From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: [PATCH v2 21/39] ASoC: fsl: asrc: replace platform to component Date: Mon, 29 Jan 2018 02:46:46 +0000 Message-ID: <87a7wx758g.wl%kuninori.morimoto.gx@renesas.com> References: <87607l8k9i.wl%kuninori.morimoto.gx@renesas.com> <874ln58k4s.wl%kuninori.morimoto.gx@renesas.com> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Return-path: Received: from relmlie2.idc.renesas.com (relmlor3.renesas.com [210.160.252.173]) by alsa0.perex.cz (Postfix) with ESMTP id 5A70E267399 for ; Mon, 29 Jan 2018 03:46:50 +0100 (CET) In-Reply-To: <874ln58k4s.wl%kuninori.morimoto.gx@renesas.com> List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: alsa-devel-bounces@alsa-project.org Sender: alsa-devel-bounces@alsa-project.org To: Mark Brown Cc: Linux-ALSA List-Id: alsa-devel@alsa-project.org From: Kuninori Morimoto Now platform can be replaced to component, let's do it. Signed-off-by: Kuninori Morimoto Tested-by: Nicolin Chen --- sound/soc/fsl/fsl_asrc.c | 10 ---------- sound/soc/fsl/fsl_asrc.h | 3 ++- sound/soc/fsl/fsl_asrc_dma.c | 14 +++++++++----- 3 files changed, 11 insertions(+), 16 deletions(-) diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c index 806d399..adfb813 100644 --- a/sound/soc/fsl/fsl_asrc.c +++ b/sound/soc/fsl/fsl_asrc.c @@ -582,10 +582,6 @@ static int fsl_asrc_dai_probe(struct snd_soc_dai *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; } diff --git a/sound/soc/fsl/fsl_asrc.h b/sound/soc/fsl/fsl_asrc.h index 2c5856a..d558dd5 100644 --- a/sound/soc/fsl/fsl_asrc.h +++ b/sound/soc/fsl/fsl_asrc.h @@ -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 */ diff --git a/sound/soc/fsl/fsl_asrc_dma.c b/sound/soc/fsl/fsl_asrc_dma.c index e1b97e5..565e16d8 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) 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); -- 1.9.1