aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/hda_codec.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/hda_codec.c')
-rw-r--r--sound/pci/hda/hda_codec.c38
1 files changed, 26 insertions, 12 deletions
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 1d31da47bc9b..043529308676 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -842,6 +842,19 @@ int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
842 return 1; 842 return 1;
843} 843}
844 844
845/*
846 * update the AMP stereo with the same mask and value
847 */
848int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
849 int direction, int idx, int mask, int val)
850{
851 int ch, ret = 0;
852 for (ch = 0; ch < 2; ch++)
853 ret |= snd_hda_codec_amp_update(codec, nid, ch, direction,
854 idx, mask, val);
855 return ret;
856}
857
845#ifdef CONFIG_PM 858#ifdef CONFIG_PM
846/* resume the all amp commands from the cache */ 859/* resume the all amp commands from the cache */
847void snd_hda_codec_resume_amp(struct hda_codec *codec) 860void snd_hda_codec_resume_amp(struct hda_codec *codec)
@@ -913,9 +926,11 @@ int snd_hda_mixer_amp_volume_get(struct snd_kcontrol *kcontrol,
913 long *valp = ucontrol->value.integer.value; 926 long *valp = ucontrol->value.integer.value;
914 927
915 if (chs & 1) 928 if (chs & 1)
916 *valp++ = snd_hda_codec_amp_read(codec, nid, 0, dir, idx) & 0x7f; 929 *valp++ = snd_hda_codec_amp_read(codec, nid, 0, dir, idx)
930 & HDA_AMP_VOLMASK;
917 if (chs & 2) 931 if (chs & 2)
918 *valp = snd_hda_codec_amp_read(codec, nid, 1, dir, idx) & 0x7f; 932 *valp = snd_hda_codec_amp_read(codec, nid, 1, dir, idx)
933 & HDA_AMP_VOLMASK;
919 return 0; 934 return 0;
920} 935}
921 936
@@ -992,10 +1007,10 @@ int snd_hda_mixer_amp_switch_get(struct snd_kcontrol *kcontrol,
992 1007
993 if (chs & 1) 1008 if (chs & 1)
994 *valp++ = (snd_hda_codec_amp_read(codec, nid, 0, dir, idx) & 1009 *valp++ = (snd_hda_codec_amp_read(codec, nid, 0, dir, idx) &
995 0x80) ? 0 : 1; 1010 HDA_AMP_MUTE) ? 0 : 1;
996 if (chs & 2) 1011 if (chs & 2)
997 *valp = (snd_hda_codec_amp_read(codec, nid, 1, dir, idx) & 1012 *valp = (snd_hda_codec_amp_read(codec, nid, 1, dir, idx) &
998 0x80) ? 0 : 1; 1013 HDA_AMP_MUTE) ? 0 : 1;
999 return 0; 1014 return 0;
1000} 1015}
1001 1016
@@ -1012,12 +1027,14 @@ int snd_hda_mixer_amp_switch_put(struct snd_kcontrol *kcontrol,
1012 1027
1013 if (chs & 1) { 1028 if (chs & 1) {
1014 change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx, 1029 change = snd_hda_codec_amp_update(codec, nid, 0, dir, idx,
1015 0x80, *valp ? 0 : 0x80); 1030 HDA_AMP_MUTE,
1031 *valp ? 0 : HDA_AMP_MUTE);
1016 valp++; 1032 valp++;
1017 } 1033 }
1018 if (chs & 2) 1034 if (chs & 2)
1019 change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx, 1035 change |= snd_hda_codec_amp_update(codec, nid, 1, dir, idx,
1020 0x80, *valp ? 0 : 0x80); 1036 HDA_AMP_MUTE,
1037 *valp ? 0 : HDA_AMP_MUTE);
1021 1038
1022 return change; 1039 return change;
1023} 1040}
@@ -1318,12 +1335,9 @@ static int snd_hda_spdif_out_switch_put(struct snd_kcontrol *kcontrol,
1318 val & 0xff); 1335 val & 0xff);
1319 /* unmute amp switch (if any) */ 1336 /* unmute amp switch (if any) */
1320 if ((get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) && 1337 if ((get_wcaps(codec, nid) & AC_WCAP_OUT_AMP) &&
1321 (val & AC_DIG1_ENABLE)) { 1338 (val & AC_DIG1_ENABLE))
1322 snd_hda_codec_amp_update(codec, nid, 0, HDA_OUTPUT, 0, 1339 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
1323 0x80, 0x00); 1340 HDA_AMP_MUTE, 0);
1324 snd_hda_codec_amp_update(codec, nid, 1, HDA_OUTPUT, 0,
1325 0x80, 0x00);
1326 }
1327 } 1341 }
1328 mutex_unlock(&codec->spdif_mutex); 1342 mutex_unlock(&codec->spdif_mutex);
1329 return change; 1343 return change;