Commit 93cdb5b0 authored by Arnd Bergmann's avatar Arnd Bergmann Committed by Vinod Koul

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: default avatarLaurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: default avatarArnd Bergmann <arnd@arndb.de>
Acked-by: default avatarMark Brown <broonie@kernel.org>
Link: https://lore.kernel.org/r/20211122222203.4103644-10-arnd@kernel.orgSigned-off-by: default avatarVinod Koul <vkoul@kernel.org>
parent 03de6b27
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/debugfs.h> #include <linux/debugfs.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dma/xilinx_dpdma.h>
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/dmapool.h> #include <linux/dmapool.h>
#include <linux/interrupt.h> #include <linux/interrupt.h>
...@@ -1273,6 +1274,7 @@ static int xilinx_dpdma_config(struct dma_chan *dchan, ...@@ -1273,6 +1274,7 @@ static int xilinx_dpdma_config(struct dma_chan *dchan,
struct dma_slave_config *config) struct dma_slave_config *config)
{ {
struct xilinx_dpdma_chan *chan = to_xilinx_chan(dchan); struct xilinx_dpdma_chan *chan = to_xilinx_chan(dchan);
struct xilinx_dpdma_peripheral_config *pconfig;
unsigned long flags; unsigned long flags;
/* /*
...@@ -1282,15 +1284,18 @@ static int xilinx_dpdma_config(struct dma_chan *dchan, ...@@ -1282,15 +1284,18 @@ static int xilinx_dpdma_config(struct dma_chan *dchan,
* fixed both on the DPDMA side and on the DP controller side. * fixed both on the DPDMA side and on the DP controller side.
*/ */
spin_lock_irqsave(&chan->lock, flags);
/* /*
* Abuse the slave_id to indicate that the channel is part of a video * Use the peripheral_config to indicate that the channel is part
* group. * of a video group. This requires matching use of the custom
* structure in each driver.
*/ */
if (chan->id <= ZYNQMP_DPDMA_VIDEO2) pconfig = config->peripheral_config;
chan->video_group = config->slave_id != 0; if (WARN_ON(pconfig && config->peripheral_size != sizeof(*pconfig)))
return -EINVAL;
spin_lock_irqsave(&chan->lock, flags);
if (chan->id <= ZYNQMP_DPDMA_VIDEO2 && pconfig)
chan->video_group = pconfig->video_group;
spin_unlock_irqrestore(&chan->lock, flags); spin_unlock_irqrestore(&chan->lock, flags);
return 0; return 0;
......
...@@ -24,6 +24,7 @@ ...@@ -24,6 +24,7 @@
#include <linux/clk.h> #include <linux/clk.h>
#include <linux/delay.h> #include <linux/delay.h>
#include <linux/dma/xilinx_dpdma.h>
#include <linux/dma-mapping.h> #include <linux/dma-mapping.h>
#include <linux/dmaengine.h> #include <linux/dmaengine.h>
#include <linux/module.h> #include <linux/module.h>
...@@ -1058,14 +1059,18 @@ static void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer, ...@@ -1058,14 +1059,18 @@ static void zynqmp_disp_layer_set_format(struct zynqmp_disp_layer *layer,
zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt); zynqmp_disp_avbuf_set_format(layer->disp, layer, layer->disp_fmt);
/* /*
* Set slave_id for each DMA channel to indicate they're part of a * Set pconfig for each DMA channel to indicate they're part of a
* video group. * video group.
*/ */
for (i = 0; i < info->num_planes; i++) { for (i = 0; i < info->num_planes; i++) {
struct zynqmp_disp_layer_dma *dma = &layer->dmas[i]; struct zynqmp_disp_layer_dma *dma = &layer->dmas[i];
struct xilinx_dpdma_peripheral_config pconfig = {
.video_group = true,
};
struct dma_slave_config config = { struct dma_slave_config config = {
.direction = DMA_MEM_TO_DEV, .direction = DMA_MEM_TO_DEV,
.slave_id = 1, .peripheral_config = &pconfig,
.peripheral_size = sizeof(pconfig),
}; };
dmaengine_slave_config(dma->chan, &config); dmaengine_slave_config(dma->chan, &config);
......
// SPDX-License-Identifier: GPL-2.0
#ifndef __LINUX_DMA_XILINX_DPDMA_H
#define __LINUX_DMA_XILINX_DPDMA_H
#include <linux/types.h>
struct xilinx_dpdma_peripheral_config {
bool video_group;
};
#endif /* __LINUX_DMA_XILINX_DPDMA_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment