linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] dmaengine: imx-sdma: Correct src_addr_widths and directions
@ 2017-09-14 18:46 Nicolin Chen
  2017-09-14 19:43 ` Fabio Estevam
  2017-09-21 17:16 ` Vinod Koul
  0 siblings, 2 replies; 4+ messages in thread
From: Nicolin Chen @ 2017-09-14 18:46 UTC (permalink / raw)
  To: vinod.koul; +Cc: fabio.estevam, dan.j.williams, dmaengine, linux-kernel

The driver already supports DMA_DEV_TO_DEV in sdma_config(),
DMA_SLAVE_BUSWIDTH_2_BYTES and DMA_SLAVE_BUSWIDTH_1_BYTE in
sdma_prep_slave_sg(). So this patch adds them to the lists.

Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
---
 drivers/dma/imx-sdma.c | 14 +++++++++++---
 1 file changed, 11 insertions(+), 3 deletions(-)

diff --git a/drivers/dma/imx-sdma.c b/drivers/dma/imx-sdma.c
index a67ec1b..2184881 100644
--- a/drivers/dma/imx-sdma.c
+++ b/drivers/dma/imx-sdma.c
@@ -178,6 +178,14 @@
 #define SDMA_WATERMARK_LEVEL_HWE	BIT(29)
 #define SDMA_WATERMARK_LEVEL_CONT	BIT(31)
 
+#define SDMA_DMA_BUSWIDTHS	(BIT(DMA_SLAVE_BUSWIDTH_1_BYTE) | \
+				 BIT(DMA_SLAVE_BUSWIDTH_2_BYTES) | \
+				 BIT(DMA_SLAVE_BUSWIDTH_4_BYTES))
+
+#define SDMA_DMA_DIRECTIONS	(BIT(DMA_DEV_TO_MEM) | \
+				 BIT(DMA_MEM_TO_DEV) | \
+				 BIT(DMA_DEV_TO_DEV))
+
 /*
  * Mode/Count of data node descriptors - IPCv2
  */
@@ -1851,9 +1859,9 @@ static int sdma_probe(struct platform_device *pdev)
 	sdma->dma_device.device_prep_dma_cyclic = sdma_prep_dma_cyclic;
 	sdma->dma_device.device_config = sdma_config;
 	sdma->dma_device.device_terminate_all = sdma_disable_channel_with_delay;
-	sdma->dma_device.src_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
-	sdma->dma_device.dst_addr_widths = BIT(DMA_SLAVE_BUSWIDTH_4_BYTES);
-	sdma->dma_device.directions = BIT(DMA_DEV_TO_MEM) | BIT(DMA_MEM_TO_DEV);
+	sdma->dma_device.src_addr_widths = SDMA_DMA_BUSWIDTHS;
+	sdma->dma_device.dst_addr_widths = SDMA_DMA_BUSWIDTHS;
+	sdma->dma_device.directions = SDMA_DMA_DIRECTIONS;
 	sdma->dma_device.residue_granularity = DMA_RESIDUE_GRANULARITY_SEGMENT;
 	sdma->dma_device.device_issue_pending = sdma_issue_pending;
 	sdma->dma_device.dev->dma_parms = &sdma->dma_parms;
-- 
2.1.4

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dmaengine: imx-sdma: Correct src_addr_widths and directions
  2017-09-14 18:46 [PATCH v2] dmaengine: imx-sdma: Correct src_addr_widths and directions Nicolin Chen
@ 2017-09-14 19:43 ` Fabio Estevam
  2017-09-14 21:49   ` Nicolin Chen
  2017-09-21 17:16 ` Vinod Koul
  1 sibling, 1 reply; 4+ messages in thread
From: Fabio Estevam @ 2017-09-14 19:43 UTC (permalink / raw)
  To: Nicolin Chen
  Cc: Vinod Koul, Fabio Estevam, Dan Williams, dmaengine, linux-kernel

Hi Nicolin,

On Thu, Sep 14, 2017 at 3:46 PM, Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> The driver already supports DMA_DEV_TO_DEV in sdma_config(),
> DMA_SLAVE_BUSWIDTH_2_BYTES and DMA_SLAVE_BUSWIDTH_1_BYTE in
> sdma_prep_slave_sg(). So this patch adds them to the lists.
>
> Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>

Patch looks good.

Just curious: what is the specific usecase that triggered this change?

Thanks

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dmaengine: imx-sdma: Correct src_addr_widths and directions
  2017-09-14 19:43 ` Fabio Estevam
@ 2017-09-14 21:49   ` Nicolin Chen
  0 siblings, 0 replies; 4+ messages in thread
From: Nicolin Chen @ 2017-09-14 21:49 UTC (permalink / raw)
  To: Fabio Estevam
  Cc: Vinod Koul, Fabio Estevam, Dan Williams, dmaengine, linux-kernel

On Thu, Sep 14, 2017 at 04:43:08PM -0300, Fabio Estevam wrote:
> Hi Nicolin,
> 
> On Thu, Sep 14, 2017 at 3:46 PM, Nicolin Chen <nicoleotsuka@gmail.com> wrote:
> > The driver already supports DMA_DEV_TO_DEV in sdma_config(),
> > DMA_SLAVE_BUSWIDTH_2_BYTES and DMA_SLAVE_BUSWIDTH_1_BYTE in
> > sdma_prep_slave_sg(). So this patch adds them to the lists.
> >
> > Signed-off-by: Nicolin Chen <nicoleotsuka@gmail.com>
> 
> Patch looks good.
> 
> Just curious: what is the specific usecase that triggered this change?

Any audio test case. The ASoC generic dmaengine gets the DMA
cap (4_BYTES only) and apply it to hw->formats in ASoC core.
SSI + WM8962 could have S8_LE, S16_LE and S24_LE formats but
it turns out that it only has S24_LE now because of this.

I haven't seen any side effect by DMA_DEV_TO_DEV yet but it
could potentially break ASRC once a similar constrain based
on the "directions" is applied.

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH v2] dmaengine: imx-sdma: Correct src_addr_widths and directions
  2017-09-14 18:46 [PATCH v2] dmaengine: imx-sdma: Correct src_addr_widths and directions Nicolin Chen
  2017-09-14 19:43 ` Fabio Estevam
@ 2017-09-21 17:16 ` Vinod Koul
  1 sibling, 0 replies; 4+ messages in thread
From: Vinod Koul @ 2017-09-21 17:16 UTC (permalink / raw)
  To: Nicolin Chen; +Cc: fabio.estevam, dan.j.williams, dmaengine, linux-kernel

On Thu, Sep 14, 2017 at 11:46:43AM -0700, Nicolin Chen wrote:
> The driver already supports DMA_DEV_TO_DEV in sdma_config(),
> DMA_SLAVE_BUSWIDTH_2_BYTES and DMA_SLAVE_BUSWIDTH_1_BYTE in
> sdma_prep_slave_sg(). So this patch adds them to the lists.

Applied, thanks

-- 
~Vinod

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2017-09-21 17:13 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-09-14 18:46 [PATCH v2] dmaengine: imx-sdma: Correct src_addr_widths and directions Nicolin Chen
2017-09-14 19:43 ` Fabio Estevam
2017-09-14 21:49   ` Nicolin Chen
2017-09-21 17:16 ` Vinod Koul

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).