ALSA: hda - Consolidate cap_sync_hook and capture_switch_hook

Two hooks in hda_gen_spec, cap_sync_hook and capture_switch_hook, play
very similar roles.  The only differences are that the former is
called more often (e.g. at init or switching capsrc) while the latter
can take an on/off argument.

As a more generic implementation, consolidate these two hooks, and
pass snd_ctl_elem_value pointer as the second argument.  If the
secondary argument is non-NULL, it can take the on/off value, so the
caller handles it like the former capture_switch_hook.  If it's NULL,
it's called in the init or capsrc switch case.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 9d2dfad..456ebc7 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -316,11 +316,17 @@
 }
 
 /* hook for controlling mic-mute LED GPIO */
-static void stac_capture_led_hook(struct hda_codec *codec, bool enable)
+static void stac_capture_led_hook(struct hda_codec *codec,
+			       struct snd_ctl_elem_value *ucontrol)
 {
 	struct sigmatel_spec *spec = codec->spec;
-	bool mute = !enable;
+	bool mute;
 
+	if (!ucontrol)
+		return;
+
+	mute = !(ucontrol->value.integer.value[0] ||
+		 ucontrol->value.integer.value[1]);
 	if (spec->mic_mute_led_on != mute) {
 		spec->mic_mute_led_on = mute;
 		if (mute)
@@ -3806,7 +3812,7 @@
 		spec->mic_mute_led_on = true;
 		spec->gpio_data |= spec->mic_mute_led_gpio;
 
-		spec->gen.capture_switch_hook = stac_capture_led_hook;
+		spec->gen.cap_sync_hook = stac_capture_led_hook;
 	}
 }