All of lore.kernel.org
 help / color / mirror / Atom feed
From: Ulf Hansson <ulf.hansson@linaro.org>
To: Viresh Kumar <viresh.kumar@linaro.org>
Cc: Kevin Hilman <khilman@kernel.org>,
	Viresh Kumar <vireshk@kernel.org>, Nishanth Menon <nm@ti.com>,
	Stephen Boyd <sboyd@codeaurora.org>,
	"Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Linux PM <linux-pm@vger.kernel.org>,
	Vincent Guittot <vincent.guittot@linaro.org>,
	Rob Herring <robh+dt@kernel.org>,
	Rajendra Nayak <rnayak@codeaurora.org>,
	Sudeep Holla <sudeep.holla@arm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/7] PM / OPP: Implement dev_pm_opp_of_add_table_indexed()
Date: Thu, 22 Mar 2018 10:28:57 +0100	[thread overview]
Message-ID: <CAPDyKFr3hz8MqQoOCYzcfMPN7z-yg58L_evytSb4w32oq9fmCw@mail.gmail.com> (raw)
In-Reply-To: <627a1c8658a1c0cd4b96ae087c87bb3dfa1ee70a.1513926033.git.viresh.kumar@linaro.org>

On 22 December 2017 at 08:26, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> The "operating-points-v2" property can contain a list of phandles now,
> specifically for the power domain providers that provide multiple
> domains.
>
> Add support to parse that.
>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>

Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>

Kind regards
Uffe

> ---
>  drivers/opp/of.c       | 50 +++++++++++++++++++++++++++++++++++++++++---------
>  include/linux/pm_opp.h |  6 ++++++
>  2 files changed, 47 insertions(+), 9 deletions(-)
>
> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> index cb716aa2f44b..22c9bd191f62 100644
> --- a/drivers/opp/of.c
> +++ b/drivers/opp/of.c
> @@ -250,20 +250,17 @@ EXPORT_SYMBOL_GPL(dev_pm_opp_of_remove_table);
>
>  /* Returns opp descriptor node for a device node, caller must
>   * do of_node_put() */
> -static struct device_node *_opp_of_get_opp_desc_node(struct device_node *np)
> +static struct device_node *_opp_of_get_opp_desc_node(struct device_node *np,
> +                                                    int index)
>  {
> -       /*
> -        * There should be only ONE phandle present in "operating-points-v2"
> -        * property.
> -        */
> -
> -       return of_parse_phandle(np, "operating-points-v2", 0);
> +       /* "operating-points-v2" can be an array for power domain providers */
> +       return of_parse_phandle(np, "operating-points-v2", index);
>  }
>
>  /* Returns opp descriptor node for a device, caller must do of_node_put() */
>  struct device_node *dev_pm_opp_of_get_opp_desc_node(struct device *dev)
>  {
> -       return _opp_of_get_opp_desc_node(dev->of_node);
> +       return _opp_of_get_opp_desc_node(dev->of_node, 0);
>  }
>  EXPORT_SYMBOL_GPL(dev_pm_opp_of_get_opp_desc_node);
>
> @@ -509,6 +506,41 @@ int dev_pm_opp_of_add_table(struct device *dev)
>  }
>  EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table);
>
> +/**
> + * dev_pm_opp_of_add_table_indexed() - Initialize indexed opp table from device tree
> + * @dev:       device pointer used to lookup OPP table.
> + * @index:     Index number.
> + *
> + * Register the initial OPP table with the OPP library for given device only
> + * using the "operating-points-v2" property.
> + *
> + * Return:
> + * 0           On success OR
> + *             Duplicate OPPs (both freq and volt are same) and opp->available
> + * -EEXIST     Freq are same and volt are different OR
> + *             Duplicate OPPs (both freq and volt are same) and !opp->available
> + * -ENOMEM     Memory allocation failure
> + * -ENODEV     when 'operating-points' property is not found or is invalid data
> + *             in device node.
> + * -ENODATA    when empty 'operating-points' property is found
> + * -EINVAL     when invalid entries are found in opp-v2 table
> + */
> +int dev_pm_opp_of_add_table_indexed(struct device *dev, int index)
> +{
> +       struct device_node *opp_np;
> +       int ret;
> +
> +       opp_np = _opp_of_get_opp_desc_node(dev->of_node, index);
> +       if (!opp_np)
> +               return -ENODEV;
> +
> +       ret = _of_add_opp_table_v2(dev, opp_np);
> +       of_node_put(opp_np);
> +
> +       return ret;
> +}
> +EXPORT_SYMBOL_GPL(dev_pm_opp_of_add_table_indexed);
> +
>  /* CPU device specific helpers */
>
>  /**
> @@ -613,7 +645,7 @@ int dev_pm_opp_of_get_sharing_cpus(struct device *cpu_dev,
>                 }
>
>                 /* Get OPP descriptor node */
> -               tmp_np = _opp_of_get_opp_desc_node(cpu_np);
> +               tmp_np = _opp_of_get_opp_desc_node(cpu_np, 0);
>                 of_node_put(cpu_np);
>                 if (!tmp_np) {
>                         pr_err("%pOF: Couldn't find opp node\n", cpu_np);
> diff --git a/include/linux/pm_opp.h b/include/linux/pm_opp.h
> index 6c2d2e88f066..f042fdeaaa3c 100644
> --- a/include/linux/pm_opp.h
> +++ b/include/linux/pm_opp.h
> @@ -303,6 +303,7 @@ static inline void dev_pm_opp_cpumask_remove_table(const struct cpumask *cpumask
>
>  #if defined(CONFIG_PM_OPP) && defined(CONFIG_OF)
>  int dev_pm_opp_of_add_table(struct device *dev);
> +int dev_pm_opp_of_add_table_indexed(struct device *dev, int index);
>  void dev_pm_opp_of_remove_table(struct device *dev);
>  int dev_pm_opp_of_cpumask_add_table(const struct cpumask *cpumask);
>  void dev_pm_opp_of_cpumask_remove_table(const struct cpumask *cpumask);
> @@ -314,6 +315,11 @@ static inline int dev_pm_opp_of_add_table(struct device *dev)
>         return -ENOTSUPP;
>  }
>
> +static inline int dev_pm_opp_of_add_table_indexed(struct device *dev, int index)
> +{
> +       return -ENOTSUPP;
> +}
> +
>  static inline void dev_pm_opp_of_remove_table(struct device *dev)
>  {
>  }
> --
> 2.15.0.194.g9af6a3dea062
>

  reply	other threads:[~2018-03-22  9:29 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-12-22  7:26 [PATCH 0/7] PM /Domain/OPP: Add support to get performance state from DT Viresh Kumar
2017-12-22  7:26 ` [PATCH 1/7] PM / OPP: Implement dev_pm_opp_of_add_table_indexed() Viresh Kumar
2018-03-22  9:28   ` Ulf Hansson [this message]
2017-12-22  7:26 ` [PATCH 2/7] PM / OPP: Implement of_dev_pm_opp_find_required_opp() Viresh Kumar
2018-03-22  9:29   ` Ulf Hansson
2017-12-22  7:26 ` [PATCH 3/7] PM / Domain: Add struct device to genpd Viresh Kumar
2018-03-22  9:30   ` Ulf Hansson
2018-03-22  9:59     ` Viresh Kumar
2018-03-22 10:18       ` Ulf Hansson
2018-04-09  7:53         ` Viresh Kumar
2018-04-09 10:46           ` Ulf Hansson
2017-12-22  7:26 ` [PATCH 4/7] PM / Domain: Add support to parse domain's OPP table Viresh Kumar
2018-03-22  9:31   ` Ulf Hansson
2018-03-22 10:00     ` Viresh Kumar
2018-03-22 10:09       ` Ulf Hansson
2017-12-22  7:26 ` [PATCH 5/7] PM / Domain: Implement of_dev_pm_genpd_get_performance_state() Viresh Kumar
2018-03-22  9:32   ` Ulf Hansson
2017-12-22  7:26 ` [PATCH 6/7] PM / OPP: Get performance state using genpd helper Viresh Kumar
2018-03-22  9:32   ` Ulf Hansson
2017-12-22  7:26 ` [PATCH 7/7] PM / OPP: Remove dev_pm_opp_{un}register_get_pstate_helper() Viresh Kumar
2018-03-22  9:32   ` Ulf Hansson
2018-01-18  6:34 ` [PATCH 0/7] PM /Domain/OPP: Add support to get performance state from DT Viresh Kumar
2018-01-18 19:24   ` Rafael J. Wysocki
2018-01-19  5:42     ` Viresh Kumar

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=CAPDyKFr3hz8MqQoOCYzcfMPN7z-yg58L_evytSb4w32oq9fmCw@mail.gmail.com \
    --to=ulf.hansson@linaro.org \
    --cc=khilman@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pm@vger.kernel.org \
    --cc=nm@ti.com \
    --cc=rjw@rjwysocki.net \
    --cc=rnayak@codeaurora.org \
    --cc=robh+dt@kernel.org \
    --cc=sboyd@codeaurora.org \
    --cc=sudeep.holla@arm.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.