From patchwork Mon Oct 28 10:25:27 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3595 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f71.google.com (mail-ed1-f71.google.com [209.85.208.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4F47C3F338 for ; Mon, 28 Oct 2024 11:26:18 +0100 (CET) Received: by mail-ed1-f71.google.com with SMTP id 4fb4d7f45d1cf-5c92e8b8101sf3029818a12.2 for ; Mon, 28 Oct 2024 03:26:18 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1730111178; cv=pass; d=google.com; s=arc-20240605; b=So28C/Koreg0eTssORFYwLxiyDLrZYXmC+dIGo+Lb5o262daSC6qEyc39K1w+afYBY D+7wWQA39/ZByB2/SVgSiUp30yczbysl4TaRrwfdLiHzacyyx3qjXJHUMTJCxjgQJUSf LY1hyFjlNwnIf9GPjC8CCrEtUdh9rDocEoj3nxDRq2aldDFrni+Rlz/AAQwo9zp2Y87O Qfi8soPhkmFUGRv8Qqdkk7KYf3H4II+va+ldm5c5VYfjuJ6VnLYnBWm4XLRoUo4mP0gg qioMtfyL/PGHY6bGOtYOrKCzHr/b9ExBjlaGpa8TBwYZQKrYp+/N8sOVWKzouSsrq4MU SevA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=w2hKqSM9Nl8/jbvd9hp61HEGcobReW5nVzfdVwt2988=; fh=g35dbYIIBQEc0bjeGQy4GZHON+2BwLk9i/gn36BGbJ8=; b=Ww5gYzxgDy7zKKHh5/g9EW3dB9zQvfbOtnD/APVu6Tp01iaqzRG4XJjEgoOgZ/AZLu /6FJL0xQkFMJSfmwuW+Jz3J9V1zn41P4xEJ3zquroJNvkFvNarx9S0Sq0HMA8bqtPOry Qp4el5mUoobdVZ7y2BUOgBPIlZBGFQ5keeZyRHbRV5hbs7b9gfr307M1SY6HLtPsJ0eC 4KERfhLHWOB5ZHl3UFMhlitIPShb/pNKCTcO30QTPCf9C/ejEgaplvTtNO95mvEArMtN lBwyhxsajou2rykYjcfg9i8utqnc935xlBTy64M33qCS5rj6OYPs7/Glh+vakJhqsJKK Ar3A==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=co3oWLRC; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; t=1730111178; x=1730715978; darn=patchwork.amarulasolutions.com; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=w2hKqSM9Nl8/jbvd9hp61HEGcobReW5nVzfdVwt2988=; b=Rijr3LRKX7hd6pLFFODJM+JqTfnVeojKKwEUWfvD8+F4peke8bAB0oOgyEUxlzLyNK tyzTOa7NW1BWMiaXL5Zd7Lyv/32ErdAtwj3s/U+nlslKKoskijKkKzckPN3akyhgbsPb DVRsM8KEqa1cVP9HrIO50yNdqRXbxj7/BgqhU= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1730111178; x=1730715978; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-beenthere:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to; bh=w2hKqSM9Nl8/jbvd9hp61HEGcobReW5nVzfdVwt2988=; b=mH7FyG0FqW9xpSdHpa6Wk7mdZVYaK5KWKetthDnkcshVY3y6Im8+IXgfnNoQCME0lq fxl0DzBgglacRvUD4CtIFdMsEjgIeDWRdGd7UuPCtObPP92fTaWu4qoCbOWfN9aitrhz YkGhNx6KQNXbjfB5MsCOMoU32aJYyV70rtXyrNO47ODto90+uC7iN4OpANulgOq//yFf 9e86vEwaA2tOm2ornKCLrEadMTMG1Wt2kDhpOl6SdaFzrK0TozybzvRN5aMa9lldaWC8 BxD3ttc94a58gyRuKr6wwJxR49xYtkMwlMgc2WqLlDte1TppVUfBnaCSzXhGZPhJ2rg3 WhQw== X-Forwarded-Encrypted: i=2; AJvYcCXTC9O/iCtHWUJr0er4uXFtOVI3TH83Puf3N9zB4ErhZVLsTdDqO4/JEUXS5YfhzuUBQOgHj8OnliBQNVpj@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yx40Nzgrrm2wg81XXg9S4TtT30Kx+LIdoSJCcRTDXoOt9TUc35W Bps6mtAt6z1RJPop5usrYspJQSbdimveJFKmyM7GrYvgh+vC+S3PfdPs+xnTo+zeZA== X-Google-Smtp-Source: AGHT+IG4GU+wWnBcJAC5blOQUh876pIA1pEjU8kwvUpFaLDN8cJfQ4TOVhTrkcl8jOrnYAxxFXkYng== X-Received: by 2002:a05:6402:35c3:b0:5ca:e4e:59e6 with SMTP id 4fb4d7f45d1cf-5cbbf94abcdmr7882765a12.27.1730111177918; Mon, 28 Oct 2024 03:26:17 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:2112:b0:5c8:acf3:129a with SMTP id 4fb4d7f45d1cf-5cbce263341ls68143a12.1.-pod-prod-08-eu; Mon, 28 Oct 2024 03:26:16 -0700 (PDT) X-Received: by 2002:a17:907:7d93:b0:a9a:8a4:e079 with SMTP id a640c23a62f3a-a9de5edea84mr705299466b.31.1730111176396; Mon, 28 Oct 2024 03:26:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1730111176; cv=none; d=google.com; s=arc-20240605; b=OBrx/d89q+JiCS9aNcYW65SsA9ZpzszzFj7FcqLws9SiSjp8B+NEUZDaH2plndaq9X 00Hdt1qp6Rv7fNtFBlcypp6+CjGbMsn+cxXFSrR1+LH8Ps5c2nKCB3QthzMTLivvxkhP z3fjUxf0pREVlivBlcXX7BniBSaDLnp2QN6T5X6LSvglp9NsWnYrXNH8/+9Ikil+vefP RRiOlOgnBrdROdVSCzZrjXM6wHtiSJUB44rZ8tf4mrX9PRZ+TSTB9j/mEdF+69Mkd+9j JDoxmzTxs5u9KgnukG5CycG+hSv70lPMS9gLgbsFnh4L1W4nwRI/dbvL38E+PsZJg86Z LAvw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20240605; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=3tF2Wj+vRMtC983z9w7XL42BV51oFEPPNHEhybEVd+Q=; fh=NcMBwwiNt23f9TqX7vGiZ69SyZyyIPIFh3O627JMfbU=; b=BoY90CK8hBIlNYEJABsR1gyacclkuqg/E41jOZmHRmgCjN6wx0HtS+cVC/RvOyHOIh WkLK0h89JsGxzdi2uN7XKzVTcGmGJQPQD8GH79netgbqae4N/3/AZMPvNqRuvq//UrUh 6lDxIJ16xUHaoDAiowpGziXQntXWd6nqwY2WvV5v7YzdQeSIgmEjDZl4L8IP48ox/9il HKa/lGZ6QR9/R+zuMgo15Bp7TVzR2gSjt5Os/TGTI+Il9w/rF7E95yipsrz/Uo2gKia7 6aSPFgAp9sXsn5mx5rKVMC4cN2MgtnzQcuMAHznaey9F1qDjts58Qv6ruT0Pu4SkmfEA zBbA==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=co3oWLRC; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id a640c23a62f3a-a9b1ec51d1esor256272666b.6.2024.10.28.03.26.16 for (Google Transport Security); Mon, 28 Oct 2024 03:26:16 -0700 (PDT) Received-SPF: pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:907:1c22:b0:a99:f1aa:a71f with SMTP id a640c23a62f3a-a9de5c90d49mr793546866b.11.1730111175841; Mon, 28 Oct 2024 03:26:15 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.121]) by smtp.gmail.com with ESMTPSA id a640c23a62f3a-a9b1f297b04sm363613966b.134.2024.10.28.03.26.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 28 Oct 2024 03:26:15 -0700 (PDT) From: Dario Binacchi To: linux-kernel@vger.kernel.org Cc: linux-amarula@amarulasolutions.com, Dario Binacchi , Michael Trimarchi , Fabio Estevam , Krzysztof Kozlowski , Pengutronix Kernel Team , Sascha Hauer , Shawn Guo , Shengjiu Wang , Ulf Hansson , =?utf-8?q?Uwe_Kleine-K=C3=B6nig?= , imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-pm@vger.kernel.org Subject: [RFC PATCH 04/10] pmdomain: imx: gpcv2: don't turn on a power domain already on Date: Mon, 28 Oct 2024 11:25:27 +0100 Message-ID: <20241028102559.1451383-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> References: <20241028102559.1451383-1-dario.binacchi@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: dario.binacchi@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=co3oWLRC; spf=pass (google.com: domain of dario.binacchi@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=dario.binacchi@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com; dara=pass header.i=@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The patch, by informing pm_genpd_init() with the "is_off" parameter that the power domain is already on, prevents the power_on() callback from being called, thus avoiding the unnecessary repetition of the hardware power-on procedure. This feature is crucial when supporting the simple framebuffer, as the power domains have already been initialized by the bootloader. Co-developed-by: Michael Trimarchi Signed-off-by: Michael Trimarchi Signed-off-by: Dario Binacchi --- drivers/pmdomain/imx/gpcv2.c | 32 ++++++++++++++++++++++++++++++-- 1 file changed, 30 insertions(+), 2 deletions(-) diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c index 963d61c5af6d..bf9fe4af03c5 100644 --- a/drivers/pmdomain/imx/gpcv2.c +++ b/drivers/pmdomain/imx/gpcv2.c @@ -1324,6 +1324,7 @@ static const struct imx_pgc_domain_data imx8mn_pgc_domain_data = { static int imx_pgc_domain_probe(struct platform_device *pdev) { struct imx_pgc_domain *domain = pdev->dev.platform_data; + bool init_off; int ret; domain->dev = &pdev->dev; @@ -1354,12 +1355,33 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) regmap_update_bits(domain->regmap, domain->regs->map, domain->bits.map, domain->bits.map); - ret = pm_genpd_init(&domain->genpd, NULL, true); + init_off = !of_property_read_bool(domain->dev->of_node, + "fsl,boot-on"); + ret = pm_genpd_init(&domain->genpd, NULL, init_off); if (ret) { dev_err(domain->dev, "Failed to init power domain\n"); goto out_domain_unmap; } + if (!init_off) { + ret = pm_runtime_get_sync(domain->dev); + if (ret < 0) { + pm_runtime_put_noidle(domain->dev); + dev_err_probe(domain->dev, ret, "failed to power up bus domain\n"); + goto out_genpd_remove; + } + + if (domain->keep_clocks) { + ret = clk_bulk_prepare_enable(domain->num_clks, domain->clks); + if (ret) { + dev_err_probe(domain->dev, ret, + "failed to enable clocks for domain: %s\n", + domain->genpd.name); + goto out_pm_put; + } + } + } + if (IS_ENABLED(CONFIG_LOCKDEP) && of_property_read_bool(domain->dev->of_node, "power-domains")) lockdep_set_subclass(&domain->genpd.mlock, 1); @@ -1368,11 +1390,17 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) &domain->genpd); if (ret) { dev_err(domain->dev, "Failed to add genpd provider\n"); - goto out_genpd_remove; + goto out_clk_unprepare; } return 0; +out_clk_unprepare: + if (!init_off && domain->keep_clocks) + clk_bulk_disable_unprepare(domain->num_clks, domain->clks); +out_pm_put: + if (!init_off) + pm_runtime_put(domain->dev); out_genpd_remove: pm_genpd_remove(&domain->genpd); out_domain_unmap: