summaryrefslogtreecommitdiff
path: root/sound/hda/core/controller.c
AgeCommit message (Collapse)Author
6 daysALSA: hda: Reset response counter when a verb times outBob Song
On some controllers the HDA link reports a verb timeout and the driver falls back to polling mode. After that, every subsequent verb sent to that codec address keeps timing out (roughly one second per verb), while the hardware itself looks perfectly healthy: the RIRB write pointer keeps advancing, interrupts are still delivered, and verbs that carry no reply payload -- notably writes -- still take effect on the codec. The reason is that bus->rirb.cmds[addr] is incremented for every verb and only decremented in snd_hdac_bus_update_rirb() when a matching RIRB response is read, without any rollback for a response that never arrives. A controller that cannot fall back to the single-command mode (chip->fallback_to_single_cmd == 0, e.g. the ACPI platform, Tegra and CIX controllers) returns an error right away and never performs the bus reset that would reinitialize CORB/RIRB and clear the counter, so a single lost response leaves bus->rirb.cmds[addr] non-zero forever. Each following verb then still gets one response that only brings the count back to the stale baseline of 1, and snd_hdac_bus_get_response() keeps timing out even though the codec answers normally. Handle it in the core helper snd_hdac_bus_exec_verb_unlocked(): whenever get_response() reports an error, reset the pending counter for the codec address, so a late response is simply treated as a spurious response and the following verbs recover. Doing it here covers all HD-audio controllers instead of relying on each controller's fallback setting. Add a small helper snd_hdac_bus_reset_response_counter() for this. Signed-off-by: Bob Song <songxiebing@kylinos.cn> Link: https://patch.msgid.link/20261010082724.1653199-1-songxiebing@kylinos.cn Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-09-28ALSA/ASoC: use assign_bit() where applicablePeng Fan
Convert open-coded if/else with set_bit/clear_bit and their non-atomic __set_bit/__clear_bit variants to the assign_bit/__assign_bit API. Done with Coccinelle semantic patch: // set_bit -> clear_bit => assign_bit @@ expression cond, bit, addr; @@ -if (cond) - set_bit(bit, addr); -else - clear_bit(bit, addr); +assign_bit(bit, addr, cond); // clear_bit -> set_bit => assign_bit @@ expression cond, bit, addr; @@ -if (cond) - clear_bit(bit, addr); -else - set_bit(bit, addr); +assign_bit(bit, addr, !cond); // __set_bit -> __clear_bit => __assign_bit @@ expression cond, bit, addr; @@ -if (cond) - __set_bit(bit, addr); -else - __clear_bit(bit, addr); +__assign_bit(bit, addr, cond); // __clear_bit -> __set_bit => __assign_bit @@ expression cond, bit, addr; @@ -if (cond) - __clear_bit(bit, addr); -else - __set_bit(bit, addr); +__assign_bit(bit, addr, !cond); Signed-off-by: Peng Fan <peng.fan@nxp.com> Acked-by: Mark Brown <broonie@kernel.org> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20260918141532.3022761-1-peng.fan@oss.nxp.com
2026-08-04ALSA: hda/core: Log stream DMA errors on interruptArun Raghavan
The stream descriptor status register reports FIFO and descriptor errors, but these are currently cleared silently along with the rest of the interrupt status. Log them, rate-limited, so DMA problems are visible instead of only manifesting as audible glitches. Observed on some AMD GPU HDMI audio controllers under specific low power circumstances. Signed-off-by: Arun Raghavan <arunr@valvesoftware.com> Cc: Arun Raghavan <arun@arunraghavan.net> Link: https://patch.msgid.link/20260803-master-v1-1-9bcedb736978@valvesoftware.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-07-07ALSA: hda/core: add cleanup in snd_hdac_bus_alloc_stream_pages()Zhao Dongdong
The current error handling in snd_hdac_bus_alloc_stream_pages() returns directly on failure without cleaning up already allocated resources. While callers are supposed to release those via snd_hdac_bus_free_stream_pages() at destructor, adding explicit cleanup makes the function more self-contained and safer against future misuse. Add proper error cleanup path using goto labels to free previously allocated BDL DMA buffers, position buffer, and ring buffer in reverse allocation order. Signed-off-by: Zhao Dongdong <zhaodongdong@kylinos.cn> Link: https://patch.msgid.link/tencent_8E5BBBD19D53B1EFCDB6E89F3B6246A70B06@qq.com Signed-off-by: Takashi Iwai <tiwai@suse.de>
2026-06-29ALSA: hda: Fix single byte writing issue for Hygon family 18h model 5hFu Hao
On Hygon family 18h model 5h controller, some registers such as GCTL, SD_CTL and SD_CTL_3B should be accessed in dword, or the writing will fail. Signed-off-by: Fu Hao <fuhao@open-hieco.net> Link: https://patch.msgid.link/dd4a0b6743751dfb495a371c135ac052191e99f6.1781523812.git.fuhao@open-hieco.net Signed-off-by: Takashi Iwai <tiwai@suse.de>
2025-12-07ALSA: hda/core: add addr_offset field for bus address translationJoakim Zhang
Add bus addr_offset field for dma address translation, for some SoCs such as CIX SKY1 which is ARM64 Arch, HOST and HDAC has different memory view, so need to do dma address translation between HOST and HDAC. Signed-off-by: Joakim Zhang <joakim.zhang@cixtech.com> Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20251205154621.3019640-3-joakim.zhang@cixtech.com
2025-08-29ALSA: hda/core: Use guard() for spinlocksTakashi Iwai
Replace the manual spin lock/unlock pairs with guard() for code simplification. Only code refactoring, and no behavior change. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250827072916.31933-24-tiwai@suse.de
2025-07-11ALSA: hda: Move HD-audio core stuff into sound/hda/coreTakashi Iwai
This is a part of HD-audio code restructuring. Simply move the current code of sound/hda/* into the subdirectory sound/hda/core, so that more stuff can be moved into sound/hda cleanly later. Most of file names with hdac_ and hdac_ext_ prefix are renamed without the prefix, since they can be identified well in the directory name and superfluous. Signed-off-by: Takashi Iwai <tiwai@suse.de> Link: https://patch.msgid.link/20250709160434.1859-3-tiwai@suse.de