diff options
author | Nicolas Boichat <drinkcat@chromium.org> | 2015-07-16 01:42:34 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-16 08:10:47 -0400 |
commit | a4e3c5fa955ce0934774f3f3684377dbf2c20eca (patch) | |
tree | 70943ac79d1c31efbd195c62f8cd7d516dd46742 | |
parent | b14c917409f47dbfdff93e69effd6740f6a809f7 (diff) |
ASoC: rt5645: Simplify rt5645_enable_push_button_irq
LDO2/Mic Det Power pins are already enabled/disabled in rt5645_jack_detect
(the jack out code path previously did not disable those if button function
is enabled: modify it to make it so).
Signed-off-by: Nicolas Boichat <drinkcat@chromium.org>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/rt5645.c | 33 |
1 files changed, 12 insertions, 21 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 33d1aff38d5f..11a2bfc4a059 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -2766,13 +2766,9 @@ static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, | |||
2766 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 2766 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); |
2767 | 2767 | ||
2768 | if (enable) { | 2768 | if (enable) { |
2769 | snd_soc_dapm_mutex_lock(dapm); | 2769 | snd_soc_dapm_force_enable_pin(dapm, "ADC L power"); |
2770 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "ADC L power"); | 2770 | snd_soc_dapm_force_enable_pin(dapm, "ADC R power"); |
2771 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "ADC R power"); | 2771 | snd_soc_dapm_sync(dapm); |
2772 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "LDO2"); | ||
2773 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "Mic Det Power"); | ||
2774 | snd_soc_dapm_sync_unlocked(dapm); | ||
2775 | snd_soc_dapm_mutex_unlock(dapm); | ||
2776 | 2772 | ||
2777 | snd_soc_update_bits(codec, | 2773 | snd_soc_update_bits(codec, |
2778 | RT5645_INT_IRQ_ST, 0x8, 0x8); | 2774 | RT5645_INT_IRQ_ST, 0x8, 0x8); |
@@ -2785,14 +2781,9 @@ static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, | |||
2785 | snd_soc_update_bits(codec, RT5650_4BTN_IL_CMD2, 0x8000, 0x0); | 2781 | snd_soc_update_bits(codec, RT5650_4BTN_IL_CMD2, 0x8000, 0x0); |
2786 | snd_soc_update_bits(codec, RT5645_INT_IRQ_ST, 0x8, 0x0); | 2782 | snd_soc_update_bits(codec, RT5645_INT_IRQ_ST, 0x8, 0x0); |
2787 | 2783 | ||
2788 | snd_soc_dapm_mutex_lock(dapm); | 2784 | snd_soc_dapm_disable_pin(dapm, "ADC L power"); |
2789 | snd_soc_dapm_disable_pin_unlocked(dapm, "ADC L power"); | 2785 | snd_soc_dapm_disable_pin(dapm, "ADC R power"); |
2790 | snd_soc_dapm_disable_pin_unlocked(dapm, "ADC R power"); | 2786 | snd_soc_dapm_sync(dapm); |
2791 | if (rt5645->pdata.jd_mode == 0) | ||
2792 | snd_soc_dapm_disable_pin_unlocked(dapm, "LDO2"); | ||
2793 | snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Det Power"); | ||
2794 | snd_soc_dapm_sync_unlocked(dapm); | ||
2795 | snd_soc_dapm_mutex_unlock(dapm); | ||
2796 | } | 2787 | } |
2797 | } | 2788 | } |
2798 | 2789 | ||
@@ -2847,14 +2838,14 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) | |||
2847 | 2838 | ||
2848 | } else { /* jack out */ | 2839 | } else { /* jack out */ |
2849 | rt5645->jack_type = 0; | 2840 | rt5645->jack_type = 0; |
2841 | |||
2850 | if (rt5645->en_button_func) | 2842 | if (rt5645->en_button_func) |
2851 | rt5645_enable_push_button_irq(codec, false); | 2843 | rt5645_enable_push_button_irq(codec, false); |
2852 | else { | 2844 | |
2853 | if (rt5645->pdata.jd_mode == 0) | 2845 | if (rt5645->pdata.jd_mode == 0) |
2854 | snd_soc_dapm_disable_pin(dapm, "LDO2"); | 2846 | snd_soc_dapm_disable_pin(dapm, "LDO2"); |
2855 | snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); | 2847 | snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); |
2856 | snd_soc_dapm_sync(dapm); | 2848 | snd_soc_dapm_sync(dapm); |
2857 | } | ||
2858 | } | 2849 | } |
2859 | 2850 | ||
2860 | return rt5645->jack_type; | 2851 | return rt5645->jack_type; |