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 8F1B9C41513 for ; Mon, 7 Aug 2023 13:06: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:In-Reply-To:From:References:To:Subject: MIME-Version:Date:Message-ID:Reply-To:Cc:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=s/QN82IB/wEp6Ky4L6aBFdKypoTcC63RUV/dJ7HGysQ=; b=l7qOCfKWXKeoZU oU4fWRUYFDQlxISYnlyHWF3N5KIk/E4uv5EyPJzP2XaLdrqFNEPWMwVCgW44cRSOKmZL0qS3bz6rq dnsewk7Vit+hny++RAZRxTF7Xw84chShSlaGmLCm8jYAmBR9jVeQoe1TqlfpNVsaUXzHdVOZqdj5S 6Tad6l40cF2uFP8FmjHYoV7My9WkZf1vSXlEH32yzOMnpUYM+49dhCMwvYLU0z/GXJUUtw1cf92JZ GED8L6nXEH24Y8ovxWRZupQCG+GNLh8iOEGqv6/RM0X45oMysCNpYT8z5+DdA4Yn6m14MKO/GbKx1 fdy3cD1wg9p6jKHC/+Dg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.96 #2 (Red Hat Linux)) id 1qSzwM-00HIVJ-07; Mon, 07 Aug 2023 13:06:30 +0000 Received: from dfw.source.kernel.org ([139.178.84.217]) by bombadil.infradead.org with esmtps (Exim 4.96 #2 (Red Hat Linux)) id 1qSzwI-00HIUd-2Y for linux-arm-kernel@lists.infradead.org; Mon, 07 Aug 2023 13:06:28 +0000 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4B8A1618D6; Mon, 7 Aug 2023 13:06:26 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 37D0FC433C7; Mon, 7 Aug 2023 13:06:23 +0000 (UTC) Message-ID: <0b361e6c-d141-4758-edc2-c75b6f0efbe3@xs4all.nl> Date: Mon, 7 Aug 2023 15:06:21 +0200 MIME-Version: 1.0 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:102.0) Gecko/20100101 Thunderbird/102.12.0 Subject: Re: [PATCH 3/3] media: exynos4-is: fimc-is: replace duplicate pmu node with phandle Content-Language: en-US, nl To: Krzysztof Kozlowski , Sylwester Nawrocki , Mauro Carvalho Chehab , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Alim Akhtar , linux-media@vger.kernel.org, devicetree@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-kernel@vger.kernel.org References: <20230722115441.139628-1-krzysztof.kozlowski@linaro.org> <20230722115441.139628-3-krzysztof.kozlowski@linaro.org> From: Hans Verkuil In-Reply-To: <20230722115441.139628-3-krzysztof.kozlowski@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20230807_060626_914429_03690AA9 X-CRM114-Status: GOOD ( 24.01 ) 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 Krzysztof, On 22/07/2023 13:54, Krzysztof Kozlowski wrote: > Devicetree for the FIMC IS camera included duplicated PMU node as its > child like: > > soc@0 { > system-controller@10020000 { ... }; // Real PMU > > camera@11800000 { > fimc-is@12000000 { > // FIMC IS camera node > pmu@10020000 { > reg = <0x10020000 0x3000>; // Fake PMU node > }; > }; > }; > }; > > This is not a correct representation of the hardware. Mapping the PMU > (Power Management Unit) IO memory should be via syscon-like phandle > (samsung,pmu-syscon, already used for other drivers), not by duplicating > "pmu" Devicetree node inside the FIMC IS. Backward compatibility is > preserved. > > Signed-off-by: Krzysztof Kozlowski > --- > .../platform/samsung/exynos4-is/fimc-is.c | 33 ++++++++++++++----- > 1 file changed, 24 insertions(+), 9 deletions(-) > > diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-is.c b/drivers/media/platform/samsung/exynos4-is/fimc-is.c > index 530a148fe4d3..c4c191771093 100644 > --- a/drivers/media/platform/samsung/exynos4-is/fimc-is.c > +++ b/drivers/media/platform/samsung/exynos4-is/fimc-is.c > @@ -767,12 +767,32 @@ static void fimc_is_debugfs_create(struct fimc_is *is) > static int fimc_is_runtime_resume(struct device *dev); > static int fimc_is_runtime_suspend(struct device *dev); > > +static void __iomem *fimc_is_get_pmu_regs(struct device *dev) > +{ > + struct device_node *node; > + void __iomem *regs; > + > + node = of_parse_phandle(dev->of_node, "samsung,pmu-syscon", 0); > + if (!node) { > + dev_warn(dev, "Finding PMU node via deprecated method, update your DTB\n"); > + node = of_get_child_by_name(dev->of_node, "pmu"); > + if (!node) > + return ERR_PTR(-ENODEV); > + } > + > + regs = of_iomap(node, 0); > + of_node_put(node); > + if (!regs) > + return ERR_PTR(-ENOMEM); sparse gives me these warnings for these ERR_PTR returns: drivers/media/platform/samsung/exynos4-is/fimc-is.c:780:39: warning: incorrect type in return expression (different address spaces) drivers/media/platform/samsung/exynos4-is/fimc-is.c:780:39: expected void [noderef] __iomem * drivers/media/platform/samsung/exynos4-is/fimc-is.c:780:39: got void * drivers/media/platform/samsung/exynos4-is/fimc-is.c:786:31: warning: incorrect type in return expression (different address spaces) drivers/media/platform/samsung/exynos4-is/fimc-is.c:786:31: expected void [noderef] __iomem * drivers/media/platform/samsung/exynos4-is/fimc-is.c:786:31: got void * Regards, Hans > + > + return regs; > +} > + > static int fimc_is_probe(struct platform_device *pdev) > { > struct device *dev = &pdev->dev; > struct fimc_is *is; > struct resource res; > - struct device_node *node; > int ret; > > is = devm_kzalloc(&pdev->dev, sizeof(*is), GFP_KERNEL); > @@ -794,14 +814,9 @@ static int fimc_is_probe(struct platform_device *pdev) > if (IS_ERR(is->regs)) > return PTR_ERR(is->regs); > > - node = of_get_child_by_name(dev->of_node, "pmu"); > - if (!node) > - return -ENODEV; > - > - is->pmu_regs = of_iomap(node, 0); > - of_node_put(node); > - if (!is->pmu_regs) > - return -ENOMEM; > + is->pmu_regs = fimc_is_get_pmu_regs(dev); > + if (IS_ERR(is->pmu_regs)) > + return PTR_ERR(is->pmu_regs); > > is->irq = irq_of_parse_and_map(dev->of_node, 0); > if (!is->irq) { _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel