Skip to content

Commit 8efc9b1

Browse files
author
Ulf Hansson
committed
soc/tegra: pmc: Opt-out from genpd's common ->sync_state() support
Tegra implements its own specific ->sync_state() callback for the genpd providers. Let's set the GENPD_FLAG_NO_SYNC_STATE to inform genpd about it. Moreover, let's call of_genpd_sync_state() to make sure genpd tries to power off unused PM domains. Cc: Thierry Reding <thierry.reding@gmail.com> Cc: Jonathan Hunter <jonathanh@nvidia.com> Tested-by: Hiago De Franco <hiago.franco@toradex.com> # Colibri iMX8X Tested-by: Tomi Valkeinen <tomi.valkeinen@ideasonboard.com> # TI AM62A,Xilinx ZynqMP ZCU106 Signed-off-by: Ulf Hansson <ulf.hansson@linaro.org> Link: https://lore.kernel.org/r/20250701114733.636510-10-ulf.hansson@linaro.org
1 parent c8c1962 commit 8efc9b1

1 file changed

Lines changed: 19 additions & 7 deletions

File tree

drivers/soc/tegra/pmc.c

Lines changed: 19 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -418,7 +418,6 @@ struct tegra_pmc_soc {
418418
* @irq: chip implementation for the IRQ domain
419419
* @clk_nb: pclk clock changes handler
420420
* @core_domain_state_synced: flag marking the core domain's state as synced
421-
* @core_domain_registered: flag marking the core domain as registered
422421
* @wake_type_level_map: Bitmap indicating level type for non-dual edge wakes
423422
* @wake_type_dual_edge_map: Bitmap indicating if a wake is dual-edge or not
424423
* @wake_sw_status_map: Bitmap to hold raw status of wakes without mask
@@ -462,7 +461,6 @@ struct tegra_pmc {
462461
struct notifier_block clk_nb;
463462

464463
bool core_domain_state_synced;
465-
bool core_domain_registered;
466464

467465
unsigned long *wake_type_level_map;
468466
unsigned long *wake_type_dual_edge_map;
@@ -1297,6 +1295,7 @@ static int tegra_powergate_add(struct tegra_pmc *pmc, struct device_node *np)
12971295

12981296
pg->id = id;
12991297
pg->genpd.name = np->name;
1298+
pg->genpd.flags = GENPD_FLAG_NO_SYNC_STATE;
13001299
pg->genpd.power_off = tegra_genpd_power_off;
13011300
pg->genpd.power_on = tegra_genpd_power_on;
13021301
pg->pmc = pmc;
@@ -1406,6 +1405,7 @@ static int tegra_pmc_core_pd_add(struct tegra_pmc *pmc, struct device_node *np)
14061405
return -ENOMEM;
14071406

14081407
genpd->name = "core";
1408+
genpd->flags = GENPD_FLAG_NO_SYNC_STATE;
14091409
genpd->set_performance_state = tegra_pmc_core_pd_set_performance_state;
14101410

14111411
err = devm_pm_opp_set_regulators(pmc->dev, rname);
@@ -1425,8 +1425,6 @@ static int tegra_pmc_core_pd_add(struct tegra_pmc *pmc, struct device_node *np)
14251425
goto remove_genpd;
14261426
}
14271427

1428-
pmc->core_domain_registered = true;
1429-
14301428
return 0;
14311429

14321430
remove_genpd:
@@ -4263,8 +4261,25 @@ static const struct of_device_id tegra_pmc_match[] = {
42634261

42644262
static void tegra_pmc_sync_state(struct device *dev)
42654263
{
4264+
struct device_node *np, *child;
42664265
int err;
42674266

4267+
np = of_get_child_by_name(dev->of_node, "powergates");
4268+
if (!np)
4269+
return;
4270+
4271+
for_each_child_of_node(np, child)
4272+
of_genpd_sync_state(child);
4273+
4274+
of_node_put(np);
4275+
4276+
np = of_get_child_by_name(dev->of_node, "core-domain");
4277+
if (!np)
4278+
return;
4279+
4280+
of_genpd_sync_state(np);
4281+
of_node_put(np);
4282+
42684283
/*
42694284
* Newer device-trees have power domains, but we need to prepare all
42704285
* device drivers with runtime PM and OPP support first, otherwise
@@ -4278,9 +4293,6 @@ static void tegra_pmc_sync_state(struct device *dev)
42784293
* no dependencies that will block the state syncing. We shouldn't
42794294
* mark the domain as synced in this case.
42804295
*/
4281-
if (!pmc->core_domain_registered)
4282-
return;
4283-
42844296
pmc->core_domain_state_synced = true;
42854297

42864298
/* this is a no-op if core regulator isn't used */

0 commit comments

Comments
 (0)