ASoC: Regression fix for OMAP in DT boot (3.11)
v2 cover ASoC: Regression fix for OMAP in DT boot (3.11)
Hi,
Changes since v1:
- Drop the change in dmaengine_pcm.h
- Use .filter_data to store the DMA channel name
- omap-pcm: checks if the DAI is probed via DT and uses decides which method to use to request the DMA channel
- Dropped the cleanup patch for omap-dmic from the series
I will send another series with cleanups later
I just noticed in mainline kernel (pre 3.11-rc1) that OMAP4 audio is not probing anymore. This is because OMAP4 also moved to DT only mode (3.10 DT boot was fine).
The issue underneath is that we can not use platform_get_resource_byname() for DMA resources when booted with devicetree.
In case of DT boot we can use the DMA name to request the channel.
Due to technical issues OMAP can not be moved to generic dmaengine pcm as other SoCs did.
Mark: can you queue this series for 3.11? Thank you.
Regards,
Peter
---
Peter Ujfalusi (4):
ASoC: omap-pcm: Request the DMA channel differently when DT is
involved
ASoC: omap-mcpdm: Do not use platform_get_resource_byname() for DMA
ASoC: omap-dmic: Do not use platform_get_resource_byname() for DMA
ASoC: omap-mcbsp: Use different method for DMA request when booted
with DT
sound/soc/omap/mcbsp.c | 39 ++++++++++++++++++++++----------------- sound/soc/omap/omap-dmic.c | 11 +---------- sound/soc/omap/omap-mcpdm.c | 16 ++-------------- sound/soc/omap/omap-pcm.c | 17 ++++++++++++++--- 4 files changed, 39 insertions(+), 44 deletions(-)
Signature · 1 line
1.8.2.1
PATCH v2 1/4 ASoC: omap-pcm: Request the DMA channel differently when DT is involved
When booting with DT the platform_get_resource_byname() is not available to get the DMA resource. In this case the DAI drivers will set the filter_data to the name of the DMA and omap-pcm can use this to request the DMA channel.
--- sound/soc/omap/omap-pcm.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
sound/soc/omap/omap-pcm.c +14 -3
@@ -113,14 +113,25 @@ static int omap_pcm_open(struct snd_pcm_substream *substream) {struct snd_soc_pcm_runtime *rtd = substream->private_data;struct snd_dmaengine_dai_dma_data *dma_data; +int ret;snd_soc_set_runtime_hwparams (substream, &omap_pcm_hardware); dma_data =snd_soc_dai_get_dma_data (rtd->cpu_dai, substream); -return snd_dmaengine_pcm_open_request_chan (substream, - omap_dma_filter_fn, - dma_data->filter_data); +/* DT boot: filter_data is the DMA name */ +if (rtd->cpu_dai->dev->of_node) { +struct dma_chan *chan; + + chan =dma_request_slave_channel (rtd->cpu_dai->dev, + dma_data->filter_data); + ret =snd_dmaengine_pcm_open (substream, chan); + }else { + ret =snd_dmaengine_pcm_open_request_chan (substream, + omap_dma_filter_fn, + dma_data->filter_data); + } +return ret; } static int omap_pcm_mmap(struct snd_pcm_substream *substream,
Signature · 1 line
1.8.2.1
Re: [PATCH v2 1/4] ASoC: omap-pcm: Request the DMA channel differently when DT is involved
Quoted 3 lines · Peter Ujfalusi
When booting with DT the
platform_get_resource_byname()is not available to get the DMA resource. In this case the DAI drivers will set thefilter_datato the name of the DMA and omap-pcm can use this to request the DMA channel.
Applied all, thanks.
PATCH v2 2/4 ASoC: omap-mcpdm: Do not use platform_get_resource_byname() for DMA
In reply to Peter UjfalusiThe DMA resource no longer available via this API when booting with DT. McPDM is only available on OMAP4/5 and both can boot with DT only. Set the dma_data.filter_data to the DMA name which will be used by omap-pcm to request the DMA channel.
--- sound/soc/omap/omap-mcpdm.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-)
sound/soc/omap/omap-mcpdm.c +2 -14
@@ -66,7 +66,6 @@ struct omap_mcpdm {bool restart;struct snd_dmaengine_dai_dma_data dma_data[2 ]; -unsigned int dma_req[2 ]; };/*
@@ -477,19 +476,8 @@ static int asoc_mcpdm_probe(struct platform_device *pdev) mcpdm->dma_data[0 ].addr = res->start +MCPDM_REG_DN_DATA ; mcpdm->dma_data[1 ].addr = res->start +MCPDM_REG_UP_DATA ; - res =platform_get_resource_byname (pdev,IORESOURCE_DMA ,"dn_link" ); -if (!res) -return -ENODEV ; - - mcpdm->dma_req[0 ] = res->start; - mcpdm->dma_data[0 ].filter_data = &mcpdm->dma_req[0 ]; - - res =platform_get_resource_byname (pdev,IORESOURCE_DMA ,"up_link" ); -if (!res) -return -ENODEV ; - - mcpdm->dma_req[1 ] = res->start; - mcpdm->dma_data[1 ].filter_data = &mcpdm->dma_req[1 ]; + mcpdm->dma_data[0 ].filter_data ="dn_link" ; + mcpdm->dma_data[1 ].filter_data ="up_link" ; res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"mpu" );if (res ==NULL )
Signature · 1 line
1.8.2.1
PATCH v2 3/4 ASoC: omap-dmic: Do not use platform_get_resource_byname() for DMA
In reply to Peter UjfalusiThe DMA resource no longer available via this API when booting with DT. DMIC is only available on OMAP4/5 and both can boot with DT only. Set the dma_data.filter_data to the DMA name which will be used by omap-pcm to request the DMA channel.
--- sound/soc/omap/omap-dmic.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
sound/soc/omap/omap-dmic.c +1 -10
@@ -57,7 +57,6 @@ struct omap_dmic {struct mutex mutex;struct snd_dmaengine_dai_dma_data dma_data; -unsigned int dma_req; };static inline void omap_dmic_write (struct omap_dmic *dmic,u16 reg,u32 val)
@@ -478,15 +477,7 @@ static int asoc_dmic_probe(struct platform_device *pdev) } dmic->dma_data.addr = res->start +OMAP_DMIC_DATA_REG ; - res =platform_get_resource (pdev,IORESOURCE_DMA ,0 ); -if (!res) { -dev_err (dmic->dev,"invalid dma resource\n" ); - ret = -ENODEV ; - goto err_put_clk; - } - - dmic->dma_req = res->start; - dmic->dma_data.filter_data = &dmic->dma_req; + dmic->dma_data.filter_data ="up_link" ; res =platform_get_resource_byname (pdev,IORESOURCE_MEM ,"mpu" );if (!res) {
Signature · 1 line
1.8.2.1
PATCH v2 4/4 ASoC: omap-mcbsp: Use different method for DMA request when booted with DT
In reply to Peter UjfalusiThe DMA resource no longer available via this API when booting with DT. When the board is booted with DT do not use platform_get_resource_byname(), instead set the dma_data.filter_data to the name of the DMA channel and omap-pcm can use this name to request the DMA channel.
--- sound/soc/omap/mcbsp.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-)
sound/soc/omap/mcbsp.c +22 -17
@@ -1012,28 +1012,33 @@ int omap_mcbsp_init(struct platform_device *pdev) } } - res =platform_get_resource_byname (pdev,IORESOURCE_DMA ,"rx" ); -if (!res) { -dev_err (&pdev->dev,"invalid rx DMA channel\n" ); -return -ENODEV ; - } -/* RX DMA request number, and port address configuration */ - mcbsp->dma_req[1 ] = res->start; - mcbsp->dma_data[1 ].filter_data = &mcbsp->dma_req[1 ]; - mcbsp->dma_data[1 ].addr =omap_mcbsp_dma_reg_params (mcbsp,1 ); - mcbsp->dma_data[1 ].maxburst =4 ; +if (!pdev->dev.of_node) { + res =platform_get_resource_byname (pdev,IORESOURCE_DMA ,"tx" ); +if (!res) { +dev_err (&pdev->dev,"invalid tx DMA channel\n" ); +return -ENODEV ; + } + mcbsp->dma_req[0 ] = res->start; + mcbsp->dma_data[0 ].filter_data = &mcbsp->dma_req[0 ]; - res =platform_get_resource_byname (pdev,IORESOURCE_DMA ,"tx" ); -if (!res) { -dev_err (&pdev->dev,"invalid tx DMA channel\n" ); -return -ENODEV ; + res =platform_get_resource_byname (pdev,IORESOURCE_DMA ,"rx" ); +if (!res) { +dev_err (&pdev->dev,"invalid rx DMA channel\n" ); +return -ENODEV ; + } + mcbsp->dma_req[1 ] = res->start; + mcbsp->dma_data[1 ].filter_data = &mcbsp->dma_req[1 ]; + }else { + mcbsp->dma_data[0 ].filter_data ="tx" ; + mcbsp->dma_data[1 ].filter_data ="rx" ; } -/* TX DMA request number, and port address configuration */ - mcbsp->dma_req[0 ] = res->start; - mcbsp->dma_data[0 ].filter_data = &mcbsp->dma_req[0 ]; + mcbsp->dma_data[0 ].addr =omap_mcbsp_dma_reg_params (mcbsp,0 ); mcbsp->dma_data[0 ].maxburst =4 ; + mcbsp->dma_data[1 ].addr =omap_mcbsp_dma_reg_params (mcbsp,1 ); + mcbsp->dma_data[1 ].maxburst =4 ; + mcbsp->fclk =clk_get (&pdev->dev,"fck" );if (IS_ERR (mcbsp->fclk)) { ret =PTR_ERR (mcbsp->fclk);
Signature · 1 line
1.8.2.1
Quoted 18 lines · Peter Ujfalusi
Hi,
Changes since v1:
- Drop the change indmaengine_pcm.h
- Use .filter_data to store the DMA channel name
- omap-pcm: checks if the DAI is probed via DT and uses decides which method to use to request the DMA channel
- Dropped the cleanup patch for omap-dmic from the series
I will send another series with cleanups laterI just noticed in mainline kernel (pre 3.11-rc1) that OMAP4 audio is not probing anymore. This is because OMAP4 also moved to DT only mode (3.10 DT boot was fine).
The issue underneath is that we can not useplatform_get_resource_byname()for DMA resources when booted with devicetree.In case of DT boot we can use the DMA name to request the channel.
Quoted 7 lines
Due to technical issues OMAP can not be moved to generic dmaengine pcm as other SoCs did.
Mark: can you queue this series for 3.11? Thank you.
Regards,
Peter
Looks good, all 4 patches:
But I'm wondering who do you register the PCM device in the DT case? Do you have a separate DT node for the PCM device?
- Lars
Quoted 15 lines
---
Peter Ujfalusi (4):
ASoC: omap-pcm: Request the DMA channel differently when DT is
involved
ASoC: omap-mcpdm: Do not useplatform_get_resource_byname()for DMA
ASoC: omap-dmic: Do not useplatform_get_resource_byname()for DMA
ASoC: omap-mcbsp: Use different method for DMA request when booted
with DTsound/soc/omap/mcbsp.c | 39 ++++++++++++++++++++++----------------- sound/soc/omap/omap-dmic.c | 11 +---------- sound/soc/omap/omap-mcpdm.c | 16 ++-------------- sound/soc/omap/omap-pcm.c | 17 ++++++++++++++--- 4 files changed, 39 insertions(+), 44 deletions(-)
Quoted 2 lines · Lars-Peter Clausen
Looks good, all 4 patches:
Reviewed-by Lars-Peter Clausen <[email protected]>
Thanks
Quoted 2 lines
But I'm wondering who do you register the PCM device in the DT case? Do you have a separate DT node for the PCM device?
It is a platform_device right now registered in arch/arm/mach-omap2/devices.c We do not have and I don't plan to have DT node for it. The device for the PCM is registered if soc audio is selected for OMAP.
Signature · 1 line
Péter
Mark Brown
maintainerQuoted 8 lines · Peter Ujfalusi
Quoted 2 lines · Lars-Peter Clausen
But I'm wondering who do you register the PCM device in the DT case? Do you have a separate DT node for the PCM device?
It is a
platform_deviceright now registered inarch/arm/mach-omap2/devices.cWe do not have and I don't plan to have DT node for it. The device for the PCM is registered if soc audio is selected for OMAP.
The standard thing there is to trigger the instantiation from the DAI driver if the DMA driver isn't hardware in itself but rather an adaptor to a shared DMA controller.