summaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2018-01-28 22:07:09 -0500
committerMark Brown <broonie@kernel.org>2018-02-12 04:42:07 -0500
commit51bef5c65b293152e4a189e0d3d6805ae5db9965 (patch)
tree3a9b23f44219927b5555b27b82d813aa0f512809 /sound
parent7928b2cbe55b2a410a0f5c1f154610059c57b1b2 (diff)
ASoC: wm8990: 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>
Diffstat (limited to 'sound')
-rw-r--r--sound/soc/codecs/wm8990.c179
1 files changed, 86 insertions, 93 deletions
diff --git a/sound/soc/codecs/wm8990.c b/sound/soc/codecs/wm8990.c
index a8945001e696..411b9eee88c2 100644
--- a/sound/soc/codecs/wm8990.c
+++ b/sound/soc/codecs/wm8990.c
@@ -111,7 +111,7 @@ static const struct reg_default wm8990_reg_defaults[] = {
111 { 62, 0x0026 }, /* R62 - PLL3 */ 111 { 62, 0x0026 }, /* R62 - PLL3 */
112}; 112};
113 113
114#define wm8990_reset(c) snd_soc_write(c, WM8990_RESET, 0) 114#define wm8990_reset(c) snd_soc_component_write(c, WM8990_RESET, 0)
115 115
116static const DECLARE_TLV_DB_SCALE(rec_mix_tlv, -1500, 600, 0); 116static const DECLARE_TLV_DB_SCALE(rec_mix_tlv, -1500, 600, 0);
117 117
@@ -132,7 +132,7 @@ static const DECLARE_TLV_DB_SCALE(out_sidetone_tlv, -3600, 0, 0);
132static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol, 132static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
133 struct snd_ctl_elem_value *ucontrol) 133 struct snd_ctl_elem_value *ucontrol)
134{ 134{
135 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 135 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
136 struct soc_mixer_control *mc = 136 struct soc_mixer_control *mc =
137 (struct soc_mixer_control *)kcontrol->private_value; 137 (struct soc_mixer_control *)kcontrol->private_value;
138 int reg = mc->reg; 138 int reg = mc->reg;
@@ -144,8 +144,8 @@ static int wm899x_outpga_put_volsw_vu(struct snd_kcontrol *kcontrol,
144 return ret; 144 return ret;
145 145
146 /* now hit the volume update bits (always bit 8) */ 146 /* now hit the volume update bits (always bit 8) */
147 val = snd_soc_read(codec, reg); 147 val = snd_soc_component_read32(component, reg);
148 return snd_soc_write(codec, reg, val | 0x0100); 148 return snd_soc_component_write(component, reg, val | 0x0100);
149} 149}
150 150
151#define SOC_WM899X_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert,\ 151#define SOC_WM899X_OUTPGA_SINGLE_R_TLV(xname, reg, shift, max, invert,\
@@ -374,14 +374,14 @@ SOC_SINGLE("RIN34 Mute Switch", WM8990_RIGHT_LINE_INPUT_3_4_VOLUME,
374static int outmixer_event(struct snd_soc_dapm_widget *w, 374static int outmixer_event(struct snd_soc_dapm_widget *w,
375 struct snd_kcontrol *kcontrol, int event) 375 struct snd_kcontrol *kcontrol, int event)
376{ 376{
377 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 377 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
378 u32 reg_shift = kcontrol->private_value & 0xfff; 378 u32 reg_shift = kcontrol->private_value & 0xfff;
379 int ret = 0; 379 int ret = 0;
380 u16 reg; 380 u16 reg;
381 381
382 switch (reg_shift) { 382 switch (reg_shift) {
383 case WM8990_SPEAKER_MIXER | (WM8990_LDSPK_BIT << 8) : 383 case WM8990_SPEAKER_MIXER | (WM8990_LDSPK_BIT << 8) :
384 reg = snd_soc_read(codec, WM8990_OUTPUT_MIXER1); 384 reg = snd_soc_component_read32(component, WM8990_OUTPUT_MIXER1);
385 if (reg & WM8990_LDLO) { 385 if (reg & WM8990_LDLO) {
386 printk(KERN_WARNING 386 printk(KERN_WARNING
387 "Cannot set as Output Mixer 1 LDLO Set\n"); 387 "Cannot set as Output Mixer 1 LDLO Set\n");
@@ -389,7 +389,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
389 } 389 }
390 break; 390 break;
391 case WM8990_SPEAKER_MIXER | (WM8990_RDSPK_BIT << 8): 391 case WM8990_SPEAKER_MIXER | (WM8990_RDSPK_BIT << 8):
392 reg = snd_soc_read(codec, WM8990_OUTPUT_MIXER2); 392 reg = snd_soc_component_read32(component, WM8990_OUTPUT_MIXER2);
393 if (reg & WM8990_RDRO) { 393 if (reg & WM8990_RDRO) {
394 printk(KERN_WARNING 394 printk(KERN_WARNING
395 "Cannot set as Output Mixer 2 RDRO Set\n"); 395 "Cannot set as Output Mixer 2 RDRO Set\n");
@@ -397,7 +397,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
397 } 397 }
398 break; 398 break;
399 case WM8990_OUTPUT_MIXER1 | (WM8990_LDLO_BIT << 8): 399 case WM8990_OUTPUT_MIXER1 | (WM8990_LDLO_BIT << 8):
400 reg = snd_soc_read(codec, WM8990_SPEAKER_MIXER); 400 reg = snd_soc_component_read32(component, WM8990_SPEAKER_MIXER);
401 if (reg & WM8990_LDSPK) { 401 if (reg & WM8990_LDSPK) {
402 printk(KERN_WARNING 402 printk(KERN_WARNING
403 "Cannot set as Speaker Mixer LDSPK Set\n"); 403 "Cannot set as Speaker Mixer LDSPK Set\n");
@@ -405,7 +405,7 @@ static int outmixer_event(struct snd_soc_dapm_widget *w,
405 } 405 }
406 break; 406 break;
407 case WM8990_OUTPUT_MIXER2 | (WM8990_RDRO_BIT << 8): 407 case WM8990_OUTPUT_MIXER2 | (WM8990_RDRO_BIT << 8):
408 reg = snd_soc_read(codec, WM8990_SPEAKER_MIXER); 408 reg = snd_soc_component_read32(component, WM8990_SPEAKER_MIXER);
409 if (reg & WM8990_RDSPK) { 409 if (reg & WM8990_RDSPK) {
410 printk(KERN_WARNING 410 printk(KERN_WARNING
411 "Cannot set as Speaker Mixer RDSPK Set\n"); 411 "Cannot set as Speaker Mixer RDSPK Set\n");
@@ -934,28 +934,28 @@ static void pll_factors(struct _pll_div *pll_div, unsigned int target,
934static int wm8990_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id, 934static int wm8990_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
935 int source, unsigned int freq_in, unsigned int freq_out) 935 int source, unsigned int freq_in, unsigned int freq_out)
936{ 936{
937 struct snd_soc_codec *codec = codec_dai->codec; 937 struct snd_soc_component *component = codec_dai->component;
938 struct _pll_div pll_div; 938 struct _pll_div pll_div;
939 939
940 if (freq_in && freq_out) { 940 if (freq_in && freq_out) {
941 pll_factors(&pll_div, freq_out * 4, freq_in); 941 pll_factors(&pll_div, freq_out * 4, freq_in);
942 942
943 /* Turn on PLL */ 943 /* Turn on PLL */
944 snd_soc_update_bits(codec, WM8990_POWER_MANAGEMENT_2, 944 snd_soc_component_update_bits(component, WM8990_POWER_MANAGEMENT_2,
945 WM8990_PLL_ENA, WM8990_PLL_ENA); 945 WM8990_PLL_ENA, WM8990_PLL_ENA);
946 946
947 /* sysclk comes from PLL */ 947 /* sysclk comes from PLL */
948 snd_soc_update_bits(codec, WM8990_CLOCKING_2, 948 snd_soc_component_update_bits(component, WM8990_CLOCKING_2,
949 WM8990_SYSCLK_SRC, WM8990_SYSCLK_SRC); 949 WM8990_SYSCLK_SRC, WM8990_SYSCLK_SRC);
950 950
951 /* set up N , fractional mode and pre-divisor if necessary */ 951 /* set up N , fractional mode and pre-divisor if necessary */
952 snd_soc_write(codec, WM8990_PLL1, pll_div.n | WM8990_SDM | 952 snd_soc_component_write(component, WM8990_PLL1, pll_div.n | WM8990_SDM |
953 (pll_div.div2?WM8990_PRESCALE:0)); 953 (pll_div.div2?WM8990_PRESCALE:0));
954 snd_soc_write(codec, WM8990_PLL2, (u8)(pll_div.k>>8)); 954 snd_soc_component_write(component, WM8990_PLL2, (u8)(pll_div.k>>8));
955 snd_soc_write(codec, WM8990_PLL3, (u8)(pll_div.k & 0xFF)); 955 snd_soc_component_write(component, WM8990_PLL3, (u8)(pll_div.k & 0xFF));
956 } else { 956 } else {
957 /* Turn off PLL */ 957 /* Turn off PLL */
958 snd_soc_update_bits(codec, WM8990_POWER_MANAGEMENT_2, 958 snd_soc_component_update_bits(component, WM8990_POWER_MANAGEMENT_2,
959 WM8990_PLL_ENA, 0); 959 WM8990_PLL_ENA, 0);
960 } 960 }
961 return 0; 961 return 0;
@@ -967,8 +967,8 @@ static int wm8990_set_dai_pll(struct snd_soc_dai *codec_dai, int pll_id,
967static int wm8990_set_dai_sysclk(struct snd_soc_dai *codec_dai, 967static int wm8990_set_dai_sysclk(struct snd_soc_dai *codec_dai,
968 int clk_id, unsigned int freq, int dir) 968 int clk_id, unsigned int freq, int dir)
969{ 969{
970 struct snd_soc_codec *codec = codec_dai->codec; 970 struct snd_soc_component *component = codec_dai->component;
971 struct wm8990_priv *wm8990 = snd_soc_codec_get_drvdata(codec); 971 struct wm8990_priv *wm8990 = snd_soc_component_get_drvdata(component);
972 972
973 wm8990->sysclk = freq; 973 wm8990->sysclk = freq;
974 return 0; 974 return 0;
@@ -980,11 +980,11 @@ static int wm8990_set_dai_sysclk(struct snd_soc_dai *codec_dai,
980static int wm8990_set_dai_fmt(struct snd_soc_dai *codec_dai, 980static int wm8990_set_dai_fmt(struct snd_soc_dai *codec_dai,
981 unsigned int fmt) 981 unsigned int fmt)
982{ 982{
983 struct snd_soc_codec *codec = codec_dai->codec; 983 struct snd_soc_component *component = codec_dai->component;
984 u16 audio1, audio3; 984 u16 audio1, audio3;
985 985
986 audio1 = snd_soc_read(codec, WM8990_AUDIO_INTERFACE_1); 986 audio1 = snd_soc_component_read32(component, WM8990_AUDIO_INTERFACE_1);
987 audio3 = snd_soc_read(codec, WM8990_AUDIO_INTERFACE_3); 987 audio3 = snd_soc_component_read32(component, WM8990_AUDIO_INTERFACE_3);
988 988
989 /* set master/slave audio interface */ 989 /* set master/slave audio interface */
990 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) { 990 switch (fmt & SND_SOC_DAIFMT_MASTER_MASK) {
@@ -1025,31 +1025,31 @@ static int wm8990_set_dai_fmt(struct snd_soc_dai *codec_dai,
1025 return -EINVAL; 1025 return -EINVAL;
1026 } 1026 }
1027 1027
1028 snd_soc_write(codec, WM8990_AUDIO_INTERFACE_1, audio1); 1028 snd_soc_component_write(component, WM8990_AUDIO_INTERFACE_1, audio1);
1029 snd_soc_write(codec, WM8990_AUDIO_INTERFACE_3, audio3); 1029 snd_soc_component_write(component, WM8990_AUDIO_INTERFACE_3, audio3);
1030 return 0; 1030 return 0;
1031} 1031}
1032 1032
1033static int wm8990_set_dai_clkdiv(struct snd_soc_dai *codec_dai, 1033static int wm8990_set_dai_clkdiv(struct snd_soc_dai *codec_dai,
1034 int div_id, int div) 1034 int div_id, int div)
1035{ 1035{
1036 struct snd_soc_codec *codec = codec_dai->codec; 1036 struct snd_soc_component *component = codec_dai->component;
1037 1037
1038 switch (div_id) { 1038 switch (div_id) {
1039 case WM8990_MCLK_DIV: 1039 case WM8990_MCLK_DIV:
1040 snd_soc_update_bits(codec, WM8990_CLOCKING_2, 1040 snd_soc_component_update_bits(component, WM8990_CLOCKING_2,
1041 WM8990_MCLK_DIV_MASK, div); 1041 WM8990_MCLK_DIV_MASK, div);
1042 break; 1042 break;
1043 case WM8990_DACCLK_DIV: 1043 case WM8990_DACCLK_DIV:
1044 snd_soc_update_bits(codec, WM8990_CLOCKING_2, 1044 snd_soc_component_update_bits(component, WM8990_CLOCKING_2,
1045 WM8990_DAC_CLKDIV_MASK, div); 1045 WM8990_DAC_CLKDIV_MASK, div);
1046 break; 1046 break;
1047 case WM8990_ADCCLK_DIV: 1047 case WM8990_ADCCLK_DIV:
1048 snd_soc_update_bits(codec, WM8990_CLOCKING_2, 1048 snd_soc_component_update_bits(component, WM8990_CLOCKING_2,
1049 WM8990_ADC_CLKDIV_MASK, div); 1049 WM8990_ADC_CLKDIV_MASK, div);
1050 break; 1050 break;
1051 case WM8990_BCLK_DIV: 1051 case WM8990_BCLK_DIV:
1052 snd_soc_update_bits(codec, WM8990_CLOCKING_1, 1052 snd_soc_component_update_bits(component, WM8990_CLOCKING_1,
1053 WM8990_BCLK_DIV_MASK, div); 1053 WM8990_BCLK_DIV_MASK, div);
1054 break; 1054 break;
1055 default: 1055 default:
@@ -1066,8 +1066,8 @@ static int wm8990_hw_params(struct snd_pcm_substream *substream,
1066 struct snd_pcm_hw_params *params, 1066 struct snd_pcm_hw_params *params,
1067 struct snd_soc_dai *dai) 1067 struct snd_soc_dai *dai)
1068{ 1068{
1069 struct snd_soc_codec *codec = dai->codec; 1069 struct snd_soc_component *component = dai->component;
1070 u16 audio1 = snd_soc_read(codec, WM8990_AUDIO_INTERFACE_1); 1070 u16 audio1 = snd_soc_component_read32(component, WM8990_AUDIO_INTERFACE_1);
1071 1071
1072 audio1 &= ~WM8990_AIF_WL_MASK; 1072 audio1 &= ~WM8990_AIF_WL_MASK;
1073 /* bit size */ 1073 /* bit size */
@@ -1085,29 +1085,29 @@ static int wm8990_hw_params(struct snd_pcm_substream *substream,
1085 break; 1085 break;
1086 } 1086 }
1087 1087
1088 snd_soc_write(codec, WM8990_AUDIO_INTERFACE_1, audio1); 1088 snd_soc_component_write(component, WM8990_AUDIO_INTERFACE_1, audio1);
1089 return 0; 1089 return 0;
1090} 1090}
1091 1091
1092static int wm8990_mute(struct snd_soc_dai *dai, int mute) 1092static int wm8990_mute(struct snd_soc_dai *dai, int mute)
1093{ 1093{
1094 struct snd_soc_codec *codec = dai->codec; 1094 struct snd_soc_component *component = dai->component;
1095 u16 val; 1095 u16 val;
1096 1096
1097 val = snd_soc_read(codec, WM8990_DAC_CTRL) & ~WM8990_DAC_MUTE; 1097 val = snd_soc_component_read32(component, WM8990_DAC_CTRL) & ~WM8990_DAC_MUTE;
1098 1098
1099 if (mute) 1099 if (mute)
1100 snd_soc_write(codec, WM8990_DAC_CTRL, val | WM8990_DAC_MUTE); 1100 snd_soc_component_write(component, WM8990_DAC_CTRL, val | WM8990_DAC_MUTE);
1101 else 1101 else
1102 snd_soc_write(codec, WM8990_DAC_CTRL, val); 1102 snd_soc_component_write(component, WM8990_DAC_CTRL, val);
1103 1103
1104 return 0; 1104 return 0;
1105} 1105}
1106 1106
1107static int wm8990_set_bias_level(struct snd_soc_codec *codec, 1107static int wm8990_set_bias_level(struct snd_soc_component *component,
1108 enum snd_soc_bias_level level) 1108 enum snd_soc_bias_level level)
1109{ 1109{
1110 struct wm8990_priv *wm8990 = snd_soc_codec_get_drvdata(codec); 1110 struct wm8990_priv *wm8990 = snd_soc_component_get_drvdata(component);
1111 int ret; 1111 int ret;
1112 1112
1113 switch (level) { 1113 switch (level) {
@@ -1116,26 +1116,26 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec,
1116 1116
1117 case SND_SOC_BIAS_PREPARE: 1117 case SND_SOC_BIAS_PREPARE:
1118 /* VMID=2*50k */ 1118 /* VMID=2*50k */
1119 snd_soc_update_bits(codec, WM8990_POWER_MANAGEMENT_1, 1119 snd_soc_component_update_bits(component, WM8990_POWER_MANAGEMENT_1,
1120 WM8990_VMID_MODE_MASK, 0x2); 1120 WM8990_VMID_MODE_MASK, 0x2);
1121 break; 1121 break;
1122 1122
1123 case SND_SOC_BIAS_STANDBY: 1123 case SND_SOC_BIAS_STANDBY:
1124 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { 1124 if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1125 ret = regcache_sync(wm8990->regmap); 1125 ret = regcache_sync(wm8990->regmap);
1126 if (ret < 0) { 1126 if (ret < 0) {
1127 dev_err(codec->dev, "Failed to sync cache: %d\n", ret); 1127 dev_err(component->dev, "Failed to sync cache: %d\n", ret);
1128 return ret; 1128 return ret;
1129 } 1129 }
1130 1130
1131 /* Enable all output discharge bits */ 1131 /* Enable all output discharge bits */
1132 snd_soc_write(codec, WM8990_ANTIPOP1, WM8990_DIS_LLINE | 1132 snd_soc_component_write(component, WM8990_ANTIPOP1, WM8990_DIS_LLINE |
1133 WM8990_DIS_RLINE | WM8990_DIS_OUT3 | 1133 WM8990_DIS_RLINE | WM8990_DIS_OUT3 |
1134 WM8990_DIS_OUT4 | WM8990_DIS_LOUT | 1134 WM8990_DIS_OUT4 | WM8990_DIS_LOUT |
1135 WM8990_DIS_ROUT); 1135 WM8990_DIS_ROUT);
1136 1136
1137 /* Enable POBCTRL, SOFT_ST, VMIDTOG and BUFDCOPEN */ 1137 /* Enable POBCTRL, SOFT_ST, VMIDTOG and BUFDCOPEN */
1138 snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | 1138 snd_soc_component_write(component, WM8990_ANTIPOP2, WM8990_SOFTST |
1139 WM8990_BUFDCOPEN | WM8990_POBCTRL | 1139 WM8990_BUFDCOPEN | WM8990_POBCTRL |
1140 WM8990_VMIDTOG); 1140 WM8990_VMIDTOG);
1141 1141
@@ -1143,82 +1143,82 @@ static int wm8990_set_bias_level(struct snd_soc_codec *codec,
1143 msleep(300); 1143 msleep(300);
1144 1144
1145 /* Disable VMIDTOG */ 1145 /* Disable VMIDTOG */
1146 snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | 1146 snd_soc_component_write(component, WM8990_ANTIPOP2, WM8990_SOFTST |
1147 WM8990_BUFDCOPEN | WM8990_POBCTRL); 1147 WM8990_BUFDCOPEN | WM8990_POBCTRL);
1148 1148
1149 /* disable all output discharge bits */ 1149 /* disable all output discharge bits */
1150 snd_soc_write(codec, WM8990_ANTIPOP1, 0); 1150 snd_soc_component_write(component, WM8990_ANTIPOP1, 0);
1151 1151
1152 /* Enable outputs */ 1152 /* Enable outputs */
1153 snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1b00); 1153 snd_soc_component_write(component, WM8990_POWER_MANAGEMENT_1, 0x1b00);
1154 1154
1155 msleep(50); 1155 msleep(50);
1156 1156
1157 /* Enable VMID at 2x50k */ 1157 /* Enable VMID at 2x50k */
1158 snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f02); 1158 snd_soc_component_write(component, WM8990_POWER_MANAGEMENT_1, 0x1f02);
1159 1159
1160 msleep(100); 1160 msleep(100);
1161 1161
1162 /* Enable VREF */ 1162 /* Enable VREF */
1163 snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f03); 1163 snd_soc_component_write(component, WM8990_POWER_MANAGEMENT_1, 0x1f03);
1164 1164
1165 msleep(600); 1165 msleep(600);
1166 1166
1167 /* Enable BUFIOEN */ 1167 /* Enable BUFIOEN */
1168 snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | 1168 snd_soc_component_write(component, WM8990_ANTIPOP2, WM8990_SOFTST |
1169 WM8990_BUFDCOPEN | WM8990_POBCTRL | 1169 WM8990_BUFDCOPEN | WM8990_POBCTRL |
1170 WM8990_BUFIOEN); 1170 WM8990_BUFIOEN);
1171 1171
1172 /* Disable outputs */ 1172 /* Disable outputs */
1173 snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x3); 1173 snd_soc_component_write(component, WM8990_POWER_MANAGEMENT_1, 0x3);
1174 1174
1175 /* disable POBCTRL, SOFT_ST and BUFDCOPEN */ 1175 /* disable POBCTRL, SOFT_ST and BUFDCOPEN */
1176 snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_BUFIOEN); 1176 snd_soc_component_write(component, WM8990_ANTIPOP2, WM8990_BUFIOEN);
1177 1177
1178 /* Enable workaround for ADC clocking issue. */ 1178 /* Enable workaround for ADC clocking issue. */
1179 snd_soc_write(codec, WM8990_EXT_ACCESS_ENA, 0x2); 1179 snd_soc_component_write(component, WM8990_EXT_ACCESS_ENA, 0x2);
1180 snd_soc_write(codec, WM8990_EXT_CTL1, 0xa003); 1180 snd_soc_component_write(component, WM8990_EXT_CTL1, 0xa003);
1181 snd_soc_write(codec, WM8990_EXT_ACCESS_ENA, 0); 1181 snd_soc_component_write(component, WM8990_EXT_ACCESS_ENA, 0);
1182 } 1182 }
1183 1183
1184 /* VMID=2*250k */ 1184 /* VMID=2*250k */
1185 snd_soc_update_bits(codec, WM8990_POWER_MANAGEMENT_1, 1185 snd_soc_component_update_bits(component, WM8990_POWER_MANAGEMENT_1,
1186 WM8990_VMID_MODE_MASK, 0x4); 1186 WM8990_VMID_MODE_MASK, 0x4);
1187 break; 1187 break;
1188 1188
1189 case SND_SOC_BIAS_OFF: 1189 case SND_SOC_BIAS_OFF:
1190 /* Enable POBCTRL and SOFT_ST */ 1190 /* Enable POBCTRL and SOFT_ST */
1191 snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | 1191 snd_soc_component_write(component, WM8990_ANTIPOP2, WM8990_SOFTST |
1192 WM8990_POBCTRL | WM8990_BUFIOEN); 1192 WM8990_POBCTRL | WM8990_BUFIOEN);
1193 1193
1194 /* Enable POBCTRL, SOFT_ST and BUFDCOPEN */ 1194 /* Enable POBCTRL, SOFT_ST and BUFDCOPEN */
1195 snd_soc_write(codec, WM8990_ANTIPOP2, WM8990_SOFTST | 1195 snd_soc_component_write(component, WM8990_ANTIPOP2, WM8990_SOFTST |
1196 WM8990_BUFDCOPEN | WM8990_POBCTRL | 1196 WM8990_BUFDCOPEN | WM8990_POBCTRL |
1197 WM8990_BUFIOEN); 1197 WM8990_BUFIOEN);
1198 1198
1199 /* mute DAC */ 1199 /* mute DAC */
1200 snd_soc_update_bits(codec, WM8990_DAC_CTRL, 1200 snd_soc_component_update_bits(component, WM8990_DAC_CTRL,
1201 WM8990_DAC_MUTE, WM8990_DAC_MUTE); 1201 WM8990_DAC_MUTE, WM8990_DAC_MUTE);
1202 1202
1203 /* Enable any disabled outputs */ 1203 /* Enable any disabled outputs */
1204 snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f03); 1204 snd_soc_component_write(component, WM8990_POWER_MANAGEMENT_1, 0x1f03);
1205 1205
1206 /* Disable VMID */ 1206 /* Disable VMID */
1207 snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x1f01); 1207 snd_soc_component_write(component, WM8990_POWER_MANAGEMENT_1, 0x1f01);
1208 1208
1209 msleep(300); 1209 msleep(300);
1210 1210
1211 /* Enable all output discharge bits */ 1211 /* Enable all output discharge bits */
1212 snd_soc_write(codec, WM8990_ANTIPOP1, WM8990_DIS_LLINE | 1212 snd_soc_component_write(component, WM8990_ANTIPOP1, WM8990_DIS_LLINE |
1213 WM8990_DIS_RLINE | WM8990_DIS_OUT3 | 1213 WM8990_DIS_RLINE | WM8990_DIS_OUT3 |
1214 WM8990_DIS_OUT4 | WM8990_DIS_LOUT | 1214 WM8990_DIS_OUT4 | WM8990_DIS_LOUT |
1215 WM8990_DIS_ROUT); 1215 WM8990_DIS_ROUT);
1216 1216
1217 /* Disable VREF */ 1217 /* Disable VREF */
1218 snd_soc_write(codec, WM8990_POWER_MANAGEMENT_1, 0x0); 1218 snd_soc_component_write(component, WM8990_POWER_MANAGEMENT_1, 0x0);
1219 1219
1220 /* disable POBCTRL, SOFT_ST and BUFDCOPEN */ 1220 /* disable POBCTRL, SOFT_ST and BUFDCOPEN */
1221 snd_soc_write(codec, WM8990_ANTIPOP2, 0x0); 1221 snd_soc_component_write(component, WM8990_ANTIPOP2, 0x0);
1222 1222
1223 regcache_mark_dirty(wm8990->regmap); 1223 regcache_mark_dirty(wm8990->regmap);
1224 break; 1224 break;
@@ -1272,41 +1272,42 @@ static struct snd_soc_dai_driver wm8990_dai = {
1272 * initialise the WM8990 driver 1272 * initialise the WM8990 driver
1273 * register the mixer and dsp interfaces with the kernel 1273 * register the mixer and dsp interfaces with the kernel
1274 */ 1274 */
1275static int wm8990_probe(struct snd_soc_codec *codec) 1275static int wm8990_probe(struct snd_soc_component *component)
1276{ 1276{
1277 wm8990_reset(codec); 1277 wm8990_reset(component);
1278 1278
1279 /* charge output caps */ 1279 /* charge output caps */
1280 snd_soc_codec_force_bias_level(codec, SND_SOC_BIAS_STANDBY); 1280 snd_soc_component_force_bias_level(component, SND_SOC_BIAS_STANDBY);
1281 1281
1282 snd_soc_update_bits(codec, WM8990_AUDIO_INTERFACE_4, 1282 snd_soc_component_update_bits(component, WM8990_AUDIO_INTERFACE_4,
1283 WM8990_ALRCGPIO1, WM8990_ALRCGPIO1); 1283 WM8990_ALRCGPIO1, WM8990_ALRCGPIO1);
1284 1284
1285 snd_soc_update_bits(codec, WM8990_GPIO1_GPIO2, 1285 snd_soc_component_update_bits(component, WM8990_GPIO1_GPIO2,
1286 WM8990_GPIO1_SEL_MASK, 1); 1286 WM8990_GPIO1_SEL_MASK, 1);
1287 1287
1288 snd_soc_update_bits(codec, WM8990_POWER_MANAGEMENT_2, 1288 snd_soc_component_update_bits(component, WM8990_POWER_MANAGEMENT_2,
1289 WM8990_OPCLK_ENA, WM8990_OPCLK_ENA); 1289 WM8990_OPCLK_ENA, WM8990_OPCLK_ENA);
1290 1290
1291 snd_soc_write(codec, WM8990_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8)); 1291 snd_soc_component_write(component, WM8990_LEFT_OUTPUT_VOLUME, 0x50 | (1<<8));
1292 snd_soc_write(codec, WM8990_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8)); 1292 snd_soc_component_write(component, WM8990_RIGHT_OUTPUT_VOLUME, 0x50 | (1<<8));
1293 1293
1294 return 0; 1294 return 0;
1295} 1295}
1296 1296
1297static const struct snd_soc_codec_driver soc_codec_dev_wm8990 = { 1297static const struct snd_soc_component_driver soc_component_dev_wm8990 = {
1298 .probe = wm8990_probe, 1298 .probe = wm8990_probe,
1299 .set_bias_level = wm8990_set_bias_level, 1299 .set_bias_level = wm8990_set_bias_level,
1300 .suspend_bias_off = true, 1300 .controls = wm8990_snd_controls,
1301 1301 .num_controls = ARRAY_SIZE(wm8990_snd_controls),
1302 .component_driver = { 1302 .dapm_widgets = wm8990_dapm_widgets,
1303 .controls = wm8990_snd_controls, 1303 .num_dapm_widgets = ARRAY_SIZE(wm8990_dapm_widgets),
1304 .num_controls = ARRAY_SIZE(wm8990_snd_controls), 1304 .dapm_routes = wm8990_dapm_routes,
1305 .dapm_widgets = wm8990_dapm_widgets, 1305 .num_dapm_routes = ARRAY_SIZE(wm8990_dapm_routes),
1306 .num_dapm_widgets = ARRAY_SIZE(wm8990_dapm_widgets), 1306 .suspend_bias_off = 1,
1307 .dapm_routes = wm8990_dapm_routes, 1307 .idle_bias_on = 1,
1308 .num_dapm_routes = ARRAY_SIZE(wm8990_dapm_routes), 1308 .use_pmdown_time = 1,
1309 }, 1309 .endianness = 1,
1310 .non_legacy_dai_naming = 1,
1310}; 1311};
1311 1312
1312static const struct regmap_config wm8990_regmap = { 1313static const struct regmap_config wm8990_regmap = {
@@ -1333,19 +1334,12 @@ static int wm8990_i2c_probe(struct i2c_client *i2c,
1333 1334
1334 i2c_set_clientdata(i2c, wm8990); 1335 i2c_set_clientdata(i2c, wm8990);
1335 1336
1336 ret = snd_soc_register_codec(&i2c->dev, 1337 ret = devm_snd_soc_register_component(&i2c->dev,
1337 &soc_codec_dev_wm8990, &wm8990_dai, 1); 1338 &soc_component_dev_wm8990, &wm8990_dai, 1);
1338 1339
1339 return ret; 1340 return ret;
1340} 1341}
1341 1342
1342static int wm8990_i2c_remove(struct i2c_client *client)
1343{
1344 snd_soc_unregister_codec(&client->dev);
1345
1346 return 0;
1347}
1348
1349static const struct i2c_device_id wm8990_i2c_id[] = { 1343static const struct i2c_device_id wm8990_i2c_id[] = {
1350 { "wm8990", 0 }, 1344 { "wm8990", 0 },
1351 { } 1345 { }
@@ -1357,7 +1351,6 @@ static struct i2c_driver wm8990_i2c_driver = {
1357 .name = "wm8990", 1351 .name = "wm8990",
1358 }, 1352 },
1359 .probe = wm8990_i2c_probe, 1353 .probe = wm8990_i2c_probe,
1360 .remove = wm8990_i2c_remove,
1361 .id_table = wm8990_i2c_id, 1354 .id_table = wm8990_i2c_id,
1362}; 1355};
1363 1356