aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/sound/rt5514.h2
-rw-r--r--include/sound/rt5645.h3
-rw-r--r--sound/soc/codecs/rl6231.c93
-rw-r--r--sound/soc/codecs/rt5514-spi.c1
-rw-r--r--sound/soc/codecs/rt5514.c85
-rw-r--r--sound/soc/codecs/rt5514.h5
-rw-r--r--sound/soc/codecs/rt5645.c187
-rw-r--r--sound/soc/codecs/rt5645.h6
-rw-r--r--sound/soc/intel/boards/cht_bsw_rt5645.c7
-rw-r--r--sound/soc/samsung/bells.c40
10 files changed, 314 insertions, 115 deletions
diff --git a/include/sound/rt5514.h b/include/sound/rt5514.h
index ef18494769ee..64d027dbaaca 100644
--- a/include/sound/rt5514.h
+++ b/include/sound/rt5514.h
@@ -14,6 +14,8 @@
14 14
15struct rt5514_platform_data { 15struct rt5514_platform_data {
16 unsigned int dmic_init_delay; 16 unsigned int dmic_init_delay;
17 const char *dsp_calib_clk_name;
18 unsigned int dsp_calib_clk_rate;
17}; 19};
18 20
19#endif 21#endif
diff --git a/include/sound/rt5645.h b/include/sound/rt5645.h
index d0c33a9972b9..f218c742f08e 100644
--- a/include/sound/rt5645.h
+++ b/include/sound/rt5645.h
@@ -25,6 +25,9 @@ struct rt5645_platform_data {
25 bool level_trigger_irq; 25 bool level_trigger_irq;
26 /* Invert JD1_1 status polarity */ 26 /* Invert JD1_1 status polarity */
27 bool inv_jd1_1; 27 bool inv_jd1_1;
28
29 /* Value to asign to snd_soc_card.long_name */
30 const char *long_name;
28}; 31};
29 32
30#endif 33#endif
diff --git a/sound/soc/codecs/rl6231.c b/sound/soc/codecs/rl6231.c
index 974a9040651d..7ef3b5476bcc 100644
--- a/sound/soc/codecs/rl6231.c
+++ b/sound/soc/codecs/rl6231.c
@@ -13,6 +13,7 @@
13#include <linux/module.h> 13#include <linux/module.h>
14#include <linux/regmap.h> 14#include <linux/regmap.h>
15 15
16#include <linux/gcd.h>
16#include "rl6231.h" 17#include "rl6231.h"
17 18
18/** 19/**
@@ -106,6 +107,25 @@ static const struct pll_calc_map pll_preset_table[] = {
106 {19200000, 24576000, 3, 30, 3, false}, 107 {19200000, 24576000, 3, 30, 3, false},
107}; 108};
108 109
110static unsigned int find_best_div(unsigned int in,
111 unsigned int max, unsigned int div)
112{
113 unsigned int d;
114
115 if (in <= max)
116 return 1;
117
118 d = in / max;
119 if (in % max)
120 d++;
121
122 while (div % d != 0)
123 d++;
124
125
126 return d;
127}
128
109/** 129/**
110 * rl6231_pll_calc - Calcualte PLL M/N/K code. 130 * rl6231_pll_calc - Calcualte PLL M/N/K code.
111 * @freq_in: external clock provided to codec. 131 * @freq_in: external clock provided to codec.
@@ -120,9 +140,11 @@ int rl6231_pll_calc(const unsigned int freq_in,
120 const unsigned int freq_out, struct rl6231_pll_code *pll_code) 140 const unsigned int freq_out, struct rl6231_pll_code *pll_code)
121{ 141{
122 int max_n = RL6231_PLL_N_MAX, max_m = RL6231_PLL_M_MAX; 142 int max_n = RL6231_PLL_N_MAX, max_m = RL6231_PLL_M_MAX;
123 int i, k, red, n_t, pll_out, in_t, out_t; 143 int i, k, n_t;
124 int n = 0, m = 0, m_t = 0; 144 int k_t, min_k, max_k, n = 0, m = 0, m_t = 0;
125 int red_t = abs(freq_out - freq_in); 145 unsigned int red, pll_out, in_t, out_t, div, div_t;
146 unsigned int red_t = abs(freq_out - freq_in);
147 unsigned int f_in, f_out, f_max;
126 bool bypass = false; 148 bool bypass = false;
127 149
128 if (RL6231_PLL_INP_MAX < freq_in || RL6231_PLL_INP_MIN > freq_in) 150 if (RL6231_PLL_INP_MAX < freq_in || RL6231_PLL_INP_MIN > freq_in)
@@ -140,39 +162,52 @@ int rl6231_pll_calc(const unsigned int freq_in,
140 } 162 }
141 } 163 }
142 164
143 k = 100000000 / freq_out - 2; 165 min_k = 80000000 / freq_out - 2;
144 if (k > RL6231_PLL_K_MAX) 166 max_k = 150000000 / freq_out - 2;
145 k = RL6231_PLL_K_MAX; 167 if (max_k > RL6231_PLL_K_MAX)
146 for (n_t = 0; n_t <= max_n; n_t++) { 168 max_k = RL6231_PLL_K_MAX;
147 in_t = freq_in / (k + 2); 169 if (min_k > RL6231_PLL_K_MAX)
148 pll_out = freq_out / (n_t + 2); 170 min_k = max_k = RL6231_PLL_K_MAX;
149 if (in_t < 0) 171 div_t = gcd(freq_in, freq_out);
150 continue; 172 f_max = 0xffffffff / RL6231_PLL_N_MAX;
151 if (in_t == pll_out) { 173 div = find_best_div(freq_in, f_max, div_t);
152 bypass = true; 174 f_in = freq_in / div;
153 n = n_t; 175 f_out = freq_out / div;
154 goto code_find; 176 k = min_k;
155 } 177 for (k_t = min_k; k_t <= max_k; k_t++) {
156 red = abs(in_t - pll_out); 178 for (n_t = 0; n_t <= max_n; n_t++) {
157 if (red < red_t) { 179 in_t = f_in * (n_t + 2);
158 bypass = true; 180 pll_out = f_out * (k_t + 2);
159 n = n_t; 181 if (in_t == pll_out) {
160 m = m_t; 182 bypass = true;
161 if (red == 0) 183 n = n_t;
184 k = k_t;
162 goto code_find; 185 goto code_find;
163 red_t = red; 186 }
164 } 187 out_t = in_t / (k_t + 2);
165 for (m_t = 0; m_t <= max_m; m_t++) { 188 red = abs(f_out - out_t);
166 out_t = in_t / (m_t + 2);
167 red = abs(out_t - pll_out);
168 if (red < red_t) { 189 if (red < red_t) {
169 bypass = false; 190 bypass = true;
170 n = n_t; 191 n = n_t;
171 m = m_t; 192 m = 0;
193 k = k_t;
172 if (red == 0) 194 if (red == 0)
173 goto code_find; 195 goto code_find;
174 red_t = red; 196 red_t = red;
175 } 197 }
198 for (m_t = 0; m_t <= max_m; m_t++) {
199 out_t = in_t / ((m_t + 2) * (k_t + 2));
200 red = abs(f_out - out_t);
201 if (red < red_t) {
202 bypass = false;
203 n = n_t;
204 m = m_t;
205 k = k_t;
206 if (red == 0)
207 goto code_find;
208 red_t = red;
209 }
210 }
176 } 211 }
177 } 212 }
178 pr_debug("Only get approximation about PLL\n"); 213 pr_debug("Only get approximation about PLL\n");
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c
index 64bf26cec20d..2144edca97b0 100644
--- a/sound/soc/codecs/rt5514-spi.c
+++ b/sound/soc/codecs/rt5514-spi.c
@@ -381,6 +381,7 @@ int rt5514_spi_burst_read(unsigned int addr, u8 *rxbuf, size_t len)
381 381
382 return true; 382 return true;
383} 383}
384EXPORT_SYMBOL_GPL(rt5514_spi_burst_read);
384 385
385/** 386/**
386 * rt5514_spi_burst_write - Write data to SPI by rt5514 address. 387 * rt5514_spi_burst_write - Write data to SPI by rt5514 address.
diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c
index 2dd6e9f990a4..198df016802f 100644
--- a/sound/soc/codecs/rt5514.c
+++ b/sound/soc/codecs/rt5514.c
@@ -295,6 +295,33 @@ static int rt5514_dsp_voice_wake_up_get(struct snd_kcontrol *kcontrol,
295 return 0; 295 return 0;
296} 296}
297 297
298static int rt5514_calibration(struct rt5514_priv *rt5514, bool on)
299{
300 if (on) {
301 regmap_write(rt5514->regmap, RT5514_ANA_CTRL_PLL3, 0x0000000a);
302 regmap_update_bits(rt5514->regmap, RT5514_PLL_SOURCE_CTRL, 0xf,
303 0xa);
304 regmap_update_bits(rt5514->regmap, RT5514_PWR_ANA1, 0x301,
305 0x301);
306 regmap_write(rt5514->regmap, RT5514_PLL3_CALIB_CTRL4,
307 0x80000000 | rt5514->pll3_cal_value);
308 regmap_write(rt5514->regmap, RT5514_PLL3_CALIB_CTRL1,
309 0x8bb80800);
310 regmap_update_bits(rt5514->regmap, RT5514_PLL3_CALIB_CTRL5,
311 0xc0000000, 0x80000000);
312 regmap_update_bits(rt5514->regmap, RT5514_PLL3_CALIB_CTRL5,
313 0xc0000000, 0xc0000000);
314 } else {
315 regmap_update_bits(rt5514->regmap, RT5514_PLL3_CALIB_CTRL5,
316 0xc0000000, 0x40000000);
317 regmap_update_bits(rt5514->regmap, RT5514_PWR_ANA1, 0x301, 0);
318 regmap_update_bits(rt5514->regmap, RT5514_PLL_SOURCE_CTRL, 0xf,
319 0x4);
320 }
321
322 return 0;
323}
324
298static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol, 325static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
299 struct snd_ctl_elem_value *ucontrol) 326 struct snd_ctl_elem_value *ucontrol)
300{ 327{
@@ -302,6 +329,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
302 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component); 329 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
303 struct snd_soc_codec *codec = rt5514->codec; 330 struct snd_soc_codec *codec = rt5514->codec;
304 const struct firmware *fw = NULL; 331 const struct firmware *fw = NULL;
332 u8 buf[8];
305 333
306 if (ucontrol->value.integer.value[0] == rt5514->dsp_enabled) 334 if (ucontrol->value.integer.value[0] == rt5514->dsp_enabled)
307 return 0; 335 return 0;
@@ -310,6 +338,35 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
310 rt5514->dsp_enabled = ucontrol->value.integer.value[0]; 338 rt5514->dsp_enabled = ucontrol->value.integer.value[0];
311 339
312 if (rt5514->dsp_enabled) { 340 if (rt5514->dsp_enabled) {
341 if (rt5514->pdata.dsp_calib_clk_name &&
342 !IS_ERR(rt5514->dsp_calib_clk)) {
343 if (clk_set_rate(rt5514->dsp_calib_clk,
344 rt5514->pdata.dsp_calib_clk_rate))
345 dev_err(codec->dev,
346 "Can't set rate for mclk");
347
348 if (clk_prepare_enable(rt5514->dsp_calib_clk))
349 dev_err(codec->dev,
350 "Can't enable dsp_calib_clk");
351
352 rt5514_calibration(rt5514, true);
353
354 msleep(20);
355#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
356 rt5514_spi_burst_read(RT5514_PLL3_CALIB_CTRL6 |
357 RT5514_DSP_MAPPING,
358 (u8 *)&buf, sizeof(buf));
359#else
360 dev_err(codec->dev, "There is no SPI driver for"
361 " loading the firmware\n");
362#endif
363 rt5514->pll3_cal_value = buf[0] | buf[1] << 8 |
364 buf[2] << 16 | buf[3] << 24;
365
366 rt5514_calibration(rt5514, false);
367 clk_disable_unprepare(rt5514->dsp_calib_clk);
368 }
369
313 rt5514_enable_dsp_prepare(rt5514); 370 rt5514_enable_dsp_prepare(rt5514);
314 371
315 request_firmware(&fw, RT5514_FIRMWARE1, codec->dev); 372 request_firmware(&fw, RT5514_FIRMWARE1, codec->dev);
@@ -341,6 +398,20 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
341 /* DSP run */ 398 /* DSP run */
342 regmap_write(rt5514->i2c_regmap, 0x18002f00, 399 regmap_write(rt5514->i2c_regmap, 0x18002f00,
343 0x00055148); 400 0x00055148);
401
402 if (rt5514->pdata.dsp_calib_clk_name &&
403 !IS_ERR(rt5514->dsp_calib_clk)) {
404 msleep(20);
405
406 regmap_write(rt5514->i2c_regmap, 0x1800211c,
407 rt5514->pll3_cal_value);
408 regmap_write(rt5514->i2c_regmap, 0x18002124,
409 0x00220012);
410 regmap_write(rt5514->i2c_regmap, 0x18002124,
411 0x80220042);
412 regmap_write(rt5514->i2c_regmap, 0x18002124,
413 0xe0220042);
414 }
344 } else { 415 } else {
345 regmap_multi_reg_write(rt5514->i2c_regmap, 416 regmap_multi_reg_write(rt5514->i2c_regmap,
346 rt5514_i2c_patch, ARRAY_SIZE(rt5514_i2c_patch)); 417 rt5514_i2c_patch, ARRAY_SIZE(rt5514_i2c_patch));
@@ -1024,12 +1095,22 @@ static int rt5514_set_bias_level(struct snd_soc_codec *codec,
1024static int rt5514_probe(struct snd_soc_codec *codec) 1095static int rt5514_probe(struct snd_soc_codec *codec)
1025{ 1096{
1026 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 1097 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec);
1098 struct platform_device *pdev = container_of(codec->dev,
1099 struct platform_device, dev);
1027 1100
1028 rt5514->mclk = devm_clk_get(codec->dev, "mclk"); 1101 rt5514->mclk = devm_clk_get(codec->dev, "mclk");
1029 if (PTR_ERR(rt5514->mclk) == -EPROBE_DEFER) 1102 if (PTR_ERR(rt5514->mclk) == -EPROBE_DEFER)
1030 return -EPROBE_DEFER; 1103 return -EPROBE_DEFER;
1031 1104
1105 if (rt5514->pdata.dsp_calib_clk_name) {
1106 rt5514->dsp_calib_clk = devm_clk_get(&pdev->dev,
1107 rt5514->pdata.dsp_calib_clk_name);
1108 if (PTR_ERR(rt5514->dsp_calib_clk) == -EPROBE_DEFER)
1109 return -EPROBE_DEFER;
1110 }
1111
1032 rt5514->codec = codec; 1112 rt5514->codec = codec;
1113 rt5514->pll3_cal_value = 0x0078b000;
1033 1114
1034 return 0; 1115 return 0;
1035} 1116}
@@ -1147,6 +1228,10 @@ static int rt5514_parse_dp(struct rt5514_priv *rt5514, struct device *dev)
1147{ 1228{
1148 device_property_read_u32(dev, "realtek,dmic-init-delay-ms", 1229 device_property_read_u32(dev, "realtek,dmic-init-delay-ms",
1149 &rt5514->pdata.dmic_init_delay); 1230 &rt5514->pdata.dmic_init_delay);
1231 device_property_read_string(dev, "realtek,dsp-calib-clk-name",
1232 &rt5514->pdata.dsp_calib_clk_name);
1233 device_property_read_u32(dev, "realtek,dsp-calib-clk-rate",
1234 &rt5514->pdata.dsp_calib_clk_rate);
1150 1235
1151 return 0; 1236 return 0;
1152} 1237}
diff --git a/sound/soc/codecs/rt5514.h b/sound/soc/codecs/rt5514.h
index 2dc40e6d8b3f..f0f3400ce6b1 100644
--- a/sound/soc/codecs/rt5514.h
+++ b/sound/soc/codecs/rt5514.h
@@ -34,7 +34,9 @@
34#define RT5514_CLK_CTRL1 0x2104 34#define RT5514_CLK_CTRL1 0x2104
35#define RT5514_CLK_CTRL2 0x2108 35#define RT5514_CLK_CTRL2 0x2108
36#define RT5514_PLL3_CALIB_CTRL1 0x2110 36#define RT5514_PLL3_CALIB_CTRL1 0x2110
37#define RT5514_PLL3_CALIB_CTRL4 0x2120
37#define RT5514_PLL3_CALIB_CTRL5 0x2124 38#define RT5514_PLL3_CALIB_CTRL5 0x2124
39#define RT5514_PLL3_CALIB_CTRL6 0x2128
38#define RT5514_DELAY_BUF_CTRL1 0x2140 40#define RT5514_DELAY_BUF_CTRL1 0x2140
39#define RT5514_DELAY_BUF_CTRL3 0x2148 41#define RT5514_DELAY_BUF_CTRL3 0x2148
40#define RT5514_ASRC_IN_CTRL1 0x2180 42#define RT5514_ASRC_IN_CTRL1 0x2180
@@ -272,7 +274,7 @@ struct rt5514_priv {
272 struct rt5514_platform_data pdata; 274 struct rt5514_platform_data pdata;
273 struct snd_soc_codec *codec; 275 struct snd_soc_codec *codec;
274 struct regmap *i2c_regmap, *regmap; 276 struct regmap *i2c_regmap, *regmap;
275 struct clk *mclk; 277 struct clk *mclk, *dsp_calib_clk;
276 int sysclk; 278 int sysclk;
277 int sysclk_src; 279 int sysclk_src;
278 int lrck; 280 int lrck;
@@ -281,6 +283,7 @@ struct rt5514_priv {
281 int pll_in; 283 int pll_in;
282 int pll_out; 284 int pll_out;
283 int dsp_enabled; 285 int dsp_enabled;
286 unsigned int pll3_cal_value;
284}; 287};
285 288
286#endif /* __RT5514_H__ */ 289#endif /* __RT5514_H__ */
diff --git a/sound/soc/codecs/rt5645.c b/sound/soc/codecs/rt5645.c
index edc152c8a1fe..8f140c8b93ac 100644
--- a/sound/soc/codecs/rt5645.c
+++ b/sound/soc/codecs/rt5645.c
@@ -1943,6 +1943,56 @@ static int rt5650_hp_event(struct snd_soc_dapm_widget *w,
1943 return 0; 1943 return 0;
1944} 1944}
1945 1945
1946static int rt5645_set_micbias1_event(struct snd_soc_dapm_widget *w,
1947 struct snd_kcontrol *k, int event)
1948{
1949 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
1950
1951 switch (event) {
1952 case SND_SOC_DAPM_PRE_PMU:
1953 snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
1954 RT5645_MICBIAS1_POW_CTRL_SEL_MASK,
1955 RT5645_MICBIAS1_POW_CTRL_SEL_M);
1956 break;
1957
1958 case SND_SOC_DAPM_POST_PMD:
1959 snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
1960 RT5645_MICBIAS1_POW_CTRL_SEL_MASK,
1961 RT5645_MICBIAS1_POW_CTRL_SEL_A);
1962 break;
1963
1964 default:
1965 return 0;
1966 }
1967
1968 return 0;
1969}
1970
1971static int rt5645_set_micbias2_event(struct snd_soc_dapm_widget *w,
1972 struct snd_kcontrol *k, int event)
1973{
1974 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm);
1975
1976 switch (event) {
1977 case SND_SOC_DAPM_PRE_PMU:
1978 snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
1979 RT5645_MICBIAS2_POW_CTRL_SEL_MASK,
1980 RT5645_MICBIAS2_POW_CTRL_SEL_M);
1981 break;
1982
1983 case SND_SOC_DAPM_POST_PMD:
1984 snd_soc_update_bits(codec, RT5645_GEN_CTRL2,
1985 RT5645_MICBIAS2_POW_CTRL_SEL_MASK,
1986 RT5645_MICBIAS2_POW_CTRL_SEL_A);
1987 break;
1988
1989 default:
1990 return 0;
1991 }
1992
1993 return 0;
1994}
1995
1946static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = { 1996static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = {
1947 SND_SOC_DAPM_SUPPLY("LDO2", RT5645_PWR_MIXER, 1997 SND_SOC_DAPM_SUPPLY("LDO2", RT5645_PWR_MIXER,
1948 RT5645_PWR_LDO2_BIT, 0, NULL, 0), 1998 RT5645_PWR_LDO2_BIT, 0, NULL, 0),
@@ -1980,10 +2030,12 @@ static const struct snd_soc_dapm_widget rt5645_dapm_widgets[] = {
1980 2030
1981 /* Input Side */ 2031 /* Input Side */
1982 /* micbias */ 2032 /* micbias */
1983 SND_SOC_DAPM_MICBIAS("micbias1", RT5645_PWR_ANLG2, 2033 SND_SOC_DAPM_SUPPLY("micbias1", RT5645_PWR_ANLG2,
1984 RT5645_PWR_MB1_BIT, 0), 2034 RT5645_PWR_MB1_BIT, 0, rt5645_set_micbias1_event,
1985 SND_SOC_DAPM_MICBIAS("micbias2", RT5645_PWR_ANLG2, 2035 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
1986 RT5645_PWR_MB2_BIT, 0), 2036 SND_SOC_DAPM_SUPPLY("micbias2", RT5645_PWR_ANLG2,
2037 RT5645_PWR_MB2_BIT, 0, rt5645_set_micbias2_event,
2038 SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
1987 /* Input Lines */ 2039 /* Input Lines */
1988 SND_SOC_DAPM_INPUT("DMIC L1"), 2040 SND_SOC_DAPM_INPUT("DMIC L1"),
1989 SND_SOC_DAPM_INPUT("DMIC R1"), 2041 SND_SOC_DAPM_INPUT("DMIC R1"),
@@ -3394,6 +3446,9 @@ static int rt5645_probe(struct snd_soc_codec *codec)
3394 snd_soc_dapm_sync(dapm); 3446 snd_soc_dapm_sync(dapm);
3395 } 3447 }
3396 3448
3449 if (rt5645->pdata.long_name)
3450 codec->component.card->long_name = rt5645->pdata.long_name;
3451
3397 rt5645->eq_param = devm_kzalloc(codec->dev, 3452 rt5645->eq_param = devm_kzalloc(codec->dev,
3398 RT5645_HWEQ_NUM * sizeof(struct rt5645_eq_param_s), GFP_KERNEL); 3453 RT5645_HWEQ_NUM * sizeof(struct rt5645_eq_param_s), GFP_KERNEL);
3399 3454
@@ -3570,63 +3625,74 @@ static const struct acpi_device_id rt5645_acpi_match[] = {
3570MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match); 3625MODULE_DEVICE_TABLE(acpi, rt5645_acpi_match);
3571#endif 3626#endif
3572 3627
3573static const struct rt5645_platform_data general_platform_data = { 3628static const struct rt5645_platform_data intel_braswell_platform_data = {
3574 .dmic1_data_pin = RT5645_DMIC1_DISABLE, 3629 .dmic1_data_pin = RT5645_DMIC1_DISABLE,
3575 .dmic2_data_pin = RT5645_DMIC_DATA_IN2P, 3630 .dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
3576 .jd_mode = 3, 3631 .jd_mode = 3,
3577}; 3632};
3578 3633
3579static const struct dmi_system_id dmi_platform_intel_braswell[] = { 3634static const struct rt5645_platform_data buddy_platform_data = {
3635 .dmic1_data_pin = RT5645_DMIC_DATA_GPIO5,
3636 .dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
3637 .jd_mode = 3,
3638 .level_trigger_irq = true,
3639};
3640
3641static const struct rt5645_platform_data gpd_win_platform_data = {
3642 .jd_mode = 3,
3643 .inv_jd1_1 = true,
3644 .long_name = "gpd-win-pocket-rt5645",
3645 /* The GPD pocket has a diff. mic, for the win this does not matter. */
3646 .in2_diff = true,
3647};
3648
3649static const struct rt5645_platform_data asus_t100ha_platform_data = {
3650 .dmic1_data_pin = RT5645_DMIC_DATA_IN2N,
3651 .dmic2_data_pin = RT5645_DMIC2_DISABLE,
3652 .jd_mode = 3,
3653 .inv_jd1_1 = true,
3654};
3655
3656static const struct rt5645_platform_data jd_mode3_platform_data = {
3657 .jd_mode = 3,
3658};
3659
3660static const struct dmi_system_id dmi_platform_data[] = {
3661 {
3662 .ident = "Chrome Buddy",
3663 .matches = {
3664 DMI_MATCH(DMI_PRODUCT_NAME, "Buddy"),
3665 },
3666 .driver_data = (void *)&buddy_platform_data,
3667 },
3580 { 3668 {
3581 .ident = "Intel Strago", 3669 .ident = "Intel Strago",
3582 .matches = { 3670 .matches = {
3583 DMI_MATCH(DMI_PRODUCT_NAME, "Strago"), 3671 DMI_MATCH(DMI_PRODUCT_NAME, "Strago"),
3584 }, 3672 },
3673 .driver_data = (void *)&intel_braswell_platform_data,
3585 }, 3674 },
3586 { 3675 {
3587 .ident = "Google Chrome", 3676 .ident = "Google Chrome",
3588 .matches = { 3677 .matches = {
3589 DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"), 3678 DMI_MATCH(DMI_SYS_VENDOR, "GOOGLE"),
3590 }, 3679 },
3680 .driver_data = (void *)&intel_braswell_platform_data,
3591 }, 3681 },
3592 { 3682 {
3593 .ident = "Google Setzer", 3683 .ident = "Google Setzer",
3594 .matches = { 3684 .matches = {
3595 DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"), 3685 DMI_MATCH(DMI_PRODUCT_NAME, "Setzer"),
3596 }, 3686 },
3687 .driver_data = (void *)&intel_braswell_platform_data,
3597 }, 3688 },
3598 { 3689 {
3599 .ident = "Microsoft Surface 3", 3690 .ident = "Microsoft Surface 3",
3600 .matches = { 3691 .matches = {
3601 DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"), 3692 DMI_MATCH(DMI_PRODUCT_NAME, "Surface 3"),
3602 }, 3693 },
3694 .driver_data = (void *)&intel_braswell_platform_data,
3603 }, 3695 },
3604 { }
3605};
3606
3607static const struct rt5645_platform_data buddy_platform_data = {
3608 .dmic1_data_pin = RT5645_DMIC_DATA_GPIO5,
3609 .dmic2_data_pin = RT5645_DMIC_DATA_IN2P,
3610 .jd_mode = 3,
3611 .level_trigger_irq = true,
3612};
3613
3614static const struct dmi_system_id dmi_platform_intel_broadwell[] = {
3615 {
3616 .ident = "Chrome Buddy",
3617 .matches = {
3618 DMI_MATCH(DMI_PRODUCT_NAME, "Buddy"),
3619 },
3620 },
3621 { }
3622};
3623
3624static const struct rt5645_platform_data gpd_win_platform_data = {
3625 .jd_mode = 3,
3626 .inv_jd1_1 = true,
3627};
3628
3629static const struct dmi_system_id dmi_platform_gpd_win[] = {
3630 { 3696 {
3631 /* 3697 /*
3632 * Match for the GPDwin which unfortunately uses somewhat 3698 * Match for the GPDwin which unfortunately uses somewhat
@@ -3637,46 +3703,38 @@ static const struct dmi_system_id dmi_platform_gpd_win[] = {
3637 * the same default product_name. Also the GPDwin is the 3703 * the same default product_name. Also the GPDwin is the
3638 * only device to have both board_ and product_name not set. 3704 * only device to have both board_ and product_name not set.
3639 */ 3705 */
3640 .ident = "GPD Win", 3706 .ident = "GPD Win / Pocket",
3641 .matches = { 3707 .matches = {
3642 DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"), 3708 DMI_MATCH(DMI_BOARD_VENDOR, "AMI Corporation"),
3643 DMI_MATCH(DMI_BOARD_NAME, "Default string"), 3709 DMI_MATCH(DMI_BOARD_NAME, "Default string"),
3644 DMI_MATCH(DMI_BOARD_SERIAL, "Default string"), 3710 DMI_MATCH(DMI_BOARD_SERIAL, "Default string"),
3645 DMI_MATCH(DMI_PRODUCT_NAME, "Default string"), 3711 DMI_MATCH(DMI_PRODUCT_NAME, "Default string"),
3646 }, 3712 },
3713 .driver_data = (void *)&gpd_win_platform_data,
3647 }, 3714 },
3648 {}
3649};
3650
3651static const struct rt5645_platform_data general_platform_data2 = {
3652 .dmic1_data_pin = RT5645_DMIC_DATA_IN2N,
3653 .dmic2_data_pin = RT5645_DMIC2_DISABLE,
3654 .jd_mode = 3,
3655 .inv_jd1_1 = true,
3656};
3657
3658static const struct dmi_system_id dmi_platform_asus_t100ha[] = {
3659 { 3715 {
3660 .ident = "ASUS T100HAN", 3716 .ident = "ASUS T100HAN",
3661 .matches = { 3717 .matches = {
3662 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."), 3718 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
3663 DMI_MATCH(DMI_PRODUCT_NAME, "T100HAN"), 3719 DMI_MATCH(DMI_PRODUCT_NAME, "T100HAN"),
3664 }, 3720 },
3721 .driver_data = (void *)&asus_t100ha_platform_data,
3665 }, 3722 },
3666 { }
3667};
3668
3669static const struct rt5645_platform_data minix_z83_4_platform_data = {
3670 .jd_mode = 3,
3671};
3672
3673static const struct dmi_system_id dmi_platform_minix_z83_4[] = {
3674 { 3723 {
3675 .ident = "MINIX Z83-4", 3724 .ident = "MINIX Z83-4",
3676 .matches = { 3725 .matches = {
3677 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MINIX"), 3726 DMI_EXACT_MATCH(DMI_SYS_VENDOR, "MINIX"),
3678 DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"), 3727 DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
3679 }, 3728 },
3729 .driver_data = (void *)&jd_mode3_platform_data,
3730 },
3731 {
3732 .ident = "Teclast X80 Pro",
3733 .matches = {
3734 DMI_MATCH(DMI_SYS_VENDOR, "TECLAST"),
3735 DMI_MATCH(DMI_PRODUCT_NAME, "X80 Pro"),
3736 },
3737 .driver_data = (void *)&jd_mode3_platform_data,
3680 }, 3738 },
3681 { } 3739 { }
3682}; 3740};
@@ -3684,9 +3742,9 @@ static const struct dmi_system_id dmi_platform_minix_z83_4[] = {
3684static bool rt5645_check_dp(struct device *dev) 3742static bool rt5645_check_dp(struct device *dev)
3685{ 3743{
3686 if (device_property_present(dev, "realtek,in2-differential") || 3744 if (device_property_present(dev, "realtek,in2-differential") ||
3687 device_property_present(dev, "realtek,dmic1-data-pin") || 3745 device_property_present(dev, "realtek,dmic1-data-pin") ||
3688 device_property_present(dev, "realtek,dmic2-data-pin") || 3746 device_property_present(dev, "realtek,dmic2-data-pin") ||
3689 device_property_present(dev, "realtek,jd-mode")) 3747 device_property_present(dev, "realtek,jd-mode"))
3690 return true; 3748 return true;
3691 3749
3692 return false; 3750 return false;
@@ -3710,6 +3768,7 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
3710 const struct i2c_device_id *id) 3768 const struct i2c_device_id *id)
3711{ 3769{
3712 struct rt5645_platform_data *pdata = dev_get_platdata(&i2c->dev); 3770 struct rt5645_platform_data *pdata = dev_get_platdata(&i2c->dev);
3771 const struct dmi_system_id *dmi_data;
3713 struct rt5645_priv *rt5645; 3772 struct rt5645_priv *rt5645;
3714 int ret, i; 3773 int ret, i;
3715 unsigned int val; 3774 unsigned int val;
@@ -3723,20 +3782,18 @@ static int rt5645_i2c_probe(struct i2c_client *i2c,
3723 rt5645->i2c = i2c; 3782 rt5645->i2c = i2c;
3724 i2c_set_clientdata(i2c, rt5645); 3783 i2c_set_clientdata(i2c, rt5645);
3725 3784
3785 dmi_data = dmi_first_match(dmi_platform_data);
3786 if (dmi_data) {
3787 dev_info(&i2c->dev, "Detected %s platform\n", dmi_data->ident);
3788 pdata = dmi_data->driver_data;
3789 }
3790
3726 if (pdata) 3791 if (pdata)
3727 rt5645->pdata = *pdata; 3792 rt5645->pdata = *pdata;
3728 else if (dmi_check_system(dmi_platform_intel_broadwell))
3729 rt5645->pdata = buddy_platform_data;
3730 else if (rt5645_check_dp(&i2c->dev)) 3793 else if (rt5645_check_dp(&i2c->dev))
3731 rt5645_parse_dt(rt5645, &i2c->dev); 3794 rt5645_parse_dt(rt5645, &i2c->dev);
3732 else if (dmi_check_system(dmi_platform_intel_braswell)) 3795 else
3733 rt5645->pdata = general_platform_data; 3796 rt5645->pdata = jd_mode3_platform_data;
3734 else if (dmi_check_system(dmi_platform_gpd_win))
3735 rt5645->pdata = gpd_win_platform_data;
3736 else if (dmi_check_system(dmi_platform_asus_t100ha))
3737 rt5645->pdata = general_platform_data2;
3738 else if (dmi_check_system(dmi_platform_minix_z83_4))
3739 rt5645->pdata = minix_z83_4_platform_data;
3740 3797
3741 if (quirk != -1) { 3798 if (quirk != -1) {
3742 rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk); 3799 rt5645->pdata.in2_diff = QUIRK_IN2_DIFF(quirk);
diff --git a/sound/soc/codecs/rt5645.h b/sound/soc/codecs/rt5645.h
index cfc5f97549eb..940325b28c29 100644
--- a/sound/soc/codecs/rt5645.h
+++ b/sound/soc/codecs/rt5645.h
@@ -2117,6 +2117,12 @@ enum {
2117#define RT5645_RXDC_SRC_STO (0x0 << 7) 2117#define RT5645_RXDC_SRC_STO (0x0 << 7)
2118#define RT5645_RXDC_SRC_MONO (0x1 << 7) 2118#define RT5645_RXDC_SRC_MONO (0x1 << 7)
2119#define RT5645_RXDC_SRC_SFT (7) 2119#define RT5645_RXDC_SRC_SFT (7)
2120#define RT5645_MICBIAS1_POW_CTRL_SEL_MASK (0x1 << 5)
2121#define RT5645_MICBIAS1_POW_CTRL_SEL_A (0x0 << 5)
2122#define RT5645_MICBIAS1_POW_CTRL_SEL_M (0x1 << 5)
2123#define RT5645_MICBIAS2_POW_CTRL_SEL_MASK (0x1 << 4)
2124#define RT5645_MICBIAS2_POW_CTRL_SEL_A (0x0 << 4)
2125#define RT5645_MICBIAS2_POW_CTRL_SEL_M (0x1 << 4)
2120#define RT5645_RXDP2_SEL_MASK (0x1 << 3) 2126#define RT5645_RXDP2_SEL_MASK (0x1 << 3)
2121#define RT5645_RXDP2_SEL_IF2 (0x0 << 3) 2127#define RT5645_RXDP2_SEL_IF2 (0x0 << 3)
2122#define RT5645_RXDP2_SEL_ADC (0x1 << 3) 2128#define RT5645_RXDP2_SEL_ADC (0x1 << 3)
diff --git a/sound/soc/intel/boards/cht_bsw_rt5645.c b/sound/soc/intel/boards/cht_bsw_rt5645.c
index 976ea6bf9539..31641aab62cd 100644
--- a/sound/soc/intel/boards/cht_bsw_rt5645.c
+++ b/sound/soc/intel/boards/cht_bsw_rt5645.c
@@ -118,6 +118,7 @@ static const struct snd_soc_dapm_widget cht_dapm_widgets[] = {
118 SND_SOC_DAPM_HP("Headphone", NULL), 118 SND_SOC_DAPM_HP("Headphone", NULL),
119 SND_SOC_DAPM_MIC("Headset Mic", NULL), 119 SND_SOC_DAPM_MIC("Headset Mic", NULL),
120 SND_SOC_DAPM_MIC("Int Mic", NULL), 120 SND_SOC_DAPM_MIC("Int Mic", NULL),
121 SND_SOC_DAPM_MIC("Int Analog Mic", NULL),
121 SND_SOC_DAPM_SPK("Ext Spk", NULL), 122 SND_SOC_DAPM_SPK("Ext Spk", NULL),
122 SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0, 123 SND_SOC_DAPM_SUPPLY("Platform Clock", SND_SOC_NOPM, 0, 0,
123 platform_clock_control, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD), 124 platform_clock_control, SND_SOC_DAPM_PRE_PMU | SND_SOC_DAPM_POST_PMD),
@@ -128,6 +129,8 @@ static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
128 {"IN1N", NULL, "Headset Mic"}, 129 {"IN1N", NULL, "Headset Mic"},
129 {"DMIC L1", NULL, "Int Mic"}, 130 {"DMIC L1", NULL, "Int Mic"},
130 {"DMIC R1", NULL, "Int Mic"}, 131 {"DMIC R1", NULL, "Int Mic"},
132 {"IN2P", NULL, "Int Analog Mic"},
133 {"IN2N", NULL, "Int Analog Mic"},
131 {"Headphone", NULL, "HPOL"}, 134 {"Headphone", NULL, "HPOL"},
132 {"Headphone", NULL, "HPOR"}, 135 {"Headphone", NULL, "HPOR"},
133 {"Ext Spk", NULL, "SPOL"}, 136 {"Ext Spk", NULL, "SPOL"},
@@ -135,6 +138,9 @@ static const struct snd_soc_dapm_route cht_rt5645_audio_map[] = {
135 {"Headphone", NULL, "Platform Clock"}, 138 {"Headphone", NULL, "Platform Clock"},
136 {"Headset Mic", NULL, "Platform Clock"}, 139 {"Headset Mic", NULL, "Platform Clock"},
137 {"Int Mic", NULL, "Platform Clock"}, 140 {"Int Mic", NULL, "Platform Clock"},
141 {"Int Analog Mic", NULL, "Platform Clock"},
142 {"Int Analog Mic", NULL, "micbias1"},
143 {"Int Analog Mic", NULL, "micbias2"},
138 {"Ext Spk", NULL, "Platform Clock"}, 144 {"Ext Spk", NULL, "Platform Clock"},
139}; 145};
140 146
@@ -189,6 +195,7 @@ static const struct snd_kcontrol_new cht_mc_controls[] = {
189 SOC_DAPM_PIN_SWITCH("Headphone"), 195 SOC_DAPM_PIN_SWITCH("Headphone"),
190 SOC_DAPM_PIN_SWITCH("Headset Mic"), 196 SOC_DAPM_PIN_SWITCH("Headset Mic"),
191 SOC_DAPM_PIN_SWITCH("Int Mic"), 197 SOC_DAPM_PIN_SWITCH("Int Mic"),
198 SOC_DAPM_PIN_SWITCH("Int Analog Mic"),
192 SOC_DAPM_PIN_SWITCH("Ext Spk"), 199 SOC_DAPM_PIN_SWITCH("Ext Spk"),
193}; 200};
194 201
diff --git a/sound/soc/samsung/bells.c b/sound/soc/samsung/bells.c
index 34deba461ae1..0e66cd8ef2f9 100644
--- a/sound/soc/samsung/bells.c
+++ b/sound/soc/samsung/bells.c
@@ -60,13 +60,13 @@ static int bells_set_bias_level(struct snd_soc_card *card,
60{ 60{
61 struct snd_soc_pcm_runtime *rtd; 61 struct snd_soc_pcm_runtime *rtd;
62 struct snd_soc_dai *codec_dai; 62 struct snd_soc_dai *codec_dai;
63 struct snd_soc_codec *codec; 63 struct snd_soc_component *component;
64 struct bells_drvdata *bells = card->drvdata; 64 struct bells_drvdata *bells = card->drvdata;
65 int ret; 65 int ret;
66 66
67 rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name); 67 rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name);
68 codec_dai = rtd->codec_dai; 68 codec_dai = rtd->codec_dai;
69 codec = codec_dai->codec; 69 component = codec_dai->component;
70 70
71 if (dapm->dev != codec_dai->dev) 71 if (dapm->dev != codec_dai->dev)
72 return 0; 72 return 0;
@@ -76,7 +76,7 @@ static int bells_set_bias_level(struct snd_soc_card *card,
76 if (dapm->bias_level != SND_SOC_BIAS_STANDBY) 76 if (dapm->bias_level != SND_SOC_BIAS_STANDBY)
77 break; 77 break;
78 78
79 ret = snd_soc_codec_set_pll(codec, WM5102_FLL1, 79 ret = snd_soc_component_set_pll(component, WM5102_FLL1,
80 ARIZONA_FLL_SRC_MCLK1, 80 ARIZONA_FLL_SRC_MCLK1,
81 MCLK_RATE, 81 MCLK_RATE,
82 bells->sysclk_rate); 82 bells->sysclk_rate);
@@ -84,7 +84,7 @@ static int bells_set_bias_level(struct snd_soc_card *card,
84 pr_err("Failed to start FLL: %d\n", ret); 84 pr_err("Failed to start FLL: %d\n", ret);
85 85
86 if (bells->asyncclk_rate) { 86 if (bells->asyncclk_rate) {
87 ret = snd_soc_codec_set_pll(codec, WM5102_FLL2, 87 ret = snd_soc_component_set_pll(component, WM5102_FLL2,
88 ARIZONA_FLL_SRC_AIF2BCLK, 88 ARIZONA_FLL_SRC_AIF2BCLK,
89 BCLK2_RATE, 89 BCLK2_RATE,
90 bells->asyncclk_rate); 90 bells->asyncclk_rate);
@@ -106,27 +106,27 @@ static int bells_set_bias_level_post(struct snd_soc_card *card,
106{ 106{
107 struct snd_soc_pcm_runtime *rtd; 107 struct snd_soc_pcm_runtime *rtd;
108 struct snd_soc_dai *codec_dai; 108 struct snd_soc_dai *codec_dai;
109 struct snd_soc_codec *codec; 109 struct snd_soc_component *component;
110 struct bells_drvdata *bells = card->drvdata; 110 struct bells_drvdata *bells = card->drvdata;
111 int ret; 111 int ret;
112 112
113 rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name); 113 rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name);
114 codec_dai = rtd->codec_dai; 114 codec_dai = rtd->codec_dai;
115 codec = codec_dai->codec; 115 component = codec_dai->component;
116 116
117 if (dapm->dev != codec_dai->dev) 117 if (dapm->dev != codec_dai->dev)
118 return 0; 118 return 0;
119 119
120 switch (level) { 120 switch (level) {
121 case SND_SOC_BIAS_STANDBY: 121 case SND_SOC_BIAS_STANDBY:
122 ret = snd_soc_codec_set_pll(codec, WM5102_FLL1, 0, 0, 0); 122 ret = snd_soc_component_set_pll(component, WM5102_FLL1, 0, 0, 0);
123 if (ret < 0) { 123 if (ret < 0) {
124 pr_err("Failed to stop FLL: %d\n", ret); 124 pr_err("Failed to stop FLL: %d\n", ret);
125 return ret; 125 return ret;
126 } 126 }
127 127
128 if (bells->asyncclk_rate) { 128 if (bells->asyncclk_rate) {
129 ret = snd_soc_codec_set_pll(codec, WM5102_FLL2, 129 ret = snd_soc_component_set_pll(component, WM5102_FLL2,
130 0, 0, 0); 130 0, 0, 0);
131 if (ret < 0) { 131 if (ret < 0) {
132 pr_err("Failed to stop FLL: %d\n", ret); 132 pr_err("Failed to stop FLL: %d\n", ret);
@@ -148,8 +148,8 @@ static int bells_late_probe(struct snd_soc_card *card)
148{ 148{
149 struct bells_drvdata *bells = card->drvdata; 149 struct bells_drvdata *bells = card->drvdata;
150 struct snd_soc_pcm_runtime *rtd; 150 struct snd_soc_pcm_runtime *rtd;
151 struct snd_soc_codec *wm0010; 151 struct snd_soc_component *wm0010;
152 struct snd_soc_codec *codec; 152 struct snd_soc_component *component;
153 struct snd_soc_dai *aif1_dai; 153 struct snd_soc_dai *aif1_dai;
154 struct snd_soc_dai *aif2_dai; 154 struct snd_soc_dai *aif2_dai;
155 struct snd_soc_dai *aif3_dai; 155 struct snd_soc_dai *aif3_dai;
@@ -157,22 +157,22 @@ static int bells_late_probe(struct snd_soc_card *card)
157 int ret; 157 int ret;
158 158
159 rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_AP_DSP].name); 159 rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_AP_DSP].name);
160 wm0010 = rtd->codec; 160 wm0010 = rtd->codec_dai->component;
161 161
162 rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name); 162 rtd = snd_soc_get_pcm_runtime(card, card->dai_link[DAI_DSP_CODEC].name);
163 codec = rtd->codec; 163 component = rtd->codec_dai->component;
164 aif1_dai = rtd->codec_dai; 164 aif1_dai = rtd->codec_dai;
165 165
166 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_SYSCLK, 166 ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_SYSCLK,
167 ARIZONA_CLK_SRC_FLL1, 167 ARIZONA_CLK_SRC_FLL1,
168 bells->sysclk_rate, 168 bells->sysclk_rate,
169 SND_SOC_CLOCK_IN); 169 SND_SOC_CLOCK_IN);
170 if (ret != 0) { 170 if (ret != 0) {
171 dev_err(codec->dev, "Failed to set SYSCLK: %d\n", ret); 171 dev_err(component->dev, "Failed to set SYSCLK: %d\n", ret);
172 return ret; 172 return ret;
173 } 173 }
174 174
175 ret = snd_soc_codec_set_sysclk(wm0010, 0, 0, SYS_MCLK_RATE, 0); 175 ret = snd_soc_component_set_sysclk(wm0010, 0, 0, SYS_MCLK_RATE, 0);
176 if (ret != 0) { 176 if (ret != 0) {
177 dev_err(wm0010->dev, "Failed to set WM0010 clock: %d\n", ret); 177 dev_err(wm0010->dev, "Failed to set WM0010 clock: %d\n", ret);
178 return ret; 178 return ret;
@@ -182,20 +182,20 @@ static int bells_late_probe(struct snd_soc_card *card)
182 if (ret != 0) 182 if (ret != 0)
183 dev_err(aif1_dai->dev, "Failed to set AIF1 clock: %d\n", ret); 183 dev_err(aif1_dai->dev, "Failed to set AIF1 clock: %d\n", ret);
184 184
185 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_OPCLK, 0, 185 ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_OPCLK, 0,
186 SYS_MCLK_RATE, SND_SOC_CLOCK_OUT); 186 SYS_MCLK_RATE, SND_SOC_CLOCK_OUT);
187 if (ret != 0) 187 if (ret != 0)
188 dev_err(codec->dev, "Failed to set OPCLK: %d\n", ret); 188 dev_err(component->dev, "Failed to set OPCLK: %d\n", ret);
189 189
190 if (card->num_rtd == DAI_CODEC_CP) 190 if (card->num_rtd == DAI_CODEC_CP)
191 return 0; 191 return 0;
192 192
193 ret = snd_soc_codec_set_sysclk(codec, ARIZONA_CLK_ASYNCCLK, 193 ret = snd_soc_component_set_sysclk(component, ARIZONA_CLK_ASYNCCLK,
194 ARIZONA_CLK_SRC_FLL2, 194 ARIZONA_CLK_SRC_FLL2,
195 bells->asyncclk_rate, 195 bells->asyncclk_rate,
196 SND_SOC_CLOCK_IN); 196 SND_SOC_CLOCK_IN);
197 if (ret != 0) { 197 if (ret != 0) {
198 dev_err(codec->dev, "Failed to set ASYNCCLK: %d\n", ret); 198 dev_err(component->dev, "Failed to set ASYNCCLK: %d\n", ret);
199 return ret; 199 return ret;
200 } 200 }
201 201
@@ -221,7 +221,7 @@ static int bells_late_probe(struct snd_soc_card *card)
221 return ret; 221 return ret;
222 } 222 }
223 223
224 ret = snd_soc_codec_set_sysclk(wm9081_dai->codec, WM9081_SYSCLK_MCLK, 224 ret = snd_soc_component_set_sysclk(wm9081_dai->component, WM9081_SYSCLK_MCLK,
225 0, SYS_MCLK_RATE, 0); 225 0, SYS_MCLK_RATE, 0);
226 if (ret != 0) { 226 if (ret != 0) {
227 dev_err(wm9081_dai->dev, "Failed to set MCLK: %d\n", ret); 227 dev_err(wm9081_dai->dev, "Failed to set MCLK: %d\n", ret);