From patchwork Tue Sep 3 15:31:52 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dario Binacchi X-Patchwork-Id: 3406 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-wm1-f69.google.com (mail-wm1-f69.google.com [209.85.128.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D39293F228 for ; Tue, 3 Sep 2024 17:32:05 +0200 (CEST) Received: by mail-wm1-f69.google.com with SMTP id 5b1f17b1804b1-42bb9fa67d7sf52850045e9.0 for ; Tue, 03 Sep 2024 08:32:05 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1725377525; cv=pass; d=google.com; s=arc-20240605; b=NGMVXjFIEWHAKKzFt0WH6xVaqpKmJQu6l4FgBM77cA4jFU7Gbv6gXG6hfF7VXaK+RP lFNH9UAeBLGXw10rCqHZi93Xgs/Atp1S52HGWLUqOtCNL0pWn7yL4taLNp6y1vO4cHgO ZlRReRbyM4KKdccFjqctqwOw4/Yn3x3NBmRhZaFuNq3WklASrHoIcRiaxC3BgLSM1Y9W j8GscYa0Islk87BGneLtKm6Hdq9VfJjXR2d560MfGygtTEKPoJlhHXdHxkazNXwXnkY6 UwEf/IDh2yvlzm0KpD++SU/o4fgKW+O3MxEjKNmX1aH/5T9GF17m+GNyxgNen8/5z4EW /6ng== 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=EdeXsWpC3Z97tyvYfdsq++m+qnEXpwIleBUMr8Q6jnI=; b=bsG6tnI6qxUnUVuWysTdqjg7+IUIu9Ow/fTLr8bGPBMy4UNVIbGdqXMu/lM428uUTV bAdvAroVXgVz61/F7Jizibfual9NVexVyqFq0F0xeOIJH62SFhg/Yi8A/EXhcvnCKVTC maoubT5hckgkcL7/2QTuIiooQ86F6xr3YF10V+4FmiYsOwUmEcTp/2BJWbLsj8mqYCDv SUZerCpDbSyxeBP7jnkrJKEy8VlWg8y9pyQESSMSe5nY6o9j3Yq9anJRJmql9rQRK/+k b01nQvjMKS9iyBqt9rxsMTR4gp7br0qWMNTZ3SKBGtt7qZQLOhZv3djoFZk1++3p/NFP /Pjw==; darn=patchwork.amarulasolutions.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UZAP8ZK7; 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=1725377525; x=1725982325; 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=CxhUobsE7TAEig7mc1qs1t9co8AaOUQ5aebb3Vgm17sY9Wn0M1guJBsPXP9mBLkHsb cRQ4AH/MKPgsZ1oUmAyMZPzqM6JuamVv4pzXDV2LwRJUtQQy/HxU9dB/B8lKLgawFQq0 7ra+HzKmwaUPePRvmnpAHALq5fXq0gVZeJJ4g= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1725377525; x=1725982325; 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=NckNzmY6J1JvfCreiE0I9IXQzJqCfVQ0XR1JTEXEMT3q5/Vp3OWcCDOJwJ0XaJjw1b PLQfPppSYBrzbqxdN+G/CGH3w5oYTpG9lV1Y1nnyEcxiF1IcxiNgpC4JynV5fGTGBvir i5PjTirs/ZuaW5DfPvnq2YH8xk217i13BwIRuyg2E68eMnT/fpIWDmG4NYjtHIkjLE7y Tzg1kjeRfuQE6Y3tDOjsAh2WfF05tnq3oeO02asOgtGU2xWxAaJ/wIU3PB4z2UYJWPtR X3oQnMK2/tE9GIx0MQqMqocw7KKhy5B+XoZEWtNH3QNSr/3O07wq0W2qZvrmvEKIUVAu Q+mA== X-Forwarded-Encrypted: i=2; AJvYcCWQLIea/Hhs2lw+h4bX1RZsHWk+bpvf6BiZzb4hZHH8UfSd1z+fePFRjrtKo4OmUCbGX01eY3qz0nHzR9Cg@patchwork.amarulasolutions.com X-Gm-Message-State: AOJu0Yy/yPsACBzxUM6Famm9K9zynlOVR4hMBlzBvJ3+G9EDuOGmavlE 9QZTDXF8Fpyl3GI51vB9F3/YEQl1djdxm/mgj+tKVjmg0/qBhcOkQKP3y2Bwm64Q5w== X-Google-Smtp-Source: AGHT+IGeEz3UKkxKTndXXt6HP3fhbVELnxkfl6gw7E2mAGqiDQkX4kf3B2NMhp0LjIOw9NoGXZTUDg== X-Received: by 2002:a05:600c:a01:b0:426:6857:3156 with SMTP id 5b1f17b1804b1-42bb01edd50mr168216425e9.27.1725377525301; Tue, 03 Sep 2024 08:32:05 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:600c:3590:b0:427:9669:d780 with SMTP id 5b1f17b1804b1-42bb28398bfls1349335e9.0.-pod-prod-05-eu; Tue, 03 Sep 2024 08:32:04 -0700 (PDT) X-Received: by 2002:a05:600c:1548:b0:426:59d3:8cae with SMTP id 5b1f17b1804b1-42bb01b9302mr160751305e9.13.1725377523697; Tue, 03 Sep 2024 08:32:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1725377523; cv=none; d=google.com; s=arc-20160816; b=BshbQnnmdRJFPUjMUU0553iMAIsTOHEgB8zPaxFHm6N4aHWgibDzpmZ5Wbdn3dl58q NEV4VBDEUnbhmgJJvDG9yIJUZVx4YF0niajwJJvzUqoBO2UH8RKY2XL37yBOlF3Q3U1C NRVOtiq0wifsWS9Mn2WcCOs14fGAZQKnkJChByTK55i/jgIW640HPkSiJnkMZvPv2o7r 1NUjWBQ5gbxBRrfrEkR0mlibHlATHhafn4ZtzcLIN1jqWwPTypdwZKvhrOM6RFSdCTT+ nFqMdcVymKi2OUfKFKq5AHjH+aWNqY57DWDEYrOk7wH2m9g1M3JwOgS+XSePjEN/s81w XOlQ== 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=hfnegFXyJ6Qfy9UDu7ENHBttZ/7MCs5jmGWIHgTo04tou7IAh+iqqjQnGxP5FeFsa6 mLmU3cGuBxVsmr6/dyigvPXXwfAGIaeABib9atxTRy2fl9kmMrJOVX6fVPRpgS08AMdm jVQIoROsUl53Dss6FjE7XdRkBN92JBoNRxiU1hPnj8EzQ568ph4Ft4PXXupef7WD1SFO P3NgNuQs4pUZg9pPlyFVKKNJlhq1WPi0YcOh22l/BGcDGh/TSxzdnuPQLXgUnL8gfPgJ HrIRo2lbYimIHkbCSCEXNhk7qlOktjaU/4l/hNag7TixiYoVlriwU8JZ1hiqCDMlmcOL 1qnQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=UZAP8ZK7; 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 5b1f17b1804b1-42c87b7c69csor4124805e9.9.2024.09.03.08.32.03 for (Google Transport Security); Tue, 03 Sep 2024 08:32:03 -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:a05:600c:470f:b0:42a:a6b8:f09f with SMTP id 5b1f17b1804b1-42bb01ed85amr162014775e9.23.1725377522551; Tue, 03 Sep 2024 08:32:02 -0700 (PDT) Received: from dario-ThinkPad-T14s-Gen-2i.amarulasolutions.com ([2.196.42.65]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-42baf1b0c18sm192963055e9.37.2024.09.03.08.32.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 03 Sep 2024 08:32:02 -0700 (PDT) From: Dario Binacchi To: linux-amarula@amarulasolutions.com Subject: [PATCH 05/10] pmdomain: imx: gpcv2: don't turn on a power domain already on Date: Tue, 3 Sep 2024 17:31:52 +0200 Message-ID: <20240903153157.918185-5-dario.binacchi@amarulasolutions.com> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240903153157.918185-1-dario.binacchi@amarulasolutions.com> References: <20240903153157.918185-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=UZAP8ZK7; 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: