ALSA: hda/sigmatel - Use common helper for mic mute LED
To simplify the code and to get the mic-mute LED behavior control, use the new helper function for controlling the mic mute LED instead of open-codes. Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Родитель
c647f806b8
Коммит
3bf29db731
|
@ -332,33 +332,15 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask,
|
|||
}
|
||||
|
||||
/* hook for controlling mic-mute LED GPIO */
|
||||
static void stac_capture_led_hook(struct hda_codec *codec,
|
||||
struct snd_kcontrol *kcontrol,
|
||||
struct snd_ctl_elem_value *ucontrol)
|
||||
static void stac_capture_led_update(struct hda_codec *codec)
|
||||
{
|
||||
struct sigmatel_spec *spec = codec->spec;
|
||||
unsigned int mask;
|
||||
bool cur_mute, prev_mute;
|
||||
|
||||
if (!kcontrol || !ucontrol)
|
||||
return;
|
||||
|
||||
mask = 1U << snd_ctl_get_ioffidx(kcontrol, &ucontrol->id);
|
||||
prev_mute = !spec->mic_enabled;
|
||||
if (ucontrol->value.integer.value[0] ||
|
||||
ucontrol->value.integer.value[1])
|
||||
spec->mic_enabled |= mask;
|
||||
if (spec->gen.micmute_led.led_value)
|
||||
spec->gpio_data |= spec->mic_mute_led_gpio;
|
||||
else
|
||||
spec->mic_enabled &= ~mask;
|
||||
cur_mute = !spec->mic_enabled;
|
||||
if (cur_mute != prev_mute) {
|
||||
if (cur_mute)
|
||||
spec->gpio_data |= spec->mic_mute_led_gpio;
|
||||
else
|
||||
spec->gpio_data &= ~spec->mic_mute_led_gpio;
|
||||
stac_gpio_set(codec, spec->gpio_mask,
|
||||
spec->gpio_dir, spec->gpio_data);
|
||||
}
|
||||
spec->gpio_data &= ~spec->mic_mute_led_gpio;
|
||||
stac_gpio_set(codec, spec->gpio_mask, spec->gpio_dir, spec->gpio_data);
|
||||
}
|
||||
|
||||
static int stac_vrefout_set(struct hda_codec *codec,
|
||||
|
@ -4656,8 +4638,7 @@ static void stac_setup_gpio(struct hda_codec *codec)
|
|||
spec->gpio_dir |= spec->mic_mute_led_gpio;
|
||||
spec->mic_enabled = 0;
|
||||
spec->gpio_data |= spec->mic_mute_led_gpio;
|
||||
|
||||
spec->gen.cap_sync_hook = stac_capture_led_hook;
|
||||
snd_hda_gen_add_micmute_led(codec, stac_capture_led_update);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче