ASoC: davinci-mcasp: Fixes for 3.20
cover ASoC: davinci-mcasp: Fixes for 3.20
Hi,
While doing the conversion of davinci DAI drivers to use edma-pcm I have noticed couple of issues with the driver regarding to old daVinci device support which resulted in the following two patch.
Some SoC uses shared IRQ line for all McASP instances
There are SoCs where a given McASP instance only supports DIT mode. Currently the arch code feeds dummy resource in place of RX (which is not available). With the second patch this is not going to be needed anymore.
If it is not too late for 3.20..
regards,
Peter
---
Peter Ujfalusi (2):
ASoC: davicni-mcasp: Mark the common irq line as shared
ASoC: davinci-mcasp: Fix DIT only McASP instance support
sound/soc/davinci/davinci-mcasp.c | 75 +++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 34 deletions(-)
Signature · 1 line
2.2.2
PATCH 1/2 ASoC: davicni-mcasp: Mark the common irq line as shared
On DA830 devices McASP0,1 and 2 shares a single combined interrupt request line.
--- sound/soc/davinci/davinci-mcasp.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-)
sound/soc/davinci/davinci-mcasp.c +2 -1
@@ -1461,7 +1461,8 @@ static int davinci_mcasp_probe(struct platform_device *pdev) dev_name(&pdev->dev)); ret =devm_request_threaded_irq (&pdev->dev, irq,NULL , davinci_mcasp_common_irq_handler, -IRQF_ONESHOT , irq_name, mcasp); +IRQF_ONESHOT |IRQF_SHARED , + irq_name, mcasp);if (ret) {dev_err (&pdev->dev,"common IRQ request failed\n" ); goto err;
Signature · 1 line
2.2.2
Re: [PATCH 1/2] ASoC: davicni-mcasp: Mark the common irq line as shared
Quoted 2 lines · Peter Ujfalusi
On DA830 devices McASP0,1 and 2 shares a single combined interrupt request line.
Applied, thanks.
PATCH 2/2 ASoC: davinci-mcasp: Fix DIT only McASP instance support
In reply to Peter UjfalusiOne of the McASP instances in DM646x line of DMSoC only supports DIT mode. This means that the given IP does not have support for rx and all the rx related resources are missing, like irq and DMA request.
The driver should not fail if any or all of the RX resource is missing when the op_mode is set to DIT mode.
Since RX is not possible in DIT mode, we can just ignore the rx resources when the McASP is used in DIT mode.
--- sound/soc/davinci/davinci-mcasp.c | 72 +++++++++++++++++++++------------------ 1 file changed, 39 insertions(+), 33 deletions(-)
sound/soc/davinci/davinci-mcasp.c +39 -33
@@ -1327,16 +1327,19 @@ static struct davinci_mcasp_pdata *davinci_mcasp_set_pdata_from_of( pdata->tx_dma_channel = dma_spec.args[0 ]; - ret =of_property_match_string (np,"dma-names" ,"rx" ); -if (ret <0 ) - goto nodata; +/* RX is not valid in DIT mode */ +if (pdata->op_mode !=DAVINCI_MCASP_DIT_MODE ) { + ret =of_property_match_string (np,"dma-names" ,"rx" ); +if (ret <0 ) + goto nodata; - ret =of_parse_phandle_with_args (np,"dmas" ,"#dma-cells" , ret, - &dma_spec); -if (ret <0 ) - goto nodata; + ret =of_parse_phandle_with_args (np,"dmas" ,"#dma-cells" , ret, + &dma_spec); +if (ret <0 ) + goto nodata; - pdata->rx_dma_channel = dma_spec.args[0 ]; + pdata->rx_dma_channel = dma_spec.args[0 ]; + } ret =of_property_read_u32 (np,"tx-num-evt" , &val);if (ret >=0 )
@@ -1532,19 +1535,34 @@ static int davinci_mcasp_probe(struct platform_device *pdev)else dma_data->filter_data = &dma_params->channel; - dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_CAPTURE ]; - dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE ]; - dma_params->asp_chan_q = pdata->asp_chan_q; - dma_params->ram_chan_q = pdata->ram_chan_q; - dma_params->sram_pool = pdata->sram_pool; - dma_params->sram_size = pdata->sram_size_capture; -if (dat) - dma_params->dma_addr = dat->start; -else - dma_params->dma_addr = mem->start + pdata->rx_dma_offset; - -/* Unconditional dmaengine stuff */ - dma_data->addr = dma_params->dma_addr; +/* RX is not valid in DIT mode */ +if (mcasp->op_mode !=DAVINCI_MCASP_DIT_MODE ) { + dma_params = &mcasp->dma_params[SNDRV_PCM_STREAM_CAPTURE ]; + dma_data = &mcasp->dma_data[SNDRV_PCM_STREAM_CAPTURE ]; + dma_params->asp_chan_q = pdata->asp_chan_q; + dma_params->ram_chan_q = pdata->ram_chan_q; + dma_params->sram_pool = pdata->sram_pool; + dma_params->sram_size = pdata->sram_size_capture; +if (dat) + dma_params->dma_addr = dat->start; +else + dma_params->dma_addr = mem->start + pdata->rx_dma_offset; + +/* Unconditional dmaengine stuff */ + dma_data->addr = dma_params->dma_addr; + + res =platform_get_resource (pdev,IORESOURCE_DMA ,1 ); +if (res) + dma_params->channel = res->start; +else + dma_params->channel = pdata->rx_dma_channel; + +/* dmaengine filter data for DT and non-DT boot */ +if (pdev->dev.of_node) + dma_data->filter_data ="rx" ; +else + dma_data->filter_data = &dma_params->channel; + }if (mcasp->version <MCASP_VERSION_3 ) { mcasp->fifo_base =DAVINCI_MCASP_V2_AFIFO_BASE ;
@@ -1554,18 +1572,6 @@ static int davinci_mcasp_probe(struct platform_device *pdev) mcasp->fifo_base =DAVINCI_MCASP_V3_AFIFO_BASE ; } - res =platform_get_resource (pdev,IORESOURCE_DMA ,1 ); -if (res) - dma_params->channel = res->start; -else - dma_params->channel = pdata->rx_dma_channel; - -/* dmaengine filter data for DT and non-DT boot */ -if (pdev->dev.of_node) - dma_data->filter_data ="rx" ; -else - dma_data->filter_data = &dma_params->channel; -dev_set_drvdata (&pdev->dev, mcasp);mcasp_reparent_fck (pdev);
Signature · 1 line
2.2.2
Re: [PATCH 2/2] ASoC: davinci-mcasp: Fix DIT only McASP instance support
Quoted 3 lines · Peter Ujfalusi
One of the McASP instances in DM646x line of DMSoC only supports DIT mode. This means that the given IP does not have support for rx and all the rx related resources are missing, like irq and DMA request.
Applied, thanks.