[alsa-devel] [PATCH v2 0/4] 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(-)
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.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- sound/soc/omap/omap-pcm.c | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-)
diff --git a/sound/soc/omap/omap-pcm.c b/sound/soc/omap/omap-pcm.c index c28e042..a11405d 100644 --- a/sound/soc/omap/omap-pcm.c +++ b/sound/soc/omap/omap-pcm.c @@ -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,
On Thu, Jul 11, 2013 at 02:35:43PM +0200, Peter Ujfalusi wrote:
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.
Applied all, thanks.
The 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.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- sound/soc/omap/omap-mcpdm.c | 16 ++-------------- 1 file changed, 2 insertions(+), 14 deletions(-)
diff --git a/sound/soc/omap/omap-mcpdm.c b/sound/soc/omap/omap-mcpdm.c index eb05c7e..a49dc52 100644 --- a/sound/soc/omap/omap-mcpdm.c +++ b/sound/soc/omap/omap-mcpdm.c @@ -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)
The 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.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- sound/soc/omap/omap-dmic.c | 11 +---------- 1 file changed, 1 insertion(+), 10 deletions(-)
diff --git a/sound/soc/omap/omap-dmic.c b/sound/soc/omap/omap-dmic.c index 2ad0370..4db1f8e 100644 --- a/sound/soc/omap/omap-dmic.c +++ b/sound/soc/omap/omap-dmic.c @@ -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) {
The 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.
Signed-off-by: Peter Ujfalusi peter.ujfalusi@ti.com --- sound/soc/omap/mcbsp.c | 39 ++++++++++++++++++++++----------------- 1 file changed, 22 insertions(+), 17 deletions(-)
diff --git a/sound/soc/omap/mcbsp.c b/sound/soc/omap/mcbsp.c index eb68c7d..361e4c0 100644 --- a/sound/soc/omap/mcbsp.c +++ b/sound/soc/omap/mcbsp.c @@ -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);
On 07/11/2013 02:35 PM, Peter Ujfalusi wrote:
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
Looks good, all 4 patches: Reviewed-by: Lars-Peter Clausen lars@metafoo.de
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
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(-)
On 07/11/2013 04:02 PM, Lars-Peter Clausen wrote:
Looks good, all 4 patches: Reviewed-by: Lars-Peter Clausen lars@metafoo.de
Thanks
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.
On Thu, Jul 11, 2013 at 04:23:24PM +0200, Peter Ujfalusi wrote:
On 07/11/2013 04:02 PM, Lars-Peter Clausen wrote:
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.
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.
participants (3)
-
Lars-Peter Clausen
-
Mark Brown
-
Peter Ujfalusi