From patchwork Thu Jan 5 13:47:24 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Michael Tretter X-Patchwork-Id: 13090668 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 4D213C4708E for ; Thu, 5 Jan 2023 23:07:53 +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:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=iE3AoH0ewDh7kVkfgPEU2ii8qGRXkERWF/DXVt2ZyOY=; b=jjlcUVnsH27jfu FQfeVZIghHYznn/E8QKOkIs9hlg1XZdfUrytN18WXMRpNx1Gnf2zNMzwuSdLYWk4d423f4z2uS+dN /ifFUxrfUmp3YZ+6+Jzt7Za6S3tMNZbNt2c0sc/o4eHSuEpLzN4nSJMocv+TL48HUrpj9GtZyx0Qo 45fop1D6d8OrlMifsRBKJ8x25+Huz09fNevTMSTE3SAtnYYJ9+gcdLP0U+ylFYg/MkW/Yt9F5jQ4Q fC8jfvxZZudlMXA/I+nO+0KAvXhq8ZBNbDp4aZ3IdQkUSMHpZXStbMBa/5tUWmoM35Y5nu2Edwm3m 5rQcGE0mFqjou1hBO0OQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDZK0-00FwkR-8s; Thu, 05 Jan 2023 23:06:52 +0000 Received: from desiato.infradead.org ([2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDVUS-00Dvep-If for linux-arm-kernel@bombadil.infradead.org; Thu, 05 Jan 2023 19:01:24 +0000 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=Content-Transfer-Encoding:MIME-Version :References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From:Sender:Reply-To: Content-Type:Content-ID:Content-Description; bh=NNjSyaAdq3Ruw5nkEaTHlEhkur1sIJxTehT0tDm/NSs=; b=oefBNsC+CwwvkX7CpQ18sNa/27 yjUq2FwrzFXqg3Yk0YaeooSqTL+HtzZHj4VaBFK9AwIrGq8Dppee0P+PQ3vJA5aPuDT35lWs7QvOV 3Ywqg00+mDwvHLkWPuwY3kRn+d01YjL9VoeRooVLn1I6vWpkSaCiu0y/WfakRCetg8w8eDv8rv7No HUvgfDI+zKmbF2o323r9vx8L6TeHgMgzEiurJwvkiPIu4rqf7YUyNNlCbmJc6ExiGB5y9tqMAr343 HEUZOeI7xGPmRp4HR68TxbvuQFud2a7ewvHKenUrjBQpU+XnTK/HLNZ00vVgUSaf4ATKYmHXp3W0d ZYQMXDcg==; Received: from metis.ext.pengutronix.de ([2001:67c:670:201:290:27ff:fe1d:cc33]) by desiato.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1pDQay-001MCO-0Z for linux-arm-kernel@lists.infradead.org; Thu, 05 Jan 2023 13:47:51 +0000 Received: from drehscheibe.grey.stw.pengutronix.de ([2a0a:edc0:0:c01:1d::a2]) by metis.ext.pengutronix.de with esmtps (TLS1.3:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1pDQah-0003Qo-Vj; Thu, 05 Jan 2023 14:47:32 +0100 Received: from [2a0a:edc0:0:900:1d::48] (helo=litschi) by drehscheibe.grey.stw.pengutronix.de with esmtp (Exim 4.94.2) (envelope-from ) id 1pDQag-0040LV-QY; Thu, 05 Jan 2023 14:47:30 +0100 Received: from mtr by litschi with local (Exim 4.94.2) (envelope-from ) id 1pDQaf-000FVG-GW; Thu, 05 Jan 2023 14:47:29 +0100 From: Michael Tretter To: linux-media@vger.kernel.org, devicetree@vger.kernel.org, Philipp Zabel Cc: Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Fabio Estevam , Laurent Pinchart , kernel@pengutronix.de, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org, Michael Tretter Subject: [PATCH 3/8] media: imx-pxp: extract helper function to setup data path Date: Thu, 5 Jan 2023 14:47:24 +0100 Message-Id: <20230105134729.59542-4-m.tretter@pengutronix.de> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20230105134729.59542-1-m.tretter@pengutronix.de> References: <20230105134729.59542-1-m.tretter@pengutronix.de> MIME-Version: 1.0 X-SA-Exim-Connect-IP: 2a0a:edc0:0:c01:1d::a2 X-SA-Exim-Mail-From: mtr@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-20230105_134748_305082_D41B4B10 X-CRM114-Status: GOOD ( 14.79 ) 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. Signed-off-by: Michael Tretter Reviewed-by: Laurent Pinchart --- 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 05abe40558b0..a957fee88829 100644 --- a/drivers/media/platform/nxp/imx-pxp.c +++ b/drivers/media/platform/nxp/imx-pxp.c @@ -726,6 +726,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) { @@ -912,26 +953,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);