Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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 <laurent.pinchart@ideasonboard.com>
Signed-off-by: Arnd Bergmann <arnd@arndb.de>
Acked-by: Mark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-10-arnd@kernel.org
Signed-off-by: Vinod Koul <vkoul@kernel.org>

authored by

Arnd Bergmann and committed by
Vinod Koul
93cdb5b0 03de6b27

+29 -8
+11 -6
drivers/dma/xilinx/xilinx_dpdma.c
··· 12 12 #include <linux/clk.h> 13 13 #include <linux/debugfs.h> 14 14 #include <linux/delay.h> 15 + #include <linux/dma/xilinx_dpdma.h> 15 16 #include <linux/dmaengine.h> 16 17 #include <linux/dmapool.h> 17 18 #include <linux/interrupt.h> ··· 1274 1273 struct dma_slave_config *config) 1275 1274 { 1276 1275 struct xilinx_dpdma_chan *chan = to_xilinx_chan(dchan); 1276 + struct xilinx_dpdma_peripheral_config *pconfig; 1277 1277 unsigned long flags; 1278 1278 1279 1279 /* ··· 1284 1282 * fixed both on the DPDMA side and on the DP controller side. 1285 1283 */ 1286 1284 1287 - spin_lock_irqsave(&chan->lock, flags); 1288 - 1289 1285 /* 1290 - * Abuse the slave_id to indicate that the channel is part of a video 1291 - * group. 1286 + * Use the peripheral_config to indicate that the channel is part 1287 + * of a video group. This requires matching use of the custom 1288 + * structure in each driver. 1292 1289 */ 1293 - if (chan->id <= ZYNQMP_DPDMA_VIDEO2) 1294 - chan->video_group = config->slave_id != 0; 1290 + pconfig = config->peripheral_config; 1291 + if (WARN_ON(pconfig && config->peripheral_size != sizeof(*pconfig))) 1292 + return -EINVAL; 1295 1293 1294 + spin_lock_irqsave(&chan->lock, flags); 1295 + if (chan->id <= ZYNQMP_DPDMA_VIDEO2 && pconfig) 1296 + chan->video_group = pconfig->video_group; 1296 1297 spin_unlock_irqrestore(&chan->lock, flags); 1297 1298 1298 1299 return 0;
+7 -2
drivers/gpu/drm/xlnx/zynqmp_disp.c
··· 24 24 25 25 #include <linux/clk.h> 26 26 #include <linux/delay.h> 27 + #include <linux/dma/xilinx_dpdma.h> 27 28 #include <linux/dma-mapping.h> 28 29 #include <linux/dmaengine.h> 29 30 #include <linux/module.h> ··· 1059 1058 zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt); 1060 1059 1061 1060 /* 1062 - * Set slave_id for each DMA channel to indicate they're part of a 1061 + * Set pconfig for each DMA channel to indicate they're part of a 1063 1062 * video group. 1064 1063 */ 1065 1064 for (i = 0; i < info->num_planes; i++) { 1066 1065 struct zynqmp_disp_layer_dma *dma = &layer->dmas[i]; 1066 + struct xilinx_dpdma_peripheral_config pconfig = { 1067 + .video_group = true, 1068 + }; 1067 1069 struct dma_slave_config config = { 1068 1070 .direction = DMA_MEM_TO_DEV, 1069 - .slave_id = 1, 1071 + .peripheral_config = &pconfig, 1072 + .peripheral_size = sizeof(pconfig), 1070 1073 }; 1071 1074 1072 1075 dmaengine_slave_config(dma->chan, &config);
+11
include/linux/dma/xilinx_dpdma.h
··· 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 */