aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/pci/hda/hda_codec.c38
-rw-r--r--sound/pci/hda/hda_generic.c8
-rw-r--r--sound/pci/hda/hda_local.h7
-rw-r--r--sound/pci/hda/patch_analog.c21
-rw-r--r--sound/pci/hda/patch_conexant.c66
-rw-r--r--sound/pci/hda/patch_realtek.c325
-rw-r--r--sound/pci/hda/patch_sigmatel.c18
7 files changed, 205 insertions, 278 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;
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index d5f1180115ce..91cd9b9ea5d1 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -218,8 +218,7 @@ static int unmute_output(struct hda_codec *codec, struct hda_gnode *node)
218 ofs = (node->amp_out_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT; 218 ofs = (node->amp_out_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT;
219 if (val >= ofs) 219 if (val >= ofs)
220 val -= ofs; 220 val -= ofs;
221 snd_hda_codec_amp_update(codec, node->nid, 0, HDA_OUTPUT, 0, 0xff, val); 221 snd_hda_codec_amp_stereo(codec, node->nid, HDA_OUTPUT, 0, 0xff, val);
222 snd_hda_codec_amp_update(codec, node->nid, 0, HDA_OUTPUT, 1, 0xff, val);
223 return 0; 222 return 0;
224} 223}
225 224
@@ -234,10 +233,7 @@ static int unmute_input(struct hda_codec *codec, struct hda_gnode *node, unsigne
234 ofs = (node->amp_in_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT; 233 ofs = (node->amp_in_caps & AC_AMPCAP_OFFSET) >> AC_AMPCAP_OFFSET_SHIFT;
235 if (val >= ofs) 234 if (val >= ofs)
236 val -= ofs; 235 val -= ofs;
237 snd_hda_codec_amp_update(codec, node->nid, 0, HDA_INPUT, index, 236 snd_hda_codec_amp_stereo(codec, node->nid, HDA_INPUT, index, 0xff, val);
238 0xff, val);
239 snd_hda_codec_amp_update(codec, node->nid, 1, HDA_INPUT, index,
240 0xff, val);
241 return 0; 237 return 0;
242} 238}
243 239
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index 8dec32cfdf54..35ea0cf37a27 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -84,10 +84,17 @@ int snd_hda_codec_amp_read(struct hda_codec *codec, hda_nid_t nid, int ch,
84 int direction, int index); 84 int direction, int index);
85int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch, 85int snd_hda_codec_amp_update(struct hda_codec *codec, hda_nid_t nid, int ch,
86 int direction, int idx, int mask, int val); 86 int direction, int idx, int mask, int val);
87int snd_hda_codec_amp_stereo(struct hda_codec *codec, hda_nid_t nid,
88 int dir, int idx, int mask, int val);
87#ifdef CONFIG_PM 89#ifdef CONFIG_PM
88void snd_hda_codec_resume_amp(struct hda_codec *codec); 90void snd_hda_codec_resume_amp(struct hda_codec *codec);
89#endif 91#endif
90 92
93/* amp value bits */
94#define HDA_AMP_MUTE 0x80
95#define HDA_AMP_UNMUTE 0x00
96#define HDA_AMP_VOLMASK 0x7f
97
91/* mono switch binding multiple inputs */ 98/* mono switch binding multiple inputs */
92#define HDA_BIND_MUTE_MONO(xname, nid, channel, indices, direction) \ 99#define HDA_BIND_MUTE_MONO(xname, nid, channel, indices, direction) \
93 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \ 100 { .iface = SNDRV_CTL_ELEM_IFACE_MIXER, .name = xname, .index = 0, \
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index f20ddd85db22..febc2053f08e 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -1120,10 +1120,9 @@ static int ad1981_hp_master_sw_put(struct snd_kcontrol *kcontrol,
1120 return 0; 1120 return 0;
1121 1121
1122 /* toggle HP mute appropriately */ 1122 /* toggle HP mute appropriately */
1123 snd_hda_codec_amp_update(codec, 0x06, 0, HDA_OUTPUT, 0, 1123 snd_hda_codec_amp_stereo(codec, 0x06, HDA_OUTPUT, 0,
1124 0x80, spec->cur_eapd ? 0 : 0x80); 1124 HDA_AMP_MUTE,
1125 snd_hda_codec_amp_update(codec, 0x06, 1, HDA_OUTPUT, 0, 1125 spec->cur_eapd ? 0 : HDA_AMP_MUTE);
1126 0x80, spec->cur_eapd ? 0 : 0x80);
1127 return 1; 1126 return 1;
1128} 1127}
1129 1128
@@ -1136,13 +1135,13 @@ static int ad1981_hp_master_vol_put(struct snd_kcontrol *kcontrol,
1136 int change; 1135 int change;
1137 1136
1138 change = snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, 1137 change = snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0,
1139 0x7f, valp[0] & 0x7f); 1138 HDA_AMP_VOLMASK, valp[0]);
1140 change |= snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, 1139 change |= snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0,
1141 0x7f, valp[1] & 0x7f); 1140 HDA_AMP_VOLMASK, valp[1]);
1142 snd_hda_codec_amp_update(codec, 0x06, 0, HDA_OUTPUT, 0, 1141 snd_hda_codec_amp_update(codec, 0x06, 0, HDA_OUTPUT, 0,
1143 0x7f, valp[0] & 0x7f); 1142 HDA_AMP_VOLMASK, valp[0]);
1144 snd_hda_codec_amp_update(codec, 0x06, 1, HDA_OUTPUT, 0, 1143 snd_hda_codec_amp_update(codec, 0x06, 1, HDA_OUTPUT, 0,
1145 0x7f, valp[1] & 0x7f); 1144 HDA_AMP_VOLMASK, valp[1]);
1146 return change; 1145 return change;
1147} 1146}
1148 1147
@@ -1153,10 +1152,8 @@ static void ad1981_hp_automute(struct hda_codec *codec)
1153 1152
1154 present = snd_hda_codec_read(codec, 0x06, 0, 1153 present = snd_hda_codec_read(codec, 0x06, 0,
1155 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1154 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1156 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, 1155 snd_hda_codec_amp_stereo(codec, 0x05, HDA_OUTPUT, 0,
1157 0x80, present ? 0x80 : 0); 1156 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
1158 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0,
1159 0x80, present ? 0x80 : 0);
1160} 1157}
1161 1158
1162/* toggle input of built-in and mic jack appropriately */ 1159/* toggle input of built-in and mic jack appropriately */
diff --git a/sound/pci/hda/patch_conexant.c b/sound/pci/hda/patch_conexant.c
index f1b6d0eda140..ebf83275756e 100644
--- a/sound/pci/hda/patch_conexant.c
+++ b/sound/pci/hda/patch_conexant.c
@@ -472,13 +472,13 @@ static int cxt5045_hp_master_sw_put(struct snd_kcontrol *kcontrol,
472 /* toggle internal speakers mute depending of presence of 472 /* toggle internal speakers mute depending of presence of
473 * the headphone jack 473 * the headphone jack
474 */ 474 */
475 bits = (!spec->hp_present && spec->cur_eapd) ? 0 : 0x80; 475 bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE;
476 snd_hda_codec_amp_update(codec, 0x10, 0, HDA_OUTPUT, 0, 0x80, bits); 476 snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0,
477 snd_hda_codec_amp_update(codec, 0x10, 1, HDA_OUTPUT, 0, 0x80, bits); 477 HDA_AMP_MUTE, bits);
478 478
479 bits = spec->cur_eapd ? 0 : 0x80; 479 bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE;
480 snd_hda_codec_amp_update(codec, 0x11, 0, HDA_OUTPUT, 0, 0x80, bits); 480 snd_hda_codec_amp_stereo(codec, 0x11, HDA_OUTPUT, 0,
481 snd_hda_codec_amp_update(codec, 0x11, 1, HDA_OUTPUT, 0, 0x80, bits); 481 HDA_AMP_MUTE, bits);
482 return 1; 482 return 1;
483} 483}
484 484
@@ -491,13 +491,13 @@ static int cxt5045_hp_master_vol_put(struct snd_kcontrol *kcontrol,
491 int change; 491 int change;
492 492
493 change = snd_hda_codec_amp_update(codec, 0x10, 0, HDA_OUTPUT, 0, 493 change = snd_hda_codec_amp_update(codec, 0x10, 0, HDA_OUTPUT, 0,
494 0x7f, valp[0] & 0x7f); 494 HDA_AMP_VOLMASK, valp[0]);
495 change |= snd_hda_codec_amp_update(codec, 0x10, 1, HDA_OUTPUT, 0, 495 change |= snd_hda_codec_amp_update(codec, 0x10, 1, HDA_OUTPUT, 0,
496 0x7f, valp[1] & 0x7f); 496 HDA_AMP_VOLMASK, valp[1]);
497 snd_hda_codec_amp_update(codec, 0x11, 0, HDA_OUTPUT, 0, 497 snd_hda_codec_amp_update(codec, 0x11, 0, HDA_OUTPUT, 0,
498 0x7f, valp[0] & 0x7f); 498 HDA_AMP_VOLMASK, valp[0]);
499 snd_hda_codec_amp_update(codec, 0x11, 1, HDA_OUTPUT, 0, 499 snd_hda_codec_amp_update(codec, 0x11, 1, HDA_OUTPUT, 0,
500 0x7f, valp[1] & 0x7f); 500 HDA_AMP_VOLMASK, valp[1]);
501 return change; 501 return change;
502} 502}
503 503
@@ -534,9 +534,9 @@ static void cxt5045_hp_automute(struct hda_codec *codec)
534 spec->hp_present = snd_hda_codec_read(codec, 0x11, 0, 534 spec->hp_present = snd_hda_codec_read(codec, 0x11, 0,
535 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 535 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
536 536
537 bits = (spec->hp_present || !spec->cur_eapd) ? 0x80 : 0; 537 bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0;
538 snd_hda_codec_amp_update(codec, 0x10, 0, HDA_OUTPUT, 0, 0x80, bits); 538 snd_hda_codec_amp_stereo(codec, 0x10, HDA_OUTPUT, 0,
539 snd_hda_codec_amp_update(codec, 0x10, 1, HDA_OUTPUT, 0, 0x80, bits); 539 HDA_AMP_MUTE, bits);
540} 540}
541 541
542/* unsolicited event for HP jack sensing */ 542/* unsolicited event for HP jack sensing */
@@ -887,12 +887,12 @@ static int cxt5047_hp_master_sw_put(struct snd_kcontrol *kcontrol,
887 /* toggle internal speakers mute depending of presence of 887 /* toggle internal speakers mute depending of presence of
888 * the headphone jack 888 * the headphone jack
889 */ 889 */
890 bits = (!spec->hp_present && spec->cur_eapd) ? 0 : 0x80; 890 bits = (!spec->hp_present && spec->cur_eapd) ? 0 : HDA_AMP_MUTE;
891 snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits); 891 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0,
892 snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits); 892 HDA_AMP_MUTE, bits);
893 bits = spec->cur_eapd ? 0 : 0x80; 893 bits = spec->cur_eapd ? 0 : HDA_AMP_MUTE;
894 snd_hda_codec_amp_update(codec, 0x13, 0, HDA_OUTPUT, 0, 0x80, bits); 894 snd_hda_codec_amp_stereo(codec, 0x13, HDA_OUTPUT, 0,
895 snd_hda_codec_amp_update(codec, 0x13, 1, HDA_OUTPUT, 0, 0x80, bits); 895 HDA_AMP_MUTE, bits);
896 return 1; 896 return 1;
897} 897}
898 898
@@ -905,13 +905,13 @@ static int cxt5047_hp_master_vol_put(struct snd_kcontrol *kcontrol,
905 int change; 905 int change;
906 906
907 change = snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 907 change = snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0,
908 0x7f, valp[0] & 0x7f); 908 HDA_AMP_VOLMASK, valp[0]);
909 change |= snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 909 change |= snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0,
910 0x7f, valp[1] & 0x7f); 910 HDA_AMP_VOLMASK, valp[1]);
911 snd_hda_codec_amp_update(codec, 0x13, 0, HDA_OUTPUT, 0, 911 snd_hda_codec_amp_update(codec, 0x13, 0, HDA_OUTPUT, 0,
912 0x7f, valp[0] & 0x7f); 912 HDA_AMP_VOLMASK, valp[0]);
913 snd_hda_codec_amp_update(codec, 0x13, 1, HDA_OUTPUT, 0, 913 snd_hda_codec_amp_update(codec, 0x13, 1, HDA_OUTPUT, 0,
914 0x7f, valp[1] & 0x7f); 914 HDA_AMP_VOLMASK, valp[1]);
915 return change; 915 return change;
916} 916}
917 917
@@ -924,12 +924,12 @@ static void cxt5047_hp_automute(struct hda_codec *codec)
924 spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, 924 spec->hp_present = snd_hda_codec_read(codec, 0x13, 0,
925 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 925 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
926 926
927 bits = (spec->hp_present || !spec->cur_eapd) ? 0x80 : 0; 927 bits = (spec->hp_present || !spec->cur_eapd) ? HDA_AMP_MUTE : 0;
928 snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits); 928 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0,
929 snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits); 929 HDA_AMP_MUTE, bits);
930 /* Mute/Unmute PCM 2 for good measure - some systems need this */ 930 /* Mute/Unmute PCM 2 for good measure - some systems need this */
931 snd_hda_codec_amp_update(codec, 0x1c, 0, HDA_OUTPUT, 0, 0x80, bits); 931 snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0,
932 snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); 932 HDA_AMP_MUTE, bits);
933} 933}
934 934
935/* mute internal speaker if HP is plugged */ 935/* mute internal speaker if HP is plugged */
@@ -941,12 +941,12 @@ static void cxt5047_hp2_automute(struct hda_codec *codec)
941 spec->hp_present = snd_hda_codec_read(codec, 0x13, 0, 941 spec->hp_present = snd_hda_codec_read(codec, 0x13, 0,
942 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 942 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
943 943
944 bits = spec->hp_present ? 0x80 : 0; 944 bits = spec->hp_present ? HDA_AMP_MUTE : 0;
945 snd_hda_codec_amp_update(codec, 0x1d, 0, HDA_OUTPUT, 0, 0x80, bits); 945 snd_hda_codec_amp_stereo(codec, 0x1d, HDA_OUTPUT, 0,
946 snd_hda_codec_amp_update(codec, 0x1d, 1, HDA_OUTPUT, 0, 0x80, bits); 946 HDA_AMP_MUTE, bits);
947 /* Mute/Unmute PCM 2 for good measure - some systems need this */ 947 /* Mute/Unmute PCM 2 for good measure - some systems need this */
948 snd_hda_codec_amp_update(codec, 0x1c, 0, HDA_OUTPUT, 0, 0x80, bits); 948 snd_hda_codec_amp_stereo(codec, 0x1c, HDA_OUTPUT, 0,
949 snd_hda_codec_amp_update(codec, 0x1c, 1, HDA_OUTPUT, 0, 0x80, bits); 949 HDA_AMP_MUTE, bits);
950} 950}
951 951
952/* toggle input of built-in and mic jack appropriately */ 952/* toggle input of built-in and mic jack appropriately */
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 63011133e3fb..29119fd4017d 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -457,23 +457,15 @@ static int alc_pin_mode_put(struct snd_kcontrol *kcontrol,
457 * this turns out to be necessary in the future. 457 * this turns out to be necessary in the future.
458 */ 458 */
459 if (val <= 2) { 459 if (val <= 2) {
460 snd_hda_codec_amp_update(codec, nid, 0, HDA_OUTPUT, 0, 460 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
461 0x80, 0x80); 461 HDA_AMP_MUTE, HDA_AMP_MUTE);
462 snd_hda_codec_amp_update(codec, nid, 1, HDA_OUTPUT, 0, 462 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
463 0x80, 0x80); 463 HDA_AMP_MUTE, 0);
464 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 0,
465 0x80, 0x00);
466 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 0,
467 0x80, 0x00);
468 } else { 464 } else {
469 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 0, 465 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT, 0,
470 0x80, 0x80); 466 HDA_AMP_MUTE, HDA_AMP_MUTE);
471 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 0, 467 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
472 0x80, 0x80); 468 HDA_AMP_MUTE, 0);
473 snd_hda_codec_amp_update(codec, nid, 0, HDA_OUTPUT, 0,
474 0x80, 0x00);
475 snd_hda_codec_amp_update(codec, nid, 1, HDA_OUTPUT, 0,
476 0x80, 0x00);
477 } 469 }
478 } 470 }
479 return change; 471 return change;
@@ -1559,15 +1551,11 @@ static void alc880_uniwill_hp_automute(struct hda_codec *codec)
1559 1551
1560 present = snd_hda_codec_read(codec, 0x14, 0, 1552 present = snd_hda_codec_read(codec, 0x14, 0,
1561 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1553 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1562 bits = present ? 0x80 : 0; 1554 bits = present ? HDA_AMP_MUTE : 0;
1563 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 1555 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
1564 0x80, bits); 1556 HDA_AMP_MUTE, bits);
1565 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, 1557 snd_hda_codec_amp_stereo(codec, 0x16, HDA_OUTPUT, 0,
1566 0x80, bits); 1558 HDA_AMP_MUTE, bits);
1567 snd_hda_codec_amp_update(codec, 0x16, 0, HDA_OUTPUT, 0,
1568 0x80, bits);
1569 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_OUTPUT, 0,
1570 0x80, bits);
1571} 1559}
1572 1560
1573/* auto-toggle front mic */ 1561/* auto-toggle front mic */
@@ -1578,11 +1566,8 @@ static void alc880_uniwill_mic_automute(struct hda_codec *codec)
1578 1566
1579 present = snd_hda_codec_read(codec, 0x18, 0, 1567 present = snd_hda_codec_read(codec, 0x18, 0,
1580 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1568 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1581 bits = present ? 0x80 : 0; 1569 bits = present ? HDA_AMP_MUTE : 0;
1582 snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, 1570 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1, HDA_AMP_MUTE, bits);
1583 0x80, bits);
1584 snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1,
1585 0x80, bits);
1586} 1571}
1587 1572
1588static void alc880_uniwill_automute(struct hda_codec *codec) 1573static void alc880_uniwill_automute(struct hda_codec *codec)
@@ -1614,11 +1599,8 @@ static void alc880_uniwill_p53_hp_automute(struct hda_codec *codec)
1614 1599
1615 present = snd_hda_codec_read(codec, 0x14, 0, 1600 present = snd_hda_codec_read(codec, 0x14, 0,
1616 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1601 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1617 bits = present ? 0x80 : 0; 1602 bits = present ? HDA_AMP_MUTE : 0;
1618 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_INPUT, 0, 1603 snd_hda_codec_amp_stereo(codec, 0x15, HDA_INPUT, 0, HDA_AMP_MUTE, bits);
1619 0x80, bits);
1620 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_INPUT, 0,
1621 0x80, bits);
1622} 1604}
1623 1605
1624static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec) 1606static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
@@ -1626,19 +1608,14 @@ static void alc880_uniwill_p53_dcvol_automute(struct hda_codec *codec)
1626 unsigned int present; 1608 unsigned int present;
1627 1609
1628 present = snd_hda_codec_read(codec, 0x21, 0, 1610 present = snd_hda_codec_read(codec, 0x21, 0,
1629 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0) & 0x7f; 1611 AC_VERB_GET_VOLUME_KNOB_CONTROL, 0);
1630 1612 present &= HDA_AMP_VOLMASK;
1631 snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, 1613 snd_hda_codec_amp_stereo(codec, 0x0c, HDA_OUTPUT, 0,
1632 0x7f, present); 1614 HDA_AMP_VOLMASK, present);
1633 snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, 1615 snd_hda_codec_amp_stereo(codec, 0x0d, HDA_OUTPUT, 0,
1634 0x7f, present); 1616 HDA_AMP_VOLMASK, present);
1635
1636 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0,
1637 0x7f, present);
1638 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0,
1639 0x7f, present);
1640
1641} 1617}
1618
1642static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec, 1619static void alc880_uniwill_p53_unsol_event(struct hda_codec *codec,
1643 unsigned int res) 1620 unsigned int res)
1644{ 1621{
@@ -1891,11 +1868,9 @@ static void alc880_lg_automute(struct hda_codec *codec)
1891 1868
1892 present = snd_hda_codec_read(codec, 0x1b, 0, 1869 present = snd_hda_codec_read(codec, 0x1b, 0,
1893 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1870 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1894 bits = present ? 0x80 : 0; 1871 bits = present ? HDA_AMP_MUTE : 0;
1895 snd_hda_codec_amp_update(codec, 0x17, 0, HDA_OUTPUT, 0, 1872 snd_hda_codec_amp_stereo(codec, 0x17, HDA_OUTPUT, 0,
1896 0x80, bits); 1873 HDA_AMP_MUTE, bits);
1897 snd_hda_codec_amp_update(codec, 0x17, 1, HDA_OUTPUT, 0,
1898 0x80, bits);
1899} 1874}
1900 1875
1901static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res) 1876static void alc880_lg_unsol_event(struct hda_codec *codec, unsigned int res)
@@ -1990,11 +1965,9 @@ static void alc880_lg_lw_automute(struct hda_codec *codec)
1990 1965
1991 present = snd_hda_codec_read(codec, 0x1b, 0, 1966 present = snd_hda_codec_read(codec, 0x1b, 0,
1992 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 1967 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
1993 bits = present ? 0x80 : 0; 1968 bits = present ? HDA_AMP_MUTE : 0;
1994 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 1969 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
1995 0x80, bits); 1970 HDA_AMP_MUTE, bits);
1996 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
1997 0x80, bits);
1998} 1971}
1999 1972
2000static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res) 1973static void alc880_lg_lw_unsol_event(struct hda_codec *codec, unsigned int res)
@@ -2363,11 +2336,10 @@ static int alc_test_pin_ctl_put(struct snd_kcontrol *kcontrol,
2363 snd_hda_codec_write_cache(codec, nid, 0, 2336 snd_hda_codec_write_cache(codec, nid, 0,
2364 AC_VERB_SET_PIN_WIDGET_CONTROL, 2337 AC_VERB_SET_PIN_WIDGET_CONTROL,
2365 new_ctl); 2338 new_ctl);
2366 val = ucontrol->value.enumerated.item[0] >= 3 ? 0x80 : 0x00; 2339 val = ucontrol->value.enumerated.item[0] >= 3 ?
2367 snd_hda_codec_amp_update(codec, nid, 0, HDA_OUTPUT, 0, 2340 HDA_AMP_MUTE : 0;
2368 0x80, val); 2341 snd_hda_codec_amp_stereo(codec, nid, HDA_OUTPUT, 0,
2369 snd_hda_codec_amp_update(codec, nid, 1, HDA_OUTPUT, 0, 2342 HDA_AMP_MUTE, val);
2370 0x80, val);
2371 return 1; 2343 return 1;
2372 } 2344 }
2373 return 0; 2345 return 0;
@@ -4791,13 +4763,10 @@ static int alc882_mux_enum_put(struct snd_kcontrol *kcontrol,
4791 if (*cur_val == idx) 4763 if (*cur_val == idx)
4792 return 0; 4764 return 0;
4793 for (i = 0; i < imux->num_items; i++) { 4765 for (i = 0; i < imux->num_items; i++) {
4794 unsigned int v = (i == idx) ? 0x00 : 0x80; 4766 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
4795 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 4767 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
4796 imux->items[i].index,
4797 0x80, v);
4798 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT,
4799 imux->items[i].index, 4768 imux->items[i].index,
4800 0x80, v); 4769 HDA_AMP_MUTE, v);
4801 } 4770 }
4802 *cur_val = idx; 4771 *cur_val = idx;
4803 return 1; 4772 return 1;
@@ -5134,14 +5103,10 @@ static void alc885_imac24_automute(struct hda_codec *codec)
5134 5103
5135 present = snd_hda_codec_read(codec, 0x14, 0, 5104 present = snd_hda_codec_read(codec, 0x14, 0,
5136 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 5105 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5137 snd_hda_codec_amp_update(codec, 0x18, 0, HDA_OUTPUT, 0, 5106 snd_hda_codec_amp_stereo(codec, 0x18, HDA_OUTPUT, 0,
5138 0x80, present ? 0x80 : 0); 5107 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5139 snd_hda_codec_amp_update(codec, 0x18, 1, HDA_OUTPUT, 0, 5108 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_OUTPUT, 0,
5140 0x80, present ? 0x80 : 0); 5109 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5141 snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_OUTPUT, 0,
5142 0x80, present ? 0x80 : 0);
5143 snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_OUTPUT, 0,
5144 0x80, present ? 0x80 : 0);
5145} 5110}
5146 5111
5147/* Processes unsolicited events. */ 5112/* Processes unsolicited events. */
@@ -5178,10 +5143,8 @@ static void alc882_targa_automute(struct hda_codec *codec)
5178 5143
5179 present = snd_hda_codec_read(codec, 0x14, 0, 5144 present = snd_hda_codec_read(codec, 0x14, 0,
5180 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 5145 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
5181 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, 5146 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
5182 0x80, present ? 0x80 : 0); 5147 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
5183 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
5184 0x80, present ? 0x80 : 0);
5185 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, 5148 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
5186 present ? 1 : 3); 5149 present ? 1 : 3);
5187} 5150}
@@ -5776,13 +5739,10 @@ static int alc883_mux_enum_put(struct snd_kcontrol *kcontrol,
5776 if (*cur_val == idx) 5739 if (*cur_val == idx)
5777 return 0; 5740 return 0;
5778 for (i = 0; i < imux->num_items; i++) { 5741 for (i = 0; i < imux->num_items; i++) {
5779 unsigned int v = (i == idx) ? 0x00 : 0x80; 5742 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
5780 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 5743 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
5781 imux->items[i].index, 5744 imux->items[i].index,
5782 0x80, v); 5745 HDA_AMP_MUTE, v);
5783 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT,
5784 imux->items[i].index,
5785 0x80, v);
5786 } 5746 }
5787 *cur_val = idx; 5747 *cur_val = idx;
5788 return 1; 5748 return 1;
@@ -6421,15 +6381,10 @@ static void alc888_lenovo_ms7195_front_automute(struct hda_codec *codec)
6421 6381
6422 present = snd_hda_codec_read(codec, 0x1b, 0, 6382 present = snd_hda_codec_read(codec, 0x1b, 0,
6423 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6383 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6424 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 6384 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6425 0x80, present ? 0x80 : 0); 6385 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6426 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 6386 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6427 0x80, present ? 0x80 : 0); 6387 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6428 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0,
6429 0x80, present ? 0x80 : 0);
6430 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6431 0x80, present ? 0x80 : 0);
6432
6433} 6388}
6434 6389
6435/* toggle RCA according to the front-jack state */ 6390/* toggle RCA according to the front-jack state */
@@ -6439,12 +6394,10 @@ static void alc888_lenovo_ms7195_rca_automute(struct hda_codec *codec)
6439 6394
6440 present = snd_hda_codec_read(codec, 0x14, 0, 6395 present = snd_hda_codec_read(codec, 0x14, 0,
6441 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6396 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6442 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 6397 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6443 0x80, present ? 0x80 : 0); 6398 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6444 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6445 0x80, present ? 0x80 : 0);
6446
6447} 6399}
6400
6448static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec, 6401static void alc883_lenovo_ms7195_unsol_event(struct hda_codec *codec,
6449 unsigned int res) 6402 unsigned int res)
6450{ 6403{
@@ -6483,10 +6436,8 @@ static void alc883_medion_md2_automute(struct hda_codec *codec)
6483 6436
6484 present = snd_hda_codec_read(codec, 0x14, 0, 6437 present = snd_hda_codec_read(codec, 0x14, 0,
6485 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6438 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6486 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 6439 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6487 0x80, present ? 0x80 : 0); 6440 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
6488 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6489 0x80, present ? 0x80 : 0);
6490} 6441}
6491 6442
6492static void alc883_medion_md2_unsol_event(struct hda_codec *codec, 6443static void alc883_medion_md2_unsol_event(struct hda_codec *codec,
@@ -6504,11 +6455,9 @@ static void alc883_tagra_automute(struct hda_codec *codec)
6504 6455
6505 present = snd_hda_codec_read(codec, 0x14, 0, 6456 present = snd_hda_codec_read(codec, 0x14, 0,
6506 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6457 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6507 bits = present ? 0x80 : 0; 6458 bits = present ? HDA_AMP_MUTE : 0;
6508 snd_hda_codec_amp_update(codec, 0x1b, 0, HDA_OUTPUT, 0, 6459 snd_hda_codec_amp_stereo(codec, 0x1b, HDA_OUTPUT, 0,
6509 0x80, bits); 6460 HDA_AMP_MUTE, bits);
6510 snd_hda_codec_amp_update(codec, 0x1b, 1, HDA_OUTPUT, 0,
6511 0x80, bits);
6512 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA, 6461 snd_hda_codec_write_cache(codec, 1, 0, AC_VERB_SET_GPIO_DATA,
6513 present ? 1 : 3); 6462 present ? 1 : 3);
6514} 6463}
@@ -6526,11 +6475,9 @@ static void alc883_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
6526 6475
6527 present = snd_hda_codec_read(codec, 0x14, 0, 6476 present = snd_hda_codec_read(codec, 0x14, 0,
6528 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6477 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6529 bits = present ? 0x80 : 0; 6478 bits = present ? HDA_AMP_MUTE : 0;
6530 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 6479 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6531 0x80, bits); 6480 HDA_AMP_MUTE, bits);
6532 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
6533 0x80, bits);
6534} 6481}
6535 6482
6536static void alc883_lenovo_101e_all_automute(struct hda_codec *codec) 6483static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
@@ -6540,15 +6487,11 @@ static void alc883_lenovo_101e_all_automute(struct hda_codec *codec)
6540 6487
6541 present = snd_hda_codec_read(codec, 0x1b, 0, 6488 present = snd_hda_codec_read(codec, 0x1b, 0,
6542 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 6489 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
6543 bits = present ? 0x80 : 0; 6490 bits = present ? HDA_AMP_MUTE : 0;
6544 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 6491 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
6545 0x80, bits); 6492 HDA_AMP_MUTE, bits);
6546 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, 6493 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
6547 0x80, bits); 6494 HDA_AMP_MUTE, bits);
6548 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
6549 0x80, bits);
6550 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
6551 0x80, bits);
6552} 6495}
6553 6496
6554static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec, 6497static void alc883_lenovo_101e_unsol_event(struct hda_codec *codec,
@@ -7347,18 +7290,13 @@ static void alc262_hippo_automute(struct hda_codec *codec)
7347 spec->jack_present = (present & 0x80000000) != 0; 7290 spec->jack_present = (present & 0x80000000) != 0;
7348 if (spec->jack_present) { 7291 if (spec->jack_present) {
7349 /* mute internal speaker */ 7292 /* mute internal speaker */
7350 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7293 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7351 0x80, 0x80); 7294 HDA_AMP_MUTE, HDA_AMP_MUTE);
7352 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7353 0x80, 0x80);
7354 } else { 7295 } else {
7355 /* unmute internal speaker if necessary */ 7296 /* unmute internal speaker if necessary */
7356 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0); 7297 mute = snd_hda_codec_amp_read(codec, 0x15, 0, HDA_OUTPUT, 0);
7357 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7298 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7358 0x80, mute & 0x80); 7299 HDA_AMP_MUTE, mute);
7359 mute = snd_hda_codec_amp_read(codec, 0x15, 1, HDA_OUTPUT, 0);
7360 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7361 0x80, mute & 0x80);
7362 } 7300 }
7363} 7301}
7364 7302
@@ -7382,18 +7320,13 @@ static void alc262_hippo1_automute(struct hda_codec *codec)
7382 present = (present & 0x80000000) != 0; 7320 present = (present & 0x80000000) != 0;
7383 if (present) { 7321 if (present) {
7384 /* mute internal speaker */ 7322 /* mute internal speaker */
7385 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7323 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7386 0x80, 0x80); 7324 HDA_AMP_MUTE, HDA_AMP_MUTE);
7387 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7388 0x80, 0x80);
7389 } else { 7325 } else {
7390 /* unmute internal speaker if necessary */ 7326 /* unmute internal speaker if necessary */
7391 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0); 7327 mute = snd_hda_codec_amp_read(codec, 0x1b, 0, HDA_OUTPUT, 0);
7392 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7328 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
7393 0x80, mute & 0x80); 7329 HDA_AMP_MUTE, mute);
7394 mute = snd_hda_codec_amp_read(codec, 0x1b, 1, HDA_OUTPUT, 0);
7395 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7396 0x80, mute & 0x80);
7397 } 7330 }
7398} 7331}
7399 7332
@@ -7455,18 +7388,13 @@ static void alc262_fujitsu_automute(struct hda_codec *codec, int force)
7455 } 7388 }
7456 if (spec->jack_present) { 7389 if (spec->jack_present) {
7457 /* mute internal speaker */ 7390 /* mute internal speaker */
7458 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 7391 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7459 0x80, 0x80); 7392 HDA_AMP_MUTE, HDA_AMP_MUTE);
7460 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7461 0x80, 0x80);
7462 } else { 7393 } else {
7463 /* unmute internal speaker if necessary */ 7394 /* unmute internal speaker if necessary */
7464 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0); 7395 mute = snd_hda_codec_amp_read(codec, 0x14, 0, HDA_OUTPUT, 0);
7465 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 7396 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
7466 0x80, mute & 0x80); 7397 HDA_AMP_MUTE, mute);
7467 mute = snd_hda_codec_amp_read(codec, 0x14, 1, HDA_OUTPUT, 0);
7468 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
7469 0x80, mute & 0x80);
7470 } 7398 }
7471} 7399}
7472 7400
@@ -7488,13 +7416,13 @@ static int alc262_fujitsu_master_vol_put(struct snd_kcontrol *kcontrol,
7488 int change; 7416 int change;
7489 7417
7490 change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0, 7418 change = snd_hda_codec_amp_update(codec, 0x0c, 0, HDA_OUTPUT, 0,
7491 0x7f, valp[0] & 0x7f); 7419 HDA_AMP_VOLMASK, valp[0]);
7492 change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0, 7420 change |= snd_hda_codec_amp_update(codec, 0x0c, 1, HDA_OUTPUT, 0,
7493 0x7f, valp[1] & 0x7f); 7421 HDA_AMP_VOLMASK, valp[1]);
7494 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0, 7422 snd_hda_codec_amp_update(codec, 0x0d, 0, HDA_OUTPUT, 0,
7495 0x7f, valp[0] & 0x7f); 7423 HDA_AMP_VOLMASK, valp[0]);
7496 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0, 7424 snd_hda_codec_amp_update(codec, 0x0d, 1, HDA_OUTPUT, 0,
7497 0x7f, valp[1] & 0x7f); 7425 HDA_AMP_VOLMASK, valp[1]);
7498 return change; 7426 return change;
7499} 7427}
7500 7428
@@ -7507,9 +7435,11 @@ static int alc262_fujitsu_master_sw_put(struct snd_kcontrol *kcontrol,
7507 int change; 7435 int change;
7508 7436
7509 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 7437 change = snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
7510 0x80, valp[0] ? 0 : 0x80); 7438 HDA_AMP_MUTE,
7439 valp[0] ? 0 : HDA_AMP_MUTE);
7511 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0, 7440 change |= snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
7512 0x80, valp[1] ? 0 : 0x80); 7441 HDA_AMP_MUTE,
7442 valp[1] ? 0 : HDA_AMP_MUTE);
7513 if (change) 7443 if (change)
7514 alc262_fujitsu_automute(codec, 0); 7444 alc262_fujitsu_automute(codec, 0);
7515 return change; 7445 return change;
@@ -8331,11 +8261,10 @@ static int alc268_mux_enum_put(struct snd_kcontrol *kcontrol,
8331 if (*cur_val == idx) 8261 if (*cur_val == idx)
8332 return 0; 8262 return 0;
8333 for (i = 0; i < imux->num_items; i++) { 8263 for (i = 0; i < imux->num_items; i++) {
8334 unsigned int v = (i == idx) ? 0x00 : 0x80; 8264 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
8335 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 8265 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
8336 imux->items[i].index, 0x80, v); 8266 imux->items[i].index,
8337 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 8267 HDA_AMP_MUTE, v);
8338 imux->items[i].index, 0x80, v);
8339 snd_hda_codec_write_cache(codec, nid, 0, 8268 snd_hda_codec_write_cache(codec, nid, 0,
8340 AC_VERB_SET_CONNECT_SEL, 8269 AC_VERB_SET_CONNECT_SEL,
8341 idx ); 8270 idx );
@@ -9328,14 +9257,10 @@ static void alc861_toshiba_automute(struct hda_codec *codec)
9328 9257
9329 present = snd_hda_codec_read(codec, 0x0f, 0, 9258 present = snd_hda_codec_read(codec, 0x0f, 0,
9330 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 9259 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
9331 snd_hda_codec_amp_update(codec, 0x16, 0, HDA_INPUT, 0, 9260 snd_hda_codec_amp_stereo(codec, 0x16, HDA_INPUT, 0,
9332 0x80, present ? 0x80 : 0); 9261 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
9333 snd_hda_codec_amp_update(codec, 0x16, 1, HDA_INPUT, 0, 9262 snd_hda_codec_amp_stereo(codec, 0x1a, HDA_INPUT, 3,
9334 0x80, present ? 0x80 : 0); 9263 HDA_AMP_MUTE, present ? 0 : HDA_AMP_MUTE);
9335 snd_hda_codec_amp_update(codec, 0x1a, 0, HDA_INPUT, 3,
9336 0x80, present ? 0 : 0x80);
9337 snd_hda_codec_amp_update(codec, 0x1a, 1, HDA_INPUT, 3,
9338 0x80, present ? 0 : 0x80);
9339} 9264}
9340 9265
9341static void alc861_toshiba_unsol_event(struct hda_codec *codec, 9266static void alc861_toshiba_unsol_event(struct hda_codec *codec,
@@ -9922,11 +9847,10 @@ static int alc861vd_mux_enum_put(struct snd_kcontrol *kcontrol,
9922 if (*cur_val == idx) 9847 if (*cur_val == idx)
9923 return 0; 9848 return 0;
9924 for (i = 0; i < imux->num_items; i++) { 9849 for (i = 0; i < imux->num_items; i++) {
9925 unsigned int v = (i == idx) ? 0x00 : 0x80; 9850 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
9926 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 9851 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
9927 imux->items[i].index, 0x80, v); 9852 imux->items[i].index,
9928 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 9853 HDA_AMP_MUTE, v);
9929 imux->items[i].index, 0x80, v);
9930 } 9854 }
9931 *cur_val = idx; 9855 *cur_val = idx;
9932 return 1; 9856 return 1;
@@ -10261,11 +10185,9 @@ static void alc861vd_lenovo_hp_automute(struct hda_codec *codec)
10261 10185
10262 present = snd_hda_codec_read(codec, 0x1b, 0, 10186 present = snd_hda_codec_read(codec, 0x1b, 0,
10263 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 10187 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10264 bits = present ? 0x80 : 0; 10188 bits = present ? HDA_AMP_MUTE : 0;
10265 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 10189 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10266 0x80, bits); 10190 HDA_AMP_MUTE, bits);
10267 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10268 0x80, bits);
10269} 10191}
10270 10192
10271static void alc861vd_lenovo_mic_automute(struct hda_codec *codec) 10193static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
@@ -10275,11 +10197,9 @@ static void alc861vd_lenovo_mic_automute(struct hda_codec *codec)
10275 10197
10276 present = snd_hda_codec_read(codec, 0x18, 0, 10198 present = snd_hda_codec_read(codec, 0x18, 0,
10277 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 10199 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10278 bits = present ? 0x80 : 0; 10200 bits = present ? HDA_AMP_MUTE : 0;
10279 snd_hda_codec_amp_update(codec, 0x0b, 0, HDA_INPUT, 1, 10201 snd_hda_codec_amp_stereo(codec, 0x0b, HDA_INPUT, 1,
10280 0x80, bits); 10202 HDA_AMP_MUTE, bits);
10281 snd_hda_codec_amp_update(codec, 0x0b, 1, HDA_INPUT, 1,
10282 0x80, bits);
10283} 10203}
10284 10204
10285static void alc861vd_lenovo_automute(struct hda_codec *codec) 10205static void alc861vd_lenovo_automute(struct hda_codec *codec)
@@ -10353,10 +10273,8 @@ static void alc861vd_dallas_automute(struct hda_codec *codec)
10353 10273
10354 present = snd_hda_codec_read(codec, 0x15, 0, 10274 present = snd_hda_codec_read(codec, 0x15, 0,
10355 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 10275 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
10356 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0, 10276 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
10357 0x80, present ? 0x80 : 0); 10277 HDA_AMP_MUTE, present ? HDA_AMP_MUTE : 0);
10358 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
10359 0x80, present ? 0x80 : 0);
10360} 10278}
10361 10279
10362static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res) 10280static void alc861vd_dallas_unsol_event(struct hda_codec *codec, unsigned int res)
@@ -10855,11 +10773,10 @@ static int alc662_mux_enum_put(struct snd_kcontrol *kcontrol,
10855 if (*cur_val == idx) 10773 if (*cur_val == idx)
10856 return 0; 10774 return 0;
10857 for (i = 0; i < imux->num_items; i++) { 10775 for (i = 0; i < imux->num_items; i++) {
10858 unsigned int v = (i == idx) ? 0x00 : 0x80; 10776 unsigned int v = (i == idx) ? 0 : HDA_AMP_MUTE;
10859 snd_hda_codec_amp_update(codec, nid, 0, HDA_INPUT, 10777 snd_hda_codec_amp_stereo(codec, nid, HDA_INPUT,
10860 imux->items[i].index, 0x80, v); 10778 imux->items[i].index,
10861 snd_hda_codec_amp_update(codec, nid, 1, HDA_INPUT, 10779 HDA_AMP_MUTE, v);
10862 imux->items[i].index, 0x80, v);
10863 } 10780 }
10864 *cur_val = idx; 10781 *cur_val = idx;
10865 return 1; 10782 return 1;
@@ -11204,11 +11121,9 @@ static void alc662_lenovo_101e_ispeaker_automute(struct hda_codec *codec)
11204 11121
11205 present = snd_hda_codec_read(codec, 0x14, 0, 11122 present = snd_hda_codec_read(codec, 0x14, 0,
11206 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 11123 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11207 bits = present ? 0x80 : 0; 11124 bits = present ? HDA_AMP_MUTE : 0;
11208 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 11125 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11209 0x80, bits); 11126 HDA_AMP_MUTE, bits);
11210 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0,
11211 0x80, bits);
11212} 11127}
11213 11128
11214static void alc662_lenovo_101e_all_automute(struct hda_codec *codec) 11129static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
@@ -11218,15 +11133,11 @@ static void alc662_lenovo_101e_all_automute(struct hda_codec *codec)
11218 11133
11219 present = snd_hda_codec_read(codec, 0x1b, 0, 11134 present = snd_hda_codec_read(codec, 0x1b, 0,
11220 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000; 11135 AC_VERB_GET_PIN_SENSE, 0) & 0x80000000;
11221 bits = present ? 0x80 : 0; 11136 bits = present ? HDA_AMP_MUTE : 0;
11222 snd_hda_codec_amp_update(codec, 0x15, 0, HDA_OUTPUT, 0, 11137 snd_hda_codec_amp_stereo(codec, 0x15, HDA_OUTPUT, 0,
11223 0x80, bits); 11138 HDA_AMP_MUTE, bits);
11224 snd_hda_codec_amp_update(codec, 0x15, 1, HDA_OUTPUT, 0, 11139 snd_hda_codec_amp_stereo(codec, 0x14, HDA_OUTPUT, 0,
11225 0x80, bits); 11140 HDA_AMP_MUTE, bits);
11226 snd_hda_codec_amp_update(codec, 0x14, 0, HDA_OUTPUT, 0,
11227 0x80, bits);
11228 snd_hda_codec_amp_update(codec, 0x14, 1, HDA_OUTPUT, 0,
11229 0x80, bits);
11230} 11141}
11231 11142
11232static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec, 11143static void alc662_lenovo_101e_unsol_event(struct hda_codec *codec,
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 145a5f3c0632..1690726c1e13 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -2408,13 +2408,13 @@ static int vaio_master_vol_put(struct snd_kcontrol *kcontrol,
2408 int change; 2408 int change;
2409 2409
2410 change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0, 2410 change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0,
2411 0x7f, valp[0] & 0x7f); 2411 HDA_AMP_VOLMASK, valp[0]);
2412 change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0, 2412 change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0,
2413 0x7f, valp[1] & 0x7f); 2413 HDA_AMP_VOLMASK, valp[1]);
2414 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, 2414 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0,
2415 0x7f, valp[0] & 0x7f); 2415 HDA_AMP_VOLMASK, valp[0]);
2416 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, 2416 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0,
2417 0x7f, valp[1] & 0x7f); 2417 HDA_AMP_VOLMASK, valp[1]);
2418 return change; 2418 return change;
2419} 2419}
2420 2420
@@ -2427,13 +2427,15 @@ static int vaio_master_sw_put(struct snd_kcontrol *kcontrol,
2427 int change; 2427 int change;
2428 2428
2429 change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0, 2429 change = snd_hda_codec_amp_update(codec, 0x02, 0, HDA_OUTPUT, 0,
2430 0x80, (valp[0] ? 0 : 0x80)); 2430 HDA_AMP_MUTE,
2431 (valp[0] ? 0 : HDA_AMP_MUTE));
2431 change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0, 2432 change |= snd_hda_codec_amp_update(codec, 0x02, 1, HDA_OUTPUT, 0,
2432 0x80, (valp[1] ? 0 : 0x80)); 2433 HDA_AMP_MUTE,
2434 (valp[1] ? 0 : HDA_AMP_MUTE));
2433 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0, 2435 snd_hda_codec_amp_update(codec, 0x05, 0, HDA_OUTPUT, 0,
2434 0x80, (valp[0] ? 0 : 0x80)); 2436 HDA_AMP_MUTE, (valp[0] ? 0 : HDA_AMP_MUTE));
2435 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0, 2437 snd_hda_codec_amp_update(codec, 0x05, 1, HDA_OUTPUT, 0,
2436 0x80, (valp[1] ? 0 : 0x80)); 2438 HDA_AMP_MUTE, (valp[1] ? 0 : HDA_AMP_MUTE));
2437 return change; 2439 return change;
2438} 2440}
2439 2441