Skip to content

Commit

Permalink
ALSA: HDA: Fix DAC assignment for secondary headphone on Sigmatel/IDT
Browse files Browse the repository at this point in the history
If we run out of DACs when trying to assign a DAC to a secondary
headphone, prefer the DAC of the first headphone to the primary
(usually line out) DAC.

BugLink: http://bugs.launchpad.net/bugs/845275
Signed-off-by: David Henningsson <david.henningsson@canonical.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
  • Loading branch information
David Henningsson authored and Takashi Iwai committed Oct 5, 2011
1 parent ce662bb commit 48718ea
Showing 1 changed file with 15 additions and 3 deletions.
18 changes: 15 additions & 3 deletions sound/pci/hda/patch_sigmatel.c
Original file line number Diff line number Diff line change
Expand Up @@ -2972,8 +2972,9 @@ static int check_all_dac_nids(struct sigmatel_spec *spec, hda_nid_t nid)
static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid)
{
struct sigmatel_spec *spec = codec->spec;
struct auto_pin_cfg *cfg = &spec->autocfg;
int j, conn_len;
hda_nid_t conn[HDA_MAX_CONNECTIONS];
hda_nid_t conn[HDA_MAX_CONNECTIONS], fallback_dac;
unsigned int wcaps, wtype;

conn_len = snd_hda_get_connections(codec, nid, conn,
Expand Down Expand Up @@ -3001,10 +3002,21 @@ static hda_nid_t get_unassigned_dac(struct hda_codec *codec, hda_nid_t nid)
return conn[j];
}
}
/* if all DACs are already assigned, connect to the primary DAC */

/* if all DACs are already assigned, connect to the primary DAC,
unless we're assigning a secondary headphone */
fallback_dac = spec->multiout.dac_nids[0];
if (spec->multiout.hp_nid) {
for (j = 0; j < cfg->hp_outs; j++)
if (cfg->hp_pins[j] == nid) {
fallback_dac = spec->multiout.hp_nid;
break;
}
}

if (conn_len > 1) {
for (j = 0; j < conn_len; j++) {
if (conn[j] == spec->multiout.dac_nids[0]) {
if (conn[j] == fallback_dac) {
snd_hda_codec_write_cache(codec, nid, 0,
AC_VERB_SET_CONNECT_SEL, j);
break;
Expand Down

0 comments on commit 48718ea

Please sign in to comment.