[PATCH] ALSA: hda: Fix the control element identification for multiple codecs

Takashi Iwai tiwai at suse.de
Wed Feb 1 15:40:48 CET 2023


On Tue, 31 Jan 2023 10:42:15 +0100,
Jaroslav Kysela wrote:
> 
> Some motherboards have multiple HDA codecs connected to the serial bus.
> The current code may create multiple mixer controls with the almost
> identical identification.
> 
> The current code use id.device field from the control element structure
> to store the codec address to avoid such clashes for multiple codecs.
> Unfortunately, the user space do not handle this correctly. For mixer
> controls, only name and index are used for the identifiers.
> 
> This patch fixes this problem to compose the index using the codec
> address as an offset in case, when the control already exists. It is
> really unlikely that one codec will create 10 similar controls.
> 
> This patch adds new kernel module parameter 'ctl_dev_id' to allow
> select the old behaviour, too. The CONFIG_SND_HDA_CTL_DEV_ID Kconfig
> option sets the default value.
> 
> BugLink: https://github.com/alsa-project/alsa-lib/issues/294
> BugLink: https://github.com/alsa-project/alsa-lib/issues/205
> Fixes: 54d174031576 ("[ALSA] hda-codec - Fix connection list parsing")
> Fixes: 1afe206ab699 ("ALSA: hda - Try to find an empty control index when it's occupied")
> Signed-off-by: Jaroslav Kysela <perex at perex.cz>
> 
> --
> 
> rfc..v1:
>  - added CONFIG_SND_HDA_CTL_DEV_ID Kconfig option

Looks almost fine.  One thing would be to just make it a single option
instead of array.  This behavior should be consistent on the whole
system, not specific to a certain chip, after all, and the array
option is error-prone.


thanks,

Takashi


More information about the Alsa-devel mailing list