From patchwork Wed Sep 11 15:15:50 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3462 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wr1-f71.google.com (mail-wr1-f71.google.com [209.85.221.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 1CF3C42E89 for ; Wed, 11 Sep 2024 17:16:04 +0200 (CEST) Received: by mail-wr1-f71.google.com with SMTP id ffacd0b85a97d-374bb2f100fsf2971746f8f.0 for ; Wed, 11 Sep 2024 08:16:04 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1726067764; cv=pass; d=google.com; s=arc-20240605; b=h466FN/txQH3brIdrCYS1PDnjk/KFFJ7Eir3BPtEkD6yj812ZtA46UnSbdPR0r80yM LphGUU/IGTJyLru6UvShnc2nObNAvP86/brLQUrlwhpbZu7zLngMW0qWYRGJ/OUZDvhf uvfcLgNT9VgZHjLCVGJIfvPxAIlBK88LIl0HMWNeFAcZuqGeEY+yV/MWDifLFbJ3c8NS +Q9vTYNX724vONXtBOZ3AJLOmWmzWRIeO9zkrJx1/2Cv3HvHchuPOFtBKsU9pwXLQjE2 gQjHZrHcEE/OLFD2dsRYZsT5xQAGVv0hQ3UeyZl58tQJf9Cm0HzQBluBnU2HNQmEDl5R zreQ== 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:to:from:dkim-signature; bh=J0oCOBvw+S6KwfV50PCYj+UQ+LpnyWegF0wDbc0IUSE=; fh=QAYQfJIcA/VKnUbk4qvDjcQuu6Y8bi6rfCYoO/FbOqU=; b=jbWITtdGA491AX67jVGFPv5CmfDT7B2rhYvyHh0EM57LhlnyXMH+nIKhyC4mOq6brW RWVPcv/0bJCQcvdMdONfI5HrvkNYzWKGNghFvWDmSdCpUuezH6hdaJ7Q/LO+xKA0PPxg TEc5F82MDIeLbbG0kYMH3ph3U7y0cqur6q6ASBMD/CA68cyiaFwiPnib3R9XGmPwxePO pokV5H/gEnzRu7ji26TR2O1YxpDFF18x2CNniXIIngQaiIrDfvb9ndRcNrd+bSvy8r6R Atrs4/wB1/eUA3oFoWxdb2/NlktjLSFvUNr3VtfyYdDoamI1WEoTvKl/mvuwWCixrZqY aCjQ==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=S5rqEFOR; 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=1726067763; x=1726672563; 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:to:from:from:to:cc:subject:date:message-id:reply-to; bh=J0oCOBvw+S6KwfV50PCYj+UQ+LpnyWegF0wDbc0IUSE=; b=FMK5xPWgWyyROKXAG+mEd3BaN+X0a5uusXac2EkYAvTJda9VsWhA1z9KRPJ32oRyuK LbvWO3uvLiY9rafb6Gu3xqMeqXA5awdQw9+BUI4Ni+cZaf6V5S5T5eSwKkfC6WQXKL9p Khr/aaGagCUFkCX2vfd4wY7uhKBemLfW78c+Q= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1726067764; x=1726672564; 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:to:from:x-beenthere :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=J0oCOBvw+S6KwfV50PCYj+UQ+LpnyWegF0wDbc0IUSE=; b=q/5iSR+j7g5cPSbPujaINcsCAR8FKs/nuqbBvuZctvGo/CBDXu2/o1aWRqkoLmzPoF 8Y3krOZ7pjs+2D0NDzMcMkCwWUGBERj7dSb0FOfynSxXQE8rTHDOkG9UOIInuDTbhVEo 4ncq1KzVrLxoInxzAxFBBzwrpdAlMzrNBtyBu5i1MIMEhj5fov/IjwIK4Pvmfi2Pzegg 0FTCVT3NjzwKQJmHCCZAIpB/dszvA9m+4+F3CdjQGmkyrofh1DPpbYAYhAKZbKEq88y0 y0JANBzN7WN3GpdZ/drpVowns60rpT4ESla01Ih5tDFBPn4grgzNvfc7AoaS76XRLuQa 5vww== X-Forwarded-Encrypted: i=2; AJvYcCX9MdUuJ7orxSllep7vZ+yydyuNxakGH2jVpGe2r8s5AzxD5X6p6N0kLAmjG8bV69za4nCFYAFmAd1DJ1kF@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0YwGTuYyWIfiZOGyKg5wVaWdTPIszJ4O52RLMx2JOoXyH13Tx/NR VdIt1vBivWawJ/gf6C1qqKFAwgtt9OmJPUVOXzknlGnYMdqJcF7rdIPRGnAykSsc/A== X-Google-Smtp-Source: AGHT+IF73ZY+S27gMEet9qyJZkT7ned2D/s3Ddn4pp37FXb/dGGNqJkueAKTZKnTNwQbS2c3IS6L+Q== X-Received: by 2002:adf:f38d:0:b0:374:b35e:ea6c with SMTP id ffacd0b85a97d-3788967487amr12399581f8f.40.1726067763656; Wed, 11 Sep 2024 08:16:03 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:adf:f411:0:b0:368:4489:3f45 with SMTP id ffacd0b85a97d-378883d0021ls1288898f8f.2.-pod-prod-01-eu; Wed, 11 Sep 2024 08:16:02 -0700 (PDT) X-Received: by 2002:adf:a3cd:0:b0:374:c1f9:ea79 with SMTP id ffacd0b85a97d-378895c323cmr11751150f8f.5.1726067762163; Wed, 11 Sep 2024 08:16:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1726067762; cv=none; d=google.com; s=arc-20160816; b=Kx9gNHP6HkQeJ9sVjnoMR8guYqdVw2TgC544yh6HVKfo/IdNfkN7EFPK+i34RMK9UB G8HuqjWIZXUkTIXBntkWWvxcdMIo4SLPAWY+E0zhtQgsVr7MqMOgJPAPqpeVnABh6XdS b/Fve6Fu8f/F2uJOWjF/ABYkQQEldyliWQCGQnWb27u3N21DDPkgv61uLJjzWHge8LLe GiYSBU6H+iEc5qFxSSfIfknLLFGxgXTi6fO+kI/UZ7FIibeWw9i4OwkefXxowzbUqpfn RZwgtRRxUwY+NdPxiAqbjt4AMRmL3E2bk1xYWEzjUh0nwBZwZzwLAEJBCG2gJBCAqH7u MMHA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:dkim-signature; bh=/BDd7c4xTgXZo0WxyxenDl3Nw/iA1QAcTDBZTuDPcQw=; fh=FtQepR0uNoeKT2PVdKfTKOkvEYfwbRmoVE9BmlYw3tk=; b=yx7yPKJ78xSosEn5hVYoTa4s+ks2g16OuIPaWAz6Tg9/VHCcA2TQb2NjDf7RrrNSyN zBrU0g4EXMPcOu/Hwi9LdKtHuWu/fO24M0qwbUa9daacvPVmepMFNiURd+23RagoFLE7 CWsgjqsoP2xzjAGeHEUsdQRsZrSrryQ+IsaFV4r9wDFmLDb88qT9zaHMqtQ475DYYLtS 41CU41yGxdt2F1rbUutVok/PG84PdQBqLaBchWo5pEWNMAsFyuK1FqoyTIuXECIy/Z/D 0e2GRTFGiXRw1j7aGLbzd28izVRYh96OO136dPavbCZgIoHu0GqByK33PpiUFyel+X15 ElWg==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=S5rqEFOR; 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 ffacd0b85a97d-37895600ce1sor1962235f8f.2.2024.09.11.08.16.02 for (Google Transport Security); Wed, 11 Sep 2024 08:16:02 -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:a5d:490f:0:b0:374:c847:83a with SMTP id ffacd0b85a97d-378895c32bdmr9668516f8f.8.1726067761365; Wed, 11 Sep 2024 08:16:01 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.41.3]) by smtp.gmail.com with ESMTPSA id ffacd0b85a97d-378956d37a1sm11797177f8f.77.2024.09.11.08.16.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Sep 2024 08:16:01 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH v2 05/10] pmdomain: imx: gpcv2: don't turn on a power domain already on Date: Wed, 11 Sep 2024 17:15:50 +0200 Message-ID: <20240911151555.2915258-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240911151555.2915258-1-dario.binacchi@amarulasolutions.com> References: <20240911151555.2915258-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=S5rqEFOR; 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: Dario Binacchi --- drivers/pmdomain/imx/gpcv2.c | 31 +++++++++++++++++++++++++++++-- 1 file changed, 29 insertions(+), 2 deletions(-) diff --git a/drivers/pmdomain/imx/gpcv2.c b/drivers/pmdomain/imx/gpcv2.c index 374732335752..3c1982e46769 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,32 @@ 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_probe(domain->dev, ret, "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 +1389,17 @@ static int imx_pgc_domain_probe(struct platform_device *pdev) &domain->genpd); if (ret) { dev_err_probe(domain->dev, ret, "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: