summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_analog.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-08-10 17:12:15 +0200
committerJaroslav Kysela <perex@perex.cz>2007-10-16 15:58:45 +0200
commitcca3b3718ca96dca51daf1129ac03003bcede751 (patch)
tree32dc0ee54e783fe0021f26061dfbdd37beef4d1f /sound/pci/hda/patch_analog.c
parent47fd830acf0b6b5bc75db55d0f2cc64f59a23b5f (diff)
[ALSA] hda-codec - Clean up bind-controls
We have already a generic bind-control helper, so let's clean up the codes using it. Signed-off-by: Takashi Iwai <tiwai@suse.de> Signed-off-by: Jaroslav Kysela <perex@suse.cz>
Diffstat (limited to 'sound/pci/hda/patch_analog.c')
-rw-r--r--sound/pci/hda/patch_analog.c34
1 files changed, 9 insertions, 25 deletions
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index febc2053f08..f9390a544ea 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1127,23 +1127,14 @@ static int ad1981_hp_master_sw_put(struct snd_kcontrol *kcontrol,
}
/* bind volumes of both NID 0x05 and 0x06 */
-static int ad1981_hp_master_vol_put(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_value *ucontrol)
-{
- struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
- long *valp = ucontrol->value.integer.value;
- int change;
-
- change = snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0,
- HDA_AMP_VOLMASK, valp[0]);
- change |= snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0,
- HDA_AMP_VOLMASK, valp[1]);
- snd_hda_codec_amp_update(codec, 0x06, 0, HDA_OUTPUT, 0,
- HDA_AMP_VOLMASK, valp[0]);
- snd_hda_codec_amp_update(codec, 0x06, 1, HDA_OUTPUT, 0,
- HDA_AMP_VOLMASK, valp[1]);
- return change;
-}
+static struct hda_bind_ctls ad1981_hp_bind_master_vol = {
+ .ops = &snd_hda_bind_vol,
+ .values = {
+ HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
+ HDA_COMPOSE_AMP_VAL(0x06, 3, 0, HDA_OUTPUT),
+ 0
+ },
+};
/* mute internal speaker if HP is plugged */
static void ad1981_hp_automute(struct hda_codec *codec)
@@ -1204,14 +1195,7 @@ static struct hda_input_mux ad1981_hp_capture_source = {
};
static struct snd_kcontrol_new ad1981_hp_mixers[] = {
- {
- .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
- .name = "Master Playback Volume",
- .info = snd_hda_mixer_amp_volume_info,
- .get = snd_hda_mixer_amp_volume_get,
- .put = ad1981_hp_master_vol_put,
- .private_value = HDA_COMPOSE_AMP_VAL(0x05, 3, 0, HDA_OUTPUT),
- },
+ HDA_BIND_VOL("Master Playback Volume", &ad1981_hp_bind_master_vol),
{
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Master Playback Switch",