aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_via.c
diff options
context:
space:
mode:
authorTakashi Iwai <tiwai@suse.de>2011-06-21 16:52:39 +0200
committerTakashi Iwai <tiwai@suse.de>2011-06-21 16:52:39 +0200
commitf2b1c9f031d6b7604f861223f9e7024e6597b201 (patch)
treee92224ab215797e23f6d5e256cc4b8cee9989ad2 /sound/pci/hda/patch_via.c
parentddd304d8be4ffbb3662a92da515b1c74376b2280 (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/hda/patch_via.c')
-rw-r--r--sound/pci/hda/patch_via.c31
1 files changed, 8 insertions, 23 deletions
diff --git a/sound/pci/hda/patch_via.c b/sound/pci/hda/patch_via.c
index 899b9663131..af47b9aca97 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)
return false;
}
-static int via_smart51_info(struct snd_kcontrol *kcontrol,
- struct snd_ctl_elem_info *uinfo)
-{
- uinfo->type = SNDRV_CTL_ELEM_TYPE_BOOLEAN;
- uinfo->count = 1;
- uinfo->value.integer.min = 0;
- uinfo->value.integer.max = 1;
- return 0;
-}
-
static int via_smart51_get(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
struct via_spec *spec = codec->spec;
- int on = 1;
- int i;
- for (i = 0; i < spec->smart51_nums; i++) {
- hda_nid_t nid = spec->smart51_pins[i];
- unsigned int ctl;
- ctl = snd_hda_codec_read(codec, nid, 0,
- AC_VERB_GET_PIN_WIDGET_CONTROL, 0);
- if ((ctl & AC_PINCTL_IN_EN) && !(ctl & AC_PINCTL_OUT_EN))
- on = 0;
- }
- *ucontrol->value.integer.value = on;
+ *ucontrol->value.integer.value = spec->smart51_enabled;
return 0;
}
@@ -908,7 +888,7 @@ static const struct snd_kcontrol_new via_smart51_mixer = {
.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
.name = "Smart 5.1",
.count = 1,
- .info = via_smart51_info,
+ .info = snd_ctl_boolean_mono_info,
.get = via_smart51_get,
.put = via_smart51_put,
};
@@ -1450,8 +1430,13 @@ static void via_hp_automute(struct hda_codec *codec)
struct via_spec *spec = codec->spec;
if (!spec->hp_independent_mode && spec->autocfg.hp_pins[0]) {
+ int nums;
present = snd_hda_jack_detect(codec, spec->autocfg.hp_pins[0]);
- toggle_output_mutes(codec, spec->autocfg.line_outs,
+ if (spec->smart51_enabled)
+ nums = spec->autocfg.line_outs + spec->smart51_nums;
+ else
+ nums = spec->autocfg.line_outs;
+ toggle_output_mutes(codec, nums,
spec->autocfg.line_out_pins,
present);
}