diff options
-rw-r--r-- | sound/pci/hda/hda_generic.c | 34 | ||||
-rw-r--r-- | sound/pci/hda/hda_generic.h | 6 | ||||
-rw-r--r-- | sound/pci/hda/patch_realtek.c | 3 | ||||
-rw-r--r-- | sound/pci/hda/patch_sigmatel.c | 12 |
4 files changed, 22 insertions, 33 deletions
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c index e9af9ab4fac5..f0d83b2f42ac 100644 --- a/sound/pci/hda/hda_generic.c +++ b/sound/pci/hda/hda_generic.c | |||
@@ -2738,7 +2738,7 @@ static int cap_put_caller(struct snd_kcontrol *kcontrol, | |||
2738 | mutex_unlock(&codec->control_mutex); | 2738 | mutex_unlock(&codec->control_mutex); |
2739 | snd_hda_codec_flush_amp_cache(codec); /* flush the updates */ | 2739 | snd_hda_codec_flush_amp_cache(codec); /* flush the updates */ |
2740 | if (err >= 0 && spec->cap_sync_hook) | 2740 | if (err >= 0 && spec->cap_sync_hook) |
2741 | spec->cap_sync_hook(codec); | 2741 | spec->cap_sync_hook(codec, ucontrol); |
2742 | return err; | 2742 | return err; |
2743 | } | 2743 | } |
2744 | 2744 | ||
@@ -2774,23 +2774,9 @@ static const struct snd_kcontrol_new cap_vol_temp = { | |||
2774 | static int cap_sw_put(struct snd_kcontrol *kcontrol, | 2774 | static int cap_sw_put(struct snd_kcontrol *kcontrol, |
2775 | struct snd_ctl_elem_value *ucontrol) | 2775 | struct snd_ctl_elem_value *ucontrol) |
2776 | { | 2776 | { |
2777 | struct hda_codec *codec = snd_kcontrol_chip(kcontrol); | 2777 | return cap_put_caller(kcontrol, ucontrol, |
2778 | struct hda_gen_spec *spec = codec->spec; | ||
2779 | int ret; | ||
2780 | |||
2781 | ret = cap_put_caller(kcontrol, ucontrol, | ||
2782 | snd_hda_mixer_amp_switch_put, | 2778 | snd_hda_mixer_amp_switch_put, |
2783 | NID_PATH_MUTE_CTL); | 2779 | NID_PATH_MUTE_CTL); |
2784 | if (ret < 0) | ||
2785 | return ret; | ||
2786 | |||
2787 | if (spec->capture_switch_hook) { | ||
2788 | bool enable = (ucontrol->value.integer.value[0] || | ||
2789 | ucontrol->value.integer.value[1]); | ||
2790 | spec->capture_switch_hook(codec, enable); | ||
2791 | } | ||
2792 | |||
2793 | return ret; | ||
2794 | } | 2780 | } |
2795 | 2781 | ||
2796 | static const struct snd_kcontrol_new cap_sw_temp = { | 2782 | static const struct snd_kcontrol_new cap_sw_temp = { |
@@ -2860,6 +2846,7 @@ static bool is_inv_dmic_pin(struct hda_codec *codec, hda_nid_t nid) | |||
2860 | return false; | 2846 | return false; |
2861 | } | 2847 | } |
2862 | 2848 | ||
2849 | /* capture switch put callback for a single control with hook call */ | ||
2863 | static int cap_single_sw_put(struct snd_kcontrol *kcontrol, | 2850 | static int cap_single_sw_put(struct snd_kcontrol *kcontrol, |
2864 | struct snd_ctl_elem_value *ucontrol) | 2851 | struct snd_ctl_elem_value *ucontrol) |
2865 | { | 2852 | { |
@@ -2871,11 +2858,8 @@ static int cap_single_sw_put(struct snd_kcontrol *kcontrol, | |||
2871 | if (ret < 0) | 2858 | if (ret < 0) |
2872 | return ret; | 2859 | return ret; |
2873 | 2860 | ||
2874 | if (spec->capture_switch_hook) { | 2861 | if (spec->cap_sync_hook) |
2875 | bool enable = (ucontrol->value.integer.value[0] || | 2862 | spec->cap_sync_hook(codec, ucontrol); |
2876 | ucontrol->value.integer.value[1]); | ||
2877 | spec->capture_switch_hook(codec, enable); | ||
2878 | } | ||
2879 | 2863 | ||
2880 | return ret; | 2864 | return ret; |
2881 | } | 2865 | } |
@@ -2904,7 +2888,7 @@ static int add_single_cap_ctl(struct hda_codec *codec, const char *label, | |||
2904 | amp_val_replace_channels(ctl, chs)); | 2888 | amp_val_replace_channels(ctl, chs)); |
2905 | if (!knew) | 2889 | if (!knew) |
2906 | return -ENOMEM; | 2890 | return -ENOMEM; |
2907 | if (is_switch && spec->capture_switch_hook) | 2891 | if (is_switch) |
2908 | knew->put = cap_single_sw_put; | 2892 | knew->put = cap_single_sw_put; |
2909 | if (!inv_dmic) | 2893 | if (!inv_dmic) |
2910 | return 0; | 2894 | return 0; |
@@ -2920,7 +2904,7 @@ static int add_single_cap_ctl(struct hda_codec *codec, const char *label, | |||
2920 | amp_val_replace_channels(ctl, 2)); | 2904 | amp_val_replace_channels(ctl, 2)); |
2921 | if (!knew) | 2905 | if (!knew) |
2922 | return -ENOMEM; | 2906 | return -ENOMEM; |
2923 | if (is_switch && spec->capture_switch_hook) | 2907 | if (is_switch) |
2924 | knew->put = cap_single_sw_put; | 2908 | knew->put = cap_single_sw_put; |
2925 | return 0; | 2909 | return 0; |
2926 | } | 2910 | } |
@@ -3280,7 +3264,7 @@ static int mux_select(struct hda_codec *codec, unsigned int adc_idx, | |||
3280 | return 0; | 3264 | return 0; |
3281 | snd_hda_activate_path(codec, path, true, false); | 3265 | snd_hda_activate_path(codec, path, true, false); |
3282 | if (spec->cap_sync_hook) | 3266 | if (spec->cap_sync_hook) |
3283 | spec->cap_sync_hook(codec); | 3267 | spec->cap_sync_hook(codec, NULL); |
3284 | return 1; | 3268 | return 1; |
3285 | } | 3269 | } |
3286 | 3270 | ||
@@ -4610,7 +4594,7 @@ static void init_input_src(struct hda_codec *codec) | |||
4610 | update_shared_mic_hp(codec, spec->cur_mux[0]); | 4594 | update_shared_mic_hp(codec, spec->cur_mux[0]); |
4611 | 4595 | ||
4612 | if (spec->cap_sync_hook) | 4596 | if (spec->cap_sync_hook) |
4613 | spec->cap_sync_hook(codec); | 4597 | spec->cap_sync_hook(codec, NULL); |
4614 | } | 4598 | } |
4615 | 4599 | ||
4616 | /* set right pin controls for digital I/O */ | 4600 | /* set right pin controls for digital I/O */ |
diff --git a/sound/pci/hda/hda_generic.h b/sound/pci/hda/hda_generic.h index f6b88cd4584f..594a9cc4ecca 100644 --- a/sound/pci/hda/hda_generic.h +++ b/sound/pci/hda/hda_generic.h | |||
@@ -233,7 +233,8 @@ struct hda_gen_spec { | |||
233 | /* hooks */ | 233 | /* hooks */ |
234 | void (*init_hook)(struct hda_codec *codec); | 234 | void (*init_hook)(struct hda_codec *codec); |
235 | void (*automute_hook)(struct hda_codec *codec); | 235 | void (*automute_hook)(struct hda_codec *codec); |
236 | void (*cap_sync_hook)(struct hda_codec *codec); | 236 | void (*cap_sync_hook)(struct hda_codec *codec, |
237 | struct snd_ctl_elem_value *ucontrol); | ||
237 | 238 | ||
238 | /* PCM hooks */ | 239 | /* PCM hooks */ |
239 | void (*pcm_playback_hook)(struct hda_pcm_stream *hinfo, | 240 | void (*pcm_playback_hook)(struct hda_pcm_stream *hinfo, |
@@ -252,9 +253,6 @@ struct hda_gen_spec { | |||
252 | struct hda_jack_tbl *tbl); | 253 | struct hda_jack_tbl *tbl); |
253 | void (*mic_autoswitch_hook)(struct hda_codec *codec, | 254 | void (*mic_autoswitch_hook)(struct hda_codec *codec, |
254 | struct hda_jack_tbl *tbl); | 255 | struct hda_jack_tbl *tbl); |
255 | |||
256 | /* capture switch hook (for mic-mute LED) */ | ||
257 | void (*capture_switch_hook)(struct hda_codec *codec, bool enable); | ||
258 | }; | 256 | }; |
259 | 257 | ||
260 | int snd_hda_gen_spec_init(struct hda_gen_spec *spec); | 258 | int snd_hda_gen_spec_init(struct hda_gen_spec *spec); |
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c index 71a8894438ab..70b0e323f5af 100644 --- a/sound/pci/hda/patch_realtek.c +++ b/sound/pci/hda/patch_realtek.c | |||
@@ -670,7 +670,8 @@ static void alc_inv_dmic_sync(struct hda_codec *codec, bool force) | |||
670 | } | 670 | } |
671 | } | 671 | } |
672 | 672 | ||
673 | static void alc_inv_dmic_hook(struct hda_codec *codec) | 673 | static void alc_inv_dmic_hook(struct hda_codec *codec, |
674 | struct snd_ctl_elem_value *ucontrol) | ||
674 | { | 675 | { |
675 | alc_inv_dmic_sync(codec, false); | 676 | alc_inv_dmic_sync(codec, false); |
676 | } | 677 | } |
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c index 9d2dfad7f0bc..456ebc771313 100644 --- a/sound/pci/hda/patch_sigmatel.c +++ b/sound/pci/hda/patch_sigmatel.c | |||
@@ -316,11 +316,17 @@ static void stac_gpio_set(struct hda_codec *codec, unsigned int mask, | |||
316 | } | 316 | } |
317 | 317 | ||
318 | /* hook for controlling mic-mute LED GPIO */ | 318 | /* hook for controlling mic-mute LED GPIO */ |
319 | static void stac_capture_led_hook(struct hda_codec *codec, bool enable) | 319 | static void stac_capture_led_hook(struct hda_codec *codec, |
320 | struct snd_ctl_elem_value *ucontrol) | ||
320 | { | 321 | { |
321 | struct sigmatel_spec *spec = codec->spec; | 322 | struct sigmatel_spec *spec = codec->spec; |
322 | bool mute = !enable; | 323 | bool mute; |
323 | 324 | ||
325 | if (!ucontrol) | ||
326 | return; | ||
327 | |||
328 | mute = !(ucontrol->value.integer.value[0] || | ||
329 | ucontrol->value.integer.value[1]); | ||
324 | if (spec->mic_mute_led_on != mute) { | 330 | if (spec->mic_mute_led_on != mute) { |
325 | spec->mic_mute_led_on = mute; | 331 | spec->mic_mute_led_on = mute; |
326 | if (mute) | 332 | if (mute) |
@@ -3806,7 +3812,7 @@ static void stac_setup_gpio(struct hda_codec *codec) | |||
3806 | spec->mic_mute_led_on = true; | 3812 | spec->mic_mute_led_on = true; |
3807 | spec->gpio_data |= spec->mic_mute_led_gpio; | 3813 | spec->gpio_data |= spec->mic_mute_led_gpio; |
3808 | 3814 | ||
3809 | spec->gen.capture_switch_hook = stac_capture_led_hook; | 3815 | spec->gen.cap_sync_hook = stac_capture_led_hook; |
3810 | } | 3816 | } |
3811 | } | 3817 | } |
3812 | 3818 | ||