diff options
author | Lars-Peter Clausen <lars@metafoo.de> | 2015-07-06 09:38:06 -0400 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2015-07-07 09:54:14 -0400 |
commit | e2ada8187bc8b46c30a623e7d6b5a72c209f70cd (patch) | |
tree | 87273418d638c8051951a8832a5cc1155f3f71ca | |
parent | d770e558e21961ad6cfdf0ff7df0eb5d7d4f0754 (diff) |
ASoC: rt5645: Replace direct snd_soc_codec dapm field access
The dapm field of the snd_soc_codec struct is eventually going to be
removed, in preparation for this replace all manual access to
codec->dapm.bias_level with snd_soc_codec_get_bias_level() and replace all
other manual access to codec->dapm with snd_soc_codec_get_dapm().
Signed-off-by: Lars-Peter Clausen <lars@metafoo.de>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/rt5645.c | 73 |
1 files changed, 32 insertions, 41 deletions
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c index 9ce311e088fc..571e4b5895e2 100644 --- a/sound/soc/codecs/rt5645.c +++ b/sound/soc/codecs/rt5645.c | |||
@@ -2642,7 +2642,7 @@ static int rt5645_set_bias_level(struct snd_soc_codec *codec, | |||
2642 | 2642 | ||
2643 | switch (level) { | 2643 | switch (level) { |
2644 | case SND_SOC_BIAS_PREPARE: | 2644 | case SND_SOC_BIAS_PREPARE: |
2645 | if (SND_SOC_BIAS_STANDBY == codec->dapm.bias_level) { | 2645 | if (SND_SOC_BIAS_STANDBY == snd_soc_codec_get_bias_level(codec)) { |
2646 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, | 2646 | snd_soc_update_bits(codec, RT5645_PWR_ANLG1, |
2647 | RT5645_PWR_VREF1 | RT5645_PWR_MB | | 2647 | RT5645_PWR_VREF1 | RT5645_PWR_MB | |
2648 | RT5645_PWR_BG | RT5645_PWR_VREF2, | 2648 | RT5645_PWR_BG | RT5645_PWR_VREF2, |
@@ -2760,20 +2760,17 @@ static int rt5650_calibration(struct rt5645_priv *rt5645) | |||
2760 | static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, | 2760 | static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, |
2761 | bool enable) | 2761 | bool enable) |
2762 | { | 2762 | { |
2763 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
2763 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 2764 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); |
2764 | 2765 | ||
2765 | if (enable) { | 2766 | if (enable) { |
2766 | snd_soc_dapm_mutex_lock(&codec->dapm); | 2767 | snd_soc_dapm_mutex_lock(dapm); |
2767 | snd_soc_dapm_force_enable_pin_unlocked(&codec->dapm, | 2768 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "ADC L power"); |
2768 | "ADC L power"); | 2769 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "ADC R power"); |
2769 | snd_soc_dapm_force_enable_pin_unlocked(&codec->dapm, | 2770 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "LDO2"); |
2770 | "ADC R power"); | 2771 | snd_soc_dapm_force_enable_pin_unlocked(dapm, "Mic Det Power"); |
2771 | snd_soc_dapm_force_enable_pin_unlocked(&codec->dapm, | 2772 | snd_soc_dapm_sync_unlocked(dapm); |
2772 | "LDO2"); | 2773 | snd_soc_dapm_mutex_unlock(dapm); |
2773 | snd_soc_dapm_force_enable_pin_unlocked(&codec->dapm, | ||
2774 | "Mic Det Power"); | ||
2775 | snd_soc_dapm_sync_unlocked(&codec->dapm); | ||
2776 | snd_soc_dapm_mutex_unlock(&codec->dapm); | ||
2777 | 2774 | ||
2778 | snd_soc_update_bits(codec, | 2775 | snd_soc_update_bits(codec, |
2779 | RT5645_INT_IRQ_ST, 0x8, 0x8); | 2776 | RT5645_INT_IRQ_ST, 0x8, 0x8); |
@@ -2786,23 +2783,20 @@ static void rt5645_enable_push_button_irq(struct snd_soc_codec *codec, | |||
2786 | snd_soc_update_bits(codec, RT5650_4BTN_IL_CMD2, 0x8000, 0x0); | 2783 | snd_soc_update_bits(codec, RT5650_4BTN_IL_CMD2, 0x8000, 0x0); |
2787 | snd_soc_update_bits(codec, RT5645_INT_IRQ_ST, 0x8, 0x0); | 2784 | snd_soc_update_bits(codec, RT5645_INT_IRQ_ST, 0x8, 0x0); |
2788 | 2785 | ||
2789 | snd_soc_dapm_mutex_lock(&codec->dapm); | 2786 | snd_soc_dapm_mutex_lock(dapm); |
2790 | snd_soc_dapm_disable_pin_unlocked(&codec->dapm, | 2787 | snd_soc_dapm_disable_pin_unlocked(dapm, "ADC L power"); |
2791 | "ADC L power"); | 2788 | snd_soc_dapm_disable_pin_unlocked(dapm, "ADC R power"); |
2792 | snd_soc_dapm_disable_pin_unlocked(&codec->dapm, | ||
2793 | "ADC R power"); | ||
2794 | if (rt5645->pdata.jd_mode == 0) | 2789 | if (rt5645->pdata.jd_mode == 0) |
2795 | snd_soc_dapm_disable_pin_unlocked(&codec->dapm, | 2790 | snd_soc_dapm_disable_pin_unlocked(dapm, "LDO2"); |
2796 | "LDO2"); | 2791 | snd_soc_dapm_disable_pin_unlocked(dapm, "Mic Det Power"); |
2797 | snd_soc_dapm_disable_pin_unlocked(&codec->dapm, | 2792 | snd_soc_dapm_sync_unlocked(dapm); |
2798 | "Mic Det Power"); | 2793 | snd_soc_dapm_mutex_unlock(dapm); |
2799 | snd_soc_dapm_sync_unlocked(&codec->dapm); | ||
2800 | snd_soc_dapm_mutex_unlock(&codec->dapm); | ||
2801 | } | 2794 | } |
2802 | } | 2795 | } |
2803 | 2796 | ||
2804 | static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) | 2797 | static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) |
2805 | { | 2798 | { |
2799 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
2806 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 2800 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); |
2807 | unsigned int val; | 2801 | unsigned int val; |
2808 | 2802 | ||
@@ -2811,10 +2805,9 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) | |||
2811 | 2805 | ||
2812 | if (codec->component.card->instantiated) { | 2806 | if (codec->component.card->instantiated) { |
2813 | /* for jack type detect */ | 2807 | /* for jack type detect */ |
2814 | snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO2"); | 2808 | snd_soc_dapm_force_enable_pin(dapm, "LDO2"); |
2815 | snd_soc_dapm_force_enable_pin(&codec->dapm, | 2809 | snd_soc_dapm_force_enable_pin(dapm, "Mic Det Power"); |
2816 | "Mic Det Power"); | 2810 | snd_soc_dapm_sync(dapm); |
2817 | snd_soc_dapm_sync(&codec->dapm); | ||
2818 | } else { | 2811 | } else { |
2819 | /* Power up necessary bits for JD if dapm is | 2812 | /* Power up necessary bits for JD if dapm is |
2820 | not ready yet */ | 2813 | not ready yet */ |
@@ -2847,9 +2840,8 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) | |||
2847 | } | 2840 | } |
2848 | } else { | 2841 | } else { |
2849 | if (codec->component.card->instantiated) { | 2842 | if (codec->component.card->instantiated) { |
2850 | snd_soc_dapm_disable_pin(&codec->dapm, | 2843 | snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); |
2851 | "Mic Det Power"); | 2844 | snd_soc_dapm_sync(dapm); |
2852 | snd_soc_dapm_sync(&codec->dapm); | ||
2853 | } else | 2845 | } else |
2854 | regmap_update_bits(rt5645->regmap, | 2846 | regmap_update_bits(rt5645->regmap, |
2855 | RT5645_PWR_VOL, RT5645_PWR_MIC_DET, 0); | 2847 | RT5645_PWR_VOL, RT5645_PWR_MIC_DET, 0); |
@@ -2863,11 +2855,9 @@ static int rt5645_jack_detect(struct snd_soc_codec *codec, int jack_insert) | |||
2863 | else { | 2855 | else { |
2864 | if (codec->component.card->instantiated) { | 2856 | if (codec->component.card->instantiated) { |
2865 | if (rt5645->pdata.jd_mode == 0) | 2857 | if (rt5645->pdata.jd_mode == 0) |
2866 | snd_soc_dapm_disable_pin(&codec->dapm, | 2858 | snd_soc_dapm_disable_pin(dapm, "LDO2"); |
2867 | "LDO2"); | 2859 | snd_soc_dapm_disable_pin(dapm, "Mic Det Power"); |
2868 | snd_soc_dapm_disable_pin(&codec->dapm, | 2860 | snd_soc_dapm_sync(dapm); |
2869 | "Mic Det Power"); | ||
2870 | snd_soc_dapm_sync(&codec->dapm); | ||
2871 | } else { | 2861 | } else { |
2872 | if (rt5645->pdata.jd_mode == 0) | 2862 | if (rt5645->pdata.jd_mode == 0) |
2873 | regmap_update_bits(rt5645->regmap, | 2863 | regmap_update_bits(rt5645->regmap, |
@@ -3043,21 +3033,22 @@ static int rt5645_irq_detection(struct rt5645_priv *rt5645) | |||
3043 | 3033 | ||
3044 | static int rt5645_probe(struct snd_soc_codec *codec) | 3034 | static int rt5645_probe(struct snd_soc_codec *codec) |
3045 | { | 3035 | { |
3036 | struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); | ||
3046 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); | 3037 | struct rt5645_priv *rt5645 = snd_soc_codec_get_drvdata(codec); |
3047 | 3038 | ||
3048 | rt5645->codec = codec; | 3039 | rt5645->codec = codec; |
3049 | 3040 | ||
3050 | switch (rt5645->codec_type) { | 3041 | switch (rt5645->codec_type) { |
3051 | case CODEC_TYPE_RT5645: | 3042 | case CODEC_TYPE_RT5645: |
3052 | snd_soc_dapm_add_routes(&codec->dapm, | 3043 | snd_soc_dapm_add_routes(dapm, |
3053 | rt5645_specific_dapm_routes, | 3044 | rt5645_specific_dapm_routes, |
3054 | ARRAY_SIZE(rt5645_specific_dapm_routes)); | 3045 | ARRAY_SIZE(rt5645_specific_dapm_routes)); |
3055 | break; | 3046 | break; |
3056 | case CODEC_TYPE_RT5650: | 3047 | case CODEC_TYPE_RT5650: |
3057 | snd_soc_dapm_new_controls(&codec->dapm, | 3048 | snd_soc_dapm_new_controls(dapm, |
3058 | rt5650_specific_dapm_widgets, | 3049 | rt5650_specific_dapm_widgets, |
3059 | ARRAY_SIZE(rt5650_specific_dapm_widgets)); | 3050 | ARRAY_SIZE(rt5650_specific_dapm_widgets)); |
3060 | snd_soc_dapm_add_routes(&codec->dapm, | 3051 | snd_soc_dapm_add_routes(dapm, |
3061 | rt5650_specific_dapm_routes, | 3052 | rt5650_specific_dapm_routes, |
3062 | ARRAY_SIZE(rt5650_specific_dapm_routes)); | 3053 | ARRAY_SIZE(rt5650_specific_dapm_routes)); |
3063 | break; | 3054 | break; |
@@ -3067,9 +3058,9 @@ static int rt5645_probe(struct snd_soc_codec *codec) | |||
3067 | 3058 | ||
3068 | /* for JD function */ | 3059 | /* for JD function */ |
3069 | if (rt5645->pdata.jd_mode) { | 3060 | if (rt5645->pdata.jd_mode) { |
3070 | snd_soc_dapm_force_enable_pin(&codec->dapm, "JD Power"); | 3061 | snd_soc_dapm_force_enable_pin(dapm, "JD Power"); |
3071 | snd_soc_dapm_force_enable_pin(&codec->dapm, "LDO2"); | 3062 | snd_soc_dapm_force_enable_pin(dapm, "LDO2"); |
3072 | snd_soc_dapm_sync(&codec->dapm); | 3063 | snd_soc_dapm_sync(dapm); |
3073 | } | 3064 | } |
3074 | 3065 | ||
3075 | return 0; | 3066 | return 0; |