aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_conexant.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_conexant.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_conexant.c')
-rw-r--r--sound/pci/hda/patch_conexant.c66
1 files changed, 33 insertions, 33 deletions
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 */