diff options
author | Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> | 2018-01-28 21:59:50 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-12 04:39:59 -0500 |
commit | 2621a9a4a28b37fa066a1c08aecdd6a44a083e56 (patch) | |
tree | 14f64cf5f5eba13fb2cf497b118321f428282121 | |
parent | 7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff) |
ASoC: wm8350: replace codec to component
Now we can replace Codec to Component. Let's do it.
Note:
xxx_codec_xxx() -> xxx_component_xxx()
.idle_bias_off = 0 -> .idle_bias_on = 1
.ignore_pmdown_time = 0 -> .use_pmdown_time = 1
- -> .endianness = 1
- -> .non_legacy_dai_naming = 1
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r-- | sound/soc/codecs/wm8350.c | 183 | ||||
-rw-r--r-- | sound/soc/codecs/wm8350.h | 4 | ||||
-rw-r--r-- | sound/soc/fsl/wm1133-ev1.c | 6 |
3 files changed, 93 insertions, 100 deletions
diff --git a/sound/soc/codecs/wm8350.c b/sound/soc/codecs/wm8350.c index fc79c6725d06..e92ebe52d485 100644 --- a/sound/soc/codecs/wm8350.c +++ b/sound/soc/codecs/wm8350.c | |||
@@ -256,8 +256,8 @@ static void wm8350_pga_work(struct work_struct *work) | |||
256 | static int pga_event(struct snd_soc_dapm_widget *w, | 256 | static int pga_event(struct snd_soc_dapm_widget *w, |
257 | struct snd_kcontrol *kcontrol, int event) | 257 | struct snd_kcontrol *kcontrol, int event) |
258 | { | 258 | { |
259 | struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); | 259 | struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm); |
260 | struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); | 260 | struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component); |
261 | struct wm8350_output *out; | 261 | struct wm8350_output *out; |
262 | 262 | ||
263 | switch (w->shift) { | 263 | switch (w->shift) { |
@@ -299,8 +299,8 @@ static int pga_event(struct snd_soc_dapm_widget *w, | |||
299 | static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol, | 299 | static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol, |
300 | struct snd_ctl_elem_value *ucontrol) | 300 | struct snd_ctl_elem_value *ucontrol) |
301 | { | 301 | { |
302 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 302 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
303 | struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec); | 303 | struct wm8350_data *wm8350_priv = snd_soc_component_get_drvdata(component); |
304 | struct wm8350_output *out = NULL; | 304 | struct wm8350_output *out = NULL; |
305 | struct soc_mixer_control *mc = | 305 | struct soc_mixer_control *mc = |
306 | (struct soc_mixer_control *)kcontrol->private_value; | 306 | (struct soc_mixer_control *)kcontrol->private_value; |
@@ -334,16 +334,16 @@ static int wm8350_put_volsw_2r_vu(struct snd_kcontrol *kcontrol, | |||
334 | return ret; | 334 | return ret; |
335 | 335 | ||
336 | /* now hit the volume update bits (always bit 8) */ | 336 | /* now hit the volume update bits (always bit 8) */ |
337 | val = snd_soc_read(codec, reg); | 337 | val = snd_soc_component_read32(component, reg); |
338 | snd_soc_write(codec, reg, val | WM8350_OUT1_VU); | 338 | snd_soc_component_write(component, reg, val | WM8350_OUT1_VU); |
339 | return 1; | 339 | return 1; |
340 | } | 340 | } |
341 | 341 | ||
342 | static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol, | 342 | static int wm8350_get_volsw_2r(struct snd_kcontrol *kcontrol, |
343 | struct snd_ctl_elem_value *ucontrol) | 343 | struct snd_ctl_elem_value *ucontrol) |
344 | { | 344 | { |
345 | struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); | 345 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
346 | struct wm8350_data *wm8350_priv = snd_soc_codec_get_drvdata(codec); | 346 | struct wm8350_data *wm8350_priv = snd_soc_component_get_drvdata(component); |
347 | struct wm8350_output *out1 = &wm8350_priv->out1; | 347 | struct wm8350_output *out1 = &wm8350_priv->out1; |
348 | struct wm8350_output *out2 = &wm8350_priv->out2; | 348 | struct wm8350_output *out2 = &wm8350_priv->out2; |
349 | struct soc_mixer_control *mc = | 349 | struct soc_mixer_control *mc = |
@@ -753,8 +753,8 @@ static const struct snd_soc_dapm_route wm8350_dapm_routes[] = { | |||
753 | static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, | 753 | static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, |
754 | int clk_id, unsigned int freq, int dir) | 754 | int clk_id, unsigned int freq, int dir) |
755 | { | 755 | { |
756 | struct snd_soc_codec *codec = codec_dai->codec; | 756 | struct snd_soc_component *component = codec_dai->component; |
757 | struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); | 757 | struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component); |
758 | struct wm8350 *wm8350 = wm8350_data->wm8350; | 758 | struct wm8350 *wm8350 = wm8350_data->wm8350; |
759 | u16 fll_4; | 759 | u16 fll_4; |
760 | 760 | ||
@@ -769,9 +769,9 @@ static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
769 | case WM8350_MCLK_SEL_PLL_32K: | 769 | case WM8350_MCLK_SEL_PLL_32K: |
770 | wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_1, | 770 | wm8350_set_bits(wm8350, WM8350_CLOCK_CONTROL_1, |
771 | WM8350_MCLK_SEL); | 771 | WM8350_MCLK_SEL); |
772 | fll_4 = snd_soc_read(codec, WM8350_FLL_CONTROL_4) & | 772 | fll_4 = snd_soc_component_read32(component, WM8350_FLL_CONTROL_4) & |
773 | ~WM8350_FLL_CLK_SRC_MASK; | 773 | ~WM8350_FLL_CLK_SRC_MASK; |
774 | snd_soc_write(codec, WM8350_FLL_CONTROL_4, fll_4 | clk_id); | 774 | snd_soc_component_write(component, WM8350_FLL_CONTROL_4, fll_4 | clk_id); |
775 | break; | 775 | break; |
776 | } | 776 | } |
777 | 777 | ||
@@ -788,44 +788,44 @@ static int wm8350_set_dai_sysclk(struct snd_soc_dai *codec_dai, | |||
788 | 788 | ||
789 | static int wm8350_set_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div) | 789 | static int wm8350_set_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div) |
790 | { | 790 | { |
791 | struct snd_soc_codec *codec = codec_dai->codec; | 791 | struct snd_soc_component *component = codec_dai->component; |
792 | u16 val; | 792 | u16 val; |
793 | 793 | ||
794 | switch (div_id) { | 794 | switch (div_id) { |
795 | case WM8350_ADC_CLKDIV: | 795 | case WM8350_ADC_CLKDIV: |
796 | val = snd_soc_read(codec, WM8350_ADC_DIVIDER) & | 796 | val = snd_soc_component_read32(component, WM8350_ADC_DIVIDER) & |
797 | ~WM8350_ADC_CLKDIV_MASK; | 797 | ~WM8350_ADC_CLKDIV_MASK; |
798 | snd_soc_write(codec, WM8350_ADC_DIVIDER, val | div); | 798 | snd_soc_component_write(component, WM8350_ADC_DIVIDER, val | div); |
799 | break; | 799 | break; |
800 | case WM8350_DAC_CLKDIV: | 800 | case WM8350_DAC_CLKDIV: |
801 | val = snd_soc_read(codec, WM8350_DAC_CLOCK_CONTROL) & | 801 | val = snd_soc_component_read32(component, WM8350_DAC_CLOCK_CONTROL) & |
802 | ~WM8350_DAC_CLKDIV_MASK; | 802 | ~WM8350_DAC_CLKDIV_MASK; |
803 | snd_soc_write(codec, WM8350_DAC_CLOCK_CONTROL, val | div); | 803 | snd_soc_component_write(component, WM8350_DAC_CLOCK_CONTROL, val | div); |
804 | break; | 804 | break; |
805 | case WM8350_BCLK_CLKDIV: | 805 | case WM8350_BCLK_CLKDIV: |
806 | val = snd_soc_read(codec, WM8350_CLOCK_CONTROL_1) & | 806 | val = snd_soc_component_read32(component, WM8350_CLOCK_CONTROL_1) & |
807 | ~WM8350_BCLK_DIV_MASK; | 807 | ~WM8350_BCLK_DIV_MASK; |
808 | snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div); | 808 | snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div); |
809 | break; | 809 | break; |
810 | case WM8350_OPCLK_CLKDIV: | 810 | case WM8350_OPCLK_CLKDIV: |
811 | val = snd_soc_read(codec, WM8350_CLOCK_CONTROL_1) & | 811 | val = snd_soc_component_read32(component, WM8350_CLOCK_CONTROL_1) & |
812 | ~WM8350_OPCLK_DIV_MASK; | 812 | ~WM8350_OPCLK_DIV_MASK; |
813 | snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div); | 813 | snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div); |
814 | break; | 814 | break; |
815 | case WM8350_SYS_CLKDIV: | 815 | case WM8350_SYS_CLKDIV: |
816 | val = snd_soc_read(codec, WM8350_CLOCK_CONTROL_1) & | 816 | val = snd_soc_component_read32(component, WM8350_CLOCK_CONTROL_1) & |
817 | ~WM8350_MCLK_DIV_MASK; | 817 | ~WM8350_MCLK_DIV_MASK; |
818 | snd_soc_write(codec, WM8350_CLOCK_CONTROL_1, val | div); | 818 | snd_soc_component_write(component, WM8350_CLOCK_CONTROL_1, val | div); |
819 | break; | 819 | break; |
820 | case WM8350_DACLR_CLKDIV: | 820 | case WM8350_DACLR_CLKDIV: |
821 | val = snd_soc_read(codec, WM8350_DAC_LR_RATE) & | 821 | val = snd_soc_component_read32(component, WM8350_DAC_LR_RATE) & |
822 | ~WM8350_DACLRC_RATE_MASK; | 822 | ~WM8350_DACLRC_RATE_MASK; |
823 | snd_soc_write(codec, WM8350_DAC_LR_RATE, val | div); | 823 | snd_soc_component_write(component, WM8350_DAC_LR_RATE, val | div); |
824 | break; | 824 | break; |
825 | case WM8350_ADCLR_CLKDIV: | 825 | case WM8350_ADCLR_CLKDIV: |
826 | val = snd_soc_read(codec, WM8350_ADC_LR_RATE) & | 826 | val = snd_soc_component_read32(component, WM8350_ADC_LR_RATE) & |
827 | ~WM8350_ADCLRC_RATE_MASK; | 827 | ~WM8350_ADCLRC_RATE_MASK; |
828 | snd_soc_write(codec, WM8350_ADC_LR_RATE, val | div); | 828 | snd_soc_component_write(component, WM8350_ADC_LR_RATE, val | div); |
829 | break; | 829 | break; |
830 | default: | 830 | default: |
831 | return -EINVAL; | 831 | return -EINVAL; |
@@ -836,14 +836,14 @@ static int wm8350_set_clkdiv(struct snd_soc_dai *codec_dai, int div_id, int div) | |||
836 | 836 | ||
837 | static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | 837 | static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) |
838 | { | 838 | { |
839 | struct snd_soc_codec *codec = codec_dai->codec; | 839 | struct snd_soc_component *component = codec_dai->component; |
840 | u16 iface = snd_soc_read(codec, WM8350_AI_FORMATING) & | 840 | u16 iface = snd_soc_component_read32(component, WM8350_AI_FORMATING) & |
841 | ~(WM8350_AIF_BCLK_INV | WM8350_AIF_LRCLK_INV | WM8350_AIF_FMT_MASK); | 841 | ~(WM8350_AIF_BCLK_INV | WM8350_AIF_LRCLK_INV | WM8350_AIF_FMT_MASK); |
842 | u16 master = snd_soc_read(codec, WM8350_AI_DAC_CONTROL) & | 842 | u16 master = snd_soc_component_read32(component, WM8350_AI_DAC_CONTROL) & |
843 | ~WM8350_BCLK_MSTR; | 843 | ~WM8350_BCLK_MSTR; |
844 | u16 dac_lrc = snd_soc_read(codec, WM8350_DAC_LR_RATE) & | 844 | u16 dac_lrc = snd_soc_component_read32(component, WM8350_DAC_LR_RATE) & |
845 | ~WM8350_DACLRC_ENA; | 845 | ~WM8350_DACLRC_ENA; |
846 | u16 adc_lrc = snd_soc_read(codec, WM8350_ADC_LR_RATE) & | 846 | u16 adc_lrc = snd_soc_component_read32(component, WM8350_ADC_LR_RATE) & |
847 | ~WM8350_ADCLRC_ENA; | 847 | ~WM8350_ADCLRC_ENA; |
848 | 848 | ||
849 | /* set master/slave audio interface */ | 849 | /* set master/slave audio interface */ |
@@ -896,10 +896,10 @@ static int wm8350_set_dai_fmt(struct snd_soc_dai *codec_dai, unsigned int fmt) | |||
896 | return -EINVAL; | 896 | return -EINVAL; |
897 | } | 897 | } |
898 | 898 | ||
899 | snd_soc_write(codec, WM8350_AI_FORMATING, iface); | 899 | snd_soc_component_write(component, WM8350_AI_FORMATING, iface); |
900 | snd_soc_write(codec, WM8350_AI_DAC_CONTROL, master); | 900 | snd_soc_component_write(component, WM8350_AI_DAC_CONTROL, master); |
901 | snd_soc_write(codec, WM8350_DAC_LR_RATE, dac_lrc); | 901 | snd_soc_component_write(component, WM8350_DAC_LR_RATE, dac_lrc); |
902 | snd_soc_write(codec, WM8350_ADC_LR_RATE, adc_lrc); | 902 | snd_soc_component_write(component, WM8350_ADC_LR_RATE, adc_lrc); |
903 | return 0; | 903 | return 0; |
904 | } | 904 | } |
905 | 905 | ||
@@ -907,10 +907,10 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream, | |||
907 | struct snd_pcm_hw_params *params, | 907 | struct snd_pcm_hw_params *params, |
908 | struct snd_soc_dai *codec_dai) | 908 | struct snd_soc_dai *codec_dai) |
909 | { | 909 | { |
910 | struct snd_soc_codec *codec = codec_dai->codec; | 910 | struct snd_soc_component *component = codec_dai->component; |
911 | struct wm8350_data *wm8350_data = snd_soc_codec_get_drvdata(codec); | 911 | struct wm8350_data *wm8350_data = snd_soc_component_get_drvdata(component); |
912 | struct wm8350 *wm8350 = wm8350_data->wm8350; | 912 | struct wm8350 *wm8350 = wm8350_data->wm8350; |
913 | u16 iface = snd_soc_read(codec, WM8350_AI_FORMATING) & | 913 | u16 iface = snd_soc_component_read32(component, WM8350_AI_FORMATING) & |
914 | ~WM8350_AIF_WL_MASK; | 914 | ~WM8350_AIF_WL_MASK; |
915 | 915 | ||
916 | /* bit size */ | 916 | /* bit size */ |
@@ -928,7 +928,7 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream, | |||
928 | break; | 928 | break; |
929 | } | 929 | } |
930 | 930 | ||
931 | snd_soc_write(codec, WM8350_AI_FORMATING, iface); | 931 | snd_soc_component_write(component, WM8350_AI_FORMATING, iface); |
932 | 932 | ||
933 | /* The sloping stopband filter is recommended for use with | 933 | /* The sloping stopband filter is recommended for use with |
934 | * lower sample rates to improve performance. | 934 | * lower sample rates to improve performance. |
@@ -947,7 +947,7 @@ static int wm8350_pcm_hw_params(struct snd_pcm_substream *substream, | |||
947 | 947 | ||
948 | static int wm8350_mute(struct snd_soc_dai *dai, int mute) | 948 | static int wm8350_mute(struct snd_soc_dai *dai, int mute) |
949 | { | 949 | { |
950 | struct snd_soc_codec *codec = dai->codec; | 950 | struct snd_soc_component *component = dai->component; |
951 | unsigned int val; | 951 | unsigned int val; |
952 | 952 | ||
953 | if (mute) | 953 | if (mute) |
@@ -955,7 +955,7 @@ static int wm8350_mute(struct snd_soc_dai *dai, int mute) | |||
955 | else | 955 | else |
956 | val = 0; | 956 | val = 0; |
957 | 957 | ||
958 | snd_soc_update_bits(codec, WM8350_DAC_MUTE, WM8350_DAC_MUTE_ENA, val); | 958 | snd_soc_component_update_bits(component, WM8350_DAC_MUTE, WM8350_DAC_MUTE_ENA, val); |
959 | 959 | ||
960 | return 0; | 960 | return 0; |
961 | } | 961 | } |
@@ -1024,8 +1024,8 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai, | |||
1024 | int pll_id, int source, unsigned int freq_in, | 1024 | int pll_id, int source, unsigned int freq_in, |
1025 | unsigned int freq_out) | 1025 | unsigned int freq_out) |
1026 | { | 1026 | { |
1027 | struct snd_soc_codec *codec = codec_dai->codec; | 1027 | struct snd_soc_component *component = codec_dai->component; |
1028 | struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); | 1028 | struct wm8350_data *priv = snd_soc_component_get_drvdata(component); |
1029 | struct wm8350 *wm8350 = priv->wm8350; | 1029 | struct wm8350 *wm8350 = priv->wm8350; |
1030 | struct _fll_div fll_div; | 1030 | struct _fll_div fll_div; |
1031 | int ret = 0; | 1031 | int ret = 0; |
@@ -1050,17 +1050,17 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai, | |||
1050 | fll_div.ratio); | 1050 | fll_div.ratio); |
1051 | 1051 | ||
1052 | /* set up N.K & dividers */ | 1052 | /* set up N.K & dividers */ |
1053 | fll_1 = snd_soc_read(codec, WM8350_FLL_CONTROL_1) & | 1053 | fll_1 = snd_soc_component_read32(component, WM8350_FLL_CONTROL_1) & |
1054 | ~(WM8350_FLL_OUTDIV_MASK | WM8350_FLL_RSP_RATE_MASK | 0xc000); | 1054 | ~(WM8350_FLL_OUTDIV_MASK | WM8350_FLL_RSP_RATE_MASK | 0xc000); |
1055 | snd_soc_write(codec, WM8350_FLL_CONTROL_1, | 1055 | snd_soc_component_write(component, WM8350_FLL_CONTROL_1, |
1056 | fll_1 | (fll_div.div << 8) | 0x50); | 1056 | fll_1 | (fll_div.div << 8) | 0x50); |
1057 | snd_soc_write(codec, WM8350_FLL_CONTROL_2, | 1057 | snd_soc_component_write(component, WM8350_FLL_CONTROL_2, |
1058 | (fll_div.ratio << 11) | (fll_div. | 1058 | (fll_div.ratio << 11) | (fll_div. |
1059 | n & WM8350_FLL_N_MASK)); | 1059 | n & WM8350_FLL_N_MASK)); |
1060 | snd_soc_write(codec, WM8350_FLL_CONTROL_3, fll_div.k); | 1060 | snd_soc_component_write(component, WM8350_FLL_CONTROL_3, fll_div.k); |
1061 | fll_4 = snd_soc_read(codec, WM8350_FLL_CONTROL_4) & | 1061 | fll_4 = snd_soc_component_read32(component, WM8350_FLL_CONTROL_4) & |
1062 | ~(WM8350_FLL_FRAC | WM8350_FLL_SLOW_LOCK_REF); | 1062 | ~(WM8350_FLL_FRAC | WM8350_FLL_SLOW_LOCK_REF); |
1063 | snd_soc_write(codec, WM8350_FLL_CONTROL_4, | 1063 | snd_soc_component_write(component, WM8350_FLL_CONTROL_4, |
1064 | fll_4 | (fll_div.k ? WM8350_FLL_FRAC : 0) | | 1064 | fll_4 | (fll_div.k ? WM8350_FLL_FRAC : 0) | |
1065 | (fll_div.ratio == 8 ? WM8350_FLL_SLOW_LOCK_REF : 0)); | 1065 | (fll_div.ratio == 8 ? WM8350_FLL_SLOW_LOCK_REF : 0)); |
1066 | 1066 | ||
@@ -1074,10 +1074,10 @@ static int wm8350_set_fll(struct snd_soc_dai *codec_dai, | |||
1074 | return 0; | 1074 | return 0; |
1075 | } | 1075 | } |
1076 | 1076 | ||
1077 | static int wm8350_set_bias_level(struct snd_soc_codec *codec, | 1077 | static int wm8350_set_bias_level(struct snd_soc_component *component, |
1078 | enum snd_soc_bias_level level) | 1078 | enum snd_soc_bias_level level) |
1079 | { | 1079 | { |
1080 | struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); | 1080 | struct wm8350_data *priv = snd_soc_component_get_drvdata(component); |
1081 | struct wm8350 *wm8350 = priv->wm8350; | 1081 | struct wm8350 *wm8350 = priv->wm8350; |
1082 | struct wm8350_audio_platform_data *platform = | 1082 | struct wm8350_audio_platform_data *platform = |
1083 | wm8350->codec.platform_data; | 1083 | wm8350->codec.platform_data; |
@@ -1101,7 +1101,7 @@ static int wm8350_set_bias_level(struct snd_soc_codec *codec, | |||
1101 | break; | 1101 | break; |
1102 | 1102 | ||
1103 | case SND_SOC_BIAS_STANDBY: | 1103 | case SND_SOC_BIAS_STANDBY: |
1104 | if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { | 1104 | if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) { |
1105 | ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), | 1105 | ret = regulator_bulk_enable(ARRAY_SIZE(priv->supplies), |
1106 | priv->supplies); | 1106 | priv->supplies); |
1107 | if (ret != 0) | 1107 | if (ret != 0) |
@@ -1310,7 +1310,7 @@ static irqreturn_t wm8350_hpr_jack_handler(int irq, void *data) | |||
1310 | /** | 1310 | /** |
1311 | * wm8350_hp_jack_detect - Enable headphone jack detection. | 1311 | * wm8350_hp_jack_detect - Enable headphone jack detection. |
1312 | * | 1312 | * |
1313 | * @codec: WM8350 codec | 1313 | * @component: WM8350 component |
1314 | * @which: left or right jack detect signal | 1314 | * @which: left or right jack detect signal |
1315 | * @jack: jack to report detection events on | 1315 | * @jack: jack to report detection events on |
1316 | * @report: value to report | 1316 | * @report: value to report |
@@ -1318,10 +1318,10 @@ static irqreturn_t wm8350_hpr_jack_handler(int irq, void *data) | |||
1318 | * Enables the headphone jack detection of the WM8350. If no report | 1318 | * Enables the headphone jack detection of the WM8350. If no report |
1319 | * is specified then detection is disabled. | 1319 | * is specified then detection is disabled. |
1320 | */ | 1320 | */ |
1321 | int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, | 1321 | int wm8350_hp_jack_detect(struct snd_soc_component *component, enum wm8350_jack which, |
1322 | struct snd_soc_jack *jack, int report) | 1322 | struct snd_soc_jack *jack, int report) |
1323 | { | 1323 | { |
1324 | struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); | 1324 | struct wm8350_data *priv = snd_soc_component_get_drvdata(component); |
1325 | struct wm8350 *wm8350 = priv->wm8350; | 1325 | struct wm8350 *wm8350 = priv->wm8350; |
1326 | int ena; | 1326 | int ena; |
1327 | 1327 | ||
@@ -1389,7 +1389,7 @@ static irqreturn_t wm8350_mic_handler(int irq, void *data) | |||
1389 | /** | 1389 | /** |
1390 | * wm8350_mic_jack_detect - Enable microphone jack detection. | 1390 | * wm8350_mic_jack_detect - Enable microphone jack detection. |
1391 | * | 1391 | * |
1392 | * @codec: WM8350 codec | 1392 | * @component: WM8350 component |
1393 | * @jack: jack to report detection events on | 1393 | * @jack: jack to report detection events on |
1394 | * @detect_report: value to report when presence detected | 1394 | * @detect_report: value to report when presence detected |
1395 | * @short_report: value to report when microphone short detected | 1395 | * @short_report: value to report when microphone short detected |
@@ -1397,11 +1397,11 @@ static irqreturn_t wm8350_mic_handler(int irq, void *data) | |||
1397 | * Enables the microphone jack detection of the WM8350. If both reports | 1397 | * Enables the microphone jack detection of the WM8350. If both reports |
1398 | * are specified as zero then detection is disabled. | 1398 | * are specified as zero then detection is disabled. |
1399 | */ | 1399 | */ |
1400 | int wm8350_mic_jack_detect(struct snd_soc_codec *codec, | 1400 | int wm8350_mic_jack_detect(struct snd_soc_component *component, |
1401 | struct snd_soc_jack *jack, | 1401 | struct snd_soc_jack *jack, |
1402 | int detect_report, int short_report) | 1402 | int detect_report, int short_report) |
1403 | { | 1403 | { |
1404 | struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); | 1404 | struct wm8350_data *priv = snd_soc_component_get_drvdata(component); |
1405 | struct wm8350 *wm8350 = priv->wm8350; | 1405 | struct wm8350 *wm8350 = priv->wm8350; |
1406 | 1406 | ||
1407 | priv->mic.jack = jack; | 1407 | priv->mic.jack = jack; |
@@ -1455,26 +1455,26 @@ static struct snd_soc_dai_driver wm8350_dai = { | |||
1455 | .ops = &wm8350_dai_ops, | 1455 | .ops = &wm8350_dai_ops, |
1456 | }; | 1456 | }; |
1457 | 1457 | ||
1458 | static int wm8350_codec_probe(struct snd_soc_codec *codec) | 1458 | static int wm8350_component_probe(struct snd_soc_component *component) |
1459 | { | 1459 | { |
1460 | struct wm8350 *wm8350 = dev_get_platdata(codec->dev); | 1460 | struct wm8350 *wm8350 = dev_get_platdata(component->dev); |
1461 | struct wm8350_data *priv; | 1461 | struct wm8350_data *priv; |
1462 | struct wm8350_output *out1; | 1462 | struct wm8350_output *out1; |
1463 | struct wm8350_output *out2; | 1463 | struct wm8350_output *out2; |
1464 | int ret, i; | 1464 | int ret, i; |
1465 | 1465 | ||
1466 | if (wm8350->codec.platform_data == NULL) { | 1466 | if (wm8350->codec.platform_data == NULL) { |
1467 | dev_err(codec->dev, "No audio platform data supplied\n"); | 1467 | dev_err(component->dev, "No audio platform data supplied\n"); |
1468 | return -EINVAL; | 1468 | return -EINVAL; |
1469 | } | 1469 | } |
1470 | 1470 | ||
1471 | priv = devm_kzalloc(codec->dev, sizeof(struct wm8350_data), | 1471 | priv = devm_kzalloc(component->dev, sizeof(struct wm8350_data), |
1472 | GFP_KERNEL); | 1472 | GFP_KERNEL); |
1473 | if (priv == NULL) | 1473 | if (priv == NULL) |
1474 | return -ENOMEM; | 1474 | return -ENOMEM; |
1475 | 1475 | ||
1476 | snd_soc_codec_init_regmap(codec, wm8350->regmap); | 1476 | snd_soc_component_init_regmap(component, wm8350->regmap); |
1477 | snd_soc_codec_set_drvdata(codec, priv); | 1477 | snd_soc_component_set_drvdata(component, priv); |
1478 | 1478 | ||
1479 | priv->wm8350 = wm8350; | 1479 | priv->wm8350 = wm8350; |
1480 | 1480 | ||
@@ -1497,9 +1497,9 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) | |||
1497 | wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); | 1497 | wm8350_set_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); |
1498 | 1498 | ||
1499 | /* Enable robust clocking mode in ADC */ | 1499 | /* Enable robust clocking mode in ADC */ |
1500 | snd_soc_write(codec, WM8350_SECURITY, 0xa7); | 1500 | snd_soc_component_write(component, WM8350_SECURITY, 0xa7); |
1501 | snd_soc_write(codec, 0xde, 0x13); | 1501 | snd_soc_component_write(component, 0xde, 0x13); |
1502 | snd_soc_write(codec, WM8350_SECURITY, 0); | 1502 | snd_soc_component_write(component, WM8350_SECURITY, 0); |
1503 | 1503 | ||
1504 | /* read OUT1 & OUT2 volumes */ | 1504 | /* read OUT1 & OUT2 volumes */ |
1505 | out1 = &priv->out1; | 1505 | out1 = &priv->out1; |
@@ -1552,10 +1552,10 @@ static int wm8350_codec_probe(struct snd_soc_codec *codec) | |||
1552 | return 0; | 1552 | return 0; |
1553 | } | 1553 | } |
1554 | 1554 | ||
1555 | static int wm8350_codec_remove(struct snd_soc_codec *codec) | 1555 | static void wm8350_component_remove(struct snd_soc_component *component) |
1556 | { | 1556 | { |
1557 | struct wm8350_data *priv = snd_soc_codec_get_drvdata(codec); | 1557 | struct wm8350_data *priv = snd_soc_component_get_drvdata(component); |
1558 | struct wm8350 *wm8350 = dev_get_platdata(codec->dev); | 1558 | struct wm8350 *wm8350 = dev_get_platdata(component->dev); |
1559 | 1559 | ||
1560 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, | 1560 | wm8350_clear_bits(wm8350, WM8350_JACK_DETECT, |
1561 | WM8350_JDL_ENA | WM8350_JDR_ENA); | 1561 | WM8350_JDL_ENA | WM8350_JDR_ENA); |
@@ -1578,44 +1578,37 @@ static int wm8350_codec_remove(struct snd_soc_codec *codec) | |||
1578 | flush_delayed_work(&priv->pga_work); | 1578 | flush_delayed_work(&priv->pga_work); |
1579 | 1579 | ||
1580 | wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); | 1580 | wm8350_clear_bits(wm8350, WM8350_POWER_MGMT_5, WM8350_CODEC_ENA); |
1581 | |||
1582 | return 0; | ||
1583 | } | 1581 | } |
1584 | 1582 | ||
1585 | static const struct snd_soc_codec_driver soc_codec_dev_wm8350 = { | 1583 | static const struct snd_soc_component_driver soc_component_dev_wm8350 = { |
1586 | .probe = wm8350_codec_probe, | 1584 | .probe = wm8350_component_probe, |
1587 | .remove = wm8350_codec_remove, | 1585 | .remove = wm8350_component_remove, |
1588 | .set_bias_level = wm8350_set_bias_level, | 1586 | .set_bias_level = wm8350_set_bias_level, |
1589 | .suspend_bias_off = true, | 1587 | .controls = wm8350_snd_controls, |
1590 | 1588 | .num_controls = ARRAY_SIZE(wm8350_snd_controls), | |
1591 | .component_driver = { | 1589 | .dapm_widgets = wm8350_dapm_widgets, |
1592 | .controls = wm8350_snd_controls, | 1590 | .num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets), |
1593 | .num_controls = ARRAY_SIZE(wm8350_snd_controls), | 1591 | .dapm_routes = wm8350_dapm_routes, |
1594 | .dapm_widgets = wm8350_dapm_widgets, | 1592 | .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes), |
1595 | .num_dapm_widgets = ARRAY_SIZE(wm8350_dapm_widgets), | 1593 | .suspend_bias_off = 1, |
1596 | .dapm_routes = wm8350_dapm_routes, | 1594 | .idle_bias_on = 1, |
1597 | .num_dapm_routes = ARRAY_SIZE(wm8350_dapm_routes), | 1595 | .use_pmdown_time = 1, |
1598 | }, | 1596 | .endianness = 1, |
1597 | .non_legacy_dai_naming = 1, | ||
1599 | }; | 1598 | }; |
1600 | 1599 | ||
1601 | static int wm8350_probe(struct platform_device *pdev) | 1600 | static int wm8350_probe(struct platform_device *pdev) |
1602 | { | 1601 | { |
1603 | return snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8350, | 1602 | return devm_snd_soc_register_component(&pdev->dev, |
1603 | &soc_component_dev_wm8350, | ||
1604 | &wm8350_dai, 1); | 1604 | &wm8350_dai, 1); |
1605 | } | 1605 | } |
1606 | 1606 | ||
1607 | static int wm8350_remove(struct platform_device *pdev) | ||
1608 | { | ||
1609 | snd_soc_unregister_codec(&pdev->dev); | ||
1610 | return 0; | ||
1611 | } | ||
1612 | |||
1613 | static struct platform_driver wm8350_codec_driver = { | 1607 | static struct platform_driver wm8350_codec_driver = { |
1614 | .driver = { | 1608 | .driver = { |
1615 | .name = "wm8350-codec", | 1609 | .name = "wm8350-codec", |
1616 | }, | 1610 | }, |
1617 | .probe = wm8350_probe, | 1611 | .probe = wm8350_probe, |
1618 | .remove = wm8350_remove, | ||
1619 | }; | 1612 | }; |
1620 | 1613 | ||
1621 | module_platform_driver(wm8350_codec_driver); | 1614 | module_platform_driver(wm8350_codec_driver); |
diff --git a/sound/soc/codecs/wm8350.h b/sound/soc/codecs/wm8350.h index 74108eb82938..1191326c4a61 100644 --- a/sound/soc/codecs/wm8350.h +++ b/sound/soc/codecs/wm8350.h | |||
@@ -20,9 +20,9 @@ enum wm8350_jack { | |||
20 | WM8350_JDR = 2, | 20 | WM8350_JDR = 2, |
21 | }; | 21 | }; |
22 | 22 | ||
23 | int wm8350_hp_jack_detect(struct snd_soc_codec *codec, enum wm8350_jack which, | 23 | int wm8350_hp_jack_detect(struct snd_soc_component *component, enum wm8350_jack which, |
24 | struct snd_soc_jack *jack, int report); | 24 | struct snd_soc_jack *jack, int report); |
25 | int wm8350_mic_jack_detect(struct snd_soc_codec *codec, | 25 | int wm8350_mic_jack_detect(struct snd_soc_component *component, |
26 | struct snd_soc_jack *jack, | 26 | struct snd_soc_jack *jack, |
27 | int detect_report, int short_report); | 27 | int detect_report, int short_report); |
28 | 28 | ||
diff --git a/sound/soc/fsl/wm1133-ev1.c b/sound/soc/fsl/wm1133-ev1.c index cdaf16367b47..2f80b21b2921 100644 --- a/sound/soc/fsl/wm1133-ev1.c +++ b/sound/soc/fsl/wm1133-ev1.c | |||
@@ -201,18 +201,18 @@ static struct snd_soc_jack_pin mic_jack_pins[] = { | |||
201 | 201 | ||
202 | static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd) | 202 | static int wm1133_ev1_init(struct snd_soc_pcm_runtime *rtd) |
203 | { | 203 | { |
204 | struct snd_soc_codec *codec = rtd->codec; | 204 | struct snd_soc_component *component = rtd->codec_dai->component; |
205 | 205 | ||
206 | /* Headphone jack detection */ | 206 | /* Headphone jack detection */ |
207 | snd_soc_card_jack_new(rtd->card, "Headphone", SND_JACK_HEADPHONE, | 207 | snd_soc_card_jack_new(rtd->card, "Headphone", SND_JACK_HEADPHONE, |
208 | &hp_jack, hp_jack_pins, ARRAY_SIZE(hp_jack_pins)); | 208 | &hp_jack, hp_jack_pins, ARRAY_SIZE(hp_jack_pins)); |
209 | wm8350_hp_jack_detect(codec, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE); | 209 | wm8350_hp_jack_detect(component, WM8350_JDR, &hp_jack, SND_JACK_HEADPHONE); |
210 | 210 | ||
211 | /* Microphone jack detection */ | 211 | /* Microphone jack detection */ |
212 | snd_soc_card_jack_new(rtd->card, "Microphone", | 212 | snd_soc_card_jack_new(rtd->card, "Microphone", |
213 | SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack, | 213 | SND_JACK_MICROPHONE | SND_JACK_BTN_0, &mic_jack, |
214 | mic_jack_pins, ARRAY_SIZE(mic_jack_pins)); | 214 | mic_jack_pins, ARRAY_SIZE(mic_jack_pins)); |
215 | wm8350_mic_jack_detect(codec, &mic_jack, SND_JACK_MICROPHONE, | 215 | wm8350_mic_jack_detect(component, &mic_jack, SND_JACK_MICROPHONE, |
216 | SND_JACK_BTN_0); | 216 | SND_JACK_BTN_0); |
217 | 217 | ||
218 | snd_soc_dapm_force_enable_pin(&rtd->card->dapm, "Mic Bias"); | 218 | snd_soc_dapm_force_enable_pin(&rtd->card->dapm, "Mic Bias"); |