linux-spi.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Arnd Bergmann <arnd@kernel.org>
To: Vinod Koul <vkoul@kernel.org>
Cc: Arnd Bergmann <arnd@arndb.de>, Andy Gross <agross@kernel.org>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Baolin Wang <baolin.wang7@gmail.com>,
	Bjorn Andersson <bjorn.andersson@linaro.org>,
	Chunyan Zhang <zhang.lyra@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Hyun Kwon <hyun.kwon@xilinx.com>,
	Jaroslav Kysela <perex@perex.cz>,
	Jon Hunter <jonathanh@nvidia.com>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
	Laxman Dewangan <ldewangan@nvidia.com>,
	Manivannan Sadhasivam <mani@kernel.org>,
	Mark Brown <broonie@kernel.org>,
	Michal Simek <michal.simek@xilinx.com>,
	Nicolas Saenz Julienne <nsaenz@kernel.org>,
	Orson Zhai <orsonzhai@gmail.com>,
	Robert Jarzmik <robert.jarzmik@free.fr>,
	Scott Branden <sbranden@broadcom.com>,
	Takashi Iwai <tiwai@suse.com>,
	Thierry Reding <thierry.reding@gmail.com>,
	alsa-devel@alsa-project.org,
	bcm-kernel-feedback-list@broadcom.com, dmaengine@vger.kernel.org,
	dri-devel@lists.freedesktop.org,
	linux-arm-kernel@lists.infradead.org,
	linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-mmc@vger.kernel.org, linux-mtd@lists.infradead.org,
	linux-rpi-kernel@lists.infradead.org,
	linux-serial@vger.kernel.org, linux-spi@vger.kernel.org,
	linux-staging@lists.linux.dev, linux-tegra@vger.kernel.org
Subject: [PATCH 08/11] dmaengine: xilinx_dpdma: stop using slave_id field
Date: Mon, 15 Nov 2021 09:54:00 +0100	[thread overview]
Message-ID: <20211115085403.360194-9-arnd@kernel.org> (raw)
In-Reply-To: <20211115085403.360194-1-arnd@kernel.org>

From: Arnd Bergmann <arnd@arndb.de>

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.

Signed-off-by: Arnd Bergmann <arnd@arndb.de>
---
 drivers/dma/xilinx/xilinx_dpdma.c  | 12 ++++++++----
 drivers/gpu/drm/xlnx/zynqmp_disp.c |  9 +++++++--
 include/linux/dma/xilinx_dpdma.h   | 11 +++++++++++
 3 files changed, 26 insertions(+), 6 deletions(-)
 create mode 100644 include/linux/dma/xilinx_dpdma.h

diff --git a/drivers/dma/xilinx/xilinx_dpdma.c b/drivers/dma/xilinx/xilinx_dpdma.c
index ce5c66e6897d..e2c1ef7a659c 100644
--- a/drivers/dma/xilinx/xilinx_dpdma.c
+++ b/drivers/dma/xilinx/xilinx_dpdma.c
@@ -12,6 +12,7 @@
 #include <linux/clk.h>
 #include <linux/debugfs.h>
 #include <linux/delay.h>
+#include <linux/dma/xilinx_dpdma.h>
 #include <linux/dmaengine.h>
 #include <linux/dmapool.h>
 #include <linux/interrupt.h>
@@ -1273,6 +1274,7 @@ static int xilinx_dpdma_config(struct dma_chan *dchan,
 			       struct dma_slave_config *config)
 {
 	struct xilinx_dpdma_chan *chan = to_xilinx_chan(dchan);
+	struct xilinx_dpdma_peripheral_config *pconfig;
 	unsigned long flags;
 
 	/*
@@ -1285,11 +1287,13 @@ static int xilinx_dpdma_config(struct dma_chan *dchan,
 	spin_lock_irqsave(&chan->lock, flags);
 
 	/*
-	 * Abuse the slave_id to indicate that the channel is part of a video
-	 * group.
+	 * Abuse the peripheral_config to indicate that the channel is part
+	 * of a video group.
 	 */
-	if (chan->id <= ZYNQMP_DPDMA_VIDEO2)
-		chan->video_group = config->slave_id != 0;
+	pconfig = config->peripheral_config;
+	if (chan->id <= ZYNQMP_DPDMA_VIDEO2 &&
+	    config->peripheral_size == sizeof(*pconfig))
+		chan->video_group = pconfig->video_group;
 
 	spin_unlock_irqrestore(&chan->lock, flags);
 
diff --git a/drivers/gpu/drm/xlnx/zynqmp_disp.c b/drivers/gpu/drm/xlnx/zynqmp_disp.c
index ff2b308d8651..11c409cbc88e 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_disp.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_disp.c
@@ -24,6 +24,7 @@
 
 #include <linux/clk.h>
 #include <linux/delay.h>
+#include <linux/dma/xilinx_dpdma.h>
 #include <linux/dma-mapping.h>
 #include <linux/dmaengine.h>
 #include <linux/module.h>
@@ -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);
 
 	/*
-	 * 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.
 	 */
 	for (i = 0; i < info->num_planes; i++) {
 		struct zynqmp_disp_layer_dma *dma = &layer->dmas[i];
+		struct xilinx_dpdma_peripheral_config pconfig = {
+			.video_group = true,
+		};
 		struct dma_slave_config config = {
 			.direction = DMA_MEM_TO_DEV,
-			.slave_id = 1,
+			.peripheral_config = &pconfig,
+			.peripheral_size = sizeof(pconfig),
 		};
 
 		dmaengine_slave_config(dma->chan, &config);
diff --git a/include/linux/dma/xilinx_dpdma.h b/include/linux/dma/xilinx_dpdma.h
new file mode 100644
index 000000000000..83a1377f03f8
--- /dev/null
+++ b/include/linux/dma/xilinx_dpdma.h
@@ -0,0 +1,11 @@
+// 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 */
-- 
2.30.2


  parent reply	other threads:[~2021-11-15  8:57 UTC|newest]

Thread overview: 36+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-11-15  8:53 [PATCH 00/11] dmaengine: kill off dma_slave_config->slave_id Arnd Bergmann
2021-11-15  8:53 ` [PATCH 01/11] ASoC: dai_dma: remove slave_id field Arnd Bergmann
2021-11-15 10:14   ` Lars-Peter Clausen
2021-11-15 10:42     ` Arnd Bergmann
2021-11-15 11:53       ` Lars-Peter Clausen
2021-11-15 14:46         ` Dmitry Osipenko
2021-11-15 15:15           ` Arnd Bergmann
2021-11-15  8:53 ` [PATCH 02/11] spi: pic32: stop setting dma_config->slave_id Arnd Bergmann
2021-11-15 13:29   ` Mark Brown
2021-11-15  8:53 ` [PATCH 03/11] mmc: bcm2835: stop setting chan_config->slave_id Arnd Bergmann
2021-11-15  9:55   ` nicolas saenz julienne
2021-11-15 13:09   ` Ulf Hansson
2021-11-15  8:53 ` [PATCH 04/11] dmaengine: shdma: remove legacy slave_id parsing Arnd Bergmann
2021-11-15  9:09   ` Laurent Pinchart
2021-11-15  8:53 ` [PATCH 05/11] dmaengine: pxa/mmp: stop referencing config->slave_id Arnd Bergmann
2021-11-15  8:53 ` [PATCH 06/11] dmaengine: sprd: " Arnd Bergmann
2021-11-16  2:34   ` Baolin Wang
2021-11-15  8:53 ` [PATCH 07/11] dmaengine: qcom-adm: stop abusing slave_id config Arnd Bergmann
2021-11-19 12:42   ` kernel test robot
2021-11-25  7:57   ` kernel test robot
2021-11-25  8:25     ` Arnd Bergmann
2021-11-25  9:32       ` Vinod Koul
2021-11-15  8:54 ` Arnd Bergmann [this message]
2021-11-15  9:14   ` [PATCH 08/11] dmaengine: xilinx_dpdma: stop using slave_id field Laurent Pinchart
2021-11-15 10:21     ` Arnd Bergmann
2021-11-15 11:49       ` Laurent Pinchart
2021-11-15 12:38         ` Arnd Bergmann
2021-11-15 13:05           ` Laurent Pinchart
2021-11-15 13:39             ` Arnd Bergmann
2021-11-16  4:28       ` Vinod Koul
2021-11-15  8:54 ` [PATCH 09/11] dmaengine: tegra20-apb: stop checking config->slave_id Arnd Bergmann
2021-11-15  8:54 ` [PATCH 10/11] staging: ralink-gdma: stop using slave_id config Arnd Bergmann
2021-11-15  9:55   ` Sergio Paracuellos
2021-11-15 10:23     ` Arnd Bergmann
2021-11-15  8:54 ` [PATCH 11/11] dmaengine: remove slave_id config field Arnd Bergmann
2021-11-15  9:18   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20211115085403.360194-9-arnd@kernel.org \
    --to=arnd@kernel.org \
    --cc=agross@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=arnd@arndb.de \
    --cc=baolin.wang7@gmail.com \
    --cc=bcm-kernel-feedback-list@broadcom.com \
    --cc=bjorn.andersson@linaro.org \
    --cc=broonie@kernel.org \
    --cc=dmaengine@vger.kernel.org \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=hyun.kwon@xilinx.com \
    --cc=jonathanh@nvidia.com \
    --cc=lars@metafoo.de \
    --cc=laurent.pinchart@ideasonboard.com \
    --cc=ldewangan@nvidia.com \
    --cc=linux-arm-kernel@lists.infradead.org \
    --cc=linux-arm-msm@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mmc@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-rpi-kernel@lists.infradead.org \
    --cc=linux-serial@vger.kernel.org \
    --cc=linux-spi@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=linux-tegra@vger.kernel.org \
    --cc=mani@kernel.org \
    --cc=michal.simek@xilinx.com \
    --cc=nsaenz@kernel.org \
    --cc=orsonzhai@gmail.com \
    --cc=perex@perex.cz \
    --cc=robert.jarzmik@free.fr \
    --cc=sbranden@broadcom.com \
    --cc=thierry.reding@gmail.com \
    --cc=tiwai@suse.com \
    --cc=vkoul@kernel.org \
    --cc=zhang.lyra@gmail.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).