Commit 9d0b71b1 authored by Takashi Iwai's avatar Takashi Iwai

ALSA: hda - Reuse ALC268 parser for ALC269

Reuse a part of the code of ALC268 parser for ALC269.
This will change the default output volume either to Front or Speaker
depending on the pin configuration.
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent fd72d008
...@@ -13086,87 +13086,8 @@ static struct hda_verb alc269_init_verbs[] = { ...@@ -13086,87 +13086,8 @@ static struct hda_verb alc269_init_verbs[] = {
{ } { }
}; };
/* add playback controls from the parsed DAC table */ #define alc269_auto_create_multi_out_ctls \
static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec, alc268_auto_create_multi_out_ctls
const struct auto_pin_cfg *cfg)
{
hda_nid_t nid;
int err;
spec->multiout.num_dacs = 1; /* only use one dac */
spec->multiout.dac_nids = spec->private_dac_nids;
spec->multiout.dac_nids[0] = 2;
nid = cfg->line_out_pins[0];
if (nid) {
err = add_control(spec, ALC_CTL_WIDGET_VOL,
"Front Playback Volume",
HDA_COMPOSE_AMP_VAL(0x02, 3, 0, HDA_OUTPUT));
if (err < 0)
return err;
err = add_control(spec, ALC_CTL_WIDGET_MUTE,
"Front Playback Switch",
HDA_COMPOSE_AMP_VAL(nid, 3, 0, HDA_OUTPUT));
if (err < 0)
return err;
}
nid = cfg->speaker_pins[0];
if (nid) {
if (!cfg->line_out_pins[0]) {
err = add_control(spec, ALC_CTL_WIDGET_VOL,
"Speaker Playback Volume",
HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
HDA_OUTPUT));
if (err < 0)
return err;
}
if (nid == 0x16) {
err = add_control(spec, ALC_CTL_WIDGET_MUTE,
"Speaker Playback Switch",
HDA_COMPOSE_AMP_VAL(nid, 2, 0,
HDA_OUTPUT));
if (err < 0)
return err;
} else {
err = add_control(spec, ALC_CTL_WIDGET_MUTE,
"Speaker Playback Switch",
HDA_COMPOSE_AMP_VAL(nid, 3, 0,
HDA_OUTPUT));
if (err < 0)
return err;
}
}
nid = cfg->hp_pins[0];
if (nid) {
/* spec->multiout.hp_nid = 2; */
if (!cfg->line_out_pins[0] && !cfg->speaker_pins[0]) {
err = add_control(spec, ALC_CTL_WIDGET_VOL,
"Headphone Playback Volume",
HDA_COMPOSE_AMP_VAL(0x02, 3, 0,
HDA_OUTPUT));
if (err < 0)
return err;
}
if (nid == 0x16) {
err = add_control(spec, ALC_CTL_WIDGET_MUTE,
"Headphone Playback Switch",
HDA_COMPOSE_AMP_VAL(nid, 2, 0,
HDA_OUTPUT));
if (err < 0)
return err;
} else {
err = add_control(spec, ALC_CTL_WIDGET_MUTE,
"Headphone Playback Switch",
HDA_COMPOSE_AMP_VAL(nid, 3, 0,
HDA_OUTPUT));
if (err < 0)
return err;
}
}
return 0;
}
#define alc269_auto_create_analog_input_ctls \ #define alc269_auto_create_analog_input_ctls \
alc262_auto_create_analog_input_ctls alc262_auto_create_analog_input_ctls
......
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