aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2013-08-09 09:05:03 -0400
committerTakashi Iwai <tiwai@suse.de>2013-08-13 03:10:37 -0400
commitbc2eee29fc8224ffad495d0c68ead0ce603309e3 (patch)
tree716f6030196d46fadb7b5bcb43ebfc5c3d5b8ada /sound/pci
parentf672f31ab58c1e7e96acb4ea54eebb8bb59a2667 (diff)
ALSA: hda - Allow auto_mute_via_amp on bind mute controls
The auto-mute using the amp currently works only for a single amp on a pin. Make it working also with HDA_CTL_BIND_MUTE type, too. Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r--sound/pci/hda/hda_generic.c26
1 files changed, 23 insertions, 3 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index f6c0344258ac..6ed2209c9142 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -816,6 +816,8 @@ static void resume_path_from_idx(struct hda_codec *codec, int path_idx)
816 816
817static int hda_gen_mixer_mute_put(struct snd_kcontrol *kcontrol, 817static int hda_gen_mixer_mute_put(struct snd_kcontrol *kcontrol,
818 struct snd_ctl_elem_value *ucontrol); 818 struct snd_ctl_elem_value *ucontrol);
819static int hda_gen_bind_mute_put(struct snd_kcontrol *kcontrol,
820 struct snd_ctl_elem_value *ucontrol);
819 821
820enum { 822enum {
821 HDA_CTL_WIDGET_VOL, 823 HDA_CTL_WIDGET_VOL,
@@ -833,7 +835,13 @@ static const struct snd_kcontrol_new control_templates[] = {
833 .put = hda_gen_mixer_mute_put, /* replaced */ 835 .put = hda_gen_mixer_mute_put, /* replaced */
834 .private_value = HDA_COMPOSE_AMP_VAL(0, 3, 0, 0), 836 .private_value = HDA_COMPOSE_AMP_VAL(0, 3, 0, 0),
835 }, 837 },
836 HDA_BIND_MUTE(NULL, 0, 0, 0), 838 {
839 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
840 .info = snd_hda_mixer_amp_switch_info,
841 .get = snd_hda_mixer_bind_switch_get,
842 .put = hda_gen_bind_mute_put, /* replaced */
843 .private_value = HDA_COMPOSE_AMP_VAL(0, 3, 0, 0),
844 },
837}; 845};
838 846
839/* add dynamic controls from template */ 847/* add dynamic controls from template */
@@ -940,8 +948,8 @@ static int add_stereo_sw(struct hda_codec *codec, const char *pfx,
940} 948}
941 949
942/* playback mute control with the software mute bit check */ 950/* playback mute control with the software mute bit check */
943static int hda_gen_mixer_mute_put(struct snd_kcontrol *kcontrol, 951static void sync_auto_mute_bits(struct snd_kcontrol *kcontrol,
944 struct snd_ctl_elem_value *ucontrol) 952 struct snd_ctl_elem_value *ucontrol)
945{ 953{
946 struct hda_codec *codec = snd_kcontrol_chip(kcontrol); 954 struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
947 struct hda_gen_spec *spec = codec->spec; 955 struct hda_gen_spec *spec = codec->spec;
@@ -952,10 +960,22 @@ static int hda_gen_mixer_mute_put(struct snd_kcontrol *kcontrol,
952 ucontrol->value.integer.value[0] &= enabled; 960 ucontrol->value.integer.value[0] &= enabled;
953 ucontrol->value.integer.value[1] &= enabled; 961 ucontrol->value.integer.value[1] &= enabled;
954 } 962 }
963}
955 964
965static int hda_gen_mixer_mute_put(struct snd_kcontrol *kcontrol,
966 struct snd_ctl_elem_value *ucontrol)
967{
968 sync_auto_mute_bits(kcontrol, ucontrol);
956 return snd_hda_mixer_amp_switch_put(kcontrol, ucontrol); 969 return snd_hda_mixer_amp_switch_put(kcontrol, ucontrol);
957} 970}
958 971
972static int hda_gen_bind_mute_put(struct snd_kcontrol *kcontrol,
973 struct snd_ctl_elem_value *ucontrol)
974{
975 sync_auto_mute_bits(kcontrol, ucontrol);
976 return snd_hda_mixer_bind_switch_put(kcontrol, ucontrol);
977}
978
959/* any ctl assigned to the path with the given index? */ 979/* any ctl assigned to the path with the given index? */
960static bool path_has_mixer(struct hda_codec *codec, int path_idx, int ctl_type) 980static bool path_has_mixer(struct hda_codec *codec, int path_idx, int ctl_type)
961{ 981{