aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_analog.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2007-08-10 11:11:07 -0400
committerJaroslav Kysela <perex@perex.cz>2007-10-16 09:58:43 -0400
commit47fd830acf0b6b5bc75db55d0f2cc64f59a23b5f (patch)
tree920b7e2cdce7120ff96417d74b911c3d5b95c21b /sound/pci/hda/patch_analog.c
parent82beb8fd365afe3891b277c46425083f13e23c56 (diff)
[ALSA] hda-codec - add snd_hda_codec_stereo() function
Added snd_hda_codec_amp_stereo() function that changes both of stereo channels with the same mask and value bits. It simplifies most of amp-handling codes. 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.c21
1 files changed, 9 insertions, 12 deletions
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 */