From patchwork Mon Nov 22 22:22:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 519304 Delivered-To: patch@linaro.org Received: by 2002:ac0:c605:0:0:0:0:0 with SMTP id p5csp7681366imj; Mon, 22 Nov 2021 14:23:35 -0800 (PST) X-Google-Smtp-Source: ABdhPJy69/SIcQQkWnSOX8dDtUx9IQ5dvwbS2cyBkRLn2FL6iJnPfJb7ePdWJKWUKKPo4wAhKlpg X-Received: by 2002:a17:90b:3890:: with SMTP id mu16mr36875005pjb.73.1637619814807; Mon, 22 Nov 2021 14:23:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637619814; cv=none; d=google.com; s=arc-20160816; b=LCDvuC9/BlWfQ9oqPBhMpc6hYNoiACbL+8OC3bQ7tAmt4E6NPPls507NMDwLe0vv2s ivW/vY1Gdpb4lVggeRtvExFinD0UBP2S/99tY7VjnCvl6HEk8b7TUaTZsSKo8SfyFWmk btD3vJOCR+OJHQYUif8K67e8Y08vGzKkPsbTtuX7ZUiHtxEeGxkAHBrzocI8HRNL/8Dk Iv+lfPUEzIopa54eqMgJtB4B0Zpw0sVLYeqXvGPjtsM1uKh087kbwXgXSe6TayzVEimx lbO5xjopA54WGuLZ5dRtZ5JntKKBoW/OnIeCUBLW3jL1Ub8tyightnCOO42JGBL8V3lE CXPQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:cc:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:to:from :dkim-signature:delivered-to; bh=TaVcJMX28bcxOq+a3O+bHbni+fU72ZJq9plK8+XgibU=; b=RouAdOkmOx42eR0pM4vW3Q0xmQ3tKooWtSJ0RVwids1qb+Tw5QWgps/l4cjGpe2ndK P6cV56772VIN2J0AhLfKeymkbKTAYsKN0e4IQa1laj+hBAemgUvcWVhslC/5kX/ViXIT 06MX/rCf2upWE1w29XhyIKiiQ5XvSu8sxWTrOFfR+q7nb49k/+ve+3GLkzVWb/QpBHA0 KNBzKJGPUpPQIyqmBUfTVVqHUsJQI4nStILkszuBYxJHK3zcF8sJBbXj36X46c3+X5AY IXvf2QDtTaRb0QckT2U0uEMdNU55QM9KDTyHD58XoLRditszr93v843zVT0JW4dZlSUJ xkwg== ARC-Authentication-Results: i=1; mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=D2LWKDba; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id n7si4725742plh.46.2021.11.22.14.23.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Nov 2021 14:23:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=fail header.i=@kernel.org header.s=k20201202 header.b=D2LWKDba; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BA7BC89E2B; Mon, 22 Nov 2021 22:23:31 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4885189E2B for ; Mon, 22 Nov 2021 22:23:31 +0000 (UTC) Received: by mail.kernel.org (Postfix) with ESMTPSA id 0E0A061053; Mon, 22 Nov 2021 22:23:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1637619811; bh=DMxz9rkJwWZ5AqTdDggA8BLDb3DTgP5Oz0VUo2zj6B4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=D2LWKDbatUWolgPnSkaWF6uAmXJr7TRUsffIAYil8ieu9gP8qTxDGTlSSeFslk+FX lfasUT+qjAZz4FqvxeQbdvqY7gm+Szg9KN11yNlzJ9GOQaUe2v85AHYKYosrXAMyrE 83Qo7Vahw/aCxC+KQwYxEhvp5nYKM2xiNPHzZz3mpotZj10zImrNUftev0qcZA03Zn NQLipAZpiDTgThm7UHwH21MkyStuMHBgZkt8Z6fmCqVtjxInuWYT3q2YF1Ajj0kiB1 UMwMelZbEWO8BXX6fob9irbYUtNypouPZRN0P8c65LiXoihCRpce5QwQAS3j6Vkxsv uUuI47S8VCEng== From: Arnd Bergmann To: Vinod Koul Subject: [PATCH v2 09/11] dmaengine: xilinx_dpdma: stop using slave_id field Date: Mon, 22 Nov 2021 23:22:01 +0100 Message-Id: <20211122222203.4103644-10-arnd@kernel.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211122222203.4103644-1-arnd@kernel.org> References: <20211122222203.4103644-1-arnd@kernel.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: alsa-devel@alsa-project.org, dri-devel@lists.freedesktop.org, Bjorn Andersson , linux-tegra@vger.kernel.org, Thierry Reding , linux-mtd@lists.infradead.org, Laurent Pinchart , linux-spi@vger.kernel.org, Robert Jarzmik , Chunyan Zhang , linux-staging@lists.linux.dev, Michal Simek , Jon Hunter , Andy Gross , bcm-kernel-feedback-list@broadcom.com, linux-serial@vger.kernel.org, Orson Zhai , Nicolas Saenz Julienne , Arnd Bergmann , Manivannan Sadhasivam , linux-arm-msm@vger.kernel.org, dmaengine@vger.kernel.org, Mark Brown , linux-rpi-kernel@lists.infradead.org, Jaroslav Kysela , Andy Shevchenko , linux-arm-kernel@lists.infradead.org, Scott Branden , Hyun Kwon , Greg Kroah-Hartman , linux-mmc@vger.kernel.org, Takashi Iwai , linux-kernel@vger.kernel.org, Laxman Dewangan , Baolin Wang Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Arnd Bergmann 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 Signed-off-by: Arnd Bergmann --- drivers/dma/xilinx/xilinx_dpdma.c | 17 +++++++++++------ drivers/gpu/drm/xlnx/zynqmp_disp.c | 9 +++++++-- include/linux/dma/xilinx_dpdma.h | 11 +++++++++++ 3 files changed, 29 insertions(+), 8 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..b0f4948b00a5 100644 --- a/drivers/dma/xilinx/xilinx_dpdma.c +++ b/drivers/dma/xilinx/xilinx_dpdma.c @@ -12,6 +12,7 @@ #include #include #include +#include #include #include #include @@ -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; /* @@ -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. */ - spin_lock_irqsave(&chan->lock, flags); - /* - * Abuse the slave_id to indicate that the channel is part of a video - * group. + * Use the peripheral_config to indicate that the channel is part + * of a video group. This requires matching use of the custom + * structure in each driver. */ - if (chan->id <= ZYNQMP_DPDMA_VIDEO2) - chan->video_group = config->slave_id != 0; + pconfig = config->peripheral_config; + 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); return 0; 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 #include +#include #include #include #include @@ -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 + +struct xilinx_dpdma_peripheral_config { + bool video_group; +}; + +#endif /* __LINUX_DMA_XILINX_DPDMA_H */