linux/sound
Kai Vehmanen 8de335e819 ALSA: hda: avoid write to STATESTS if controller is in reset
[ Upstream commit b37a15188eae9d4c49c5bb035e0c8d4058e4d9b3 ]

The snd_hdac_bus_reset_link() contains logic to clear STATESTS register
before performing controller reset. This code dates back to an old
bugfix in commit e8a7f136f5 ("[ALSA] hda-intel - Improve HD-audio
codec probing robustness"). Originally the code was added to
azx_reset().

The code was moved around in commit a41d122449 ("ALSA: hda - Embed bus
into controller object") and ended up to snd_hdac_bus_reset_link() and
called primarily via snd_hdac_bus_init_chip().

The logic to clear STATESTS is correct when snd_hdac_bus_init_chip() is
called when controller is not in reset. In this case, STATESTS can be
cleared. This can be useful e.g. when forcing a controller reset to retry
codec probe. A normal non-power-on reset will not clear the bits.

However, this old logic is problematic when controller is already in
reset. The HDA specification states that controller must be taken out of
reset before writing to registers other than GCTL.CRST (1.0a spec,
3.3.7). The write to STATESTS in snd_hdac_bus_reset_link() will be lost
if the controller is already in reset per the HDA specification mentioned.

This has been harmless on older hardware. On newer generation of Intel
PCIe based HDA controllers, if configured to report issues, this write
will emit an unsupported request error. If ACPI Platform Error Interface
(APEI) is enabled in kernel, this will end up to kernel log.

Fix the code in snd_hdac_bus_reset_link() to only clear the STATESTS if
the function is called when controller is not in reset. Otherwise
clearing the bits is not possible and should be skipped.

Signed-off-by: Kai Vehmanen <kai.vehmanen@linux.intel.com>
Link: https://lore.kernel.org/r/20211012142935.3731820-1-kai.vehmanen@linux.intel.com
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Sasha Levin <sashal@kernel.org>
2021-10-27 09:54:29 +02:00
..
ac97 ALSA: ac97: fix PM reference leak in ac97_bus_remove() 2021-07-20 16:10:42 +02:00
aoa
arm
atmel
core ALSA: seq: Fix a potential UAF by wrong private_free call order 2021-10-20 11:40:12 +02:00
drivers ALSA: aloop: Fix initialization of controls 2021-04-14 08:24:09 +02:00
firewire ALSA: bebob: add support for ToneWeal FW66 2021-07-20 16:10:45 +02:00
hda ALSA: hda: avoid write to STATESTS if controller is in reset 2021-10-27 09:54:29 +02:00
i2c
isa ALSA: sb: Fix potential ABBA deadlock in CSP driver 2021-07-28 13:30:59 +02:00
mips
oss
parisc
pci ALSA: hda/realtek: Add quirk for Clevo PC50HS 2021-10-27 09:54:27 +02:00
pcmcia
ppc ALSA: ppc: fix error return code in snd_pmac_probe() 2021-07-20 16:10:44 +02:00
sh ALSA: sh: Fix compile warning wrt const 2020-02-24 08:36:42 +01:00
soc ASoC: DAPM: Fix missing kctl change notifications 2021-10-27 09:54:27 +02:00
sparc
spi
synth
usb ALSA: usb-audio: Provide quirk for Sennheiser GSP670 Headset 2021-10-27 09:54:27 +02:00
x86
xen
Kconfig
Makefile
ac97_bus.c
last.c
sound_core.c