ALSA: hda - Add capture_switch_hook to generic parser
authorTakashi Iwai <tiwai@suse.de>
Mon, 14 Jan 2013 11:13:06 +0000 (12:13 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 14 Jan 2013 11:13:06 +0000 (12:13 +0100)
Add a hook for the capture mixer switch.  This will be used by IDT
codecs for controlling the mic-mute LED.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_generic.h

index 4bc4cd9338664ffee03ff1257d50708b8355fdbd..932e6a133f3d5e0947c9efda457eb2a04fb06c0c 100644 (file)
@@ -2517,9 +2517,23 @@ static const struct snd_kcontrol_new cap_vol_temp = {
 static int cap_sw_put(struct snd_kcontrol *kcontrol,
                      struct snd_ctl_elem_value *ucontrol)
 {
-       return cap_put_caller(kcontrol, ucontrol,
+       struct hda_codec *codec = snd_kcontrol_chip(kcontrol);
+       struct hda_gen_spec *spec = codec->spec;
+       int ret;
+
+       ret = cap_put_caller(kcontrol, ucontrol,
                              snd_hda_mixer_amp_switch_put,
                              NID_PATH_MUTE_CTL);
+       if (ret < 0)
+               return ret;
+
+       if (spec->capture_switch_hook) {
+               bool enable = (ucontrol->value.integer.value[0] ||
+                              ucontrol->value.integer.value[1]);
+               spec->capture_switch_hook(codec, enable);
+       }
+
+       return ret;
 }
 
 static const struct snd_kcontrol_new cap_sw_temp = {
index bfa2d973268b24f386e7b99537f7ac89332d9285..1ceaacd1b7752113d3ef266848f35e8e779c25cb 100644 (file)
@@ -227,6 +227,9 @@ struct hda_gen_spec {
                                   struct hda_jack_tbl *tbl);
        void (*mic_autoswitch_hook)(struct hda_codec *codec,
                                    struct hda_jack_tbl *tbl);
+
+       /* capture switch hook (for mic-mute LED) */
+       void (*capture_switch_hook)(struct hda_codec *codec, bool enable);
 };
 
 int snd_hda_gen_spec_init(struct hda_gen_spec *spec);
This page took 0.027497 seconds and 5 git commands to generate.