diff options
author | Takashi Iwai <tiwai@suse.de> | 2009-07-24 16:54:59 +0200 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2009-07-24 16:54:59 +0200 |
commit | a3daf68931679dbd96342099e4d61a99ba98315c (patch) | |
tree | 7460f5dfb8cb63fe2b3cc5da3cb4b869bde78bfb /sound/pci/hda/patch_realtek.c | |
parent | b5d6f93b92a37466b43ba105f524bdf046d3bb3c (diff) | |
parent | 8de56b7deb2534a586839eda52843c1dae680dc5 (diff) | |
download | lwn-a3daf68931679dbd96342099e4d61a99ba98315c.tar.gz lwn-a3daf68931679dbd96342099e4d61a99ba98315c.zip |
Merge branch 'fix/hda' into topic/hda
Diffstat (limited to 'sound/pci/hda/patch_realtek.c')
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 33 |
1 files changed, 16 insertions, 17 deletions
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index b5b36b893b1e..e1563f48243f 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c @@ -10389,6 +10389,18 @@ static void alc262_lenovo_3000_unsol_event(struct hda_codec *codec, alc262_lenovo_3000_automute(codec, 1); } +static int amp_stereo_mute_update(struct hda_codec *codec, hda_nid_t nid, + int dir, int idx, long *valp) +{ + int i, change = 0; + + for (i = 0; i < 2; i++, valp++) + change |= snd_hda_codec_amp_update(codec, nid, i, dir, idx, + HDA_AMP_MUTE, + *valp ? 0 : HDA_AMP_MUTE); + return change; +} + /* bind hp and internal speaker mute (with plug check) */ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value *ucontrol) @@ -10397,13 +10409,8 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol, long *valp = ucontrol->value.integer.value; int change; - change = snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0, - HDA_AMP_MUTE, - valp ? 0 : HDA_AMP_MUTE); - change |= snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, - HDA_AMP_MUTE, - valp ? 0 : HDA_AMP_MUTE); - + change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); + change |= amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); if (change) alc262_fujitsu_automute(codec, 0); return change; @@ -10438,10 +10445,7 @@ static int alc262_lenovo_3000_master_sw_put(struct snd_kcontrol *kcontrol, long *valp = ucontrol->value.integer.value; int change; - change = snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0, - HDA_AMP_MUTE, - valp ? 0 : HDA_AMP_MUTE); - + change = amp_stereo_mute_update(codec, 0x1b, HDA_OUTPUT, 0, valp); if (change) alc262_lenovo_3000_automute(codec, 0); return change; @@ -11612,12 +11616,7 @@ static int alc268_acer_master_sw_put(struct snd_kcontrol *kcontrol, long *valp = ucontrol->value.integer.value; int change; - change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, - HDA_AMP_MUTE, - valp[0] ? 0 : HDA_AMP_MUTE); - change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, - HDA_AMP_MUTE, - valp[1] ? 0 : HDA_AMP_MUTE); + change = amp_stereo_mute_update(codec, 0x14, HDA_OUTPUT, 0, valp); if (change) alc268_acer_automute(codec, 0); return change; |