From patchwork Fri Jan 13 09:54:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tretter X-Patchwork-Id: 13100411 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 5402EC54EBE for ; Fri, 13 Jan 2023 09:56:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=TtF6P7xxmQLxstIyZmCxdLnnwD3vV0Ockmqfe+qYQDw=; b=NZyGpoPN31VNK0 rq+FcktYUlAgD04Bgsnd6PZi70lRpxNEdfmg8hOzi32+H3JwypTgGooqWn3/9i4pQLAmgkzghS4Eh lWZ2OJnOAW4dgFrQelFhUMWOoDPlRM+aFCCifHsnALVC/nwB71/wfh8+pOTWgfo4X3Y9nLJDqNS4U uMgSEwqplIUFbayRAD2LlA4BPklfdteC6o1/Seu5c9NeNC6xZXGYpoRC5LPmEGCIAmYGZhJBaYCd+ hpdA8vRd3BiRO0cI8GLWEkuLYWInAIHN/to+I9EYZG5wQ3Ks61sMaRqbWizLUH1V89KHZ0euwRio6 FtMuiJBXfmrehHvCQfeQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGGmx-001aWK-0d; Fri, 13 Jan 2023 09:55:55 +0000 Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGGlV-001ZoW-T2 for linux-arm-kernel@lists.infradead.org; Fri, 13 Jan 2023 09:54:29 +0000 Received: from dude05.red.stw.pengutronix.de ([2a0a:edc0:0:1101:1d::54]) by metis.ext.pengutronix.de with esmtp (Exim 4.92) (envelope-from ) id 1pGGlH-0003cp-Mo; Fri, 13 Jan 2023 10:54:11 +0100 From: Michael Tretter Date: Fri, 13 Jan 2023 10:54:09 +0100 Subject: [PATCH v2 03/16] media: imx-pxp: extract helper function to setup data path MIME-Version: 1.0 Message-Id: <20230112-imx-pxp-v2-3-e2281da1db55@pengutronix.de> References: <20230112-imx-pxp-v2-0-e2281da1db55@pengutronix.de> In-Reply-To: <20230112-imx-pxp-v2-0-e2281da1db55@pengutronix.de> To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, Philipp Zabel , Laurent Pinchart Cc: Michael Tretter , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Fabio Estevam , Alexander Stein , kernel@pengutronix.de, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org X-Mailer: b4 0.11.2 X-SA-Exim-Connect-IP: 2a0a:edc0:0:1101:1d::54 X-SA-Exim-Mail-From: m.tretter@pengutronix.de X-SA-Exim-Scanned: No (on metis.ext.pengutronix.de); SAEximRunCond expanded to false X-PTX-Original-Recipient: linux-arm-kernel@lists.infradead.org X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230113_015426_006185_673B4A8D X-CRM114-Status: GOOD ( 13.86 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org The driver must configure the data path through the Pixel Pipeline. Currently, the driver is using a fixed setup, but once there are different pipeline configurations, it is helpful to have a dedicated function for determining the register value for the data path. Reviewed-by: Laurent Pinchart Signed-off-by: Michael Tretter Reviewed-by: Philipp Zabel --- Changelog: v2: none --- drivers/media/platform/nxp/imx-pxp.c | 62 ++++++++++++++++++++++++------------ 1 file changed, 42 insertions(+), 20 deletions(-) diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c index 5b671c6e5cae..675fd00faaac 100644 --- a/drivers/media/platform/nxp/imx-pxp.c +++ b/drivers/media/platform/nxp/imx-pxp.c @@ -724,6 +724,47 @@ static void pxp_setup_csc(struct pxp_ctx *ctx) } } +static u32 pxp_data_path_ctrl0(struct pxp_ctx *ctx) +{ + u32 ctrl0; + + ctrl0 = 0; + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX15_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX14_SEL(1); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX13_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX12_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX11_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX10_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX9_SEL(1); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX8_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX7_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX6_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX5_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX4_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX3_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX2_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX1_SEL(0); + ctrl0 |= BF_PXP_DATA_PATH_CTRL0_MUX0_SEL(0); + + return ctrl0; +} + +static void pxp_set_data_path(struct pxp_ctx *ctx) +{ + struct pxp_dev *dev = ctx->dev; + u32 ctrl0; + u32 ctrl1; + + ctrl0 = pxp_data_path_ctrl0(ctx); + + ctrl1 = 0; + ctrl1 |= BF_PXP_DATA_PATH_CTRL1_MUX17_SEL(1); + ctrl1 |= BF_PXP_DATA_PATH_CTRL1_MUX16_SEL(1); + + writel(ctrl0, dev->mmio + HW_PXP_DATA_PATH_CTRL0); + writel(ctrl1, dev->mmio + HW_PXP_DATA_PATH_CTRL1); +} + static int pxp_start(struct pxp_ctx *ctx, struct vb2_v4l2_buffer *in_vb, struct vb2_v4l2_buffer *out_vb) { @@ -910,26 +951,7 @@ static int pxp_start(struct pxp_ctx *ctx, struct vb2_v4l2_buffer *in_vb, /* bypass LUT */ writel(BM_PXP_LUT_CTRL_BYPASS, dev->mmio + HW_PXP_LUT_CTRL); - writel(BF_PXP_DATA_PATH_CTRL0_MUX15_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX14_SEL(1)| - BF_PXP_DATA_PATH_CTRL0_MUX13_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX12_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX11_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX10_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX9_SEL(1)| - BF_PXP_DATA_PATH_CTRL0_MUX8_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX7_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX6_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX5_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX4_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX3_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX2_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX1_SEL(0)| - BF_PXP_DATA_PATH_CTRL0_MUX0_SEL(0), - dev->mmio + HW_PXP_DATA_PATH_CTRL0); - writel(BF_PXP_DATA_PATH_CTRL1_MUX17_SEL(1) | - BF_PXP_DATA_PATH_CTRL1_MUX16_SEL(1), - dev->mmio + HW_PXP_DATA_PATH_CTRL1); + pxp_set_data_path(ctx); writel(0xffff, dev->mmio + HW_PXP_IRQ_MASK);