aboutsummaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/patch_sigmatel.c
diff options
context:
space:
mode:
Diffstat (limited to 'sound/pci/hda/patch_sigmatel.c')
-rw-r--r--sound/pci/hda/patch_sigmatel.c27
1 files changed, 17 insertions, 10 deletions
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 6998cf29b9bc..7311badf6a94 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -194,7 +194,7 @@ struct sigmatel_spec {
194 int default_polarity; 194 int default_polarity;
195 195
196 unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */ 196 unsigned int mic_mute_led_gpio; /* capture mute LED GPIO */
197 bool mic_mute_led_on; /* current mic mute state */ 197 unsigned int mic_enabled; /* current mic mute state (bitmask) */
198 198
199 /* stream */ 199 /* stream */
200 unsigned int stream_delay; 200 unsigned int stream_delay;
@@ -324,19 +324,26 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
324 324
325/* hook for controlling mic-mute LED GPIO */ 325/* hook for controlling mic-mute LED GPIO */
326static void stac_capture_led_hook(struct hda_codec *codec, 326static void stac_capture_led_hook(struct hda_codec *codec,
327 struct snd_ctl_elem_value *ucontrol) 327 struct snd_kcontrol *kcontrol,
328 struct snd_ctl_elem_value *ucontrol)
328{ 329{
329 struct sigmatel_spec *spec = codec->spec; 330 struct sigmatel_spec *spec = codec->spec;
330 bool mute; 331 unsigned int mask;
332 bool cur_mute, prev_mute;
331 333
332 if (!ucontrol) 334 if (!kcontrol || !ucontrol)
333 return; 335 return;
334 336
335 mute = !(ucontrol->value.integer.value[0] || 337 mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
336 ucontrol->value.integer.value[1]); 338 prev_mute = !spec->mic_enabled;
337 if (spec->mic_mute_led_on != mute) { 339 if (ucontrol->value.integer.value[0] ||
338 spec->mic_mute_led_on = mute; 340 ucontrol->value.integer.value[1])
339 if (mute) 341 spec->mic_enabled |= mask;
342 else
343 spec->mic_enabled &= ~mask;
344 cur_mute = !spec->mic_enabled;
345 if (cur_mute != prev_mute) {
346 if (cur_mute)
340 spec->gpio_data |= spec->mic_mute_led_gpio; 347 spec->gpio_data |= spec->mic_mute_led_gpio;
341 else 348 else
342 spec->gpio_data &= ~spec->mic_mute_led_gpio; 349 spec->gpio_data &= ~spec->mic_mute_led_gpio;
@@ -4462,7 +4469,7 @@ static void stac_setup_gpio(struct hda_codec *codec)
4462 if (spec->mic_mute_led_gpio) { 4469 if (spec->mic_mute_led_gpio) {
4463 spec->gpio_mask |= spec->mic_mute_led_gpio; 4470 spec->gpio_mask |= spec->mic_mute_led_gpio;
4464 spec->gpio_dir |= spec->mic_mute_led_gpio; 4471 spec->gpio_dir |= spec->mic_mute_led_gpio;
4465 spec->mic_mute_led_on = true; 4472 spec->mic_enabled = 0;
4466 spec->gpio_data |= spec->mic_mute_led_gpio; 4473 spec->gpio_data |= spec->mic_mute_led_gpio;
4467 4474
4468 spec->gen.cap_sync_hook = stac_capture_led_hook; 4475 spec->gen.cap_sync_hook = stac_capture_led_hook;