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 70A63C3DA7A for ; Fri, 6 Jan 2023 11:47:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229476AbjAFLrj (ORCPT ); Fri, 6 Jan 2023 06:47:39 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:40980 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229564AbjAFLrj (ORCPT ); Fri, 6 Jan 2023 06:47:39 -0500 Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [213.167.242.64]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5A056F97F; Fri, 6 Jan 2023 03:47:37 -0800 (PST) Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 713B14AE; Fri, 6 Jan 2023 12:47:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1673005655; bh=XNQC90BPL01qhL4tDOTNnvszldIBSECjIvhcAKBYTo0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rYWQ9ZHq2wl7Ljd+jBOEZqrfFab5hETw7r0dkNsjNlxduZlqqc8x8d4E+4HKX9H/4 astYzkukeCSJUVXfuvWJBYzJeqgud/SAz4WkP1PM7CNT9jN46yPMbmzGJg/SMMHjYi nOlLeMy8Wy0ugE0wHrDjfX8GbOdVAqj3jG/GYNCI= Date: Fri, 6 Jan 2023 13:47:30 +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 , kernel@pengutronix.de, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/8] media: imx-pxp: detect PXP version Message-ID: References: <20230105134729.59542-1-m.tretter@pengutronix.de> <20230105134729.59542-3-m.tretter@pengutronix.de> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20230105134729.59542-3-m.tretter@pengutronix.de> Precedence: bulk List-ID: X-Mailing-List: devicetree@vger.kernel.org Hi Michael, Thank you for the patch. On Thu, Jan 05, 2023 at 02:47:23PM +0100, Michael Tretter wrote: > Different versions of the Pixel Pipeline have different blocks and their > routing may be different. Read the PXP_HW_VERSION register to determine > the version of the PXP and print it to the log for debugging purposes. Is there a specific reason you chose to read the version register instead of basing the decision on the compatible string ? > Signed-off-by: Michael Tretter > --- > drivers/media/platform/nxp/imx-pxp.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c > index 689ae5e6ac62..05abe40558b0 100644 > --- a/drivers/media/platform/nxp/imx-pxp.c > +++ b/drivers/media/platform/nxp/imx-pxp.c > @@ -10,6 +10,7 @@ > * Pawel Osciak, > * Marek Szyprowski, > */ > +#include > #include > #include > #include > @@ -52,6 +53,11 @@ MODULE_PARM_DESC(debug, "activates debug info"); > #define MEM2MEM_HFLIP (1 << 0) > #define MEM2MEM_VFLIP (1 << 1) > > +#define PXP_VERSION_MAJOR(version) \ > + FIELD_GET(BM_PXP_VERSION_MAJOR, version) > +#define PXP_VERSION_MINOR(version) \ > + FIELD_GET(BM_PXP_VERSION_MINOR, version) > + > #define dprintk(dev, fmt, arg...) \ > v4l2_dbg(1, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg) > > @@ -192,6 +198,8 @@ struct pxp_dev { > struct clk *clk; > void __iomem *mmio; > > + u32 hw_version; > + > atomic_t num_inst; > struct mutex dev_mutex; > spinlock_t irqlock; > @@ -1660,6 +1668,11 @@ static int pxp_soft_reset(struct pxp_dev *dev) > return 0; > } > > +static u32 pxp_read_version(struct pxp_dev *dev) > +{ > + return readl(dev->mmio + HW_PXP_VERSION); > +} > + > static int pxp_probe(struct platform_device *pdev) > { > struct pxp_dev *dev; > @@ -1705,6 +1718,11 @@ static int pxp_probe(struct platform_device *pdev) > goto err_clk; > } > > + dev->hw_version = pxp_read_version(dev); > + dev_info(&pdev->dev, "PXP Version %d.%d\n", As the version can't be negative, I'd use %u.%u. > + PXP_VERSION_MAJOR(dev->hw_version), > + PXP_VERSION_MINOR(dev->hw_version)); > + The driver now prints two messages at probe time, it would be nice to combine them, or remove the other one. That's a candidate for a future patch though. > ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); > if (ret) > goto err_clk; -- Regards, Laurent Pinchart 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 DB198C5479D for ; Fri, 6 Jan 2023 11:48:37 +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=f+VESIK/J+q17j6w/ndycqbHed14/dAN5CEqJzhn5Zg=; b=TmJo9Cx50045OL hTaLr7kga9aY6o1aDQFfxd1Hsyl72xcPTY2O0m52QA+7jKRZgpsKM4sKnqBJu1mmTYb3Hoa/d2hJB dm7wEHs0HNP17G4n3sYa+TFMs6wRfrqo3U+Rygb7QmoTWcQnFdpLMp/PlXQuvEExTxaMNZOgKYYbH HfvaDGW29315DjYeZtfE5N4l/VbrYfc/dL89ny1QxjDQfmympb8TK1xgR3wZDIkL/YtL/fUH4JV4z zoBYQH03iaEBDV9k+XGvhwi8pBGXaM+R+rGF8pymc1X5QXgtWdGoRYMJ1iX+dvgPp+0wBZgjnaF+5 eFhsMkMIFp3oVLAZCLlg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1pDlCF-007ovO-No; Fri, 06 Jan 2023 11:47:39 +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 1pDlCD-007oua-8E for linux-arm-kernel@lists.infradead.org; Fri, 06 Jan 2023 11:47:38 +0000 Received: from pendragon.ideasonboard.com (213-243-189-158.bb.dnainternet.fi [213.243.189.158]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id 713B14AE; Fri, 6 Jan 2023 12:47:35 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1673005655; bh=XNQC90BPL01qhL4tDOTNnvszldIBSECjIvhcAKBYTo0=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=rYWQ9ZHq2wl7Ljd+jBOEZqrfFab5hETw7r0dkNsjNlxduZlqqc8x8d4E+4HKX9H/4 astYzkukeCSJUVXfuvWJBYzJeqgud/SAz4WkP1PM7CNT9jN46yPMbmzGJg/SMMHjYi nOlLeMy8Wy0ugE0wHrDjfX8GbOdVAqj3jG/GYNCI= Date: Fri, 6 Jan 2023 13:47:30 +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 , kernel@pengutronix.de, linux-imx@nxp.com, linux-arm-kernel@lists.infradead.org Subject: Re: [PATCH 2/8] media: imx-pxp: detect PXP version Message-ID: References: <20230105134729.59542-1-m.tretter@pengutronix.de> <20230105134729.59542-3-m.tretter@pengutronix.de> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20230105134729.59542-3-m.tretter@pengutronix.de> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230106_034737_478551_6FE77CB4 X-CRM114-Status: GOOD ( 25.60 ) 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 Thu, Jan 05, 2023 at 02:47:23PM +0100, Michael Tretter wrote: > Different versions of the Pixel Pipeline have different blocks and their > routing may be different. Read the PXP_HW_VERSION register to determine > the version of the PXP and print it to the log for debugging purposes. Is there a specific reason you chose to read the version register instead of basing the decision on the compatible string ? > Signed-off-by: Michael Tretter > --- > drivers/media/platform/nxp/imx-pxp.c | 18 ++++++++++++++++++ > 1 file changed, 18 insertions(+) > > diff --git a/drivers/media/platform/nxp/imx-pxp.c b/drivers/media/platform/nxp/imx-pxp.c > index 689ae5e6ac62..05abe40558b0 100644 > --- a/drivers/media/platform/nxp/imx-pxp.c > +++ b/drivers/media/platform/nxp/imx-pxp.c > @@ -10,6 +10,7 @@ > * Pawel Osciak, > * Marek Szyprowski, > */ > +#include > #include > #include > #include > @@ -52,6 +53,11 @@ MODULE_PARM_DESC(debug, "activates debug info"); > #define MEM2MEM_HFLIP (1 << 0) > #define MEM2MEM_VFLIP (1 << 1) > > +#define PXP_VERSION_MAJOR(version) \ > + FIELD_GET(BM_PXP_VERSION_MAJOR, version) > +#define PXP_VERSION_MINOR(version) \ > + FIELD_GET(BM_PXP_VERSION_MINOR, version) > + > #define dprintk(dev, fmt, arg...) \ > v4l2_dbg(1, debug, &dev->v4l2_dev, "%s: " fmt, __func__, ## arg) > > @@ -192,6 +198,8 @@ struct pxp_dev { > struct clk *clk; > void __iomem *mmio; > > + u32 hw_version; > + > atomic_t num_inst; > struct mutex dev_mutex; > spinlock_t irqlock; > @@ -1660,6 +1668,11 @@ static int pxp_soft_reset(struct pxp_dev *dev) > return 0; > } > > +static u32 pxp_read_version(struct pxp_dev *dev) > +{ > + return readl(dev->mmio + HW_PXP_VERSION); > +} > + > static int pxp_probe(struct platform_device *pdev) > { > struct pxp_dev *dev; > @@ -1705,6 +1718,11 @@ static int pxp_probe(struct platform_device *pdev) > goto err_clk; > } > > + dev->hw_version = pxp_read_version(dev); > + dev_info(&pdev->dev, "PXP Version %d.%d\n", As the version can't be negative, I'd use %u.%u. > + PXP_VERSION_MAJOR(dev->hw_version), > + PXP_VERSION_MINOR(dev->hw_version)); > + The driver now prints two messages at probe time, it would be nice to combine them, or remove the other one. That's a candidate for a future patch though. > ret = v4l2_device_register(&pdev->dev, &dev->v4l2_dev); > if (ret) > goto err_clk; -- Regards, Laurent Pinchart _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel