From: Viresh Kumar <viresh.kumar@linaro.org>
To: Rajendra Nayak <rnayak@codeaurora.org>
Cc: andy.gross@linaro.org, robh@kernel.org, sboyd@kernel.org,
ulf.hansson@linaro.org, collinsd@codeaurora.org,
mka@chromium.org, devicetree@vger.kernel.org,
linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org,
henryc.chen@mediatek.com
Subject: Re: [PATCH v9 08/10] OPP: Add a dev_pm_opp_of_get_level() helper
Date: Tue, 8 Jan 2019 10:24:02 +0530 [thread overview]
Message-ID: <20190108045402.2jglb5y3bk76dems@vireshk-i7> (raw)
In-Reply-To: <20190107100959.14528-9-rnayak@codeaurora.org>
On 07-01-19, 15:39, Rajendra Nayak wrote:
> Now that we have atleast 2 genpd providers, both using a simple
This kind of reasoning for this patch isn't required anymore. Make
this patch the second one in the series, i.e. just after the bindings.
> routine to read a performance state (opp-level) value from device
> tree, in order to implement the .opp_to_performance_state
> callback, add a dev_pm_opp_of_get_level() helper to do
> it, so it can be resued across all such genpd providers which
> just need to read the value from DT.
>
> Suggested-by: Stephen Boyd <sboyd@kernel.org>
> Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
> ---
> drivers/opp/of.c | 23 +++++++++++++++++++++++
> include/linux/pm_opp.h | 5 +++++
> 2 files changed, 28 insertions(+)
>
> diff --git a/drivers/opp/of.c b/drivers/opp/of.c
> index 06f0f632ec47..6fb383fee601 100644
> --- a/drivers/opp/of.c
> +++ b/drivers/opp/of.c
> @@ -1029,6 +1029,29 @@ int of_get_required_opp_performance_state(struct device_node *np, int index)
> }
> EXPORT_SYMBOL_GPL(of_get_required_opp_performance_state);
>
> +/**
> + * dev_pm_opp_of_get_level() - Reads the opp-level value from Device Tree
> + * @opp: opp for which 'opp-level' should be read and returned
> + *
> + * Returns the opp-level value read from Device Tree, if present, else 0
> + *
> + * Return: Zero or positive opp-level value read from Device tree
> + */
> +unsigned int dev_pm_opp_of_get_level(struct dev_pm_opp *opp)
> +{
> + struct device_node *np;
> + unsigned int perf_state = 0;
> +
> + np = dev_pm_opp_get_of_node(opp);
> + if (of_property_read_u32(np, "opp-level", &perf_state))
> + pr_err("%s: missing 'opp-level' property\n", __func__);
Instead of this, add a field "level" in the opp structure in
drivers/opp/opp.h and fill it while parsing the OPPs. And here you can
just read the values then.
--
viresh
next prev parent reply other threads:[~2019-01-08 4:54 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-01-07 10:09 [PATCH v9 00/10] Add power domain driver for corners on msm8996/sdm845 Rajendra Nayak
2019-01-07 10:09 ` [PATCH v9 01/10] dt-bindings: opp: Introduce opp-level bindings Rajendra Nayak
2019-01-08 4:49 ` Viresh Kumar
2019-01-07 10:09 ` [PATCH v9 02/10] dt-bindings: power: Add qcom rpm power domain driver bindings Rajendra Nayak
2019-01-07 10:09 ` [PATCH v9 03/10] soc: qcom: rpmpd: Add a Power domain driver to model corners Rajendra Nayak
2019-01-07 10:09 ` [PATCH v9 04/10] soc: qcom: rpmpd: Add support for get/set performance state Rajendra Nayak
2019-01-07 10:09 ` [PATCH v9 05/10] arm64: dts: msm8996: Add rpmpd device node Rajendra Nayak
2019-01-07 10:09 ` [PATCH v9 06/10] soc: qcom: rpmhpd: Add RPMh power domain driver Rajendra Nayak
2019-01-07 10:09 ` [PATCH v9 07/10] arm64: dts: sdm845: Add rpmh powercontroller node Rajendra Nayak
2019-01-07 10:09 ` [PATCH v9 08/10] OPP: Add a dev_pm_opp_of_get_level() helper Rajendra Nayak
2019-01-08 4:54 ` Viresh Kumar [this message]
2019-01-07 10:09 ` [PATCH v9 09/10] soc: qcom: rpmpd: Use " Rajendra Nayak
2019-01-07 10:09 ` [PATCH v9 10/10] soc: qcom: rpmhpd: Mark mx as a parent for cx Rajendra Nayak
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=20190108045402.2jglb5y3bk76dems@vireshk-i7 \
--to=viresh.kumar@linaro.org \
--cc=andy.gross@linaro.org \
--cc=collinsd@codeaurora.org \
--cc=devicetree@vger.kernel.org \
--cc=henryc.chen@mediatek.com \
--cc=linux-arm-msm@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mka@chromium.org \
--cc=rnayak@codeaurora.org \
--cc=robh@kernel.org \
--cc=sboyd@kernel.org \
--cc=ulf.hansson@linaro.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).