Skip to content

Commit 93cdb5b

Browse files
arndbvinodkoul
authored andcommitted
dmaengine: xilinx_dpdma: stop using slave_id field
The display driver wants to pass a custom flag to the DMA engine driver, which it started doing by using the slave_id field that was traditionally used for a different purpose. As there is no longer a correct use for the slave_id field, it should really be removed, and the remaining users changed over to something different. The new mechanism for passing nonstandard settings is using the .peripheral_config field, so use that to pass a newly defined structure here, making it clear that this will not work in portable drivers. Reviewed-by: Laurent Pinchart <[email protected]> Signed-off-by: Arnd Bergmann <[email protected]> Acked-by: Mark Brown <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Vinod Koul <[email protected]>
1 parent 03de6b2 commit 93cdb5b

File tree

3 files changed

+29
-8
lines changed

3 files changed

+29
-8
lines changed

drivers/dma/xilinx/xilinx_dpdma.c

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@
1212
#include <linux/clk.h>
1313
#include <linux/debugfs.h>
1414
#include <linux/delay.h>
15+
#include <linux/dma/xilinx_dpdma.h>
1516
#include <linux/dmaengine.h>
1617
#include <linux/dmapool.h>
1718
#include <linux/interrupt.h>
@@ -1273,6 +1274,7 @@ static int xilinx_dpdma_config(struct dma_chan *dchan,
12731274
struct dma_slave_config *config)
12741275
{
12751276
struct xilinx_dpdma_chan *chan = to_xilinx_chan(dchan);
1277+
struct xilinx_dpdma_peripheral_config *pconfig;
12761278
unsigned long flags;
12771279

12781280
/*
@@ -1282,15 +1284,18 @@ static int xilinx_dpdma_config(struct dma_chan *dchan,
12821284
* fixed both on the DPDMA side and on the DP controller side.
12831285
*/
12841286

1285-
spin_lock_irqsave(&chan->lock, flags);
1286-
12871287
/*
1288-
* Abuse the slave_id to indicate that the channel is part of a video
1289-
* group.
1288+
* Use the peripheral_config to indicate that the channel is part
1289+
* of a video group. This requires matching use of the custom
1290+
* structure in each driver.
12901291
*/
1291-
if (chan->id <= ZYNQMP_DPDMA_VIDEO2)
1292-
chan->video_group = config->slave_id != 0;
1292+
pconfig = config->peripheral_config;
1293+
if (WARN_ON(pconfig && config->peripheral_size != sizeof(*pconfig)))
1294+
return -EINVAL;
12931295

1296+
spin_lock_irqsave(&chan->lock, flags);
1297+
if (chan->id <= ZYNQMP_DPDMA_VIDEO2 && pconfig)
1298+
chan->video_group = pconfig->video_group;
12941299
spin_unlock_irqrestore(&chan->lock, flags);
12951300

12961301
return 0;

drivers/gpu/drm/xlnx/zynqmp_disp.c

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
#include <linux/clk.h>
2626
#include <linux/delay.h>
27+
#include <linux/dma/xilinx_dpdma.h>
2728
#include <linux/dma-mapping.h>
2829
#include <linux/dmaengine.h>
2930
#include <linux/module.h>
@@ -1058,14 +1059,18 @@ static void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer,
10581059
zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt);
10591060

10601061
/*
1061-
* Set slave_id for each DMA channel to indicate they're part of a
1062+
* Set pconfig for each DMA channel to indicate they're part of a
10621063
* video group.
10631064
*/
10641065
for (i = 0; i < info->num_planes; i++) {
10651066
struct zynqmp_disp_layer_dma *dma = &layer->dmas[i];
1067+
struct xilinx_dpdma_peripheral_config pconfig = {
1068+
.video_group = true,
1069+
};
10661070
struct dma_slave_config config = {
10671071
.direction = DMA_MEM_TO_DEV,
1068-
.slave_id = 1,
1072+
.peripheral_config = &pconfig,
1073+
.peripheral_size = sizeof(pconfig),
10691074
};
10701075

10711076
dmaengine_slave_config(dma->chan, &config);

include/linux/dma/xilinx_dpdma.h

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// SPDX-License-Identifier: GPL-2.0
2+
#ifndef __LINUX_DMA_XILINX_DPDMA_H
3+
#define __LINUX_DMA_XILINX_DPDMA_H
4+
5+
#include <linux/types.h>
6+
7+
struct xilinx_dpdma_peripheral_config {
8+
bool video_group;
9+
};
10+
11+
#endif /* __LINUX_DMA_XILINX_DPDMA_H */

0 commit comments

Comments
 (0)