From nobody Wed Nov 27 00:38:31 2024 Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com [209.85.221.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D26F41F76C8 for ; Tue, 15 Oct 2024 16:48:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729010885; cv=none; b=HfDgY91eGMNoR566rbCy9/wYRCDoomqnxBupTZp9SP6DACmJsMQpU5JVP7ol25zMx9snN2ud5DvrY11mUlSx/u00qr/y0a6O7plUOBIRjWw42un/GIJmeHSkfkMw9WnS7tktpC/ZptudOMDC3+4LHyjWZBigl4CeJ7m24pBU9lo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729010885; c=relaxed/simple; bh=LERwhS4RVKBGhttEmAJP9WRlWvBzyJk53VHGxQRRYkI=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=KAqZNH8NfYybtN0q/bYXwFg2PFwZAwh73cMqLrHh1HRibj4A6xmqqXmQCG21QiUMxM1Tt6zXVcbd1bY48zJPP1Atn8+r3A3PEJrwAuA4Yu7O7cMnojPqFJ1UHMEIJcr1CW7pAvpHXn7hoZoGJ3chUiqSHFaLNPM7yZqg5rK+U1g= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev; spf=pass smtp.mailfrom=tuxon.dev; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b=lL5PztFz; arc=none smtp.client-ip=209.85.221.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=none (p=none dis=none) header.from=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=tuxon.dev Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=tuxon.dev header.i=@tuxon.dev header.b="lL5PztFz" Received: by mail-wr1-f42.google.com with SMTP id ffacd0b85a97d-37d41894a32so18722f8f.1 for ; Tue, 15 Oct 2024 09:48:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tuxon.dev; s=google; t=1729010880; x=1729615680; darn=vger.kernel.org; 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=7pKXusPTZ5tcxxkq2V3AB08xzlPZhMDjS7/H8WgERgg=; b=lL5PztFz4D8EHVoAv5hJ+NRkYoJLwIl+QIl+G4+5Q6q7zwnOSPqCz16bCLRI5hL34t 8NwDj6Ws6BV97AlrLMOWESxySb+F3LzXIXG6GtKrgQKBi1y6W7kMhVOsRwqusehNFPYt uD+LxlnT/p6KJZz8oIANxWWRfFJ7mOE7biesvxbhNclfSARd99Pis4J8N26HZs4aUgrI rt5f0P7pWLY2J3wmJyNpYcKeeqqL2jQvsRrCDUvWtbZ+DdxKDza5ii0skz7BAkeBpt+p 4de+Oy+dQAGoX3wXQX1ZUU0nlc2knlKIBLe8e8OBRcsnGEae0lyMt5dEgOJEdZO6mBv7 gqHA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729010880; x=1729615680; 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=7pKXusPTZ5tcxxkq2V3AB08xzlPZhMDjS7/H8WgERgg=; b=P0HJgyBfIfynf91FH5hN0hmJDeza6XR7w5/BHCm1dK+bc3p9Aypei5MDGKo9OOatzV OUzImbvheWc9NxO0u6/+5hU+He08uM6Zzx6k+hrBWgi+41UTCL+HQT6H+a15jyrn19Vh xnpcMLUAJBSOlJQ6UklhGouVi6zKTkDBk0lOQTGWfRJT0U7nXSDcJklsj6nzJ0GgGG6s UxXmjmg6TMJPMSHGiz+7dsx56XFbRvoJ4Jq8x2WmFRLAR7cGnHQR4xbdLNKD9/5kfj0p cWlvp/M+RkVQqBQkjbBAyx1NLeMVxFd3BEByZVpmofmygfJA0IrDHUut75FKbH8/ghX+ 6L+w== X-Forwarded-Encrypted: i=1; AJvYcCWpuqyMon9GyCEE3XKfs2wf/HrHw1SzInaP09AfILavuYuj2+GW1RV7I7PEccOJyerw+WsCuRU966htI44=@vger.kernel.org X-Gm-Message-State: AOJu0YwXi3t02l989+Lgi8DCT7MPa7znUoMNyfeHvrhNMAOFbRiL2oAt AVRdCHnS2Hau8vJh0qZsrVDpIKo0dVd66vsSN2wk24xtYawgH88Xqoil+31wsuk= X-Google-Smtp-Source: AGHT+IHHc60GgREOlS98Zspu++ht5CfNcHtWXghPlVy/gA432Hwxq+nY4kDwZWwzU4bPGzheaVwXoQ== X-Received: by 2002:a05:6000:194b:b0:37d:460d:2d07 with SMTP id ffacd0b85a97d-37d86285f8cmr1094955f8f.10.1729010879983; Tue, 15 Oct 2024 09:47:59 -0700 (PDT) Received: from claudiu-X670E-Pro-RS.. ([82.78.167.23]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4313f56eab2sm22882045e9.26.2024.10.15.09.47.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 15 Oct 2024 09:47:59 -0700 (PDT) From: Claudiu X-Google-Original-From: Claudiu To: geert+renesas@glider.be, mturquette@baylibre.com, sboyd@kernel.org, wim@linux-watchdog.org, linux@roeck-us.net, ulf.hansson@linaro.org Cc: linux-renesas-soc@vger.kernel.org, linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org, linux-watchdog@vger.kernel.org, linux-pm@vger.kernel.org, claudiu.beznea@tuxon.dev, Claudiu Beznea Subject: [PATCH v4 1/4] clk: renesas: rzg2l-cpg: Move PM domain power on in rzg2l_cpg_pd_setup() Date: Tue, 15 Oct 2024 19:47:29 +0300 Message-Id: <20241015164732.4085249-2-claudiu.beznea.uj@bp.renesas.com> X-Mailer: git-send-email 2.39.2 In-Reply-To: <20241015164732.4085249-1-claudiu.beznea.uj@bp.renesas.com> References: <20241015164732.4085249-1-claudiu.beznea.uj@bp.renesas.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Claudiu Beznea Move the PM domain power on in rzg2l_cpg_pd_setup(). With this the previously always-on power domains got struct generic_pm_domain::{power_on, power_off} populated (and registered with simple_qos_governor if #power-domain-cells =3D <1> and with pm_domain_always_on_gov if #power-domain-cells =3D <0>). The values for struct generic_pm_domain::{power_on, power_off} are now populated for all registered domains but used by core only for the domains that can use them (the PM domain should be non always-on and registered with simple_qos_governor). Moreover, the power on/off functions check if the mstop support is valid. The mstop is populated only by the RZ/G3S initialization code at the moment. This approach was chosen to keep the code simple and use the same code across different implementations. There should be no issues with this approach as the always on domains are registered with GENPD_FLAG_ALWAYS_ON and the PM domain core takes care of it. This approach allows doing further cleanups on the rzg2l_cpg power domain registering code that will be handled by the next commit. Reviewed-by: Geert Uytterhoeven Signed-off-by: Claudiu Beznea --- Changes in v4: - call rzg2l_cpg_power_on() unconditionally - drop the governor parameter of rzg2l_cpg_pd_setup() and decide the governor based on always_on flag - collected tags Changes in v3: - none; this patch is new drivers/clk/renesas/rzg2l-cpg.c | 41 ++++++++++++++++++--------------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/drivers/clk/renesas/rzg2l-cpg.c b/drivers/clk/renesas/rzg2l-cp= g.c index 88bf39e8c79c..63ad467196f3 100644 --- a/drivers/clk/renesas/rzg2l-cpg.c +++ b/drivers/clk/renesas/rzg2l-cpg.c @@ -1680,23 +1680,31 @@ static int rzg2l_cpg_power_off(struct generic_pm_do= main *domain) return 0; } =20 -static int __init rzg2l_cpg_pd_setup(struct rzg2l_cpg_pd *pd, bool always_= on) +static int __init rzg2l_cpg_pd_setup(struct rzg2l_cpg_pd *pd) { + bool always_on =3D !!(pd->genpd.flags & GENPD_FLAG_ALWAYS_ON); struct dev_power_governor *governor; + int ret; + + if (always_on) + governor =3D &pm_domain_always_on_gov; + else + governor =3D &simple_qos_governor; =20 pd->genpd.flags |=3D GENPD_FLAG_PM_CLK | GENPD_FLAG_ACTIVE_WAKEUP; pd->genpd.attach_dev =3D rzg2l_cpg_attach_dev; pd->genpd.detach_dev =3D rzg2l_cpg_detach_dev; - if (always_on) { - pd->genpd.flags |=3D GENPD_FLAG_ALWAYS_ON; - governor =3D &pm_domain_always_on_gov; - } else { - pd->genpd.power_on =3D rzg2l_cpg_power_on; - pd->genpd.power_off =3D rzg2l_cpg_power_off; - governor =3D &simple_qos_governor; - } + pd->genpd.power_on =3D rzg2l_cpg_power_on; + pd->genpd.power_off =3D rzg2l_cpg_power_off; + + ret =3D pm_genpd_init(&pd->genpd, governor, !always_on); + if (ret) + return ret; =20 - return pm_genpd_init(&pd->genpd, governor, !always_on); + if (always_on) + ret =3D rzg2l_cpg_power_on(&pd->genpd); + + return ret; } =20 static int __init rzg2l_cpg_add_clk_domain(struct rzg2l_cpg_priv *priv) @@ -1711,8 +1719,9 @@ static int __init rzg2l_cpg_add_clk_domain(struct rzg= 2l_cpg_priv *priv) return -ENOMEM; =20 pd->genpd.name =3D np->name; + pd->genpd.flags =3D GENPD_FLAG_ALWAYS_ON; pd->priv =3D priv; - ret =3D rzg2l_cpg_pd_setup(pd, true); + ret =3D rzg2l_cpg_pd_setup(pd); if (ret) return ret; =20 @@ -1785,20 +1794,16 @@ static int __init rzg2l_cpg_add_pm_domains(struct r= zg2l_cpg_priv *priv) return -ENOMEM; =20 pd->genpd.name =3D info->pm_domains[i].name; + if (always_on) + pd->genpd.flags =3D GENPD_FLAG_ALWAYS_ON; pd->conf =3D info->pm_domains[i].conf; pd->id =3D info->pm_domains[i].id; pd->priv =3D priv; =20 - ret =3D rzg2l_cpg_pd_setup(pd, always_on); + ret =3D rzg2l_cpg_pd_setup(pd); if (ret) return ret; =20 - if (always_on) { - ret =3D rzg2l_cpg_power_on(&pd->genpd); - if (ret) - return ret; - } - domains->domains[i] =3D &pd->genpd; /* Parent should be on the very first entry of info->pm_domains[]. */ if (!i) { --=20 2.39.2