diff options
author | Takashi Iwai <tiwai@suse.de> | 2011-06-21 10:52:39 -0400 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2011-06-21 10:52:39 -0400 |
commit | f2b1c9f031d6b7604f861223f9e7024e6597b201 (patch) | |
tree | e92224ab215797e23f6d5e256cc4b8cee9989ad2 /sound/pci | |
parent | ddd304d8be4ffbb3662a92da515b1c74376b2280 (diff) |
ALSA: hda - Auto-mute smart51 surround pins for VIA codecs
When smart51 mode is enabled, auto-mute these surround outputs
as well as the primary line-out. Also this patch includes minor
clean-ups.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/pci')
-rw-r--r-- | sound/pci/hda/patch_via.c | 31 |
1 files changed, 8 insertions, 23 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c index 899b96631312..af47b9aca974 100644 --- a/sound/pci/hda/patch_via.c +++ b/sound/pci/hda/patch_via.c | |||
@@ -844,33 +844,13 @@ static bool is_smart51_pins(struct hda_codec *codec, hda_nid_t pin) | |||
844 | return false; | 844 | return false; |
845 | } | 845 | } |
846 | 846 | ||
847 | static int via_smart51_info(struct snd_kcontrol *kcontrol, | ||
848 | struct snd_ctl_elem_info *uinfo) | ||
849 | { | ||
850 | uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN; | ||
851 | uinfo->count = 1; | ||
852 | uinfo->value.integer.min = 0; | ||
853 | uinfo->value.integer.max = 1; | ||
854 | return 0; | ||
855 | } | ||
856 | |||
857 | static int via_smart51_get(struct snd_kcontrol *kcontrol, | 847 | static int via_smart51_get(struct snd_kcontrol *kcontrol, |
858 | struct snd_ctl_elem_value *ucontrol) | 848 | struct snd_ctl_elem_value *ucontrol) |
859 | { | 849 | { |
860 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 850 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); |
861 | struct via_spec *spec = codec->spec; | 851 | struct via_spec *spec = codec->spec; |
862 | int on = 1; | ||
863 | int i; | ||
864 | 852 | ||
865 | for (i = 0; i < spec->smart51_nums; i++) { | 853 | *ucontrol->value.integer.value = spec->smart51_enabled; |
866 | hda_nid_t nid = spec->smart51_pins[i]; | ||
867 | unsigned int ctl; | ||
868 | ctl = snd_hda_codec_read(codec, nid, 0, | ||
869 | AC_VERB_GET_PIN_WIDGET_CONTROL, 0); | ||
870 | if ((ctl & AC_PINCTL_IN_EN) && !(ctl & AC_PINCTL_OUT_EN)) | ||
871 | on = 0; | ||
872 | } | ||
873 | *ucontrol->value.integer.value = on; | ||
874 | return 0; | 854 | return 0; |
875 | } | 855 | } |
876 | 856 | ||
@@ -908,7 +888,7 @@ static const struct snd_kcontrol_new via_smart51_mixer = { | |||
908 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, | 888 | .iface = SNDRV_CTL_ELEM_IFACE_MIXER, |
909 | .name = "Smart 5.1", | 889 | .name = "Smart 5.1", |
910 | .count = 1, | 890 | .count = 1, |
911 | .info = via_smart51_info, | 891 | .info = snd_ctl_boolean_mono_info, |
912 | .get = via_smart51_get, | 892 | .get = via_smart51_get, |
913 | .put = via_smart51_put, | 893 | .put = via_smart51_put, |
914 | }; | 894 | }; |
@@ -1450,8 +1430,13 @@ static void via_hp_automute(struct hda_codec *codec) | |||
1450 | struct via_spec *spec = codec->spec; | 1430 | struct via_spec *spec = codec->spec; |
1451 | 1431 | ||
1452 | if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0]) { | 1432 | if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0]) { |
1433 | int nums; | ||
1453 | present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); | 1434 | present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]); |
1454 | toggle_output_mutes(codec, spec->autocfg.line_outs, | 1435 | if (spec->smart51_enabled) |
1436 | nums = spec->autocfg.line_outs + spec->smart51_nums; | ||
1437 | else | ||
1438 | nums = spec->autocfg.line_outs; | ||
1439 | toggle_output_mutes(codec, nums, | ||
1455 | spec->autocfg.line_out_pins, | 1440 | spec->autocfg.line_out_pins, |
1456 | present); | 1441 | present); |
1457 | } | 1442 | } |