From 7fbe824a0f0e6a73de5b589a6690294f7cb9dae3 Mon Sep 17 00:00:00 2001 From: Takashi Iwai Date: Thu, 15 Oct 2015 14:06:14 +0200 Subject: ALSA: hda - Update mixer name for the lower codec address In most cases, we prefer the onboard codec as the primary device, thus it's better to set it as the mixer name. Currently, however, the mixer name is updated per the device instantiation order, and user gets often HDMI/DP or other seen as a mixer chip name. Also, if a codec name is renamed by the driver, the old chip name might be left still as the mixer name. This patch addresses these issues by remembering the chip address that was referred as the mixer name. When a codec with the same or lower address gives its name, renew the mixer name accordingly, as it's either the update of the codec name or we get likely the more appropriate chip as the reference. Signed-off-by: Takashi Iwai --- sound/pci/hda/hda_bind.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'sound/pci/hda/hda_bind.c') diff --git a/sound/pci/hda/hda_bind.c b/sound/pci/hda/hda_bind.c index ef6b8f836a87..021bcce59447 100644 --- a/sound/pci/hda/hda_bind.c +++ b/sound/pci/hda/hda_bind.c @@ -61,10 +61,12 @@ int snd_hda_codec_set_name(struct hda_codec *codec, const char *name) return err; /* update the mixer name */ - if (!*codec->card->mixername) { + if (!*codec->card->mixername || + codec->mixer_assigned >= codec->core.addr) { snprintf(codec->card->mixername, sizeof(codec->card->mixername), "%s %s", codec->core.vendor_name, codec->core.chip_name); + codec->mixer_assigned = codec->core.addr; } return 0; -- cgit v1.2.3