Skip to content

Commit

Permalink
ALSA: hda - Update mixer name for the lower codec address
Browse files Browse the repository at this point in the history
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 <tiwai@suse.de>
  • Loading branch information
Takashi Iwai committed Oct 15, 2015
1 parent ded255b commit 7fbe824
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 1 deletion.
4 changes: 3 additions & 1 deletion sound/pci/hda/hda_bind.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
1 change: 1 addition & 0 deletions sound/pci/hda/hda_codec.c
Original file line number Diff line number Diff line change
Expand Up @@ -851,6 +851,7 @@ int snd_hda_codec_new(struct hda_bus *bus, struct snd_card *card,
INIT_DELAYED_WORK(&codec->jackpoll_work, hda_jackpoll_work);
codec->depop_delay = -1;
codec->fixup_id = HDA_FIXUP_ID_NOT_SET;
codec->mixer_assigned = -1;

#ifdef CONFIG_PM
codec->power_jiffies = jiffies;
Expand Down
1 change: 1 addition & 0 deletions sound/pci/hda/hda_codec.h
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ struct hda_codec {
unsigned long power_off_acct;
unsigned long power_jiffies;
#endif
unsigned int mixer_assigned;

/* filter the requested power state per nid */
unsigned int (*power_filter)(struct hda_codec *codec, hda_nid_t nid,
Expand Down

0 comments on commit 7fbe824

Please sign in to comment.