mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
synced 2024-10-29 23:53:32 +00:00
ALSA: hda - Simplify AD1986A mixer definitions
Split mixer element arrays of AD1986A models to several pieces so that each model can share the same mixer arrays. This removes lots of duplicated data. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
4e8a2372f9
commit
16d11a829e
1 changed files with 21 additions and 56 deletions
|
@ -669,13 +669,15 @@ static struct hda_input_mux ad1986a_automic_capture_source = {
|
|||
},
|
||||
};
|
||||
|
||||
static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
|
||||
static struct snd_kcontrol_new ad1986a_laptop_master_mixers[] = {
|
||||
HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
|
||||
HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
|
||||
{ } /* end */
|
||||
};
|
||||
|
||||
static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
|
||||
HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
|
||||
HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
|
||||
|
@ -699,31 +701,9 @@ static struct snd_kcontrol_new ad1986a_laptop_eapd_mixers[] = {
|
|||
{ } /* end */
|
||||
};
|
||||
|
||||
static struct snd_kcontrol_new ad1986a_samsung_mixers[] = {
|
||||
HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
|
||||
HDA_BIND_SW("Master Playback Switch", &ad1986a_laptop_master_sw),
|
||||
HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT),
|
||||
{
|
||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||
.name = "Capture Source",
|
||||
.info = ad198x_mux_enum_info,
|
||||
.get = ad198x_mux_enum_get,
|
||||
.put = ad198x_mux_enum_put,
|
||||
},
|
||||
{
|
||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||
.name = "External Amplifier",
|
||||
.info = ad198x_eapd_info,
|
||||
.get = ad198x_eapd_get,
|
||||
.put = ad198x_eapd_put,
|
||||
.private_value = 0x1b | (1 << 8), /* port-D, inversed */
|
||||
},
|
||||
static struct snd_kcontrol_new ad1986a_laptop_intmic_mixers[] = {
|
||||
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0, HDA_OUTPUT),
|
||||
{ } /* end */
|
||||
};
|
||||
|
||||
|
@ -816,7 +796,7 @@ static int ad1986a_hp_master_sw_put(struct snd_kcontrol *kcontrol,
|
|||
return change;
|
||||
}
|
||||
|
||||
static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = {
|
||||
static struct snd_kcontrol_new ad1986a_automute_master_mixers[] = {
|
||||
HDA_BIND_VOL("Master Playback Volume", &ad1986a_laptop_master_vol),
|
||||
{
|
||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||
|
@ -826,33 +806,10 @@ static struct snd_kcontrol_new ad1986a_laptop_automute_mixers[] = {
|
|||
.put = ad1986a_hp_master_sw_put,
|
||||
.private_value = HDA_COMPOSE_AMP_VAL(0x1a, 3, 0, HDA_OUTPUT),
|
||||
},
|
||||
HDA_CODEC_VOLUME("PCM Playback Volume", 0x03, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("PCM Playback Switch", 0x03, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_VOLUME("Internal Mic Playback Volume", 0x17, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("Internal Mic Playback Switch", 0x17, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_VOLUME("Mic Playback Volume", 0x13, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("Mic Playback Switch", 0x13, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_VOLUME("Mic Boost", 0x0f, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_VOLUME("Capture Volume", 0x12, 0x0, HDA_OUTPUT),
|
||||
HDA_CODEC_MUTE("Capture Switch", 0x12, 0x0, HDA_OUTPUT),
|
||||
{
|
||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||
.name = "Capture Source",
|
||||
.info = ad198x_mux_enum_info,
|
||||
.get = ad198x_mux_enum_get,
|
||||
.put = ad198x_mux_enum_put,
|
||||
},
|
||||
{
|
||||
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
|
||||
.name = "External Amplifier",
|
||||
.info = ad198x_eapd_info,
|
||||
.get = ad198x_eapd_get,
|
||||
.put = ad198x_eapd_put,
|
||||
.private_value = 0x1b | (1 << 8), /* port-D, inversed */
|
||||
},
|
||||
{ } /* end */
|
||||
};
|
||||
|
||||
|
||||
/*
|
||||
* initialization verbs
|
||||
*/
|
||||
|
@ -1111,7 +1068,10 @@ static int patch_ad1986a(struct hda_codec *codec)
|
|||
spec->multiout.dac_nids = ad1986a_laptop_dac_nids;
|
||||
break;
|
||||
case AD1986A_LAPTOP_EAPD:
|
||||
spec->mixers[0] = ad1986a_laptop_eapd_mixers;
|
||||
spec->num_mixers = 3;
|
||||
spec->mixers[0] = ad1986a_laptop_master_mixers;
|
||||
spec->mixers[1] = ad1986a_laptop_eapd_mixers;
|
||||
spec->mixers[2] = ad1986a_laptop_intmic_mixers;
|
||||
spec->num_init_verbs = 2;
|
||||
spec->init_verbs[1] = ad1986a_eapd_init_verbs;
|
||||
spec->multiout.max_channels = 2;
|
||||
|
@ -1122,7 +1082,9 @@ static int patch_ad1986a(struct hda_codec *codec)
|
|||
spec->input_mux = &ad1986a_laptop_eapd_capture_source;
|
||||
break;
|
||||
case AD1986A_SAMSUNG:
|
||||
spec->mixers[0] = ad1986a_samsung_mixers;
|
||||
spec->num_mixers = 2;
|
||||
spec->mixers[0] = ad1986a_laptop_master_mixers;
|
||||
spec->mixers[1] = ad1986a_laptop_eapd_mixers;
|
||||
spec->num_init_verbs = 3;
|
||||
spec->init_verbs[1] = ad1986a_eapd_init_verbs;
|
||||
spec->init_verbs[2] = ad1986a_automic_verbs;
|
||||
|
@ -1136,7 +1098,10 @@ static int patch_ad1986a(struct hda_codec *codec)
|
|||
codec->patch_ops.init = ad1986a_automic_init;
|
||||
break;
|
||||
case AD1986A_LAPTOP_AUTOMUTE:
|
||||
spec->mixers[0] = ad1986a_laptop_automute_mixers;
|
||||
spec->num_mixers = 3;
|
||||
spec->mixers[0] = ad1986a_automute_master_mixers;
|
||||
spec->mixers[1] = ad1986a_laptop_eapd_mixers;
|
||||
spec->mixers[2] = ad1986a_laptop_intmic_mixers;
|
||||
spec->num_init_verbs = 3;
|
||||
spec->init_verbs[1] = ad1986a_eapd_init_verbs;
|
||||
spec->init_verbs[2] = ad1986a_hp_init_verbs;
|
||||
|
|
Loading…
Reference in a new issue