Skip to contentSkip to conversation

dma: zx: rename zx296702_dma.c to zx_dma.c

PATCH New Shawn Guo 3 participants 7 messages Dec 15, 2016 – Jan 2, 2017 dmaengine

lore
Share & tools
lore

Shawn Guo

author
#0 lore raw

PATCH 1/3 dma: zx: rename zx296702_dma.c to zx_dma.c

From: Shawn Guo <[email protected]>

ZTE ZX dma driver is not ZX296702 specific. It works for not only ZX296702 but also other ZTE ZX family platforms like ZX296718. Let's rename the file to reflect that.

---
 drivers/dma/Kconfig                      | 4 ++--
 drivers/dma/Makefile                     | 2 +-
 drivers/dma/{zx296702_dma.c => zx_dma.c} | 0
 3 files changed, 3 insertions(+), 3 deletions(-)
 rename drivers/dma/{zx296702_dma.c => zx_dma.c} (100%)
drivers/dma/Kconfig +2 -2
index 263495d0adbd..eab7e12ee4a6 100644
@@ -571,12 +571,12 @@ config XILINX_ZYNQMP_DMA
 	  Enable support for Xilinx ZynqMP DMA controller.
 
 config ZX_DMA
-	tristate "ZTE ZX296702 DMA support"
+	tristate "ZTE ZX DMA support"
 	depends on ARCH_ZX || COMPILE_TEST
 	select DMA_ENGINE
 	select DMA_VIRTUAL_CHANNELS
 	help
-	  Support the DMA engine for ZTE ZX296702 platform devices.
+	  Support the DMA engine for ZTE ZX family platform devices.
 
 
 # driver files
drivers/dma/Makefile +1 -1
index a4fa3360e609..0b723e94d9e6 100644
@@ -66,7 +66,7 @@ obj-$(CONFIG_TI_CPPI41) += cppi41.o
 obj-$(CONFIG_TI_DMA_CROSSBAR) += ti-dma-crossbar.o
 obj-$(CONFIG_TI_EDMA) += edma.o
 obj-$(CONFIG_XGENE_DMA) += xgene-dma.o
-obj-$(CONFIG_ZX_DMA) += zx296702_dma.o
+obj-$(CONFIG_ZX_DMA) += zx_dma.o
 obj-$(CONFIG_ST_FDMA) += st_fdma.o
 
 obj-y += qcom/
drivers/dma/zx_dma.c renamed from drivers/dma/zx296702_dma.c +0 -0
similarity index 100%
rename from drivers/dma/zx296702_dma.c
rename to drivers/dma/zx_dma.c
Signature · 1 line
1.9.1
author
#1 lore raw

PATCH 2/3 dma: zx: set DMA_CYCLIC cap_mask bit

From: Shawn Guo <[email protected]>

The zx_dma driver supports cyclic transfer mode. Let's set DMA_CYCLIC cap_mask bit to make that clear, and avoid unnecessary failure when clients request channel via dma_request_chan_by_mask() with DMA_CYCLIC bit set in mask.

---
 drivers/dma/zx_dma.c | 1 +
 1 file changed, 1 insertion(+)
drivers/dma/zx_dma.c +1 -0
index 380276d078b2..33155c6816cc 100644
@@ -812,6 +812,7 @@ static int zx_dma_probe(struct platform_device *op)
 	INIT_LIST_HEAD(&d->slave.channels);
 	dma_cap_set(DMA_SLAVE, d->slave.cap_mask);
 	dma_cap_set(DMA_MEMCPY, d->slave.cap_mask);
+	dma_cap_set(DMA_CYCLIC, d->slave.cap_mask);
 	dma_cap_set(DMA_PRIVATE, d->slave.cap_mask);
 	d->slave.dev = &op->dev;
 	d->slave.device_free_chan_resources = zx_dma_free_chan_resources;
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/3 dma: zx: set DMA_CYCLIC cap_mask bit

2016-12-15 22:03 GMT+08:00 Shawn Guo <[email protected]>:

Quoted 7 lines

From: Shawn Guo <[email protected]>

The zx_dma driver supports cyclic transfer mode. Let's set DMA_CYCLIC cap_mask bit to make that clear, and avoid unnecessary failure when clients request channel via dma_request_chan_by_mask() with DMA_CYCLIC bit set in mask.

Quoted 5 lines
---
 drivers/dma/zx_dma.c | 1 +
 1 file changed, 1 insertion(+)
author
#3 lore raw

PATCH 3/3 dma: zx: fix residue calculation

In reply to Shawn Guo

From: Shawn Guo <[email protected]>

The dma residue is defined as the free space to end of transfer buffer, which could be multiple segments chained together. So the residue calculation in zx_dma_tx_status() works for both slave_sg and cyclic case. But unfortunately, the 'index' is wrong. It should plus one, because the current segment is already occupied and shouldn't be counted into free space.

This fixes the HDMI audio noise issue we see on ZX296718 with SPDIF interface.

---
 drivers/dma/zx_dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
drivers/dma/zx_dma.c +2 -1
index 33155c6816cc..42ff3e66c1e1 100644
@@ -365,7 +365,8 @@ static enum dma_status zx_dma_tx_status(struct dma_chan *chan,
 
 		bytes = 0;
 		clli = zx_dma_get_curr_lli(p);
-		index = (clli - ds->desc_hw_lli) / sizeof(struct zx_desc_hw);
+		index = (clli - ds->desc_hw_lli) /
+				sizeof(struct zx_desc_hw) + 1;
 		for (; index < ds->desc_num; index++) {
 			bytes += ds->desc_hw[index].src_x;
 			/* end of lli */
Signature · 1 line
1.9.1
#4 lore raw

PATCH 3/3 dma: zx: fix residue calculation

2016-12-15 22:03 GMT+08:00 Shawn Guo <[email protected]>:

Quoted 9 lines

From: Shawn Guo <[email protected]>

The dma residue is defined as the free space to end of transfer buffer, which could be multiple segments chained together. So the residue calculation in zx_dma_tx_status() works for both slave_sg and cyclic case. But unfortunately, the 'index' is wrong. It should plus one, because the current segment is already occupied and shouldn't be counted into free space.

Quoted 8 lines

This fixes the HDMI audio noise issue we see on ZX296718 with SPDIF interface.

---
 drivers/dma/zx_dma.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)
#5 lore raw

PATCH 1/3 dma: zx: rename zx296702_dma.c to zx_dma.c

In reply to Shawn Guo

2016-12-15 22:03 GMT+08:00 Shawn Guo <[email protected]>:

Quoted 6 lines

From: Shawn Guo <[email protected]>

ZTE ZX dma driver is not ZX296702 specific. It works for not only ZX296702 but also other ZTE ZX family platforms like ZX296718. Let's rename the file to reflect that.

Quoted 8 lines
---
 drivers/dma/Kconfig                      | 4 ++--
 drivers/dma/Makefile                     | 2 +-
 drivers/dma/{zx296702_dma.c => zx_dma.c} | 0
 3 files changed, 3 insertions(+), 3 deletions(-)
 rename drivers/dma/{zx296702_dma.c => zx_dma.c} (100%)
#6 lore raw

PATCH 1/3 dma: zx: rename zx296702_dma.c to zx_dma.c

In reply to Shawn Guo
Quoted 5 lines · Shawn Guo

From: Shawn Guo <[email protected]>

ZTE ZX dma driver is not ZX296702 specific. It works for not only ZX296702 but also other ZTE ZX family platforms like ZX296718. Let's rename the file to reflect that.

Applied all after fixing subsystem name

Signature · 1 line
~Vinod