For a domain belongs to no devices anymore, let's choose the deepest state
to enter to save power.
Reviewed-by: Frank Li <frank.li@nxp.com>
Reviewed-by: Ranjani Vaidyanathan <Ranjani.Vaidyanathan@nxp.com>
Signed-off-by: Dong Aisheng <aisheng.dong@nxp.com>
if (atomic_read(&genpd->sd_count) > 0)
return -EBUSY;
+ if (!genpd->device_count)
+ /* Choose the deepest state if no devices using this domain */
+ genpd->state_idx = genpd->state_count - 1;
+
/*
* If sd_count > 0 at this point, one of the subdomains hasn't
* managed to call genpd_poweron() for the master yet after