From: Ulf Hansson <ulf.hansson@linaro.org>
To: Abel Vesa <abel.vesa@linaro.org>
Cc: "Rafael J. Wysocki" <rafael@kernel.org>,
Kevin Hilman <khilman@kernel.org>, Pavel Machek <pavel@ucw.cz>,
Len Brown <len.brown@intel.com>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
Bjorn Andersson <andersson@kernel.org>,
Andy Gross <agross@kernel.org>,
Konrad Dybcio <konrad.dybcio@linaro.org>,
Mike Turquette <mturquette@baylibre.com>,
Stephen Boyd <sboyd@kernel.org>,
Saravana Kannan <saravanak@google.com>,
linux-pm@vger.kernel.org,
Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
linux-arm-msm@vger.kernel.org, linux-clk@vger.kernel.org,
Doug Anderson <dianders@chromium.org>,
Matthias Kaehlcke <mka@chromium.org>
Subject: Re: [RFC PATCH v2 1/5] PM: domains: Allow power off queuing from providers
Date: Tue, 21 Mar 2023 14:01:49 +0100 [thread overview]
Message-ID: <CAPDyKFqZ8sYVpo-HxnsRRKoWD+g0psVrpufEw1NtBdFe+LTTwA@mail.gmail.com> (raw)
In-Reply-To: <20230320134217.1685781-2-abel.vesa@linaro.org>
On Mon, 20 Mar 2023 at 14:42, Abel Vesa <abel.vesa@linaro.org> wrote:
>
> In some cases, the providers might choose to refuse powering off some
> domains until all of the consumer have had a chance to probe, that is,
/s/consumer/consumers
> until sync state callback has been called. Such providers might choose
> to disable such domains on their on, from the sync state callback. So,
/s/their on/their own
> in order to do that, they need a way to queue up a power off request.
> Since the generic genpd already has such API, make that available to
> those providers.
>
> Signed-off-by: Abel Vesa <abel.vesa@linaro.org>
> ---
> drivers/base/power/domain.c | 3 ++-
> include/linux/pm_domain.h | 6 ++++++
> 2 files changed, 8 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index 32084e38b73d..97d4e2f2da91 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -649,10 +649,11 @@ static int _genpd_power_off(struct generic_pm_domain *genpd, bool timed)
> * Queue up the execution of genpd_power_off() unless it's already been done
> * before.
> */
> -static void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
Please add a function description - and make sure to state that its
external use is explicitly intended for being called from genpd
providers ->sync_state callbacks.
> +void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
As this becomes an exported function, we should also conform to
genpd's function naming rules, which is to use the "pm_genpd_*"
prefix.
While renaming it, perhaps it's sufficient with
"pm_genpd_queue_power_off" or maybe even better "pm_genpd_sync_state",
what do you think?
> {
> queue_work(pm_wq, &genpd->power_off_work);
> }
> +EXPORT_SYMBOL_GPL(genpd_queue_power_off_work);
>
> /**
> * genpd_power_off - Remove power from a given PM domain.
> diff --git a/include/linux/pm_domain.h b/include/linux/pm_domain.h
> index f776fb93eaa0..f9729640f87e 100644
> --- a/include/linux/pm_domain.h
> +++ b/include/linux/pm_domain.h
> @@ -231,6 +231,7 @@ int pm_genpd_remove_subdomain(struct generic_pm_domain *genpd,
> int pm_genpd_init(struct generic_pm_domain *genpd,
> struct dev_power_governor *gov, bool is_off);
> int pm_genpd_remove(struct generic_pm_domain *genpd);
> +void genpd_queue_power_off_work(struct generic_pm_domain *genpd);
> int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state);
> int dev_pm_genpd_add_notifier(struct device *dev, struct notifier_block *nb);
> int dev_pm_genpd_remove_notifier(struct device *dev);
> @@ -278,6 +279,11 @@ static inline int pm_genpd_remove(struct generic_pm_domain *genpd)
> return -EOPNOTSUPP;
> }
>
> +void genpd_queue_power_off_work(struct generic_pm_domain *genpd)
> +{
> + return -EOPNOTSUPP;
> +}
> +
> static inline int dev_pm_genpd_set_performance_state(struct device *dev,
> unsigned int state)
> {
> --
> 2.34.1
>
Other than the minor things above, the approach looks reasonable to me!
Kind regards
Uffe
next prev parent reply other threads:[~2023-03-21 13:02 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-03-20 13:42 [RFC PATCH v2 0/5] Allow genpd providers to power off domains on sync state Abel Vesa
2023-03-20 13:42 ` [RFC PATCH v2 1/5] PM: domains: Allow power off queuing from providers Abel Vesa
2023-03-21 13:01 ` Ulf Hansson [this message]
2023-03-20 13:42 ` [RFC PATCH v2 2/5] soc: qcom: rpmhpd: Do proper power off when state synced Abel Vesa
2023-03-20 13:42 ` [RFC PATCH v2 3/5] clk: qcom: gdsc: Avoid actual power off until sync state Abel Vesa
2023-03-20 13:42 ` [RFC PATCH v2 4/5] clk: qcom: Add sync state callback to all SC8280XP providers Abel Vesa
2023-03-20 13:42 ` [RFC PATCH v2 5/5] clk: qcom: Add sync state callback to all SM8450 providers Abel Vesa
2023-03-21 13:07 ` [RFC PATCH v2 0/5] Allow genpd providers to power off domains on sync state Ulf Hansson
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=CAPDyKFqZ8sYVpo-HxnsRRKoWD+g0psVrpufEw1NtBdFe+LTTwA@mail.gmail.com \
--to=ulf.hansson@linaro.org \
--cc=abel.vesa@linaro.org \
--cc=agross@kernel.org \
--cc=andersson@kernel.org \
--cc=dianders@chromium.org \
--cc=gregkh@linuxfoundation.org \
--cc=khilman@kernel.org \
--cc=konrad.dybcio@linaro.org \
--cc=len.brown@intel.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-pm@vger.kernel.org \
--cc=mka@chromium.org \
--cc=mturquette@baylibre.com \
--cc=pavel@ucw.cz \
--cc=rafael@kernel.org \
--cc=saravanak@google.com \
--cc=sboyd@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).