Use the edma-pcm with AM335x and AM447x SoCs. Keep using the davinci-pcm for DaVinci devices, they can be switched to use the dmaengine based driver later when they are verified to work correctly.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- sound/soc/davinci/davinci-mcasp.c | 46 +++++++++++++++++++++++++++++++++------ 1 file changed, 39 insertions(+), 7 deletions(-)
diff --git a/sound/soc/davinci/davinci-mcasp.c b/sound/soc/davinci/davinci-mcasp.c index b0ae0677f023..604aa982f5c4 100644 --- a/sound/soc/davinci/davinci-mcasp.c +++ b/sound/soc/davinci/davinci-mcasp.c @@ -36,6 +36,7 @@
#include "davinci-pcm.h" #include "davinci-mcasp.h" +#include "edma-pcm.h"
struct davinci_mcasp_context { u32 txfmtctl; @@ -721,10 +722,12 @@ static int davinci_mcasp_startup(struct snd_pcm_substream *substream, { struct davinci_mcasp *mcasp = snd_soc_dai_get_drvdata(dai);
- if (mcasp->version == MCASP_VERSION_4) + if (mcasp->version >= MCASP_VERSION_3) + /* Using dmaengine PCM */ snd_soc_dai_set_dma_data(dai, substream, &mcasp->dma_data[substream->stream]); else + /* Using davinci-pcm */ snd_soc_dai_set_dma_data(dai, substream, mcasp->dma_params);
return 0; @@ -1154,12 +1157,28 @@ static int davinci_mcasp_probe(struct platform_device *pdev) if (ret != 0) goto err_release_clk;
- if (mcasp->version != MCASP_VERSION_4) { + /* Based on the McASP version use different platform driver */ + switch (mcasp->version) { + case MCASP_VERSION_1: + case MCASP_VERSION_2: ret = davinci_soc_platform_register(&pdev->dev); - if (ret) { - dev_err(&pdev->dev, "register PCM failed: %d\n", ret); - goto err_unregister_component; - } + break; + case MCASP_VERSION_3: + ret = edma_pcm_platform_register(&pdev->dev); + break; + case MCASP_VERSION_4: + /* Using omap-pcm as platform driver */ + break; + default: + dev_err(&pdev->dev, "Invalid McASP version: %d\n", + mcasp->version); + ret = -EINVAL; + break; + } + + if (ret) { + dev_err(&pdev->dev, "register PCM failed: %d\n", ret); + goto err_unregister_component; }
return 0; @@ -1177,8 +1196,21 @@ static int davinci_mcasp_remove(struct platform_device *pdev) struct davinci_mcasp *mcasp = dev_get_drvdata(&pdev->dev);
snd_soc_unregister_component(&pdev->dev); - if (mcasp->version != MCASP_VERSION_4) + + switch (mcasp->version) { + case MCASP_VERSION_1: + case MCASP_VERSION_2: davinci_soc_platform_unregister(&pdev->dev); + break; + case MCASP_VERSION_3: + edma_pcm_platform_unregister(&pdev->dev); + break; + case MCASP_VERSION_4: + /* Using omap-pcm as platform driver */ + break; + default: + break; + }
pm_runtime_put_sync(&pdev->dev); pm_runtime_disable(&pdev->dev);