From mboxrd@z Thu Jan 1 00:00:00 1970 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 783E8C54EBE for ; Fri, 13 Jan 2023 12:06:30 +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:In-Reply-To:MIME-Version:References: Message-ID:Subject:Cc:To:From:Date:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bR4ggdR48NKuah4gQ0gIoKFyGiDKkRBpLndOhf4+V40=; b=rbTbj6p+pC34Ju cJcVbniOL7eaPAuDtFDF6pCdoQ+X2FKaz10Pq/r+GMSYBqaEwAz/AWKHNIw5fzJWLF7t0K4jSB0Wm 8+vorTgwnMvDT20AFMbJRQD7TX90rA27S43i/7vcNBaYMduJb5huWJls8pCbyn6Xg9NLE9KsO6jaK 0+LKZf+nVO7PnG+7V1gEb1+ZkDLZaQAI3EQjlGDtd5/XtZJX5ggE/16Er/Iw6QuaErlbsiXH6Pzu4 ZISunCnj/ZQ5aRFh7R2Pt7IjU+8luz8gbBstvWogSBLc6HTrX1N8Q4nflO54O7y4K2FFaB8Db3m8l N7YP47a/ttPJ9rXltomg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGIo3-002Rj0-VS; Fri, 13 Jan 2023 12:05:12 +0000 Received: from perceval.ideasonboard.com ([213.167.242.64]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1pGImo-002R84-Bo for linux-arm-kernel@lists.infradead.org; Fri, 13 Jan 2023 12:03:56 +0000 Received: from pendragon.ideasonboard.com (85-131-99-81.bb.dnainternet.fi [85.131.99.81]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9FDAD4D4; Fri, 13 Jan 2023 13:03:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1673611429; bh=6YIShQPskU5szBYMQWaunG9175SSYoPUA2nUdwpccOM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qzDn0VhsUYdZjDj997faeUd139LNqsYMRuTxjYeraeHBjNpWXF8aKpanBJNn1Y04P DbYnvUnPAY//IzBPc3OtWLq8+2bd2mKVXAgm4E9hBjDYuTodtJf6YJ3UIpoeTtqrUW sJfO5tEfNurS0Nc9YQufgcwuVDhcKAsHcltcAtro= Date: Fri, 13 Jan 2023 14:03:48 +0200 From: Laurent Pinchart To: Michael Tretter Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, Philipp Zabel , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Fabio Estevam , Alexander Stein , kernel@pengutronix.de, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 06/16] media: imx-pxp: make data_path_ctrl0 platform dependent Message-ID: References: <20230112-imx-pxp-v2-0-e2281da1db55@pengutronix.de> <20230112-imx-pxp-v2-6-e2281da1db55@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230112-imx-pxp-v2-6-e2281da1db55@pengutronix.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230113_040354_583759_70E1A372 X-CRM114-Status: GOOD ( 23.69 ) 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: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Hi Michael, Thank you for the patch. On Fri, Jan 13, 2023 at 10:54:12AM +0100, Michael Tretter wrote: > Unfortunately, the PXP_HW_VERSION register reports the PXP on the i.MX7D > and on the i.MX6ULL as version 3.0, although the PXP versions on these > SoCs have significant differences. > > Use the compatible to configure the ctrl0 register as required dependent > on the platform. > > Signed-off-by: Michael Tretter Reviewed-by: Laurent Pinchart > --- > Changelog > > v2: > > - drop fallback for missing data_path_ctrl0 > --- > drivers/media/platform/nxp/imx-pxp.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c > index bf3be989a552..c7f8a1808516 100644 > --- a/drivers/media/platform/nxp/imx-pxp.c > +++ b/drivers/media/platform/nxp/imx-pxp.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -191,6 +192,12 @@ static struct pxp_fmt *find_format(struct v4l2_format *f) > return &formats[k]; > } > > +struct pxp_ctx; > + > +struct pxp_pdata { > + u32 (*data_path_ctrl0)(struct pxp_ctx *ctx); > +}; > + > struct pxp_dev { > struct v4l2_device v4l2_dev; > struct video_device vfd; > @@ -198,6 +205,8 @@ struct pxp_dev { > struct clk *clk; > void __iomem *mmio; > > + const struct pxp_pdata *pdata; > + > atomic_t num_inst; > struct mutex dev_mutex; > spinlock_t irqlock; > @@ -724,7 +733,7 @@ static void pxp_setup_csc(struct pxp_ctx *ctx) > } > } > > -static u32 pxp_data_path_ctrl0(struct pxp_ctx *ctx) > +static u32 pxp_imx6ull_data_path_ctrl0(struct pxp_ctx *ctx) > { > u32 ctrl0; > > @@ -760,7 +769,7 @@ static void pxp_set_data_path(struct pxp_ctx *ctx) > u32 ctrl0; > u32 ctrl1; > > - ctrl0 = pxp_data_path_ctrl0(ctx); > + ctrl0 = dev->pdata->data_path_ctrl0(ctx); > > ctrl1 = 0; > ctrl1 |= BF_PXP_DATA_PATH_CTRL1_MUX17_SEL(3); > @@ -1705,6 +1714,8 @@ static int pxp_probe(struct platform_device *pdev) > if (!dev) > return -ENOMEM; > > + dev->pdata = of_device_get_match_data(&pdev->dev); > + > dev->clk = devm_clk_get(&pdev->dev, "axi"); > if (IS_ERR(dev->clk)) { > ret = PTR_ERR(dev->clk); > @@ -1804,8 +1815,12 @@ static int pxp_remove(struct platform_device *pdev) > return 0; > } > > +static const struct pxp_pdata pxp_imx6ull_pdata = { > + .data_path_ctrl0 = pxp_imx6ull_data_path_ctrl0, > +}; > + > static const struct of_device_id pxp_dt_ids[] = { > - { .compatible = "fsl,imx6ull-pxp", .data = NULL }, > + { .compatible = "fsl,imx6ull-pxp", .data = &pxp_imx6ull_pdata }, > { }, > }; > MODULE_DEVICE_TABLE(of, pxp_dt_ids); -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel From mboxrd@z Thu Jan 1 00:00:00 1970 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id D699CC54EBE for ; Fri, 13 Jan 2023 12:10:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239679AbjAMMKi (ORCPT ); Fri, 13 Jan 2023 07:10:38 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47614 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241303AbjAMMJy (ORCPT ); Fri, 13 Jan 2023 07:09:54 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8049277D23; Fri, 13 Jan 2023 04:03:52 -0800 (PST) Received: from pendragon.ideasonboard.com (85-131-99-81.bb.dnainternet.fi [85.131.99.81]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 9FDAD4D4; Fri, 13 Jan 2023 13:03:49 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1673611429; bh=6YIShQPskU5szBYMQWaunG9175SSYoPUA2nUdwpccOM=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=qzDn0VhsUYdZjDj997faeUd139LNqsYMRuTxjYeraeHBjNpWXF8aKpanBJNn1Y04P DbYnvUnPAY//IzBPc3OtWLq8+2bd2mKVXAgm4E9hBjDYuTodtJf6YJ3UIpoeTtqrUW sJfO5tEfNurS0Nc9YQufgcwuVDhcKAsHcltcAtro= Date: Fri, 13 Jan 2023 14:03:48 +0200 From: Laurent Pinchart To: Michael Tretter Cc: linux-media@vger.kernel.org, devicetree@vger.kernel.org, Philipp Zabel , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Fabio Estevam , Alexander Stein , kernel@pengutronix.de, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH v2 06/16] media: imx-pxp: make data_path_ctrl0 platform dependent Message-ID: References: <20230112-imx-pxp-v2-0-e2281da1db55@pengutronix.de> <20230112-imx-pxp-v2-6-e2281da1db55@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230112-imx-pxp-v2-6-e2281da1db55@pengutronix.de> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Michael, Thank you for the patch. On Fri, Jan 13, 2023 at 10:54:12AM +0100, Michael Tretter wrote: > Unfortunately, the PXP_HW_VERSION register reports the PXP on the i.MX7D > and on the i.MX6ULL as version 3.0, although the PXP versions on these > SoCs have significant differences. > > Use the compatible to configure the ctrl0 register as required dependent > on the platform. > > Signed-off-by: Michael Tretter Reviewed-by: Laurent Pinchart > --- > Changelog > > v2: > > - drop fallback for missing data_path_ctrl0 > --- > drivers/media/platform/nxp/imx-pxp.c | 21 ++++++++++++++++++--- > 1 file changed, 18 insertions(+), 3 deletions(-) > > diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c > index bf3be989a552..c7f8a1808516 100644 > --- a/drivers/media/platform/nxp/imx-pxp.c > +++ b/drivers/media/platform/nxp/imx-pxp.c > @@ -19,6 +19,7 @@ > #include > #include > #include > +#include > #include > #include > > @@ -191,6 +192,12 @@ static struct pxp_fmt *find_format(struct v4l2_format *f) > return &formats[k]; > } > > +struct pxp_ctx; > + > +struct pxp_pdata { > + u32 (*data_path_ctrl0)(struct pxp_ctx *ctx); > +}; > + > struct pxp_dev { > struct v4l2_device v4l2_dev; > struct video_device vfd; > @@ -198,6 +205,8 @@ struct pxp_dev { > struct clk *clk; > void __iomem *mmio; > > + const struct pxp_pdata *pdata; > + > atomic_t num_inst; > struct mutex dev_mutex; > spinlock_t irqlock; > @@ -724,7 +733,7 @@ static void pxp_setup_csc(struct pxp_ctx *ctx) > } > } > > -static u32 pxp_data_path_ctrl0(struct pxp_ctx *ctx) > +static u32 pxp_imx6ull_data_path_ctrl0(struct pxp_ctx *ctx) > { > u32 ctrl0; > > @@ -760,7 +769,7 @@ static void pxp_set_data_path(struct pxp_ctx *ctx) > u32 ctrl0; > u32 ctrl1; > > - ctrl0 = pxp_data_path_ctrl0(ctx); > + ctrl0 = dev->pdata->data_path_ctrl0(ctx); > > ctrl1 = 0; > ctrl1 |= BF_PXP_DATA_PATH_CTRL1_MUX17_SEL(3); > @@ -1705,6 +1714,8 @@ static int pxp_probe(struct platform_device *pdev) > if (!dev) > return -ENOMEM; > > + dev->pdata = of_device_get_match_data(&pdev->dev); > + > dev->clk = devm_clk_get(&pdev->dev, "axi"); > if (IS_ERR(dev->clk)) { > ret = PTR_ERR(dev->clk); > @@ -1804,8 +1815,12 @@ static int pxp_remove(struct platform_device *pdev) > return 0; > } > > +static const struct pxp_pdata pxp_imx6ull_pdata = { > + .data_path_ctrl0 = pxp_imx6ull_data_path_ctrl0, > +}; > + > static const struct of_device_id pxp_dt_ids[] = { > - { .compatible = "fsl,imx6ull-pxp", .data = NULL }, > + { .compatible = "fsl,imx6ull-pxp", .data = &pxp_imx6ull_pdata }, > { }, > }; > MODULE_DEVICE_TABLE(of, pxp_dt_ids); -- Regards, Laurent Pinchart