linux-stable/sound
Takashi Iwai f785f5ee96 ALSA: hda/hdmi: Preserve the previous PCM device upon re-enablement
When a DRM driver turns on or off the screen with the audio
capability, it notifies the ELD to HD-audio HDMI codec driver via
component ops.  HDMI codec driver, in turn, attaches or detaches the
PCM stream for the given port on the fly.

The problem is that, since the recent code change, the HDMI driver
always treats the PCM stream assignment dynamically; this ended up the
confusion of the PCM device appearance.  e.g. when a screen goes once
off and on again, it may appear on a different PCM device before the
screen-off.  Although the application should treat such a change, it
doesn't seem working gracefully with the current pipewire (maybe
PulseAudio, too).

As a workaround, this patch changes the HDMI codec driver behavior
slightly to be more consistent.  Now it remembers the previous PCM
slot for the given port and try to assign to it.  That is, if a port
is re-enabled, the driver tries to use the same PCM slot that was
assigned to that port previously.  If it conflicts, a new slot is
searched and used like before, instead.

Note that multiple monitor connections are the only typical case where
the PCM slot preservation is effective.  As long as only a single
monitor is connected, the behavior isn't changed, and the first PCM
slot is still assigned always.

Fixes: ef6f5494fa ("ALSA: hda/hdmi: Use only dynamic PCM device allocation")
Reviewed-by: Jaroslav Kysela <perex@perex.cz>
Link: https://bugzilla.kernel.org/show_bug.cgi?id=217259
Link: https://lore.kernel.org/r/20230331142217.19791-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
2023-04-01 18:05:48 +02:00
..
ac97 ALSA: ac97: make remove callback of ac97 driver void returned 2023-01-25 09:34:20 +01:00
aoa Driver core changes for 6.3-rc1 2023-02-24 12:58:55 -08:00
arm ALSA: arm: pxa: pxa2xx-ac97-lib: fix return value check of platform_get_irq() 2022-10-29 10:45:27 +02:00
atmel
core ALSA: usb-audio: Fix recursive locking at XRUN during syncing 2023-03-21 07:10:43 +01:00
drivers ALSA: mts64: fix possible null-ptr-defer in snd_mts64_interrupt 2022-12-06 11:12:12 +01:00
firewire Merge branch 'topic/apple-gmux' into for-next 2023-02-16 14:18:54 +01:00
hda ALSA: hda: intel-dsp-config: add MTL PCI id 2023-03-08 06:37:19 +01:00
i2c treewide: Convert del_timer*() to timer_shutdown*() 2022-12-25 13:38:09 -08:00
isa ALSA: sb: Use DIV_ROUND_UP() instead of open-coding it 2022-09-29 08:11:55 +02:00
mips
oss sound: oss: dmasound: remove software_input_volume declaration 2022-09-09 09:11:06 +02:00
parisc
pci ALSA: hda/hdmi: Preserve the previous PCM device upon re-enablement 2023-04-01 18:05:48 +02:00
pcmcia ALSA: pdaudiocf: Drop superfluous GFP setup 2022-08-24 08:00:26 +02:00
ppc ALSA: ppc: fix unused function local variable 2023-02-09 08:04:36 +01:00
sh
soc ASoC: SOF: avoid a NULL dereference with unsupported widgets 2023-03-29 14:40:18 +01:00
sparc
spi sound:spi: remove reference to AVR32 in Atmel AT73C213 DAC driver 2022-08-03 11:11:26 +02:00
synth ALSA: emux: Avoid potential array out-of-bound in snd_emux_xg_control() 2023-02-07 14:32:33 +01:00
usb ALSA: usb-audio: Fix regression on detection of Roland VS-100 2023-03-24 08:50:51 +01:00
virtio
x86
xen xen: make remove callback of xen driver void returned 2022-12-15 16:06:10 +01:00
Kconfig mfd: remove ucb1400 support 2023-02-01 17:23:38 +01:00
Makefile
ac97_bus.c
last.c
sound_core.c driver core: make struct class.devnode() take a const * 2022-11-24 17:12:27 +01:00