Skip to content

Commit 9d8aa0d

Browse files
khilmanstorulf
authored andcommitted
pmdomain: ti_sci: add wakeup constraint management
During system-wide suspend, check all devices connected to PM domain to see if they are wakeup-enabled. If so, set a TI SCI device constraint. Note: DM firmware clears all constraints on resume. Co-developed-by: Vibhore Vardhan <[email protected]> Signed-off-by: Vibhore Vardhan <[email protected]> Reviewed-by: Ulf Hansson <[email protected]> Tested-by: Dhruva Gole <[email protected]> Signed-off-by: Kevin Hilman <[email protected]> Reviewed-by: Dhruva Gole <[email protected]> Message-ID: <20241206-lpm-v6-10-constraints-pmdomain-v6-2-833980158c68@baylibre.com> Signed-off-by: Ulf Hansson <[email protected]>
1 parent b5fc945 commit 9d8aa0d

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

drivers/pmdomain/ti/ti_sci_pm_domains.c

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -79,6 +79,21 @@ static void ti_sci_pd_set_lat_constraint(struct device *dev, s32 val)
7979
}
8080
#endif
8181

82+
static inline void ti_sci_pd_set_wkup_constraint(struct device *dev)
83+
{
84+
struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain);
85+
struct ti_sci_pm_domain *pd = genpd_to_ti_sci_pd(genpd);
86+
const struct ti_sci_handle *ti_sci = pd->parent->ti_sci;
87+
int ret;
88+
89+
if (device_may_wakeup(dev)) {
90+
ret = ti_sci->ops.pm_ops.set_device_constraint(ti_sci, pd->idx,
91+
TISCI_MSG_CONSTRAINT_SET);
92+
if (!ret)
93+
dev_dbg(dev, "ti_sci_pd: ID:%d set device constraint.\n", pd->idx);
94+
}
95+
}
96+
8297
/*
8398
* ti_sci_pd_power_off(): genpd power down hook
8499
* @domain: pointer to the powerdomain to power off
@@ -121,6 +136,8 @@ static int ti_sci_pd_suspend(struct device *dev)
121136
if (ti_sci_pd_is_valid_constraint(val))
122137
ti_sci_pd_set_lat_constraint(dev, val);
123138

139+
ti_sci_pd_set_wkup_constraint(dev);
140+
124141
return 0;
125142
}
126143
#else

0 commit comments

Comments
 (0)