Commit 489008cd authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Fix ALC882 DAC connections in auto mode

Assign DACs properly to each output.  Currently, the front output is bound
to HP/speaker outputs blindly, but they should be assigned to individual
DACs.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 92ab7b8f
...@@ -10191,21 +10191,21 @@ static int alc882_auto_create_input_ctls(struct hda_codec *codec, ...@@ -10191,21 +10191,21 @@ static int alc882_auto_create_input_ctls(struct hda_codec *codec,
static void alc882_auto_set_output_and_unmute(struct hda_codec *codec, static void alc882_auto_set_output_and_unmute(struct hda_codec *codec,
hda_nid_t nid, int pin_type, hda_nid_t nid, int pin_type,
int dac_idx) hda_nid_t dac)
{ {
/* set as output */
struct alc_spec *spec = codec->spec;
int idx; int idx;
printk("XXX set output pin %x, dac %x\n", nid, dac);
/* set as output */
alc_set_pin_output(codec, nid, pin_type); alc_set_pin_output(codec, nid, pin_type);
if (dac_idx >= spec->multiout.num_dacs)
return; if (dac == 0x25)
if (spec->multiout.dac_nids[dac_idx] == 0x25)
idx = 4; idx = 4;
else if (dac >= 0x02 && dac <= 0x05)
idx = dac - 2;
else else
idx = spec->multiout.dac_nids[dac_idx] - 2; return;
snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx); snd_hda_codec_write(codec, nid, 0, AC_VERB_SET_CONNECT_SEL, idx);
} }
static void alc882_auto_init_multi_out(struct hda_codec *codec) static void alc882_auto_init_multi_out(struct hda_codec *codec)
...@@ -10218,22 +10218,29 @@ static void alc882_auto_init_multi_out(struct hda_codec *codec) ...@@ -10218,22 +10218,29 @@ static void alc882_auto_init_multi_out(struct hda_codec *codec)
int pin_type = get_pin_type(spec->autocfg.line_out_type); int pin_type = get_pin_type(spec->autocfg.line_out_type);
if (nid) if (nid)
alc882_auto_set_output_and_unmute(codec, nid, pin_type, alc882_auto_set_output_and_unmute(codec, nid, pin_type,
i); spec->multiout.dac_nids[i]);
} }
} }
static void alc882_auto_init_hp_out(struct hda_codec *codec) static void alc882_auto_init_hp_out(struct hda_codec *codec)
{ {
struct alc_spec *spec = codec->spec; struct alc_spec *spec = codec->spec;
hda_nid_t pin; hda_nid_t pin, dac;
pin = spec->autocfg.hp_pins[0]; pin = spec->autocfg.hp_pins[0];
if (pin) /* connect to front */ if (pin) {
/* use dac 0 */ dac = spec->multiout.hp_nid;
alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, 0); if (!dac)
dac = spec->multiout.dac_nids[0]; /* to front */
alc882_auto_set_output_and_unmute(codec, pin, PIN_HP, dac);
}
pin = spec->autocfg.speaker_pins[0]; pin = spec->autocfg.speaker_pins[0];
if (pin) if (pin) {
alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, 0); dac = spec->multiout.extra_out_nid[0];
if (!dac)
dac = spec->multiout.dac_nids[0]; /* to front */
alc882_auto_set_output_and_unmute(codec, pin, PIN_OUT, dac);
}
} }
static void alc882_auto_init_analog_input(struct hda_codec *codec) static void alc882_auto_init_analog_input(struct hda_codec *codec)
...@@ -10347,6 +10354,10 @@ static int alc882_parse_auto_config(struct hda_codec *codec) ...@@ -10347,6 +10354,10 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
if (err < 0) if (err < 0)
return err; return err;
err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg); err = alc880_auto_create_multi_out_ctls(spec, &spec->autocfg);
if (err < 0)
return err;
err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
"Headphone");
if (err < 0) if (err < 0)
return err; return err;
err = alc880_auto_create_extra_out(spec, err = alc880_auto_create_extra_out(spec,
...@@ -10354,10 +10365,6 @@ static int alc882_parse_auto_config(struct hda_codec *codec) ...@@ -10354,10 +10365,6 @@ static int alc882_parse_auto_config(struct hda_codec *codec)
"Speaker"); "Speaker");
if (err < 0) if (err < 0)
return err; return err;
err = alc880_auto_create_extra_out(spec, spec->autocfg.hp_pins[0],
"Headphone");
if (err < 0)
return err;
err = alc882_auto_create_input_ctls(codec, &spec->autocfg); err = alc882_auto_create_input_ctls(codec, &spec->autocfg);
if (err < 0) if (err < 0)
return err; return err;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment