Commit 033688a5 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Add multiple headphone support to ALC262 codec

This patch changes the alc262 auto-parser to allow multiple pins
assigned for a single purpose (line-out, headphone or speaker).
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent bb35febd
...@@ -11824,7 +11824,7 @@ static int alc262_check_volbit(hda_nid_t nid) ...@@ -11824,7 +11824,7 @@ static int alc262_check_volbit(hda_nid_t nid)
} }
static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
const char *pfx, int *vbits) const char *pfx, int *vbits, int idx)
{ {
unsigned long val; unsigned long val;
int vbit; int vbit;
...@@ -11839,11 +11839,11 @@ static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid, ...@@ -11839,11 +11839,11 @@ static int alc262_add_out_vol_ctl(struct alc_spec *spec, hda_nid_t nid,
val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT); val = HDA_COMPOSE_AMP_VAL(0x0e, 2, 0, HDA_OUTPUT);
else else
val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT); val = HDA_COMPOSE_AMP_VAL(0x0c, 3, 0, HDA_OUTPUT);
return add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, val); return __add_pb_vol_ctrl(spec, ALC_CTL_WIDGET_VOL, pfx, idx, val);
} }
static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
const char *pfx) const char *pfx, int idx)
{ {
unsigned long val; unsigned long val;
...@@ -11853,7 +11853,7 @@ static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid, ...@@ -11853,7 +11853,7 @@ static int alc262_add_out_sw_ctl(struct alc_spec *spec, hda_nid_t nid,
val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT); val = HDA_COMPOSE_AMP_VAL(nid, 2, 0, HDA_OUTPUT);
else else
val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT); val = HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT);
return add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, val); return __add_pb_sw_ctrl(spec, ALC_CTL_WIDGET_MUTE, pfx, idx, val);
} }
/* add playback controls from the parsed DAC table */ /* add playback controls from the parsed DAC table */
...@@ -11862,7 +11862,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, ...@@ -11862,7 +11862,7 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
{ {
const char *pfx; const char *pfx;
int vbits; int vbits;
int err; int i, err;
spec->multiout.num_dacs = 1; /* only use one dac */ spec->multiout.num_dacs = 1; /* only use one dac */
spec->multiout.dac_nids = spec->private_dac_nids; spec->multiout.dac_nids = spec->private_dac_nids;
...@@ -11872,39 +11872,52 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec, ...@@ -11872,39 +11872,52 @@ static int alc262_auto_create_multi_out_ctls(struct alc_spec *spec,
pfx = "Master"; pfx = "Master";
else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT) else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
pfx = "Speaker"; pfx = "Speaker";
else if (cfg->line_out_type == AUTO_PIN_HP_OUT)
pfx = "Headphone";
else else
pfx = "Front"; pfx = "Front";
err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[0], pfx); for (i = 0; i < 2; i++) {
if (err < 0) err = alc262_add_out_sw_ctl(spec, cfg->line_out_pins[i], pfx, i);
return err; if (err < 0)
err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[0], "Speaker"); return err;
if (err < 0) if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
return err; err = alc262_add_out_sw_ctl(spec, cfg->speaker_pins[i],
err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[0], "Headphone"); "Speaker", i);
if (err < 0) if (err < 0)
return err; return err;
}
if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
err = alc262_add_out_sw_ctl(spec, cfg->hp_pins[i],
"Headphone", i);
if (err < 0)
return err;
}
}
vbits = alc262_check_volbit(cfg->line_out_pins[0]) | vbits = alc262_check_volbit(cfg->line_out_pins[0]) |
alc262_check_volbit(cfg->speaker_pins[0]) | alc262_check_volbit(cfg->speaker_pins[0]) |
alc262_check_volbit(cfg->hp_pins[0]); alc262_check_volbit(cfg->hp_pins[0]);
if (vbits == 1 || vbits == 2) if (vbits == 1 || vbits == 2)
pfx = "Master"; /* only one mixer is used */ pfx = "Master"; /* only one mixer is used */
else if (cfg->line_out_type == AUTO_PIN_SPEAKER_OUT)
pfx = "Speaker";
else
pfx = "Front";
vbits = 0; vbits = 0;
err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[0], pfx, &vbits); for (i = 0; i < 2; i++) {
if (err < 0) err = alc262_add_out_vol_ctl(spec, cfg->line_out_pins[i], pfx,
return err; &vbits, i);
err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[0], "Speaker", if (err < 0)
&vbits); return err;
if (err < 0) if (cfg->line_out_type != AUTO_PIN_SPEAKER_OUT) {
return err; err = alc262_add_out_vol_ctl(spec, cfg->speaker_pins[i],
err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[0], "Headphone", "Speaker", &vbits, i);
&vbits); if (err < 0)
if (err < 0) return err;
return err; }
if (cfg->line_out_type != AUTO_PIN_HP_OUT) {
err = alc262_add_out_vol_ctl(spec, cfg->hp_pins[i],
"Headphone", &vbits, i);
if (err < 0)
return err;
}
}
return 0; return 0;
} }
......
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