linux-pm.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Rafael Wysocki <rjw@rjwysocki.net>,
	Kevin Hilman <khilman@kernel.org>, Pavel Machek <pavel@ucw.cz>,
	Len Brown <len.brown@intel.com>,
	Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	Stephen Boyd <sboyd@kernel.org>,
	Linux PM <linux-pm@vger.kernel.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Rajendra Nayak <rnayak@codeaurora.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 06/10] OPP: Add dev_pm_opp_{set|put}_required_device() helper
Date: Mon, 10 Sep 2018 16:18:53 +0200	[thread overview]
Message-ID: <CAPDyKFrM2x9NwSS0JTjoyu-SdtckQdbZHjWeqmH8NF3_Q2tw-w@mail.gmail.com> (raw)
In-Reply-To: <282ac8092650c95595c84213dc87a4bf6b278da8.1530252803.git.viresh.kumar@linaro.org>

On 29 June 2018 at 08:19, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> Multiple generic power domains for a device are supported with the help
> of virtual devices, which are created for each device-genpd pair. These

What "device-genpd" pair are you referring to?

> are the device structures which are attached to the power domain and are
> required by the OPP core to set the performance state of the genpd.
>
> The helpers added by this commit are required to be called once for each
> genpd of a device. These are required only if multiple domains are
> present for a device, otherwise the actual device structure will be used
> instead by the OPP core.
>
> This commit also updates the genpd core to automatically call the new
> helper to set the required devices with the OPP layer, whenever the
> virtual devices are created for multiple genpd. The prototype of
> __genpd_dev_pm_attach() is slightly updated for this.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> ---
>  drivers/base/power/domain.c | 31 ++++++++++++++---
>  drivers/opp/core.c          | 69 +++++++++++++++++++++++++++++++++++++
>  drivers/opp/of.c            | 12 +++++++
>  drivers/opp/opp.h           |  2 ++
>  include/linux/pm_opp.h      |  8 +++++
>  5 files changed, 118 insertions(+), 4 deletions(-)
>
> diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c
> index c298de8a8308..e9c85c96580c 100644
> --- a/drivers/base/power/domain.c
> +++ b/drivers/base/power/domain.c
> @@ -2219,8 +2219,14 @@ static void genpd_dev_pm_detach(struct device *dev, bool power_off)
>         genpd_queue_power_off_work(pd);
>
>         /* Unregister the device if it was created by genpd. */
> -       if (dev->bus == &genpd_bus_type)
> +       if (dev->bus == &genpd_bus_type) {
> +               struct opp_table *opp_table = dev_get_drvdata(dev);

This feels wrong, to me. Genpd is not a driver, but rather a
subsystem, hence I think it's a bad idea to "abuse" the driver data
pointer like this.

Instead, in genpd we store device specific data, through the
dev->power.subsys_data.

Seems like a better option is to extend the subsys_data, to also
include data needed to be shared for opp/performance states.

In that way, we might not even need to call into the opp library
(dev_pm_opp_set_required_device()) API, but rather the opp library can
itself check what is in the subsys_data for the device that is being
targeted. Would that work?

[...]

Kind regards
Uffe

  reply	other threads:[~2018-09-10 14:18 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-06-29  6:19 [PATCH 00/10] OPP: Support multiple power-domains per device Viresh Kumar
2018-06-29  6:19 ` [PATCH 01/10] OPP: Parse OPP table's DT properties from _of_init_opp_table() Viresh Kumar
2018-06-29  6:19 ` [PATCH 02/10] OPP: Identify and mark genpd OPP tables Viresh Kumar
2018-06-29  6:19 ` [PATCH 03/10] OPP: Separate out custom OPP handler specific code Viresh Kumar
2018-06-29  6:19 ` [PATCH 04/10] OPP: Populate required opp tables from "required-opps" property Viresh Kumar
2018-06-29  6:19 ` [PATCH 05/10] OPP: Populate OPPs " Viresh Kumar
2018-06-29  6:19 ` [PATCH 06/10] OPP: Add dev_pm_opp_{set|put}_required_device() helper Viresh Kumar
2018-09-10 14:18   ` Ulf Hansson [this message]
2018-06-29  6:19 ` [PATCH 07/10] PM / Domains: Add genpd_opp_to_performance_state() Viresh Kumar
2018-06-29  6:19 ` [PATCH 08/10] OPP: Configure all required OPPs Viresh Kumar
2018-06-29  6:19 ` [PATCH 09/10] OPP: Rename and relocate of_genpd_opp_to_performance_state() Viresh Kumar
2018-06-29  6:19 ` [PATCH 10/10] OPP: Remove of_dev_pm_opp_find_required_opp() Viresh Kumar
2018-06-29  9:06 ` [PATCH 00/10] OPP: Support multiple power-domains per device Rafael J. Wysocki
2018-06-29  9:48   ` Viresh Kumar
2018-07-16  4:32 ` Viresh Kumar
2018-07-16  9:04   ` 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=CAPDyKFrM2x9NwSS0JTjoyu-SdtckQdbZHjWeqmH8NF3_Q2tw-w@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=khilman@kernel.org \
    --cc=len.brown@intel.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=pavel@ucw.cz \
    --cc=rjw@rjwysocki.net \
    --cc=rnayak@codeaurora.org \
    --cc=sboyd@kernel.org \
    --cc=vincent.guittot@linaro.org \
    --cc=viresh.kumar@linaro.org \
    --cc=vireshk@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).