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: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2009-08-24 14:10:30 +02:00
parent fd72d00846
commit 9d0b71b1cf
1 changed files with 2 additions and 81 deletions

View File

@ -13086,87 +13086,8 @@ static struct hda_verb alc269_init_verbs[] = {
{ }
};
/* add playback controls from the parsed DAC table */
static int alc269_auto_create_multi_out_ctls(struct alc_spec *spec,
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_multi_out_ctls \
alc268_auto_create_multi_out_ctls
#define alc269_auto_create_analog_input_ctls \
alc262_auto_create_analog_input_ctls