OSDN Git Service

ASoC: fsl: asrc: replace platform to component
authorKuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Mon, 29 Jan 2018 02:46:46 +0000 (02:46 +0000)
committerMark Brown <broonie@kernel.org>
Mon, 12 Feb 2018 11:45:23 +0000 (11:45 +0000)
Now platform can be replaced to component, let's do it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Tested-by: Nicolin Chen <nicoleotsuka@gmail.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
sound/soc/fsl/fsl_asrc.c
sound/soc/fsl/fsl_asrc.h
sound/soc/fsl/fsl_asrc_dma.c

index 806d399..adfb813 100644 (file)
@@ -582,10 +582,6 @@ static struct snd_soc_dai_driver fsl_asrc_dai = {
        .ops = &fsl_asrc_dai_ops,
 };
 
-static const struct snd_soc_component_driver fsl_asrc_component = {
-       .name = "fsl-asrc-dai",
-};
-
 static bool fsl_asrc_readable_reg(struct device *dev, unsigned int reg)
 {
        switch (reg) {
@@ -927,12 +923,6 @@ static int fsl_asrc_probe(struct platform_device *pdev)
                return ret;
        }
 
-       ret = devm_snd_soc_register_platform(&pdev->dev, &fsl_asrc_platform);
-       if (ret) {
-               dev_err(&pdev->dev, "failed to register ASoC platform\n");
-               return ret;
-       }
-
        return 0;
 }
 
index 2c5856a..d558dd5 100644 (file)
@@ -462,6 +462,7 @@ struct fsl_asrc {
        u32 regcache_cfg;
 };
 
-extern struct snd_soc_platform_driver fsl_asrc_platform;
+#define DRV_NAME "fsl-asrc-dai"
+extern struct snd_soc_component_driver fsl_asrc_component;
 struct dma_chan *fsl_asrc_get_dma_channel(struct fsl_asrc_pair *pair, bool dir);
 #endif /* _FSL_ASRC_H */
index e1b97e5..565e16d 100644 (file)
@@ -64,7 +64,8 @@ static int fsl_asrc_dma_prepare_and_submit(struct snd_pcm_substream *substream)
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct fsl_asrc_pair *pair = runtime->private_data;
-       struct device *dev = rtd->platform->dev;
+       struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+       struct device *dev = component->dev;
        unsigned long flags = DMA_CTRL_ACK;
 
        /* Prepare and submit Front-End DMA channel */
@@ -137,12 +138,13 @@ static int fsl_asrc_dma_hw_params(struct snd_pcm_substream *substream,
        bool tx = substream->stream == SNDRV_PCM_STREAM_PLAYBACK;
        struct snd_dmaengine_dai_dma_data *dma_params_fe = NULL;
        struct snd_dmaengine_dai_dma_data *dma_params_be = NULL;
+       struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
        struct snd_pcm_runtime *runtime = substream->runtime;
        struct fsl_asrc_pair *pair = runtime->private_data;
        struct fsl_asrc *asrc_priv = pair->asrc_priv;
        struct dma_slave_config config_fe, config_be;
        enum asrc_pair_index index = pair->index;
-       struct device *dev = rtd->platform->dev;
+       struct device *dev = component->dev;
        int stream = substream->stream;
        struct imx_dma_data *tmp_data;
        struct snd_soc_dpcm *dpcm;
@@ -274,7 +276,8 @@ static int fsl_asrc_dma_startup(struct snd_pcm_substream *substream)
 {
        struct snd_soc_pcm_runtime *rtd = substream->private_data;
        struct snd_pcm_runtime *runtime = substream->runtime;
-       struct device *dev = rtd->platform->dev;
+       struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
+       struct device *dev = component->dev;
        struct fsl_asrc *asrc_priv = dev_get_drvdata(dev);
        struct fsl_asrc_pair *pair;
 
@@ -381,9 +384,10 @@ static void fsl_asrc_dma_pcm_free(struct snd_pcm *pcm)
        }
 }
 
-struct snd_soc_platform_driver fsl_asrc_platform = {
+struct snd_soc_component_driver fsl_asrc_component = {
+       .name           = DRV_NAME,
        .ops            = &fsl_asrc_dma_pcm_ops,
        .pcm_new        = fsl_asrc_dma_pcm_new,
        .pcm_free       = fsl_asrc_dma_pcm_free,
 };
-EXPORT_SYMBOL_GPL(fsl_asrc_platform);
+EXPORT_SYMBOL_GPL(fsl_asrc_component);