summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>2018-02-12 21:03:12 -0500
committerMark Brown <broonie@kernel.org>2018-02-14 05:44:19 -0500
commit0fe1daa6663ae9437c7168b81fe23c9ed50f55df (patch)
treef31a7178b5fd5cf2b0157ae67cd70bc0690bd677
parent03a0ddeda7ebafea8e99078581a50d856e3587a4 (diff)
ASoC: arizona: replace codec to component
Now we can replace Codec to Component. Let's do it. Because there are many drivers which are using arizona, we need to update these all related drivers in same time. Otherwise compile error/warning happen Note: cs47l24 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 wm5102 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 wm5110 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 wm8997 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .ignore_pmdown_time = 0 -> .use_pmdown_time = 1 - -> .endianness = 1 - -> .non_legacy_dai_naming = 1 wm8998 xxx_codec_xxx() -> xxx_component_xxx() .idle_bias_off = 1 -> .idle_bias_on = 0 .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> Tested-by: Charles Keepax <ckeepax@opensource.cirrus.com> Acked-by: Charles Keepax <ckeepax@opensource.cirrus.com> Signed-off-by: Mark Brown <broonie@kernel.org>
-rw-r--r--sound/soc/codecs/arizona.c208
-rw-r--r--sound/soc/codecs/arizona.h24
-rw-r--r--sound/soc/codecs/cs47l24.c86
-rw-r--r--sound/soc/codecs/wm5102.c106
-rw-r--r--sound/soc/codecs/wm5110.c140
-rw-r--r--sound/soc/codecs/wm8997.c62
-rw-r--r--sound/soc/codecs/wm8998.c88
-rw-r--r--sound/soc/codecs/wm_adsp.c58
-rw-r--r--sound/soc/codecs/wm_adsp.h6
-rw-r--r--sound/soc/samsung/tm2_wm5110.c54
10 files changed, 400 insertions, 432 deletions
diff --git a/sound/soc/codecs/arizona.c b/sound/soc/codecs/arizona.c
index b3375e19598a..ffcfe8ea1848 100644
--- a/sound/soc/codecs/arizona.c
+++ b/sound/soc/codecs/arizona.c
@@ -84,13 +84,13 @@ static int arizona_spk_ev(struct snd_soc_dapm_widget *w,
84 struct snd_kcontrol *kcontrol, 84 struct snd_kcontrol *kcontrol,
85 int event) 85 int event)
86{ 86{
87 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 87 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
88 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 88 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
89 int val; 89 int val;
90 90
91 switch (event) { 91 switch (event) {
92 case SND_SOC_DAPM_POST_PMU: 92 case SND_SOC_DAPM_POST_PMU:
93 val = snd_soc_read(codec, ARIZONA_INTERRUPT_RAW_STATUS_3); 93 val = snd_soc_component_read32(component, ARIZONA_INTERRUPT_RAW_STATUS_3);
94 if (val & ARIZONA_SPK_OVERHEAT_STS) { 94 if (val & ARIZONA_SPK_OVERHEAT_STS) {
95 dev_crit(arizona->dev, 95 dev_crit(arizona->dev,
96 "Speaker not enabled due to temperature\n"); 96 "Speaker not enabled due to temperature\n");
@@ -169,10 +169,10 @@ static const struct snd_soc_dapm_widget arizona_spkr =
169 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU | 169 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMU |
170 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD); 170 SND_SOC_DAPM_PRE_PMD | SND_SOC_DAPM_POST_PMD);
171 171
172int arizona_init_spk(struct snd_soc_codec *codec) 172int arizona_init_spk(struct snd_soc_component *component)
173{ 173{
174 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 174 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
175 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 175 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
176 struct arizona *arizona = priv->arizona; 176 struct arizona *arizona = priv->arizona;
177 int ret; 177 int ret;
178 178
@@ -238,10 +238,10 @@ static const struct snd_soc_dapm_route arizona_mono_routes[] = {
238 { "OUT6R", NULL, "OUT6L" }, 238 { "OUT6R", NULL, "OUT6L" },
239}; 239};
240 240
241int arizona_init_mono(struct snd_soc_codec *codec) 241int arizona_init_mono(struct snd_soc_component *component)
242{ 242{
243 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 243 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
244 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 244 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
245 struct arizona *arizona = priv->arizona; 245 struct arizona *arizona = priv->arizona;
246 int i; 246 int i;
247 247
@@ -255,11 +255,9 @@ int arizona_init_mono(struct snd_soc_codec *codec)
255} 255}
256EXPORT_SYMBOL_GPL(arizona_init_mono); 256EXPORT_SYMBOL_GPL(arizona_init_mono);
257 257
258int arizona_init_gpio(struct snd_soc_codec *codec) 258int arizona_init_gpio(struct snd_soc_component *component)
259{ 259{
260 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 260 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
261 struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
262 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec);
263 struct arizona *arizona = priv->arizona; 261 struct arizona *arizona = priv->arizona;
264 int i; 262 int i;
265 263
@@ -882,9 +880,9 @@ const struct snd_kcontrol_new arizona_voice_trigger_switch[] = {
882}; 880};
883EXPORT_SYMBOL_GPL(arizona_voice_trigger_switch); 881EXPORT_SYMBOL_GPL(arizona_voice_trigger_switch);
884 882
885static void arizona_in_set_vu(struct snd_soc_codec *codec, int ena) 883static void arizona_in_set_vu(struct snd_soc_component *component, int ena)
886{ 884{
887 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 885 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
888 unsigned int val; 886 unsigned int val;
889 int i; 887 int i;
890 888
@@ -894,15 +892,15 @@ static void arizona_in_set_vu(struct snd_soc_codec *codec, int ena)
894 val = 0; 892 val = 0;
895 893
896 for (i = 0; i < priv->num_inputs; i++) 894 for (i = 0; i < priv->num_inputs; i++)
897 snd_soc_update_bits(codec, 895 snd_soc_component_update_bits(component,
898 ARIZONA_ADC_DIGITAL_VOLUME_1L + (i * 4), 896 ARIZONA_ADC_DIGITAL_VOLUME_1L + (i * 4),
899 ARIZONA_IN_VU, val); 897 ARIZONA_IN_VU, val);
900} 898}
901 899
902bool arizona_input_analog(struct snd_soc_codec *codec, int shift) 900bool arizona_input_analog(struct snd_soc_component *component, int shift)
903{ 901{
904 unsigned int reg = ARIZONA_IN1L_CONTROL + ((shift / 2) * 8); 902 unsigned int reg = ARIZONA_IN1L_CONTROL + ((shift / 2) * 8);
905 unsigned int val = snd_soc_read(codec, reg); 903 unsigned int val = snd_soc_component_read32(component, reg);
906 904
907 return !(val & ARIZONA_IN1_MODE_MASK); 905 return !(val & ARIZONA_IN1_MODE_MASK);
908} 906}
@@ -911,8 +909,8 @@ EXPORT_SYMBOL_GPL(arizona_input_analog);
911int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, 909int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
912 int event) 910 int event)
913{ 911{
914 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 912 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
915 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 913 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
916 unsigned int reg; 914 unsigned int reg;
917 915
918 if (w->shift % 2) 916 if (w->shift % 2)
@@ -925,25 +923,25 @@ int arizona_in_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
925 priv->in_pending++; 923 priv->in_pending++;
926 break; 924 break;
927 case SND_SOC_DAPM_POST_PMU: 925 case SND_SOC_DAPM_POST_PMU:
928 snd_soc_update_bits(codec, reg, ARIZONA_IN1L_MUTE, 0); 926 snd_soc_component_update_bits(component, reg, ARIZONA_IN1L_MUTE, 0);
929 927
930 /* If this is the last input pending then allow VU */ 928 /* If this is the last input pending then allow VU */
931 priv->in_pending--; 929 priv->in_pending--;
932 if (priv->in_pending == 0) { 930 if (priv->in_pending == 0) {
933 msleep(1); 931 msleep(1);
934 arizona_in_set_vu(codec, 1); 932 arizona_in_set_vu(component, 1);
935 } 933 }
936 break; 934 break;
937 case SND_SOC_DAPM_PRE_PMD: 935 case SND_SOC_DAPM_PRE_PMD:
938 snd_soc_update_bits(codec, reg, 936 snd_soc_component_update_bits(component, reg,
939 ARIZONA_IN1L_MUTE | ARIZONA_IN_VU, 937 ARIZONA_IN1L_MUTE | ARIZONA_IN_VU,
940 ARIZONA_IN1L_MUTE | ARIZONA_IN_VU); 938 ARIZONA_IN1L_MUTE | ARIZONA_IN_VU);
941 break; 939 break;
942 case SND_SOC_DAPM_POST_PMD: 940 case SND_SOC_DAPM_POST_PMD:
943 /* Disable volume updates if no inputs are enabled */ 941 /* Disable volume updates if no inputs are enabled */
944 reg = snd_soc_read(codec, ARIZONA_INPUT_ENABLES); 942 reg = snd_soc_component_read32(component, ARIZONA_INPUT_ENABLES);
945 if (reg == 0) 943 if (reg == 0)
946 arizona_in_set_vu(codec, 0); 944 arizona_in_set_vu(component, 0);
947 break; 945 break;
948 default: 946 default:
949 break; 947 break;
@@ -957,8 +955,8 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w,
957 struct snd_kcontrol *kcontrol, 955 struct snd_kcontrol *kcontrol,
958 int event) 956 int event)
959{ 957{
960 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 958 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
961 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 959 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
962 struct arizona *arizona = priv->arizona; 960 struct arizona *arizona = priv->arizona;
963 961
964 switch (event) { 962 switch (event) {
@@ -1001,7 +999,7 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w,
1001 case ARIZONA_OUT4R_ENA_SHIFT: 999 case ARIZONA_OUT4R_ENA_SHIFT:
1002 priv->out_up_pending--; 1000 priv->out_up_pending--;
1003 if (!priv->out_up_pending && priv->out_up_delay) { 1001 if (!priv->out_up_pending && priv->out_up_delay) {
1004 dev_dbg(codec->dev, "Power up delay: %d\n", 1002 dev_dbg(component->dev, "Power up delay: %d\n",
1005 priv->out_up_delay); 1003 priv->out_up_delay);
1006 msleep(priv->out_up_delay); 1004 msleep(priv->out_up_delay);
1007 priv->out_up_delay = 0; 1005 priv->out_up_delay = 0;
@@ -1054,7 +1052,7 @@ int arizona_out_ev(struct snd_soc_dapm_widget *w,
1054 case ARIZONA_OUT4R_ENA_SHIFT: 1052 case ARIZONA_OUT4R_ENA_SHIFT:
1055 priv->out_down_pending--; 1053 priv->out_down_pending--;
1056 if (!priv->out_down_pending && priv->out_down_delay) { 1054 if (!priv->out_down_pending && priv->out_down_delay) {
1057 dev_dbg(codec->dev, "Power down delay: %d\n", 1055 dev_dbg(component->dev, "Power down delay: %d\n",
1058 priv->out_down_delay); 1056 priv->out_down_delay);
1059 msleep(priv->out_down_delay); 1057 msleep(priv->out_down_delay);
1060 priv->out_down_delay = 0; 1058 priv->out_down_delay = 0;
@@ -1076,8 +1074,8 @@ int arizona_hp_ev(struct snd_soc_dapm_widget *w,
1076 struct snd_kcontrol *kcontrol, 1074 struct snd_kcontrol *kcontrol,
1077 int event) 1075 int event)
1078{ 1076{
1079 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 1077 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1080 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1078 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1081 struct arizona *arizona = priv->arizona; 1079 struct arizona *arizona = priv->arizona;
1082 unsigned int mask = 1 << w->shift; 1080 unsigned int mask = 1 << w->shift;
1083 unsigned int val; 1081 unsigned int val;
@@ -1111,15 +1109,15 @@ int arizona_hp_ev(struct snd_soc_dapm_widget *w,
1111} 1109}
1112EXPORT_SYMBOL_GPL(arizona_hp_ev); 1110EXPORT_SYMBOL_GPL(arizona_hp_ev);
1113 1111
1114static int arizona_dvfs_enable(struct snd_soc_codec *codec) 1112static int arizona_dvfs_enable(struct snd_soc_component *component)
1115{ 1113{
1116 const struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1114 const struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1117 struct arizona *arizona = priv->arizona; 1115 struct arizona *arizona = priv->arizona;
1118 int ret; 1116 int ret;
1119 1117
1120 ret = regulator_set_voltage(arizona->dcvdd, 1800000, 1800000); 1118 ret = regulator_set_voltage(arizona->dcvdd, 1800000, 1800000);
1121 if (ret) { 1119 if (ret) {
1122 dev_err(codec->dev, "Failed to boost DCVDD: %d\n", ret); 1120 dev_err(component->dev, "Failed to boost DCVDD: %d\n", ret);
1123 return ret; 1121 return ret;
1124 } 1122 }
1125 1123
@@ -1128,7 +1126,7 @@ static int arizona_dvfs_enable(struct snd_soc_codec *codec)
1128 ARIZONA_SUBSYS_MAX_FREQ, 1126 ARIZONA_SUBSYS_MAX_FREQ,
1129 ARIZONA_SUBSYS_MAX_FREQ); 1127 ARIZONA_SUBSYS_MAX_FREQ);
1130 if (ret) { 1128 if (ret) {
1131 dev_err(codec->dev, "Failed to enable subsys max: %d\n", ret); 1129 dev_err(component->dev, "Failed to enable subsys max: %d\n", ret);
1132 regulator_set_voltage(arizona->dcvdd, 1200000, 1800000); 1130 regulator_set_voltage(arizona->dcvdd, 1200000, 1800000);
1133 return ret; 1131 return ret;
1134 } 1132 }
@@ -1136,9 +1134,9 @@ static int arizona_dvfs_enable(struct snd_soc_codec *codec)
1136 return 0; 1134 return 0;
1137} 1135}
1138 1136
1139static int arizona_dvfs_disable(struct snd_soc_codec *codec) 1137static int arizona_dvfs_disable(struct snd_soc_component *component)
1140{ 1138{
1141 const struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1139 const struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1142 struct arizona *arizona = priv->arizona; 1140 struct arizona *arizona = priv->arizona;
1143 int ret; 1141 int ret;
1144 1142
@@ -1146,28 +1144,28 @@ static int arizona_dvfs_disable(struct snd_soc_codec *codec)
1146 ARIZONA_DYNAMIC_FREQUENCY_SCALING_1, 1144 ARIZONA_DYNAMIC_FREQUENCY_SCALING_1,
1147 ARIZONA_SUBSYS_MAX_FREQ, 0); 1145 ARIZONA_SUBSYS_MAX_FREQ, 0);
1148 if (ret) { 1146 if (ret) {
1149 dev_err(codec->dev, "Failed to disable subsys max: %d\n", ret); 1147 dev_err(component->dev, "Failed to disable subsys max: %d\n", ret);
1150 return ret; 1148 return ret;
1151 } 1149 }
1152 1150
1153 ret = regulator_set_voltage(arizona->dcvdd, 1200000, 1800000); 1151 ret = regulator_set_voltage(arizona->dcvdd, 1200000, 1800000);
1154 if (ret) { 1152 if (ret) {
1155 dev_err(codec->dev, "Failed to unboost DCVDD: %d\n", ret); 1153 dev_err(component->dev, "Failed to unboost DCVDD: %d\n", ret);
1156 return ret; 1154 return ret;
1157 } 1155 }
1158 1156
1159 return 0; 1157 return 0;
1160} 1158}
1161 1159
1162int arizona_dvfs_up(struct snd_soc_codec *codec, unsigned int flags) 1160int arizona_dvfs_up(struct snd_soc_component *component, unsigned int flags)
1163{ 1161{
1164 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1162 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1165 int ret = 0; 1163 int ret = 0;
1166 1164
1167 mutex_lock(&priv->dvfs_lock); 1165 mutex_lock(&priv->dvfs_lock);
1168 1166
1169 if (!priv->dvfs_cached && !priv->dvfs_reqs) { 1167 if (!priv->dvfs_cached && !priv->dvfs_reqs) {
1170 ret = arizona_dvfs_enable(codec); 1168 ret = arizona_dvfs_enable(component);
1171 if (ret) 1169 if (ret)
1172 goto err; 1170 goto err;
1173 } 1171 }
@@ -1179,9 +1177,9 @@ err:
1179} 1177}
1180EXPORT_SYMBOL_GPL(arizona_dvfs_up); 1178EXPORT_SYMBOL_GPL(arizona_dvfs_up);
1181 1179
1182int arizona_dvfs_down(struct snd_soc_codec *codec, unsigned int flags) 1180int arizona_dvfs_down(struct snd_soc_component *component, unsigned int flags)
1183{ 1181{
1184 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1182 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1185 unsigned int old_reqs; 1183 unsigned int old_reqs;
1186 int ret = 0; 1184 int ret = 0;
1187 1185
@@ -1191,7 +1189,7 @@ int arizona_dvfs_down(struct snd_soc_codec *codec, unsigned int flags)
1191 priv->dvfs_reqs &= ~flags; 1189 priv->dvfs_reqs &= ~flags;
1192 1190
1193 if (!priv->dvfs_cached && old_reqs && !priv->dvfs_reqs) 1191 if (!priv->dvfs_cached && old_reqs && !priv->dvfs_reqs)
1194 ret = arizona_dvfs_disable(codec); 1192 ret = arizona_dvfs_disable(component);
1195 1193
1196 mutex_unlock(&priv->dvfs_lock); 1194 mutex_unlock(&priv->dvfs_lock);
1197 return ret; 1195 return ret;
@@ -1201,8 +1199,8 @@ EXPORT_SYMBOL_GPL(arizona_dvfs_down);
1201int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w, 1199int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w,
1202 struct snd_kcontrol *kcontrol, int event) 1200 struct snd_kcontrol *kcontrol, int event)
1203{ 1201{
1204 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 1202 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1205 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1203 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1206 int ret = 0; 1204 int ret = 0;
1207 1205
1208 mutex_lock(&priv->dvfs_lock); 1206 mutex_lock(&priv->dvfs_lock);
@@ -1210,7 +1208,7 @@ int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w,
1210 switch (event) { 1208 switch (event) {
1211 case SND_SOC_DAPM_POST_PMU: 1209 case SND_SOC_DAPM_POST_PMU:
1212 if (priv->dvfs_reqs) 1210 if (priv->dvfs_reqs)
1213 ret = arizona_dvfs_enable(codec); 1211 ret = arizona_dvfs_enable(component);
1214 1212
1215 priv->dvfs_cached = false; 1213 priv->dvfs_cached = false;
1216 break; 1214 break;
@@ -1222,7 +1220,7 @@ int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w,
1222 priv->dvfs_cached = true; 1220 priv->dvfs_cached = true;
1223 1221
1224 if (priv->dvfs_reqs) 1222 if (priv->dvfs_reqs)
1225 ret = arizona_dvfs_disable(codec); 1223 ret = arizona_dvfs_disable(component);
1226 break; 1224 break;
1227 default: 1225 default:
1228 break; 1226 break;
@@ -1243,7 +1241,7 @@ int arizona_anc_ev(struct snd_soc_dapm_widget *w,
1243 struct snd_kcontrol *kcontrol, 1241 struct snd_kcontrol *kcontrol,
1244 int event) 1242 int event)
1245{ 1243{
1246 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 1244 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1247 unsigned int val; 1245 unsigned int val;
1248 1246
1249 switch (event) { 1247 switch (event) {
@@ -1257,7 +1255,7 @@ int arizona_anc_ev(struct snd_soc_dapm_widget *w,
1257 return 0; 1255 return 0;
1258 } 1256 }
1259 1257
1260 snd_soc_write(codec, ARIZONA_CLOCK_CONTROL, val); 1258 snd_soc_component_write(component, ARIZONA_CLOCK_CONTROL, val);
1261 1259
1262 return 0; 1260 return 0;
1263} 1261}
@@ -1277,10 +1275,10 @@ static unsigned int arizona_opclk_ref_44k1_rates[] = {
1277 45158400, 1275 45158400,
1278}; 1276};
1279 1277
1280static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk, 1278static int arizona_set_opclk(struct snd_soc_component *component, unsigned int clk,
1281 unsigned int freq) 1279 unsigned int freq)
1282{ 1280{
1283 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1281 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1284 unsigned int reg; 1282 unsigned int reg;
1285 unsigned int *rates; 1283 unsigned int *rates;
1286 int ref, div, refclk; 1284 int ref, div, refclk;
@@ -1308,9 +1306,9 @@ static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk,
1308 div = 1; 1306 div = 1;
1309 while (rates[ref] / div >= freq && div < 32) { 1307 while (rates[ref] / div >= freq && div < 32) {
1310 if (rates[ref] / div == freq) { 1308 if (rates[ref] / div == freq) {
1311 dev_dbg(codec->dev, "Configured %dHz OPCLK\n", 1309 dev_dbg(component->dev, "Configured %dHz OPCLK\n",
1312 freq); 1310 freq);
1313 snd_soc_update_bits(codec, reg, 1311 snd_soc_component_update_bits(component, reg,
1314 ARIZONA_OPCLK_DIV_MASK | 1312 ARIZONA_OPCLK_DIV_MASK |
1315 ARIZONA_OPCLK_SEL_MASK, 1313 ARIZONA_OPCLK_SEL_MASK,
1316 (div << 1314 (div <<
@@ -1322,22 +1320,22 @@ static int arizona_set_opclk(struct snd_soc_codec *codec, unsigned int clk,
1322 } 1320 }
1323 } 1321 }
1324 1322
1325 dev_err(codec->dev, "Unable to generate %dHz OPCLK\n", freq); 1323 dev_err(component->dev, "Unable to generate %dHz OPCLK\n", freq);
1326 return -EINVAL; 1324 return -EINVAL;
1327} 1325}
1328 1326
1329int arizona_clk_ev(struct snd_soc_dapm_widget *w, 1327int arizona_clk_ev(struct snd_soc_dapm_widget *w,
1330 struct snd_kcontrol *kcontrol, int event) 1328 struct snd_kcontrol *kcontrol, int event)
1331{ 1329{
1332 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 1330 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
1333 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 1331 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
1334 unsigned int val; 1332 unsigned int val;
1335 int clk_idx; 1333 int clk_idx;
1336 int ret; 1334 int ret;
1337 1335
1338 ret = regmap_read(arizona->regmap, w->reg, &val); 1336 ret = regmap_read(arizona->regmap, w->reg, &val);
1339 if (ret) { 1337 if (ret) {
1340 dev_err(codec->dev, "Failed to check clock source: %d\n", ret); 1338 dev_err(component->dev, "Failed to check clock source: %d\n", ret);
1341 return ret; 1339 return ret;
1342 } 1340 }
1343 1341
@@ -1366,10 +1364,10 @@ int arizona_clk_ev(struct snd_soc_dapm_widget *w,
1366} 1364}
1367EXPORT_SYMBOL_GPL(arizona_clk_ev); 1365EXPORT_SYMBOL_GPL(arizona_clk_ev);
1368 1366
1369int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id, 1367int arizona_set_sysclk(struct snd_soc_component *component, int clk_id,
1370 int source, unsigned int freq, int dir) 1368 int source, unsigned int freq, int dir)
1371{ 1369{
1372 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1370 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1373 struct arizona *arizona = priv->arizona; 1371 struct arizona *arizona = priv->arizona;
1374 char *name; 1372 char *name;
1375 unsigned int reg; 1373 unsigned int reg;
@@ -1391,7 +1389,7 @@ int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id,
1391 break; 1389 break;
1392 case ARIZONA_CLK_OPCLK: 1390 case ARIZONA_CLK_OPCLK:
1393 case ARIZONA_CLK_ASYNC_OPCLK: 1391 case ARIZONA_CLK_ASYNC_OPCLK:
1394 return arizona_set_opclk(codec, clk_id, freq); 1392 return arizona_set_opclk(component, clk_id, freq);
1395 default: 1393 default:
1396 return -EINVAL; 1394 return -EINVAL;
1397 } 1395 }
@@ -1445,8 +1443,8 @@ EXPORT_SYMBOL_GPL(arizona_set_sysclk);
1445 1443
1446static int arizona_set_fmt(struct snd_soc_dai *dai, unsigned int fmt) 1444static int arizona_set_fmt(struct snd_soc_dai *dai, unsigned int fmt)
1447{ 1445{
1448 struct snd_soc_codec *codec = dai->codec; 1446 struct snd_soc_component *component = dai->component;
1449 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1447 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1450 struct arizona *arizona = priv->arizona; 1448 struct arizona *arizona = priv->arizona;
1451 int lrclk, bclk, mode, base; 1449 int lrclk, bclk, mode, base;
1452 1450
@@ -1620,8 +1618,8 @@ static const struct snd_pcm_hw_constraint_list arizona_constraint = {
1620static int arizona_startup(struct snd_pcm_substream *substream, 1618static int arizona_startup(struct snd_pcm_substream *substream,
1621 struct snd_soc_dai *dai) 1619 struct snd_soc_dai *dai)
1622{ 1620{
1623 struct snd_soc_codec *codec = dai->codec; 1621 struct snd_soc_component *component = dai->component;
1624 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1622 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1625 struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; 1623 struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1];
1626 unsigned int base_rate; 1624 unsigned int base_rate;
1627 1625
@@ -1651,10 +1649,10 @@ static int arizona_startup(struct snd_pcm_substream *substream,
1651 &dai_priv->constraint); 1649 &dai_priv->constraint);
1652} 1650}
1653 1651
1654static void arizona_wm5102_set_dac_comp(struct snd_soc_codec *codec, 1652static void arizona_wm5102_set_dac_comp(struct snd_soc_component *component,
1655 unsigned int rate) 1653 unsigned int rate)
1656{ 1654{
1657 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1655 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1658 struct arizona *arizona = priv->arizona; 1656 struct arizona *arizona = priv->arizona;
1659 struct reg_sequence dac_comp[] = { 1657 struct reg_sequence dac_comp[] = {
1660 { 0x80, 0x3 }, 1658 { 0x80, 0x3 },
@@ -1680,8 +1678,8 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream,
1680 struct snd_pcm_hw_params *params, 1678 struct snd_pcm_hw_params *params,
1681 struct snd_soc_dai *dai) 1679 struct snd_soc_dai *dai)
1682{ 1680{
1683 struct snd_soc_codec *codec = dai->codec; 1681 struct snd_soc_component *component = dai->component;
1684 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1682 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1685 struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; 1683 struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1];
1686 int base = dai->driver->base; 1684 int base = dai->driver->base;
1687 int i, sr_val, ret; 1685 int i, sr_val, ret;
@@ -1704,9 +1702,9 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream,
1704 case WM5102: 1702 case WM5102:
1705 case WM8997: 1703 case WM8997:
1706 if (arizona_sr_vals[sr_val] >= 88200) 1704 if (arizona_sr_vals[sr_val] >= 88200)
1707 ret = arizona_dvfs_up(codec, ARIZONA_DVFS_SR1_RQ); 1705 ret = arizona_dvfs_up(component, ARIZONA_DVFS_SR1_RQ);
1708 else 1706 else
1709 ret = arizona_dvfs_down(codec, ARIZONA_DVFS_SR1_RQ); 1707 ret = arizona_dvfs_down(component, ARIZONA_DVFS_SR1_RQ);
1710 1708
1711 if (ret) { 1709 if (ret) {
1712 arizona_aif_err(dai, "Failed to change DVFS %d\n", ret); 1710 arizona_aif_err(dai, "Failed to change DVFS %d\n", ret);
@@ -1721,24 +1719,24 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream,
1721 case ARIZONA_CLK_SYSCLK: 1719 case ARIZONA_CLK_SYSCLK:
1722 switch (priv->arizona->type) { 1720 switch (priv->arizona->type) {
1723 case WM5102: 1721 case WM5102:
1724 arizona_wm5102_set_dac_comp(codec, 1722 arizona_wm5102_set_dac_comp(component,
1725 params_rate(params)); 1723 params_rate(params));
1726 break; 1724 break;
1727 default: 1725 default:
1728 break; 1726 break;
1729 } 1727 }
1730 1728
1731 snd_soc_update_bits(codec, ARIZONA_SAMPLE_RATE_1, 1729 snd_soc_component_update_bits(component, ARIZONA_SAMPLE_RATE_1,
1732 ARIZONA_SAMPLE_RATE_1_MASK, sr_val); 1730 ARIZONA_SAMPLE_RATE_1_MASK, sr_val);
1733 if (base) 1731 if (base)
1734 snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, 1732 snd_soc_component_update_bits(component, base + ARIZONA_AIF_RATE_CTRL,
1735 ARIZONA_AIF1_RATE_MASK, 0); 1733 ARIZONA_AIF1_RATE_MASK, 0);
1736 break; 1734 break;
1737 case ARIZONA_CLK_ASYNCCLK: 1735 case ARIZONA_CLK_ASYNCCLK:
1738 snd_soc_update_bits(codec, ARIZONA_ASYNC_SAMPLE_RATE_1, 1736 snd_soc_component_update_bits(component, ARIZONA_ASYNC_SAMPLE_RATE_1,
1739 ARIZONA_ASYNC_SAMPLE_RATE_1_MASK, sr_val); 1737 ARIZONA_ASYNC_SAMPLE_RATE_1_MASK, sr_val);
1740 if (base) 1738 if (base)
1741 snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, 1739 snd_soc_component_update_bits(component, base + ARIZONA_AIF_RATE_CTRL,
1742 ARIZONA_AIF1_RATE_MASK, 1740 ARIZONA_AIF1_RATE_MASK,
1743 8 << ARIZONA_AIF1_RATE_SHIFT); 1741 8 << ARIZONA_AIF1_RATE_SHIFT);
1744 break; 1742 break;
@@ -1750,20 +1748,20 @@ static int arizona_hw_params_rate(struct snd_pcm_substream *substream,
1750 return 0; 1748 return 0;
1751} 1749}
1752 1750
1753static bool arizona_aif_cfg_changed(struct snd_soc_codec *codec, 1751static bool arizona_aif_cfg_changed(struct snd_soc_component *component,
1754 int base, int bclk, int lrclk, int frame) 1752 int base, int bclk, int lrclk, int frame)
1755{ 1753{
1756 int val; 1754 int val;
1757 1755
1758 val = snd_soc_read(codec, base + ARIZONA_AIF_BCLK_CTRL); 1756 val = snd_soc_component_read32(component, base + ARIZONA_AIF_BCLK_CTRL);
1759 if (bclk != (val & ARIZONA_AIF1_BCLK_FREQ_MASK)) 1757 if (bclk != (val & ARIZONA_AIF1_BCLK_FREQ_MASK))
1760 return true; 1758 return true;
1761 1759
1762 val = snd_soc_read(codec, base + ARIZONA_AIF_TX_BCLK_RATE); 1760 val = snd_soc_component_read32(component, base + ARIZONA_AIF_TX_BCLK_RATE);
1763 if (lrclk != (val & ARIZONA_AIF1TX_BCPF_MASK)) 1761 if (lrclk != (val & ARIZONA_AIF1TX_BCPF_MASK))
1764 return true; 1762 return true;
1765 1763
1766 val = snd_soc_read(codec, base + ARIZONA_AIF_FRAME_CTRL_1); 1764 val = snd_soc_component_read32(component, base + ARIZONA_AIF_FRAME_CTRL_1);
1767 if (frame != (val & (ARIZONA_AIF1TX_WL_MASK | 1765 if (frame != (val & (ARIZONA_AIF1TX_WL_MASK |
1768 ARIZONA_AIF1TX_SLOT_LEN_MASK))) 1766 ARIZONA_AIF1TX_SLOT_LEN_MASK)))
1769 return true; 1767 return true;
@@ -1775,8 +1773,8 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
1775 struct snd_pcm_hw_params *params, 1773 struct snd_pcm_hw_params *params,
1776 struct snd_soc_dai *dai) 1774 struct snd_soc_dai *dai)
1777{ 1775{
1778 struct snd_soc_codec *codec = dai->codec; 1776 struct snd_soc_component *component = dai->component;
1779 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1777 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1780 struct arizona *arizona = priv->arizona; 1778 struct arizona *arizona = priv->arizona;
1781 int base = dai->driver->base; 1779 int base = dai->driver->base;
1782 const int *rates; 1780 const int *rates;
@@ -1813,7 +1811,7 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
1813 } 1811 }
1814 1812
1815 /* Force multiple of 2 channels for I2S mode */ 1813 /* Force multiple of 2 channels for I2S mode */
1816 val = snd_soc_read(codec, base + ARIZONA_AIF_FORMAT); 1814 val = snd_soc_component_read32(component, base + ARIZONA_AIF_FORMAT);
1817 val &= ARIZONA_AIF1_FMT_MASK; 1815 val &= ARIZONA_AIF1_FMT_MASK;
1818 if ((channels & 1) && (val == ARIZONA_FMT_I2S_MODE)) { 1816 if ((channels & 1) && (val == ARIZONA_FMT_I2S_MODE)) {
1819 arizona_aif_dbg(dai, "Forcing stereo mode\n"); 1817 arizona_aif_dbg(dai, "Forcing stereo mode\n");
@@ -1841,13 +1839,13 @@ static int arizona_hw_params(struct snd_pcm_substream *substream,
1841 1839
1842 frame = wl << ARIZONA_AIF1TX_WL_SHIFT | tdm_width; 1840 frame = wl << ARIZONA_AIF1TX_WL_SHIFT | tdm_width;
1843 1841
1844 reconfig = arizona_aif_cfg_changed(codec, base, bclk, lrclk, frame); 1842 reconfig = arizona_aif_cfg_changed(component, base, bclk, lrclk, frame);
1845 1843
1846 if (reconfig) { 1844 if (reconfig) {
1847 /* Save AIF TX/RX state */ 1845 /* Save AIF TX/RX state */
1848 aif_tx_state = snd_soc_read(codec, 1846 aif_tx_state = snd_soc_component_read32(component,
1849 base + ARIZONA_AIF_TX_ENABLES); 1847 base + ARIZONA_AIF_TX_ENABLES);
1850 aif_rx_state = snd_soc_read(codec, 1848 aif_rx_state = snd_soc_component_read32(component,
1851 base + ARIZONA_AIF_RX_ENABLES); 1849 base + ARIZONA_AIF_RX_ENABLES);
1852 /* Disable AIF TX/RX before reconfiguring it */ 1850 /* Disable AIF TX/RX before reconfiguring it */
1853 regmap_update_bits_async(arizona->regmap, 1851 regmap_update_bits_async(arizona->regmap,
@@ -1908,9 +1906,9 @@ static const char *arizona_dai_clk_str(int clk_id)
1908static int arizona_dai_set_sysclk(struct snd_soc_dai *dai, 1906static int arizona_dai_set_sysclk(struct snd_soc_dai *dai,
1909 int clk_id, unsigned int freq, int dir) 1907 int clk_id, unsigned int freq, int dir)
1910{ 1908{
1911 struct snd_soc_codec *codec = dai->codec; 1909 struct snd_soc_component *component = dai->component;
1912 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 1910 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1913 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1911 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1914 struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1]; 1912 struct arizona_dai_priv *dai_priv = &priv->dai[dai->id - 1];
1915 struct snd_soc_dapm_route routes[2]; 1913 struct snd_soc_dapm_route routes[2];
1916 1914
@@ -1926,12 +1924,12 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai,
1926 return 0; 1924 return 0;
1927 1925
1928 if (dai->active) { 1926 if (dai->active) {
1929 dev_err(codec->dev, "Can't change clock on active DAI %d\n", 1927 dev_err(component->dev, "Can't change clock on active DAI %d\n",
1930 dai->id); 1928 dai->id);
1931 return -EBUSY; 1929 return -EBUSY;
1932 } 1930 }
1933 1931
1934 dev_dbg(codec->dev, "Setting AIF%d to %s\n", dai->id + 1, 1932 dev_dbg(component->dev, "Setting AIF%d to %s\n", dai->id + 1,
1935 arizona_dai_clk_str(clk_id)); 1933 arizona_dai_clk_str(clk_id));
1936 1934
1937 memset(&routes, 0, sizeof(routes)); 1935 memset(&routes, 0, sizeof(routes));
@@ -1953,7 +1951,7 @@ static int arizona_dai_set_sysclk(struct snd_soc_dai *dai,
1953 1951
1954static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate) 1952static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate)
1955{ 1953{
1956 struct snd_soc_codec *codec = dai->codec; 1954 struct snd_soc_component *component = dai->component;
1957 int base = dai->driver->base; 1955 int base = dai->driver->base;
1958 unsigned int reg; 1956 unsigned int reg;
1959 1957
@@ -1962,7 +1960,7 @@ static int arizona_set_tristate(struct snd_soc_dai *dai, int tristate)
1962 else 1960 else
1963 reg = 0; 1961 reg = 0;
1964 1962
1965 return snd_soc_update_bits(codec, base + ARIZONA_AIF_RATE_CTRL, 1963 return snd_soc_component_update_bits(component, base + ARIZONA_AIF_RATE_CTRL,
1966 ARIZONA_AIF1_TRI, reg); 1964 ARIZONA_AIF1_TRI, reg);
1967} 1965}
1968 1966
@@ -1970,8 +1968,8 @@ static void arizona_set_channels_to_mask(struct snd_soc_dai *dai,
1970 unsigned int base, 1968 unsigned int base,
1971 int channels, unsigned int mask) 1969 int channels, unsigned int mask)
1972{ 1970{
1973 struct snd_soc_codec *codec = dai->codec; 1971 struct snd_soc_component *component = dai->component;
1974 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1972 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1975 struct arizona *arizona = priv->arizona; 1973 struct arizona *arizona = priv->arizona;
1976 int slot, i; 1974 int slot, i;
1977 1975
@@ -1992,8 +1990,8 @@ static void arizona_set_channels_to_mask(struct snd_soc_dai *dai,
1992static int arizona_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, 1990static int arizona_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
1993 unsigned int rx_mask, int slots, int slot_width) 1991 unsigned int rx_mask, int slots, int slot_width)
1994{ 1992{
1995 struct snd_soc_codec *codec = dai->codec; 1993 struct snd_soc_component *component = dai->component;
1996 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 1994 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
1997 struct arizona *arizona = priv->arizona; 1995 struct arizona *arizona = priv->arizona;
1998 int base = dai->driver->base; 1996 int base = dai->driver->base;
1999 int rx_max_chan = dai->driver->playback.channels_max; 1997 int rx_max_chan = dai->driver->playback.channels_max;
@@ -2645,7 +2643,7 @@ EXPORT_SYMBOL_GPL(arizona_init_fll);
2645/** 2643/**
2646 * arizona_set_output_mode - Set the mode of the specified output 2644 * arizona_set_output_mode - Set the mode of the specified output
2647 * 2645 *
2648 * @codec: Device to configure 2646 * @component: Device to configure
2649 * @output: Output number 2647 * @output: Output number
2650 * @diff: True to set the output to differential mode 2648 * @diff: True to set the output to differential mode
2651 * 2649 *
@@ -2658,7 +2656,7 @@ EXPORT_SYMBOL_GPL(arizona_init_fll);
2658 * Most systems have a single static configuration and should use 2656 * Most systems have a single static configuration and should use
2659 * platform data instead. 2657 * platform data instead.
2660 */ 2658 */
2661int arizona_set_output_mode(struct snd_soc_codec *codec, int output, bool diff) 2659int arizona_set_output_mode(struct snd_soc_component *component, int output, bool diff)
2662{ 2660{
2663 unsigned int reg, val; 2661 unsigned int reg, val;
2664 2662
@@ -2672,7 +2670,7 @@ int arizona_set_output_mode(struct snd_soc_codec *codec, int output, bool diff)
2672 else 2670 else
2673 val = 0; 2671 val = 0;
2674 2672
2675 return snd_soc_update_bits(codec, reg, ARIZONA_OUT1_MONO, val); 2673 return snd_soc_component_update_bits(component, reg, ARIZONA_OUT1_MONO, val);
2676} 2674}
2677EXPORT_SYMBOL_GPL(arizona_set_output_mode); 2675EXPORT_SYMBOL_GPL(arizona_set_output_mode);
2678 2676
@@ -2721,8 +2719,8 @@ static bool arizona_eq_filter_unstable(bool mode, __be16 _a, __be16 _b)
2721int arizona_eq_coeff_put(struct snd_kcontrol *kcontrol, 2719int arizona_eq_coeff_put(struct snd_kcontrol *kcontrol,
2722 struct snd_ctl_elem_value *ucontrol) 2720 struct snd_ctl_elem_value *ucontrol)
2723{ 2721{
2724 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 2722 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2725 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 2723 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
2726 struct soc_bytes *params = (void *)kcontrol->private_value; 2724 struct soc_bytes *params = (void *)kcontrol->private_value;
2727 unsigned int val; 2725 unsigned int val;
2728 __be16 *data; 2726 __be16 *data;
@@ -2765,8 +2763,8 @@ EXPORT_SYMBOL_GPL(arizona_eq_coeff_put);
2765int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol, 2763int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
2766 struct snd_ctl_elem_value *ucontrol) 2764 struct snd_ctl_elem_value *ucontrol)
2767{ 2765{
2768 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 2766 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2769 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 2767 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
2770 __be16 *data = (__be16 *)ucontrol->value.bytes.data; 2768 __be16 *data = (__be16 *)ucontrol->value.bytes.data;
2771 s16 val = be16_to_cpu(*data); 2769 s16 val = be16_to_cpu(*data);
2772 2770
diff --git a/sound/soc/codecs/arizona.h b/sound/soc/codecs/arizona.h
index dfdf6d8c9687..e3ccee5627c6 100644
--- a/sound/soc/codecs/arizona.h
+++ b/sound/soc/codecs/arizona.h
@@ -273,7 +273,7 @@ int arizona_lhpf_coeff_put(struct snd_kcontrol *kcontrol,
273 273
274int arizona_clk_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol, 274int arizona_clk_ev(struct snd_soc_dapm_widget *w, struct snd_kcontrol *kcontrol,
275 int event); 275 int event);
276int arizona_set_sysclk(struct snd_soc_codec *codec, int clk_id, int source, 276int arizona_set_sysclk(struct snd_soc_component *component, int clk_id, int source,
277 unsigned int freq, int dir); 277 unsigned int freq, int dir);
278 278
279extern const struct snd_soc_dai_ops arizona_dai_ops; 279extern const struct snd_soc_dai_ops arizona_dai_ops;
@@ -297,8 +297,8 @@ struct arizona_fll {
297 char clock_ok_name[ARIZONA_FLL_NAME_LEN]; 297 char clock_ok_name[ARIZONA_FLL_NAME_LEN];
298}; 298};
299 299
300int arizona_dvfs_up(struct snd_soc_codec *codec, unsigned int flags); 300int arizona_dvfs_up(struct snd_soc_component *component, unsigned int flags);
301int arizona_dvfs_down(struct snd_soc_codec *codec, unsigned int flags); 301int arizona_dvfs_down(struct snd_soc_component *component, unsigned int flags);
302int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w, 302int arizona_dvfs_sysclk_ev(struct snd_soc_dapm_widget *w,
303 struct snd_kcontrol *kcontrol, int event); 303 struct snd_kcontrol *kcontrol, int event);
304void arizona_init_dvfs(struct arizona_priv *priv); 304void arizona_init_dvfs(struct arizona_priv *priv);
@@ -310,9 +310,9 @@ int arizona_set_fll_refclk(struct arizona_fll *fll, int source,
310int arizona_set_fll(struct arizona_fll *fll, int source, 310int arizona_set_fll(struct arizona_fll *fll, int source,
311 unsigned int Fref, unsigned int Fout); 311 unsigned int Fref, unsigned int Fout);
312 312
313int arizona_init_spk(struct snd_soc_codec *codec); 313int arizona_init_spk(struct snd_soc_component *component);
314int arizona_init_gpio(struct snd_soc_codec *codec); 314int arizona_init_gpio(struct snd_soc_component *component);
315int arizona_init_mono(struct snd_soc_codec *codec); 315int arizona_init_mono(struct snd_soc_component *component);
316 316
317int arizona_init_common(struct arizona *arizona); 317int arizona_init_common(struct arizona *arizona);
318int arizona_init_vol_limit(struct arizona *arizona); 318int arizona_init_vol_limit(struct arizona *arizona);
@@ -322,20 +322,20 @@ int arizona_free_spk_irqs(struct arizona *arizona);
322 322
323int arizona_init_dai(struct arizona_priv *priv, int dai); 323int arizona_init_dai(struct arizona_priv *priv, int dai);
324 324
325int arizona_set_output_mode(struct snd_soc_codec *codec, int output, 325int arizona_set_output_mode(struct snd_soc_component *component, int output,
326 bool diff); 326 bool diff);
327 327
328bool arizona_input_analog(struct snd_soc_codec *codec, int shift); 328bool arizona_input_analog(struct snd_soc_component *component, int shift);
329 329
330const char *arizona_sample_rate_val_to_name(unsigned int rate_val); 330const char *arizona_sample_rate_val_to_name(unsigned int rate_val);
331 331
332static inline int arizona_register_notifier(struct snd_soc_codec *codec, 332static inline int arizona_register_notifier(struct snd_soc_component *component,
333 struct notifier_block *nb, 333 struct notifier_block *nb,
334 int (*notify) 334 int (*notify)
335 (struct notifier_block *nb, 335 (struct notifier_block *nb,
336 unsigned long action, void *data)) 336 unsigned long action, void *data))
337{ 337{
338 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 338 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
339 struct arizona *arizona = priv->arizona; 339 struct arizona *arizona = priv->arizona;
340 340
341 nb->notifier_call = notify; 341 nb->notifier_call = notify;
@@ -343,10 +343,10 @@ static inline int arizona_register_notifier(struct snd_soc_codec *codec,
343 return blocking_notifier_chain_register(&arizona->notifier, nb); 343 return blocking_notifier_chain_register(&arizona->notifier, nb);
344} 344}
345 345
346static inline int arizona_unregister_notifier(struct snd_soc_codec *codec, 346static inline int arizona_unregister_notifier(struct snd_soc_component *component,
347 struct notifier_block *nb) 347 struct notifier_block *nb)
348{ 348{
349 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 349 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
350 struct arizona *arizona = priv->arizona; 350 struct arizona *arizona = priv->arizona;
351 351
352 return blocking_notifier_chain_unregister(&arizona->notifier, nb); 352 return blocking_notifier_chain_unregister(&arizona->notifier, nb);
diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c
index 3f34de5f800e..c93d3f7e8e36 100644
--- a/sound/soc/codecs/cs47l24.c
+++ b/sound/soc/codecs/cs47l24.c
@@ -62,14 +62,14 @@ static const struct wm_adsp_region *cs47l24_dsp_regions[] = {
62static int cs47l24_adsp_power_ev(struct snd_soc_dapm_widget *w, 62static int cs47l24_adsp_power_ev(struct snd_soc_dapm_widget *w,
63 struct snd_kcontrol *kcontrol, int event) 63 struct snd_kcontrol *kcontrol, int event)
64{ 64{
65 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 65 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
66 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 66 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
67 unsigned int v; 67 unsigned int v;
68 int ret; 68 int ret;
69 69
70 ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v); 70 ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v);
71 if (ret != 0) { 71 if (ret != 0) {
72 dev_err(codec->dev, "Failed to read SYSCLK state: %d\n", ret); 72 dev_err(component->dev, "Failed to read SYSCLK state: %d\n", ret);
73 return ret; 73 return ret;
74 } 74 }
75 75
@@ -931,10 +931,10 @@ static const struct snd_soc_dapm_route cs47l24_dapm_routes[] = {
931 { "DSP3 Voice Trigger", "Switch", "DSP3" }, 931 { "DSP3 Voice Trigger", "Switch", "DSP3" },
932}; 932};
933 933
934static int cs47l24_set_fll(struct snd_soc_codec *codec, int fll_id, int source, 934static int cs47l24_set_fll(struct snd_soc_component *component, int fll_id, int source,
935 unsigned int Fref, unsigned int Fout) 935 unsigned int Fref, unsigned int Fout)
936{ 936{
937 struct cs47l24_priv *cs47l24 = snd_soc_codec_get_drvdata(codec); 937 struct cs47l24_priv *cs47l24 = snd_soc_component_get_drvdata(component);
938 938
939 switch (fll_id) { 939 switch (fll_id) {
940 case CS47L24_FLL1: 940 case CS47L24_FLL1:
@@ -1118,33 +1118,32 @@ static irqreturn_t cs47l24_adsp2_irq(int irq, void *data)
1118 return IRQ_HANDLED; 1118 return IRQ_HANDLED;
1119} 1119}
1120 1120
1121static int cs47l24_codec_probe(struct snd_soc_codec *codec) 1121static int cs47l24_component_probe(struct snd_soc_component *component)
1122{ 1122{
1123 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 1123 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1124 struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); 1124 struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component);
1125 struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec);
1126 struct arizona *arizona = priv->core.arizona; 1125 struct arizona *arizona = priv->core.arizona;
1127 int ret; 1126 int ret;
1128 1127
1129 arizona->dapm = dapm; 1128 arizona->dapm = dapm;
1130 snd_soc_codec_init_regmap(codec, arizona->regmap); 1129 snd_soc_component_init_regmap(component, arizona->regmap);
1131 1130
1132 ret = arizona_init_spk(codec); 1131 ret = arizona_init_spk(component);
1133 if (ret < 0) 1132 if (ret < 0)
1134 return ret; 1133 return ret;
1135 1134
1136 arizona_init_gpio(codec); 1135 arizona_init_gpio(component);
1137 arizona_init_mono(codec); 1136 arizona_init_mono(component);
1138 1137
1139 ret = wm_adsp2_codec_probe(&priv->core.adsp[1], codec); 1138 ret = wm_adsp2_component_probe(&priv->core.adsp[1], component);
1140 if (ret) 1139 if (ret)
1141 goto err_adsp2_codec_probe; 1140 goto err_adsp2_codec_probe;
1142 1141
1143 ret = wm_adsp2_codec_probe(&priv->core.adsp[2], codec); 1142 ret = wm_adsp2_component_probe(&priv->core.adsp[2], component);
1144 if (ret) 1143 if (ret)
1145 goto err_adsp2_codec_probe; 1144 goto err_adsp2_codec_probe;
1146 1145
1147 ret = snd_soc_add_codec_controls(codec, 1146 ret = snd_soc_add_component_controls(component,
1148 &arizona_adsp2_rate_controls[1], 2); 1147 &arizona_adsp2_rate_controls[1], 2);
1149 if (ret) 1148 if (ret)
1150 goto err_adsp2_codec_probe; 1149 goto err_adsp2_codec_probe;
@@ -1154,22 +1153,20 @@ static int cs47l24_codec_probe(struct snd_soc_codec *codec)
1154 return 0; 1153 return 0;
1155 1154
1156err_adsp2_codec_probe: 1155err_adsp2_codec_probe:
1157 wm_adsp2_codec_remove(&priv->core.adsp[1], codec); 1156 wm_adsp2_component_remove(&priv->core.adsp[1], component);
1158 wm_adsp2_codec_remove(&priv->core.adsp[2], codec); 1157 wm_adsp2_component_remove(&priv->core.adsp[2], component);
1159 1158
1160 return ret; 1159 return ret;
1161} 1160}
1162 1161
1163static int cs47l24_codec_remove(struct snd_soc_codec *codec) 1162static void cs47l24_component_remove(struct snd_soc_component *component)
1164{ 1163{
1165 struct cs47l24_priv *priv = snd_soc_codec_get_drvdata(codec); 1164 struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component);
1166 1165
1167 wm_adsp2_codec_remove(&priv->core.adsp[1], codec); 1166 wm_adsp2_component_remove(&priv->core.adsp[1], component);
1168 wm_adsp2_codec_remove(&priv->core.adsp[2], codec); 1167 wm_adsp2_component_remove(&priv->core.adsp[2], component);
1169 1168
1170 priv->core.arizona->dapm = NULL; 1169 priv->core.arizona->dapm = NULL;
1171
1172 return 0;
1173} 1170}
1174 1171
1175#define CS47L24_DIG_VU 0x0200 1172#define CS47L24_DIG_VU 0x0200
@@ -1190,25 +1187,22 @@ static struct snd_compr_ops cs47l24_compr_ops = {
1190 .copy = wm_adsp_compr_copy, 1187 .copy = wm_adsp_compr_copy,
1191}; 1188};
1192 1189
1193static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = { 1190static const struct snd_soc_component_driver soc_component_dev_cs47l24 = {
1194 .probe = cs47l24_codec_probe, 1191 .probe = cs47l24_component_probe,
1195 .remove = cs47l24_codec_remove, 1192 .remove = cs47l24_component_remove,
1196 1193 .set_sysclk = arizona_set_sysclk,
1197 .idle_bias_off = true, 1194 .set_pll = cs47l24_set_fll,
1198 1195 .name = DRV_NAME,
1199 .set_sysclk = arizona_set_sysclk, 1196 .compr_ops = &cs47l24_compr_ops,
1200 .set_pll = cs47l24_set_fll, 1197 .controls = cs47l24_snd_controls,
1201 1198 .num_controls = ARRAY_SIZE(cs47l24_snd_controls),
1202 .component_driver = { 1199 .dapm_widgets = cs47l24_dapm_widgets,
1203 .name = DRV_NAME, 1200 .num_dapm_widgets = ARRAY_SIZE(cs47l24_dapm_widgets),
1204 .compr_ops = &cs47l24_compr_ops, 1201 .dapm_routes = cs47l24_dapm_routes,
1205 .controls = cs47l24_snd_controls, 1202 .num_dapm_routes = ARRAY_SIZE(cs47l24_dapm_routes),
1206 .num_controls = ARRAY_SIZE(cs47l24_snd_controls), 1203 .use_pmdown_time = 1,
1207 .dapm_widgets = cs47l24_dapm_widgets, 1204 .endianness = 1,
1208 .num_dapm_widgets = ARRAY_SIZE(cs47l24_dapm_widgets), 1205 .non_legacy_dai_naming = 1,
1209 .dapm_routes = cs47l24_dapm_routes,
1210 .num_dapm_routes = ARRAY_SIZE(cs47l24_dapm_routes),
1211 },
1212}; 1206};
1213 1207
1214static int cs47l24_probe(struct platform_device *pdev) 1208static int cs47l24_probe(struct platform_device *pdev)
@@ -1299,10 +1293,11 @@ static int cs47l24_probe(struct platform_device *pdev)
1299 if (ret < 0) 1293 if (ret < 0)
1300 goto err_dsp_irq; 1294 goto err_dsp_irq;
1301 1295
1302 ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_cs47l24, 1296 ret = devm_snd_soc_register_component(&pdev->dev,
1297 &soc_component_dev_cs47l24,
1303 cs47l24_dai, ARRAY_SIZE(cs47l24_dai)); 1298 cs47l24_dai, ARRAY_SIZE(cs47l24_dai));
1304 if (ret < 0) { 1299 if (ret < 0) {
1305 dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); 1300 dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
1306 goto err_spk_irqs; 1301 goto err_spk_irqs;
1307 } 1302 }
1308 1303
@@ -1321,7 +1316,6 @@ static int cs47l24_remove(struct platform_device *pdev)
1321 struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev); 1316 struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev);
1322 struct arizona *arizona = cs47l24->core.arizona; 1317 struct arizona *arizona = cs47l24->core.arizona;
1323 1318
1324 snd_soc_unregister_codec(&pdev->dev);
1325 pm_runtime_disable(&pdev->dev); 1319 pm_runtime_disable(&pdev->dev);
1326 1320
1327 wm_adsp2_remove(&cs47l24->core.adsp[1]); 1321 wm_adsp2_remove(&cs47l24->core.adsp[1]);
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c
index a568050090ad..24f19cfc98f5 100644
--- a/sound/soc/codecs/wm5102.c
+++ b/sound/soc/codecs/wm5102.c
@@ -583,8 +583,8 @@ static const struct reg_default wm5102_sysclk_revb_patch[] = {
583static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w, 583static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
584 struct snd_kcontrol *kcontrol, int event) 584 struct snd_kcontrol *kcontrol, int event)
585{ 585{
586 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 586 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
587 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 587 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
588 struct regmap *regmap = arizona->regmap; 588 struct regmap *regmap = arizona->regmap;
589 const struct reg_default *patch = NULL; 589 const struct reg_default *patch = NULL;
590 int i, patch_size; 590 int i, patch_size;
@@ -622,8 +622,8 @@ static int wm5102_sysclk_ev(struct snd_soc_dapm_widget *w,
622static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w, 622static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w,
623 struct snd_kcontrol *kcontrol, int event) 623 struct snd_kcontrol *kcontrol, int event)
624{ 624{
625 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 625 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
626 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 626 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
627 unsigned int v = 0; 627 unsigned int v = 0;
628 int ret; 628 int ret;
629 629
@@ -631,7 +631,7 @@ static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w,
631 case SND_SOC_DAPM_PRE_PMU: 631 case SND_SOC_DAPM_PRE_PMU:
632 ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v); 632 ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v);
633 if (ret != 0) { 633 if (ret != 0) {
634 dev_err(codec->dev, 634 dev_err(component->dev,
635 "Failed to read SYSCLK state: %d\n", ret); 635 "Failed to read SYSCLK state: %d\n", ret);
636 return -EIO; 636 return -EIO;
637 } 637 }
@@ -639,9 +639,9 @@ static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w,
639 v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT; 639 v = (v & ARIZONA_SYSCLK_FREQ_MASK) >> ARIZONA_SYSCLK_FREQ_SHIFT;
640 640
641 if (v >= 3) { 641 if (v >= 3) {
642 ret = arizona_dvfs_up(codec, ARIZONA_DVFS_ADSP1_RQ); 642 ret = arizona_dvfs_up(component, ARIZONA_DVFS_ADSP1_RQ);
643 if (ret) { 643 if (ret) {
644 dev_err(codec->dev, 644 dev_err(component->dev,
645 "Failed to raise DVFS: %d\n", ret); 645 "Failed to raise DVFS: %d\n", ret);
646 return ret; 646 return ret;
647 } 647 }
@@ -649,9 +649,9 @@ static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w,
649 break; 649 break;
650 650
651 case SND_SOC_DAPM_POST_PMD: 651 case SND_SOC_DAPM_POST_PMD:
652 ret = arizona_dvfs_down(codec, ARIZONA_DVFS_ADSP1_RQ); 652 ret = arizona_dvfs_down(component, ARIZONA_DVFS_ADSP1_RQ);
653 if (ret) 653 if (ret)
654 dev_warn(codec->dev, 654 dev_warn(component->dev,
655 "Failed to lower DVFS: %d\n", ret); 655 "Failed to lower DVFS: %d\n", ret);
656 break; 656 break;
657 657
@@ -665,8 +665,8 @@ static int wm5102_adsp_power_ev(struct snd_soc_dapm_widget *w,
665static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol, 665static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol,
666 struct snd_ctl_elem_value *ucontrol) 666 struct snd_ctl_elem_value *ucontrol)
667{ 667{
668 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 668 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
669 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 669 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
670 670
671 mutex_lock(&arizona->dac_comp_lock); 671 mutex_lock(&arizona->dac_comp_lock);
672 put_unaligned_be16(arizona->dac_comp_coeff, 672 put_unaligned_be16(arizona->dac_comp_coeff,
@@ -679,8 +679,8 @@ static int wm5102_out_comp_coeff_get(struct snd_kcontrol *kcontrol,
679static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol, 679static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol,
680 struct snd_ctl_elem_value *ucontrol) 680 struct snd_ctl_elem_value *ucontrol)
681{ 681{
682 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 682 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
683 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 683 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
684 684
685 mutex_lock(&arizona->dac_comp_lock); 685 mutex_lock(&arizona->dac_comp_lock);
686 memcpy(&arizona->dac_comp_coeff, ucontrol->value.bytes.data, 686 memcpy(&arizona->dac_comp_coeff, ucontrol->value.bytes.data,
@@ -694,8 +694,8 @@ static int wm5102_out_comp_coeff_put(struct snd_kcontrol *kcontrol,
694static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol, 694static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol,
695 struct snd_ctl_elem_value *ucontrol) 695 struct snd_ctl_elem_value *ucontrol)
696{ 696{
697 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 697 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
698 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 698 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
699 699
700 mutex_lock(&arizona->dac_comp_lock); 700 mutex_lock(&arizona->dac_comp_lock);
701 ucontrol->value.integer.value[0] = arizona->dac_comp_enabled; 701 ucontrol->value.integer.value[0] = arizona->dac_comp_enabled;
@@ -707,8 +707,8 @@ static int wm5102_out_comp_switch_get(struct snd_kcontrol *kcontrol,
707static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol, 707static int wm5102_out_comp_switch_put(struct snd_kcontrol *kcontrol,
708 struct snd_ctl_elem_value *ucontrol) 708 struct snd_ctl_elem_value *ucontrol)
709{ 709{
710 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 710 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
711 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 711 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
712 712
713 mutex_lock(&arizona->dac_comp_lock); 713 mutex_lock(&arizona->dac_comp_lock);
714 arizona->dac_comp_enabled = ucontrol->value.integer.value[0]; 714 arizona->dac_comp_enabled = ucontrol->value.integer.value[0];
@@ -1736,10 +1736,10 @@ static const struct snd_soc_dapm_route wm5102_dapm_routes[] = {
1736 { "DRC1 Signal Activity", NULL, "DRC1R" }, 1736 { "DRC1 Signal Activity", NULL, "DRC1R" },
1737}; 1737};
1738 1738
1739static int wm5102_set_fll(struct snd_soc_codec *codec, int fll_id, int source, 1739static int wm5102_set_fll(struct snd_soc_component *component, int fll_id, int source,
1740 unsigned int Fref, unsigned int Fout) 1740 unsigned int Fref, unsigned int Fout)
1741{ 1741{
1742 struct wm5102_priv *wm5102 = snd_soc_codec_get_drvdata(codec); 1742 struct wm5102_priv *wm5102 = snd_soc_component_get_drvdata(component);
1743 1743
1744 switch (fll_id) { 1744 switch (fll_id) {
1745 case WM5102_FLL1: 1745 case WM5102_FLL1:
@@ -1933,30 +1933,29 @@ static irqreturn_t wm5102_adsp2_irq(int irq, void *data)
1933 return IRQ_HANDLED; 1933 return IRQ_HANDLED;
1934} 1934}
1935 1935
1936static int wm5102_codec_probe(struct snd_soc_codec *codec) 1936static int wm5102_component_probe(struct snd_soc_component *component)
1937{ 1937{
1938 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 1938 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1939 struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); 1939 struct wm5102_priv *priv = snd_soc_component_get_drvdata(component);
1940 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec);
1941 struct arizona *arizona = priv->core.arizona; 1940 struct arizona *arizona = priv->core.arizona;
1942 int ret; 1941 int ret;
1943 1942
1944 snd_soc_codec_init_regmap(codec, arizona->regmap); 1943 snd_soc_component_init_regmap(component, arizona->regmap);
1945 1944
1946 ret = wm_adsp2_codec_probe(&priv->core.adsp[0], codec); 1945 ret = wm_adsp2_component_probe(&priv->core.adsp[0], component);
1947 if (ret) 1946 if (ret)
1948 return ret; 1947 return ret;
1949 1948
1950 ret = snd_soc_add_codec_controls(codec, 1949 ret = snd_soc_add_component_controls(component,
1951 arizona_adsp2_rate_controls, 1); 1950 arizona_adsp2_rate_controls, 1);
1952 if (ret) 1951 if (ret)
1953 goto err_adsp2_codec_probe; 1952 goto err_adsp2_codec_probe;
1954 1953
1955 ret = arizona_init_spk(codec); 1954 ret = arizona_init_spk(component);
1956 if (ret < 0) 1955 if (ret < 0)
1957 return ret; 1956 return ret;
1958 1957
1959 arizona_init_gpio(codec); 1958 arizona_init_gpio(component);
1960 1959
1961 snd_soc_component_disable_pin(component, "HAPTICS"); 1960 snd_soc_component_disable_pin(component, "HAPTICS");
1962 1961
@@ -1965,20 +1964,18 @@ static int wm5102_codec_probe(struct snd_soc_codec *codec)
1965 return 0; 1964 return 0;
1966 1965
1967err_adsp2_codec_probe: 1966err_adsp2_codec_probe:
1968 wm_adsp2_codec_remove(&priv->core.adsp[0], codec); 1967 wm_adsp2_component_remove(&priv->core.adsp[0], component);
1969 1968
1970 return ret; 1969 return ret;
1971} 1970}
1972 1971
1973static int wm5102_codec_remove(struct snd_soc_codec *codec) 1972static void wm5102_component_remove(struct snd_soc_component *component)
1974{ 1973{
1975 struct wm5102_priv *priv = snd_soc_codec_get_drvdata(codec); 1974 struct wm5102_priv *priv = snd_soc_component_get_drvdata(component);
1976 1975
1977 wm_adsp2_codec_remove(&priv->core.adsp[0], codec); 1976 wm_adsp2_component_remove(&priv->core.adsp[0], component);
1978 1977
1979 priv->core.arizona->dapm = NULL; 1978 priv->core.arizona->dapm = NULL;
1980
1981 return 0;
1982} 1979}
1983 1980
1984#define WM5102_DIG_VU 0x0200 1981#define WM5102_DIG_VU 0x0200
@@ -2005,25 +2002,22 @@ static struct snd_compr_ops wm5102_compr_ops = {
2005 .copy = wm_adsp_compr_copy, 2002 .copy = wm_adsp_compr_copy,
2006}; 2003};
2007 2004
2008static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = { 2005static const struct snd_soc_component_driver soc_component_dev_wm5102 = {
2009 .probe = wm5102_codec_probe, 2006 .probe = wm5102_component_probe,
2010 .remove = wm5102_codec_remove, 2007 .remove = wm5102_component_remove,
2011 2008 .set_sysclk = arizona_set_sysclk,
2012 .idle_bias_off = true, 2009 .set_pll = wm5102_set_fll,
2013 2010 .name = DRV_NAME,
2014 .set_sysclk = arizona_set_sysclk, 2011 .compr_ops = &wm5102_compr_ops,
2015 .set_pll = wm5102_set_fll, 2012 .controls = wm5102_snd_controls,
2016 2013 .num_controls = ARRAY_SIZE(wm5102_snd_controls),
2017 .component_driver = { 2014 .dapm_widgets = wm5102_dapm_widgets,
2018 .name = DRV_NAME, 2015 .num_dapm_widgets = ARRAY_SIZE(wm5102_dapm_widgets),
2019 .compr_ops = &wm5102_compr_ops, 2016 .dapm_routes = wm5102_dapm_routes,
2020 .controls = wm5102_snd_controls, 2017 .num_dapm_routes = ARRAY_SIZE(wm5102_dapm_routes),
2021 .num_controls = ARRAY_SIZE(wm5102_snd_controls), 2018 .use_pmdown_time = 1,
2022 .dapm_widgets = wm5102_dapm_widgets, 2019 .endianness = 1,
2023 .num_dapm_widgets = ARRAY_SIZE(wm5102_dapm_widgets), 2020 .non_legacy_dai_naming = 1,
2024 .dapm_routes = wm5102_dapm_routes,
2025 .num_dapm_routes = ARRAY_SIZE(wm5102_dapm_routes),
2026 },
2027}; 2021};
2028 2022
2029static int wm5102_probe(struct platform_device *pdev) 2023static int wm5102_probe(struct platform_device *pdev)
@@ -2110,10 +2104,11 @@ static int wm5102_probe(struct platform_device *pdev)
2110 if (ret < 0) 2104 if (ret < 0)
2111 goto err_dsp_irq; 2105 goto err_dsp_irq;
2112 2106
2113 ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5102, 2107 ret = devm_snd_soc_register_component(&pdev->dev,
2108 &soc_component_dev_wm5102,
2114 wm5102_dai, ARRAY_SIZE(wm5102_dai)); 2109 wm5102_dai, ARRAY_SIZE(wm5102_dai));
2115 if (ret < 0) { 2110 if (ret < 0) {
2116 dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); 2111 dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
2117 goto err_spk_irqs; 2112 goto err_spk_irqs;
2118 } 2113 }
2119 2114
@@ -2132,7 +2127,6 @@ static int wm5102_remove(struct platform_device *pdev)
2132 struct wm5102_priv *wm5102 = platform_get_drvdata(pdev); 2127 struct wm5102_priv *wm5102 = platform_get_drvdata(pdev);
2133 struct arizona *arizona = wm5102->core.arizona; 2128 struct arizona *arizona = wm5102->core.arizona;
2134 2129
2135 snd_soc_unregister_codec(&pdev->dev);
2136 pm_runtime_disable(&pdev->dev); 2130 pm_runtime_disable(&pdev->dev);
2137 2131
2138 wm_adsp2_remove(&wm5102->core.adsp[0]); 2132 wm_adsp2_remove(&wm5102->core.adsp[0]);
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c
index d5ece6c6fcb6..b33cbd0161d3 100644
--- a/sound/soc/codecs/wm5110.c
+++ b/sound/soc/codecs/wm5110.c
@@ -161,8 +161,8 @@ static const struct reg_default wm5110_sysclk_reve_patch[] = {
161static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w, 161static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w,
162 struct snd_kcontrol *kcontrol, int event) 162 struct snd_kcontrol *kcontrol, int event)
163{ 163{
164 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 164 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
165 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 165 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
166 struct regmap *regmap = arizona->regmap; 166 struct regmap *regmap = arizona->regmap;
167 const struct reg_default *patch = NULL; 167 const struct reg_default *patch = NULL;
168 int i, patch_size; 168 int i, patch_size;
@@ -198,14 +198,14 @@ static int wm5110_sysclk_ev(struct snd_soc_dapm_widget *w,
198static int wm5110_adsp_power_ev(struct snd_soc_dapm_widget *w, 198static int wm5110_adsp_power_ev(struct snd_soc_dapm_widget *w,
199 struct snd_kcontrol *kcontrol, int event) 199 struct snd_kcontrol *kcontrol, int event)
200{ 200{
201 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 201 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
202 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 202 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
203 unsigned int v; 203 unsigned int v;
204 int ret; 204 int ret;
205 205
206 ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v); 206 ret = regmap_read(arizona->regmap, ARIZONA_SYSTEM_CLOCK_1, &v);
207 if (ret != 0) { 207 if (ret != 0) {
208 dev_err(codec->dev, "Failed to read SYSCLK state: %d\n", ret); 208 dev_err(component->dev, "Failed to read SYSCLK state: %d\n", ret);
209 return ret; 209 return ret;
210 } 210 }
211 211
@@ -288,10 +288,10 @@ static const struct reg_sequence wm5110_dre_right_enable[] = {
288 288
289static int wm5110_hp_pre_enable(struct snd_soc_dapm_widget *w) 289static int wm5110_hp_pre_enable(struct snd_soc_dapm_widget *w)
290{ 290{
291 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 291 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
292 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 292 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
293 struct arizona *arizona = priv->arizona; 293 struct arizona *arizona = priv->arizona;
294 unsigned int val = snd_soc_read(codec, ARIZONA_DRE_ENABLE); 294 unsigned int val = snd_soc_component_read32(component, ARIZONA_DRE_ENABLE);
295 const struct reg_sequence *wseq; 295 const struct reg_sequence *wseq;
296 int nregs; 296 int nregs;
297 297
@@ -325,25 +325,25 @@ static int wm5110_hp_pre_enable(struct snd_soc_dapm_widget *w)
325 325
326static int wm5110_hp_pre_disable(struct snd_soc_dapm_widget *w) 326static int wm5110_hp_pre_disable(struct snd_soc_dapm_widget *w)
327{ 327{
328 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 328 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
329 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 329 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
330 unsigned int val = snd_soc_read(codec, ARIZONA_DRE_ENABLE); 330 unsigned int val = snd_soc_component_read32(component, ARIZONA_DRE_ENABLE);
331 331
332 switch (w->shift) { 332 switch (w->shift) {
333 case ARIZONA_OUT1L_ENA_SHIFT: 333 case ARIZONA_OUT1L_ENA_SHIFT:
334 if (!(val & ARIZONA_DRE1L_ENA_MASK)) { 334 if (!(val & ARIZONA_DRE1L_ENA_MASK)) {
335 snd_soc_update_bits(codec, ARIZONA_SPARE_TRIGGERS, 335 snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS,
336 ARIZONA_WS_TRG1, ARIZONA_WS_TRG1); 336 ARIZONA_WS_TRG1, ARIZONA_WS_TRG1);
337 snd_soc_update_bits(codec, ARIZONA_SPARE_TRIGGERS, 337 snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS,
338 ARIZONA_WS_TRG1, 0); 338 ARIZONA_WS_TRG1, 0);
339 priv->out_down_delay += 27; 339 priv->out_down_delay += 27;
340 } 340 }
341 break; 341 break;
342 case ARIZONA_OUT1R_ENA_SHIFT: 342 case ARIZONA_OUT1R_ENA_SHIFT:
343 if (!(val & ARIZONA_DRE1R_ENA_MASK)) { 343 if (!(val & ARIZONA_DRE1R_ENA_MASK)) {
344 snd_soc_update_bits(codec, ARIZONA_SPARE_TRIGGERS, 344 snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS,
345 ARIZONA_WS_TRG2, ARIZONA_WS_TRG2); 345 ARIZONA_WS_TRG2, ARIZONA_WS_TRG2);
346 snd_soc_update_bits(codec, ARIZONA_SPARE_TRIGGERS, 346 snd_soc_component_update_bits(component, ARIZONA_SPARE_TRIGGERS,
347 ARIZONA_WS_TRG2, 0); 347 ARIZONA_WS_TRG2, 0);
348 priv->out_down_delay += 27; 348 priv->out_down_delay += 27;
349 } 349 }
@@ -358,8 +358,8 @@ static int wm5110_hp_pre_disable(struct snd_soc_dapm_widget *w)
358static int wm5110_hp_ev(struct snd_soc_dapm_widget *w, 358static int wm5110_hp_ev(struct snd_soc_dapm_widget *w,
359 struct snd_kcontrol *kcontrol, int event) 359 struct snd_kcontrol *kcontrol, int event)
360{ 360{
361 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 361 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
362 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 362 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
363 363
364 switch (priv->arizona->rev) { 364 switch (priv->arizona->rev) {
365 case 0 ... 3: 365 case 0 ... 3:
@@ -397,9 +397,9 @@ static int wm5110_clear_pga_volume(struct arizona *arizona, int output)
397static int wm5110_put_dre(struct snd_kcontrol *kcontrol, 397static int wm5110_put_dre(struct snd_kcontrol *kcontrol,
398 struct snd_ctl_elem_value *ucontrol) 398 struct snd_ctl_elem_value *ucontrol)
399{ 399{
400 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 400 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
401 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 401 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
402 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 402 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
403 struct soc_mixer_control *mc = 403 struct soc_mixer_control *mc =
404 (struct soc_mixer_control *)kcontrol->private_value; 404 (struct soc_mixer_control *)kcontrol->private_value;
405 unsigned int ena, dre; 405 unsigned int ena, dre;
@@ -458,8 +458,8 @@ err:
458static int wm5110_in_pga_get(struct snd_kcontrol *kcontrol, 458static int wm5110_in_pga_get(struct snd_kcontrol *kcontrol,
459 struct snd_ctl_elem_value *ucontrol) 459 struct snd_ctl_elem_value *ucontrol)
460{ 460{
461 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 461 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
462 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 462 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
463 int ret; 463 int ret;
464 464
465 /* 465 /*
@@ -478,8 +478,8 @@ static int wm5110_in_pga_get(struct snd_kcontrol *kcontrol,
478static int wm5110_in_pga_put(struct snd_kcontrol *kcontrol, 478static int wm5110_in_pga_put(struct snd_kcontrol *kcontrol,
479 struct snd_ctl_elem_value *ucontrol) 479 struct snd_ctl_elem_value *ucontrol)
480{ 480{
481 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 481 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
482 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 482 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
483 int ret; 483 int ret;
484 484
485 /* 485 /*
@@ -498,9 +498,9 @@ static int wm5110_in_pga_put(struct snd_kcontrol *kcontrol,
498static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w, 498static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w,
499 struct snd_kcontrol *kcontrol, int event) 499 struct snd_kcontrol *kcontrol, int event)
500{ 500{
501 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 501 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
502 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 502 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
503 struct wm5110_priv *wm5110 = snd_soc_codec_get_drvdata(codec); 503 struct wm5110_priv *wm5110 = snd_soc_component_get_drvdata(component);
504 struct arizona *arizona = priv->arizona; 504 struct arizona *arizona = priv->arizona;
505 unsigned int reg, mask; 505 unsigned int reg, mask;
506 struct reg_sequence analog_seq[] = { 506 struct reg_sequence analog_seq[] = {
@@ -519,9 +519,9 @@ static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w,
519 wm5110->in_post_pending++; 519 wm5110->in_post_pending++;
520 return 0; 520 return 0;
521 case SND_SOC_DAPM_PRE_PMU: 521 case SND_SOC_DAPM_PRE_PMU:
522 wm5110->in_pga_cache[w->shift] = snd_soc_read(codec, reg); 522 wm5110->in_pga_cache[w->shift] = snd_soc_component_read32(component, reg);
523 523
524 snd_soc_update_bits(codec, reg, mask, 524 snd_soc_component_update_bits(component, reg, mask,
525 0x40 << ARIZONA_IN1L_PGA_VOL_SHIFT); 525 0x40 << ARIZONA_IN1L_PGA_VOL_SHIFT);
526 526
527 wm5110->in_pre_pending--; 527 wm5110->in_pre_pending--;
@@ -538,7 +538,7 @@ static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w,
538 538
539 break; 539 break;
540 case SND_SOC_DAPM_POST_PMU: 540 case SND_SOC_DAPM_POST_PMU:
541 snd_soc_update_bits(codec, reg, mask, 541 snd_soc_component_update_bits(component, reg, mask,
542 wm5110->in_pga_cache[w->shift]); 542 wm5110->in_pga_cache[w->shift]);
543 543
544 wm5110->in_post_pending--; 544 wm5110->in_post_pending--;
@@ -557,13 +557,13 @@ static int wm5110_in_analog_ev(struct snd_soc_dapm_widget *w,
557static int wm5110_in_ev(struct snd_soc_dapm_widget *w, 557static int wm5110_in_ev(struct snd_soc_dapm_widget *w,
558 struct snd_kcontrol *kcontrol, int event) 558 struct snd_kcontrol *kcontrol, int event)
559{ 559{
560 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 560 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
561 struct arizona_priv *priv = snd_soc_codec_get_drvdata(codec); 561 struct arizona_priv *priv = snd_soc_component_get_drvdata(component);
562 struct arizona *arizona = priv->arizona; 562 struct arizona *arizona = priv->arizona;
563 563
564 switch (arizona->rev) { 564 switch (arizona->rev) {
565 case 0 ... 4: 565 case 0 ... 4:
566 if (arizona_input_analog(codec, w->shift)) 566 if (arizona_input_analog(component, w->shift))
567 wm5110_in_analog_ev(w, kcontrol, event); 567 wm5110_in_analog_ev(w, kcontrol, event);
568 568
569 break; 569 break;
@@ -2034,10 +2034,10 @@ static const struct snd_soc_dapm_route wm5110_dapm_routes[] = {
2034 { "DSP3 Voice Trigger", "Switch", "DSP3" }, 2034 { "DSP3 Voice Trigger", "Switch", "DSP3" },
2035}; 2035};
2036 2036
2037static int wm5110_set_fll(struct snd_soc_codec *codec, int fll_id, int source, 2037static int wm5110_set_fll(struct snd_soc_component *component, int fll_id, int source,
2038 unsigned int Fref, unsigned int Fout) 2038 unsigned int Fref, unsigned int Fout)
2039{ 2039{
2040 struct wm5110_priv *wm5110 = snd_soc_codec_get_drvdata(codec); 2040 struct wm5110_priv *wm5110 = snd_soc_component_get_drvdata(component);
2041 2041
2042 switch (fll_id) { 2042 switch (fll_id) {
2043 case WM5110_FLL1: 2043 case WM5110_FLL1:
@@ -2278,31 +2278,30 @@ static irqreturn_t wm5110_adsp2_irq(int irq, void *data)
2278 return IRQ_HANDLED; 2278 return IRQ_HANDLED;
2279} 2279}
2280 2280
2281static int wm5110_codec_probe(struct snd_soc_codec *codec) 2281static int wm5110_component_probe(struct snd_soc_component *component)
2282{ 2282{
2283 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 2283 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2284 struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); 2284 struct wm5110_priv *priv = snd_soc_component_get_drvdata(component);
2285 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec);
2286 struct arizona *arizona = priv->core.arizona; 2285 struct arizona *arizona = priv->core.arizona;
2287 int i, ret; 2286 int i, ret;
2288 2287
2289 arizona->dapm = dapm; 2288 arizona->dapm = dapm;
2290 snd_soc_codec_init_regmap(codec, arizona->regmap); 2289 snd_soc_component_init_regmap(component, arizona->regmap);
2291 2290
2292 ret = arizona_init_spk(codec); 2291 ret = arizona_init_spk(component);
2293 if (ret < 0) 2292 if (ret < 0)
2294 return ret; 2293 return ret;
2295 2294
2296 arizona_init_gpio(codec); 2295 arizona_init_gpio(component);
2297 arizona_init_mono(codec); 2296 arizona_init_mono(component);
2298 2297
2299 for (i = 0; i < WM5110_NUM_ADSP; ++i) { 2298 for (i = 0; i < WM5110_NUM_ADSP; ++i) {
2300 ret = wm_adsp2_codec_probe(&priv->core.adsp[i], codec); 2299 ret = wm_adsp2_component_probe(&priv->core.adsp[i], component);
2301 if (ret) 2300 if (ret)
2302 goto err_adsp2_codec_probe; 2301 goto err_adsp2_codec_probe;
2303 } 2302 }
2304 2303
2305 ret = snd_soc_add_codec_controls(codec, 2304 ret = snd_soc_add_component_controls(component,
2306 arizona_adsp2_rate_controls, 2305 arizona_adsp2_rate_controls,
2307 WM5110_NUM_ADSP); 2306 WM5110_NUM_ADSP);
2308 if (ret) 2307 if (ret)
@@ -2314,22 +2313,20 @@ static int wm5110_codec_probe(struct snd_soc_codec *codec)
2314 2313
2315err_adsp2_codec_probe: 2314err_adsp2_codec_probe:
2316 for (--i; i >= 0; --i) 2315 for (--i; i >= 0; --i)
2317 wm_adsp2_codec_remove(&priv->core.adsp[i], codec); 2316 wm_adsp2_component_remove(&priv->core.adsp[i], component);
2318 2317
2319 return ret; 2318 return ret;
2320} 2319}
2321 2320
2322static int wm5110_codec_remove(struct snd_soc_codec *codec) 2321static void wm5110_component_remove(struct snd_soc_component *component)
2323{ 2322{
2324 struct wm5110_priv *priv = snd_soc_codec_get_drvdata(codec); 2323 struct wm5110_priv *priv = snd_soc_component_get_drvdata(component);
2325 int i; 2324 int i;
2326 2325
2327 for (i = 0; i < WM5110_NUM_ADSP; ++i) 2326 for (i = 0; i < WM5110_NUM_ADSP; ++i)
2328 wm_adsp2_codec_remove(&priv->core.adsp[i], codec); 2327 wm_adsp2_component_remove(&priv->core.adsp[i], component);
2329 2328
2330 priv->core.arizona->dapm = NULL; 2329 priv->core.arizona->dapm = NULL;
2331
2332 return 0;
2333} 2330}
2334 2331
2335#define WM5110_DIG_VU 0x0200 2332#define WM5110_DIG_VU 0x0200
@@ -2359,25 +2356,22 @@ static struct snd_compr_ops wm5110_compr_ops = {
2359 .copy = wm_adsp_compr_copy, 2356 .copy = wm_adsp_compr_copy,
2360}; 2357};
2361 2358
2362static const struct snd_soc_codec_driver soc_codec_dev_wm5110 = { 2359static const struct snd_soc_component_driver soc_component_dev_wm5110 = {
2363 .probe = wm5110_codec_probe, 2360 .probe = wm5110_component_probe,
2364 .remove = wm5110_codec_remove, 2361 .remove = wm5110_component_remove,
2365 2362 .set_sysclk = arizona_set_sysclk,
2366 .idle_bias_off = true, 2363 .set_pll = wm5110_set_fll,
2367 2364 .name = DRV_NAME,
2368 .set_sysclk = arizona_set_sysclk, 2365 .compr_ops = &wm5110_compr_ops,
2369 .set_pll = wm5110_set_fll, 2366 .controls = wm5110_snd_controls,
2370 2367 .num_controls = ARRAY_SIZE(wm5110_snd_controls),
2371 .component_driver = { 2368 .dapm_widgets = wm5110_dapm_widgets,
2372 .name = DRV_NAME, 2369 .num_dapm_widgets = ARRAY_SIZE(wm5110_dapm_widgets),
2373 .compr_ops = &wm5110_compr_ops, 2370 .dapm_routes = wm5110_dapm_routes,
2374 .controls = wm5110_snd_controls, 2371 .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes),
2375 .num_controls = ARRAY_SIZE(wm5110_snd_controls), 2372 .use_pmdown_time = 1,
2376 .dapm_widgets = wm5110_dapm_widgets, 2373 .endianness = 1,
2377 .num_dapm_widgets = ARRAY_SIZE(wm5110_dapm_widgets), 2374 .non_legacy_dai_naming = 1,
2378 .dapm_routes = wm5110_dapm_routes,
2379 .num_dapm_routes = ARRAY_SIZE(wm5110_dapm_routes),
2380 },
2381}; 2375};
2382 2376
2383static int wm5110_probe(struct platform_device *pdev) 2377static int wm5110_probe(struct platform_device *pdev)
@@ -2465,10 +2459,11 @@ static int wm5110_probe(struct platform_device *pdev)
2465 if (ret < 0) 2459 if (ret < 0)
2466 goto err_dsp_irq; 2460 goto err_dsp_irq;
2467 2461
2468 ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5110, 2462 ret = devm_snd_soc_register_component(&pdev->dev,
2463 &soc_component_dev_wm5110,
2469 wm5110_dai, ARRAY_SIZE(wm5110_dai)); 2464 wm5110_dai, ARRAY_SIZE(wm5110_dai));
2470 if (ret < 0) { 2465 if (ret < 0) {
2471 dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); 2466 dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
2472 goto err_spk_irqs; 2467 goto err_spk_irqs;
2473 } 2468 }
2474 2469
@@ -2488,7 +2483,6 @@ static int wm5110_remove(struct platform_device *pdev)
2488 struct arizona *arizona = wm5110->core.arizona; 2483 struct arizona *arizona = wm5110->core.arizona;
2489 int i; 2484 int i;
2490 2485
2491 snd_soc_unregister_codec(&pdev->dev);
2492 pm_runtime_disable(&pdev->dev); 2486 pm_runtime_disable(&pdev->dev);
2493 2487
2494 for (i = 0; i < WM5110_NUM_ADSP; i++) 2488 for (i = 0; i < WM5110_NUM_ADSP; i++)
diff --git a/sound/soc/codecs/wm8997.c b/sound/soc/codecs/wm8997.c
index cac9b3e7e15d..45ee1e6bf715 100644
--- a/sound/soc/codecs/wm8997.c
+++ b/sound/soc/codecs/wm8997.c
@@ -84,8 +84,8 @@ static const struct reg_default wm8997_sysclk_reva_patch[] = {
84static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w, 84static int wm8997_sysclk_ev(struct snd_soc_dapm_widget *w,
85 struct snd_kcontrol *kcontrol, int event) 85 struct snd_kcontrol *kcontrol, int event)
86{ 86{
87 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 87 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
88 struct arizona *arizona = dev_get_drvdata(codec->dev->parent); 88 struct arizona *arizona = dev_get_drvdata(component->dev->parent);
89 struct regmap *regmap = arizona->regmap; 89 struct regmap *regmap = arizona->regmap;
90 const struct reg_default *patch = NULL; 90 const struct reg_default *patch = NULL;
91 int i, patch_size; 91 int i, patch_size;
@@ -927,10 +927,10 @@ static const struct snd_soc_dapm_route wm8997_dapm_routes[] = {
927 { "MICSUPP", NULL, "SYSCLK" }, 927 { "MICSUPP", NULL, "SYSCLK" },
928}; 928};
929 929
930static int wm8997_set_fll(struct snd_soc_codec *codec, int fll_id, int source, 930static int wm8997_set_fll(struct snd_soc_component *component, int fll_id, int source,
931 unsigned int Fref, unsigned int Fout) 931 unsigned int Fref, unsigned int Fout)
932{ 932{
933 struct wm8997_priv *wm8997 = snd_soc_codec_get_drvdata(codec); 933 struct wm8997_priv *wm8997 = snd_soc_component_get_drvdata(component);
934 934
935 switch (fll_id) { 935 switch (fll_id) {
936 case WM8997_FLL1: 936 case WM8997_FLL1:
@@ -1057,17 +1057,16 @@ static struct snd_soc_dai_driver wm8997_dai[] = {
1057 }, 1057 },
1058}; 1058};
1059 1059
1060static int wm8997_codec_probe(struct snd_soc_codec *codec) 1060static int wm8997_component_probe(struct snd_soc_component *component)
1061{ 1061{
1062 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 1062 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1063 struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); 1063 struct wm8997_priv *priv = snd_soc_component_get_drvdata(component);
1064 struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec);
1065 struct arizona *arizona = priv->core.arizona; 1064 struct arizona *arizona = priv->core.arizona;
1066 int ret; 1065 int ret;
1067 1066
1068 snd_soc_codec_init_regmap(codec, arizona->regmap); 1067 snd_soc_component_init_regmap(component, arizona->regmap);
1069 1068
1070 ret = arizona_init_spk(codec); 1069 ret = arizona_init_spk(component);
1071 if (ret < 0) 1070 if (ret < 0)
1072 return ret; 1071 return ret;
1073 1072
@@ -1078,13 +1077,11 @@ static int wm8997_codec_probe(struct snd_soc_codec *codec)
1078 return 0; 1077 return 0;
1079} 1078}
1080 1079
1081static int wm8997_codec_remove(struct snd_soc_codec *codec) 1080static void wm8997_component_remove(struct snd_soc_component *component)
1082{ 1081{
1083 struct wm8997_priv *priv = snd_soc_codec_get_drvdata(codec); 1082 struct wm8997_priv *priv = snd_soc_component_get_drvdata(component);
1084 1083
1085 priv->core.arizona->dapm = NULL; 1084 priv->core.arizona->dapm = NULL;
1086
1087 return 0;
1088} 1085}
1089 1086
1090#define WM8997_DIG_VU 0x0200 1087#define WM8997_DIG_VU 0x0200
@@ -1098,23 +1095,20 @@ static unsigned int wm8997_digital_vu[] = {
1098 ARIZONA_DAC_DIGITAL_VOLUME_5R, 1095 ARIZONA_DAC_DIGITAL_VOLUME_5R,
1099}; 1096};
1100 1097
1101static const struct snd_soc_codec_driver soc_codec_dev_wm8997 = { 1098static const struct snd_soc_component_driver soc_component_dev_wm8997 = {
1102 .probe = wm8997_codec_probe, 1099 .probe = wm8997_component_probe,
1103 .remove = wm8997_codec_remove, 1100 .remove = wm8997_component_remove,
1104 1101 .set_sysclk = arizona_set_sysclk,
1105 .idle_bias_off = true, 1102 .set_pll = wm8997_set_fll,
1106 1103 .controls = wm8997_snd_controls,
1107 .set_sysclk = arizona_set_sysclk, 1104 .num_controls = ARRAY_SIZE(wm8997_snd_controls),
1108 .set_pll = wm8997_set_fll, 1105 .dapm_widgets = wm8997_dapm_widgets,
1109 1106 .num_dapm_widgets = ARRAY_SIZE(wm8997_dapm_widgets),
1110 .component_driver = { 1107 .dapm_routes = wm8997_dapm_routes,
1111 .controls = wm8997_snd_controls, 1108 .num_dapm_routes = ARRAY_SIZE(wm8997_dapm_routes),
1112 .num_controls = ARRAY_SIZE(wm8997_snd_controls), 1109 .use_pmdown_time = 1,
1113 .dapm_widgets = wm8997_dapm_widgets, 1110 .endianness = 1,
1114 .num_dapm_widgets = ARRAY_SIZE(wm8997_dapm_widgets), 1111 .non_legacy_dai_naming = 1,
1115 .dapm_routes = wm8997_dapm_routes,
1116 .num_dapm_routes = ARRAY_SIZE(wm8997_dapm_routes),
1117 },
1118}; 1112};
1119 1113
1120static int wm8997_probe(struct platform_device *pdev) 1114static int wm8997_probe(struct platform_device *pdev)
@@ -1178,10 +1172,11 @@ static int wm8997_probe(struct platform_device *pdev)
1178 if (ret < 0) 1172 if (ret < 0)
1179 return ret; 1173 return ret;
1180 1174
1181 ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8997, 1175 ret = devm_snd_soc_register_component(&pdev->dev,
1176 &soc_component_dev_wm8997,
1182 wm8997_dai, ARRAY_SIZE(wm8997_dai)); 1177 wm8997_dai, ARRAY_SIZE(wm8997_dai));
1183 if (ret < 0) { 1178 if (ret < 0) {
1184 dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); 1179 dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
1185 goto err_spk_irqs; 1180 goto err_spk_irqs;
1186 } 1181 }
1187 1182
@@ -1196,7 +1191,6 @@ static int wm8997_remove(struct platform_device *pdev)
1196 struct wm8997_priv *wm8997 = platform_get_drvdata(pdev); 1191 struct wm8997_priv *wm8997 = platform_get_drvdata(pdev);
1197 struct arizona *arizona = wm8997->core.arizona; 1192 struct arizona *arizona = wm8997->core.arizona;
1198 1193
1199 snd_soc_unregister_codec(&pdev->dev);
1200 pm_runtime_disable(&pdev->dev); 1194 pm_runtime_disable(&pdev->dev);
1201 1195
1202 arizona_free_spk_irqs(arizona); 1196 arizona_free_spk_irqs(arizona);
diff --git a/sound/soc/codecs/wm8998.c b/sound/soc/codecs/wm8998.c
index 1288e1f67dcf..6f3fdd7b095e 100644
--- a/sound/soc/codecs/wm8998.c
+++ b/sound/soc/codecs/wm8998.c
@@ -41,12 +41,12 @@ static int wm8998_asrc_ev(struct snd_soc_dapm_widget *w,
41 struct snd_kcontrol *kcontrol, 41 struct snd_kcontrol *kcontrol,
42 int event) 42 int event)
43{ 43{
44 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 44 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
45 unsigned int val; 45 unsigned int val;
46 46
47 switch (event) { 47 switch (event) {
48 case SND_SOC_DAPM_PRE_PMU: 48 case SND_SOC_DAPM_PRE_PMU:
49 val = snd_soc_read(codec, ARIZONA_ASRC_RATE1); 49 val = snd_soc_component_read32(component, ARIZONA_ASRC_RATE1);
50 val &= ARIZONA_ASRC_RATE1_MASK; 50 val &= ARIZONA_ASRC_RATE1_MASK;
51 val >>= ARIZONA_ASRC_RATE1_SHIFT; 51 val >>= ARIZONA_ASRC_RATE1_SHIFT;
52 52
@@ -54,23 +54,23 @@ static int wm8998_asrc_ev(struct snd_soc_dapm_widget *w,
54 case 0: 54 case 0:
55 case 1: 55 case 1:
56 case 2: 56 case 2:
57 val = snd_soc_read(codec, 57 val = snd_soc_component_read32(component,
58 ARIZONA_SAMPLE_RATE_1 + val); 58 ARIZONA_SAMPLE_RATE_1 + val);
59 if (val >= 0x11) { 59 if (val >= 0x11) {
60 dev_warn(codec->dev, 60 dev_warn(component->dev,
61 "Unsupported ASRC rate1 (%s)\n", 61 "Unsupported ASRC rate1 (%s)\n",
62 arizona_sample_rate_val_to_name(val)); 62 arizona_sample_rate_val_to_name(val));
63 return -EINVAL; 63 return -EINVAL;
64 } 64 }
65 break; 65 break;
66 default: 66 default:
67 dev_err(codec->dev, 67 dev_err(component->dev,
68 "Illegal ASRC rate1 selector (0x%x)\n", 68 "Illegal ASRC rate1 selector (0x%x)\n",
69 val); 69 val);
70 return -EINVAL; 70 return -EINVAL;
71 } 71 }
72 72
73 val = snd_soc_read(codec, ARIZONA_ASRC_RATE2); 73 val = snd_soc_component_read32(component, ARIZONA_ASRC_RATE2);
74 val &= ARIZONA_ASRC_RATE2_MASK; 74 val &= ARIZONA_ASRC_RATE2_MASK;
75 val >>= ARIZONA_ASRC_RATE2_SHIFT; 75 val >>= ARIZONA_ASRC_RATE2_SHIFT;
76 76
@@ -78,17 +78,17 @@ static int wm8998_asrc_ev(struct snd_soc_dapm_widget *w,
78 case 8: 78 case 8:
79 case 9: 79 case 9:
80 val -= 0x8; 80 val -= 0x8;
81 val = snd_soc_read(codec, 81 val = snd_soc_component_read32(component,
82 ARIZONA_ASYNC_SAMPLE_RATE_1 + val); 82 ARIZONA_ASYNC_SAMPLE_RATE_1 + val);
83 if (val >= 0x11) { 83 if (val >= 0x11) {
84 dev_warn(codec->dev, 84 dev_warn(component->dev,
85 "Unsupported ASRC rate2 (%s)\n", 85 "Unsupported ASRC rate2 (%s)\n",
86 arizona_sample_rate_val_to_name(val)); 86 arizona_sample_rate_val_to_name(val));
87 return -EINVAL; 87 return -EINVAL;
88 } 88 }
89 break; 89 break;
90 default: 90 default:
91 dev_err(codec->dev, 91 dev_err(component->dev,
92 "Illegal ASRC rate2 selector (0x%x)\n", 92 "Illegal ASRC rate2 selector (0x%x)\n",
93 val); 93 val);
94 return -EINVAL; 94 return -EINVAL;
@@ -104,9 +104,9 @@ static int wm8998_asrc_ev(struct snd_soc_dapm_widget *w,
104static int wm8998_inmux_put(struct snd_kcontrol *kcontrol, 104static int wm8998_inmux_put(struct snd_kcontrol *kcontrol,
105 struct snd_ctl_elem_value *ucontrol) 105 struct snd_ctl_elem_value *ucontrol)
106{ 106{
107 struct snd_soc_codec *codec = snd_soc_dapm_kcontrol_codec(kcontrol); 107 struct snd_soc_component *component = snd_soc_dapm_kcontrol_component(kcontrol);
108 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 108 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
109 struct wm8998_priv *wm8998 = snd_soc_codec_get_drvdata(codec); 109 struct wm8998_priv *wm8998 = snd_soc_component_get_drvdata(component);
110 struct arizona *arizona = wm8998->core.arizona; 110 struct arizona *arizona = wm8998->core.arizona;
111 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 111 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
112 unsigned int mode_reg, mode_index; 112 unsigned int mode_reg, mode_index;
@@ -137,9 +137,9 @@ static int wm8998_inmux_put(struct snd_kcontrol *kcontrol,
137 if (inmode & ARIZONA_INMODE_SE) 137 if (inmode & ARIZONA_INMODE_SE)
138 src_val |= 1 << ARIZONA_IN1L_SRC_SE_SHIFT; 138 src_val |= 1 << ARIZONA_IN1L_SRC_SE_SHIFT;
139 139
140 snd_soc_update_bits(codec, mode_reg, ARIZONA_IN1_MODE_MASK, mode_val); 140 snd_soc_component_update_bits(component, mode_reg, ARIZONA_IN1_MODE_MASK, mode_val);
141 141
142 snd_soc_update_bits(codec, e->reg, 142 snd_soc_component_update_bits(component, e->reg,
143 ARIZONA_IN1L_SRC_MASK | ARIZONA_IN1L_SRC_SE_MASK, 143 ARIZONA_IN1L_SRC_MASK | ARIZONA_IN1L_SRC_SE_MASK,
144 src_val); 144 src_val);
145 145
@@ -1249,10 +1249,10 @@ static struct snd_soc_dai_driver wm8998_dai[] = {
1249 }, 1249 },
1250}; 1250};
1251 1251
1252static int wm8998_set_fll(struct snd_soc_codec *codec, int fll_id, int source, 1252static int wm8998_set_fll(struct snd_soc_component *component, int fll_id, int source,
1253 unsigned int Fref, unsigned int Fout) 1253 unsigned int Fref, unsigned int Fout)
1254{ 1254{
1255 struct wm8998_priv *wm8998 = snd_soc_codec_get_drvdata(codec); 1255 struct wm8998_priv *wm8998 = snd_soc_component_get_drvdata(component);
1256 1256
1257 switch (fll_id) { 1257 switch (fll_id) {
1258 case WM8998_FLL1: 1258 case WM8998_FLL1:
@@ -1270,35 +1270,32 @@ static int wm8998_set_fll(struct snd_soc_codec *codec, int fll_id, int source,
1270 } 1270 }
1271} 1271}
1272 1272
1273static int wm8998_codec_probe(struct snd_soc_codec *codec) 1273static int wm8998_component_probe(struct snd_soc_component *component)
1274{ 1274{
1275 struct wm8998_priv *priv = snd_soc_codec_get_drvdata(codec); 1275 struct wm8998_priv *priv = snd_soc_component_get_drvdata(component);
1276 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 1276 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
1277 struct snd_soc_component *component = snd_soc_dapm_to_component(dapm);
1278 struct arizona *arizona = priv->core.arizona; 1277 struct arizona *arizona = priv->core.arizona;
1279 int ret; 1278 int ret;
1280 1279
1281 arizona->dapm = dapm; 1280 arizona->dapm = dapm;
1282 snd_soc_codec_init_regmap(codec, arizona->regmap); 1281 snd_soc_component_init_regmap(component, arizona->regmap);
1283 1282
1284 ret = arizona_init_spk(codec); 1283 ret = arizona_init_spk(component);
1285 if (ret < 0) 1284 if (ret < 0)
1286 return ret; 1285 return ret;
1287 1286
1288 arizona_init_gpio(codec); 1287 arizona_init_gpio(component);
1289 1288
1290 snd_soc_component_disable_pin(component, "HAPTICS"); 1289 snd_soc_component_disable_pin(component, "HAPTICS");
1291 1290
1292 return 0; 1291 return 0;
1293} 1292}
1294 1293
1295static int wm8998_codec_remove(struct snd_soc_codec *codec) 1294static void wm8998_component_remove(struct snd_soc_component *component)
1296{ 1295{
1297 struct wm8998_priv *priv = snd_soc_codec_get_drvdata(codec); 1296 struct wm8998_priv *priv = snd_soc_component_get_drvdata(component);
1298 1297
1299 priv->core.arizona->dapm = NULL; 1298 priv->core.arizona->dapm = NULL;
1300
1301 return 0;
1302} 1299}
1303 1300
1304#define WM8998_DIG_VU 0x0200 1301#define WM8998_DIG_VU 0x0200
@@ -1315,23 +1312,20 @@ static unsigned int wm8998_digital_vu[] = {
1315 ARIZONA_DAC_DIGITAL_VOLUME_5R, 1312 ARIZONA_DAC_DIGITAL_VOLUME_5R,
1316}; 1313};
1317 1314
1318static const struct snd_soc_codec_driver soc_codec_dev_wm8998 = { 1315static const struct snd_soc_component_driver soc_component_dev_wm8998 = {
1319 .probe = wm8998_codec_probe, 1316 .probe = wm8998_component_probe,
1320 .remove = wm8998_codec_remove, 1317 .remove = wm8998_component_remove,
1321 1318 .set_sysclk = arizona_set_sysclk,
1322 .idle_bias_off = true, 1319 .set_pll = wm8998_set_fll,
1323 1320 .controls = wm8998_snd_controls,
1324 .set_sysclk = arizona_set_sysclk, 1321 .num_controls = ARRAY_SIZE(wm8998_snd_controls),
1325 .set_pll = wm8998_set_fll, 1322 .dapm_widgets = wm8998_dapm_widgets,
1326 1323 .num_dapm_widgets = ARRAY_SIZE(wm8998_dapm_widgets),
1327 .component_driver = { 1324 .dapm_routes = wm8998_dapm_routes,
1328 .controls = wm8998_snd_controls, 1325 .num_dapm_routes = ARRAY_SIZE(wm8998_dapm_routes),
1329 .num_controls = ARRAY_SIZE(wm8998_snd_controls), 1326 .use_pmdown_time = 1,
1330 .dapm_widgets = wm8998_dapm_widgets, 1327 .endianness = 1,
1331 .num_dapm_widgets = ARRAY_SIZE(wm8998_dapm_widgets), 1328 .non_legacy_dai_naming = 1,
1332 .dapm_routes = wm8998_dapm_routes,
1333 .num_dapm_routes = ARRAY_SIZE(wm8998_dapm_routes),
1334 },
1335}; 1329};
1336 1330
1337static int wm8998_probe(struct platform_device *pdev) 1331static int wm8998_probe(struct platform_device *pdev)
@@ -1384,10 +1378,11 @@ static int wm8998_probe(struct platform_device *pdev)
1384 if (ret < 0) 1378 if (ret < 0)
1385 return ret; 1379 return ret;
1386 1380
1387 ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm8998, 1381 ret = devm_snd_soc_register_component(&pdev->dev,
1382 &soc_component_dev_wm8998,
1388 wm8998_dai, ARRAY_SIZE(wm8998_dai)); 1383 wm8998_dai, ARRAY_SIZE(wm8998_dai));
1389 if (ret < 0) { 1384 if (ret < 0) {
1390 dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); 1385 dev_err(&pdev->dev, "Failed to register component: %d\n", ret);
1391 goto err_spk_irqs; 1386 goto err_spk_irqs;
1392 } 1387 }
1393 1388
@@ -1404,7 +1399,6 @@ static int wm8998_remove(struct platform_device *pdev)
1404 struct wm8998_priv *wm8998 = platform_get_drvdata(pdev); 1399 struct wm8998_priv *wm8998 = platform_get_drvdata(pdev);
1405 struct arizona *arizona = wm8998->core.arizona; 1400 struct arizona *arizona = wm8998->core.arizona;
1406 1401
1407 snd_soc_unregister_codec(&pdev->dev);
1408 pm_runtime_disable(&pdev->dev); 1402 pm_runtime_disable(&pdev->dev);
1409 1403
1410 arizona_free_spk_irqs(arizona); 1404 arizona_free_spk_irqs(arizona);
diff --git a/sound/soc/codecs/wm_adsp.c b/sound/soc/codecs/wm_adsp.c
index 66e32f5d2917..4847e947410b 100644
--- a/sound/soc/codecs/wm_adsp.c
+++ b/sound/soc/codecs/wm_adsp.c
@@ -605,13 +605,13 @@ static const struct {
605}; 605};
606 606
607static void wm_adsp2_init_debugfs(struct wm_adsp *dsp, 607static void wm_adsp2_init_debugfs(struct wm_adsp *dsp,
608 struct snd_soc_codec *codec) 608 struct snd_soc_component *component)
609{ 609{
610 struct dentry *root = NULL; 610 struct dentry *root = NULL;
611 char *root_name; 611 char *root_name;
612 int i; 612 int i;
613 613
614 if (!codec->component.debugfs_root) { 614 if (!component->debugfs_root) {
615 adsp_err(dsp, "No codec debugfs root\n"); 615 adsp_err(dsp, "No codec debugfs root\n");
616 goto err; 616 goto err;
617 } 617 }
@@ -621,7 +621,7 @@ static void wm_adsp2_init_debugfs(struct wm_adsp *dsp,
621 goto err; 621 goto err;
622 622
623 snprintf(root_name, PAGE_SIZE, "dsp%d", dsp->num); 623 snprintf(root_name, PAGE_SIZE, "dsp%d", dsp->num);
624 root = debugfs_create_dir(root_name, codec->component.debugfs_root); 624 root = debugfs_create_dir(root_name, component->debugfs_root);
625 kfree(root_name); 625 kfree(root_name);
626 626
627 if (!root) 627 if (!root)
@@ -662,7 +662,7 @@ static void wm_adsp2_cleanup_debugfs(struct wm_adsp *dsp)
662} 662}
663#else 663#else
664static inline void wm_adsp2_init_debugfs(struct wm_adsp *dsp, 664static inline void wm_adsp2_init_debugfs(struct wm_adsp *dsp,
665 struct snd_soc_codec *codec) 665 struct snd_soc_component *component)
666{ 666{
667} 667}
668 668
@@ -688,9 +688,9 @@ static inline void wm_adsp_debugfs_clear(struct wm_adsp *dsp)
688static int wm_adsp_fw_get(struct snd_kcontrol *kcontrol, 688static int wm_adsp_fw_get(struct snd_kcontrol *kcontrol,
689 struct snd_ctl_elem_value *ucontrol) 689 struct snd_ctl_elem_value *ucontrol)
690{ 690{
691 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 691 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
692 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 692 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
693 struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec); 693 struct wm_adsp *dsp = snd_soc_component_get_drvdata(component);
694 694
695 ucontrol->value.enumerated.item[0] = dsp[e->shift_l].fw; 695 ucontrol->value.enumerated.item[0] = dsp[e->shift_l].fw;
696 696
@@ -700,9 +700,9 @@ static int wm_adsp_fw_get(struct snd_kcontrol *kcontrol,
700static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol, 700static int wm_adsp_fw_put(struct snd_kcontrol *kcontrol,
701 struct snd_ctl_elem_value *ucontrol) 701 struct snd_ctl_elem_value *ucontrol)
702{ 702{
703 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 703 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
704 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value; 704 struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
705 struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec); 705 struct wm_adsp *dsp = snd_soc_component_get_drvdata(component);
706 int ret = 0; 706 int ret = 0;
707 707
708 if (ucontrol->value.enumerated.item[0] == dsp[e->shift_l].fw) 708 if (ucontrol->value.enumerated.item[0] == dsp[e->shift_l].fw)
@@ -1213,7 +1213,7 @@ static int wmfw_add_ctl(struct wm_adsp *dsp, struct wm_coeff_ctl *ctl)
1213 break; 1213 break;
1214 } 1214 }
1215 1215
1216 ret = snd_soc_add_codec_controls(dsp->codec, kcontrol, 1); 1216 ret = snd_soc_add_component_controls(dsp->component, kcontrol, 1);
1217 if (ret < 0) 1217 if (ret < 0)
1218 goto err_kcontrol; 1218 goto err_kcontrol;
1219 1219
@@ -2396,14 +2396,14 @@ int wm_adsp1_event(struct snd_soc_dapm_widget *w,
2396 struct snd_kcontrol *kcontrol, 2396 struct snd_kcontrol *kcontrol,
2397 int event) 2397 int event)
2398{ 2398{
2399 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 2399 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
2400 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); 2400 struct wm_adsp *dsps = snd_soc_component_get_drvdata(component);
2401 struct wm_adsp *dsp = &dsps[w->shift]; 2401 struct wm_adsp *dsp = &dsps[w->shift];
2402 struct wm_coeff_ctl *ctl; 2402 struct wm_coeff_ctl *ctl;
2403 int ret; 2403 int ret;
2404 unsigned int val; 2404 unsigned int val;
2405 2405
2406 dsp->codec = codec; 2406 dsp->component = component;
2407 2407
2408 mutex_lock(&dsp->pwr_lock); 2408 mutex_lock(&dsp->pwr_lock);
2409 2409
@@ -2633,8 +2633,8 @@ static void wm_adsp2_set_dspclk(struct wm_adsp *dsp, unsigned int freq)
2633int wm_adsp2_preloader_get(struct snd_kcontrol *kcontrol, 2633int wm_adsp2_preloader_get(struct snd_kcontrol *kcontrol,
2634 struct snd_ctl_elem_value *ucontrol) 2634 struct snd_ctl_elem_value *ucontrol)
2635{ 2635{
2636 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 2636 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2637 struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec); 2637 struct wm_adsp *dsp = snd_soc_component_get_drvdata(component);
2638 2638
2639 ucontrol->value.integer.value[0] = dsp->preloaded; 2639 ucontrol->value.integer.value[0] = dsp->preloaded;
2640 2640
@@ -2645,9 +2645,9 @@ EXPORT_SYMBOL_GPL(wm_adsp2_preloader_get);
2645int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol, 2645int wm_adsp2_preloader_put(struct snd_kcontrol *kcontrol,
2646 struct snd_ctl_elem_value *ucontrol) 2646 struct snd_ctl_elem_value *ucontrol)
2647{ 2647{
2648 struct snd_soc_codec *codec = snd_soc_kcontrol_codec(kcontrol); 2648 struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol);
2649 struct wm_adsp *dsp = snd_soc_codec_get_drvdata(codec); 2649 struct wm_adsp *dsp = snd_soc_component_get_drvdata(component);
2650 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 2650 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2651 struct soc_mixer_control *mc = 2651 struct soc_mixer_control *mc =
2652 (struct soc_mixer_control *)kcontrol->private_value; 2652 (struct soc_mixer_control *)kcontrol->private_value;
2653 char preload[32]; 2653 char preload[32];
@@ -2683,8 +2683,8 @@ int wm_adsp2_early_event(struct snd_soc_dapm_widget *w,
2683 struct snd_kcontrol *kcontrol, int event, 2683 struct snd_kcontrol *kcontrol, int event,
2684 unsigned int freq) 2684 unsigned int freq)
2685{ 2685{
2686 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 2686 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
2687 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); 2687 struct wm_adsp *dsps = snd_soc_component_get_drvdata(component);
2688 struct wm_adsp *dsp = &dsps[w->shift]; 2688 struct wm_adsp *dsp = &dsps[w->shift];
2689 struct wm_coeff_ctl *ctl; 2689 struct wm_coeff_ctl *ctl;
2690 2690
@@ -2726,8 +2726,8 @@ EXPORT_SYMBOL_GPL(wm_adsp2_early_event);
2726int wm_adsp2_event(struct snd_soc_dapm_widget *w, 2726int wm_adsp2_event(struct snd_soc_dapm_widget *w,
2727 struct snd_kcontrol *kcontrol, int event) 2727 struct snd_kcontrol *kcontrol, int event)
2728{ 2728{
2729 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 2729 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
2730 struct wm_adsp *dsps = snd_soc_codec_get_drvdata(codec); 2730 struct wm_adsp *dsps = snd_soc_component_get_drvdata(component);
2731 struct wm_adsp *dsp = &dsps[w->shift]; 2731 struct wm_adsp *dsp = &dsps[w->shift];
2732 int ret; 2732 int ret;
2733 2733
@@ -2841,31 +2841,31 @@ err:
2841} 2841}
2842EXPORT_SYMBOL_GPL(wm_adsp2_event); 2842EXPORT_SYMBOL_GPL(wm_adsp2_event);
2843 2843
2844int wm_adsp2_codec_probe(struct wm_adsp *dsp, struct snd_soc_codec *codec) 2844int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *component)
2845{ 2845{
2846 struct snd_soc_dapm_context *dapm = snd_soc_codec_get_dapm(codec); 2846 struct snd_soc_dapm_context *dapm = snd_soc_component_get_dapm(component);
2847 char preload[32]; 2847 char preload[32];
2848 2848
2849 snprintf(preload, ARRAY_SIZE(preload), "DSP%d Preload", dsp->num); 2849 snprintf(preload, ARRAY_SIZE(preload), "DSP%d Preload", dsp->num);
2850 snd_soc_dapm_disable_pin(dapm, preload); 2850 snd_soc_dapm_disable_pin(dapm, preload);
2851 2851
2852 wm_adsp2_init_debugfs(dsp, codec); 2852 wm_adsp2_init_debugfs(dsp, component);
2853 2853
2854 dsp->codec = codec; 2854 dsp->component = component;
2855 2855
2856 return snd_soc_add_codec_controls(codec, 2856 return snd_soc_add_component_controls(component,
2857 &wm_adsp_fw_controls[dsp->num - 1], 2857 &wm_adsp_fw_controls[dsp->num - 1],
2858 1); 2858 1);
2859} 2859}
2860EXPORT_SYMBOL_GPL(wm_adsp2_codec_probe); 2860EXPORT_SYMBOL_GPL(wm_adsp2_component_probe);
2861 2861
2862int wm_adsp2_codec_remove(struct wm_adsp *dsp, struct snd_soc_codec *codec) 2862int wm_adsp2_component_remove(struct wm_adsp *dsp, struct snd_soc_component *component)
2863{ 2863{
2864 wm_adsp2_cleanup_debugfs(dsp); 2864 wm_adsp2_cleanup_debugfs(dsp);
2865 2865
2866 return 0; 2866 return 0;
2867} 2867}
2868EXPORT_SYMBOL_GPL(wm_adsp2_codec_remove); 2868EXPORT_SYMBOL_GPL(wm_adsp2_component_remove);
2869 2869
2870int wm_adsp2_init(struct wm_adsp *dsp) 2870int wm_adsp2_init(struct wm_adsp *dsp)
2871{ 2871{
diff --git a/sound/soc/codecs/wm_adsp.h b/sound/soc/codecs/wm_adsp.h
index 41cc11c19b83..82d651ff9d73 100644
--- a/sound/soc/codecs/wm_adsp.h
+++ b/sound/soc/codecs/wm_adsp.h
@@ -62,7 +62,7 @@ struct wm_adsp {
62 int type; 62 int type;
63 struct device *dev; 63 struct device *dev;
64 struct regmap *regmap; 64 struct regmap *regmap;
65 struct snd_soc_codec *codec; 65 struct snd_soc_component *component;
66 66
67 int base; 67 int base;
68 int sysclk_reg; 68 int sysclk_reg;
@@ -126,8 +126,8 @@ extern const struct snd_kcontrol_new wm_adsp_fw_controls[];
126int wm_adsp1_init(struct wm_adsp *dsp); 126int wm_adsp1_init(struct wm_adsp *dsp);
127int wm_adsp2_init(struct wm_adsp *dsp); 127int wm_adsp2_init(struct wm_adsp *dsp);
128void wm_adsp2_remove(struct wm_adsp *dsp); 128void wm_adsp2_remove(struct wm_adsp *dsp);
129int wm_adsp2_codec_probe(struct wm_adsp *dsp, struct snd_soc_codec *codec); 129int wm_adsp2_component_probe(struct wm_adsp *dsp, struct snd_soc_component *component);
130int wm_adsp2_codec_remove(struct wm_adsp *dsp, struct snd_soc_codec *codec); 130int wm_adsp2_component_remove(struct wm_adsp *dsp, struct snd_soc_component *component);
131int wm_adsp1_event(struct snd_soc_dapm_widget *w, 131int wm_adsp1_event(struct snd_soc_dapm_widget *w,
132 struct snd_kcontrol *kcontrol, int event); 132 struct snd_kcontrol *kcontrol, int event);
133int wm_adsp2_early_event(struct snd_soc_dapm_widget *w, 133int wm_adsp2_early_event(struct snd_soc_dapm_widget *w,
diff --git a/sound/soc/samsung/tm2_wm5110.c b/sound/soc/samsung/tm2_wm5110.c
index a55d18703fe7..6faaec889d1b 100644
--- a/sound/soc/samsung/tm2_wm5110.c
+++ b/sound/soc/samsung/tm2_wm5110.c
@@ -31,7 +31,7 @@
31#define TM2_DAI_AIF2 1 31#define TM2_DAI_AIF2 1
32 32
33struct tm2_machine_priv { 33struct tm2_machine_priv {
34 struct snd_soc_codec *codec; 34 struct snd_soc_component *component;
35 unsigned int sysclk_rate; 35 unsigned int sysclk_rate;
36 struct gpio_desc *gpio_mic_bias; 36 struct gpio_desc *gpio_mic_bias;
37}; 37};
@@ -39,33 +39,33 @@ struct tm2_machine_priv {
39static int tm2_start_sysclk(struct snd_soc_card *card) 39static int tm2_start_sysclk(struct snd_soc_card *card)
40{ 40{
41 struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(card); 41 struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(card);
42 struct snd_soc_codec *codec = priv->codec; 42 struct snd_soc_component *component = priv->component;
43 int ret; 43 int ret;
44 44
45 ret = snd_soc_codec_set_pll(codec, WM5110_FLL1_REFCLK, 45 ret = snd_soc_component_set_pll(component, WM5110_FLL1_REFCLK,
46 ARIZONA_FLL_SRC_MCLK1, 46 ARIZONA_FLL_SRC_MCLK1,
47 MCLK_RATE, 47 MCLK_RATE,
48 priv->sysclk_rate); 48 priv->sysclk_rate);
49 if (ret < 0) { 49 if (ret < 0) {
50 dev_err(codec->dev, "Failed to set FLL1 source: %d\n", ret); 50 dev_err(component->dev, "Failed to set FLL1 source: %d\n", ret);
51 return ret; 51 return ret;
52 } 52 }
53 53
54 ret = snd_soc_codec_set_pll(codec, WM5110_FLL1, 54 ret = snd_soc_component_set_pll(component, WM5110_FLL1,
55 ARIZONA_FLL_SRC_MCLK1, 55 ARIZONA_FLL_SRC_MCLK1,
56 MCLK_RATE, 56 MCLK_RATE,
57 priv->sysclk_rate); 57 priv->sysclk_rate);
58 if (ret < 0) { 58 if (ret < 0) {
59 dev_err(codec->dev, "Failed to start FLL1: %d\n", ret); 59 dev_err(component->dev, "Failed to start FLL1: %d\n", ret);
60 return ret; 60 return ret;
61 } 61 }
62 62
63 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_SYSCLK, 63 ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_SYSCLK,
64 ARIZONA_CLK_SRC_FLL1, 64 ARIZONA_CLK_SRC_FLL1,
65 priv->sysclk_rate, 65 priv->sysclk_rate,
66 SND_SOC_CLOCK_IN); 66 SND_SOC_CLOCK_IN);
67 if (ret < 0) { 67 if (ret < 0) {
68 dev_err(codec->dev, "Failed to set SYSCLK source: %d\n", ret); 68 dev_err(component->dev, "Failed to set SYSCLK source: %d\n", ret);
69 return ret; 69 return ret;
70 } 70 }
71 71
@@ -75,19 +75,19 @@ static int tm2_start_sysclk(struct snd_soc_card *card)
75static int tm2_stop_sysclk(struct snd_soc_card *card) 75static int tm2_stop_sysclk(struct snd_soc_card *card)
76{ 76{
77 struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(card); 77 struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(card);
78 struct snd_soc_codec *codec = priv->codec; 78 struct snd_soc_component *component = priv->component;
79 int ret; 79 int ret;
80 80
81 ret = snd_soc_codec_set_pll(codec, WM5110_FLL1, 0, 0, 0); 81 ret = snd_soc_component_set_pll(component, WM5110_FLL1, 0, 0, 0);
82 if (ret < 0) { 82 if (ret < 0) {
83 dev_err(codec->dev, "Failed to stop FLL1: %d\n", ret); 83 dev_err(component->dev, "Failed to stop FLL1: %d\n", ret);
84 return ret; 84 return ret;
85 } 85 }
86 86
87 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_SYSCLK, 87 ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_SYSCLK,
88 ARIZONA_CLK_SRC_FLL1, 0, 0); 88 ARIZONA_CLK_SRC_FLL1, 0, 0);
89 if (ret < 0) { 89 if (ret < 0) {
90 dev_err(codec->dev, "Failed to stop SYSCLK: %d\n", ret); 90 dev_err(component->dev, "Failed to stop SYSCLK: %d\n", ret);
91 return ret; 91 return ret;
92 } 92 }
93 93
@@ -98,7 +98,7 @@ static int tm2_aif1_hw_params(struct snd_pcm_substream *substream,
98 struct snd_pcm_hw_params *params) 98 struct snd_pcm_hw_params *params)
99{ 99{
100 struct snd_soc_pcm_runtime *rtd = substream->private_data; 100 struct snd_soc_pcm_runtime *rtd = substream->private_data;
101 struct snd_soc_codec *codec = rtd->codec; 101 struct snd_soc_component *component = rtd->codec_dai->component;
102 struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card); 102 struct tm2_machine_priv *priv = snd_soc_card_get_drvdata(rtd->card);
103 103
104 switch (params_rate(params)) { 104 switch (params_rate(params)) {
@@ -123,7 +123,7 @@ static int tm2_aif1_hw_params(struct snd_pcm_substream *substream,
123 priv->sysclk_rate = 135475200U; 123 priv->sysclk_rate = 135475200U;
124 break; 124 break;
125 default: 125 default:
126 dev_err(codec->dev, "Not supported sample rate: %d\n", 126 dev_err(component->dev, "Not supported sample rate: %d\n",
127 params_rate(params)); 127 params_rate(params));
128 return -EINVAL; 128 return -EINVAL;
129 } 129 }
@@ -139,7 +139,7 @@ static int tm2_aif2_hw_params(struct snd_pcm_substream *substream,
139 struct snd_pcm_hw_params *params) 139 struct snd_pcm_hw_params *params)
140{ 140{
141 struct snd_soc_pcm_runtime *rtd = substream->private_data; 141 struct snd_soc_pcm_runtime *rtd = substream->private_data;
142 struct snd_soc_codec *codec = rtd->codec; 142 struct snd_soc_component *component = rtd->codec_dai->component;
143 unsigned int asyncclk_rate; 143 unsigned int asyncclk_rate;
144 int ret; 144 int ret;
145 145
@@ -155,35 +155,35 @@ static int tm2_aif2_hw_params(struct snd_pcm_substream *substream,
155 asyncclk_rate = 45158400U; 155 asyncclk_rate = 45158400U;
156 break; 156 break;
157 default: 157 default:
158 dev_err(codec->dev, "Not supported sample rate: %d\n", 158 dev_err(component->dev, "Not supported sample rate: %d\n",
159 params_rate(params)); 159 params_rate(params));
160 return -EINVAL; 160 return -EINVAL;
161 } 161 }
162 162
163 ret = snd_soc_codec_set_pll(codec, WM5110_FLL2_REFCLK, 163 ret = snd_soc_component_set_pll(component, WM5110_FLL2_REFCLK,
164 ARIZONA_FLL_SRC_MCLK1, 164 ARIZONA_FLL_SRC_MCLK1,
165 MCLK_RATE, 165 MCLK_RATE,
166 asyncclk_rate); 166 asyncclk_rate);
167 if (ret < 0) { 167 if (ret < 0) {
168 dev_err(codec->dev, "Failed to set FLL2 source: %d\n", ret); 168 dev_err(component->dev, "Failed to set FLL2 source: %d\n", ret);
169 return ret; 169 return ret;
170 } 170 }
171 171
172 ret = snd_soc_codec_set_pll(codec, WM5110_FLL2, 172 ret = snd_soc_component_set_pll(component, WM5110_FLL2,
173 ARIZONA_FLL_SRC_MCLK1, 173 ARIZONA_FLL_SRC_MCLK1,
174 MCLK_RATE, 174 MCLK_RATE,
175 asyncclk_rate); 175 asyncclk_rate);
176 if (ret < 0) { 176 if (ret < 0) {
177 dev_err(codec->dev, "Failed to start FLL2: %d\n", ret); 177 dev_err(component->dev, "Failed to start FLL2: %d\n", ret);
178 return ret; 178 return ret;
179 } 179 }
180 180
181 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_ASYNCCLK, 181 ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_ASYNCCLK,
182 ARIZONA_CLK_SRC_FLL2, 182 ARIZONA_CLK_SRC_FLL2,
183 asyncclk_rate, 183 asyncclk_rate,
184 SND_SOC_CLOCK_IN); 184 SND_SOC_CLOCK_IN);
185 if (ret < 0) { 185 if (ret < 0) {
186 dev_err(codec->dev, "Failed to set ASYNCCLK source: %d\n", ret); 186 dev_err(component->dev, "Failed to set ASYNCCLK source: %d\n", ret);
187 return ret; 187 return ret;
188 } 188 }
189 189
@@ -193,14 +193,14 @@ static int tm2_aif2_hw_params(struct snd_pcm_substream *substream,
193static int tm2_aif2_hw_free(struct snd_pcm_substream *substream) 193static int tm2_aif2_hw_free(struct snd_pcm_substream *substream)
194{ 194{
195 struct snd_soc_pcm_runtime *rtd = substream->private_data; 195 struct snd_soc_pcm_runtime *rtd = substream->private_data;
196 struct snd_soc_codec *codec = rtd->codec; 196 struct snd_soc_component *component = rtd->codec_dai->component;
197 int ret; 197 int ret;
198 198
199 /* disable FLL2 */ 199 /* disable FLL2 */
200 ret = snd_soc_codec_set_pll(codec, WM5110_FLL2, ARIZONA_FLL_SRC_MCLK1, 200 ret = snd_soc_component_set_pll(component, WM5110_FLL2, ARIZONA_FLL_SRC_MCLK1,
201 0, 0); 201 0, 0);
202 if (ret < 0) 202 if (ret < 0)
203 dev_err(codec->dev, "Failed to stop FLL2: %d\n", ret); 203 dev_err(component->dev, "Failed to stop FLL2: %d\n", ret);
204 204
205 return ret; 205 return ret;
206} 206}
@@ -269,7 +269,7 @@ static int tm2_late_probe(struct snd_soc_card *card)
269 269
270 rtd = snd_soc_get_pcm_runtime(card, card->dai_link[TM2_DAI_AIF1].name); 270 rtd = snd_soc_get_pcm_runtime(card, card->dai_link[TM2_DAI_AIF1].name);
271 aif1_dai = rtd->codec_dai; 271 aif1_dai = rtd->codec_dai;
272 priv->codec = rtd->codec; 272 priv->component = rtd->codec_dai->component;
273 273
274 ret = snd_soc_dai_set_sysclk(aif1_dai, ARIZONA_CLK_SYSCLK, 0, 0); 274 ret = snd_soc_dai_set_sysclk(aif1_dai, ARIZONA_CLK_SYSCLK, 0, 0);
275 if (ret < 0) { 275 if (ret < 0) {