ASoC: fsl: mpc5200: replace platform to component
Now platform can be replaced to component, let's do it. Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
parent
1d0a01f2d4
commit
60bceb8029
|
@ -22,6 +22,8 @@
|
||||||
|
|
||||||
#include "mpc5200_dma.h"
|
#include "mpc5200_dma.h"
|
||||||
|
|
||||||
|
#define DRV_NAME "mpc5200_dma"
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* Interrupt handlers
|
* Interrupt handlers
|
||||||
*/
|
*/
|
||||||
|
@ -300,12 +302,13 @@ static const struct snd_pcm_ops psc_dma_ops = {
|
||||||
static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
|
static int psc_dma_new(struct snd_soc_pcm_runtime *rtd)
|
||||||
{
|
{
|
||||||
struct snd_card *card = rtd->card->snd_card;
|
struct snd_card *card = rtd->card->snd_card;
|
||||||
|
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||||
struct snd_soc_dai *dai = rtd->cpu_dai;
|
struct snd_soc_dai *dai = rtd->cpu_dai;
|
||||||
struct snd_pcm *pcm = rtd->pcm;
|
struct snd_pcm *pcm = rtd->pcm;
|
||||||
size_t size = psc_dma_hardware.buffer_bytes_max;
|
size_t size = psc_dma_hardware.buffer_bytes_max;
|
||||||
int rc;
|
int rc;
|
||||||
|
|
||||||
dev_dbg(rtd->platform->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n",
|
dev_dbg(component->dev, "psc_dma_new(card=%p, dai=%p, pcm=%p)\n",
|
||||||
card, dai, pcm);
|
card, dai, pcm);
|
||||||
|
|
||||||
rc = dma_coerce_mask_and_coherent(card->dev, DMA_BIT_MASK(32));
|
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)
|
||||||
static void psc_dma_free(struct snd_pcm *pcm)
|
static void psc_dma_free(struct snd_pcm *pcm)
|
||||||
{
|
{
|
||||||
struct snd_soc_pcm_runtime *rtd = pcm->private_data;
|
struct snd_soc_pcm_runtime *rtd = pcm->private_data;
|
||||||
|
struct snd_soc_component *component = snd_soc_rtdcom_lookup(rtd, DRV_NAME);
|
||||||
struct snd_pcm_substream *substream;
|
struct snd_pcm_substream *substream;
|
||||||
int stream;
|
int stream;
|
||||||
|
|
||||||
dev_dbg(rtd->platform->dev, "psc_dma_free(pcm=%p)\n", pcm);
|
dev_dbg(component->dev, "psc_dma_free(pcm=%p)\n", pcm);
|
||||||
|
|
||||||
for (stream = 0; stream < 2; stream++) {
|
for (stream = 0; stream < 2; stream++) {
|
||||||
substream = pcm->streams[stream].substream;
|
substream = pcm->streams[stream].substream;
|
||||||
|
@ -356,7 +360,8 @@ static void psc_dma_free(struct snd_pcm *pcm)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct snd_soc_platform_driver mpc5200_audio_dma_platform = {
|
static const struct snd_soc_component_driver mpc5200_audio_dma_component = {
|
||||||
|
.name = DRV_NAME,
|
||||||
.ops = &psc_dma_ops,
|
.ops = &psc_dma_ops,
|
||||||
.pcm_new = &psc_dma_new,
|
.pcm_new = &psc_dma_new,
|
||||||
.pcm_free = &psc_dma_free,
|
.pcm_free = &psc_dma_free,
|
||||||
|
@ -468,7 +473,8 @@ int mpc5200_audio_dma_create(struct platform_device *op)
|
||||||
dev_set_drvdata(&op->dev, psc_dma);
|
dev_set_drvdata(&op->dev, psc_dma);
|
||||||
|
|
||||||
/* Tell the ASoC OF helpers about it */
|
/* Tell the ASoC OF helpers about it */
|
||||||
return snd_soc_register_platform(&op->dev, &mpc5200_audio_dma_platform);
|
return devm_snd_soc_register_component(&op->dev,
|
||||||
|
&mpc5200_audio_dma_component, NULL, 0);
|
||||||
out_irq:
|
out_irq:
|
||||||
free_irq(psc_dma->irq, psc_dma);
|
free_irq(psc_dma->irq, psc_dma);
|
||||||
free_irq(psc_dma->capture.irq, &psc_dma->capture);
|
free_irq(psc_dma->capture.irq, &psc_dma->capture);
|
||||||
|
@ -487,8 +493,6 @@ int mpc5200_audio_dma_destroy(struct platform_device *op)
|
||||||
|
|
||||||
dev_dbg(&op->dev, "mpc5200_audio_dma_destroy()\n");
|
dev_dbg(&op->dev, "mpc5200_audio_dma_destroy()\n");
|
||||||
|
|
||||||
snd_soc_unregister_platform(&op->dev);
|
|
||||||
|
|
||||||
bcom_gen_bd_rx_release(psc_dma->capture.bcom_task);
|
bcom_gen_bd_rx_release(psc_dma->capture.bcom_task);
|
||||||
bcom_gen_bd_tx_release(psc_dma->playback.bcom_task);
|
bcom_gen_bd_tx_release(psc_dma->playback.bcom_task);
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue