aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--sound/soc/codecs/rt5514-spi.c4
-rw-r--r--sound/soc/codecs/rt5514.c124
-rw-r--r--sound/soc/codecs/rt5514.h2
3 files changed, 61 insertions, 69 deletions
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c
index 2144edca97b0..b677f144462b 100644
--- a/sound/soc/codecs/rt5514-spi.c
+++ b/sound/soc/codecs/rt5514-spi.c
@@ -474,9 +474,9 @@ static int __maybe_unused rt5514_suspend(struct device *dev)
474 474
475static int __maybe_unused rt5514_resume(struct device *dev) 475static int __maybe_unused rt5514_resume(struct device *dev)
476{ 476{
477 struct snd_soc_platform *platform = snd_soc_lookup_platform(dev); 477 struct snd_soc_component *component = snd_soc_lookup_component(dev, DRV_NAME);
478 struct rt5514_dsp *rt5514_dsp = 478 struct rt5514_dsp *rt5514_dsp =
479 snd_soc_platform_get_drvdata(platform); 479 snd_soc_component_get_drvdata(component);
480 int irq = to_spi_device(dev)->irq; 480 int irq = to_spi_device(dev)->irq;
481 u8 buf[8]; 481 u8 buf[8];
482 482
diff --git a/sound/soc/codecs/rt5514.c b/sound/soc/codecs/rt5514.c
index 198df016802f..2d79571098ac 100644
--- a/sound/soc/codecs/rt5514.c
+++ b/sound/soc/codecs/rt5514.c
@@ -327,14 +327,13 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
327{ 327{
328 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol); 328 struct snd_soc_component *component = snd_kcontrol_chip(kcontrol);
329 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component); 329 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
330 struct snd_soc_codec *codec = rt5514->codec;
331 const struct firmware *fw = NULL; 330 const struct firmware *fw = NULL;
332 u8 buf[8]; 331 u8 buf[8];
333 332
334 if (ucontrol->value.integer.value[0] == rt5514->dsp_enabled) 333 if (ucontrol->value.integer.value[0] == rt5514->dsp_enabled)
335 return 0; 334 return 0;
336 335
337 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { 336 if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
338 rt5514->dsp_enabled = ucontrol->value.integer.value[0]; 337 rt5514->dsp_enabled = ucontrol->value.integer.value[0];
339 338
340 if (rt5514->dsp_enabled) { 339 if (rt5514->dsp_enabled) {
@@ -342,11 +341,11 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
342 !IS_ERR(rt5514->dsp_calib_clk)) { 341 !IS_ERR(rt5514->dsp_calib_clk)) {
343 if (clk_set_rate(rt5514->dsp_calib_clk, 342 if (clk_set_rate(rt5514->dsp_calib_clk,
344 rt5514->pdata.dsp_calib_clk_rate)) 343 rt5514->pdata.dsp_calib_clk_rate))
345 dev_err(codec->dev, 344 dev_err(component->dev,
346 "Can't set rate for mclk"); 345 "Can't set rate for mclk");
347 346
348 if (clk_prepare_enable(rt5514->dsp_calib_clk)) 347 if (clk_prepare_enable(rt5514->dsp_calib_clk))
349 dev_err(codec->dev, 348 dev_err(component->dev,
350 "Can't enable dsp_calib_clk"); 349 "Can't enable dsp_calib_clk");
351 350
352 rt5514_calibration(rt5514, true); 351 rt5514_calibration(rt5514, true);
@@ -357,7 +356,7 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
357 RT5514_DSP_MAPPING, 356 RT5514_DSP_MAPPING,
358 (u8 *)&buf, sizeof(buf)); 357 (u8 *)&buf, sizeof(buf));
359#else 358#else
360 dev_err(codec->dev, "There is no SPI driver for" 359 dev_err(component->dev, "There is no SPI driver for"
361 " loading the firmware\n"); 360 " loading the firmware\n");
362#endif 361#endif
363 rt5514->pll3_cal_value = buf[0] | buf[1] << 8 | 362 rt5514->pll3_cal_value = buf[0] | buf[1] << 8 |
@@ -369,26 +368,26 @@ static int rt5514_dsp_voice_wake_up_put(struct snd_kcontrol *kcontrol,
369 368
370 rt5514_enable_dsp_prepare(rt5514); 369 rt5514_enable_dsp_prepare(rt5514);
371 370
372 request_firmware(&fw, RT5514_FIRMWARE1, codec->dev); 371 request_firmware(&fw, RT5514_FIRMWARE1, component->dev);
373 if (fw) { 372 if (fw) {
374#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI) 373#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
375 rt5514_spi_burst_write(0x4ff60000, fw->data, 374 rt5514_spi_burst_write(0x4ff60000, fw->data,
376 ((fw->size/8)+1)*8); 375 ((fw->size/8)+1)*8);
377#else 376#else
378 dev_err(codec->dev, "There is no SPI driver for" 377 dev_err(component->dev, "There is no SPI driver for"
379 " loading the firmware\n"); 378 " loading the firmware\n");
380#endif 379#endif
381 release_firmware(fw); 380 release_firmware(fw);
382 fw = NULL; 381 fw = NULL;
383 } 382 }
384 383
385 request_firmware(&fw, RT5514_FIRMWARE2, codec->dev); 384 request_firmware(&fw, RT5514_FIRMWARE2, component->dev);
386 if (fw) { 385 if (fw) {
387#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI) 386#if IS_ENABLED(CONFIG_SND_SOC_RT5514_SPI)
388 rt5514_spi_burst_write(0x4ffc0000, fw->data, 387 rt5514_spi_burst_write(0x4ffc0000, fw->data,
389 ((fw->size/8)+1)*8); 388 ((fw->size/8)+1)*8);
390#else 389#else
391 dev_err(codec->dev, "There is no SPI driver for" 390 dev_err(component->dev, "There is no SPI driver for"
392 " loading the firmware\n"); 391 " loading the firmware\n");
393#endif 392#endif
394 release_firmware(fw); 393 release_firmware(fw);
@@ -492,7 +491,7 @@ static const struct snd_kcontrol_new rt5514_sto2_dmic_mux =
492 * Choose divider parameter that gives the highest possible DMIC frequency in 491 * Choose divider parameter that gives the highest possible DMIC frequency in
493 * 1MHz - 3MHz range. 492 * 1MHz - 3MHz range.
494 */ 493 */
495static int rt5514_calc_dmic_clk(struct snd_soc_codec *codec, int rate) 494static int rt5514_calc_dmic_clk(struct snd_soc_component *component, int rate)
496{ 495{
497 int div[] = {2, 3, 4, 8, 12, 16, 24, 32}; 496 int div[] = {2, 3, 4, 8, 12, 16, 24, 32};
498 int i; 497 int i;
@@ -508,20 +507,20 @@ static int rt5514_calc_dmic_clk(struct snd_soc_codec *codec, int rate)
508 return i; 507 return i;
509 } 508 }
510 509
511 dev_warn(codec->dev, "Base clock rate %d is too high\n", rate); 510 dev_warn(component->dev, "Base clock rate %d is too high\n", rate);
512 return -EINVAL; 511 return -EINVAL;
513} 512}
514 513
515static int rt5514_set_dmic_clk(struct snd_soc_dapm_widget *w, 514static int rt5514_set_dmic_clk(struct snd_soc_dapm_widget *w,
516 struct snd_kcontrol *kcontrol, int event) 515 struct snd_kcontrol *kcontrol, int event)
517{ 516{
518 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(w->dapm); 517 struct snd_soc_component *component = snd_soc_dapm_to_component(w->dapm);
519 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 518 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
520 int idx; 519 int idx;
521 520
522 idx = rt5514_calc_dmic_clk(codec, rt5514->sysclk); 521 idx = rt5514_calc_dmic_clk(component, rt5514->sysclk);
523 if (idx < 0) 522 if (idx < 0)
524 dev_err(codec->dev, "Failed to set DMIC clock\n"); 523 dev_err(component->dev, "Failed to set DMIC clock\n");
525 else 524 else
526 regmap_update_bits(rt5514->regmap, RT5514_CLK_CTRL1, 525 regmap_update_bits(rt5514->regmap, RT5514_CLK_CTRL1,
527 RT5514_CLK_DMIC_OUT_SEL_MASK, 526 RT5514_CLK_DMIC_OUT_SEL_MASK,
@@ -536,8 +535,8 @@ static int rt5514_set_dmic_clk(struct snd_soc_dapm_widget *w,
536static int rt5514_is_sys_clk_from_pll(struct snd_soc_dapm_widget *source, 535static int rt5514_is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
537 struct snd_soc_dapm_widget *sink) 536 struct snd_soc_dapm_widget *sink)
538{ 537{
539 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); 538 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
540 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 539 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
541 540
542 if (rt5514->sysclk_src == RT5514_SCLK_S_PLL1) 541 if (rt5514->sysclk_src == RT5514_SCLK_S_PLL1)
543 return 1; 542 return 1;
@@ -548,8 +547,8 @@ static int rt5514_is_sys_clk_from_pll(struct snd_soc_dapm_widget *source,
548static int rt5514_i2s_use_asrc(struct snd_soc_dapm_widget *source, 547static int rt5514_i2s_use_asrc(struct snd_soc_dapm_widget *source,
549 struct snd_soc_dapm_widget *sink) 548 struct snd_soc_dapm_widget *sink)
550{ 549{
551 struct snd_soc_codec *codec = snd_soc_dapm_to_codec(source->dapm); 550 struct snd_soc_component *component = snd_soc_dapm_to_component(source->dapm);
552 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 551 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
553 552
554 return (rt5514->sysclk > rt5514->lrck * 384); 553 return (rt5514->sysclk > rt5514->lrck * 384);
555} 554}
@@ -751,21 +750,21 @@ static const struct snd_soc_dapm_route rt5514_dapm_routes[] = {
751static int rt5514_hw_params(struct snd_pcm_substream *substream, 750static int rt5514_hw_params(struct snd_pcm_substream *substream,
752 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai) 751 struct snd_pcm_hw_params *params, struct snd_soc_dai *dai)
753{ 752{
754 struct snd_soc_codec *codec = dai->codec; 753 struct snd_soc_component *component = dai->component;
755 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 754 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
756 int pre_div, bclk_ms, frame_size; 755 int pre_div, bclk_ms, frame_size;
757 unsigned int val_len = 0; 756 unsigned int val_len = 0;
758 757
759 rt5514->lrck = params_rate(params); 758 rt5514->lrck = params_rate(params);
760 pre_div = rl6231_get_clk_info(rt5514->sysclk, rt5514->lrck); 759 pre_div = rl6231_get_clk_info(rt5514->sysclk, rt5514->lrck);
761 if (pre_div < 0) { 760 if (pre_div < 0) {
762 dev_err(codec->dev, "Unsupported clock setting\n"); 761 dev_err(component->dev, "Unsupported clock setting\n");
763 return -EINVAL; 762 return -EINVAL;
764 } 763 }
765 764
766 frame_size = snd_soc_params_to_frame_size(params); 765 frame_size = snd_soc_params_to_frame_size(params);
767 if (frame_size < 0) { 766 if (frame_size < 0) {
768 dev_err(codec->dev, "Unsupported frame size: %d\n", frame_size); 767 dev_err(component->dev, "Unsupported frame size: %d\n", frame_size);
769 return -EINVAL; 768 return -EINVAL;
770 } 769 }
771 770
@@ -808,8 +807,8 @@ static int rt5514_hw_params(struct snd_pcm_substream *substream,
808 807
809static int rt5514_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt) 808static int rt5514_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
810{ 809{
811 struct snd_soc_codec *codec = dai->codec; 810 struct snd_soc_component *component = dai->component;
812 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 811 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
813 unsigned int reg_val = 0; 812 unsigned int reg_val = 0;
814 813
815 switch (fmt & SND_SOC_DAIFMT_INV_MASK) { 814 switch (fmt & SND_SOC_DAIFMT_INV_MASK) {
@@ -862,8 +861,8 @@ static int rt5514_set_dai_fmt(struct snd_soc_dai *dai, unsigned int fmt)
862static int rt5514_set_dai_sysclk(struct snd_soc_dai *dai, 861static int rt5514_set_dai_sysclk(struct snd_soc_dai *dai,
863 int clk_id, unsigned int freq, int dir) 862 int clk_id, unsigned int freq, int dir)
864{ 863{
865 struct snd_soc_codec *codec = dai->codec; 864 struct snd_soc_component *component = dai->component;
866 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 865 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
867 unsigned int reg_val = 0; 866 unsigned int reg_val = 0;
868 867
869 if (freq == rt5514->sysclk && clk_id == rt5514->sysclk_src) 868 if (freq == rt5514->sysclk && clk_id == rt5514->sysclk_src)
@@ -879,7 +878,7 @@ static int rt5514_set_dai_sysclk(struct snd_soc_dai *dai,
879 break; 878 break;
880 879
881 default: 880 default:
882 dev_err(codec->dev, "Invalid clock id (%d)\n", clk_id); 881 dev_err(component->dev, "Invalid clock id (%d)\n", clk_id);
883 return -EINVAL; 882 return -EINVAL;
884 } 883 }
885 884
@@ -897,13 +896,13 @@ static int rt5514_set_dai_sysclk(struct snd_soc_dai *dai,
897static int rt5514_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source, 896static int rt5514_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
898 unsigned int freq_in, unsigned int freq_out) 897 unsigned int freq_in, unsigned int freq_out)
899{ 898{
900 struct snd_soc_codec *codec = dai->codec; 899 struct snd_soc_component *component = dai->component;
901 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 900 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
902 struct rl6231_pll_code pll_code; 901 struct rl6231_pll_code pll_code;
903 int ret; 902 int ret;
904 903
905 if (!freq_in || !freq_out) { 904 if (!freq_in || !freq_out) {
906 dev_dbg(codec->dev, "PLL disabled\n"); 905 dev_dbg(component->dev, "PLL disabled\n");
907 906
908 rt5514->pll_in = 0; 907 rt5514->pll_in = 0;
909 rt5514->pll_out = 0; 908 rt5514->pll_out = 0;
@@ -930,17 +929,17 @@ static int rt5514_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
930 break; 929 break;
931 930
932 default: 931 default:
933 dev_err(codec->dev, "Unknown PLL source %d\n", source); 932 dev_err(component->dev, "Unknown PLL source %d\n", source);
934 return -EINVAL; 933 return -EINVAL;
935 } 934 }
936 935
937 ret = rl6231_pll_calc(freq_in, freq_out, &pll_code); 936 ret = rl6231_pll_calc(freq_in, freq_out, &pll_code);
938 if (ret < 0) { 937 if (ret < 0) {
939 dev_err(codec->dev, "Unsupport input clock %d\n", freq_in); 938 dev_err(component->dev, "Unsupport input clock %d\n", freq_in);
940 return ret; 939 return ret;
941 } 940 }
942 941
943 dev_dbg(codec->dev, "bypass=%d m=%d n=%d k=%d\n", 942 dev_dbg(component->dev, "bypass=%d m=%d n=%d k=%d\n",
944 pll_code.m_bp, (pll_code.m_bp ? 0 : pll_code.m_code), 943 pll_code.m_bp, (pll_code.m_bp ? 0 : pll_code.m_code),
945 pll_code.n_code, pll_code.k_code); 944 pll_code.n_code, pll_code.k_code);
946 945
@@ -961,8 +960,8 @@ static int rt5514_set_dai_pll(struct snd_soc_dai *dai, int pll_id, int source,
961static int rt5514_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask, 960static int rt5514_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
962 unsigned int rx_mask, int slots, int slot_width) 961 unsigned int rx_mask, int slots, int slot_width)
963{ 962{
964 struct snd_soc_codec *codec = dai->codec; 963 struct snd_soc_component *component = dai->component;
965 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 964 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
966 unsigned int val = 0, val2 = 0; 965 unsigned int val = 0, val2 = 0;
967 966
968 if (rx_mask || tx_mask) 967 if (rx_mask || tx_mask)
@@ -1047,10 +1046,10 @@ static int rt5514_set_tdm_slot(struct snd_soc_dai *dai, unsigned int tx_mask,
1047 return 0; 1046 return 0;
1048} 1047}
1049 1048
1050static int rt5514_set_bias_level(struct snd_soc_codec *codec, 1049static int rt5514_set_bias_level(struct snd_soc_component *component,
1051 enum snd_soc_bias_level level) 1050 enum snd_soc_bias_level level)
1052{ 1051{
1053 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 1052 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
1054 int ret; 1053 int ret;
1055 1054
1056 switch (level) { 1055 switch (level) {
@@ -1058,7 +1057,7 @@ static int rt5514_set_bias_level(struct snd_soc_codec *codec,
1058 if (IS_ERR(rt5514->mclk)) 1057 if (IS_ERR(rt5514->mclk))
1059 break; 1058 break;
1060 1059
1061 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_ON) { 1060 if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_ON) {
1062 clk_disable_unprepare(rt5514->mclk); 1061 clk_disable_unprepare(rt5514->mclk);
1063 } else { 1062 } else {
1064 ret = clk_prepare_enable(rt5514->mclk); 1063 ret = clk_prepare_enable(rt5514->mclk);
@@ -1068,7 +1067,7 @@ static int rt5514_set_bias_level(struct snd_soc_codec *codec,
1068 break; 1067 break;
1069 1068
1070 case SND_SOC_BIAS_STANDBY: 1069 case SND_SOC_BIAS_STANDBY:
1071 if (snd_soc_codec_get_bias_level(codec) == SND_SOC_BIAS_OFF) { 1070 if (snd_soc_component_get_bias_level(component) == SND_SOC_BIAS_OFF) {
1072 /* 1071 /*
1073 * If the DSP is enabled in start of recording, the DSP 1072 * If the DSP is enabled in start of recording, the DSP
1074 * should be disabled, and sync back to normal recording 1073 * should be disabled, and sync back to normal recording
@@ -1092,13 +1091,13 @@ static int rt5514_set_bias_level(struct snd_soc_codec *codec,
1092 return 0; 1091 return 0;
1093} 1092}
1094 1093
1095static int rt5514_probe(struct snd_soc_codec *codec) 1094static int rt5514_probe(struct snd_soc_component *component)
1096{ 1095{
1097 struct rt5514_priv *rt5514 = snd_soc_codec_get_drvdata(codec); 1096 struct rt5514_priv *rt5514 = snd_soc_component_get_drvdata(component);
1098 struct platform_device *pdev = container_of(codec->dev, 1097 struct platform_device *pdev = container_of(component->dev,
1099 struct platform_device, dev); 1098 struct platform_device, dev);
1100 1099
1101 rt5514->mclk = devm_clk_get(codec->dev, "mclk"); 1100 rt5514->mclk = devm_clk_get(component->dev, "mclk");
1102 if (PTR_ERR(rt5514->mclk) == -EPROBE_DEFER) 1101 if (PTR_ERR(rt5514->mclk) == -EPROBE_DEFER)
1103 return -EPROBE_DEFER; 1102 return -EPROBE_DEFER;
1104 1103
@@ -1109,7 +1108,7 @@ static int rt5514_probe(struct snd_soc_codec *codec)
1109 return -EPROBE_DEFER; 1108 return -EPROBE_DEFER;
1110 } 1109 }
1111 1110
1112 rt5514->codec = codec; 1111 rt5514->component = component;
1113 rt5514->pll3_cal_value = 0x0078b000; 1112 rt5514->pll3_cal_value = 0x0078b000;
1114 1113
1115 return 0; 1114 return 0;
@@ -1162,18 +1161,18 @@ static struct snd_soc_dai_driver rt5514_dai[] = {
1162 } 1161 }
1163}; 1162};
1164 1163
1165static const struct snd_soc_codec_driver soc_codec_dev_rt5514 = { 1164static const struct snd_soc_component_driver soc_component_dev_rt5514 = {
1166 .probe = rt5514_probe, 1165 .probe = rt5514_probe,
1167 .idle_bias_off = true, 1166 .set_bias_level = rt5514_set_bias_level,
1168 .set_bias_level = rt5514_set_bias_level, 1167 .controls = rt5514_snd_controls,
1169 .component_driver = { 1168 .num_controls = ARRAY_SIZE(rt5514_snd_controls),
1170 .controls = rt5514_snd_controls, 1169 .dapm_widgets = rt5514_dapm_widgets,
1171 .num_controls = ARRAY_SIZE(rt5514_snd_controls), 1170 .num_dapm_widgets = ARRAY_SIZE(rt5514_dapm_widgets),
1172 .dapm_widgets = rt5514_dapm_widgets, 1171 .dapm_routes = rt5514_dapm_routes,
1173 .num_dapm_widgets = ARRAY_SIZE(rt5514_dapm_widgets), 1172 .num_dapm_routes = ARRAY_SIZE(rt5514_dapm_routes),
1174 .dapm_routes = rt5514_dapm_routes, 1173 .use_pmdown_time = 1,
1175 .num_dapm_routes = ARRAY_SIZE(rt5514_dapm_routes), 1174 .endianness = 1,
1176 }, 1175 .non_legacy_dai_naming = 1,
1177}; 1176};
1178 1177
1179static const struct regmap_config rt5514_i2c_regmap = { 1178static const struct regmap_config rt5514_i2c_regmap = {
@@ -1313,17 +1312,11 @@ static int rt5514_i2c_probe(struct i2c_client *i2c,
1313 if (ret != 0) 1312 if (ret != 0)
1314 dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret); 1313 dev_warn(&i2c->dev, "Failed to apply regmap patch: %d\n", ret);
1315 1314
1316 return snd_soc_register_codec(&i2c->dev, &soc_codec_dev_rt5514, 1315 return devm_snd_soc_register_component(&i2c->dev,
1316 &soc_component_dev_rt5514,
1317 rt5514_dai, ARRAY_SIZE(rt5514_dai)); 1317 rt5514_dai, ARRAY_SIZE(rt5514_dai));
1318} 1318}
1319 1319
1320static int rt5514_i2c_remove(struct i2c_client *i2c)
1321{
1322 snd_soc_unregister_codec(&i2c->dev);
1323
1324 return 0;
1325}
1326
1327static const struct dev_pm_ops rt5514_i2_pm_ops = { 1320static const struct dev_pm_ops rt5514_i2_pm_ops = {
1328 SET_SYSTEM_SLEEP_PM_OPS(NULL, rt5514_i2c_resume) 1321 SET_SYSTEM_SLEEP_PM_OPS(NULL, rt5514_i2c_resume)
1329}; 1322};
@@ -1336,7 +1329,6 @@ static struct i2c_driver rt5514_i2c_driver = {
1336 .pm = &rt5514_i2_pm_ops, 1329 .pm = &rt5514_i2_pm_ops,
1337 }, 1330 },
1338 .probe = rt5514_i2c_probe, 1331 .probe = rt5514_i2c_probe,
1339 .remove = rt5514_i2c_remove,
1340 .id_table = rt5514_i2c_id, 1332 .id_table = rt5514_i2c_id,
1341}; 1333};
1342module_i2c_driver(rt5514_i2c_driver); 1334module_i2c_driver(rt5514_i2c_driver);
diff --git a/sound/soc/codecs/rt5514.h b/sound/soc/codecs/rt5514.h
index f0f3400ce6b1..d1ef0b3f566f 100644
--- a/sound/soc/codecs/rt5514.h
+++ b/sound/soc/codecs/rt5514.h
@@ -272,7 +272,7 @@ enum {
272 272
273struct rt5514_priv { 273struct rt5514_priv {
274 struct rt5514_platform_data pdata; 274 struct rt5514_platform_data pdata;
275 struct snd_soc_codec *codec; 275 struct snd_soc_component *component;
276 struct regmap *i2c_regmap, *regmap; 276 struct regmap *i2c_regmap, *regmap;
277 struct clk *mclk, *dsp_calib_clk; 277 struct clk *mclk, *dsp_calib_clk;
278 int sysclk; 278 int sysclk;