diff options
author | Mark Brown <broonie@kernel.org> | 2018-02-26 06:18:36 -0500 |
---|---|---|
committer | Mark Brown <broonie@kernel.org> | 2018-02-26 06:18:36 -0500 |
commit | 8596c5c36c0473ca086dc851e5bd90452b3355d9 (patch) | |
tree | a8b789bf6928ab3767315ce7c08d7ba02d9ed9f9 | |
parent | 037002b14b7ae217aa79b260228ba51afc516a8c (diff) | |
parent | 78648092ef46255e6dc6685202164199c86cf930 (diff) |
Merge branch 'topic/generic-dmaengine' of https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound into asoc-stm32
64 files changed, 600 insertions, 599 deletions
diff --git a/include/sound/dmaengine_pcm.h b/include/sound/dmaengine_pcm.h index 67be2445941a..47ef486852ed 100644 --- a/include/sound/dmaengine_pcm.h +++ b/include/sound/dmaengine_pcm.h | |||
@@ -140,6 +140,9 @@ struct snd_dmaengine_pcm_config { | |||
140 | struct dma_chan *(*compat_request_channel)( | 140 | struct dma_chan *(*compat_request_channel)( |
141 | struct snd_soc_pcm_runtime *rtd, | 141 | struct snd_soc_pcm_runtime *rtd, |
142 | struct snd_pcm_substream *substream); | 142 | struct snd_pcm_substream *substream); |
143 | int (*process)(struct snd_pcm_substream *substream, | ||
144 | int channel, unsigned long hwoff, | ||
145 | void *buf, unsigned long bytes); | ||
143 | dma_filter_fn compat_filter_fn; | 146 | dma_filter_fn compat_filter_fn; |
144 | struct device *dma_dev; | 147 | struct device *dma_dev; |
145 | const char *chan_names[SNDRV_PCM_STREAM_LAST + 1]; | 148 | const char *chan_names[SNDRV_PCM_STREAM_LAST + 1]; |
@@ -161,4 +164,6 @@ int snd_dmaengine_pcm_prepare_slave_config(struct snd_pcm_substream *substream, | |||
161 | struct snd_pcm_hw_params *params, | 164 | struct snd_pcm_hw_params *params, |
162 | struct dma_slave_config *slave_config); | 165 | struct dma_slave_config *slave_config); |
163 | 166 | ||
167 | #define SND_DMAENGINE_PCM_DRV_NAME "snd_dmaengine_pcm" | ||
168 | |||
164 | #endif | 169 | #endif |
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h index 07d61583fd02..ed0a120d4f08 100644 --- a/include/uapi/sound/asound.h +++ b/include/uapi/sound/asound.h | |||
@@ -242,6 +242,7 @@ typedef int __bitwise snd_pcm_format_t; | |||
242 | #define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ | 242 | #define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */ |
243 | #define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ | 243 | #define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */ |
244 | #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE | 244 | #define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE |
245 | #define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8 | ||
245 | 246 | ||
246 | #ifdef SNDRV_LITTLE_ENDIAN | 247 | #ifdef SNDRV_LITTLE_ENDIAN |
247 | #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE | 248 | #define SNDRV_PCM_FORMAT_S16 SNDRV_PCM_FORMAT_S16_LE |
diff --git a/sound/soc/amd/acp-pcm-dma.c b/sound/soc/amd/acp-pcm-dma.c index c33a512283a4..78d7b6238376 100644 --- a/sound/soc/amd/acp-pcm-dma.c +++ b/sound/soc/amd/acp-pcm-dma.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <drm/amd_asic_type.h> | 23 | #include <drm/amd_asic_type.h> |
24 | #include "acp.h" | 24 | #include "acp.h" |
25 | 25 | ||
26 | #define DRV_NAME "acp_audio_dma" | ||
27 | |||
26 | #define PLAYBACK_MIN_NUM_PERIODS 2 | 28 | #define PLAYBACK_MIN_NUM_PERIODS 2 |
27 | #define PLAYBACK_MAX_NUM_PERIODS 2 | 29 | #define PLAYBACK_MAX_NUM_PERIODS 2 |
28 | #define PLAYBACK_MAX_PERIOD_SIZE 16384 | 30 | #define PLAYBACK_MAX_PERIOD_SIZE 16384 |
@@ -702,8 +704,8 @@ static int acp_dma_open(struct snd_pcm_substream *substream) | |||
702 | int ret = 0; | 704 | int ret = 0; |
703 | struct snd_pcm_runtime *runtime = substream->runtime; | 705 | struct snd_pcm_runtime *runtime = substream->runtime; |
704 | struct snd_soc_pcm_runtime *prtd = substream->private_data; | 706 | struct snd_soc_pcm_runtime *prtd = substream->private_data; |
705 | struct audio_drv_data *intr_data = dev_get_drvdata(prtd->platform->dev); | 707 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); |
706 | 708 | struct audio_drv_data *intr_data = dev_get_drvdata(component->dev); | |
707 | struct audio_substream_data *adata = | 709 | struct audio_substream_data *adata = |
708 | kzalloc(sizeof(struct audio_substream_data), GFP_KERNEL); | 710 | kzalloc(sizeof(struct audio_substream_data), GFP_KERNEL); |
709 | if (adata == NULL) | 711 | if (adata == NULL) |
@@ -730,7 +732,7 @@ static int acp_dma_open(struct snd_pcm_substream *substream) | |||
730 | ret = snd_pcm_hw_constraint_integer(runtime, | 732 | ret = snd_pcm_hw_constraint_integer(runtime, |
731 | SNDRV_PCM_HW_PARAM_PERIODS); | 733 | SNDRV_PCM_HW_PARAM_PERIODS); |
732 | if (ret < 0) { | 734 | if (ret < 0) { |
733 | dev_err(prtd->platform->dev, "set integer constraint failed\n"); | 735 | dev_err(component->dev, "set integer constraint failed\n"); |
734 | kfree(adata); | 736 | kfree(adata); |
735 | return ret; | 737 | return ret; |
736 | } | 738 | } |
@@ -778,7 +780,8 @@ static int acp_dma_hw_params(struct snd_pcm_substream *substream, | |||
778 | struct snd_pcm_runtime *runtime; | 780 | struct snd_pcm_runtime *runtime; |
779 | struct audio_substream_data *rtd; | 781 | struct audio_substream_data *rtd; |
780 | struct snd_soc_pcm_runtime *prtd = substream->private_data; | 782 | struct snd_soc_pcm_runtime *prtd = substream->private_data; |
781 | struct audio_drv_data *adata = dev_get_drvdata(prtd->platform->dev); | 783 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); |
784 | struct audio_drv_data *adata = dev_get_drvdata(component->dev); | ||
782 | 785 | ||
783 | runtime = substream->runtime; | 786 | runtime = substream->runtime; |
784 | rtd = runtime->private_data; | 787 | rtd = runtime->private_data; |
@@ -907,6 +910,7 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) | |||
907 | struct snd_pcm_runtime *runtime = substream->runtime; | 910 | struct snd_pcm_runtime *runtime = substream->runtime; |
908 | struct snd_soc_pcm_runtime *prtd = substream->private_data; | 911 | struct snd_soc_pcm_runtime *prtd = substream->private_data; |
909 | struct audio_substream_data *rtd = runtime->private_data; | 912 | struct audio_substream_data *rtd = runtime->private_data; |
913 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); | ||
910 | 914 | ||
911 | if (!rtd) | 915 | if (!rtd) |
912 | return -EINVAL; | 916 | return -EINVAL; |
@@ -924,7 +928,7 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) | |||
924 | while (acp_reg_read(rtd->acp_mmio, mmACP_DMA_CH_STS) & | 928 | while (acp_reg_read(rtd->acp_mmio, mmACP_DMA_CH_STS) & |
925 | BIT(SYSRAM_TO_ACP_CH_NUM)) { | 929 | BIT(SYSRAM_TO_ACP_CH_NUM)) { |
926 | if (!loops--) { | 930 | if (!loops--) { |
927 | dev_err(prtd->platform->dev, | 931 | dev_err(component->dev, |
928 | "acp dma start timeout\n"); | 932 | "acp dma start timeout\n"); |
929 | return -ETIMEDOUT; | 933 | return -ETIMEDOUT; |
930 | } | 934 | } |
@@ -970,7 +974,8 @@ static int acp_dma_trigger(struct snd_pcm_substream *substream, int cmd) | |||
970 | static int acp_dma_new(struct snd_soc_pcm_runtime *rtd) | 974 | static int acp_dma_new(struct snd_soc_pcm_runtime *rtd) |
971 | { | 975 | { |
972 | int ret; | 976 | int ret; |
973 | struct audio_drv_data *adata = dev_get_drvdata(rtd->platform->dev); | 977 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
978 | struct audio_drv_data *adata = dev_get_drvdata(component->dev); | ||
974 | 979 | ||
975 | switch (adata->asic_type) { | 980 | switch (adata->asic_type) { |
976 | case CHIP_STONEY: | 981 | case CHIP_STONEY: |
@@ -987,7 +992,7 @@ static int acp_dma_new(struct snd_soc_pcm_runtime *rtd) | |||
987 | break; | 992 | break; |
988 | } | 993 | } |
989 | if (ret < 0) | 994 | if (ret < 0) |
990 | dev_err(rtd->platform->dev, | 995 | dev_err(component->dev, |
991 | "buffer preallocation failer error:%d\n", ret); | 996 | "buffer preallocation failer error:%d\n", ret); |
992 | return ret; | 997 | return ret; |
993 | } | 998 | } |
@@ -998,7 +1003,8 @@ static int acp_dma_close(struct snd_pcm_substream *substream) | |||
998 | struct snd_pcm_runtime *runtime = substream->runtime; | 1003 | struct snd_pcm_runtime *runtime = substream->runtime; |
999 | struct audio_substream_data *rtd = runtime->private_data; | 1004 | struct audio_substream_data *rtd = runtime->private_data; |
1000 | struct snd_soc_pcm_runtime *prtd = substream->private_data; | 1005 | struct snd_soc_pcm_runtime *prtd = substream->private_data; |
1001 | struct audio_drv_data *adata = dev_get_drvdata(prtd->platform->dev); | 1006 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(prtd, DRV_NAME); |
1007 | struct audio_drv_data *adata = dev_get_drvdata(component->dev); | ||
1002 | 1008 | ||
1003 | kfree(rtd); | 1009 | kfree(rtd); |
1004 | 1010 | ||
@@ -1044,7 +1050,8 @@ static const struct snd_pcm_ops acp_dma_ops = { | |||
1044 | .prepare = acp_dma_prepare, | 1050 | .prepare = acp_dma_prepare, |
1045 | }; | 1051 | }; |
1046 | 1052 | ||
1047 | static struct snd_soc_platform_driver acp_asoc_platform = { | 1053 | static struct snd_soc_component_driver acp_asoc_platform = { |
1054 | .name = DRV_NAME, | ||
1048 | .ops = &acp_dma_ops, | 1055 | .ops = &acp_dma_ops, |
1049 | .pcm_new = acp_dma_new, | 1056 | .pcm_new = acp_dma_new, |
1050 | }; | 1057 | }; |
@@ -1102,7 +1109,8 @@ static int acp_audio_probe(struct platform_device *pdev) | |||
1102 | return status; | 1109 | return status; |
1103 | } | 1110 | } |
1104 | 1111 | ||
1105 | status = snd_soc_register_platform(&pdev->dev, &acp_asoc_platform); | 1112 | status = devm_snd_soc_register_component(&pdev->dev, |
1113 | &acp_asoc_platform, NULL, 0); | ||
1106 | if (status != 0) { | 1114 | if (status != 0) { |
1107 | dev_err(&pdev->dev, "Fail to register ALSA platform device\n"); | 1115 | dev_err(&pdev->dev, "Fail to register ALSA platform device\n"); |
1108 | return status; | 1116 | return status; |
@@ -1123,7 +1131,6 @@ static int acp_audio_remove(struct platform_device *pdev) | |||
1123 | status = acp_deinit(adata->acp_mmio); | 1131 | status = acp_deinit(adata->acp_mmio); |
1124 | if (status) | 1132 | if (status) |
1125 | dev_err(&pdev->dev, "ACP Deinit failed status:%d\n", status); | 1133 | dev_err(&pdev->dev, "ACP Deinit failed status:%d\n", status); |
1126 | snd_soc_unregister_platform(&pdev->dev); | ||
1127 | pm_runtime_disable(&pdev->dev); | 1134 | pm_runtime_disable(&pdev->dev); |
1128 | 1135 | ||
1129 | return 0; | 1136 | return 0; |
diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c index ebabed69f0e6..6bc2b729495c 100644 --- a/sound/soc/atmel/atmel-classd.c +++ b/sound/soc/atmel/atmel-classd.c | |||
@@ -32,6 +32,7 @@ struct atmel_classd { | |||
32 | struct regmap *regmap; | 32 | struct regmap *regmap; |
33 | struct clk *pclk; | 33 | struct clk *pclk; |
34 | struct clk *gclk; | 34 | struct clk *gclk; |
35 | struct device *dev; | ||
35 | int irq; | 36 | int irq; |
36 | const struct atmel_classd_pdata *pdata; | 37 | const struct atmel_classd_pdata *pdata; |
37 | }; | 38 | }; |
@@ -165,7 +166,7 @@ atmel_classd_platform_configure_dma(struct snd_pcm_substream *substream, | |||
165 | struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card); | 166 | struct atmel_classd *dd = snd_soc_card_get_drvdata(rtd->card); |
166 | 167 | ||
167 | if (params_physical_width(params) != 16) { | 168 | if (params_physical_width(params) != 16) { |
168 | dev_err(rtd->platform->dev, | 169 | dev_err(dd->dev, |
169 | "only supports 16-bit audio data\n"); | 170 | "only supports 16-bit audio data\n"); |
170 | return -EINVAL; | 171 | return -EINVAL; |
171 | } | 172 | } |
@@ -587,6 +588,7 @@ static int atmel_classd_probe(struct platform_device *pdev) | |||
587 | } | 588 | } |
588 | 589 | ||
589 | dd->phy_base = res->start; | 590 | dd->phy_base = res->start; |
591 | dd->dev = dev; | ||
590 | 592 | ||
591 | dd->regmap = devm_regmap_init_mmio(dev, io_base, | 593 | dd->regmap = devm_regmap_init_mmio(dev, io_base, |
592 | &atmel_classd_regmap_config); | 594 | &atmel_classd_regmap_config); |
diff --git a/sound/soc/atmel/atmel-pcm-pdc.c b/sound/soc/atmel/atmel-pcm-pdc.c index 91b7069c3499..99ca23d527c9 100644 --- a/sound/soc/atmel/atmel-pcm-pdc.c +++ b/sound/soc/atmel/atmel-pcm-pdc.c | |||
@@ -393,7 +393,7 @@ static const struct snd_pcm_ops atmel_pcm_ops = { | |||
393 | .mmap = atmel_pcm_mmap, | 393 | .mmap = atmel_pcm_mmap, |
394 | }; | 394 | }; |
395 | 395 | ||
396 | static struct snd_soc_platform_driver atmel_soc_platform = { | 396 | static struct snd_soc_component_driver atmel_soc_platform = { |
397 | .ops = &atmel_pcm_ops, | 397 | .ops = &atmel_pcm_ops, |
398 | .pcm_new = atmel_pcm_new, | 398 | .pcm_new = atmel_pcm_new, |
399 | .pcm_free = atmel_pcm_free, | 399 | .pcm_free = atmel_pcm_free, |
@@ -401,13 +401,13 @@ static struct snd_soc_platform_driver atmel_soc_platform = { | |||
401 | 401 | ||
402 | int atmel_pcm_pdc_platform_register(struct device *dev) | 402 | int atmel_pcm_pdc_platform_register(struct device *dev) |
403 | { | 403 | { |
404 | return snd_soc_register_platform(dev, &atmel_soc_platform); | 404 | return devm_snd_soc_register_component(dev, &atmel_soc_platform, |
405 | NULL, 0); | ||
405 | } | 406 | } |
406 | EXPORT_SYMBOL(atmel_pcm_pdc_platform_register); | 407 | EXPORT_SYMBOL(atmel_pcm_pdc_platform_register); |
407 | 408 | ||
408 | void atmel_pcm_pdc_platform_unregister(struct device *dev) | 409 | void atmel_pcm_pdc_platform_unregister(struct device *dev) |
409 | { | 410 | { |
410 | snd_soc_unregister_platform(dev); | ||
411 | } | 411 | } |
412 | EXPORT_SYMBOL(atmel_pcm_pdc_platform_unregister); | 412 | EXPORT_SYMBOL(atmel_pcm_pdc_platform_unregister); |
413 | 413 | ||
diff --git a/sound/soc/atmel/atmel-pdmic.c b/sound/soc/atmel/atmel-pdmic.c index 8e3d34be9e69..4eea738c1047 100644 --- a/sound/soc/atmel/atmel-pdmic.c +++ b/sound/soc/atmel/atmel-pdmic.c | |||
@@ -32,6 +32,7 @@ struct atmel_pdmic { | |||
32 | struct regmap *regmap; | 32 | struct regmap *regmap; |
33 | struct clk *pclk; | 33 | struct clk *pclk; |
34 | struct clk *gclk; | 34 | struct clk *gclk; |
35 | struct device *dev; | ||
35 | int irq; | 36 | int irq; |
36 | struct snd_pcm_substream *substream; | 37 | struct snd_pcm_substream *substream; |
37 | const struct atmel_pdmic_pdata *pdata; | 38 | const struct atmel_pdmic_pdata *pdata; |
@@ -206,7 +207,7 @@ atmel_pdmic_platform_configure_dma(struct snd_pcm_substream *substream, | |||
206 | ret = snd_hwparams_to_dma_slave_config(substream, params, | 207 | ret = snd_hwparams_to_dma_slave_config(substream, params, |
207 | slave_config); | 208 | slave_config); |
208 | if (ret) { | 209 | if (ret) { |
209 | dev_err(rtd->platform->dev, | 210 | dev_err(dd->dev, |
210 | "hw params to dma slave configure failed\n"); | 211 | "hw params to dma slave configure failed\n"); |
211 | return ret; | 212 | return ret; |
212 | } | 213 | } |
@@ -596,6 +597,7 @@ static int atmel_pdmic_probe(struct platform_device *pdev) | |||
596 | return -ENOMEM; | 597 | return -ENOMEM; |
597 | 598 | ||
598 | dd->pdata = pdata; | 599 | dd->pdata = pdata; |
600 | dd->dev = dev; | ||
599 | 601 | ||
600 | dd->irq = platform_get_irq(pdev, 0); | 602 | dd->irq = platform_get_irq(pdev, 0); |
601 | if (dd->irq < 0) { | 603 | if (dd->irq < 0) { |
diff --git a/sound/soc/au1x/dbdma2.c b/sound/soc/au1x/dbdma2.c index 6a035ca0f521..fb650659c3a3 100644 --- a/sound/soc/au1x/dbdma2.c +++ b/sound/soc/au1x/dbdma2.c | |||
@@ -32,6 +32,8 @@ | |||
32 | 32 | ||
33 | /*#define PCM_DEBUG*/ | 33 | /*#define PCM_DEBUG*/ |
34 | 34 | ||
35 | #define DRV_NAME "dbdma2" | ||
36 | |||
35 | #define MSG(x...) printk(KERN_INFO "au1xpsc_pcm: " x) | 37 | #define MSG(x...) printk(KERN_INFO "au1xpsc_pcm: " x) |
36 | #ifdef PCM_DEBUG | 38 | #ifdef PCM_DEBUG |
37 | #define DBG MSG | 39 | #define DBG MSG |
@@ -187,8 +189,8 @@ out: | |||
187 | static inline struct au1xpsc_audio_dmadata *to_dmadata(struct snd_pcm_substream *ss) | 189 | static inline struct au1xpsc_audio_dmadata *to_dmadata(struct snd_pcm_substream *ss) |
188 | { | 190 | { |
189 | struct snd_soc_pcm_runtime *rtd = ss->private_data; | 191 | struct snd_soc_pcm_runtime *rtd = ss->private_data; |
190 | struct au1xpsc_audio_dmadata *pcd = | 192 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
191 | snd_soc_platform_get_drvdata(rtd->platform); | 193 | struct au1xpsc_audio_dmadata *pcd = snd_soc_component_get_drvdata(component); |
192 | return &pcd[ss->stream]; | 194 | return &pcd[ss->stream]; |
193 | } | 195 | } |
194 | 196 | ||
@@ -327,7 +329,8 @@ static int au1xpsc_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
327 | } | 329 | } |
328 | 330 | ||
329 | /* au1xpsc audio platform */ | 331 | /* au1xpsc audio platform */ |
330 | static struct snd_soc_platform_driver au1xpsc_soc_platform = { | 332 | static struct snd_soc_component_driver au1xpsc_soc_component = { |
333 | .name = DRV_NAME, | ||
331 | .ops = &au1xpsc_pcm_ops, | 334 | .ops = &au1xpsc_pcm_ops, |
332 | .pcm_new = au1xpsc_pcm_new, | 335 | .pcm_new = au1xpsc_pcm_new, |
333 | }; | 336 | }; |
@@ -344,8 +347,8 @@ static int au1xpsc_pcm_drvprobe(struct platform_device *pdev) | |||
344 | 347 | ||
345 | platform_set_drvdata(pdev, dmadata); | 348 | platform_set_drvdata(pdev, dmadata); |
346 | 349 | ||
347 | return devm_snd_soc_register_platform(&pdev->dev, | 350 | return devm_snd_soc_register_component(&pdev->dev, |
348 | &au1xpsc_soc_platform); | 351 | &au1xpsc_soc_component, NULL, 0); |
349 | } | 352 | } |
350 | 353 | ||
351 | static struct platform_driver au1xpsc_pcm_driver = { | 354 | static struct platform_driver au1xpsc_pcm_driver = { |
diff --git a/sound/soc/au1x/dma.c b/sound/soc/au1x/dma.c index 19457e2b351e..efff1e293a1b 100644 --- a/sound/soc/au1x/dma.c +++ b/sound/soc/au1x/dma.c | |||
@@ -21,6 +21,8 @@ | |||
21 | 21 | ||
22 | #include "psc.h" | 22 | #include "psc.h" |
23 | 23 | ||
24 | #define DRV_NAME "au1x_dma" | ||
25 | |||
24 | struct pcm_period { | 26 | struct pcm_period { |
25 | u32 start; | 27 | u32 start; |
26 | u32 relative_end; /* relative to start of buffer */ | 28 | u32 relative_end; /* relative to start of buffer */ |
@@ -174,7 +176,8 @@ static const struct snd_pcm_hardware alchemy_pcm_hardware = { | |||
174 | static inline struct alchemy_pcm_ctx *ss_to_ctx(struct snd_pcm_substream *ss) | 176 | static inline struct alchemy_pcm_ctx *ss_to_ctx(struct snd_pcm_substream *ss) |
175 | { | 177 | { |
176 | struct snd_soc_pcm_runtime *rtd = ss->private_data; | 178 | struct snd_soc_pcm_runtime *rtd = ss->private_data; |
177 | return snd_soc_platform_get_drvdata(rtd->platform); | 179 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
180 | return snd_soc_component_get_drvdata(component); | ||
178 | } | 181 | } |
179 | 182 | ||
180 | static inline struct audio_stream *ss_to_as(struct snd_pcm_substream *ss) | 183 | static inline struct audio_stream *ss_to_as(struct snd_pcm_substream *ss) |
@@ -297,7 +300,8 @@ static int alchemy_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
297 | return 0; | 300 | return 0; |
298 | } | 301 | } |
299 | 302 | ||
300 | static struct snd_soc_platform_driver alchemy_pcm_soc_platform = { | 303 | static struct snd_soc_component_driver alchemy_pcm_soc_component = { |
304 | .name = DRV_NAME, | ||
301 | .ops = &alchemy_pcm_ops, | 305 | .ops = &alchemy_pcm_ops, |
302 | .pcm_new = alchemy_pcm_new, | 306 | .pcm_new = alchemy_pcm_new, |
303 | }; | 307 | }; |
@@ -312,8 +316,8 @@ static int alchemy_pcm_drvprobe(struct platform_device *pdev) | |||
312 | 316 | ||
313 | platform_set_drvdata(pdev, ctx); | 317 | platform_set_drvdata(pdev, ctx); |
314 | 318 | ||
315 | return devm_snd_soc_register_platform(&pdev->dev, | 319 | return devm_snd_soc_register_component(&pdev->dev, |
316 | &alchemy_pcm_soc_platform); | 320 | &alchemy_pcm_soc_component, NULL, 0); |
317 | } | 321 | } |
318 | 322 | ||
319 | static struct platform_driver alchemy_pcmdma_driver = { | 323 | static struct platform_driver alchemy_pcmdma_driver = { |
diff --git a/sound/soc/bcm/cygnus-pcm.c b/sound/soc/bcm/cygnus-pcm.c index d616e096462e..123ecf5479d7 100644 --- a/sound/soc/bcm/cygnus-pcm.c +++ b/sound/soc/bcm/cygnus-pcm.c | |||
@@ -820,7 +820,7 @@ static int cygnus_dma_new(struct snd_soc_pcm_runtime *rtd) | |||
820 | return 0; | 820 | return 0; |
821 | } | 821 | } |
822 | 822 | ||
823 | static struct snd_soc_platform_driver cygnus_soc_platform = { | 823 | static struct snd_soc_component_driver cygnus_soc_platform = { |
824 | .ops = &cygnus_pcm_ops, | 824 | .ops = &cygnus_pcm_ops, |
825 | .pcm_new = cygnus_dma_new, | 825 | .pcm_new = cygnus_dma_new, |
826 | .pcm_free = cygnus_dma_free_dma_buffers, | 826 | .pcm_free = cygnus_dma_free_dma_buffers, |
@@ -840,7 +840,8 @@ int cygnus_soc_platform_register(struct device *dev, | |||
840 | return rc; | 840 | return rc; |
841 | } | 841 | } |
842 | 842 | ||
843 | rc = snd_soc_register_platform(dev, &cygnus_soc_platform); | 843 | rc = devm_snd_soc_register_component(dev, &cygnus_soc_platform, |
844 | NULL, 0); | ||
844 | if (rc) { | 845 | if (rc) { |
845 | dev_err(dev, "%s failed\n", __func__); | 846 | dev_err(dev, "%s failed\n", __func__); |
846 | return rc; | 847 | return rc; |
@@ -851,8 +852,6 @@ int cygnus_soc_platform_register(struct device *dev, | |||
851 | 852 | ||
852 | int cygnus_soc_platform_unregister(struct device *dev) | 853 | int cygnus_soc_platform_unregister(struct device *dev) |
853 | { | 854 | { |
854 | snd_soc_unregister_platform(dev); | ||
855 | |||
856 | return 0; | 855 | return 0; |
857 | } | 856 | } |
858 | 857 | ||
diff --git a/sound/soc/blackfin/bf5xx-ac97-pcm.c b/sound/soc/blackfin/bf5xx-ac97-pcm.c index 8c1d1983b8f9..08bceb519c29 100644 --- a/sound/soc/blackfin/bf5xx-ac97-pcm.c +++ b/sound/soc/blackfin/bf5xx-ac97-pcm.c | |||
@@ -453,7 +453,7 @@ static int bf5xx_pcm_ac97_new(struct snd_soc_pcm_runtime *rtd) | |||
453 | return ret; | 453 | return ret; |
454 | } | 454 | } |
455 | 455 | ||
456 | static struct snd_soc_platform_driver bf5xx_ac97_soc_platform = { | 456 | static struct snd_soc_component_driver bf5xx_ac97_soc_component = { |
457 | .ops = &bf5xx_pcm_ac97_ops, | 457 | .ops = &bf5xx_pcm_ac97_ops, |
458 | .pcm_new = bf5xx_pcm_ac97_new, | 458 | .pcm_new = bf5xx_pcm_ac97_new, |
459 | .pcm_free = bf5xx_pcm_free_dma_buffers, | 459 | .pcm_free = bf5xx_pcm_free_dma_buffers, |
@@ -461,8 +461,8 @@ static struct snd_soc_platform_driver bf5xx_ac97_soc_platform = { | |||
461 | 461 | ||
462 | static int bf5xx_soc_platform_probe(struct platform_device *pdev) | 462 | static int bf5xx_soc_platform_probe(struct platform_device *pdev) |
463 | { | 463 | { |
464 | return devm_snd_soc_register_platform(&pdev->dev, | 464 | return devm_snd_soc_register_component(&pdev->dev, |
465 | &bf5xx_ac97_soc_platform); | 465 | &bf5xx_ac97_soc_component, NULL, 0); |
466 | } | 466 | } |
467 | 467 | ||
468 | static struct platform_driver bf5xx_pcm_driver = { | 468 | static struct platform_driver bf5xx_pcm_driver = { |
diff --git a/sound/soc/blackfin/bf5xx-i2s-pcm.c b/sound/soc/blackfin/bf5xx-i2s-pcm.c index 51cae76f14e6..6712b01dabd1 100644 --- a/sound/soc/blackfin/bf5xx-i2s-pcm.c +++ b/sound/soc/blackfin/bf5xx-i2s-pcm.c | |||
@@ -347,15 +347,15 @@ static int bf5xx_pcm_i2s_new(struct snd_soc_pcm_runtime *rtd) | |||
347 | SNDRV_DMA_TYPE_DEV, card->dev, size, size); | 347 | SNDRV_DMA_TYPE_DEV, card->dev, size, size); |
348 | } | 348 | } |
349 | 349 | ||
350 | static struct snd_soc_platform_driver bf5xx_i2s_soc_platform = { | 350 | static struct snd_soc_component_driver bf5xx_i2s_soc_component = { |
351 | .ops = &bf5xx_pcm_i2s_ops, | 351 | .ops = &bf5xx_pcm_i2s_ops, |
352 | .pcm_new = bf5xx_pcm_i2s_new, | 352 | .pcm_new = bf5xx_pcm_i2s_new, |
353 | }; | 353 | }; |
354 | 354 | ||
355 | static int bfin_i2s_soc_platform_probe(struct platform_device *pdev) | 355 | static int bfin_i2s_soc_platform_probe(struct platform_device *pdev) |
356 | { | 356 | { |
357 | return devm_snd_soc_register_platform(&pdev->dev, | 357 | return devm_snd_soc_register_component(&pdev->dev, |
358 | &bf5xx_i2s_soc_platform); | 358 | &bf5xx_i2s_soc_component, NULL, 0); |
359 | } | 359 | } |
360 | 360 | ||
361 | static struct platform_driver bfin_i2s_pcm_driver = { | 361 | static struct platform_driver bfin_i2s_pcm_driver = { |
diff --git a/sound/soc/codecs/cs47l24.c b/sound/soc/codecs/cs47l24.c index be2750680838..3f34de5f800e 100644 --- a/sound/soc/codecs/cs47l24.c +++ b/sound/soc/codecs/cs47l24.c | |||
@@ -33,6 +33,8 @@ | |||
33 | #include "wm_adsp.h" | 33 | #include "wm_adsp.h" |
34 | #include "cs47l24.h" | 34 | #include "cs47l24.h" |
35 | 35 | ||
36 | #define DRV_NAME "cs47l24-codec" | ||
37 | |||
36 | struct cs47l24_priv { | 38 | struct cs47l24_priv { |
37 | struct arizona_priv core; | 39 | struct arizona_priv core; |
38 | struct arizona_fll fll[2]; | 40 | struct arizona_fll fll[2]; |
@@ -1069,7 +1071,8 @@ static struct snd_soc_dai_driver cs47l24_dai[] = { | |||
1069 | static int cs47l24_open(struct snd_compr_stream *stream) | 1071 | static int cs47l24_open(struct snd_compr_stream *stream) |
1070 | { | 1072 | { |
1071 | struct snd_soc_pcm_runtime *rtd = stream->private_data; | 1073 | struct snd_soc_pcm_runtime *rtd = stream->private_data; |
1072 | struct cs47l24_priv *priv = snd_soc_platform_get_drvdata(rtd->platform); | 1074 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
1075 | struct cs47l24_priv *priv = snd_soc_component_get_drvdata(component); | ||
1073 | struct arizona *arizona = priv->core.arizona; | 1076 | struct arizona *arizona = priv->core.arizona; |
1074 | int n_adsp; | 1077 | int n_adsp; |
1075 | 1078 | ||
@@ -1177,6 +1180,16 @@ static unsigned int cs47l24_digital_vu[] = { | |||
1177 | ARIZONA_DAC_DIGITAL_VOLUME_4L, | 1180 | ARIZONA_DAC_DIGITAL_VOLUME_4L, |
1178 | }; | 1181 | }; |
1179 | 1182 | ||
1183 | static struct snd_compr_ops cs47l24_compr_ops = { | ||
1184 | .open = cs47l24_open, | ||
1185 | .free = wm_adsp_compr_free, | ||
1186 | .set_params = wm_adsp_compr_set_params, | ||
1187 | .get_caps = wm_adsp_compr_get_caps, | ||
1188 | .trigger = wm_adsp_compr_trigger, | ||
1189 | .pointer = wm_adsp_compr_pointer, | ||
1190 | .copy = wm_adsp_compr_copy, | ||
1191 | }; | ||
1192 | |||
1180 | static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = { | 1193 | static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = { |
1181 | .probe = cs47l24_codec_probe, | 1194 | .probe = cs47l24_codec_probe, |
1182 | .remove = cs47l24_codec_remove, | 1195 | .remove = cs47l24_codec_remove, |
@@ -1187,6 +1200,8 @@ static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = { | |||
1187 | .set_pll = cs47l24_set_fll, | 1200 | .set_pll = cs47l24_set_fll, |
1188 | 1201 | ||
1189 | .component_driver = { | 1202 | .component_driver = { |
1203 | .name = DRV_NAME, | ||
1204 | .compr_ops = &cs47l24_compr_ops, | ||
1190 | .controls = cs47l24_snd_controls, | 1205 | .controls = cs47l24_snd_controls, |
1191 | .num_controls = ARRAY_SIZE(cs47l24_snd_controls), | 1206 | .num_controls = ARRAY_SIZE(cs47l24_snd_controls), |
1192 | .dapm_widgets = cs47l24_dapm_widgets, | 1207 | .dapm_widgets = cs47l24_dapm_widgets, |
@@ -1196,20 +1211,6 @@ static const struct snd_soc_codec_driver soc_codec_dev_cs47l24 = { | |||
1196 | }, | 1211 | }, |
1197 | }; | 1212 | }; |
1198 | 1213 | ||
1199 | static const struct snd_compr_ops cs47l24_compr_ops = { | ||
1200 | .open = cs47l24_open, | ||
1201 | .free = wm_adsp_compr_free, | ||
1202 | .set_params = wm_adsp_compr_set_params, | ||
1203 | .get_caps = wm_adsp_compr_get_caps, | ||
1204 | .trigger = wm_adsp_compr_trigger, | ||
1205 | .pointer = wm_adsp_compr_pointer, | ||
1206 | .copy = wm_adsp_compr_copy, | ||
1207 | }; | ||
1208 | |||
1209 | static const struct snd_soc_platform_driver cs47l24_compr_platform = { | ||
1210 | .compr_ops = &cs47l24_compr_ops, | ||
1211 | }; | ||
1212 | |||
1213 | static int cs47l24_probe(struct platform_device *pdev) | 1214 | static int cs47l24_probe(struct platform_device *pdev) |
1214 | { | 1215 | { |
1215 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); | 1216 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); |
@@ -1298,23 +1299,15 @@ static int cs47l24_probe(struct platform_device *pdev) | |||
1298 | if (ret < 0) | 1299 | if (ret < 0) |
1299 | goto err_dsp_irq; | 1300 | goto err_dsp_irq; |
1300 | 1301 | ||
1301 | ret = snd_soc_register_platform(&pdev->dev, &cs47l24_compr_platform); | ||
1302 | if (ret < 0) { | ||
1303 | dev_err(&pdev->dev, "Failed to register platform: %d\n", ret); | ||
1304 | goto err_spk_irqs; | ||
1305 | } | ||
1306 | |||
1307 | ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_cs47l24, | 1302 | ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_cs47l24, |
1308 | cs47l24_dai, ARRAY_SIZE(cs47l24_dai)); | 1303 | cs47l24_dai, ARRAY_SIZE(cs47l24_dai)); |
1309 | if (ret < 0) { | 1304 | if (ret < 0) { |
1310 | dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); | 1305 | dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); |
1311 | goto err_platform; | 1306 | goto err_spk_irqs; |
1312 | } | 1307 | } |
1313 | 1308 | ||
1314 | return ret; | 1309 | return ret; |
1315 | 1310 | ||
1316 | err_platform: | ||
1317 | snd_soc_unregister_platform(&pdev->dev); | ||
1318 | err_spk_irqs: | 1311 | err_spk_irqs: |
1319 | arizona_free_spk_irqs(arizona); | 1312 | arizona_free_spk_irqs(arizona); |
1320 | err_dsp_irq: | 1313 | err_dsp_irq: |
@@ -1328,7 +1321,6 @@ static int cs47l24_remove(struct platform_device *pdev) | |||
1328 | struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev); | 1321 | struct cs47l24_priv *cs47l24 = platform_get_drvdata(pdev); |
1329 | struct arizona *arizona = cs47l24->core.arizona; | 1322 | struct arizona *arizona = cs47l24->core.arizona; |
1330 | 1323 | ||
1331 | snd_soc_unregister_platform(&pdev->dev); | ||
1332 | snd_soc_unregister_codec(&pdev->dev); | 1324 | snd_soc_unregister_codec(&pdev->dev); |
1333 | pm_runtime_disable(&pdev->dev); | 1325 | pm_runtime_disable(&pdev->dev); |
1334 | 1326 | ||
diff --git a/sound/soc/codecs/rt5514-spi.c b/sound/soc/codecs/rt5514-spi.c index 2144edca97b0..84184d90385b 100644 --- a/sound/soc/codecs/rt5514-spi.c +++ b/sound/soc/codecs/rt5514-spi.c | |||
@@ -35,6 +35,8 @@ | |||
35 | 35 | ||
36 | #include "rt5514-spi.h" | 36 | #include "rt5514-spi.h" |
37 | 37 | ||
38 | #define DRV_NAME "rt5514-spi" | ||
39 | |||
38 | static struct spi_device *rt5514_spi; | 40 | static struct spi_device *rt5514_spi; |
39 | 41 | ||
40 | struct rt5514_dsp { | 42 | struct rt5514_dsp { |
@@ -211,8 +213,9 @@ static int rt5514_spi_hw_params(struct snd_pcm_substream *substream, | |||
211 | struct snd_pcm_hw_params *hw_params) | 213 | struct snd_pcm_hw_params *hw_params) |
212 | { | 214 | { |
213 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 215 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
216 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); | ||
214 | struct rt5514_dsp *rt5514_dsp = | 217 | struct rt5514_dsp *rt5514_dsp = |
215 | snd_soc_platform_get_drvdata(rtd->platform); | 218 | snd_soc_component_get_drvdata(component); |
216 | int ret; | 219 | int ret; |
217 | u8 buf[8]; | 220 | u8 buf[8]; |
218 | 221 | ||
@@ -235,8 +238,9 @@ static int rt5514_spi_hw_params(struct snd_pcm_substream *substream, | |||
235 | static int rt5514_spi_hw_free(struct snd_pcm_substream *substream) | 238 | static int rt5514_spi_hw_free(struct snd_pcm_substream *substream) |
236 | { | 239 | { |
237 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 240 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
241 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); | ||
238 | struct rt5514_dsp *rt5514_dsp = | 242 | struct rt5514_dsp *rt5514_dsp = |
239 | snd_soc_platform_get_drvdata(rtd->platform); | 243 | snd_soc_component_get_drvdata(component); |
240 | 244 | ||
241 | mutex_lock(&rt5514_dsp->dma_lock); | 245 | mutex_lock(&rt5514_dsp->dma_lock); |
242 | rt5514_dsp->substream = NULL; | 246 | rt5514_dsp->substream = NULL; |
@@ -252,8 +256,9 @@ static snd_pcm_uframes_t rt5514_spi_pcm_pointer( | |||
252 | { | 256 | { |
253 | struct snd_pcm_runtime *runtime = substream->runtime; | 257 | struct snd_pcm_runtime *runtime = substream->runtime; |
254 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 258 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
259 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); | ||
255 | struct rt5514_dsp *rt5514_dsp = | 260 | struct rt5514_dsp *rt5514_dsp = |
256 | snd_soc_platform_get_drvdata(rtd->platform); | 261 | snd_soc_component_get_drvdata(component); |
257 | 262 | ||
258 | return bytes_to_frames(runtime, rt5514_dsp->dma_offset); | 263 | return bytes_to_frames(runtime, rt5514_dsp->dma_offset); |
259 | } | 264 | } |
@@ -267,18 +272,18 @@ static const struct snd_pcm_ops rt5514_spi_pcm_ops = { | |||
267 | .page = snd_pcm_lib_get_vmalloc_page, | 272 | .page = snd_pcm_lib_get_vmalloc_page, |
268 | }; | 273 | }; |
269 | 274 | ||
270 | static int rt5514_spi_pcm_probe(struct snd_soc_platform *platform) | 275 | static int rt5514_spi_pcm_probe(struct snd_soc_component *component) |
271 | { | 276 | { |
272 | struct rt5514_dsp *rt5514_dsp; | 277 | struct rt5514_dsp *rt5514_dsp; |
273 | int ret; | 278 | int ret; |
274 | 279 | ||
275 | rt5514_dsp = devm_kzalloc(platform->dev, sizeof(*rt5514_dsp), | 280 | rt5514_dsp = devm_kzalloc(component->dev, sizeof(*rt5514_dsp), |
276 | GFP_KERNEL); | 281 | GFP_KERNEL); |
277 | 282 | ||
278 | rt5514_dsp->dev = &rt5514_spi->dev; | 283 | rt5514_dsp->dev = &rt5514_spi->dev; |
279 | mutex_init(&rt5514_dsp->dma_lock); | 284 | mutex_init(&rt5514_dsp->dma_lock); |
280 | INIT_DELAYED_WORK(&rt5514_dsp->copy_work, rt5514_spi_copy_work); | 285 | INIT_DELAYED_WORK(&rt5514_dsp->copy_work, rt5514_spi_copy_work); |
281 | snd_soc_platform_set_drvdata(platform, rt5514_dsp); | 286 | snd_soc_component_set_drvdata(component, rt5514_dsp); |
282 | 287 | ||
283 | if (rt5514_spi->irq) { | 288 | if (rt5514_spi->irq) { |
284 | ret = devm_request_threaded_irq(&rt5514_spi->dev, | 289 | ret = devm_request_threaded_irq(&rt5514_spi->dev, |
@@ -296,15 +301,12 @@ static int rt5514_spi_pcm_probe(struct snd_soc_platform *platform) | |||
296 | return 0; | 301 | return 0; |
297 | } | 302 | } |
298 | 303 | ||
299 | static const struct snd_soc_platform_driver rt5514_spi_platform = { | 304 | static const struct snd_soc_component_driver rt5514_spi_component = { |
305 | .name = DRV_NAME, | ||
300 | .probe = rt5514_spi_pcm_probe, | 306 | .probe = rt5514_spi_pcm_probe, |
301 | .ops = &rt5514_spi_pcm_ops, | 307 | .ops = &rt5514_spi_pcm_ops, |
302 | }; | 308 | }; |
303 | 309 | ||
304 | static const struct snd_soc_component_driver rt5514_spi_dai_component = { | ||
305 | .name = "rt5514-spi-dai", | ||
306 | }; | ||
307 | |||
308 | /** | 310 | /** |
309 | * rt5514_spi_burst_read - Read data from SPI by rt5514 address. | 311 | * rt5514_spi_burst_read - Read data from SPI by rt5514 address. |
310 | * @addr: Start address. | 312 | * @addr: Start address. |
@@ -445,14 +447,8 @@ static int rt5514_spi_probe(struct spi_device *spi) | |||
445 | 447 | ||
446 | rt5514_spi = spi; | 448 | rt5514_spi = spi; |
447 | 449 | ||
448 | ret = devm_snd_soc_register_platform(&spi->dev, &rt5514_spi_platform); | ||
449 | if (ret < 0) { | ||
450 | dev_err(&spi->dev, "Failed to register platform.\n"); | ||
451 | return ret; | ||
452 | } | ||
453 | |||
454 | ret = devm_snd_soc_register_component(&spi->dev, | 450 | ret = devm_snd_soc_register_component(&spi->dev, |
455 | &rt5514_spi_dai_component, | 451 | &rt5514_spi_component, |
456 | &rt5514_spi_dai, 1); | 452 | &rt5514_spi_dai, 1); |
457 | if (ret < 0) { | 453 | if (ret < 0) { |
458 | dev_err(&spi->dev, "Failed to register component.\n"); | 454 | dev_err(&spi->dev, "Failed to register component.\n"); |
diff --git a/sound/soc/codecs/wm5102.c b/sound/soc/codecs/wm5102.c index fc066caa1918..a568050090ad 100644 --- a/sound/soc/codecs/wm5102.c +++ b/sound/soc/codecs/wm5102.c | |||
@@ -34,6 +34,8 @@ | |||
34 | #include "wm5102.h" | 34 | #include "wm5102.h" |
35 | #include "wm_adsp.h" | 35 | #include "wm_adsp.h" |
36 | 36 | ||
37 | #define DRV_NAME "wm5102-codec" | ||
38 | |||
37 | struct wm5102_priv { | 39 | struct wm5102_priv { |
38 | struct arizona_priv core; | 40 | struct arizona_priv core; |
39 | struct arizona_fll fll[2]; | 41 | struct arizona_fll fll[2]; |
@@ -1910,7 +1912,8 @@ static struct snd_soc_dai_driver wm5102_dai[] = { | |||
1910 | static int wm5102_open(struct snd_compr_stream *stream) | 1912 | static int wm5102_open(struct snd_compr_stream *stream) |
1911 | { | 1913 | { |
1912 | struct snd_soc_pcm_runtime *rtd = stream->private_data; | 1914 | struct snd_soc_pcm_runtime *rtd = stream->private_data; |
1913 | struct wm5102_priv *priv = snd_soc_platform_get_drvdata(rtd->platform); | 1915 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
1916 | struct wm5102_priv *priv = snd_soc_component_get_drvdata(component); | ||
1914 | 1917 | ||
1915 | return wm_adsp_compr_open(&priv->core.adsp[0], stream); | 1918 | return wm_adsp_compr_open(&priv->core.adsp[0], stream); |
1916 | } | 1919 | } |
@@ -1992,6 +1995,16 @@ static unsigned int wm5102_digital_vu[] = { | |||
1992 | ARIZONA_DAC_DIGITAL_VOLUME_5R, | 1995 | ARIZONA_DAC_DIGITAL_VOLUME_5R, |
1993 | }; | 1996 | }; |
1994 | 1997 | ||
1998 | static struct snd_compr_ops wm5102_compr_ops = { | ||
1999 | .open = wm5102_open, | ||
2000 | .free = wm_adsp_compr_free, | ||
2001 | .set_params = wm_adsp_compr_set_params, | ||
2002 | .get_caps = wm_adsp_compr_get_caps, | ||
2003 | .trigger = wm_adsp_compr_trigger, | ||
2004 | .pointer = wm_adsp_compr_pointer, | ||
2005 | .copy = wm_adsp_compr_copy, | ||
2006 | }; | ||
2007 | |||
1995 | static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = { | 2008 | static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = { |
1996 | .probe = wm5102_codec_probe, | 2009 | .probe = wm5102_codec_probe, |
1997 | .remove = wm5102_codec_remove, | 2010 | .remove = wm5102_codec_remove, |
@@ -2002,6 +2015,8 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = { | |||
2002 | .set_pll = wm5102_set_fll, | 2015 | .set_pll = wm5102_set_fll, |
2003 | 2016 | ||
2004 | .component_driver = { | 2017 | .component_driver = { |
2018 | .name = DRV_NAME, | ||
2019 | .compr_ops = &wm5102_compr_ops, | ||
2005 | .controls = wm5102_snd_controls, | 2020 | .controls = wm5102_snd_controls, |
2006 | .num_controls = ARRAY_SIZE(wm5102_snd_controls), | 2021 | .num_controls = ARRAY_SIZE(wm5102_snd_controls), |
2007 | .dapm_widgets = wm5102_dapm_widgets, | 2022 | .dapm_widgets = wm5102_dapm_widgets, |
@@ -2011,20 +2026,6 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5102 = { | |||
2011 | }, | 2026 | }, |
2012 | }; | 2027 | }; |
2013 | 2028 | ||
2014 | static const struct snd_compr_ops wm5102_compr_ops = { | ||
2015 | .open = wm5102_open, | ||
2016 | .free = wm_adsp_compr_free, | ||
2017 | .set_params = wm_adsp_compr_set_params, | ||
2018 | .get_caps = wm_adsp_compr_get_caps, | ||
2019 | .trigger = wm_adsp_compr_trigger, | ||
2020 | .pointer = wm_adsp_compr_pointer, | ||
2021 | .copy = wm_adsp_compr_copy, | ||
2022 | }; | ||
2023 | |||
2024 | static const struct snd_soc_platform_driver wm5102_compr_platform = { | ||
2025 | .compr_ops = &wm5102_compr_ops, | ||
2026 | }; | ||
2027 | |||
2028 | static int wm5102_probe(struct platform_device *pdev) | 2029 | static int wm5102_probe(struct platform_device *pdev) |
2029 | { | 2030 | { |
2030 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); | 2031 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); |
@@ -2109,23 +2110,15 @@ static int wm5102_probe(struct platform_device *pdev) | |||
2109 | if (ret < 0) | 2110 | if (ret < 0) |
2110 | goto err_dsp_irq; | 2111 | goto err_dsp_irq; |
2111 | 2112 | ||
2112 | ret = snd_soc_register_platform(&pdev->dev, &wm5102_compr_platform); | ||
2113 | if (ret < 0) { | ||
2114 | dev_err(&pdev->dev, "Failed to register platform: %d\n", ret); | ||
2115 | goto err_spk_irqs; | ||
2116 | } | ||
2117 | |||
2118 | ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5102, | 2113 | ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5102, |
2119 | wm5102_dai, ARRAY_SIZE(wm5102_dai)); | 2114 | wm5102_dai, ARRAY_SIZE(wm5102_dai)); |
2120 | if (ret < 0) { | 2115 | if (ret < 0) { |
2121 | dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); | 2116 | dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); |
2122 | goto err_platform; | 2117 | goto err_spk_irqs; |
2123 | } | 2118 | } |
2124 | 2119 | ||
2125 | return ret; | 2120 | return ret; |
2126 | 2121 | ||
2127 | err_platform: | ||
2128 | snd_soc_unregister_platform(&pdev->dev); | ||
2129 | err_spk_irqs: | 2122 | err_spk_irqs: |
2130 | arizona_free_spk_irqs(arizona); | 2123 | arizona_free_spk_irqs(arizona); |
2131 | err_dsp_irq: | 2124 | err_dsp_irq: |
@@ -2139,7 +2132,6 @@ static int wm5102_remove(struct platform_device *pdev) | |||
2139 | struct wm5102_priv *wm5102 = platform_get_drvdata(pdev); | 2132 | struct wm5102_priv *wm5102 = platform_get_drvdata(pdev); |
2140 | struct arizona *arizona = wm5102->core.arizona; | 2133 | struct arizona *arizona = wm5102->core.arizona; |
2141 | 2134 | ||
2142 | snd_soc_unregister_platform(&pdev->dev); | ||
2143 | snd_soc_unregister_codec(&pdev->dev); | 2135 | snd_soc_unregister_codec(&pdev->dev); |
2144 | pm_runtime_disable(&pdev->dev); | 2136 | pm_runtime_disable(&pdev->dev); |
2145 | 2137 | ||
diff --git a/sound/soc/codecs/wm5110.c b/sound/soc/codecs/wm5110.c index fb0cf9c61f48..d5ece6c6fcb6 100644 --- a/sound/soc/codecs/wm5110.c +++ b/sound/soc/codecs/wm5110.c | |||
@@ -35,6 +35,8 @@ | |||
35 | 35 | ||
36 | #define WM5110_NUM_ADSP 4 | 36 | #define WM5110_NUM_ADSP 4 |
37 | 37 | ||
38 | #define DRV_NAME "wm5110-codec" | ||
39 | |||
38 | struct wm5110_priv { | 40 | struct wm5110_priv { |
39 | struct arizona_priv core; | 41 | struct arizona_priv core; |
40 | struct arizona_fll fll[2]; | 42 | struct arizona_fll fll[2]; |
@@ -2229,7 +2231,8 @@ static struct snd_soc_dai_driver wm5110_dai[] = { | |||
2229 | static int wm5110_open(struct snd_compr_stream *stream) | 2231 | static int wm5110_open(struct snd_compr_stream *stream) |
2230 | { | 2232 | { |
2231 | struct snd_soc_pcm_runtime *rtd = stream->private_data; | 2233 | struct snd_soc_pcm_runtime *rtd = stream->private_data; |
2232 | struct wm5110_priv *priv = snd_soc_platform_get_drvdata(rtd->platform); | 2234 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
2235 | struct wm5110_priv *priv = snd_soc_component_get_drvdata(component); | ||
2233 | struct arizona *arizona = priv->core.arizona; | 2236 | struct arizona *arizona = priv->core.arizona; |
2234 | int n_adsp; | 2237 | int n_adsp; |
2235 | 2238 | ||
@@ -2346,6 +2349,16 @@ static unsigned int wm5110_digital_vu[] = { | |||
2346 | ARIZONA_DAC_DIGITAL_VOLUME_6R, | 2349 | ARIZONA_DAC_DIGITAL_VOLUME_6R, |
2347 | }; | 2350 | }; |
2348 | 2351 | ||
2352 | static struct snd_compr_ops wm5110_compr_ops = { | ||
2353 | .open = wm5110_open, | ||
2354 | .free = wm_adsp_compr_free, | ||
2355 | .set_params = wm_adsp_compr_set_params, | ||
2356 | .get_caps = wm_adsp_compr_get_caps, | ||
2357 | .trigger = wm_adsp_compr_trigger, | ||
2358 | .pointer = wm_adsp_compr_pointer, | ||
2359 | .copy = wm_adsp_compr_copy, | ||
2360 | }; | ||
2361 | |||
2349 | static const struct snd_soc_codec_driver soc_codec_dev_wm5110 = { | 2362 | static const struct snd_soc_codec_driver soc_codec_dev_wm5110 = { |
2350 | .probe = wm5110_codec_probe, | 2363 | .probe = wm5110_codec_probe, |
2351 | .remove = wm5110_codec_remove, | 2364 | .remove = wm5110_codec_remove, |
@@ -2356,6 +2369,8 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5110 = { | |||
2356 | .set_pll = wm5110_set_fll, | 2369 | .set_pll = wm5110_set_fll, |
2357 | 2370 | ||
2358 | .component_driver = { | 2371 | .component_driver = { |
2372 | .name = DRV_NAME, | ||
2373 | .compr_ops = &wm5110_compr_ops, | ||
2359 | .controls = wm5110_snd_controls, | 2374 | .controls = wm5110_snd_controls, |
2360 | .num_controls = ARRAY_SIZE(wm5110_snd_controls), | 2375 | .num_controls = ARRAY_SIZE(wm5110_snd_controls), |
2361 | .dapm_widgets = wm5110_dapm_widgets, | 2376 | .dapm_widgets = wm5110_dapm_widgets, |
@@ -2365,20 +2380,6 @@ static const struct snd_soc_codec_driver soc_codec_dev_wm5110 = { | |||
2365 | }, | 2380 | }, |
2366 | }; | 2381 | }; |
2367 | 2382 | ||
2368 | static const struct snd_compr_ops wm5110_compr_ops = { | ||
2369 | .open = wm5110_open, | ||
2370 | .free = wm_adsp_compr_free, | ||
2371 | .set_params = wm_adsp_compr_set_params, | ||
2372 | .get_caps = wm_adsp_compr_get_caps, | ||
2373 | .trigger = wm_adsp_compr_trigger, | ||
2374 | .pointer = wm_adsp_compr_pointer, | ||
2375 | .copy = wm_adsp_compr_copy, | ||
2376 | }; | ||
2377 | |||
2378 | static const struct snd_soc_platform_driver wm5110_compr_platform = { | ||
2379 | .compr_ops = &wm5110_compr_ops, | ||
2380 | }; | ||
2381 | |||
2382 | static int wm5110_probe(struct platform_device *pdev) | 2383 | static int wm5110_probe(struct platform_device *pdev) |
2383 | { | 2384 | { |
2384 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); | 2385 | struct arizona *arizona = dev_get_drvdata(pdev->dev.parent); |
@@ -2464,23 +2465,15 @@ static int wm5110_probe(struct platform_device *pdev) | |||
2464 | if (ret < 0) | 2465 | if (ret < 0) |
2465 | goto err_dsp_irq; | 2466 | goto err_dsp_irq; |
2466 | 2467 | ||
2467 | ret = snd_soc_register_platform(&pdev->dev, &wm5110_compr_platform); | ||
2468 | if (ret < 0) { | ||
2469 | dev_err(&pdev->dev, "Failed to register platform: %d\n", ret); | ||
2470 | goto err_spk_irqs; | ||
2471 | } | ||
2472 | |||
2473 | ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5110, | 2468 | ret = snd_soc_register_codec(&pdev->dev, &soc_codec_dev_wm5110, |
2474 | wm5110_dai, ARRAY_SIZE(wm5110_dai)); | 2469 | wm5110_dai, ARRAY_SIZE(wm5110_dai)); |
2475 | if (ret < 0) { | 2470 | if (ret < 0) { |
2476 | dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); | 2471 | dev_err(&pdev->dev, "Failed to register codec: %d\n", ret); |
2477 | goto err_platform; | 2472 | goto err_spk_irqs; |
2478 | } | 2473 | } |
2479 | 2474 | ||
2480 | return ret; | 2475 | return ret; |
2481 | 2476 | ||
2482 | err_platform: | ||
2483 | snd_soc_unregister_platform(&pdev->dev); | ||
2484 | err_spk_irqs: | 2477 | err_spk_irqs: |
2485 | arizona_free_spk_irqs(arizona); | 2478 | arizona_free_spk_irqs(arizona); |
2486 | err_dsp_irq: | 2479 | err_dsp_irq: |
@@ -2495,7 +2488,6 @@ static int wm5110_remove(struct platform_device *pdev) | |||
2495 | struct arizona *arizona = wm5110->core.arizona; | 2488 | struct arizona *arizona = wm5110->core.arizona; |
2496 | int i; | 2489 | int i; |
2497 | 2490 | ||
2498 | snd_soc_unregister_platform(&pdev->dev); | ||
2499 | snd_soc_unregister_codec(&pdev->dev); | 2491 | snd_soc_unregister_codec(&pdev->dev); |
2500 | pm_runtime_disable(&pdev->dev); | 2492 | pm_runtime_disable(&pdev->dev); |
2501 | 2493 | ||
diff --git a/sound/soc/davinci/davinci-i2s.c b/sound/soc/davinci/davinci-i2s.c index 384961651904..807040bb3921 100644 --- a/sound/soc/davinci/davinci-i2s.c +++ b/sound/soc/davinci/davinci-i2s.c | |||
@@ -34,6 +34,7 @@ | |||
34 | #include "edma-pcm.h" | 34 | #include "edma-pcm.h" |
35 | #include "davinci-i2s.h" | 35 | #include "davinci-i2s.h" |
36 | 36 | ||
37 | #define DRV_NAME "davinci-i2s" | ||
37 | 38 | ||
38 | /* | 39 | /* |
39 | * NOTE: terminology here is confusing. | 40 | * NOTE: terminology here is confusing. |
@@ -190,7 +191,7 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev, | |||
190 | struct snd_pcm_substream *substream) | 191 | struct snd_pcm_substream *substream) |
191 | { | 192 | { |
192 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 193 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
193 | struct snd_soc_platform *platform = rtd->platform; | 194 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
194 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); | 195 | int playback = (substream->stream == SNDRV_PCM_STREAM_PLAYBACK); |
195 | u32 spcr; | 196 | u32 spcr; |
196 | u32 mask = playback ? DAVINCI_MCBSP_SPCR_XRST : DAVINCI_MCBSP_SPCR_RRST; | 197 | u32 mask = playback ? DAVINCI_MCBSP_SPCR_XRST : DAVINCI_MCBSP_SPCR_RRST; |
@@ -211,8 +212,8 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev, | |||
211 | if (playback) { | 212 | if (playback) { |
212 | /* Stop the DMA to avoid data loss */ | 213 | /* Stop the DMA to avoid data loss */ |
213 | /* while the transmitter is out of reset to handle XSYNCERR */ | 214 | /* while the transmitter is out of reset to handle XSYNCERR */ |
214 | if (platform->driver->ops->trigger) { | 215 | if (component->driver->ops->trigger) { |
215 | int ret = platform->driver->ops->trigger(substream, | 216 | int ret = component->driver->ops->trigger(substream, |
216 | SNDRV_PCM_TRIGGER_STOP); | 217 | SNDRV_PCM_TRIGGER_STOP); |
217 | if (ret < 0) | 218 | if (ret < 0) |
218 | printk(KERN_DEBUG "Playback DMA stop failed\n"); | 219 | printk(KERN_DEBUG "Playback DMA stop failed\n"); |
@@ -233,8 +234,8 @@ static void davinci_mcbsp_start(struct davinci_mcbsp_dev *dev, | |||
233 | toggle_clock(dev, playback); | 234 | toggle_clock(dev, playback); |
234 | 235 | ||
235 | /* Restart the DMA */ | 236 | /* Restart the DMA */ |
236 | if (platform->driver->ops->trigger) { | 237 | if (component->driver->ops->trigger) { |
237 | int ret = platform->driver->ops->trigger(substream, | 238 | int ret = component->driver->ops->trigger(substream, |
238 | SNDRV_PCM_TRIGGER_START); | 239 | SNDRV_PCM_TRIGGER_START); |
239 | if (ret < 0) | 240 | if (ret < 0) |
240 | printk(KERN_DEBUG "Playback DMA start failed\n"); | 241 | printk(KERN_DEBUG "Playback DMA start failed\n"); |
@@ -651,7 +652,7 @@ static struct snd_soc_dai_driver davinci_i2s_dai = { | |||
651 | }; | 652 | }; |
652 | 653 | ||
653 | static const struct snd_soc_component_driver davinci_i2s_component = { | 654 | static const struct snd_soc_component_driver davinci_i2s_component = { |
654 | .name = "davinci-i2s", | 655 | .name = DRV_NAME, |
655 | }; | 656 | }; |
656 | 657 | ||
657 | static int davinci_i2s_probe(struct platform_device *pdev) | 658 | static int davinci_i2s_probe(struct platform_device *pdev) |
diff --git a/sound/soc/dwc/dwc-pcm.c b/sound/soc/dwc/dwc-pcm.c index 406fd867117b..2cc9632024fc 100644 --- a/sound/soc/dwc/dwc-pcm.c +++ b/sound/soc/dwc/dwc-pcm.c | |||
@@ -269,7 +269,7 @@ static const struct snd_pcm_ops dw_pcm_ops = { | |||
269 | .pointer = dw_pcm_pointer, | 269 | .pointer = dw_pcm_pointer, |
270 | }; | 270 | }; |
271 | 271 | ||
272 | static const struct snd_soc_platform_driver dw_pcm_platform = { | 272 | static const struct snd_soc_component_driver dw_pcm_component = { |
273 | .pcm_new = dw_pcm_new, | 273 | .pcm_new = dw_pcm_new, |
274 | .pcm_free = dw_pcm_free, | 274 | .pcm_free = dw_pcm_free, |
275 | .ops = &dw_pcm_ops, | 275 | .ops = &dw_pcm_ops, |
@@ -277,5 +277,6 @@ static const struct snd_soc_platform_driver dw_pcm_platform = { | |||
277 | 277 | ||
278 | int dw_pcm_register(struct platform_device *pdev) | 278 | int dw_pcm_register(struct platform_device *pdev) |
279 | { | 279 | { |
280 | return devm_snd_soc_register_platform(&pdev->dev, &dw_pcm_platform); | 280 | return devm_snd_soc_register_component(&pdev->dev, &dw_pcm_component, |
281 | NULL, 0); | ||
281 | } | 282 | } |
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 806d39927318..adfb8135d739 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c | |||
@@ -582,10 +582,6 @@ static struct snd_soc_dai_driver fsl_asrc_dai = { | |||
582 | .ops = &fsl_asrc_dai_ops, | 582 | .ops = &fsl_asrc_dai_ops, |
583 | }; | 583 | }; |
584 | 584 | ||
585 | static const struct snd_soc_component_driver fsl_asrc_component = { | ||
586 | .name = "fsl-asrc-dai", | ||
587 | }; | ||
588 | |||
589 | static bool fsl_asrc_readable_reg(struct device *dev, unsigned int reg) | 585 | static bool fsl_asrc_readable_reg(struct device *dev, unsigned int reg) |
590 | { | 586 | { |
591 | switch (reg) { | 587 | switch (reg) { |
@@ -927,12 +923,6 @@ static int fsl_asrc_probe(struct platform_device *pdev) | |||
927 | return ret; | 923 | return ret; |
928 | } | 924 | } |
929 | 925 | ||
930 | ret = devm_snd_soc_register_platform(&pdev->dev, &fsl_asrc_platform); | ||
931 | if (ret) { | ||
932 | dev_err(&pdev->dev, "failed to register ASoC platform\n"); | ||
933 | return ret; | ||
934 | } | ||
935 | |||
936 | return 0; | 926 | return 0; |
937 | } | 927 | } |
938 | 928 | ||
diff --git a/sound/soc/fsl/fsl_asrc.h b/sound/soc/fsl/fsl_asrc.h index 2c5856ac5bc3..d558dd5499a5 100644 --- a/sound/soc/fsl/fsl_asrc.h +++ b/sound/soc/fsl/fsl_asrc.h | |||
@@ -462,6 +462,7 @@ struct fsl_asrc { | |||
462 | u32 regcache_cfg; | 462 | u32 regcache_cfg; |
463 | }; | 463 | }; |
464 | 464 | ||
465 | extern struct snd_soc_platform_driver fsl_asrc_platform; | 465 | #define DRV_NAME "fsl-asrc-dai" |
466 | extern struct snd_soc_component_driver fsl_asrc_component; | ||
466 | struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir); | 467 | struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir); |
467 | #endif /* _FSL_ASRC_H */ | 468 | #endif /* _FSL_ASRC_H */ |
diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c index e1b97e59275a..565e16d8fe85 100644 --- a/sound/soc/fsl/fsl_asrc_dma.c +++ b/sound/soc/fsl/fsl_asrc_dma.c | |||
@@ -64,7 +64,8 @@ static int fsl_asrc_dma_prepare_and_submit(struct snd_pcm_substream *substream) | |||
64 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 64 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
65 | struct snd_pcm_runtime *runtime = substream->runtime; | 65 | struct snd_pcm_runtime *runtime = substream->runtime; |
66 | struct fsl_asrc_pair *pair = runtime->private_data; | 66 | struct fsl_asrc_pair *pair = runtime->private_data; |
67 | struct device *dev = rtd->platform->dev; | 67 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
68 | struct device *dev = component->dev; | ||
68 | unsigned long flags = DMA_CTRL_ACK; | 69 | unsigned long flags = DMA_CTRL_ACK; |
69 | 70 | ||
70 | /* Prepare and submit Front-End DMA channel */ | 71 | /* Prepare and submit Front-End DMA channel */ |
@@ -137,12 +138,13 @@ static int fsl_asrc_dma_hw_params(struct snd_pcm_substream *substream, | |||
137 | bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; | 138 | bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; |
138 | struct snd_dmaengine_dai_dma_data *dma_params_fe = NULL; | 139 | struct snd_dmaengine_dai_dma_data *dma_params_fe = NULL; |
139 | struct snd_dmaengine_dai_dma_data *dma_params_be = NULL; | 140 | struct snd_dmaengine_dai_dma_data *dma_params_be = NULL; |
141 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); | ||
140 | struct snd_pcm_runtime *runtime = substream->runtime; | 142 | struct snd_pcm_runtime *runtime = substream->runtime; |
141 | struct fsl_asrc_pair *pair = runtime->private_data; | 143 | struct fsl_asrc_pair *pair = runtime->private_data; |
142 | struct fsl_asrc *asrc_priv = pair->asrc_priv; | 144 | struct fsl_asrc *asrc_priv = pair->asrc_priv; |
143 | struct dma_slave_config config_fe, config_be; | 145 | struct dma_slave_config config_fe, config_be; |
144 | enum asrc_pair_index index = pair->index; | 146 | enum asrc_pair_index index = pair->index; |
145 | struct device *dev = rtd->platform->dev; | 147 | struct device *dev = component->dev; |
146 | int stream = substream->stream; | 148 | int stream = substream->stream; |
147 | struct imx_dma_data *tmp_data; | 149 | struct imx_dma_data *tmp_data; |
148 | struct snd_soc_dpcm *dpcm; | 150 | struct snd_soc_dpcm *dpcm; |
@@ -274,7 +276,8 @@ static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream) | |||
274 | { | 276 | { |
275 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 277 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
276 | struct snd_pcm_runtime *runtime = substream->runtime; | 278 | struct snd_pcm_runtime *runtime = substream->runtime; |
277 | struct device *dev = rtd->platform->dev; | 279 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
280 | struct device *dev = component->dev; | ||
278 | struct fsl_asrc *asrc_priv = dev_get_drvdata(dev); | 281 | struct fsl_asrc *asrc_priv = dev_get_drvdata(dev); |
279 | struct fsl_asrc_pair *pair; | 282 | struct fsl_asrc_pair *pair; |
280 | 283 | ||
@@ -381,9 +384,10 @@ static void fsl_asrc_dma_pcm_free(struct snd_pcm *pcm) | |||
381 | } | 384 | } |
382 | } | 385 | } |
383 | 386 | ||
384 | struct snd_soc_platform_driver fsl_asrc_platform = { | 387 | struct snd_soc_component_driver fsl_asrc_component = { |
388 | .name = DRV_NAME, | ||
385 | .ops = &fsl_asrc_dma_pcm_ops, | 389 | .ops = &fsl_asrc_dma_pcm_ops, |
386 | .pcm_new = fsl_asrc_dma_pcm_new, | 390 | .pcm_new = fsl_asrc_dma_pcm_new, |
387 | .pcm_free = fsl_asrc_dma_pcm_free, | 391 | .pcm_free = fsl_asrc_dma_pcm_free, |
388 | }; | 392 | }; |
389 | EXPORT_SYMBOL_GPL(fsl_asrc_platform); | 393 | EXPORT_SYMBOL_GPL(fsl_asrc_component); |
diff --git a/sound/soc/fsl/fsl_dma.c b/sound/soc/fsl/fsl_dma.c index 8c2981b70f64..fce2010d3c53 100644 --- a/sound/soc/fsl/fsl_dma.c +++ b/sound/soc/fsl/fsl_dma.c | |||
@@ -37,6 +37,8 @@ | |||
37 | #include "fsl_dma.h" | 37 | #include "fsl_dma.h" |
38 | #include "fsl_ssi.h" /* For the offset of stx0 and srx0 */ | 38 | #include "fsl_ssi.h" /* For the offset of stx0 and srx0 */ |
39 | 39 | ||
40 | #define DRV_NAME "fsl_dma" | ||
41 | |||
40 | /* | 42 | /* |
41 | * The formats that the DMA controller supports, which is anything | 43 | * The formats that the DMA controller supports, which is anything |
42 | * that is 8, 16, or 32 bits. | 44 | * that is 8, 16, or 32 bits. |
@@ -56,7 +58,7 @@ | |||
56 | SNDRV_PCM_FMTBIT_U32_LE | \ | 58 | SNDRV_PCM_FMTBIT_U32_LE | \ |
57 | SNDRV_PCM_FMTBIT_U32_BE) | 59 | SNDRV_PCM_FMTBIT_U32_BE) |
58 | struct dma_object { | 60 | struct dma_object { |
59 | struct snd_soc_platform_driver dai; | 61 | struct snd_soc_component_driver dai; |
60 | dma_addr_t ssi_stx_phys; | 62 | dma_addr_t ssi_stx_phys; |
61 | dma_addr_t ssi_srx_phys; | 63 | dma_addr_t ssi_srx_phys; |
62 | unsigned int ssi_fifo_depth; | 64 | unsigned int ssi_fifo_depth; |
@@ -203,7 +205,8 @@ static irqreturn_t fsl_dma_isr(int irq, void *dev_id) | |||
203 | struct fsl_dma_private *dma_private = dev_id; | 205 | struct fsl_dma_private *dma_private = dev_id; |
204 | struct snd_pcm_substream *substream = dma_private->substream; | 206 | struct snd_pcm_substream *substream = dma_private->substream; |
205 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 207 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
206 | struct device *dev = rtd->platform->dev; | 208 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
209 | struct device *dev = component->dev; | ||
207 | struct ccsr_dma_channel __iomem *dma_channel = dma_private->dma_channel; | 210 | struct ccsr_dma_channel __iomem *dma_channel = dma_private->dma_channel; |
208 | irqreturn_t ret = IRQ_NONE; | 211 | irqreturn_t ret = IRQ_NONE; |
209 | u32 sr, sr2 = 0; | 212 | u32 sr, sr2 = 0; |
@@ -385,9 +388,10 @@ static int fsl_dma_open(struct snd_pcm_substream *substream) | |||
385 | { | 388 | { |
386 | struct snd_pcm_runtime *runtime = substream->runtime; | 389 | struct snd_pcm_runtime *runtime = substream->runtime; |
387 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 390 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
388 | struct device *dev = rtd->platform->dev; | 391 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
392 | struct device *dev = component->dev; | ||
389 | struct dma_object *dma = | 393 | struct dma_object *dma = |
390 | container_of(rtd->platform->driver, struct dma_object, dai); | 394 | container_of(component->driver, struct dma_object, dai); |
391 | struct fsl_dma_private *dma_private; | 395 | struct fsl_dma_private *dma_private; |
392 | struct ccsr_dma_channel __iomem *dma_channel; | 396 | struct ccsr_dma_channel __iomem *dma_channel; |
393 | dma_addr_t ld_buf_phys; | 397 | dma_addr_t ld_buf_phys; |
@@ -539,7 +543,8 @@ static int fsl_dma_hw_params(struct snd_pcm_substream *substream, | |||
539 | struct snd_pcm_runtime *runtime = substream->runtime; | 543 | struct snd_pcm_runtime *runtime = substream->runtime; |
540 | struct fsl_dma_private *dma_private = runtime->private_data; | 544 | struct fsl_dma_private *dma_private = runtime->private_data; |
541 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 545 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
542 | struct device *dev = rtd->platform->dev; | 546 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
547 | struct device *dev = component->dev; | ||
543 | 548 | ||
544 | /* Number of bits per sample */ | 549 | /* Number of bits per sample */ |
545 | unsigned int sample_bits = | 550 | unsigned int sample_bits = |
@@ -702,7 +707,8 @@ static snd_pcm_uframes_t fsl_dma_pointer(struct snd_pcm_substream *substream) | |||
702 | struct snd_pcm_runtime *runtime = substream->runtime; | 707 | struct snd_pcm_runtime *runtime = substream->runtime; |
703 | struct fsl_dma_private *dma_private = runtime->private_data; | 708 | struct fsl_dma_private *dma_private = runtime->private_data; |
704 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 709 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
705 | struct device *dev = rtd->platform->dev; | 710 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
711 | struct device *dev = component->dev; | ||
706 | struct ccsr_dma_channel __iomem *dma_channel = dma_private->dma_channel; | 712 | struct ccsr_dma_channel __iomem *dma_channel = dma_private->dma_channel; |
707 | dma_addr_t position; | 713 | dma_addr_t position; |
708 | snd_pcm_uframes_t frames; | 714 | snd_pcm_uframes_t frames; |
@@ -799,9 +805,10 @@ static int fsl_dma_close(struct snd_pcm_substream *substream) | |||
799 | struct snd_pcm_runtime *runtime = substream->runtime; | 805 | struct snd_pcm_runtime *runtime = substream->runtime; |
800 | struct fsl_dma_private *dma_private = runtime->private_data; | 806 | struct fsl_dma_private *dma_private = runtime->private_data; |
801 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 807 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
802 | struct device *dev = rtd->platform->dev; | 808 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
809 | struct device *dev = component->dev; | ||
803 | struct dma_object *dma = | 810 | struct dma_object *dma = |
804 | container_of(rtd->platform->driver, struct dma_object, dai); | 811 | container_of(component->driver, struct dma_object, dai); |
805 | 812 | ||
806 | if (dma_private) { | 813 | if (dma_private) { |
807 | if (dma_private->irq) | 814 | if (dma_private->irq) |
@@ -908,6 +915,7 @@ static int fsl_soc_dma_probe(struct platform_device *pdev) | |||
908 | return -ENOMEM; | 915 | return -ENOMEM; |
909 | } | 916 | } |
910 | 917 | ||
918 | dma->dai.name = DRV_NAME; | ||
911 | dma->dai.ops = &fsl_dma_ops; | 919 | dma->dai.ops = &fsl_dma_ops; |
912 | dma->dai.pcm_new = fsl_dma_new; | 920 | dma->dai.pcm_new = fsl_dma_new; |
913 | dma->dai.pcm_free = fsl_dma_free_dma_buffers; | 921 | dma->dai.pcm_free = fsl_dma_free_dma_buffers; |
@@ -925,7 +933,7 @@ static int fsl_soc_dma_probe(struct platform_device *pdev) | |||
925 | 933 | ||
926 | of_node_put(ssi_np); | 934 | of_node_put(ssi_np); |
927 | 935 | ||
928 | ret = snd_soc_register_platform(&pdev->dev, &dma->dai); | 936 | ret = devm_snd_soc_register_component(&pdev->dev, &dma->dai, NULL, 0); |
929 | if (ret) { | 937 | if (ret) { |
930 | dev_err(&pdev->dev, "could not register platform\n"); | 938 | dev_err(&pdev->dev, "could not register platform\n"); |
931 | kfree(dma); | 939 | kfree(dma); |
@@ -944,7 +952,6 @@ static int fsl_soc_dma_remove(struct platform_device *pdev) | |||
944 | { | 952 | { |
945 | struct dma_object *dma = dev_get_drvdata(&pdev->dev); | 953 | struct dma_object *dma = dev_get_drvdata(&pdev->dev); |
946 | 954 | ||
947 | snd_soc_unregister_platform(&pdev->dev); | ||
948 | iounmap(dma->channel); | 955 | iounmap(dma->channel); |
949 | irq_dispose_mapping(dma->irq); | 956 | irq_dispose_mapping(dma->irq); |
950 | kfree(dma); | 957 | kfree(dma); |
diff --git a/sound/soc/fsl/imx-pcm-fiq.c b/sound/soc/fsl/imx-pcm-fiq.c index 4e5fefee111e..0578f3486847 100644 --- a/sound/soc/fsl/imx-pcm-fiq.c +++ b/sound/soc/fsl/imx-pcm-fiq.c | |||
@@ -341,7 +341,7 @@ static void imx_pcm_fiq_free(struct snd_pcm *pcm) | |||
341 | imx_pcm_free(pcm); | 341 | imx_pcm_free(pcm); |
342 | } | 342 | } |
343 | 343 | ||
344 | static const struct snd_soc_platform_driver imx_soc_platform_fiq = { | 344 | static const struct snd_soc_component_driver imx_soc_component_fiq = { |
345 | .ops = &imx_pcm_ops, | 345 | .ops = &imx_pcm_ops, |
346 | .pcm_new = imx_pcm_fiq_new, | 346 | .pcm_new = imx_pcm_fiq_new, |
347 | .pcm_free = imx_pcm_fiq_free, | 347 | .pcm_free = imx_pcm_fiq_free, |
@@ -368,7 +368,8 @@ int imx_pcm_fiq_init(struct platform_device *pdev, | |||
368 | params->dma_params_tx->maxburst = 4; | 368 | params->dma_params_tx->maxburst = 4; |
369 | params->dma_params_rx->maxburst = 6; | 369 | params->dma_params_rx->maxburst = 6; |
370 | 370 | ||
371 | ret = snd_soc_register_platform(&pdev->dev, &imx_soc_platform_fiq); | 371 | ret = devm_snd_soc_register_component(&pdev->dev, &imx_soc_component_fiq, |
372 | NULL, 0); | ||
372 | if (ret) | 373 | if (ret) |
373 | goto failed_register; | 374 | goto failed_register; |
374 | 375 | ||
@@ -384,7 +385,6 @@ EXPORT_SYMBOL_GPL(imx_pcm_fiq_init); | |||
384 | 385 | ||
385 | void imx_pcm_fiq_exit(struct platform_device *pdev) | 386 | void imx_pcm_fiq_exit(struct platform_device *pdev) |
386 | { | 387 | { |
387 | snd_soc_unregister_platform(&pdev->dev); | ||
388 | } | 388 | } |
389 | EXPORT_SYMBOL_GPL(imx_pcm_fiq_exit); | 389 | EXPORT_SYMBOL_GPL(imx_pcm_fiq_exit); |
390 | 390 | ||
diff --git a/sound/soc/fsl/mpc5200_dma.c b/sound/soc/fsl/mpc5200_dma.c index e63029f1aabc..c1a4544eb16b 100644 --- a/sound/soc/fsl/mpc5200_dma.c +++ b/sound/soc/fsl/mpc5200_dma.c | |||
@@ -22,6 +22,8 @@ | |||
22 | 22 | ||
23 | #include "mpc5200_dma.h" | 23 | #include "mpc5200_dma.h" |
24 | 24 | ||
25 | #define DRV_NAME "mpc5200_dma" | ||
26 | |||
25 | /* | 27 | /* |
26 | * Interrupt handlers | 28 | * Interrupt handlers |
27 | */ | 29 | */ |
@@ -300,12 +302,13 @@ static const struct snd_pcm_ops psc_dma_ops = { | |||
300 | static int psc_dma_new(struct snd_soc_pcm_runtime *rtd) | 302 | static int psc_dma_new(struct snd_soc_pcm_runtime *rtd) |
301 | { | 303 | { |
302 | struct snd_card *card = rtd->card->snd_card; | 304 | struct snd_card *card = rtd->card->snd_card; |
305 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); | ||
303 | struct snd_soc_dai *dai = rtd->cpu_dai; | 306 | struct snd_soc_dai *dai = rtd->cpu_dai; |
304 | struct snd_pcm *pcm = rtd->pcm; | 307 | struct snd_pcm *pcm = rtd->pcm; |
305 | size_t size = psc_dma_hardware.buffer_bytes_max; | 308 | size_t size = psc_dma_hardware.buffer_bytes_max; |
306 | int rc; | 309 | int rc; |
307 | 310 | ||
308 | dev_dbg(rtd->platform->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n", | 311 | dev_dbg(component->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n", |
309 | card, dai, pcm); | 312 | card, dai, pcm); |
310 | 313 | ||
311 | rc = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); | 314 | rc = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32)); |
@@ -341,10 +344,11 @@ static int psc_dma_new(struct snd_soc_pcm_runtime *rtd) | |||
341 | static void psc_dma_free(struct snd_pcm *pcm) | 344 | static void psc_dma_free(struct snd_pcm *pcm) |
342 | { | 345 | { |
343 | struct snd_soc_pcm_runtime *rtd = pcm->private_data; | 346 | struct snd_soc_pcm_runtime *rtd = pcm->private_data; |
347 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); | ||
344 | struct snd_pcm_substream *substream; | 348 | struct snd_pcm_substream *substream; |
345 | int stream; | 349 | int stream; |
346 | 350 | ||
347 | dev_dbg(rtd->platform->dev, "psc_dma_free(pcm=%p)\n", pcm); | 351 | dev_dbg(component->dev, "psc_dma_free(pcm=%p)\n", pcm); |
348 | 352 | ||
349 | for (stream = 0; stream < 2; stream++) { | 353 | for (stream = 0; stream < 2; stream++) { |
350 | substream = pcm->streams[stream].substream; | 354 | substream = pcm->streams[stream].substream; |
@@ -356,7 +360,8 @@ static void psc_dma_free(struct snd_pcm *pcm) | |||
356 | } | 360 | } |
357 | } | 361 | } |
358 | 362 | ||
359 | static const struct snd_soc_platform_driver mpc5200_audio_dma_platform = { | 363 | static const struct snd_soc_component_driver mpc5200_audio_dma_component = { |
364 | .name = DRV_NAME, | ||
360 | .ops = &psc_dma_ops, | 365 | .ops = &psc_dma_ops, |
361 | .pcm_new = &psc_dma_new, | 366 | .pcm_new = &psc_dma_new, |
362 | .pcm_free = &psc_dma_free, | 367 | .pcm_free = &psc_dma_free, |
@@ -468,7 +473,8 @@ int mpc5200_audio_dma_create(struct platform_device *op) | |||
468 | dev_set_drvdata(&op->dev, psc_dma); | 473 | dev_set_drvdata(&op->dev, psc_dma); |
469 | 474 | ||
470 | /* Tell the ASoC OF helpers about it */ | 475 | /* Tell the ASoC OF helpers about it */ |
471 | return snd_soc_register_platform(&op->dev, &mpc5200_audio_dma_platform); | 476 | return devm_snd_soc_register_component(&op->dev, |
477 | &mpc5200_audio_dma_component, NULL, 0); | ||
472 | out_irq: | 478 | out_irq: |
473 | free_irq(psc_dma->irq, psc_dma); | 479 | free_irq(psc_dma->irq, psc_dma); |
474 | free_irq(psc_dma->capture.irq, &psc_dma->capture); | 480 | free_irq(psc_dma->capture.irq, &psc_dma->capture); |
@@ -487,8 +493,6 @@ int mpc5200_audio_dma_destroy(struct platform_device *op) | |||
487 | 493 | ||
488 | dev_dbg(&op->dev, "mpc5200_audio_dma_destroy()\n"); | 494 | dev_dbg(&op->dev, "mpc5200_audio_dma_destroy()\n"); |
489 | 495 | ||
490 | snd_soc_unregister_platform(&op->dev); | ||
491 | |||
492 | bcom_gen_bd_rx_release(psc_dma->capture.bcom_task); | 496 | bcom_gen_bd_rx_release(psc_dma->capture.bcom_task); |
493 | bcom_gen_bd_tx_release(psc_dma->playback.bcom_task); | 497 | bcom_gen_bd_tx_release(psc_dma->playback.bcom_task); |
494 | 498 | ||
diff --git a/sound/soc/intel/atom/sst-atom-controls.c b/sound/soc/intel/atom/sst-atom-controls.c index 0f3604b55942..3672d36b4b66 100644 --- a/sound/soc/intel/atom/sst-atom-controls.c +++ b/sound/soc/intel/atom/sst-atom-controls.c | |||
@@ -1414,11 +1414,11 @@ static int sst_fill_module_list(struct snd_kcontrol *kctl, | |||
1414 | * name. First part of control name contains the pipe name (widget name). | 1414 | * name. First part of control name contains the pipe name (widget name). |
1415 | */ | 1415 | */ |
1416 | static int sst_fill_widget_module_info(struct snd_soc_dapm_widget *w, | 1416 | static int sst_fill_widget_module_info(struct snd_soc_dapm_widget *w, |
1417 | struct snd_soc_platform *platform) | 1417 | struct snd_soc_component *component) |
1418 | { | 1418 | { |
1419 | struct snd_kcontrol *kctl; | 1419 | struct snd_kcontrol *kctl; |
1420 | int index, ret = 0; | 1420 | int index, ret = 0; |
1421 | struct snd_card *card = platform->component.card->snd_card; | 1421 | struct snd_card *card = component->card->snd_card; |
1422 | char *idx; | 1422 | char *idx; |
1423 | 1423 | ||
1424 | down_read(&card->controls_rwsem); | 1424 | down_read(&card->controls_rwsem); |
@@ -1468,13 +1468,13 @@ static int sst_fill_widget_module_info(struct snd_soc_dapm_widget *w, | |||
1468 | /** | 1468 | /** |
1469 | * sst_fill_linked_widgets - fill the parent pointer for the linked widget | 1469 | * sst_fill_linked_widgets - fill the parent pointer for the linked widget |
1470 | */ | 1470 | */ |
1471 | static void sst_fill_linked_widgets(struct snd_soc_platform *platform, | 1471 | static void sst_fill_linked_widgets(struct snd_soc_component *component, |
1472 | struct sst_ids *ids) | 1472 | struct sst_ids *ids) |
1473 | { | 1473 | { |
1474 | struct snd_soc_dapm_widget *w; | 1474 | struct snd_soc_dapm_widget *w; |
1475 | unsigned int len = strlen(ids->parent_wname); | 1475 | unsigned int len = strlen(ids->parent_wname); |
1476 | 1476 | ||
1477 | list_for_each_entry(w, &platform->component.card->widgets, list) { | 1477 | list_for_each_entry(w, &component->card->widgets, list) { |
1478 | if (!strncmp(ids->parent_wname, w->name, len)) { | 1478 | if (!strncmp(ids->parent_wname, w->name, len)) { |
1479 | ids->parent_w = w; | 1479 | ids->parent_w = w; |
1480 | break; | 1480 | break; |
@@ -1485,41 +1485,41 @@ static void sst_fill_linked_widgets(struct snd_soc_platform *platform, | |||
1485 | /** | 1485 | /** |
1486 | * sst_map_modules_to_pipe - fill algo/gains list for all pipes | 1486 | * sst_map_modules_to_pipe - fill algo/gains list for all pipes |
1487 | */ | 1487 | */ |
1488 | static int sst_map_modules_to_pipe(struct snd_soc_platform *platform) | 1488 | static int sst_map_modules_to_pipe(struct snd_soc_component *component) |
1489 | { | 1489 | { |
1490 | struct snd_soc_dapm_widget *w; | 1490 | struct snd_soc_dapm_widget *w; |
1491 | int ret = 0; | 1491 | int ret = 0; |
1492 | 1492 | ||
1493 | list_for_each_entry(w, &platform->component.card->widgets, list) { | 1493 | list_for_each_entry(w, &component->card->widgets, list) { |
1494 | if (is_sst_dapm_widget(w) && (w->priv)) { | 1494 | if (is_sst_dapm_widget(w) && (w->priv)) { |
1495 | struct sst_ids *ids = w->priv; | 1495 | struct sst_ids *ids = w->priv; |
1496 | 1496 | ||
1497 | dev_dbg(platform->dev, "widget type=%d name=%s\n", | 1497 | dev_dbg(component->dev, "widget type=%d name=%s\n", |
1498 | w->id, w->name); | 1498 | w->id, w->name); |
1499 | INIT_LIST_HEAD(&ids->algo_list); | 1499 | INIT_LIST_HEAD(&ids->algo_list); |
1500 | INIT_LIST_HEAD(&ids->gain_list); | 1500 | INIT_LIST_HEAD(&ids->gain_list); |
1501 | ret = sst_fill_widget_module_info(w, platform); | 1501 | ret = sst_fill_widget_module_info(w, component); |
1502 | 1502 | ||
1503 | if (ret < 0) | 1503 | if (ret < 0) |
1504 | return ret; | 1504 | return ret; |
1505 | 1505 | ||
1506 | /* fill linked widgets */ | 1506 | /* fill linked widgets */ |
1507 | if (ids->parent_wname != NULL) | 1507 | if (ids->parent_wname != NULL) |
1508 | sst_fill_linked_widgets(platform, ids); | 1508 | sst_fill_linked_widgets(component, ids); |
1509 | } | 1509 | } |
1510 | } | 1510 | } |
1511 | return 0; | 1511 | return 0; |
1512 | } | 1512 | } |
1513 | 1513 | ||
1514 | int sst_dsp_init_v2_dpcm(struct snd_soc_platform *platform) | 1514 | int sst_dsp_init_v2_dpcm(struct snd_soc_component *component) |
1515 | { | 1515 | { |
1516 | int i, ret = 0; | 1516 | int i, ret = 0; |
1517 | struct snd_soc_dapm_context *dapm = | 1517 | struct snd_soc_dapm_context *dapm = |
1518 | snd_soc_component_get_dapm(&platform->component); | 1518 | snd_soc_component_get_dapm(component); |
1519 | struct sst_data *drv = snd_soc_platform_get_drvdata(platform); | 1519 | struct sst_data *drv = snd_soc_component_get_drvdata(component); |
1520 | unsigned int gains = ARRAY_SIZE(sst_gain_controls)/3; | 1520 | unsigned int gains = ARRAY_SIZE(sst_gain_controls)/3; |
1521 | 1521 | ||
1522 | drv->byte_stream = devm_kzalloc(platform->dev, | 1522 | drv->byte_stream = devm_kzalloc(component->dev, |
1523 | SST_MAX_BIN_BYTES, GFP_KERNEL); | 1523 | SST_MAX_BIN_BYTES, GFP_KERNEL); |
1524 | if (!drv->byte_stream) | 1524 | if (!drv->byte_stream) |
1525 | return -ENOMEM; | 1525 | return -ENOMEM; |
@@ -1537,26 +1537,26 @@ int sst_dsp_init_v2_dpcm(struct snd_soc_platform *platform) | |||
1537 | sst_gains[i].ramp_duration = SST_GAIN_RAMP_DURATION_DEFAULT; | 1537 | sst_gains[i].ramp_duration = SST_GAIN_RAMP_DURATION_DEFAULT; |
1538 | } | 1538 | } |
1539 | 1539 | ||
1540 | ret = snd_soc_add_platform_controls(platform, sst_gain_controls, | 1540 | ret = snd_soc_add_component_controls(component, sst_gain_controls, |
1541 | ARRAY_SIZE(sst_gain_controls)); | 1541 | ARRAY_SIZE(sst_gain_controls)); |
1542 | if (ret) | 1542 | if (ret) |
1543 | return ret; | 1543 | return ret; |
1544 | 1544 | ||
1545 | /* Initialize algo control params */ | 1545 | /* Initialize algo control params */ |
1546 | ret = sst_algo_control_init(platform->dev); | 1546 | ret = sst_algo_control_init(component->dev); |
1547 | if (ret) | 1547 | if (ret) |
1548 | return ret; | 1548 | return ret; |
1549 | ret = snd_soc_add_platform_controls(platform, sst_algo_controls, | 1549 | ret = snd_soc_add_component_controls(component, sst_algo_controls, |
1550 | ARRAY_SIZE(sst_algo_controls)); | 1550 | ARRAY_SIZE(sst_algo_controls)); |
1551 | if (ret) | 1551 | if (ret) |
1552 | return ret; | 1552 | return ret; |
1553 | 1553 | ||
1554 | ret = snd_soc_add_platform_controls(platform, sst_slot_controls, | 1554 | ret = snd_soc_add_component_controls(component, sst_slot_controls, |
1555 | ARRAY_SIZE(sst_slot_controls)); | 1555 | ARRAY_SIZE(sst_slot_controls)); |
1556 | if (ret) | 1556 | if (ret) |
1557 | return ret; | 1557 | return ret; |
1558 | 1558 | ||
1559 | ret = sst_map_modules_to_pipe(platform); | 1559 | ret = sst_map_modules_to_pipe(component); |
1560 | 1560 | ||
1561 | return ret; | 1561 | return ret; |
1562 | } | 1562 | } |
diff --git a/sound/soc/intel/atom/sst-mfld-platform-compress.c b/sound/soc/intel/atom/sst-mfld-platform-compress.c index 1dbcab5a6ff0..6a44b19423cf 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-compress.c +++ b/sound/soc/intel/atom/sst-mfld-platform-compress.c | |||
@@ -107,8 +107,8 @@ static int sst_platform_compr_set_params(struct snd_compr_stream *cstream, | |||
107 | struct snd_sst_params str_params; | 107 | struct snd_sst_params str_params; |
108 | struct sst_compress_cb cb; | 108 | struct sst_compress_cb cb; |
109 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; | 109 | struct snd_soc_pcm_runtime *rtd = cstream->private_data; |
110 | struct snd_soc_platform *platform = rtd->platform; | 110 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
111 | struct sst_data *ctx = snd_soc_platform_get_drvdata(platform); | 111 | struct sst_data *ctx = snd_soc_component_get_drvdata(component); |
112 | 112 | ||
113 | stream = cstream->runtime->private_data; | 113 | stream = cstream->runtime->private_data; |
114 | /* construct fw structure for this*/ | 114 | /* construct fw structure for this*/ |
diff --git a/sound/soc/intel/atom/sst-mfld-platform-pcm.c b/sound/soc/intel/atom/sst-mfld-platform-pcm.c index 43e7fdd19f29..6c36da560877 100644 --- a/sound/soc/intel/atom/sst-mfld-platform-pcm.c +++ b/sound/soc/intel/atom/sst-mfld-platform-pcm.c | |||
@@ -697,26 +697,22 @@ static int sst_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
697 | return retval; | 697 | return retval; |
698 | } | 698 | } |
699 | 699 | ||
700 | static int sst_soc_probe(struct snd_soc_platform *platform) | 700 | static int sst_soc_probe(struct snd_soc_component *component) |
701 | { | 701 | { |
702 | struct sst_data *drv = dev_get_drvdata(platform->dev); | 702 | struct sst_data *drv = dev_get_drvdata(component->dev); |
703 | 703 | ||
704 | drv->soc_card = platform->component.card; | 704 | drv->soc_card = component->card; |
705 | return sst_dsp_init_v2_dpcm(platform); | 705 | return sst_dsp_init_v2_dpcm(component); |
706 | } | 706 | } |
707 | 707 | ||
708 | static const struct snd_soc_platform_driver sst_soc_platform_drv = { | 708 | static const struct snd_soc_component_driver sst_soc_platform_drv = { |
709 | .name = DRV_NAME, | ||
709 | .probe = sst_soc_probe, | 710 | .probe = sst_soc_probe, |
710 | .ops = &sst_platform_ops, | 711 | .ops = &sst_platform_ops, |
711 | .compr_ops = &sst_platform_compr_ops, | 712 | .compr_ops = &sst_platform_compr_ops, |
712 | .pcm_new = sst_pcm_new, | 713 | .pcm_new = sst_pcm_new, |
713 | }; | 714 | }; |
714 | 715 | ||
715 | static const struct snd_soc_component_driver sst_component = { | ||
716 | .name = "sst", | ||
717 | }; | ||
718 | |||
719 | |||
720 | static int sst_platform_probe(struct platform_device *pdev) | 716 | static int sst_platform_probe(struct platform_device *pdev) |
721 | { | 717 | { |
722 | struct sst_data *drv; | 718 | struct sst_data *drv; |
@@ -740,26 +736,16 @@ static int sst_platform_probe(struct platform_device *pdev) | |||
740 | mutex_init(&drv->lock); | 736 | mutex_init(&drv->lock); |
741 | dev_set_drvdata(&pdev->dev, drv); | 737 | dev_set_drvdata(&pdev->dev, drv); |
742 | 738 | ||
743 | ret = snd_soc_register_platform(&pdev->dev, &sst_soc_platform_drv); | 739 | ret = devm_snd_soc_register_component(&pdev->dev, &sst_soc_platform_drv, |
744 | if (ret) { | ||
745 | dev_err(&pdev->dev, "registering soc platform failed\n"); | ||
746 | return ret; | ||
747 | } | ||
748 | |||
749 | ret = snd_soc_register_component(&pdev->dev, &sst_component, | ||
750 | sst_platform_dai, ARRAY_SIZE(sst_platform_dai)); | 740 | sst_platform_dai, ARRAY_SIZE(sst_platform_dai)); |
751 | if (ret) { | 741 | if (ret) |
752 | dev_err(&pdev->dev, "registering cpu dais failed\n"); | 742 | dev_err(&pdev->dev, "registering cpu dais failed\n"); |
753 | snd_soc_unregister_platform(&pdev->dev); | 743 | |
754 | } | ||
755 | return ret; | 744 | return ret; |
756 | } | 745 | } |
757 | 746 | ||
758 | static int sst_platform_remove(struct platform_device *pdev) | 747 | static int sst_platform_remove(struct platform_device *pdev) |
759 | { | 748 | { |
760 | |||
761 | snd_soc_unregister_component(&pdev->dev); | ||
762 | snd_soc_unregister_platform(&pdev->dev); | ||
763 | dev_dbg(&pdev->dev, "sst_platform_remove success\n"); | 749 | dev_dbg(&pdev->dev, "sst_platform_remove success\n"); |
764 | return 0; | 750 | return 0; |
765 | } | 751 | } |
diff --git a/sound/soc/intel/atom/sst-mfld-platform.h b/sound/soc/intel/atom/sst-mfld-platform.h index 31a58c25472c..5f729df57bb5 100644 --- a/sound/soc/intel/atom/sst-mfld-platform.h +++ b/sound/soc/intel/atom/sst-mfld-platform.h | |||
@@ -27,6 +27,8 @@ | |||
27 | extern struct sst_device *sst; | 27 | extern struct sst_device *sst; |
28 | extern const struct snd_compr_ops sst_platform_compr_ops; | 28 | extern const struct snd_compr_ops sst_platform_compr_ops; |
29 | 29 | ||
30 | #define DRV_NAME "sst" | ||
31 | |||
30 | #define SST_MONO 1 | 32 | #define SST_MONO 1 |
31 | #define SST_STEREO 2 | 33 | #define SST_STEREO 2 |
32 | #define SST_MAX_CAP 5 | 34 | #define SST_MAX_CAP 5 |
@@ -155,7 +157,7 @@ struct sst_device { | |||
155 | 157 | ||
156 | struct sst_data; | 158 | struct sst_data; |
157 | 159 | ||
158 | int sst_dsp_init_v2_dpcm(struct snd_soc_platform *platform); | 160 | int sst_dsp_init_v2_dpcm(struct snd_soc_component *component); |
159 | int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute); | 161 | int sst_send_pipe_gains(struct snd_soc_dai *dai, int stream, int mute); |
160 | int send_ssp_cmd(struct snd_soc_dai *dai, const char *id, bool enable); | 162 | int send_ssp_cmd(struct snd_soc_dai *dai, const char *id, bool enable); |
161 | int sst_handle_vb_timer(struct snd_soc_dai *dai, bool enable); | 163 | int sst_handle_vb_timer(struct snd_soc_dai *dai, bool enable); |
diff --git a/sound/soc/intel/baytrail/sst-baytrail-pcm.c b/sound/soc/intel/baytrail/sst-baytrail-pcm.c index c54529320f07..aabb35bf6b96 100644 --- a/sound/soc/intel/baytrail/sst-baytrail-pcm.c +++ b/sound/soc/intel/baytrail/sst-baytrail-pcm.c | |||
@@ -23,6 +23,7 @@ | |||
23 | #include "../common/sst-dsp-priv.h" | 23 | #include "../common/sst-dsp-priv.h" |
24 | #include "../common/sst-dsp.h" | 24 | #include "../common/sst-dsp.h" |
25 | 25 | ||
26 | #define DRV_NAME "byt-dai" | ||
26 | #define BYT_PCM_COUNT 2 | 27 | #define BYT_PCM_COUNT 2 |
27 | 28 | ||
28 | static const struct snd_pcm_hardware sst_byt_pcm_hardware = { | 29 | static const struct snd_pcm_hardware sst_byt_pcm_hardware = { |
@@ -69,8 +70,8 @@ static int sst_byt_pcm_hw_params(struct snd_pcm_substream *substream, | |||
69 | struct snd_pcm_hw_params *params) | 70 | struct snd_pcm_hw_params *params) |
70 | { | 71 | { |
71 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 72 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
72 | struct sst_byt_priv_data *pdata = | 73 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
73 | snd_soc_platform_get_drvdata(rtd->platform); | 74 | struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); |
74 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; | 75 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; |
75 | struct sst_byt *byt = pdata->byt; | 76 | struct sst_byt *byt = pdata->byt; |
76 | u32 rate, bits; | 77 | u32 rate, bits; |
@@ -141,8 +142,8 @@ static int sst_byt_pcm_hw_free(struct snd_pcm_substream *substream) | |||
141 | static int sst_byt_pcm_restore_stream_context(struct snd_pcm_substream *substream) | 142 | static int sst_byt_pcm_restore_stream_context(struct snd_pcm_substream *substream) |
142 | { | 143 | { |
143 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 144 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
144 | struct sst_byt_priv_data *pdata = | 145 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
145 | snd_soc_platform_get_drvdata(rtd->platform); | 146 | struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); |
146 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; | 147 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; |
147 | struct sst_byt *byt = pdata->byt; | 148 | struct sst_byt *byt = pdata->byt; |
148 | int ret; | 149 | int ret; |
@@ -174,8 +175,8 @@ static void sst_byt_pcm_work(struct work_struct *work) | |||
174 | static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | 175 | static int sst_byt_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
175 | { | 176 | { |
176 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 177 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
177 | struct sst_byt_priv_data *pdata = | 178 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
178 | snd_soc_platform_get_drvdata(rtd->platform); | 179 | struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); |
179 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; | 180 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; |
180 | struct sst_byt *byt = pdata->byt; | 181 | struct sst_byt *byt = pdata->byt; |
181 | 182 | ||
@@ -216,8 +217,8 @@ static u32 byt_notify_pointer(struct sst_byt_stream *stream, void *data) | |||
216 | struct snd_pcm_substream *substream = pcm_data->substream; | 217 | struct snd_pcm_substream *substream = pcm_data->substream; |
217 | struct snd_pcm_runtime *runtime = substream->runtime; | 218 | struct snd_pcm_runtime *runtime = substream->runtime; |
218 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 219 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
219 | struct sst_byt_priv_data *pdata = | 220 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
220 | snd_soc_platform_get_drvdata(rtd->platform); | 221 | struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); |
221 | struct sst_byt *byt = pdata->byt; | 222 | struct sst_byt *byt = pdata->byt; |
222 | u32 pos, hw_pos; | 223 | u32 pos, hw_pos; |
223 | 224 | ||
@@ -238,8 +239,8 @@ static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_pcm_substream *substream | |||
238 | { | 239 | { |
239 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 240 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
240 | struct snd_pcm_runtime *runtime = substream->runtime; | 241 | struct snd_pcm_runtime *runtime = substream->runtime; |
241 | struct sst_byt_priv_data *pdata = | 242 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
242 | snd_soc_platform_get_drvdata(rtd->platform); | 243 | struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); |
243 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; | 244 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; |
244 | 245 | ||
245 | dev_dbg(rtd->dev, "PCM: DMA pointer %u bytes\n", pcm_data->hw_ptr); | 246 | dev_dbg(rtd->dev, "PCM: DMA pointer %u bytes\n", pcm_data->hw_ptr); |
@@ -250,8 +251,8 @@ static snd_pcm_uframes_t sst_byt_pcm_pointer(struct snd_pcm_substream *substream | |||
250 | static int sst_byt_pcm_open(struct snd_pcm_substream *substream) | 251 | static int sst_byt_pcm_open(struct snd_pcm_substream *substream) |
251 | { | 252 | { |
252 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 253 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
253 | struct sst_byt_priv_data *pdata = | 254 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
254 | snd_soc_platform_get_drvdata(rtd->platform); | 255 | struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); |
255 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; | 256 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; |
256 | struct sst_byt *byt = pdata->byt; | 257 | struct sst_byt *byt = pdata->byt; |
257 | 258 | ||
@@ -278,8 +279,8 @@ static int sst_byt_pcm_open(struct snd_pcm_substream *substream) | |||
278 | static int sst_byt_pcm_close(struct snd_pcm_substream *substream) | 279 | static int sst_byt_pcm_close(struct snd_pcm_substream *substream) |
279 | { | 280 | { |
280 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 281 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
281 | struct sst_byt_priv_data *pdata = | 282 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
282 | snd_soc_platform_get_drvdata(rtd->platform); | 283 | struct sst_byt_priv_data *pdata = snd_soc_component_get_drvdata(component); |
283 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; | 284 | struct sst_byt_pcm_data *pcm_data = &pdata->pcm[substream->stream]; |
284 | struct sst_byt *byt = pdata->byt; | 285 | struct sst_byt *byt = pdata->byt; |
285 | int ret; | 286 | int ret; |
@@ -324,8 +325,8 @@ static int sst_byt_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
324 | { | 325 | { |
325 | struct snd_pcm *pcm = rtd->pcm; | 326 | struct snd_pcm *pcm = rtd->pcm; |
326 | size_t size; | 327 | size_t size; |
327 | struct snd_soc_platform *platform = rtd->platform; | 328 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
328 | struct sst_pdata *pdata = dev_get_platdata(platform->dev); | 329 | struct sst_pdata *pdata = dev_get_platdata(component->dev); |
329 | int ret = 0; | 330 | int ret = 0; |
330 | 331 | ||
331 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || | 332 | if (pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream || |
@@ -366,21 +367,21 @@ static struct snd_soc_dai_driver byt_dais[] = { | |||
366 | }, | 367 | }, |
367 | }; | 368 | }; |
368 | 369 | ||
369 | static int sst_byt_pcm_probe(struct snd_soc_platform *platform) | 370 | static int sst_byt_pcm_probe(struct snd_soc_component *component) |
370 | { | 371 | { |
371 | struct sst_pdata *plat_data = dev_get_platdata(platform->dev); | 372 | struct sst_pdata *plat_data = dev_get_platdata(component->dev); |
372 | struct sst_byt_priv_data *priv_data; | 373 | struct sst_byt_priv_data *priv_data; |
373 | int i; | 374 | int i; |
374 | 375 | ||
375 | if (!plat_data) | 376 | if (!plat_data) |
376 | return -ENODEV; | 377 | return -ENODEV; |
377 | 378 | ||
378 | priv_data = devm_kzalloc(platform->dev, sizeof(*priv_data), | 379 | priv_data = devm_kzalloc(component->dev, sizeof(*priv_data), |
379 | GFP_KERNEL); | 380 | GFP_KERNEL); |
380 | if (!priv_data) | 381 | if (!priv_data) |
381 | return -ENOMEM; | 382 | return -ENOMEM; |
382 | priv_data->byt = plat_data->dsp; | 383 | priv_data->byt = plat_data->dsp; |
383 | snd_soc_platform_set_drvdata(platform, priv_data); | 384 | snd_soc_component_set_drvdata(component, priv_data); |
384 | 385 | ||
385 | for (i = 0; i < BYT_PCM_COUNT; i++) { | 386 | for (i = 0; i < BYT_PCM_COUNT; i++) { |
386 | mutex_init(&priv_data->pcm[i].mutex); | 387 | mutex_init(&priv_data->pcm[i].mutex); |
@@ -390,22 +391,13 @@ static int sst_byt_pcm_probe(struct snd_soc_platform *platform) | |||
390 | return 0; | 391 | return 0; |
391 | } | 392 | } |
392 | 393 | ||
393 | static int sst_byt_pcm_remove(struct snd_soc_platform *platform) | 394 | static const struct snd_soc_component_driver byt_dai_component = { |
394 | { | 395 | .name = DRV_NAME, |
395 | return 0; | ||
396 | } | ||
397 | |||
398 | static const struct snd_soc_platform_driver byt_soc_platform = { | ||
399 | .probe = sst_byt_pcm_probe, | 396 | .probe = sst_byt_pcm_probe, |
400 | .remove = sst_byt_pcm_remove, | ||
401 | .ops = &sst_byt_pcm_ops, | 397 | .ops = &sst_byt_pcm_ops, |
402 | .pcm_new = sst_byt_pcm_new, | 398 | .pcm_new = sst_byt_pcm_new, |
403 | }; | 399 | }; |
404 | 400 | ||
405 | static const struct snd_soc_component_driver byt_dai_component = { | ||
406 | .name = "byt-dai", | ||
407 | }; | ||
408 | |||
409 | #ifdef CONFIG_PM | 401 | #ifdef CONFIG_PM |
410 | static int sst_byt_pcm_dev_suspend_late(struct device *dev) | 402 | static int sst_byt_pcm_dev_suspend_late(struct device *dev) |
411 | { | 403 | { |
@@ -461,19 +453,13 @@ static int sst_byt_pcm_dev_probe(struct platform_device *pdev) | |||
461 | if (ret < 0) | 453 | if (ret < 0) |
462 | return -ENODEV; | 454 | return -ENODEV; |
463 | 455 | ||
464 | ret = snd_soc_register_platform(&pdev->dev, &byt_soc_platform); | 456 | ret = devm_snd_soc_register_component(&pdev->dev, &byt_dai_component, |
465 | if (ret < 0) | ||
466 | goto err_plat; | ||
467 | |||
468 | ret = snd_soc_register_component(&pdev->dev, &byt_dai_component, | ||
469 | byt_dais, ARRAY_SIZE(byt_dais)); | 457 | byt_dais, ARRAY_SIZE(byt_dais)); |
470 | if (ret < 0) | 458 | if (ret < 0) |
471 | goto err_comp; | 459 | goto err_plat; |
472 | 460 | ||
473 | return 0; | 461 | return 0; |
474 | 462 | ||
475 | err_comp: | ||
476 | snd_soc_unregister_platform(&pdev->dev); | ||
477 | err_plat: | 463 | err_plat: |
478 | sst_byt_dsp_free(&pdev->dev, sst_pdata); | 464 | sst_byt_dsp_free(&pdev->dev, sst_pdata); |
479 | return ret; | 465 | return ret; |
@@ -483,8 +469,6 @@ static int sst_byt_pcm_dev_remove(struct platform_device *pdev) | |||
483 | { | 469 | { |
484 | struct sst_pdata *sst_pdata = dev_get_platdata(&pdev->dev); | 470 | struct sst_pdata *sst_pdata = dev_get_platdata(&pdev->dev); |
485 | 471 | ||
486 | snd_soc_unregister_platform(&pdev->dev); | ||
487 | snd_soc_unregister_component(&pdev->dev); | ||
488 | sst_byt_dsp_free(&pdev->dev, sst_pdata); | 472 | sst_byt_dsp_free(&pdev->dev, sst_pdata); |
489 | 473 | ||
490 | return 0; | 474 | return 0; |
diff --git a/sound/soc/intel/boards/bdw-rt5677.c b/sound/soc/intel/boards/bdw-rt5677.c index 058b8ccedf02..8999f8de119c 100644 --- a/sound/soc/intel/boards/bdw-rt5677.c +++ b/sound/soc/intel/boards/bdw-rt5677.c | |||
@@ -183,7 +183,8 @@ static const struct snd_soc_ops bdw_rt5677_ops = { | |||
183 | 183 | ||
184 | static int bdw_rt5677_rtd_init(struct snd_soc_pcm_runtime *rtd) | 184 | static int bdw_rt5677_rtd_init(struct snd_soc_pcm_runtime *rtd) |
185 | { | 185 | { |
186 | struct sst_pdata *pdata = dev_get_platdata(rtd->platform->dev); | 186 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
187 | struct sst_pdata *pdata = dev_get_platdata(component->dev); | ||
187 | struct sst_hsw *broadwell = pdata->dsp; | 188 | struct sst_hsw *broadwell = pdata->dsp; |
188 | int ret; | 189 | int ret; |
189 | 190 | ||
diff --git a/sound/soc/intel/boards/broadwell.c b/sound/soc/intel/boards/broadwell.c index 6dcbbcefc25b..249b8a3290b8 100644 --- a/sound/soc/intel/boards/broadwell.c +++ b/sound/soc/intel/boards/broadwell.c | |||
@@ -132,7 +132,8 @@ static const struct snd_soc_ops broadwell_rt286_ops = { | |||
132 | 132 | ||
133 | static int broadwell_rtd_init(struct snd_soc_pcm_runtime *rtd) | 133 | static int broadwell_rtd_init(struct snd_soc_pcm_runtime *rtd) |
134 | { | 134 | { |
135 | struct sst_pdata *pdata = dev_get_platdata(rtd->platform->dev); | 135 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
136 | struct sst_pdata *pdata = dev_get_platdata(component->dev); | ||
136 | struct sst_hsw *broadwell = pdata->dsp; | 137 | struct sst_hsw *broadwell = pdata->dsp; |
137 | int ret; | 138 | int ret; |
138 | 139 | ||
diff --git a/sound/soc/intel/boards/haswell.c b/sound/soc/intel/boards/haswell.c index 3c5160779204..eab1f439dd3f 100644 --- a/sound/soc/intel/boards/haswell.c +++ b/sound/soc/intel/boards/haswell.c | |||
@@ -87,7 +87,8 @@ static const struct snd_soc_ops haswell_rt5640_ops = { | |||
87 | 87 | ||
88 | static int haswell_rtd_init(struct snd_soc_pcm_runtime *rtd) | 88 | static int haswell_rtd_init(struct snd_soc_pcm_runtime *rtd) |
89 | { | 89 | { |
90 | struct sst_pdata *pdata = dev_get_platdata(rtd->platform->dev); | 90 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
91 | struct sst_pdata *pdata = dev_get_platdata(component->dev); | ||
91 | struct sst_hsw *haswell = pdata->dsp; | 92 | struct sst_hsw *haswell = pdata->dsp; |
92 | int ret; | 93 | int ret; |
93 | 94 | ||
diff --git a/sound/soc/intel/haswell/sst-haswell-ipc.h b/sound/soc/intel/haswell/sst-haswell-ipc.h index 06d71aefa1fe..fbc14df139e4 100644 --- a/sound/soc/intel/haswell/sst-haswell-ipc.h +++ b/sound/soc/intel/haswell/sst-haswell-ipc.h | |||
@@ -22,6 +22,8 @@ | |||
22 | #include <linux/platform_device.h> | 22 | #include <linux/platform_device.h> |
23 | #include <sound/asound.h> | 23 | #include <sound/asound.h> |
24 | 24 | ||
25 | #define DRV_NAME "haswell-dai" | ||
26 | |||
25 | #define SST_HSW_NO_CHANNELS 4 | 27 | #define SST_HSW_NO_CHANNELS 4 |
26 | #define SST_HSW_MAX_DX_REGIONS 14 | 28 | #define SST_HSW_MAX_DX_REGIONS 14 |
27 | #define SST_HSW_DX_CONTEXT_SIZE (640 * 1024) | 29 | #define SST_HSW_DX_CONTEXT_SIZE (640 * 1024) |
diff --git a/sound/soc/intel/haswell/sst-haswell-pcm.c b/sound/soc/intel/haswell/sst-haswell-pcm.c index c044400540ec..fe2c826e710c 100644 --- a/sound/soc/intel/haswell/sst-haswell-pcm.c +++ b/sound/soc/intel/haswell/sst-haswell-pcm.c | |||
@@ -181,11 +181,11 @@ static inline unsigned int hsw_ipc_to_mixer(u32 value) | |||
181 | static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol, | 181 | static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol, |
182 | struct snd_ctl_elem_value *ucontrol) | 182 | struct snd_ctl_elem_value *ucontrol) |
183 | { | 183 | { |
184 | struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); | 184 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
185 | struct soc_mixer_control *mc = | 185 | struct soc_mixer_control *mc = |
186 | (struct soc_mixer_control *)kcontrol->private_value; | 186 | (struct soc_mixer_control *)kcontrol->private_value; |
187 | struct hsw_priv_data *pdata = | 187 | struct hsw_priv_data *pdata = |
188 | snd_soc_platform_get_drvdata(platform); | 188 | snd_soc_component_get_drvdata(component); |
189 | struct hsw_pcm_data *pcm_data; | 189 | struct hsw_pcm_data *pcm_data; |
190 | struct sst_hsw *hsw = pdata->hsw; | 190 | struct sst_hsw *hsw = pdata->hsw; |
191 | u32 volume; | 191 | u32 volume; |
@@ -230,11 +230,11 @@ static int hsw_stream_volume_put(struct snd_kcontrol *kcontrol, | |||
230 | static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol, | 230 | static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol, |
231 | struct snd_ctl_elem_value *ucontrol) | 231 | struct snd_ctl_elem_value *ucontrol) |
232 | { | 232 | { |
233 | struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); | 233 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
234 | struct soc_mixer_control *mc = | 234 | struct soc_mixer_control *mc = |
235 | (struct soc_mixer_control *)kcontrol->private_value; | 235 | (struct soc_mixer_control *)kcontrol->private_value; |
236 | struct hsw_priv_data *pdata = | 236 | struct hsw_priv_data *pdata = |
237 | snd_soc_platform_get_drvdata(platform); | 237 | snd_soc_component_get_drvdata(component); |
238 | struct hsw_pcm_data *pcm_data; | 238 | struct hsw_pcm_data *pcm_data; |
239 | struct sst_hsw *hsw = pdata->hsw; | 239 | struct sst_hsw *hsw = pdata->hsw; |
240 | u32 volume; | 240 | u32 volume; |
@@ -273,8 +273,8 @@ static int hsw_stream_volume_get(struct snd_kcontrol *kcontrol, | |||
273 | static int hsw_volume_put(struct snd_kcontrol *kcontrol, | 273 | static int hsw_volume_put(struct snd_kcontrol *kcontrol, |
274 | struct snd_ctl_elem_value *ucontrol) | 274 | struct snd_ctl_elem_value *ucontrol) |
275 | { | 275 | { |
276 | struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); | 276 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
277 | struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform); | 277 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
278 | struct sst_hsw *hsw = pdata->hsw; | 278 | struct sst_hsw *hsw = pdata->hsw; |
279 | u32 volume; | 279 | u32 volume; |
280 | 280 | ||
@@ -302,8 +302,8 @@ static int hsw_volume_put(struct snd_kcontrol *kcontrol, | |||
302 | static int hsw_volume_get(struct snd_kcontrol *kcontrol, | 302 | static int hsw_volume_get(struct snd_kcontrol *kcontrol, |
303 | struct snd_ctl_elem_value *ucontrol) | 303 | struct snd_ctl_elem_value *ucontrol) |
304 | { | 304 | { |
305 | struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); | 305 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
306 | struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform); | 306 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
307 | struct sst_hsw *hsw = pdata->hsw; | 307 | struct sst_hsw *hsw = pdata->hsw; |
308 | unsigned int volume = 0; | 308 | unsigned int volume = 0; |
309 | 309 | ||
@@ -322,8 +322,8 @@ static int hsw_volume_get(struct snd_kcontrol *kcontrol, | |||
322 | static int hsw_waves_switch_get(struct snd_kcontrol *kcontrol, | 322 | static int hsw_waves_switch_get(struct snd_kcontrol *kcontrol, |
323 | struct snd_ctl_elem_value *ucontrol) | 323 | struct snd_ctl_elem_value *ucontrol) |
324 | { | 324 | { |
325 | struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); | 325 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
326 | struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform); | 326 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
327 | struct sst_hsw *hsw = pdata->hsw; | 327 | struct sst_hsw *hsw = pdata->hsw; |
328 | enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES; | 328 | enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES; |
329 | 329 | ||
@@ -336,8 +336,8 @@ static int hsw_waves_switch_get(struct snd_kcontrol *kcontrol, | |||
336 | static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol, | 336 | static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol, |
337 | struct snd_ctl_elem_value *ucontrol) | 337 | struct snd_ctl_elem_value *ucontrol) |
338 | { | 338 | { |
339 | struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); | 339 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
340 | struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform); | 340 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
341 | struct sst_hsw *hsw = pdata->hsw; | 341 | struct sst_hsw *hsw = pdata->hsw; |
342 | int ret = 0; | 342 | int ret = 0; |
343 | enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES; | 343 | enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES; |
@@ -370,8 +370,8 @@ static int hsw_waves_switch_put(struct snd_kcontrol *kcontrol, | |||
370 | static int hsw_waves_param_get(struct snd_kcontrol *kcontrol, | 370 | static int hsw_waves_param_get(struct snd_kcontrol *kcontrol, |
371 | struct snd_ctl_elem_value *ucontrol) | 371 | struct snd_ctl_elem_value *ucontrol) |
372 | { | 372 | { |
373 | struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); | 373 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
374 | struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform); | 374 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
375 | struct sst_hsw *hsw = pdata->hsw; | 375 | struct sst_hsw *hsw = pdata->hsw; |
376 | 376 | ||
377 | /* return a matching line from param buffer */ | 377 | /* return a matching line from param buffer */ |
@@ -381,8 +381,8 @@ static int hsw_waves_param_get(struct snd_kcontrol *kcontrol, | |||
381 | static int hsw_waves_param_put(struct snd_kcontrol *kcontrol, | 381 | static int hsw_waves_param_put(struct snd_kcontrol *kcontrol, |
382 | struct snd_ctl_elem_value *ucontrol) | 382 | struct snd_ctl_elem_value *ucontrol) |
383 | { | 383 | { |
384 | struct snd_soc_platform *platform = snd_soc_kcontrol_platform(kcontrol); | 384 | struct snd_soc_component *component = snd_soc_kcontrol_component(kcontrol); |
385 | struct hsw_priv_data *pdata = snd_soc_platform_get_drvdata(platform); | 385 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
386 | struct sst_hsw *hsw = pdata->hsw; | 386 | struct sst_hsw *hsw = pdata->hsw; |
387 | int ret; | 387 | int ret; |
388 | enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES; | 388 | enum sst_hsw_module_id id = SST_HSW_MODULE_WAVES; |
@@ -472,8 +472,8 @@ static int hsw_pcm_hw_params(struct snd_pcm_substream *substream, | |||
472 | { | 472 | { |
473 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 473 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
474 | struct snd_pcm_runtime *runtime = substream->runtime; | 474 | struct snd_pcm_runtime *runtime = substream->runtime; |
475 | struct hsw_priv_data *pdata = | 475 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
476 | snd_soc_platform_get_drvdata(rtd->platform); | 476 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
477 | struct hsw_pcm_data *pcm_data; | 477 | struct hsw_pcm_data *pcm_data; |
478 | struct sst_hsw *hsw = pdata->hsw; | 478 | struct sst_hsw *hsw = pdata->hsw; |
479 | struct sst_module *module_data; | 479 | struct sst_module *module_data; |
@@ -674,8 +674,8 @@ static int hsw_pcm_hw_free(struct snd_pcm_substream *substream) | |||
674 | static int hsw_pcm_trigger(struct snd_pcm_substream *substream, int cmd) | 674 | static int hsw_pcm_trigger(struct snd_pcm_substream *substream, int cmd) |
675 | { | 675 | { |
676 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 676 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
677 | struct hsw_priv_data *pdata = | 677 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
678 | snd_soc_platform_get_drvdata(rtd->platform); | 678 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
679 | struct hsw_pcm_data *pcm_data; | 679 | struct hsw_pcm_data *pcm_data; |
680 | struct sst_hsw_stream *sst_stream; | 680 | struct sst_hsw_stream *sst_stream; |
681 | struct sst_hsw *hsw = pdata->hsw; | 681 | struct sst_hsw *hsw = pdata->hsw; |
@@ -718,8 +718,8 @@ static u32 hsw_notify_pointer(struct sst_hsw_stream *stream, void *data) | |||
718 | struct snd_pcm_substream *substream = pcm_data->substream; | 718 | struct snd_pcm_substream *substream = pcm_data->substream; |
719 | struct snd_pcm_runtime *runtime = substream->runtime; | 719 | struct snd_pcm_runtime *runtime = substream->runtime; |
720 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 720 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
721 | struct hsw_priv_data *pdata = | 721 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
722 | snd_soc_platform_get_drvdata(rtd->platform); | 722 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
723 | struct sst_hsw *hsw = pdata->hsw; | 723 | struct sst_hsw *hsw = pdata->hsw; |
724 | u32 pos; | 724 | u32 pos; |
725 | snd_pcm_uframes_t position = bytes_to_frames(runtime, | 725 | snd_pcm_uframes_t position = bytes_to_frames(runtime, |
@@ -783,8 +783,8 @@ static snd_pcm_uframes_t hsw_pcm_pointer(struct snd_pcm_substream *substream) | |||
783 | { | 783 | { |
784 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 784 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
785 | struct snd_pcm_runtime *runtime = substream->runtime; | 785 | struct snd_pcm_runtime *runtime = substream->runtime; |
786 | struct hsw_priv_data *pdata = | 786 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
787 | snd_soc_platform_get_drvdata(rtd->platform); | 787 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
788 | struct hsw_pcm_data *pcm_data; | 788 | struct hsw_pcm_data *pcm_data; |
789 | struct sst_hsw *hsw = pdata->hsw; | 789 | struct sst_hsw *hsw = pdata->hsw; |
790 | snd_pcm_uframes_t offset; | 790 | snd_pcm_uframes_t offset; |
@@ -807,8 +807,8 @@ static snd_pcm_uframes_t hsw_pcm_pointer(struct snd_pcm_substream *substream) | |||
807 | static int hsw_pcm_open(struct snd_pcm_substream *substream) | 807 | static int hsw_pcm_open(struct snd_pcm_substream *substream) |
808 | { | 808 | { |
809 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 809 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
810 | struct hsw_priv_data *pdata = | 810 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
811 | snd_soc_platform_get_drvdata(rtd->platform); | 811 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
812 | struct hsw_pcm_data *pcm_data; | 812 | struct hsw_pcm_data *pcm_data; |
813 | struct sst_hsw *hsw = pdata->hsw; | 813 | struct sst_hsw *hsw = pdata->hsw; |
814 | int dai; | 814 | int dai; |
@@ -840,8 +840,8 @@ static int hsw_pcm_open(struct snd_pcm_substream *substream) | |||
840 | static int hsw_pcm_close(struct snd_pcm_substream *substream) | 840 | static int hsw_pcm_close(struct snd_pcm_substream *substream) |
841 | { | 841 | { |
842 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 842 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
843 | struct hsw_priv_data *pdata = | 843 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
844 | snd_soc_platform_get_drvdata(rtd->platform); | 844 | struct hsw_priv_data *pdata = snd_soc_component_get_drvdata(component); |
845 | struct hsw_pcm_data *pcm_data; | 845 | struct hsw_pcm_data *pcm_data; |
846 | struct sst_hsw *hsw = pdata->hsw; | 846 | struct sst_hsw *hsw = pdata->hsw; |
847 | int ret, dai; | 847 | int ret, dai; |
@@ -942,9 +942,9 @@ static void hsw_pcm_free_modules(struct hsw_priv_data *pdata) | |||
942 | static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd) | 942 | static int hsw_pcm_new(struct snd_soc_pcm_runtime *rtd) |
943 | { | 943 | { |
944 | struct snd_pcm *pcm = rtd->pcm; | 944 | struct snd_pcm *pcm = rtd->pcm; |
945 | struct snd_soc_platform *platform = rtd->platform; | 945 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
946 | struct sst_pdata *pdata = dev_get_platdata(platform->dev); | 946 | struct sst_pdata *pdata = dev_get_platdata(component->dev); |
947 | struct hsw_priv_data *priv_data = dev_get_drvdata(platform->dev); | 947 | struct hsw_priv_data *priv_data = dev_get_drvdata(component->dev); |
948 | struct device *dev = pdata->dma_dev; | 948 | struct device *dev = pdata->dma_dev; |
949 | int ret = 0; | 949 | int ret = 0; |
950 | 950 | ||
@@ -1052,23 +1052,23 @@ static const struct snd_soc_dapm_route graph[] = { | |||
1052 | {"Analog Capture", NULL, "SSP0 CODEC IN"}, | 1052 | {"Analog Capture", NULL, "SSP0 CODEC IN"}, |
1053 | }; | 1053 | }; |
1054 | 1054 | ||
1055 | static int hsw_pcm_probe(struct snd_soc_platform *platform) | 1055 | static int hsw_pcm_probe(struct snd_soc_component *component) |
1056 | { | 1056 | { |
1057 | struct hsw_priv_data *priv_data = snd_soc_platform_get_drvdata(platform); | 1057 | struct hsw_priv_data *priv_data = snd_soc_component_get_drvdata(component); |
1058 | struct sst_pdata *pdata = dev_get_platdata(platform->dev); | 1058 | struct sst_pdata *pdata = dev_get_platdata(component->dev); |
1059 | struct device *dma_dev, *dev; | 1059 | struct device *dma_dev, *dev; |
1060 | int i, ret = 0; | 1060 | int i, ret = 0; |
1061 | 1061 | ||
1062 | if (!pdata) | 1062 | if (!pdata) |
1063 | return -ENODEV; | 1063 | return -ENODEV; |
1064 | 1064 | ||
1065 | dev = platform->dev; | 1065 | dev = component->dev; |
1066 | dma_dev = pdata->dma_dev; | 1066 | dma_dev = pdata->dma_dev; |
1067 | 1067 | ||
1068 | priv_data->hsw = pdata->dsp; | 1068 | priv_data->hsw = pdata->dsp; |
1069 | priv_data->dev = platform->dev; | 1069 | priv_data->dev = dev; |
1070 | priv_data->pm_state = HSW_PM_STATE_D0; | 1070 | priv_data->pm_state = HSW_PM_STATE_D0; |
1071 | priv_data->soc_card = platform->component.card; | 1071 | priv_data->soc_card = component->card; |
1072 | 1072 | ||
1073 | /* allocate DSP buffer page tables */ | 1073 | /* allocate DSP buffer page tables */ |
1074 | for (i = 0; i < ARRAY_SIZE(hsw_dais); i++) { | 1074 | for (i = 0; i < ARRAY_SIZE(hsw_dais); i++) { |
@@ -1098,11 +1098,10 @@ static int hsw_pcm_probe(struct snd_soc_platform *platform) | |||
1098 | goto err; | 1098 | goto err; |
1099 | 1099 | ||
1100 | /* enable runtime PM with auto suspend */ | 1100 | /* enable runtime PM with auto suspend */ |
1101 | pm_runtime_set_autosuspend_delay(platform->dev, | 1101 | pm_runtime_set_autosuspend_delay(dev, SST_RUNTIME_SUSPEND_DELAY); |
1102 | SST_RUNTIME_SUSPEND_DELAY); | 1102 | pm_runtime_use_autosuspend(dev); |
1103 | pm_runtime_use_autosuspend(platform->dev); | 1103 | pm_runtime_enable(dev); |
1104 | pm_runtime_enable(platform->dev); | 1104 | pm_runtime_idle(dev); |
1105 | pm_runtime_idle(platform->dev); | ||
1106 | 1105 | ||
1107 | return 0; | 1106 | return 0; |
1108 | 1107 | ||
@@ -1116,13 +1115,13 @@ err: | |||
1116 | return ret; | 1115 | return ret; |
1117 | } | 1116 | } |
1118 | 1117 | ||
1119 | static int hsw_pcm_remove(struct snd_soc_platform *platform) | 1118 | static void hsw_pcm_remove(struct snd_soc_component *component) |
1120 | { | 1119 | { |
1121 | struct hsw_priv_data *priv_data = | 1120 | struct hsw_priv_data *priv_data = |
1122 | snd_soc_platform_get_drvdata(platform); | 1121 | snd_soc_component_get_drvdata(component); |
1123 | int i; | 1122 | int i; |
1124 | 1123 | ||
1125 | pm_runtime_disable(platform->dev); | 1124 | pm_runtime_disable(component->dev); |
1126 | hsw_pcm_free_modules(priv_data); | 1125 | hsw_pcm_free_modules(priv_data); |
1127 | 1126 | ||
1128 | for (i = 0; i < ARRAY_SIZE(hsw_dais); i++) { | 1127 | for (i = 0; i < ARRAY_SIZE(hsw_dais); i++) { |
@@ -1131,24 +1130,19 @@ static int hsw_pcm_remove(struct snd_soc_platform *platform) | |||
1131 | if (hsw_dais[i].capture.channels_min) | 1130 | if (hsw_dais[i].capture.channels_min) |
1132 | snd_dma_free_pages(&priv_data->dmab[i][1]); | 1131 | snd_dma_free_pages(&priv_data->dmab[i][1]); |
1133 | } | 1132 | } |
1134 | |||
1135 | return 0; | ||
1136 | } | 1133 | } |
1137 | 1134 | ||
1138 | static const struct snd_soc_platform_driver hsw_soc_platform = { | 1135 | static const struct snd_soc_component_driver hsw_dai_component = { |
1136 | .name = DRV_NAME, | ||
1139 | .probe = hsw_pcm_probe, | 1137 | .probe = hsw_pcm_probe, |
1140 | .remove = hsw_pcm_remove, | 1138 | .remove = hsw_pcm_remove, |
1141 | .ops = &hsw_pcm_ops, | 1139 | .ops = &hsw_pcm_ops, |
1142 | .pcm_new = hsw_pcm_new, | 1140 | .pcm_new = hsw_pcm_new, |
1143 | }; | 1141 | .controls = hsw_volume_controls, |
1144 | 1142 | .num_controls = ARRAY_SIZE(hsw_volume_controls), | |
1145 | static const struct snd_soc_component_driver hsw_dai_component = { | 1143 | .dapm_widgets = widgets, |
1146 | .name = "haswell-dai", | ||
1147 | .controls = hsw_volume_controls, | ||
1148 | .num_controls = ARRAY_SIZE(hsw_volume_controls), | ||
1149 | .dapm_widgets = widgets, | ||
1150 | .num_dapm_widgets = ARRAY_SIZE(widgets), | 1144 | .num_dapm_widgets = ARRAY_SIZE(widgets), |
1151 | .dapm_routes = graph, | 1145 | .dapm_routes = graph, |
1152 | .num_dapm_routes = ARRAY_SIZE(graph), | 1146 | .num_dapm_routes = ARRAY_SIZE(graph), |
1153 | }; | 1147 | }; |
1154 | 1148 | ||
@@ -1172,19 +1166,13 @@ static int hsw_pcm_dev_probe(struct platform_device *pdev) | |||
1172 | priv_data->hsw = sst_pdata->dsp; | 1166 | priv_data->hsw = sst_pdata->dsp; |
1173 | platform_set_drvdata(pdev, priv_data); | 1167 | platform_set_drvdata(pdev, priv_data); |
1174 | 1168 | ||
1175 | ret = snd_soc_register_platform(&pdev->dev, &hsw_soc_platform); | 1169 | ret = devm_snd_soc_register_component(&pdev->dev, &hsw_dai_component, |
1176 | if (ret < 0) | ||
1177 | goto err_plat; | ||
1178 | |||
1179 | ret = snd_soc_register_component(&pdev->dev, &hsw_dai_component, | ||
1180 | hsw_dais, ARRAY_SIZE(hsw_dais)); | 1170 | hsw_dais, ARRAY_SIZE(hsw_dais)); |
1181 | if (ret < 0) | 1171 | if (ret < 0) |
1182 | goto err_comp; | 1172 | goto err_plat; |
1183 | 1173 | ||
1184 | return 0; | 1174 | return 0; |
1185 | 1175 | ||
1186 | err_comp: | ||
1187 | snd_soc_unregister_platform(&pdev->dev); | ||
1188 | err_plat: | 1176 | err_plat: |
1189 | sst_hsw_dsp_free(&pdev->dev, sst_pdata); | 1177 | sst_hsw_dsp_free(&pdev->dev, sst_pdata); |
1190 | return 0; | 1178 | return 0; |
@@ -1194,8 +1182,6 @@ static int hsw_pcm_dev_remove(struct platform_device *pdev) | |||
1194 | { | 1182 | { |
1195 | struct sst_pdata *sst_pdata = dev_get_platdata(&pdev->dev); | 1183 | struct sst_pdata *sst_pdata = dev_get_platdata(&pdev->dev); |
1196 | 1184 | ||
1197 | snd_soc_unregister_platform(&pdev->dev); | ||
1198 | snd_soc_unregister_component(&pdev->dev); | ||
1199 | sst_hsw_dsp_free(&pdev->dev, sst_pdata); | 1185 | sst_hsw_dsp_free(&pdev->dev, sst_pdata); |
1200 | 1186 | ||
1201 | return 0; | 1187 | return 0; |
diff --git a/sound/soc/intel/skylake/skl-debug.c b/sound/soc/intel/skylake/skl-debug.c index dc20d91f62e6..a016455a6ddb 100644 --- a/sound/soc/intel/skylake/skl-debug.c +++ b/sound/soc/intel/skylake/skl-debug.c | |||
@@ -231,7 +231,7 @@ struct skl_debug *skl_debugfs_init(struct skl *skl) | |||
231 | 231 | ||
232 | /* create the debugfs dir with platform component's debugfs as parent */ | 232 | /* create the debugfs dir with platform component's debugfs as parent */ |
233 | d->fs = debugfs_create_dir("dsp", | 233 | d->fs = debugfs_create_dir("dsp", |
234 | skl->platform->component.debugfs_root); | 234 | skl->component->debugfs_root); |
235 | if (IS_ERR(d->fs) || !d->fs) { | 235 | if (IS_ERR(d->fs) || !d->fs) { |
236 | dev_err(&skl->pci->dev, "debugfs root creation failed\n"); | 236 | dev_err(&skl->pci->dev, "debugfs root creation failed\n"); |
237 | return NULL; | 237 | return NULL; |
diff --git a/sound/soc/intel/skylake/skl-pcm.c b/sound/soc/intel/skylake/skl-pcm.c index e46828533826..36a521562cf7 100644 --- a/sound/soc/intel/skylake/skl-pcm.c +++ b/sound/soc/intel/skylake/skl-pcm.c | |||
@@ -1313,23 +1313,23 @@ static int skl_populate_modules(struct skl *skl) | |||
1313 | return ret; | 1313 | return ret; |
1314 | } | 1314 | } |
1315 | 1315 | ||
1316 | static int skl_platform_soc_probe(struct snd_soc_platform *platform) | 1316 | static int skl_platform_soc_probe(struct snd_soc_component *component) |
1317 | { | 1317 | { |
1318 | struct hdac_ext_bus *ebus = dev_get_drvdata(platform->dev); | 1318 | struct hdac_ext_bus *ebus = dev_get_drvdata(component->dev); |
1319 | struct skl *skl = ebus_to_skl(ebus); | 1319 | struct skl *skl = ebus_to_skl(ebus); |
1320 | const struct skl_dsp_ops *ops; | 1320 | const struct skl_dsp_ops *ops; |
1321 | int ret; | 1321 | int ret; |
1322 | 1322 | ||
1323 | pm_runtime_get_sync(platform->dev); | 1323 | pm_runtime_get_sync(component->dev); |
1324 | if ((ebus_to_hbus(ebus))->ppcap) { | 1324 | if ((ebus_to_hbus(ebus))->ppcap) { |
1325 | skl->platform = platform; | 1325 | skl->component = component; |
1326 | 1326 | ||
1327 | /* init debugfs */ | 1327 | /* init debugfs */ |
1328 | skl->debugfs = skl_debugfs_init(skl); | 1328 | skl->debugfs = skl_debugfs_init(skl); |
1329 | 1329 | ||
1330 | ret = skl_tplg_init(platform, ebus); | 1330 | ret = skl_tplg_init(component, ebus); |
1331 | if (ret < 0) { | 1331 | if (ret < 0) { |
1332 | dev_err(platform->dev, "Failed to init topology!\n"); | 1332 | dev_err(component->dev, "Failed to init topology!\n"); |
1333 | return ret; | 1333 | return ret; |
1334 | } | 1334 | } |
1335 | 1335 | ||
@@ -1339,17 +1339,17 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform) | |||
1339 | return -EIO; | 1339 | return -EIO; |
1340 | 1340 | ||
1341 | if (skl->skl_sst->is_first_boot == false) { | 1341 | if (skl->skl_sst->is_first_boot == false) { |
1342 | dev_err(platform->dev, "DSP reports first boot done!!!\n"); | 1342 | dev_err(component->dev, "DSP reports first boot done!!!\n"); |
1343 | return -EIO; | 1343 | return -EIO; |
1344 | } | 1344 | } |
1345 | 1345 | ||
1346 | /* disable dynamic clock gating during fw and lib download */ | 1346 | /* disable dynamic clock gating during fw and lib download */ |
1347 | skl->skl_sst->enable_miscbdcge(platform->dev, false); | 1347 | skl->skl_sst->enable_miscbdcge(component->dev, false); |
1348 | 1348 | ||
1349 | ret = ops->init_fw(platform->dev, skl->skl_sst); | 1349 | ret = ops->init_fw(component->dev, skl->skl_sst); |
1350 | skl->skl_sst->enable_miscbdcge(platform->dev, true); | 1350 | skl->skl_sst->enable_miscbdcge(component->dev, true); |
1351 | if (ret < 0) { | 1351 | if (ret < 0) { |
1352 | dev_err(platform->dev, "Failed to boot first fw: %d\n", ret); | 1352 | dev_err(component->dev, "Failed to boot first fw: %d\n", ret); |
1353 | return ret; | 1353 | return ret; |
1354 | } | 1354 | } |
1355 | skl_populate_modules(skl); | 1355 | skl_populate_modules(skl); |
@@ -1362,22 +1362,20 @@ static int skl_platform_soc_probe(struct snd_soc_platform *platform) | |||
1362 | skl->cfg.astate_cfg); | 1362 | skl->cfg.astate_cfg); |
1363 | } | 1363 | } |
1364 | } | 1364 | } |
1365 | pm_runtime_mark_last_busy(platform->dev); | 1365 | pm_runtime_mark_last_busy(component->dev); |
1366 | pm_runtime_put_autosuspend(platform->dev); | 1366 | pm_runtime_put_autosuspend(component->dev); |
1367 | 1367 | ||
1368 | return 0; | 1368 | return 0; |
1369 | } | 1369 | } |
1370 | static const struct snd_soc_platform_driver skl_platform_drv = { | 1370 | |
1371 | static const struct snd_soc_component_driver skl_component = { | ||
1372 | .name = "pcm", | ||
1371 | .probe = skl_platform_soc_probe, | 1373 | .probe = skl_platform_soc_probe, |
1372 | .ops = &skl_platform_ops, | 1374 | .ops = &skl_platform_ops, |
1373 | .pcm_new = skl_pcm_new, | 1375 | .pcm_new = skl_pcm_new, |
1374 | .pcm_free = skl_pcm_free, | 1376 | .pcm_free = skl_pcm_free, |
1375 | }; | 1377 | }; |
1376 | 1378 | ||
1377 | static const struct snd_soc_component_driver skl_component = { | ||
1378 | .name = "pcm", | ||
1379 | }; | ||
1380 | |||
1381 | int skl_platform_register(struct device *dev) | 1379 | int skl_platform_register(struct device *dev) |
1382 | { | 1380 | { |
1383 | int ret; | 1381 | int ret; |
@@ -1389,12 +1387,6 @@ int skl_platform_register(struct device *dev) | |||
1389 | INIT_LIST_HEAD(&skl->ppl_list); | 1387 | INIT_LIST_HEAD(&skl->ppl_list); |
1390 | INIT_LIST_HEAD(&skl->bind_list); | 1388 | INIT_LIST_HEAD(&skl->bind_list); |
1391 | 1389 | ||
1392 | ret = snd_soc_register_platform(dev, &skl_platform_drv); | ||
1393 | if (ret) { | ||
1394 | dev_err(dev, "soc platform registration failed %d\n", ret); | ||
1395 | return ret; | ||
1396 | } | ||
1397 | |||
1398 | skl->dais = kmemdup(skl_platform_dai, sizeof(skl_platform_dai), | 1390 | skl->dais = kmemdup(skl_platform_dai, sizeof(skl_platform_dai), |
1399 | GFP_KERNEL); | 1391 | GFP_KERNEL); |
1400 | if (!skl->dais) { | 1392 | if (!skl->dais) { |
@@ -1416,18 +1408,12 @@ int skl_platform_register(struct device *dev) | |||
1416 | num_dais += ARRAY_SIZE(skl_fe_dai); | 1408 | num_dais += ARRAY_SIZE(skl_fe_dai); |
1417 | } | 1409 | } |
1418 | 1410 | ||
1419 | ret = snd_soc_register_component(dev, &skl_component, | 1411 | ret = devm_snd_soc_register_component(dev, &skl_component, |
1420 | skl->dais, num_dais); | 1412 | skl->dais, num_dais); |
1421 | if (ret) { | 1413 | if (ret) |
1422 | dev_err(dev, "soc component registration failed %d\n", ret); | 1414 | dev_err(dev, "soc component registration failed %d\n", ret); |
1423 | goto err; | ||
1424 | } | ||
1425 | |||
1426 | return 0; | ||
1427 | err: | 1415 | err: |
1428 | snd_soc_unregister_platform(dev); | ||
1429 | return ret; | 1416 | return ret; |
1430 | |||
1431 | } | 1417 | } |
1432 | 1418 | ||
1433 | int skl_platform_unregister(struct device *dev) | 1419 | int skl_platform_unregister(struct device *dev) |
@@ -1443,8 +1429,6 @@ int skl_platform_unregister(struct device *dev) | |||
1443 | } | 1429 | } |
1444 | } | 1430 | } |
1445 | 1431 | ||
1446 | snd_soc_unregister_component(dev); | ||
1447 | snd_soc_unregister_platform(dev); | ||
1448 | kfree(skl->dais); | 1432 | kfree(skl->dais); |
1449 | 1433 | ||
1450 | return 0; | 1434 | return 0; |
diff --git a/sound/soc/intel/skylake/skl-topology.c b/sound/soc/intel/skylake/skl-topology.c index 73af6e19ebbd..515e4b6d1950 100644 --- a/sound/soc/intel/skylake/skl-topology.c +++ b/sound/soc/intel/skylake/skl-topology.c | |||
@@ -2710,15 +2710,15 @@ static int skl_tplg_get_pvt_data(struct snd_soc_tplg_dapm_widget *tplg_w, | |||
2710 | return 0; | 2710 | return 0; |
2711 | } | 2711 | } |
2712 | 2712 | ||
2713 | static void skl_clear_pin_config(struct snd_soc_platform *platform, | 2713 | static void skl_clear_pin_config(struct snd_soc_component *component, |
2714 | struct snd_soc_dapm_widget *w) | 2714 | struct snd_soc_dapm_widget *w) |
2715 | { | 2715 | { |
2716 | int i; | 2716 | int i; |
2717 | struct skl_module_cfg *mconfig; | 2717 | struct skl_module_cfg *mconfig; |
2718 | struct skl_pipe *pipe; | 2718 | struct skl_pipe *pipe; |
2719 | 2719 | ||
2720 | if (!strncmp(w->dapm->component->name, platform->component.name, | 2720 | if (!strncmp(w->dapm->component->name, component->name, |
2721 | strlen(platform->component.name))) { | 2721 | strlen(component->name))) { |
2722 | mconfig = w->priv; | 2722 | mconfig = w->priv; |
2723 | pipe = mconfig->pipe; | 2723 | pipe = mconfig->pipe; |
2724 | for (i = 0; i < mconfig->module->max_input_pins; i++) { | 2724 | for (i = 0; i < mconfig->module->max_input_pins; i++) { |
@@ -2737,14 +2737,14 @@ static void skl_clear_pin_config(struct snd_soc_platform *platform, | |||
2737 | void skl_cleanup_resources(struct skl *skl) | 2737 | void skl_cleanup_resources(struct skl *skl) |
2738 | { | 2738 | { |
2739 | struct skl_sst *ctx = skl->skl_sst; | 2739 | struct skl_sst *ctx = skl->skl_sst; |
2740 | struct snd_soc_platform *soc_platform = skl->platform; | 2740 | struct snd_soc_component *soc_component = skl->component; |
2741 | struct snd_soc_dapm_widget *w; | 2741 | struct snd_soc_dapm_widget *w; |
2742 | struct snd_soc_card *card; | 2742 | struct snd_soc_card *card; |
2743 | 2743 | ||
2744 | if (soc_platform == NULL) | 2744 | if (soc_component == NULL) |
2745 | return; | 2745 | return; |
2746 | 2746 | ||
2747 | card = soc_platform->component.card; | 2747 | card = soc_component->card; |
2748 | if (!card || !card->instantiated) | 2748 | if (!card || !card->instantiated) |
2749 | return; | 2749 | return; |
2750 | 2750 | ||
@@ -2753,7 +2753,7 @@ void skl_cleanup_resources(struct skl *skl) | |||
2753 | 2753 | ||
2754 | list_for_each_entry(w, &card->widgets, list) { | 2754 | list_for_each_entry(w, &card->widgets, list) { |
2755 | if (is_skl_dsp_widget_type(w) && (w->priv != NULL)) | 2755 | if (is_skl_dsp_widget_type(w) && (w->priv != NULL)) |
2756 | skl_clear_pin_config(soc_platform, w); | 2756 | skl_clear_pin_config(soc_component, w); |
2757 | } | 2757 | } |
2758 | 2758 | ||
2759 | skl_clear_module_cnt(ctx->dsp); | 2759 | skl_clear_module_cnt(ctx->dsp); |
@@ -3400,19 +3400,19 @@ static struct snd_soc_tplg_ops skl_tplg_ops = { | |||
3400 | * widgets in a pipelines, so this helper - skl_tplg_create_pipe_widget_list() | 3400 | * widgets in a pipelines, so this helper - skl_tplg_create_pipe_widget_list() |
3401 | * helps to get the SKL type widgets in that pipeline | 3401 | * helps to get the SKL type widgets in that pipeline |
3402 | */ | 3402 | */ |
3403 | static int skl_tplg_create_pipe_widget_list(struct snd_soc_platform *platform) | 3403 | static int skl_tplg_create_pipe_widget_list(struct snd_soc_component *component) |
3404 | { | 3404 | { |
3405 | struct snd_soc_dapm_widget *w; | 3405 | struct snd_soc_dapm_widget *w; |
3406 | struct skl_module_cfg *mcfg = NULL; | 3406 | struct skl_module_cfg *mcfg = NULL; |
3407 | struct skl_pipe_module *p_module = NULL; | 3407 | struct skl_pipe_module *p_module = NULL; |
3408 | struct skl_pipe *pipe; | 3408 | struct skl_pipe *pipe; |
3409 | 3409 | ||
3410 | list_for_each_entry(w, &platform->component.card->widgets, list) { | 3410 | list_for_each_entry(w, &component->card->widgets, list) { |
3411 | if (is_skl_dsp_widget_type(w) && w->priv != NULL) { | 3411 | if (is_skl_dsp_widget_type(w) && w->priv != NULL) { |
3412 | mcfg = w->priv; | 3412 | mcfg = w->priv; |
3413 | pipe = mcfg->pipe; | 3413 | pipe = mcfg->pipe; |
3414 | 3414 | ||
3415 | p_module = devm_kzalloc(platform->dev, | 3415 | p_module = devm_kzalloc(component->dev, |
3416 | sizeof(*p_module), GFP_KERNEL); | 3416 | sizeof(*p_module), GFP_KERNEL); |
3417 | if (!p_module) | 3417 | if (!p_module) |
3418 | return -ENOMEM; | 3418 | return -ENOMEM; |
@@ -3455,7 +3455,7 @@ static void skl_tplg_set_pipe_type(struct skl *skl, struct skl_pipe *pipe) | |||
3455 | /* | 3455 | /* |
3456 | * SKL topology init routine | 3456 | * SKL topology init routine |
3457 | */ | 3457 | */ |
3458 | int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus) | 3458 | int skl_tplg_init(struct snd_soc_component *component, struct hdac_ext_bus *ebus) |
3459 | { | 3459 | { |
3460 | int ret; | 3460 | int ret; |
3461 | const struct firmware *fw; | 3461 | const struct firmware *fw; |
@@ -3479,7 +3479,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus) | |||
3479 | * The complete tplg for SKL is loaded as index 0, we don't use | 3479 | * The complete tplg for SKL is loaded as index 0, we don't use |
3480 | * any other index | 3480 | * any other index |
3481 | */ | 3481 | */ |
3482 | ret = snd_soc_tplg_component_load(&platform->component, | 3482 | ret = snd_soc_tplg_component_load(component, |
3483 | &skl_tplg_ops, fw, 0); | 3483 | &skl_tplg_ops, fw, 0); |
3484 | if (ret < 0) { | 3484 | if (ret < 0) { |
3485 | dev_err(bus->dev, "tplg component load failed%d\n", ret); | 3485 | dev_err(bus->dev, "tplg component load failed%d\n", ret); |
@@ -3491,7 +3491,7 @@ int skl_tplg_init(struct snd_soc_platform *platform, struct hdac_ext_bus *ebus) | |||
3491 | skl->resource.max_mem = SKL_FW_MAX_MEM; | 3491 | skl->resource.max_mem = SKL_FW_MAX_MEM; |
3492 | 3492 | ||
3493 | skl->tplg = fw; | 3493 | skl->tplg = fw; |
3494 | ret = skl_tplg_create_pipe_widget_list(platform); | 3494 | ret = skl_tplg_create_pipe_widget_list(component); |
3495 | if (ret < 0) | 3495 | if (ret < 0) |
3496 | return ret; | 3496 | return ret; |
3497 | 3497 | ||
diff --git a/sound/soc/intel/skylake/skl-topology.h b/sound/soc/intel/skylake/skl-topology.h index b6496513fe55..87c946835705 100644 --- a/sound/soc/intel/skylake/skl-topology.h +++ b/sound/soc/intel/skylake/skl-topology.h | |||
@@ -460,7 +460,7 @@ int skl_dsp_set_dma_control(struct skl_sst *ctx, u32 *caps, | |||
460 | u32 caps_size, u32 node_id); | 460 | u32 caps_size, u32 node_id); |
461 | void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai, | 461 | void skl_tplg_set_be_dmic_config(struct snd_soc_dai *dai, |
462 | struct skl_pipe_params *params, int stream); | 462 | struct skl_pipe_params *params, int stream); |
463 | int skl_tplg_init(struct snd_soc_platform *platform, | 463 | int skl_tplg_init(struct snd_soc_component *component, |
464 | struct hdac_ext_bus *ebus); | 464 | struct hdac_ext_bus *ebus); |
465 | struct skl_module_cfg *skl_tplg_fe_get_cpr_module( | 465 | struct skl_module_cfg *skl_tplg_fe_get_cpr_module( |
466 | struct snd_soc_dai *dai, int stream); | 466 | struct snd_soc_dai *dai, int stream); |
diff --git a/sound/soc/intel/skylake/skl.h b/sound/soc/intel/skylake/skl.h index 2d13f3fd988a..ca46ad1d0a08 100644 --- a/sound/soc/intel/skylake/skl.h +++ b/sound/soc/intel/skylake/skl.h | |||
@@ -74,7 +74,7 @@ struct skl { | |||
74 | struct platform_device *dmic_dev; | 74 | struct platform_device *dmic_dev; |
75 | struct platform_device *i2s_dev; | 75 | struct platform_device *i2s_dev; |
76 | struct platform_device *clk_dev; | 76 | struct platform_device *clk_dev; |
77 | struct snd_soc_platform *platform; | 77 | struct snd_soc_component *component; |
78 | struct snd_soc_dai_driver *dais; | 78 | struct snd_soc_dai_driver *dais; |
79 | 79 | ||
80 | struct nhlt_acpi_table *nhlt; /* nhlt ptr */ | 80 | struct nhlt_acpi_table *nhlt; /* nhlt ptr */ |
diff --git a/sound/soc/kirkwood/kirkwood-dma.c b/sound/soc/kirkwood/kirkwood-dma.c index 505b0ff03c3b..c6a58520d377 100644 --- a/sound/soc/kirkwood/kirkwood-dma.c +++ b/sound/soc/kirkwood/kirkwood-dma.c | |||
@@ -318,7 +318,8 @@ static void kirkwood_dma_free_dma_buffers(struct snd_pcm *pcm) | |||
318 | } | 318 | } |
319 | } | 319 | } |
320 | 320 | ||
321 | const struct snd_soc_platform_driver kirkwood_soc_platform = { | 321 | const struct snd_soc_component_driver kirkwood_soc_component = { |
322 | .name = DRV_NAME, | ||
322 | .ops = &kirkwood_dma_ops, | 323 | .ops = &kirkwood_dma_ops, |
323 | .pcm_new = kirkwood_dma_new, | 324 | .pcm_new = kirkwood_dma_new, |
324 | .pcm_free = kirkwood_dma_free_dma_buffers, | 325 | .pcm_free = kirkwood_dma_free_dma_buffers, |
diff --git a/sound/soc/kirkwood/kirkwood-i2s.c b/sound/soc/kirkwood/kirkwood-i2s.c index 105a73cc5158..9a2777b72dcd 100644 --- a/sound/soc/kirkwood/kirkwood-i2s.c +++ b/sound/soc/kirkwood/kirkwood-i2s.c | |||
@@ -26,8 +26,6 @@ | |||
26 | 26 | ||
27 | #include "kirkwood.h" | 27 | #include "kirkwood.h" |
28 | 28 | ||
29 | #define DRV_NAME "mvebu-audio" | ||
30 | |||
31 | #define KIRKWOOD_I2S_FORMATS \ | 29 | #define KIRKWOOD_I2S_FORMATS \ |
32 | (SNDRV_PCM_FMTBIT_S16_LE | \ | 30 | (SNDRV_PCM_FMTBIT_S16_LE | \ |
33 | SNDRV_PCM_FMTBIT_S24_LE | \ | 31 | SNDRV_PCM_FMTBIT_S24_LE | \ |
@@ -524,10 +522,6 @@ static struct snd_soc_dai_driver kirkwood_i2s_dai_extclk[2] = { | |||
524 | }, | 522 | }, |
525 | }; | 523 | }; |
526 | 524 | ||
527 | static const struct snd_soc_component_driver kirkwood_i2s_component = { | ||
528 | .name = DRV_NAME, | ||
529 | }; | ||
530 | |||
531 | static int kirkwood_i2s_dev_probe(struct platform_device *pdev) | 525 | static int kirkwood_i2s_dev_probe(struct platform_device *pdev) |
532 | { | 526 | { |
533 | struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data; | 527 | struct kirkwood_asoc_platform_data *data = pdev->dev.platform_data; |
@@ -601,24 +595,17 @@ static int kirkwood_i2s_dev_probe(struct platform_device *pdev) | |||
601 | priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_128; | 595 | priv->ctl_rec |= KIRKWOOD_RECCTL_BURST_128; |
602 | } | 596 | } |
603 | 597 | ||
604 | err = snd_soc_register_component(&pdev->dev, &kirkwood_i2s_component, | 598 | err = devm_snd_soc_register_component(&pdev->dev, &kirkwood_soc_component, |
605 | soc_dai, 2); | 599 | soc_dai, 2); |
606 | if (err) { | 600 | if (err) { |
607 | dev_err(&pdev->dev, "snd_soc_register_component failed\n"); | 601 | dev_err(&pdev->dev, "snd_soc_register_component failed\n"); |
608 | goto err_component; | 602 | goto err_component; |
609 | } | 603 | } |
610 | 604 | ||
611 | err = snd_soc_register_platform(&pdev->dev, &kirkwood_soc_platform); | ||
612 | if (err) { | ||
613 | dev_err(&pdev->dev, "snd_soc_register_platform failed\n"); | ||
614 | goto err_platform; | ||
615 | } | ||
616 | |||
617 | kirkwood_i2s_init(priv); | 605 | kirkwood_i2s_init(priv); |
618 | 606 | ||
619 | return 0; | 607 | return 0; |
620 | err_platform: | 608 | |
621 | snd_soc_unregister_component(&pdev->dev); | ||
622 | err_component: | 609 | err_component: |
623 | if (!IS_ERR(priv->extclk)) | 610 | if (!IS_ERR(priv->extclk)) |
624 | clk_disable_unprepare(priv->extclk); | 611 | clk_disable_unprepare(priv->extclk); |
@@ -631,9 +618,6 @@ static int kirkwood_i2s_dev_remove(struct platform_device *pdev) | |||
631 | { | 618 | { |
632 | struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); | 619 | struct kirkwood_dma_data *priv = dev_get_drvdata(&pdev->dev); |
633 | 620 | ||
634 | snd_soc_unregister_platform(&pdev->dev); | ||
635 | snd_soc_unregister_component(&pdev->dev); | ||
636 | |||
637 | if (!IS_ERR(priv->extclk)) | 621 | if (!IS_ERR(priv->extclk)) |
638 | clk_disable_unprepare(priv->extclk); | 622 | clk_disable_unprepare(priv->extclk); |
639 | clk_disable_unprepare(priv->clk); | 623 | clk_disable_unprepare(priv->clk); |
diff --git a/sound/soc/kirkwood/kirkwood.h b/sound/soc/kirkwood/kirkwood.h index 783cb1a4f30e..c13ee5f69446 100644 --- a/sound/soc/kirkwood/kirkwood.h +++ b/sound/soc/kirkwood/kirkwood.h | |||
@@ -12,6 +12,8 @@ | |||
12 | #ifndef _KIRKWOOD_AUDIO_H | 12 | #ifndef _KIRKWOOD_AUDIO_H |
13 | #define _KIRKWOOD_AUDIO_H | 13 | #define _KIRKWOOD_AUDIO_H |
14 | 14 | ||
15 | #define DRV_NAME "mvebu-audio" | ||
16 | |||
15 | #define KIRKWOOD_RECORD_WIN 0 | 17 | #define KIRKWOOD_RECORD_WIN 0 |
16 | #define KIRKWOOD_PLAYBACK_WIN 1 | 18 | #define KIRKWOOD_PLAYBACK_WIN 1 |
17 | #define KIRKWOOD_MAX_AUDIO_WIN 2 | 19 | #define KIRKWOOD_MAX_AUDIO_WIN 2 |
@@ -143,6 +145,6 @@ struct kirkwood_dma_data { | |||
143 | int burst; | 145 | int burst; |
144 | }; | 146 | }; |
145 | 147 | ||
146 | extern const struct snd_soc_platform_driver kirkwood_soc_platform; | 148 | extern const struct snd_soc_component_driver kirkwood_soc_component; |
147 | 149 | ||
148 | #endif | 150 | #endif |
diff --git a/sound/soc/mediatek/common/mtk-afe-fe-dai.c b/sound/soc/mediatek/common/mtk-afe-fe-dai.c index ac231d33d8fe..c91e5f4cd902 100644 --- a/sound/soc/mediatek/common/mtk-afe-fe-dai.c +++ b/sound/soc/mediatek/common/mtk-afe-fe-dai.c | |||
@@ -18,6 +18,7 @@ | |||
18 | #include <linux/pm_runtime.h> | 18 | #include <linux/pm_runtime.h> |
19 | #include <linux/regmap.h> | 19 | #include <linux/regmap.h> |
20 | #include <sound/soc.h> | 20 | #include <sound/soc.h> |
21 | #include "mtk-afe-platform-driver.h" | ||
21 | #include "mtk-afe-fe-dai.h" | 22 | #include "mtk-afe-fe-dai.h" |
22 | #include "mtk-base-afe.h" | 23 | #include "mtk-base-afe.h" |
23 | 24 | ||
@@ -43,7 +44,8 @@ int mtk_afe_fe_startup(struct snd_pcm_substream *substream, | |||
43 | struct snd_soc_dai *dai) | 44 | struct snd_soc_dai *dai) |
44 | { | 45 | { |
45 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 46 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
46 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 47 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
48 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
47 | struct snd_pcm_runtime *runtime = substream->runtime; | 49 | struct snd_pcm_runtime *runtime = substream->runtime; |
48 | int memif_num = rtd->cpu_dai->id; | 50 | int memif_num = rtd->cpu_dai->id; |
49 | struct mtk_base_afe_memif *memif = &afe->memif[memif_num]; | 51 | struct mtk_base_afe_memif *memif = &afe->memif[memif_num]; |
@@ -105,7 +107,8 @@ void mtk_afe_fe_shutdown(struct snd_pcm_substream *substream, | |||
105 | struct snd_soc_dai *dai) | 107 | struct snd_soc_dai *dai) |
106 | { | 108 | { |
107 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 109 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
108 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 110 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
111 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
109 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; | 112 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; |
110 | int irq_id; | 113 | int irq_id; |
111 | 114 | ||
@@ -128,7 +131,8 @@ int mtk_afe_fe_hw_params(struct snd_pcm_substream *substream, | |||
128 | struct snd_soc_dai *dai) | 131 | struct snd_soc_dai *dai) |
129 | { | 132 | { |
130 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 133 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
131 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 134 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
135 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
132 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; | 136 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; |
133 | int msb_at_bit33 = 0; | 137 | int msb_at_bit33 = 0; |
134 | int ret, fs = 0; | 138 | int ret, fs = 0; |
@@ -192,7 +196,8 @@ int mtk_afe_fe_trigger(struct snd_pcm_substream *substream, int cmd, | |||
192 | { | 196 | { |
193 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 197 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
194 | struct snd_pcm_runtime * const runtime = substream->runtime; | 198 | struct snd_pcm_runtime * const runtime = substream->runtime; |
195 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 199 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
200 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
196 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; | 201 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; |
197 | struct mtk_base_afe_irq *irqs = &afe->irqs[memif->irq_usage]; | 202 | struct mtk_base_afe_irq *irqs = &afe->irqs[memif->irq_usage]; |
198 | const struct mtk_base_irq_data *irq_data = irqs->irq_data; | 203 | const struct mtk_base_irq_data *irq_data = irqs->irq_data; |
@@ -255,7 +260,8 @@ int mtk_afe_fe_prepare(struct snd_pcm_substream *substream, | |||
255 | struct snd_soc_dai *dai) | 260 | struct snd_soc_dai *dai) |
256 | { | 261 | { |
257 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 262 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
258 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 263 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
264 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
259 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; | 265 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; |
260 | int hd_audio = 0; | 266 | int hd_audio = 0; |
261 | 267 | ||
diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.c b/sound/soc/mediatek/common/mtk-afe-platform-driver.c index 82d439c15f4e..53215b52e4f2 100644 --- a/sound/soc/mediatek/common/mtk-afe-platform-driver.c +++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.c | |||
@@ -25,7 +25,8 @@ static snd_pcm_uframes_t mtk_afe_pcm_pointer | |||
25 | (struct snd_pcm_substream *substream) | 25 | (struct snd_pcm_substream *substream) |
26 | { | 26 | { |
27 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 27 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
28 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 28 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
29 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
29 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; | 30 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; |
30 | const struct mtk_base_memif_data *memif_data = memif->data; | 31 | const struct mtk_base_memif_data *memif_data = memif->data; |
31 | struct regmap *regmap = afe->regmap; | 32 | struct regmap *regmap = afe->regmap; |
@@ -65,7 +66,8 @@ static int mtk_afe_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
65 | size_t size; | 66 | size_t size; |
66 | struct snd_card *card = rtd->card->snd_card; | 67 | struct snd_card *card = rtd->card->snd_card; |
67 | struct snd_pcm *pcm = rtd->pcm; | 68 | struct snd_pcm *pcm = rtd->pcm; |
68 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 69 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
70 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
69 | 71 | ||
70 | size = afe->mtk_afe_hardware->buffer_bytes_max; | 72 | size = afe->mtk_afe_hardware->buffer_bytes_max; |
71 | return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, | 73 | return snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV, |
@@ -77,7 +79,8 @@ static void mtk_afe_pcm_free(struct snd_pcm *pcm) | |||
77 | snd_pcm_lib_preallocate_free_for_all(pcm); | 79 | snd_pcm_lib_preallocate_free_for_all(pcm); |
78 | } | 80 | } |
79 | 81 | ||
80 | const struct snd_soc_platform_driver mtk_afe_pcm_platform = { | 82 | const struct snd_soc_component_driver mtk_afe_pcm_platform = { |
83 | .name = AFE_PCM_NAME, | ||
81 | .ops = &mtk_afe_pcm_ops, | 84 | .ops = &mtk_afe_pcm_ops, |
82 | .pcm_new = mtk_afe_pcm_new, | 85 | .pcm_new = mtk_afe_pcm_new, |
83 | .pcm_free = mtk_afe_pcm_free, | 86 | .pcm_free = mtk_afe_pcm_free, |
diff --git a/sound/soc/mediatek/common/mtk-afe-platform-driver.h b/sound/soc/mediatek/common/mtk-afe-platform-driver.h index a973fc9253b4..8dcdbed959ea 100644 --- a/sound/soc/mediatek/common/mtk-afe-platform-driver.h +++ b/sound/soc/mediatek/common/mtk-afe-platform-driver.h | |||
@@ -17,7 +17,8 @@ | |||
17 | #ifndef _MTK_AFE_PLATFORM_DRIVER_H_ | 17 | #ifndef _MTK_AFE_PLATFORM_DRIVER_H_ |
18 | #define _MTK_AFE_PLATFORM_DRIVER_H_ | 18 | #define _MTK_AFE_PLATFORM_DRIVER_H_ |
19 | 19 | ||
20 | extern const struct snd_soc_platform_driver mtk_afe_pcm_platform; | 20 | #define AFE_PCM_NAME "mtk-afe-pcm" |
21 | extern const struct snd_soc_component_driver mtk_afe_pcm_platform; | ||
21 | 22 | ||
22 | #endif | 23 | #endif |
23 | 24 | ||
diff --git a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c index d68b53f7cefe..f7e0702d92f8 100644 --- a/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c +++ b/sound/soc/mediatek/mt2701/mt2701-afe-pcm.c | |||
@@ -93,7 +93,8 @@ static int mt2701_afe_i2s_startup(struct snd_pcm_substream *substream, | |||
93 | struct snd_soc_dai *dai) | 93 | struct snd_soc_dai *dai) |
94 | { | 94 | { |
95 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 95 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
96 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 96 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
97 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
97 | int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); | 98 | int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); |
98 | 99 | ||
99 | if (i2s_num < 0) | 100 | if (i2s_num < 0) |
@@ -108,7 +109,8 @@ static int mt2701_afe_i2s_path_shutdown(struct snd_pcm_substream *substream, | |||
108 | int dir_invert) | 109 | int dir_invert) |
109 | { | 110 | { |
110 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 111 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
111 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 112 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
113 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
112 | struct mt2701_afe_private *afe_priv = afe->platform_priv; | 114 | struct mt2701_afe_private *afe_priv = afe->platform_priv; |
113 | struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[i2s_num]; | 115 | struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[i2s_num]; |
114 | const struct mt2701_i2s_data *i2s_data; | 116 | const struct mt2701_i2s_data *i2s_data; |
@@ -144,7 +146,8 @@ static void mt2701_afe_i2s_shutdown(struct snd_pcm_substream *substream, | |||
144 | struct snd_soc_dai *dai) | 146 | struct snd_soc_dai *dai) |
145 | { | 147 | { |
146 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 148 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
147 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 149 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
150 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
148 | struct mt2701_afe_private *afe_priv = afe->platform_priv; | 151 | struct mt2701_afe_private *afe_priv = afe->platform_priv; |
149 | int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); | 152 | int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); |
150 | struct mt2701_i2s_path *i2s_path; | 153 | struct mt2701_i2s_path *i2s_path; |
@@ -176,7 +179,8 @@ static int mt2701_i2s_path_prepare_enable(struct snd_pcm_substream *substream, | |||
176 | int dir_invert) | 179 | int dir_invert) |
177 | { | 180 | { |
178 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 181 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
179 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 182 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
183 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
180 | struct mt2701_afe_private *afe_priv = afe->platform_priv; | 184 | struct mt2701_afe_private *afe_priv = afe->platform_priv; |
181 | struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[i2s_num]; | 185 | struct mt2701_i2s_path *i2s_path = &afe_priv->i2s_path[i2s_num]; |
182 | const struct mt2701_i2s_data *i2s_data; | 186 | const struct mt2701_i2s_data *i2s_data; |
@@ -247,7 +251,8 @@ static int mt2701_afe_i2s_prepare(struct snd_pcm_substream *substream, | |||
247 | { | 251 | { |
248 | int clk_domain; | 252 | int clk_domain; |
249 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 253 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
250 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 254 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
255 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
251 | struct mt2701_afe_private *afe_priv = afe->platform_priv; | 256 | struct mt2701_afe_private *afe_priv = afe->platform_priv; |
252 | int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); | 257 | int i2s_num = mt2701_dai_num_to_i2s(afe, dai->id); |
253 | struct mt2701_i2s_path *i2s_path; | 258 | struct mt2701_i2s_path *i2s_path; |
@@ -312,7 +317,8 @@ static int mt2701_btmrg_startup(struct snd_pcm_substream *substream, | |||
312 | struct snd_soc_dai *dai) | 317 | struct snd_soc_dai *dai) |
313 | { | 318 | { |
314 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 319 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
315 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 320 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
321 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
316 | struct mt2701_afe_private *afe_priv = afe->platform_priv; | 322 | struct mt2701_afe_private *afe_priv = afe->platform_priv; |
317 | int ret; | 323 | int ret; |
318 | 324 | ||
@@ -329,7 +335,8 @@ static int mt2701_btmrg_hw_params(struct snd_pcm_substream *substream, | |||
329 | struct snd_soc_dai *dai) | 335 | struct snd_soc_dai *dai) |
330 | { | 336 | { |
331 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 337 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
332 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 338 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
339 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
333 | int stream_fs; | 340 | int stream_fs; |
334 | u32 val, msk; | 341 | u32 val, msk; |
335 | 342 | ||
@@ -372,7 +379,8 @@ static void mt2701_btmrg_shutdown(struct snd_pcm_substream *substream, | |||
372 | struct snd_soc_dai *dai) | 379 | struct snd_soc_dai *dai) |
373 | { | 380 | { |
374 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 381 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
375 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 382 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
383 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
376 | struct mt2701_afe_private *afe_priv = afe->platform_priv; | 384 | struct mt2701_afe_private *afe_priv = afe->platform_priv; |
377 | 385 | ||
378 | /* if the other direction stream is not occupied */ | 386 | /* if the other direction stream is not occupied */ |
@@ -392,7 +400,8 @@ static int mt2701_simple_fe_startup(struct snd_pcm_substream *substream, | |||
392 | struct snd_soc_dai *dai) | 400 | struct snd_soc_dai *dai) |
393 | { | 401 | { |
394 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 402 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
395 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 403 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
404 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
396 | int stream_dir = substream->stream; | 405 | int stream_dir = substream->stream; |
397 | int memif_num = rtd->cpu_dai->id; | 406 | int memif_num = rtd->cpu_dai->id; |
398 | struct mtk_base_afe_memif *memif_tmp; | 407 | struct mtk_base_afe_memif *memif_tmp; |
@@ -414,7 +423,8 @@ static int mt2701_simple_fe_hw_params(struct snd_pcm_substream *substream, | |||
414 | struct snd_soc_dai *dai) | 423 | struct snd_soc_dai *dai) |
415 | { | 424 | { |
416 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 425 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
417 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 426 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
427 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
418 | int stream_dir = substream->stream; | 428 | int stream_dir = substream->stream; |
419 | 429 | ||
420 | /* single DL use PAIR_INTERLEAVE */ | 430 | /* single DL use PAIR_INTERLEAVE */ |
@@ -431,7 +441,8 @@ static int mt2701_dlm_fe_startup(struct snd_pcm_substream *substream, | |||
431 | struct snd_soc_dai *dai) | 441 | struct snd_soc_dai *dai) |
432 | { | 442 | { |
433 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 443 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
434 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 444 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
445 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
435 | struct mtk_base_afe_memif *memif_tmp; | 446 | struct mtk_base_afe_memif *memif_tmp; |
436 | const struct mtk_base_memif_data *memif_data; | 447 | const struct mtk_base_memif_data *memif_data; |
437 | int i; | 448 | int i; |
@@ -458,7 +469,8 @@ static void mt2701_dlm_fe_shutdown(struct snd_pcm_substream *substream, | |||
458 | struct snd_soc_dai *dai) | 469 | struct snd_soc_dai *dai) |
459 | { | 470 | { |
460 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 471 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
461 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 472 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
473 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
462 | const struct mtk_base_memif_data *memif_data; | 474 | const struct mtk_base_memif_data *memif_data; |
463 | int i; | 475 | int i; |
464 | 476 | ||
@@ -477,7 +489,8 @@ static int mt2701_dlm_fe_hw_params(struct snd_pcm_substream *substream, | |||
477 | struct snd_soc_dai *dai) | 489 | struct snd_soc_dai *dai) |
478 | { | 490 | { |
479 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 491 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
480 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 492 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
493 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
481 | int channels = params_channels(params); | 494 | int channels = params_channels(params); |
482 | 495 | ||
483 | regmap_update_bits(afe->regmap, | 496 | regmap_update_bits(afe->regmap, |
@@ -500,7 +513,8 @@ static int mt2701_dlm_fe_trigger(struct snd_pcm_substream *substream, | |||
500 | int cmd, struct snd_soc_dai *dai) | 513 | int cmd, struct snd_soc_dai *dai) |
501 | { | 514 | { |
502 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 515 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
503 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 516 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
517 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
504 | struct mtk_base_afe_memif *memif_tmp = &afe->memif[MT2701_MEMIF_DL1]; | 518 | struct mtk_base_afe_memif *memif_tmp = &afe->memif[MT2701_MEMIF_DL1]; |
505 | 519 | ||
506 | switch (cmd) { | 520 | switch (cmd) { |
@@ -1517,7 +1531,8 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev) | |||
1517 | } | 1531 | } |
1518 | pm_runtime_get_sync(dev); | 1532 | pm_runtime_get_sync(dev); |
1519 | 1533 | ||
1520 | ret = snd_soc_register_platform(dev, &mtk_afe_pcm_platform); | 1534 | ret = devm_snd_soc_register_component(&pdev->dev, &mtk_afe_pcm_platform, |
1535 | NULL, 0); | ||
1521 | if (ret) { | 1536 | if (ret) { |
1522 | dev_warn(dev, "err_platform\n"); | 1537 | dev_warn(dev, "err_platform\n"); |
1523 | goto err_platform; | 1538 | goto err_platform; |
@@ -1526,13 +1541,11 @@ static int mt2701_afe_pcm_dev_probe(struct platform_device *pdev) | |||
1526 | ret = mt2701_afe_add_component(afe); | 1541 | ret = mt2701_afe_add_component(afe); |
1527 | if (ret) { | 1542 | if (ret) { |
1528 | dev_warn(dev, "err_dai_component\n"); | 1543 | dev_warn(dev, "err_dai_component\n"); |
1529 | goto err_dai_component; | 1544 | goto err_platform; |
1530 | } | 1545 | } |
1531 | 1546 | ||
1532 | return 0; | 1547 | return 0; |
1533 | 1548 | ||
1534 | err_dai_component: | ||
1535 | snd_soc_unregister_platform(dev); | ||
1536 | err_platform: | 1549 | err_platform: |
1537 | pm_runtime_put_sync(dev); | 1550 | pm_runtime_put_sync(dev); |
1538 | err_pm_disable: | 1551 | err_pm_disable: |
@@ -1549,7 +1562,6 @@ static int mt2701_afe_pcm_dev_remove(struct platform_device *pdev) | |||
1549 | mt2701_afe_runtime_suspend(&pdev->dev); | 1562 | mt2701_afe_runtime_suspend(&pdev->dev); |
1550 | 1563 | ||
1551 | snd_soc_unregister_component(&pdev->dev); | 1564 | snd_soc_unregister_component(&pdev->dev); |
1552 | snd_soc_unregister_platform(&pdev->dev); | ||
1553 | 1565 | ||
1554 | return 0; | 1566 | return 0; |
1555 | } | 1567 | } |
diff --git a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c index c7f7f8add5d9..65d1433a0944 100644 --- a/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c +++ b/sound/soc/mediatek/mt8173/mt8173-afe-pcm.c | |||
@@ -304,7 +304,8 @@ static int mt8173_afe_i2s_startup(struct snd_pcm_substream *substream, | |||
304 | struct snd_soc_dai *dai) | 304 | struct snd_soc_dai *dai) |
305 | { | 305 | { |
306 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 306 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
307 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 307 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
308 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
308 | 309 | ||
309 | if (dai->active) | 310 | if (dai->active) |
310 | return 0; | 311 | return 0; |
@@ -318,7 +319,8 @@ static void mt8173_afe_i2s_shutdown(struct snd_pcm_substream *substream, | |||
318 | struct snd_soc_dai *dai) | 319 | struct snd_soc_dai *dai) |
319 | { | 320 | { |
320 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 321 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
321 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 322 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
323 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
322 | 324 | ||
323 | if (dai->active) | 325 | if (dai->active) |
324 | return; | 326 | return; |
@@ -334,7 +336,8 @@ static int mt8173_afe_i2s_prepare(struct snd_pcm_substream *substream, | |||
334 | { | 336 | { |
335 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 337 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
336 | struct snd_pcm_runtime * const runtime = substream->runtime; | 338 | struct snd_pcm_runtime * const runtime = substream->runtime; |
337 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 339 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
340 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
338 | struct mt8173_afe_private *afe_priv = afe->platform_priv; | 341 | struct mt8173_afe_private *afe_priv = afe->platform_priv; |
339 | int ret; | 342 | int ret; |
340 | 343 | ||
@@ -356,7 +359,8 @@ static int mt8173_afe_hdmi_startup(struct snd_pcm_substream *substream, | |||
356 | struct snd_soc_dai *dai) | 359 | struct snd_soc_dai *dai) |
357 | { | 360 | { |
358 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 361 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
359 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 362 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
363 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
360 | struct mt8173_afe_private *afe_priv = afe->platform_priv; | 364 | struct mt8173_afe_private *afe_priv = afe->platform_priv; |
361 | 365 | ||
362 | if (dai->active) | 366 | if (dai->active) |
@@ -371,7 +375,8 @@ static void mt8173_afe_hdmi_shutdown(struct snd_pcm_substream *substream, | |||
371 | struct snd_soc_dai *dai) | 375 | struct snd_soc_dai *dai) |
372 | { | 376 | { |
373 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 377 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
374 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 378 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
379 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
375 | struct mt8173_afe_private *afe_priv = afe->platform_priv; | 380 | struct mt8173_afe_private *afe_priv = afe->platform_priv; |
376 | 381 | ||
377 | if (dai->active) | 382 | if (dai->active) |
@@ -386,7 +391,8 @@ static int mt8173_afe_hdmi_prepare(struct snd_pcm_substream *substream, | |||
386 | { | 391 | { |
387 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 392 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
388 | struct snd_pcm_runtime * const runtime = substream->runtime; | 393 | struct snd_pcm_runtime * const runtime = substream->runtime; |
389 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 394 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
395 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
390 | struct mt8173_afe_private *afe_priv = afe->platform_priv; | 396 | struct mt8173_afe_private *afe_priv = afe->platform_priv; |
391 | 397 | ||
392 | unsigned int val; | 398 | unsigned int val; |
@@ -449,7 +455,8 @@ static int mt8173_afe_hdmi_trigger(struct snd_pcm_substream *substream, int cmd, | |||
449 | struct snd_soc_dai *dai) | 455 | struct snd_soc_dai *dai) |
450 | { | 456 | { |
451 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 457 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
452 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 458 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
459 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
453 | 460 | ||
454 | dev_info(afe->dev, "%s cmd=%d %s\n", __func__, cmd, dai->name); | 461 | dev_info(afe->dev, "%s cmd=%d %s\n", __func__, cmd, dai->name); |
455 | 462 | ||
@@ -498,7 +505,8 @@ static int mt8173_memif_fs(struct snd_pcm_substream *substream, | |||
498 | unsigned int rate) | 505 | unsigned int rate) |
499 | { | 506 | { |
500 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 507 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
501 | struct mtk_base_afe *afe = snd_soc_platform_get_drvdata(rtd->platform); | 508 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, AFE_PCM_NAME); |
509 | struct mtk_base_afe *afe = snd_soc_component_get_drvdata(component); | ||
502 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; | 510 | struct mtk_base_afe_memif *memif = &afe->memif[rtd->cpu_dai->id]; |
503 | int fs; | 511 | int fs; |
504 | 512 | ||
@@ -1172,31 +1180,29 @@ static int mt8173_afe_pcm_dev_probe(struct platform_device *pdev) | |||
1172 | afe->runtime_resume = mt8173_afe_runtime_resume; | 1180 | afe->runtime_resume = mt8173_afe_runtime_resume; |
1173 | afe->runtime_suspend = mt8173_afe_runtime_suspend; | 1181 | afe->runtime_suspend = mt8173_afe_runtime_suspend; |
1174 | 1182 | ||
1175 | ret = snd_soc_register_platform(&pdev->dev, &mtk_afe_pcm_platform); | 1183 | ret = devm_snd_soc_register_component(&pdev->dev, |
1184 | &mtk_afe_pcm_platform, | ||
1185 | NULL, 0); | ||
1176 | if (ret) | 1186 | if (ret) |
1177 | goto err_pm_disable; | 1187 | goto err_pm_disable; |
1178 | 1188 | ||
1179 | ret = snd_soc_register_component(&pdev->dev, | 1189 | ret = devm_snd_soc_register_component(&pdev->dev, |
1180 | &mt8173_afe_pcm_dai_component, | 1190 | &mt8173_afe_pcm_dai_component, |
1181 | mt8173_afe_pcm_dais, | 1191 | mt8173_afe_pcm_dais, |
1182 | ARRAY_SIZE(mt8173_afe_pcm_dais)); | 1192 | ARRAY_SIZE(mt8173_afe_pcm_dais)); |
1183 | if (ret) | 1193 | if (ret) |
1184 | goto err_platform; | 1194 | goto err_pm_disable; |
1185 | 1195 | ||
1186 | ret = snd_soc_register_component(&pdev->dev, | 1196 | ret = devm_snd_soc_register_component(&pdev->dev, |
1187 | &mt8173_afe_hdmi_dai_component, | 1197 | &mt8173_afe_hdmi_dai_component, |
1188 | mt8173_afe_hdmi_dais, | 1198 | mt8173_afe_hdmi_dais, |
1189 | ARRAY_SIZE(mt8173_afe_hdmi_dais)); | 1199 | ARRAY_SIZE(mt8173_afe_hdmi_dais)); |
1190 | if (ret) | 1200 | if (ret) |
1191 | goto err_comp; | 1201 | goto err_pm_disable; |
1192 | 1202 | ||
1193 | dev_info(&pdev->dev, "MT8173 AFE driver initialized.\n"); | 1203 | dev_info(&pdev->dev, "MT8173 AFE driver initialized.\n"); |
1194 | return 0; | 1204 | return 0; |
1195 | 1205 | ||
1196 | err_comp: | ||
1197 | snd_soc_unregister_component(&pdev->dev); | ||
1198 | err_platform: | ||
1199 | snd_soc_unregister_platform(&pdev->dev); | ||
1200 | err_pm_disable: | 1206 | err_pm_disable: |
1201 | pm_runtime_disable(&pdev->dev); | 1207 | pm_runtime_disable(&pdev->dev); |
1202 | return ret; | 1208 | return ret; |
@@ -1207,8 +1213,6 @@ static int mt8173_afe_pcm_dev_remove(struct platform_device *pdev) | |||
1207 | pm_runtime_disable(&pdev->dev); | 1213 | pm_runtime_disable(&pdev->dev); |
1208 | if (!pm_runtime_status_suspended(&pdev->dev)) | 1214 | if (!pm_runtime_status_suspended(&pdev->dev)) |
1209 | mt8173_afe_runtime_suspend(&pdev->dev); | 1215 | mt8173_afe_runtime_suspend(&pdev->dev); |
1210 | snd_soc_unregister_component(&pdev->dev); | ||
1211 | snd_soc_unregister_platform(&pdev->dev); | ||
1212 | return 0; | 1216 | return 0; |
1213 | } | 1217 | } |
1214 | 1218 | ||
diff --git a/sound/soc/nuc900/nuc900-pcm.c b/sound/soc/nuc900/nuc900-pcm.c index bd6dfa218d59..ad8392a87df9 100644 --- a/sound/soc/nuc900/nuc900-pcm.c +++ b/sound/soc/nuc900/nuc900-pcm.c | |||
@@ -299,14 +299,15 @@ static int nuc900_dma_new(struct snd_soc_pcm_runtime *rtd) | |||
299 | return 0; | 299 | return 0; |
300 | } | 300 | } |
301 | 301 | ||
302 | static const struct snd_soc_platform_driver nuc900_soc_platform = { | 302 | static const struct snd_soc_component_driver nuc900_soc_component = { |
303 | .ops = &nuc900_dma_ops, | 303 | .ops = &nuc900_dma_ops, |
304 | .pcm_new = nuc900_dma_new, | 304 | .pcm_new = nuc900_dma_new, |
305 | }; | 305 | }; |
306 | 306 | ||
307 | static int nuc900_soc_platform_probe(struct platform_device *pdev) | 307 | static int nuc900_soc_platform_probe(struct platform_device *pdev) |
308 | { | 308 | { |
309 | return devm_snd_soc_register_platform(&pdev->dev, &nuc900_soc_platform); | 309 | return devm_snd_soc_register_component(&pdev->dev, &nuc900_soc_component, |
310 | NULL, 0); | ||
310 | } | 311 | } |
311 | 312 | ||
312 | static struct platform_driver nuc900_pcm_driver = { | 313 | static struct platform_driver nuc900_pcm_driver = { |
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index aca2c43d0f03..778cc8f75b6a 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c | |||
@@ -243,7 +243,7 @@ out: | |||
243 | return ret; | 243 | return ret; |
244 | } | 244 | } |
245 | 245 | ||
246 | static const struct snd_soc_platform_driver omap_soc_platform = { | 246 | static const struct snd_soc_component_driver omap_soc_component = { |
247 | .ops = &omap_pcm_ops, | 247 | .ops = &omap_pcm_ops, |
248 | .pcm_new = omap_pcm_new, | 248 | .pcm_new = omap_pcm_new, |
249 | .pcm_free = omap_pcm_free_dma_buffers, | 249 | .pcm_free = omap_pcm_free_dma_buffers, |
@@ -252,7 +252,8 @@ static const struct snd_soc_platform_driver omap_soc_platform = { | |||
252 | int omap_pcm_platform_register(struct device *dev) | 252 | int omap_pcm_platform_register(struct device *dev) |
253 | { | 253 | { |
254 | omap_pcm_limit_supported_formats(); | 254 | omap_pcm_limit_supported_formats(); |
255 | return devm_snd_soc_register_platform(dev, &omap_soc_platform); | 255 | return devm_snd_soc_register_component(dev, &omap_soc_component, |
256 | NULL, 0); | ||
256 | } | 257 | } |
257 | EXPORT_SYMBOL_GPL(omap_pcm_platform_register); | 258 | EXPORT_SYMBOL_GPL(omap_pcm_platform_register); |
258 | 259 | ||
diff --git a/sound/soc/pxa/mmp-pcm.c b/sound/soc/pxa/mmp-pcm.c index 624d9bd5dadd..d2d4652de32c 100644 --- a/sound/soc/pxa/mmp-pcm.c +++ b/sound/soc/pxa/mmp-pcm.c | |||
@@ -25,6 +25,8 @@ | |||
25 | #include <sound/soc.h> | 25 | #include <sound/soc.h> |
26 | #include <sound/dmaengine_pcm.h> | 26 | #include <sound/dmaengine_pcm.h> |
27 | 27 | ||
28 | #define DRV_NAME "mmp-pcm" | ||
29 | |||
28 | struct mmp_dma_data { | 30 | struct mmp_dma_data { |
29 | int ssp_id; | 31 | int ssp_id; |
30 | struct resource *dma_res; | 32 | struct resource *dma_res; |
@@ -100,7 +102,8 @@ static bool filter(struct dma_chan *chan, void *param) | |||
100 | static int mmp_pcm_open(struct snd_pcm_substream *substream) | 102 | static int mmp_pcm_open(struct snd_pcm_substream *substream) |
101 | { | 103 | { |
102 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 104 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
103 | struct platform_device *pdev = to_platform_device(rtd->platform->dev); | 105 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
106 | struct platform_device *pdev = to_platform_device(component->dev); | ||
104 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; | 107 | struct snd_soc_dai *cpu_dai = rtd->cpu_dai; |
105 | struct mmp_dma_data dma_data; | 108 | struct mmp_dma_data dma_data; |
106 | struct resource *r; | 109 | struct resource *r; |
@@ -211,7 +214,8 @@ err: | |||
211 | return ret; | 214 | return ret; |
212 | } | 215 | } |
213 | 216 | ||
214 | static const struct snd_soc_platform_driver mmp_soc_platform = { | 217 | static const struct snd_soc_component_driver mmp_soc_component = { |
218 | .name = DRV_NAME, | ||
215 | .ops = &mmp_pcm_ops, | 219 | .ops = &mmp_pcm_ops, |
216 | .pcm_new = mmp_pcm_new, | 220 | .pcm_new = mmp_pcm_new, |
217 | .pcm_free = mmp_pcm_free_dma_buffers, | 221 | .pcm_free = mmp_pcm_free_dma_buffers, |
@@ -231,7 +235,8 @@ static int mmp_pcm_probe(struct platform_device *pdev) | |||
231 | mmp_pcm_hardware[SNDRV_PCM_STREAM_CAPTURE].period_bytes_max = | 235 | mmp_pcm_hardware[SNDRV_PCM_STREAM_CAPTURE].period_bytes_max = |
232 | pdata->period_max_capture; | 236 | pdata->period_max_capture; |
233 | } | 237 | } |
234 | return devm_snd_soc_register_platform(&pdev->dev, &mmp_soc_platform); | 238 | return devm_snd_soc_register_component(&pdev->dev, &mmp_soc_component, |
239 | NULL, 0); | ||
235 | } | 240 | } |
236 | 241 | ||
237 | static struct platform_driver mmp_pcm_driver = { | 242 | static struct platform_driver mmp_pcm_driver = { |
diff --git a/sound/soc/pxa/pxa2xx-pcm.c b/sound/soc/pxa/pxa2xx-pcm.c index e64958d8bff0..8b6a70e94c01 100644 --- a/sound/soc/pxa/pxa2xx-pcm.c +++ b/sound/soc/pxa/pxa2xx-pcm.c | |||
@@ -84,7 +84,7 @@ static int pxa2xx_soc_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
84 | return ret; | 84 | return ret; |
85 | } | 85 | } |
86 | 86 | ||
87 | static const struct snd_soc_platform_driver pxa2xx_soc_platform = { | 87 | static const struct snd_soc_component_driver pxa2xx_soc_platform = { |
88 | .ops = &pxa2xx_pcm_ops, | 88 | .ops = &pxa2xx_pcm_ops, |
89 | .pcm_new = pxa2xx_soc_pcm_new, | 89 | .pcm_new = pxa2xx_soc_pcm_new, |
90 | .pcm_free = pxa2xx_pcm_free_dma_buffers, | 90 | .pcm_free = pxa2xx_pcm_free_dma_buffers, |
@@ -92,7 +92,8 @@ static const struct snd_soc_platform_driver pxa2xx_soc_platform = { | |||
92 | 92 | ||
93 | static int pxa2xx_soc_platform_probe(struct platform_device *pdev) | 93 | static int pxa2xx_soc_platform_probe(struct platform_device *pdev) |
94 | { | 94 | { |
95 | return devm_snd_soc_register_platform(&pdev->dev, &pxa2xx_soc_platform); | 95 | return devm_snd_soc_register_component(&pdev->dev, &pxa2xx_soc_platform, |
96 | NULL, 0); | ||
96 | } | 97 | } |
97 | 98 | ||
98 | #ifdef CONFIG_OF | 99 | #ifdef CONFIG_OF |
diff --git a/sound/soc/qcom/lpass-platform.c b/sound/soc/qcom/lpass-platform.c index caf71aab8196..31fe78aa207f 100644 --- a/sound/soc/qcom/lpass-platform.c +++ b/sound/soc/qcom/lpass-platform.c | |||
@@ -24,6 +24,8 @@ | |||
24 | #include "lpass-lpaif-reg.h" | 24 | #include "lpass-lpaif-reg.h" |
25 | #include "lpass.h" | 25 | #include "lpass.h" |
26 | 26 | ||
27 | #define DRV_NAME "lpass-platform" | ||
28 | |||
27 | struct lpass_pcm_data { | 29 | struct lpass_pcm_data { |
28 | int dma_ch; | 30 | int dma_ch; |
29 | int i2s_port; | 31 | int i2s_port; |
@@ -61,8 +63,8 @@ static int lpass_platform_pcmops_open(struct snd_pcm_substream *substream) | |||
61 | struct snd_pcm_runtime *runtime = substream->runtime; | 63 | struct snd_pcm_runtime *runtime = substream->runtime; |
62 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 64 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
63 | struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; | 65 | struct snd_soc_dai *cpu_dai = soc_runtime->cpu_dai; |
64 | struct lpass_data *drvdata = | 66 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME); |
65 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 67 | struct lpass_data *drvdata = snd_soc_component_get_drvdata(component); |
66 | struct lpass_variant *v = drvdata->variant; | 68 | struct lpass_variant *v = drvdata->variant; |
67 | int ret, dma_ch, dir = substream->stream; | 69 | int ret, dma_ch, dir = substream->stream; |
68 | struct lpass_pcm_data *data; | 70 | struct lpass_pcm_data *data; |
@@ -115,8 +117,8 @@ static int lpass_platform_pcmops_close(struct snd_pcm_substream *substream) | |||
115 | { | 117 | { |
116 | struct snd_pcm_runtime *runtime = substream->runtime; | 118 | struct snd_pcm_runtime *runtime = substream->runtime; |
117 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 119 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
118 | struct lpass_data *drvdata = | 120 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME); |
119 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 121 | struct lpass_data *drvdata = snd_soc_component_get_drvdata(component); |
120 | struct lpass_variant *v = drvdata->variant; | 122 | struct lpass_variant *v = drvdata->variant; |
121 | struct lpass_pcm_data *data; | 123 | struct lpass_pcm_data *data; |
122 | 124 | ||
@@ -132,8 +134,8 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream, | |||
132 | struct snd_pcm_hw_params *params) | 134 | struct snd_pcm_hw_params *params) |
133 | { | 135 | { |
134 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 136 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
135 | struct lpass_data *drvdata = | 137 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME); |
136 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 138 | struct lpass_data *drvdata = snd_soc_component_get_drvdata(component); |
137 | struct snd_pcm_runtime *rt = substream->runtime; | 139 | struct snd_pcm_runtime *rt = substream->runtime; |
138 | struct lpass_pcm_data *pcm_data = rt->private_data; | 140 | struct lpass_pcm_data *pcm_data = rt->private_data; |
139 | struct lpass_variant *v = drvdata->variant; | 141 | struct lpass_variant *v = drvdata->variant; |
@@ -225,8 +227,8 @@ static int lpass_platform_pcmops_hw_params(struct snd_pcm_substream *substream, | |||
225 | static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream) | 227 | static int lpass_platform_pcmops_hw_free(struct snd_pcm_substream *substream) |
226 | { | 228 | { |
227 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 229 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
228 | struct lpass_data *drvdata = | 230 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME); |
229 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 231 | struct lpass_data *drvdata = snd_soc_component_get_drvdata(component); |
230 | struct snd_pcm_runtime *rt = substream->runtime; | 232 | struct snd_pcm_runtime *rt = substream->runtime; |
231 | struct lpass_pcm_data *pcm_data = rt->private_data; | 233 | struct lpass_pcm_data *pcm_data = rt->private_data; |
232 | struct lpass_variant *v = drvdata->variant; | 234 | struct lpass_variant *v = drvdata->variant; |
@@ -246,8 +248,8 @@ static int lpass_platform_pcmops_prepare(struct snd_pcm_substream *substream) | |||
246 | { | 248 | { |
247 | struct snd_pcm_runtime *runtime = substream->runtime; | 249 | struct snd_pcm_runtime *runtime = substream->runtime; |
248 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 250 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
249 | struct lpass_data *drvdata = | 251 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME); |
250 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 252 | struct lpass_data *drvdata = snd_soc_component_get_drvdata(component); |
251 | struct snd_pcm_runtime *rt = substream->runtime; | 253 | struct snd_pcm_runtime *rt = substream->runtime; |
252 | struct lpass_pcm_data *pcm_data = rt->private_data; | 254 | struct lpass_pcm_data *pcm_data = rt->private_data; |
253 | struct lpass_variant *v = drvdata->variant; | 255 | struct lpass_variant *v = drvdata->variant; |
@@ -298,8 +300,8 @@ static int lpass_platform_pcmops_trigger(struct snd_pcm_substream *substream, | |||
298 | int cmd) | 300 | int cmd) |
299 | { | 301 | { |
300 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 302 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
301 | struct lpass_data *drvdata = | 303 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME); |
302 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 304 | struct lpass_data *drvdata = snd_soc_component_get_drvdata(component); |
303 | struct snd_pcm_runtime *rt = substream->runtime; | 305 | struct snd_pcm_runtime *rt = substream->runtime; |
304 | struct lpass_pcm_data *pcm_data = rt->private_data; | 306 | struct lpass_pcm_data *pcm_data = rt->private_data; |
305 | struct lpass_variant *v = drvdata->variant; | 307 | struct lpass_variant *v = drvdata->variant; |
@@ -372,8 +374,8 @@ static snd_pcm_uframes_t lpass_platform_pcmops_pointer( | |||
372 | struct snd_pcm_substream *substream) | 374 | struct snd_pcm_substream *substream) |
373 | { | 375 | { |
374 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; | 376 | struct snd_soc_pcm_runtime *soc_runtime = substream->private_data; |
375 | struct lpass_data *drvdata = | 377 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME); |
376 | snd_soc_platform_get_drvdata(soc_runtime->platform); | 378 | struct lpass_data *drvdata = snd_soc_component_get_drvdata(component); |
377 | struct snd_pcm_runtime *rt = substream->runtime; | 379 | struct snd_pcm_runtime *rt = substream->runtime; |
378 | struct lpass_pcm_data *pcm_data = rt->private_data; | 380 | struct lpass_pcm_data *pcm_data = rt->private_data; |
379 | struct lpass_variant *v = drvdata->variant; | 381 | struct lpass_variant *v = drvdata->variant; |
@@ -509,13 +511,14 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime) | |||
509 | { | 511 | { |
510 | struct snd_pcm *pcm = soc_runtime->pcm; | 512 | struct snd_pcm *pcm = soc_runtime->pcm; |
511 | struct snd_pcm_substream *psubstream, *csubstream; | 513 | struct snd_pcm_substream *psubstream, *csubstream; |
514 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(soc_runtime, DRV_NAME); | ||
512 | int ret = -EINVAL; | 515 | int ret = -EINVAL; |
513 | size_t size = lpass_platform_pcm_hardware.buffer_bytes_max; | 516 | size_t size = lpass_platform_pcm_hardware.buffer_bytes_max; |
514 | 517 | ||
515 | psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; | 518 | psubstream = pcm->streams[SNDRV_PCM_STREAM_PLAYBACK].substream; |
516 | if (psubstream) { | 519 | if (psubstream) { |
517 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, | 520 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
518 | soc_runtime->platform->dev, | 521 | component->dev, |
519 | size, &psubstream->dma_buffer); | 522 | size, &psubstream->dma_buffer); |
520 | if (ret) { | 523 | if (ret) { |
521 | dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n"); | 524 | dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n"); |
@@ -526,7 +529,7 @@ static int lpass_platform_pcm_new(struct snd_soc_pcm_runtime *soc_runtime) | |||
526 | csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; | 529 | csubstream = pcm->streams[SNDRV_PCM_STREAM_CAPTURE].substream; |
527 | if (csubstream) { | 530 | if (csubstream) { |
528 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, | 531 | ret = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, |
529 | soc_runtime->platform->dev, | 532 | component->dev, |
530 | size, &csubstream->dma_buffer); | 533 | size, &csubstream->dma_buffer); |
531 | if (ret) { | 534 | if (ret) { |
532 | dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n"); | 535 | dev_err(soc_runtime->dev, "Cannot allocate buffer(s)\n"); |
@@ -555,7 +558,8 @@ static void lpass_platform_pcm_free(struct snd_pcm *pcm) | |||
555 | } | 558 | } |
556 | } | 559 | } |
557 | 560 | ||
558 | static const struct snd_soc_platform_driver lpass_platform_driver = { | 561 | static const struct snd_soc_component_driver lpass_component_driver = { |
562 | .name = DRV_NAME, | ||
559 | .pcm_new = lpass_platform_pcm_new, | 563 | .pcm_new = lpass_platform_pcm_new, |
560 | .pcm_free = lpass_platform_pcm_free, | 564 | .pcm_free = lpass_platform_pcm_free, |
561 | .ops = &lpass_platform_pcm_ops, | 565 | .ops = &lpass_platform_pcm_ops, |
@@ -591,8 +595,8 @@ int asoc_qcom_lpass_platform_register(struct platform_device *pdev) | |||
591 | } | 595 | } |
592 | 596 | ||
593 | 597 | ||
594 | return devm_snd_soc_register_platform(&pdev->dev, | 598 | return devm_snd_soc_register_component(&pdev->dev, |
595 | &lpass_platform_driver); | 599 | &lpass_component_driver, NULL, 0); |
596 | } | 600 | } |
597 | EXPORT_SYMBOL_GPL(asoc_qcom_lpass_platform_register); | 601 | EXPORT_SYMBOL_GPL(asoc_qcom_lpass_platform_register); |
598 | 602 | ||
diff --git a/sound/soc/samsung/idma.c b/sound/soc/samsung/idma.c index a635df61f928..b1f09b942410 100644 --- a/sound/soc/samsung/idma.c +++ b/sound/soc/samsung/idma.c | |||
@@ -399,7 +399,7 @@ void idma_reg_addr_init(void __iomem *regs, dma_addr_t addr) | |||
399 | } | 399 | } |
400 | EXPORT_SYMBOL_GPL(idma_reg_addr_init); | 400 | EXPORT_SYMBOL_GPL(idma_reg_addr_init); |
401 | 401 | ||
402 | static const struct snd_soc_platform_driver asoc_idma_platform = { | 402 | static const struct snd_soc_component_driver asoc_idma_platform = { |
403 | .ops = &idma_ops, | 403 | .ops = &idma_ops, |
404 | .pcm_new = idma_new, | 404 | .pcm_new = idma_new, |
405 | .pcm_free = idma_free, | 405 | .pcm_free = idma_free, |
@@ -411,7 +411,8 @@ static int asoc_idma_platform_probe(struct platform_device *pdev) | |||
411 | if (idma_irq < 0) | 411 | if (idma_irq < 0) |
412 | return idma_irq; | 412 | return idma_irq; |
413 | 413 | ||
414 | return devm_snd_soc_register_platform(&pdev->dev, &asoc_idma_platform); | 414 | return devm_snd_soc_register_component(&pdev->dev, &asoc_idma_platform, |
415 | NULL, 0); | ||
415 | } | 416 | } |
416 | 417 | ||
417 | static struct platform_driver asoc_idma_driver = { | 418 | static struct platform_driver asoc_idma_driver = { |
diff --git a/sound/soc/sh/dma-sh7760.c b/sound/soc/sh/dma-sh7760.c index 1e7d417b53ef..2dc3b762fdd9 100644 --- a/sound/soc/sh/dma-sh7760.c +++ b/sound/soc/sh/dma-sh7760.c | |||
@@ -320,14 +320,15 @@ static int camelot_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
320 | return 0; | 320 | return 0; |
321 | } | 321 | } |
322 | 322 | ||
323 | static const struct snd_soc_platform_driver sh7760_soc_platform = { | 323 | static const struct snd_soc_component_driver sh7760_soc_component = { |
324 | .ops = &camelot_pcm_ops, | 324 | .ops = &camelot_pcm_ops, |
325 | .pcm_new = camelot_pcm_new, | 325 | .pcm_new = camelot_pcm_new, |
326 | }; | 326 | }; |
327 | 327 | ||
328 | static int sh7760_soc_platform_probe(struct platform_device *pdev) | 328 | static int sh7760_soc_platform_probe(struct platform_device *pdev) |
329 | { | 329 | { |
330 | return devm_snd_soc_register_platform(&pdev->dev, &sh7760_soc_platform); | 330 | return devm_snd_soc_register_component(&pdev->dev, &sh7760_soc_component, |
331 | NULL, 0); | ||
331 | } | 332 | } |
332 | 333 | ||
333 | static struct platform_driver sh7760_pcm_driver = { | 334 | static struct platform_driver sh7760_pcm_driver = { |
diff --git a/sound/soc/sh/fsi.c b/sound/soc/sh/fsi.c index c3aaf4788557..3bae06dd121f 100644 --- a/sound/soc/sh/fsi.c +++ b/sound/soc/sh/fsi.c | |||
@@ -1764,7 +1764,7 @@ static const struct snd_pcm_ops fsi_pcm_ops = { | |||
1764 | }; | 1764 | }; |
1765 | 1765 | ||
1766 | /* | 1766 | /* |
1767 | * snd_soc_platform | 1767 | * snd_soc_component |
1768 | */ | 1768 | */ |
1769 | 1769 | ||
1770 | #define PREALLOC_BUFFER (32 * 1024) | 1770 | #define PREALLOC_BUFFER (32 * 1024) |
@@ -1818,13 +1818,10 @@ static struct snd_soc_dai_driver fsi_soc_dai[] = { | |||
1818 | }, | 1818 | }, |
1819 | }; | 1819 | }; |
1820 | 1820 | ||
1821 | static const struct snd_soc_platform_driver fsi_soc_platform = { | ||
1822 | .ops = &fsi_pcm_ops, | ||
1823 | .pcm_new = fsi_pcm_new, | ||
1824 | }; | ||
1825 | |||
1826 | static const struct snd_soc_component_driver fsi_soc_component = { | 1821 | static const struct snd_soc_component_driver fsi_soc_component = { |
1827 | .name = "fsi", | 1822 | .name = "fsi", |
1823 | .ops = &fsi_pcm_ops, | ||
1824 | .pcm_new = fsi_pcm_new, | ||
1828 | }; | 1825 | }; |
1829 | 1826 | ||
1830 | /* | 1827 | /* |
@@ -2007,23 +2004,15 @@ static int fsi_probe(struct platform_device *pdev) | |||
2007 | goto exit_fsib; | 2004 | goto exit_fsib; |
2008 | } | 2005 | } |
2009 | 2006 | ||
2010 | ret = snd_soc_register_platform(&pdev->dev, &fsi_soc_platform); | 2007 | ret = devm_snd_soc_register_component(&pdev->dev, &fsi_soc_component, |
2011 | if (ret < 0) { | ||
2012 | dev_err(&pdev->dev, "cannot snd soc register\n"); | ||
2013 | goto exit_fsib; | ||
2014 | } | ||
2015 | |||
2016 | ret = snd_soc_register_component(&pdev->dev, &fsi_soc_component, | ||
2017 | fsi_soc_dai, ARRAY_SIZE(fsi_soc_dai)); | 2008 | fsi_soc_dai, ARRAY_SIZE(fsi_soc_dai)); |
2018 | if (ret < 0) { | 2009 | if (ret < 0) { |
2019 | dev_err(&pdev->dev, "cannot snd component register\n"); | 2010 | dev_err(&pdev->dev, "cannot snd component register\n"); |
2020 | goto exit_snd_soc; | 2011 | goto exit_fsib; |
2021 | } | 2012 | } |
2022 | 2013 | ||
2023 | return ret; | 2014 | return ret; |
2024 | 2015 | ||
2025 | exit_snd_soc: | ||
2026 | snd_soc_unregister_platform(&pdev->dev); | ||
2027 | exit_fsib: | 2016 | exit_fsib: |
2028 | pm_runtime_disable(&pdev->dev); | 2017 | pm_runtime_disable(&pdev->dev); |
2029 | fsi_stream_remove(&master->fsib); | 2018 | fsi_stream_remove(&master->fsib); |
@@ -2041,9 +2030,6 @@ static int fsi_remove(struct platform_device *pdev) | |||
2041 | 2030 | ||
2042 | pm_runtime_disable(&pdev->dev); | 2031 | pm_runtime_disable(&pdev->dev); |
2043 | 2032 | ||
2044 | snd_soc_unregister_component(&pdev->dev); | ||
2045 | snd_soc_unregister_platform(&pdev->dev); | ||
2046 | |||
2047 | fsi_stream_remove(&master->fsia); | 2033 | fsi_stream_remove(&master->fsia); |
2048 | fsi_stream_remove(&master->fsib); | 2034 | fsi_stream_remove(&master->fsib); |
2049 | 2035 | ||
diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c index 64d5ecb86528..b4007669c704 100644 --- a/sound/soc/sh/rcar/core.c +++ b/sound/soc/sh/rcar/core.c | |||
@@ -1337,7 +1337,7 @@ int rsnd_kctrl_new(struct rsnd_mod *mod, | |||
1337 | } | 1337 | } |
1338 | 1338 | ||
1339 | /* | 1339 | /* |
1340 | * snd_soc_platform | 1340 | * snd_soc_component |
1341 | */ | 1341 | */ |
1342 | 1342 | ||
1343 | #define PREALLOC_BUFFER (32 * 1024) | 1343 | #define PREALLOC_BUFFER (32 * 1024) |
@@ -1364,12 +1364,9 @@ static int rsnd_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
1364 | PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); | 1364 | PREALLOC_BUFFER, PREALLOC_BUFFER_MAX); |
1365 | } | 1365 | } |
1366 | 1366 | ||
1367 | static const struct snd_soc_platform_driver rsnd_soc_platform = { | 1367 | static const struct snd_soc_component_driver rsnd_soc_component = { |
1368 | .ops = &rsnd_pcm_ops, | 1368 | .ops = &rsnd_pcm_ops, |
1369 | .pcm_new = rsnd_pcm_new, | 1369 | .pcm_new = rsnd_pcm_new, |
1370 | }; | ||
1371 | |||
1372 | static const struct snd_soc_component_driver rsnd_soc_component = { | ||
1373 | .name = "rsnd", | 1370 | .name = "rsnd", |
1374 | }; | 1371 | }; |
1375 | 1372 | ||
@@ -1478,17 +1475,11 @@ static int rsnd_probe(struct platform_device *pdev) | |||
1478 | /* | 1475 | /* |
1479 | * asoc register | 1476 | * asoc register |
1480 | */ | 1477 | */ |
1481 | ret = snd_soc_register_platform(dev, &rsnd_soc_platform); | 1478 | ret = devm_snd_soc_register_component(dev, &rsnd_soc_component, |
1482 | if (ret < 0) { | ||
1483 | dev_err(dev, "cannot snd soc register\n"); | ||
1484 | return ret; | ||
1485 | } | ||
1486 | |||
1487 | ret = snd_soc_register_component(dev, &rsnd_soc_component, | ||
1488 | priv->daidrv, rsnd_rdai_nr(priv)); | 1479 | priv->daidrv, rsnd_rdai_nr(priv)); |
1489 | if (ret < 0) { | 1480 | if (ret < 0) { |
1490 | dev_err(dev, "cannot snd dai register\n"); | 1481 | dev_err(dev, "cannot snd dai register\n"); |
1491 | goto exit_snd_soc; | 1482 | goto exit_snd_probe; |
1492 | } | 1483 | } |
1493 | 1484 | ||
1494 | pm_runtime_enable(dev); | 1485 | pm_runtime_enable(dev); |
@@ -1496,8 +1487,6 @@ static int rsnd_probe(struct platform_device *pdev) | |||
1496 | dev_info(dev, "probed\n"); | 1487 | dev_info(dev, "probed\n"); |
1497 | return ret; | 1488 | return ret; |
1498 | 1489 | ||
1499 | exit_snd_soc: | ||
1500 | snd_soc_unregister_platform(dev); | ||
1501 | exit_snd_probe: | 1490 | exit_snd_probe: |
1502 | for_each_rsnd_dai(rdai, priv, i) { | 1491 | for_each_rsnd_dai(rdai, priv, i) { |
1503 | rsnd_dai_call(remove, &rdai->playback, priv); | 1492 | rsnd_dai_call(remove, &rdai->playback, priv); |
@@ -1535,9 +1524,6 @@ static int rsnd_remove(struct platform_device *pdev) | |||
1535 | for (i = 0; i < ARRAY_SIZE(remove_func); i++) | 1524 | for (i = 0; i < ARRAY_SIZE(remove_func); i++) |
1536 | remove_func[i](priv); | 1525 | remove_func[i](priv); |
1537 | 1526 | ||
1538 | snd_soc_unregister_component(&pdev->dev); | ||
1539 | snd_soc_unregister_platform(&pdev->dev); | ||
1540 | |||
1541 | return ret; | 1527 | return ret; |
1542 | } | 1528 | } |
1543 | 1529 | ||
diff --git a/sound/soc/sh/siu.h b/sound/soc/sh/siu.h index 83c3430ad797..6088d627c0e4 100644 --- a/sound/soc/sh/siu.h +++ b/sound/soc/sh/siu.h | |||
@@ -183,7 +183,7 @@ static inline u32 siu_read32(u32 __iomem *addr) | |||
183 | #define SIU_BRGBSEL (0x108 / sizeof(u32)) | 183 | #define SIU_BRGBSEL (0x108 / sizeof(u32)) |
184 | #define SIU_BRRB (0x10c / sizeof(u32)) | 184 | #define SIU_BRRB (0x10c / sizeof(u32)) |
185 | 185 | ||
186 | extern struct snd_soc_platform_driver siu_platform; | 186 | extern struct snd_soc_component_driver siu_component; |
187 | extern struct siu_info *siu_i2s_data; | 187 | extern struct siu_info *siu_i2s_data; |
188 | 188 | ||
189 | int siu_init_port(int port, struct siu_port **port_info, struct snd_card *card); | 189 | int siu_init_port(int port, struct siu_port **port_info, struct snd_card *card); |
diff --git a/sound/soc/sh/siu_dai.c b/sound/soc/sh/siu_dai.c index 160502947da2..ee2211635e92 100644 --- a/sound/soc/sh/siu_dai.c +++ b/sound/soc/sh/siu_dai.c | |||
@@ -727,10 +727,6 @@ static struct snd_soc_dai_driver siu_i2s_dai = { | |||
727 | .ops = &siu_dai_ops, | 727 | .ops = &siu_dai_ops, |
728 | }; | 728 | }; |
729 | 729 | ||
730 | static const struct snd_soc_component_driver siu_i2s_component = { | ||
731 | .name = "siu-i2s", | ||
732 | }; | ||
733 | |||
734 | static int siu_probe(struct platform_device *pdev) | 730 | static int siu_probe(struct platform_device *pdev) |
735 | { | 731 | { |
736 | const struct firmware *fw_entry; | 732 | const struct firmware *fw_entry; |
@@ -786,15 +782,11 @@ static int siu_probe(struct platform_device *pdev) | |||
786 | dev_set_drvdata(&pdev->dev, info); | 782 | dev_set_drvdata(&pdev->dev, info); |
787 | 783 | ||
788 | /* register using ARRAY version so we can keep dai name */ | 784 | /* register using ARRAY version so we can keep dai name */ |
789 | ret = devm_snd_soc_register_component(&pdev->dev, &siu_i2s_component, | 785 | ret = devm_snd_soc_register_component(&pdev->dev, &siu_component, |
790 | &siu_i2s_dai, 1); | 786 | &siu_i2s_dai, 1); |
791 | if (ret < 0) | 787 | if (ret < 0) |
792 | return ret; | 788 | return ret; |
793 | 789 | ||
794 | ret = devm_snd_soc_register_platform(&pdev->dev, &siu_platform); | ||
795 | if (ret < 0) | ||
796 | return ret; | ||
797 | |||
798 | pm_runtime_enable(&pdev->dev); | 790 | pm_runtime_enable(&pdev->dev); |
799 | 791 | ||
800 | return 0; | 792 | return 0; |
diff --git a/sound/soc/sh/siu_pcm.c b/sound/soc/sh/siu_pcm.c index 3118cb0ee3f2..172909570ed5 100644 --- a/sound/soc/sh/siu_pcm.c +++ b/sound/soc/sh/siu_pcm.c | |||
@@ -35,6 +35,7 @@ | |||
35 | 35 | ||
36 | #include "siu.h" | 36 | #include "siu.h" |
37 | 37 | ||
38 | #define DRV_NAME "siu-i2s" | ||
38 | #define GET_MAX_PERIODS(buf_bytes, period_bytes) \ | 39 | #define GET_MAX_PERIODS(buf_bytes, period_bytes) \ |
39 | ((buf_bytes) / (period_bytes)) | 40 | ((buf_bytes) / (period_bytes)) |
40 | #define PERIOD_OFFSET(buf_addr, period_num, period_bytes) \ | 41 | #define PERIOD_OFFSET(buf_addr, period_num, period_bytes) \ |
@@ -340,7 +341,8 @@ static int siu_pcm_open(struct snd_pcm_substream *ss) | |||
340 | { | 341 | { |
341 | /* Playback / Capture */ | 342 | /* Playback / Capture */ |
342 | struct snd_soc_pcm_runtime *rtd = ss->private_data; | 343 | struct snd_soc_pcm_runtime *rtd = ss->private_data; |
343 | struct siu_platform *pdata = rtd->platform->dev->platform_data; | 344 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
345 | struct siu_platform *pdata = component->dev->platform_data; | ||
344 | struct siu_info *info = siu_i2s_data; | 346 | struct siu_info *info = siu_i2s_data; |
345 | struct siu_port *port_info = siu_port_info(ss); | 347 | struct siu_port *port_info = siu_port_info(ss); |
346 | struct siu_stream *siu_stream; | 348 | struct siu_stream *siu_stream; |
@@ -604,9 +606,10 @@ static const struct snd_pcm_ops siu_pcm_ops = { | |||
604 | .pointer = siu_pcm_pointer_dma, | 606 | .pointer = siu_pcm_pointer_dma, |
605 | }; | 607 | }; |
606 | 608 | ||
607 | struct snd_soc_platform_driver siu_platform = { | 609 | struct snd_soc_component_driver siu_component = { |
610 | .name = DRV_NAME, | ||
608 | .ops = &siu_pcm_ops, | 611 | .ops = &siu_pcm_ops, |
609 | .pcm_new = siu_pcm_new, | 612 | .pcm_new = siu_pcm_new, |
610 | .pcm_free = siu_pcm_free, | 613 | .pcm_free = siu_pcm_free, |
611 | }; | 614 | }; |
612 | EXPORT_SYMBOL_GPL(siu_platform); | 615 | EXPORT_SYMBOL_GPL(siu_component); |
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 96c44f6576c9..9558125b448d 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c | |||
@@ -1162,11 +1162,6 @@ static int soc_bind_dai_link(struct snd_soc_card *card, | |||
1162 | 1162 | ||
1163 | rtd->platform = platform; | 1163 | rtd->platform = platform; |
1164 | } | 1164 | } |
1165 | if (!rtd->platform) { | ||
1166 | dev_err(card->dev, "ASoC: platform %s not registered\n", | ||
1167 | dai_link->platform_name); | ||
1168 | goto _err_defer; | ||
1169 | } | ||
1170 | 1165 | ||
1171 | soc_add_pcm_runtime(card, rtd); | 1166 | soc_add_pcm_runtime(card, rtd); |
1172 | return 0; | 1167 | return 0; |
diff --git a/sound/soc/soc-generic-dmaengine-pcm.c b/sound/soc/soc-generic-dmaengine-pcm.c index d53786498b61..567fbdfd1ca9 100644 --- a/sound/soc/soc-generic-dmaengine-pcm.c +++ b/sound/soc/soc-generic-dmaengine-pcm.c | |||
@@ -33,13 +33,13 @@ | |||
33 | struct dmaengine_pcm { | 33 | struct dmaengine_pcm { |
34 | struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1]; | 34 | struct dma_chan *chan[SNDRV_PCM_STREAM_LAST + 1]; |
35 | const struct snd_dmaengine_pcm_config *config; | 35 | const struct snd_dmaengine_pcm_config *config; |
36 | struct snd_soc_platform platform; | 36 | struct snd_soc_component component; |
37 | unsigned int flags; | 37 | unsigned int flags; |
38 | }; | 38 | }; |
39 | 39 | ||
40 | static struct dmaengine_pcm *soc_platform_to_pcm(struct snd_soc_platform *p) | 40 | static struct dmaengine_pcm *soc_component_to_pcm(struct snd_soc_component *p) |
41 | { | 41 | { |
42 | return container_of(p, struct dmaengine_pcm, platform); | 42 | return container_of(p, struct dmaengine_pcm, component); |
43 | } | 43 | } |
44 | 44 | ||
45 | static struct device *dmaengine_dma_dev(struct dmaengine_pcm *pcm, | 45 | static struct device *dmaengine_dma_dev(struct dmaengine_pcm *pcm, |
@@ -88,7 +88,9 @@ static int dmaengine_pcm_hw_params(struct snd_pcm_substream *substream, | |||
88 | struct snd_pcm_hw_params *params) | 88 | struct snd_pcm_hw_params *params) |
89 | { | 89 | { |
90 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 90 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
91 | struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); | 91 | struct snd_soc_component *component = |
92 | snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME); | ||
93 | struct dmaengine_pcm *pcm = soc_component_to_pcm(component); | ||
92 | struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream); | 94 | struct dma_chan *chan = snd_dmaengine_pcm_get_chan(substream); |
93 | int (*prepare_slave_config)(struct snd_pcm_substream *substream, | 95 | int (*prepare_slave_config)(struct snd_pcm_substream *substream, |
94 | struct snd_pcm_hw_params *params, | 96 | struct snd_pcm_hw_params *params, |
@@ -119,7 +121,9 @@ static int dmaengine_pcm_hw_params(struct snd_pcm_substream *substream, | |||
119 | static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substream) | 121 | static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substream) |
120 | { | 122 | { |
121 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 123 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
122 | struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); | 124 | struct snd_soc_component *component = |
125 | snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME); | ||
126 | struct dmaengine_pcm *pcm = soc_component_to_pcm(component); | ||
123 | struct device *dma_dev = dmaengine_dma_dev(pcm, substream); | 127 | struct device *dma_dev = dmaengine_dma_dev(pcm, substream); |
124 | struct dma_chan *chan = pcm->chan[substream->stream]; | 128 | struct dma_chan *chan = pcm->chan[substream->stream]; |
125 | struct snd_dmaengine_dai_dma_data *dma_data; | 129 | struct snd_dmaengine_dai_dma_data *dma_data; |
@@ -128,7 +132,8 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea | |||
128 | u32 addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | | 132 | u32 addr_widths = BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | |
129 | BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | | 133 | BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | |
130 | BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); | 134 | BIT(DMA_SLAVE_BUSWIDTH_4_BYTES); |
131 | int i, ret; | 135 | snd_pcm_format_t i; |
136 | int ret; | ||
132 | 137 | ||
133 | if (pcm->config && pcm->config->pcm_hardware) | 138 | if (pcm->config && pcm->config->pcm_hardware) |
134 | return snd_soc_set_runtime_hwparams(substream, | 139 | return snd_soc_set_runtime_hwparams(substream, |
@@ -178,7 +183,7 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea | |||
178 | * default assumption is that it supports 1, 2 and 4 bytes | 183 | * default assumption is that it supports 1, 2 and 4 bytes |
179 | * widths. | 184 | * widths. |
180 | */ | 185 | */ |
181 | for (i = 0; i <= SNDRV_PCM_FORMAT_LAST; i++) { | 186 | for (i = SNDRV_PCM_FORMAT_FIRST; i <= SNDRV_PCM_FORMAT_LAST; i++) { |
182 | int bits = snd_pcm_format_physical_width(i); | 187 | int bits = snd_pcm_format_physical_width(i); |
183 | 188 | ||
184 | /* | 189 | /* |
@@ -206,7 +211,9 @@ static int dmaengine_pcm_set_runtime_hwparams(struct snd_pcm_substream *substrea | |||
206 | static int dmaengine_pcm_open(struct snd_pcm_substream *substream) | 211 | static int dmaengine_pcm_open(struct snd_pcm_substream *substream) |
207 | { | 212 | { |
208 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 213 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
209 | struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); | 214 | struct snd_soc_component *component = |
215 | snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME); | ||
216 | struct dmaengine_pcm *pcm = soc_component_to_pcm(component); | ||
210 | struct dma_chan *chan = pcm->chan[substream->stream]; | 217 | struct dma_chan *chan = pcm->chan[substream->stream]; |
211 | int ret; | 218 | int ret; |
212 | 219 | ||
@@ -221,7 +228,9 @@ static struct dma_chan *dmaengine_pcm_compat_request_channel( | |||
221 | struct snd_soc_pcm_runtime *rtd, | 228 | struct snd_soc_pcm_runtime *rtd, |
222 | struct snd_pcm_substream *substream) | 229 | struct snd_pcm_substream *substream) |
223 | { | 230 | { |
224 | struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); | 231 | struct snd_soc_component *component = |
232 | snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME); | ||
233 | struct dmaengine_pcm *pcm = soc_component_to_pcm(component); | ||
225 | struct snd_dmaengine_dai_dma_data *dma_data; | 234 | struct snd_dmaengine_dai_dma_data *dma_data; |
226 | dma_filter_fn fn = NULL; | 235 | dma_filter_fn fn = NULL; |
227 | 236 | ||
@@ -260,9 +269,11 @@ static bool dmaengine_pcm_can_report_residue(struct device *dev, | |||
260 | 269 | ||
261 | static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) | 270 | static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) |
262 | { | 271 | { |
263 | struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); | 272 | struct snd_soc_component *component = |
273 | snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME); | ||
274 | struct dmaengine_pcm *pcm = soc_component_to_pcm(component); | ||
264 | const struct snd_dmaengine_pcm_config *config = pcm->config; | 275 | const struct snd_dmaengine_pcm_config *config = pcm->config; |
265 | struct device *dev = rtd->platform->dev; | 276 | struct device *dev = component->dev; |
266 | struct snd_dmaengine_dai_dma_data *dma_data; | 277 | struct snd_dmaengine_dai_dma_data *dma_data; |
267 | struct snd_pcm_substream *substream; | 278 | struct snd_pcm_substream *substream; |
268 | size_t prealloc_buffer_size; | 279 | size_t prealloc_buffer_size; |
@@ -296,7 +307,7 @@ static int dmaengine_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
296 | } | 307 | } |
297 | 308 | ||
298 | if (!pcm->chan[i]) { | 309 | if (!pcm->chan[i]) { |
299 | dev_err(rtd->platform->dev, | 310 | dev_err(component->dev, |
300 | "Missing dma channel for stream: %d\n", i); | 311 | "Missing dma channel for stream: %d\n", i); |
301 | return -EINVAL; | 312 | return -EINVAL; |
302 | } | 313 | } |
@@ -320,7 +331,9 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer( | |||
320 | struct snd_pcm_substream *substream) | 331 | struct snd_pcm_substream *substream) |
321 | { | 332 | { |
322 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | 333 | struct snd_soc_pcm_runtime *rtd = substream->private_data; |
323 | struct dmaengine_pcm *pcm = soc_platform_to_pcm(rtd->platform); | 334 | struct snd_soc_component *component = |
335 | snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME); | ||
336 | struct dmaengine_pcm *pcm = soc_component_to_pcm(component); | ||
324 | 337 | ||
325 | if (pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE) | 338 | if (pcm->flags & SND_DMAENGINE_PCM_FLAG_NO_RESIDUE) |
326 | return snd_dmaengine_pcm_pointer_no_residue(substream); | 339 | return snd_dmaengine_pcm_pointer_no_residue(substream); |
@@ -328,6 +341,41 @@ static snd_pcm_uframes_t dmaengine_pcm_pointer( | |||
328 | return snd_dmaengine_pcm_pointer(substream); | 341 | return snd_dmaengine_pcm_pointer(substream); |
329 | } | 342 | } |
330 | 343 | ||
344 | static int dmaengine_copy_user(struct snd_pcm_substream *substream, | ||
345 | int channel, unsigned long hwoff, | ||
346 | void *buf, unsigned long bytes) | ||
347 | { | ||
348 | struct snd_soc_pcm_runtime *rtd = substream->private_data; | ||
349 | struct snd_soc_component *component = | ||
350 | snd_soc_rtdcom_lookup(rtd, SND_DMAENGINE_PCM_DRV_NAME); | ||
351 | struct snd_pcm_runtime *runtime = substream->runtime; | ||
352 | struct dmaengine_pcm *pcm = soc_component_to_pcm(component); | ||
353 | int (*process)(struct snd_pcm_substream *substream, | ||
354 | int channel, unsigned long hwoff, | ||
355 | void *buf, unsigned long bytes) = pcm->config->process; | ||
356 | bool is_playback = substream->stream == SNDRV_PCM_STREAM_PLAYBACK; | ||
357 | void *dma_ptr = runtime->dma_area + hwoff + | ||
358 | channel * (runtime->dma_bytes / runtime->channels); | ||
359 | int ret; | ||
360 | |||
361 | if (is_playback) | ||
362 | if (copy_from_user(dma_ptr, (void __user *)buf, bytes)) | ||
363 | return -EFAULT; | ||
364 | |||
365 | if (process) { | ||
366 | ret = process(substream, channel, hwoff, | ||
367 | (void __user *)buf, bytes); | ||
368 | if (ret < 0) | ||
369 | return ret; | ||
370 | } | ||
371 | |||
372 | if (!is_playback) | ||
373 | if (copy_to_user((void __user *)buf, dma_ptr, bytes)) | ||
374 | return -EFAULT; | ||
375 | |||
376 | return 0; | ||
377 | } | ||
378 | |||
331 | static const struct snd_pcm_ops dmaengine_pcm_ops = { | 379 | static const struct snd_pcm_ops dmaengine_pcm_ops = { |
332 | .open = dmaengine_pcm_open, | 380 | .open = dmaengine_pcm_open, |
333 | .close = snd_dmaengine_pcm_close, | 381 | .close = snd_dmaengine_pcm_close, |
@@ -338,14 +386,31 @@ static const struct snd_pcm_ops dmaengine_pcm_ops = { | |||
338 | .pointer = dmaengine_pcm_pointer, | 386 | .pointer = dmaengine_pcm_pointer, |
339 | }; | 387 | }; |
340 | 388 | ||
341 | static const struct snd_soc_platform_driver dmaengine_pcm_platform = { | 389 | static const struct snd_pcm_ops dmaengine_pcm_process_ops = { |
342 | .component_driver = { | 390 | .open = dmaengine_pcm_open, |
343 | .probe_order = SND_SOC_COMP_ORDER_LATE, | 391 | .close = snd_dmaengine_pcm_close, |
344 | }, | 392 | .ioctl = snd_pcm_lib_ioctl, |
393 | .hw_params = dmaengine_pcm_hw_params, | ||
394 | .hw_free = snd_pcm_lib_free_pages, | ||
395 | .trigger = snd_dmaengine_pcm_trigger, | ||
396 | .pointer = dmaengine_pcm_pointer, | ||
397 | .copy_user = dmaengine_copy_user, | ||
398 | }; | ||
399 | |||
400 | static const struct snd_soc_component_driver dmaengine_pcm_component = { | ||
401 | .name = SND_DMAENGINE_PCM_DRV_NAME, | ||
402 | .probe_order = SND_SOC_COMP_ORDER_LATE, | ||
345 | .ops = &dmaengine_pcm_ops, | 403 | .ops = &dmaengine_pcm_ops, |
346 | .pcm_new = dmaengine_pcm_new, | 404 | .pcm_new = dmaengine_pcm_new, |
347 | }; | 405 | }; |
348 | 406 | ||
407 | static const struct snd_soc_component_driver dmaengine_pcm_component_process = { | ||
408 | .name = SND_DMAENGINE_PCM_DRV_NAME, | ||
409 | .probe_order = SND_SOC_COMP_ORDER_LATE, | ||
410 | .ops = &dmaengine_pcm_process_ops, | ||
411 | .pcm_new = dmaengine_pcm_new, | ||
412 | }; | ||
413 | |||
349 | static const char * const dmaengine_pcm_dma_channel_names[] = { | 414 | static const char * const dmaengine_pcm_dma_channel_names[] = { |
350 | [SNDRV_PCM_STREAM_PLAYBACK] = "tx", | 415 | [SNDRV_PCM_STREAM_PLAYBACK] = "tx", |
351 | [SNDRV_PCM_STREAM_CAPTURE] = "rx", | 416 | [SNDRV_PCM_STREAM_CAPTURE] = "rx", |
@@ -431,15 +496,23 @@ int snd_dmaengine_pcm_register(struct device *dev, | |||
431 | if (!pcm) | 496 | if (!pcm) |
432 | return -ENOMEM; | 497 | return -ENOMEM; |
433 | 498 | ||
499 | #ifdef CONFIG_DEBUG_FS | ||
500 | pcm->component.debugfs_prefix = "dma"; | ||
501 | #endif | ||
434 | pcm->config = config; | 502 | pcm->config = config; |
435 | pcm->flags = flags; | 503 | pcm->flags = flags; |
436 | 504 | ||
437 | ret = dmaengine_pcm_request_chan_of(pcm, dev, config); | 505 | ret = dmaengine_pcm_request_chan_of(pcm, dev, config); |
438 | if (ret) | 506 | if (ret) |
439 | goto err_free_dma; | 507 | goto err_free_pcm; |
440 | 508 | ||
441 | ret = snd_soc_add_platform(dev, &pcm->platform, | 509 | if (config && config->process) |
442 | &dmaengine_pcm_platform); | 510 | ret = snd_soc_add_component(dev, &pcm->component, |
511 | &dmaengine_pcm_component_process, | ||
512 | NULL, 0); | ||
513 | else | ||
514 | ret = snd_soc_add_component(dev, &pcm->component, | ||
515 | &dmaengine_pcm_component, NULL, 0); | ||
443 | if (ret) | 516 | if (ret) |
444 | goto err_free_dma; | 517 | goto err_free_dma; |
445 | 518 | ||
@@ -447,6 +520,7 @@ int snd_dmaengine_pcm_register(struct device *dev, | |||
447 | 520 | ||
448 | err_free_dma: | 521 | err_free_dma: |
449 | dmaengine_pcm_release_chan(pcm); | 522 | dmaengine_pcm_release_chan(pcm); |
523 | err_free_pcm: | ||
450 | kfree(pcm); | 524 | kfree(pcm); |
451 | return ret; | 525 | return ret; |
452 | } | 526 | } |
@@ -461,16 +535,16 @@ EXPORT_SYMBOL_GPL(snd_dmaengine_pcm_register); | |||
461 | */ | 535 | */ |
462 | void snd_dmaengine_pcm_unregister(struct device *dev) | 536 | void snd_dmaengine_pcm_unregister(struct device *dev) |
463 | { | 537 | { |
464 | struct snd_soc_platform *platform; | 538 | struct snd_soc_component *component; |
465 | struct dmaengine_pcm *pcm; | 539 | struct dmaengine_pcm *pcm; |
466 | 540 | ||
467 | platform = snd_soc_lookup_platform(dev); | 541 | component = snd_soc_lookup_component(dev, SND_DMAENGINE_PCM_DRV_NAME); |
468 | if (!platform) | 542 | if (!component) |
469 | return; | 543 | return; |
470 | 544 | ||
471 | pcm = soc_platform_to_pcm(platform); | 545 | pcm = soc_component_to_pcm(component); |
472 | 546 | ||
473 | snd_soc_remove_platform(platform); | 547 | snd_soc_unregister_component(dev); |
474 | dmaengine_pcm_release_chan(pcm); | 548 | dmaengine_pcm_release_chan(pcm); |
475 | kfree(pcm); | 549 | kfree(pcm); |
476 | } | 550 | } |
diff --git a/sound/soc/soc-utils.c b/sound/soc/soc-utils.c index bcd3da2739e2..2d9e98bd1530 100644 --- a/sound/soc/soc-utils.c +++ b/sound/soc/soc-utils.c | |||
@@ -284,11 +284,16 @@ static const struct snd_pcm_ops dummy_dma_ops = { | |||
284 | .ioctl = snd_pcm_lib_ioctl, | 284 | .ioctl = snd_pcm_lib_ioctl, |
285 | }; | 285 | }; |
286 | 286 | ||
287 | static const struct snd_soc_platform_driver dummy_platform = { | 287 | static const struct snd_soc_component_driver dummy_platform = { |
288 | .ops = &dummy_dma_ops, | 288 | .ops = &dummy_dma_ops, |
289 | }; | 289 | }; |
290 | 290 | ||
291 | static const struct snd_soc_codec_driver dummy_codec; | 291 | static const struct snd_soc_component_driver dummy_codec = { |
292 | .idle_bias_on = 1, | ||
293 | .use_pmdown_time = 1, | ||
294 | .endianness = 1, | ||
295 | .non_legacy_dai_naming = 1, | ||
296 | }; | ||
292 | 297 | ||
293 | #define STUB_RATES SNDRV_PCM_RATE_8000_192000 | 298 | #define STUB_RATES SNDRV_PCM_RATE_8000_192000 |
294 | #define STUB_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ | 299 | #define STUB_FORMATS (SNDRV_PCM_FMTBIT_S8 | \ |
@@ -338,33 +343,22 @@ static int snd_soc_dummy_probe(struct platform_device *pdev) | |||
338 | { | 343 | { |
339 | int ret; | 344 | int ret; |
340 | 345 | ||
341 | ret = snd_soc_register_codec(&pdev->dev, &dummy_codec, &dummy_dai, 1); | 346 | ret = devm_snd_soc_register_component(&pdev->dev, |
347 | &dummy_codec, &dummy_dai, 1); | ||
342 | if (ret < 0) | 348 | if (ret < 0) |
343 | return ret; | 349 | return ret; |
344 | 350 | ||
345 | ret = snd_soc_register_platform(&pdev->dev, &dummy_platform); | 351 | ret = devm_snd_soc_register_component(&pdev->dev, &dummy_platform, |
346 | if (ret < 0) { | 352 | NULL, 0); |
347 | snd_soc_unregister_codec(&pdev->dev); | ||
348 | return ret; | ||
349 | } | ||
350 | 353 | ||
351 | return ret; | 354 | return ret; |
352 | } | 355 | } |
353 | 356 | ||
354 | static int snd_soc_dummy_remove(struct platform_device *pdev) | ||
355 | { | ||
356 | snd_soc_unregister_platform(&pdev->dev); | ||
357 | snd_soc_unregister_codec(&pdev->dev); | ||
358 | |||
359 | return 0; | ||
360 | } | ||
361 | |||
362 | static struct platform_driver soc_dummy_driver = { | 357 | static struct platform_driver soc_dummy_driver = { |
363 | .driver = { | 358 | .driver = { |
364 | .name = "snd-soc-dummy", | 359 | .name = "snd-soc-dummy", |
365 | }, | 360 | }, |
366 | .probe = snd_soc_dummy_probe, | 361 | .probe = snd_soc_dummy_probe, |
367 | .remove = snd_soc_dummy_remove, | ||
368 | }; | 362 | }; |
369 | 363 | ||
370 | static struct platform_device *soc_dummy_dev; | 364 | static struct platform_device *soc_dummy_dev; |
diff --git a/sound/soc/stm/stm32_adfsdm.c b/sound/soc/stm/stm32_adfsdm.c index 7306e3eca9e1..db73fef3e500 100644 --- a/sound/soc/stm/stm32_adfsdm.c +++ b/sound/soc/stm/stm32_adfsdm.c | |||
@@ -281,7 +281,7 @@ static void stm32_adfsdm_pcm_free(struct snd_pcm *pcm) | |||
281 | } | 281 | } |
282 | } | 282 | } |
283 | 283 | ||
284 | static struct snd_soc_platform_driver stm32_adfsdm_soc_platform = { | 284 | static struct snd_soc_component_driver stm32_adfsdm_soc_platform = { |
285 | .ops = &stm32_adfsdm_pcm_ops, | 285 | .ops = &stm32_adfsdm_pcm_ops, |
286 | .pcm_new = stm32_adfsdm_pcm_new, | 286 | .pcm_new = stm32_adfsdm_pcm_new, |
287 | .pcm_free = stm32_adfsdm_pcm_free, | 287 | .pcm_free = stm32_adfsdm_pcm_free, |
@@ -322,8 +322,9 @@ static int stm32_adfsdm_probe(struct platform_device *pdev) | |||
322 | if (IS_ERR(priv->iio_cb)) | 322 | if (IS_ERR(priv->iio_cb)) |
323 | return PTR_ERR(priv->iio_cb); | 323 | return PTR_ERR(priv->iio_cb); |
324 | 324 | ||
325 | ret = devm_snd_soc_register_platform(&pdev->dev, | 325 | ret = devm_snd_soc_register_component(&pdev->dev, |
326 | &stm32_adfsdm_soc_platform); | 326 | &stm32_adfsdm_soc_platform, |
327 | NULL, 0); | ||
327 | if (ret < 0) | 328 | if (ret < 0) |
328 | dev_err(&pdev->dev, "%s: Failed to register PCM platform\n", | 329 | dev_err(&pdev->dev, "%s: Failed to register PCM platform\n", |
329 | __func__); | 330 | __func__); |
diff --git a/sound/soc/txx9/txx9aclc.c b/sound/soc/txx9/txx9aclc.c index a2bb68fea5a3..8d31fe628e2f 100644 --- a/sound/soc/txx9/txx9aclc.c +++ b/sound/soc/txx9/txx9aclc.c | |||
@@ -23,6 +23,8 @@ | |||
23 | #include <sound/soc.h> | 23 | #include <sound/soc.h> |
24 | #include "txx9aclc.h" | 24 | #include "txx9aclc.h" |
25 | 25 | ||
26 | #define DRV_NAME "txx9aclc" | ||
27 | |||
26 | static struct txx9aclc_soc_device { | 28 | static struct txx9aclc_soc_device { |
27 | struct txx9aclc_dmadata dmadata[2]; | 29 | struct txx9aclc_dmadata dmadata[2]; |
28 | } txx9aclc_soc_device; | 30 | } txx9aclc_soc_device; |
@@ -53,6 +55,7 @@ static int txx9aclc_pcm_hw_params(struct snd_pcm_substream *substream, | |||
53 | { | 55 | { |
54 | struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); | 56 | struct snd_soc_pcm_runtime *rtd = snd_pcm_substream_chip(substream); |
55 | struct snd_pcm_runtime *runtime = substream->runtime; | 57 | struct snd_pcm_runtime *runtime = substream->runtime; |
58 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); | ||
56 | struct txx9aclc_dmadata *dmadata = runtime->private_data; | 59 | struct txx9aclc_dmadata *dmadata = runtime->private_data; |
57 | int ret; | 60 | int ret; |
58 | 61 | ||
@@ -60,13 +63,13 @@ static int txx9aclc_pcm_hw_params(struct snd_pcm_substream *substream, | |||
60 | if (ret < 0) | 63 | if (ret < 0) |
61 | return ret; | 64 | return ret; |
62 | 65 | ||
63 | dev_dbg(rtd->platform->dev, | 66 | dev_dbg(component->dev, |
64 | "runtime->dma_area = %#lx dma_addr = %#lx dma_bytes = %zd " | 67 | "runtime->dma_area = %#lx dma_addr = %#lx dma_bytes = %zd " |
65 | "runtime->min_align %ld\n", | 68 | "runtime->min_align %ld\n", |
66 | (unsigned long)runtime->dma_area, | 69 | (unsigned long)runtime->dma_area, |
67 | (unsigned long)runtime->dma_addr, runtime->dma_bytes, | 70 | (unsigned long)runtime->dma_addr, runtime->dma_bytes, |
68 | runtime->min_align); | 71 | runtime->min_align); |
69 | dev_dbg(rtd->platform->dev, | 72 | dev_dbg(component->dev, |
70 | "periods %d period_bytes %d stream %d\n", | 73 | "periods %d period_bytes %d stream %d\n", |
71 | params_periods(params), params_period_bytes(params), | 74 | params_periods(params), params_period_bytes(params), |
72 | substream->stream); | 75 | substream->stream); |
@@ -287,7 +290,8 @@ static int txx9aclc_pcm_new(struct snd_soc_pcm_runtime *rtd) | |||
287 | struct snd_card *card = rtd->card->snd_card; | 290 | struct snd_card *card = rtd->card->snd_card; |
288 | struct snd_soc_dai *dai = rtd->cpu_dai; | 291 | struct snd_soc_dai *dai = rtd->cpu_dai; |
289 | struct snd_pcm *pcm = rtd->pcm; | 292 | struct snd_pcm *pcm = rtd->pcm; |
290 | struct platform_device *pdev = to_platform_device(rtd->platform->dev); | 293 | struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME); |
294 | struct platform_device *pdev = to_platform_device(component->dev); | ||
291 | struct txx9aclc_soc_device *dev; | 295 | struct txx9aclc_soc_device *dev; |
292 | struct resource *r; | 296 | struct resource *r; |
293 | int i; | 297 | int i; |
@@ -371,15 +375,15 @@ static int txx9aclc_dma_init(struct txx9aclc_soc_device *dev, | |||
371 | return 0; | 375 | return 0; |
372 | } | 376 | } |
373 | 377 | ||
374 | static int txx9aclc_pcm_probe(struct snd_soc_platform *platform) | 378 | static int txx9aclc_pcm_probe(struct snd_soc_component *component) |
375 | { | 379 | { |
376 | snd_soc_platform_set_drvdata(platform, &txx9aclc_soc_device); | 380 | snd_soc_component_set_drvdata(component, &txx9aclc_soc_device); |
377 | return 0; | 381 | return 0; |
378 | } | 382 | } |
379 | 383 | ||
380 | static int txx9aclc_pcm_remove(struct snd_soc_platform *platform) | 384 | static void txx9aclc_pcm_remove(struct snd_soc_component *component) |
381 | { | 385 | { |
382 | struct txx9aclc_soc_device *dev = snd_soc_platform_get_drvdata(platform); | 386 | struct txx9aclc_soc_device *dev = snd_soc_component_get_drvdata(component); |
383 | struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; | 387 | struct txx9aclc_plat_drvdata *drvdata = txx9aclc_drvdata; |
384 | void __iomem *base = drvdata->base; | 388 | void __iomem *base = drvdata->base; |
385 | int i; | 389 | int i; |
@@ -400,10 +404,10 @@ static int txx9aclc_pcm_remove(struct snd_soc_platform *platform) | |||
400 | } | 404 | } |
401 | dev->dmadata[i].dma_chan = NULL; | 405 | dev->dmadata[i].dma_chan = NULL; |
402 | } | 406 | } |
403 | return 0; | ||
404 | } | 407 | } |
405 | 408 | ||
406 | static const struct snd_soc_platform_driver txx9aclc_soc_platform = { | 409 | static const struct snd_soc_component_driver txx9aclc_soc_component = { |
410 | .name = DRV_NAME, | ||
407 | .probe = txx9aclc_pcm_probe, | 411 | .probe = txx9aclc_pcm_probe, |
408 | .remove = txx9aclc_pcm_remove, | 412 | .remove = txx9aclc_pcm_remove, |
409 | .ops = &txx9aclc_pcm_ops, | 413 | .ops = &txx9aclc_pcm_ops, |
@@ -412,8 +416,8 @@ static const struct snd_soc_platform_driver txx9aclc_soc_platform = { | |||
412 | 416 | ||
413 | static int txx9aclc_soc_platform_probe(struct platform_device *pdev) | 417 | static int txx9aclc_soc_platform_probe(struct platform_device *pdev) |
414 | { | 418 | { |
415 | return devm_snd_soc_register_platform(&pdev->dev, | 419 | return devm_snd_soc_register_component(&pdev->dev, |
416 | &txx9aclc_soc_platform); | 420 | &txx9aclc_soc_component, NULL, 0); |
417 | } | 421 | } |
418 | 422 | ||
419 | static struct platform_driver txx9aclc_pcm_driver = { | 423 | static struct platform_driver txx9aclc_pcm_driver = { |
diff --git a/sound/soc/xtensa/xtfpga-i2s.c b/sound/soc/xtensa/xtfpga-i2s.c index 2472144b329e..503560916620 100644 --- a/sound/soc/xtensa/xtfpga-i2s.c +++ b/sound/soc/xtensa/xtfpga-i2s.c | |||
@@ -483,13 +483,10 @@ static const struct snd_pcm_ops xtfpga_pcm_ops = { | |||
483 | .pointer = xtfpga_pcm_pointer, | 483 | .pointer = xtfpga_pcm_pointer, |
484 | }; | 484 | }; |
485 | 485 | ||
486 | static const struct snd_soc_platform_driver xtfpga_soc_platform = { | ||
487 | .pcm_new = xtfpga_pcm_new, | ||
488 | .ops = &xtfpga_pcm_ops, | ||
489 | }; | ||
490 | |||
491 | static const struct snd_soc_component_driver xtfpga_i2s_component = { | 486 | static const struct snd_soc_component_driver xtfpga_i2s_component = { |
492 | .name = DRV_NAME, | 487 | .name = DRV_NAME, |
488 | .pcm_new = xtfpga_pcm_new, | ||
489 | .ops = &xtfpga_pcm_ops, | ||
493 | }; | 490 | }; |
494 | 491 | ||
495 | static const struct snd_soc_dai_ops xtfpga_i2s_dai_ops = { | 492 | static const struct snd_soc_dai_ops xtfpga_i2s_dai_ops = { |
@@ -591,18 +588,13 @@ static int xtfpga_i2s_probe(struct platform_device *pdev) | |||
591 | goto err; | 588 | goto err; |
592 | } | 589 | } |
593 | 590 | ||
594 | err = snd_soc_register_platform(&pdev->dev, &xtfpga_soc_platform); | ||
595 | if (err < 0) { | ||
596 | dev_err(&pdev->dev, "couldn't register platform\n"); | ||
597 | goto err; | ||
598 | } | ||
599 | err = devm_snd_soc_register_component(&pdev->dev, | 591 | err = devm_snd_soc_register_component(&pdev->dev, |
600 | &xtfpga_i2s_component, | 592 | &xtfpga_i2s_component, |
601 | xtfpga_i2s_dai, | 593 | xtfpga_i2s_dai, |
602 | ARRAY_SIZE(xtfpga_i2s_dai)); | 594 | ARRAY_SIZE(xtfpga_i2s_dai)); |
603 | if (err < 0) { | 595 | if (err < 0) { |
604 | dev_err(&pdev->dev, "couldn't register component\n"); | 596 | dev_err(&pdev->dev, "couldn't register component\n"); |
605 | goto err_unregister_platform; | 597 | goto err; |
606 | } | 598 | } |
607 | 599 | ||
608 | pm_runtime_enable(&pdev->dev); | 600 | pm_runtime_enable(&pdev->dev); |
@@ -615,8 +607,6 @@ static int xtfpga_i2s_probe(struct platform_device *pdev) | |||
615 | 607 | ||
616 | err_pm_disable: | 608 | err_pm_disable: |
617 | pm_runtime_disable(&pdev->dev); | 609 | pm_runtime_disable(&pdev->dev); |
618 | err_unregister_platform: | ||
619 | snd_soc_unregister_platform(&pdev->dev); | ||
620 | err: | 610 | err: |
621 | dev_err(&pdev->dev, "%s: err = %d\n", __func__, err); | 611 | dev_err(&pdev->dev, "%s: err = %d\n", __func__, err); |
622 | return err; | 612 | return err; |
@@ -626,7 +616,6 @@ static int xtfpga_i2s_remove(struct platform_device *pdev) | |||
626 | { | 616 | { |
627 | struct xtfpga_i2s *i2s = dev_get_drvdata(&pdev->dev); | 617 | struct xtfpga_i2s *i2s = dev_get_drvdata(&pdev->dev); |
628 | 618 | ||
629 | snd_soc_unregister_platform(&pdev->dev); | ||
630 | if (i2s->regmap && !IS_ERR(i2s->regmap)) { | 619 | if (i2s->regmap && !IS_ERR(i2s->regmap)) { |
631 | regmap_write(i2s->regmap, XTFPGA_I2S_CONFIG, 0); | 620 | regmap_write(i2s->regmap, XTFPGA_I2S_CONFIG, 0); |
632 | regmap_write(i2s->regmap, XTFPGA_I2S_INT_MASK, 0); | 621 | regmap_write(i2s->regmap, XTFPGA_I2S_INT_MASK, 0); |