Received: by 2002:a05:6358:701b:b0:131:369:b2a3 with SMTP id 27csp1002411rwo; Sat, 22 Jul 2023 04:57:52 -0700 (PDT) X-Google-Smtp-Source: APBJJlFTvn+xpamTgU/OSE8MMYlVg7kkNbBlRLnbcAXOR5JJPRJBRtgye2ypt3ROfbyUSZiVJw2Q X-Received: by 2002:a17:906:1091:b0:991:c9da:70da with SMTP id u17-20020a170906109100b00991c9da70damr4815296eju.61.1690027072012; Sat, 22 Jul 2023 04:57:52 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1690027071; cv=none; d=google.com; s=arc-20160816; b=zEW1psu0CX1m9iIHzRYx1E0e9EU0bssWuVE9EwjziA2NHpr5wfOC23b9XURjjhMo8e 4hmLnLUX6FZ0Hz1aF7d6RHSX8xaza/JC+GLJHbHZD3y4b5AYxMeZcfneUjTGYJ7YTV5g A+yyvisbWPgSeu6M8SYQW3gXN24l+0Hnw3TxELfUnJX3QwKV9LXn/LbnRKJ6YCwcF92c J9dnRRTPe5sGNraSdQHBTQDo3I6zWIy3OVPT+Aadj+ATQdlBeI3TPglH42ymAvMopuIy LolVA5HsaOtUmzTRj1HCFDRODX0c1IUbOERUzCD7eAkM7eLR9A9WZhGLAs+7/fExYJeC 1x/w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=TjYyx1DOBe25+JK0YNsnvu9lLSFEE0N2YMpAouIlyww=; fh=l5tDndJEyEuSXH8p3Wx1dfAyiqL2OB2SmLmAQu11EuQ=; b=MC8MpdMHC6ZGarOdg+HjHbBl9mWw7rJqq+dOemaozX6CtJ2DbqhDoOCaOXhDsDhhrY agFuBQK+SrDnPIlheUXCpz3fkI8lV+b89Z2DVHtpEB1d+5RibStqF7PVM7AMBWw3jfCW agjo/NQOMf5OwRzW7JC8Y93OeWY5w4ftkd3jeAid790Ol+XoidGwMx6PPQeX+lMo35kT ioBg+8k3JBtIO6bE1vfn+HPBOPsPUe2b3DTZFXQRDbhJGf5xa8MX6onPuOZf+9d/dW9F iENy2uuaPW7+aeFX8HufuS/hZdvr4CaoPFJtIa3IvLXJijxAlCtdWuu+eOKtv5A7YSd7 uM0Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C+TT7ZqG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e13-20020a170906248d00b009874842217bsi3431531ejb.441.2023.07.22.04.57.27; Sat, 22 Jul 2023 04:57:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=C+TT7ZqG; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230215AbjGVLzM (ORCPT + 99 others); Sat, 22 Jul 2023 07:55:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59178 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229545AbjGVLzH (ORCPT ); Sat, 22 Jul 2023 07:55:07 -0400 Received: from mail-wm1-x32f.google.com (mail-wm1-x32f.google.com [IPv6:2a00:1450:4864:20::32f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0243B35AD for ; Sat, 22 Jul 2023 04:54:50 -0700 (PDT) Received: by mail-wm1-x32f.google.com with SMTP id 5b1f17b1804b1-3fc0aecf107so22174865e9.2 for ; Sat, 22 Jul 2023 04:54:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1690026889; x=1690631689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=TjYyx1DOBe25+JK0YNsnvu9lLSFEE0N2YMpAouIlyww=; b=C+TT7ZqGhAhjvW9XCQGZwb2gl5+vD14Jy8uq2oZSlz1LmbGcRH4HVqlRbJ7yx0vi+L d3o47Mw6VkqltdTx5xSm7yZqpyGvkPkvtkzk1Dno6M81vIm00sagL8OyBwyYLsjQOspI ZNiqhohXFXHwovf6TVkd1eBhJwA9S4qKMD6xnO+YWT9XRKQjrVO5XJhpJh52U1rHV9fN DCNc8tnmfzNRtHx6GJ1VQ88vcIFKoAeRz6zI5lam2axHjBH1G8DOvwNv/cy/MVRLfsyK hNn2ufh72RwpLDpiZxjWMpv5Iw+tt0uacRFE/0reEUBByjLI+/Zplq/mdFgbCHWUeiWl IbMw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1690026889; x=1690631689; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=TjYyx1DOBe25+JK0YNsnvu9lLSFEE0N2YMpAouIlyww=; b=f/l0d832akPFasJjXfK/YqrZVtKllmkg2niGGgbRLclJMl0sda4gmxsf4iWFo8HIz6 /J+7exa7/5oHzDIB4GpndrduoQBktwkcyWNUV9XkAlopD9xARyjsuNadIfLhuue5X0aa 4OWStVbP4SQhHBK0/g/+TB989YoTgZ9xKZ3vyc/m2b7WTgXTIIQs1jXPJcmbEu0ho0H+ Mg6uYHtU7RtZerOhh1AlEUDuvM8gSEE6hMfOcDuEEQh5ZbcosYXs3WRRHIZpeFmIKGqY NlGeCSpYNpDZPmv8GW1MmzwZKUdom6ewlkvxYRPFbWl2ftqwvnEMj47zu83+t0bdnVL1 RCzA== X-Gm-Message-State: ABy/qLbtF/ngrZfEgX/pGxk07BIpooW30K+3m6W/aTlrgnIMNp5B9Hqn Tc7JOYtP8IjVVbNkLcb2yLXKag== X-Received: by 2002:adf:f848:0:b0:317:18a8:5fa1 with SMTP id d8-20020adff848000000b0031718a85fa1mr2615312wrq.69.1690026889447; Sat, 22 Jul 2023 04:54:49 -0700 (PDT) Received: from krzk-bin.. ([178.197.223.104]) by smtp.gmail.com with ESMTPSA id o8-20020adfeac8000000b003143b7449ffsm6726496wrn.25.2023.07.22.04.54.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jul 2023 04:54:49 -0700 (PDT) From: Krzysztof Kozlowski To: 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 Cc: Krzysztof Kozlowski Subject: [PATCH 3/3] media: exynos4-is: fimc-is: replace duplicate pmu node with phandle Date: Sat, 22 Jul 2023 13:54:41 +0200 Message-Id: <20230722115441.139628-3-krzysztof.kozlowski@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230722115441.139628-1-krzysztof.kozlowski@linaro.org> References: <20230722115441.139628-1-krzysztof.kozlowski@linaro.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); + + 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) { -- 2.34.1