[PATCH v2 2/3] pmdomain: ti_sci: add wakeup constraint management

Ulf Hansson ulf.hansson at linaro.org
Thu Sep 5 04:31:41 PDT 2024


On Tue, 20 Aug 2024 at 02:00, Kevin Hilman <khilman at baylibre.com> wrote:
>
> 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 <vibhore at ti.com>
> Signed-off-by: Vibhore Vardhan <vibhore at ti.com>
> Signed-off-by: Kevin Hilman <khilman at baylibre.com>
> Signed-off-by: Dhruva Gole <d-gole at ti.com>
> ---
>  drivers/pmdomain/ti/ti_sci_pm_domains.c | 19 +++++++++++++++++++
>  1 file changed, 19 insertions(+)
>
> diff --git a/drivers/pmdomain/ti/ti_sci_pm_domains.c b/drivers/pmdomain/ti/ti_sci_pm_domains.c
> index 963272fa387b..8af907579152 100644
> --- a/drivers/pmdomain/ti/ti_sci_pm_domains.c
> +++ b/drivers/pmdomain/ti/ti_sci_pm_domains.c
> @@ -76,6 +76,23 @@ static int ti_sci_pd_set_lat_constraint(struct device *dev, s32 val)
>         return ret;
>  }
>
> +static inline bool ti_sci_pd_set_wkup_constraint(struct device *dev)
> +{

Similar comment as for patch1, should this be a static void intstead?

> +       struct generic_pm_domain *genpd = pd_to_genpd(dev->pm_domain);
> +       struct ti_sci_pm_domain *pd = genpd_to_ti_sci_pd(genpd);
> +       const struct ti_sci_handle *ti_sci = pd->parent->ti_sci;
> +       int ret;
> +
> +       if (device_may_wakeup(dev)) {
> +               ret = ti_sci->ops.pm_ops.set_device_constraint(ti_sci, pd->idx,
> +                                                              TISCI_MSG_CONSTRAINT_SET);
> +               if (!ret)
> +                       dev_dbg(dev, "ti_sci_pd: ID:%d set device constraint.\n", pd->idx);
> +       }
> +
> +       return true;
> +}
> +
>  /*
>   * ti_sci_pd_power_off(): genpd power down hook
>   * @domain: pointer to the powerdomain to power off
> @@ -117,6 +134,8 @@ static int ti_sci_pd_suspend(struct device *dev)
>         if (ti_sci_pd_is_valid_constraint(val))
>                 ti_sci_pd_set_lat_constraint(dev, val);
>
> +       ti_sci_pd_set_wkup_constraint(dev);
> +
>         return 0;
>  }
>
>
> --
> 2.46.0
>

Kind regards
Uffe



More information about the linux-arm-kernel mailing list