diff mbox

[v4,2/6] dt-bindings: power: Add qcom rpm power domain driver bindings

Message ID 20180627045234.27403-3-rnayak@codeaurora.org (mailing list archive)
State New, archived
Delegated to: Andy Gross
Headers show

Commit Message

Rajendra Nayak June 27, 2018, 4:52 a.m. UTC
Add DT bindings to describe the rpm/rpmh power domains found on Qualcomm
Technologies, Inc. SoCs. These power domains communicate a performance
state to RPM/RPMh, which then translates it into corresponding voltage on a
PMIC rail.

Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
---
 .../devicetree/bindings/power/qcom,rpmpd.txt  | 146 ++++++++++++++++++
 include/dt-bindings/power/qcom-rpmpd.h        |  39 +++++
 2 files changed, 185 insertions(+)
 create mode 100644 Documentation/devicetree/bindings/power/qcom,rpmpd.txt
 create mode 100644 include/dt-bindings/power/qcom-rpmpd.h

Comments

Rob Herring (Arm) July 3, 2018, 10:35 p.m. UTC | #1
On Wed, Jun 27, 2018 at 10:22:30AM +0530, Rajendra Nayak wrote:
> Add DT bindings to describe the rpm/rpmh power domains found on Qualcomm
> Technologies, Inc. SoCs. These power domains communicate a performance
> state to RPM/RPMh, which then translates it into corresponding voltage on a
> PMIC rail.
> 
> Signed-off-by: Rajendra Nayak <rnayak@codeaurora.org>
> Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
> Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org>
> ---
>  .../devicetree/bindings/power/qcom,rpmpd.txt  | 146 ++++++++++++++++++
>  include/dt-bindings/power/qcom-rpmpd.h        |  39 +++++
>  2 files changed, 185 insertions(+)
>  create mode 100644 Documentation/devicetree/bindings/power/qcom,rpmpd.txt
>  create mode 100644 include/dt-bindings/power/qcom-rpmpd.h
> 
> diff --git a/Documentation/devicetree/bindings/power/qcom,rpmpd.txt b/Documentation/devicetree/bindings/power/qcom,rpmpd.txt
> new file mode 100644
> index 000000000000..8825080afa5a
> --- /dev/null
> +++ b/Documentation/devicetree/bindings/power/qcom,rpmpd.txt
> @@ -0,0 +1,146 @@
> +Qualcomm RPM/RPMh Power domains
> +
> +For RPM/RPMh Power domains, we communicate a performance state to RPM/RPMh
> +which then translates it into a corresponding voltage on a rail
> +
> +Required Properties:
> + - compatible: Should be one of the following
> +	* qcom,msm8996-rpmpd: RPM Power domain for the msm8996 family of SoC
> +	* qcom,sdm845-rpmhpd: RPMh Power domain for the sdm845 family of SoC
> + - power-domain-cells: number of cells in Power domain specifier
> +	must be 1.
> + - operating-points-v2: Phandle to the OPP table for the Power domain.
> +	Refer to Documentation/devicetree/bindings/power/power_domain.txt
> +	and Documentation/devicetree/bindings/opp/qcom-opp.txt for more details
> +
> +Refer to <dt-bindings/power/qcom-rpmpd.h> for the level values for
> +various OPPs for different platforms as well as Power domain indexes
> +
> +Example: rpmh power domain controller and OPP table
> +
> +#include <dt-bindings/power/qcom-rpmhpd.h>
> +
> +qcom,level values specified in the OPP tables for RPMh power domains
> +should use the RPMH_REGULATOR_LEVEL_* constants from
> +<dt-bindings/power/qcom-rpmhpd.h>
> +
> +	rpmhpd: power-controller {
> +		compatible = "qcom,sdm845-rpmhpd";
> +		#power-domain-cells = <1>;
> +		operating-points-v2 = <&rpmhpd_opp_table>;
> +	};
> +
> +	rpmhpd_opp_table: opp-table {
> +		compatible = "operating-points-v2-qcom-level";
> +
> +		rpmhpd_opp_ret: opp1 {
> +			qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
> +		};

I don't see the point in using the OPP binding here when you aren't 
using *any* of the properties from it.

Rob
--
To unsubscribe from this list: send the line "unsubscribe linux-arm-msm" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Viresh Kumar July 4, 2018, 5:57 a.m. UTC | #2
On 03-07-18, 16:35, Rob Herring wrote:
> > +qcom,level values specified in the OPP tables for RPMh power domains
> > +should use the RPMH_REGULATOR_LEVEL_* constants from
> > +<dt-bindings/power/qcom-rpmhpd.h>
> > +
> > +	rpmhpd: power-controller {
> > +		compatible = "qcom,sdm845-rpmhpd";
> > +		#power-domain-cells = <1>;
> > +		operating-points-v2 = <&rpmhpd_opp_table>;
> > +	};
> > +
> > +	rpmhpd_opp_table: opp-table {
> > +		compatible = "operating-points-v2-qcom-level";
> > +
> > +		rpmhpd_opp_ret: opp1 {
> > +			qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
> > +		};
> 
> I don't see the point in using the OPP binding here when you aren't 
> using *any* of the properties from it.

Yeah, that's the case for now. But there are cases (as Stephen
mentioned earlier [1]) where the voltage values (and maybe other
values like current, etc) would be known and filled in DT. And that's
why we all agreed to use OPP tables for PM domains as well, as these
are really "operating performance points" of these PM domains.
Rajendra Nayak Aug. 30, 2018, 6:31 a.m. UTC | #3
On 7/4/2018 11:27 AM, Viresh Kumar wrote:
> On 03-07-18, 16:35, Rob Herring wrote:
>>> +qcom,level values specified in the OPP tables for RPMh power domains
>>> +should use the RPMH_REGULATOR_LEVEL_* constants from
>>> +<dt-bindings/power/qcom-rpmhpd.h>
>>> +
>>> +	rpmhpd: power-controller {
>>> +		compatible = "qcom,sdm845-rpmhpd";
>>> +		#power-domain-cells = <1>;
>>> +		operating-points-v2 = <&rpmhpd_opp_table>;
>>> +	};
>>> +
>>> +	rpmhpd_opp_table: opp-table {
>>> +		compatible = "operating-points-v2-qcom-level";
>>> +
>>> +		rpmhpd_opp_ret: opp1 {
>>> +			qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
>>> +		};
>>
>> I don't see the point in using the OPP binding here when you aren't
>> using *any* of the properties from it.
> 
> Yeah, that's the case for now. But there are cases (as Stephen
> mentioned earlier [1]) where the voltage values (and maybe other
> values like current, etc) would be known and filled in DT. And that's
> why we all agreed to use OPP tables for PM domains as well, as these
> are really "operating performance points" of these PM domains.

Rob, are you fine with these bindings then?
If so, can we please have your reviewed-by?
Rob Herring (Arm) Sept. 20, 2018, 6:51 p.m. UTC | #4
On Wed, Aug 29, 2018 at 11:31 PM Rajendra Nayak <rnayak@codeaurora.org> wrote:
>
>
>
> On 7/4/2018 11:27 AM, Viresh Kumar wrote:
> > On 03-07-18, 16:35, Rob Herring wrote:
> >>> +qcom,level values specified in the OPP tables for RPMh power domains
> >>> +should use the RPMH_REGULATOR_LEVEL_* constants from
> >>> +<dt-bindings/power/qcom-rpmhpd.h>
> >>> +
> >>> +   rpmhpd: power-controller {
> >>> +           compatible = "qcom,sdm845-rpmhpd";
> >>> +           #power-domain-cells = <1>;
> >>> +           operating-points-v2 = <&rpmhpd_opp_table>;
> >>> +   };
> >>> +
> >>> +   rpmhpd_opp_table: opp-table {
> >>> +           compatible = "operating-points-v2-qcom-level";
> >>> +
> >>> +           rpmhpd_opp_ret: opp1 {
> >>> +                   qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
> >>> +           };
> >>
> >> I don't see the point in using the OPP binding here when you aren't
> >> using *any* of the properties from it.
> >
> > Yeah, that's the case for now. But there are cases (as Stephen
> > mentioned earlier [1]) where the voltage values (and maybe other
> > values like current, etc) would be known and filled in DT. And that's
> > why we all agreed to use OPP tables for PM domains as well, as these
> > are really "operating performance points" of these PM domains.
>
> Rob, are you fine with these bindings then?

Okay, my only thought is whether we should just use 'reg' here, or do
we need 'level' for anything else and should make it common?

Rob
Rajendra Nayak Sept. 25, 2018, 10:25 a.m. UTC | #5
Hi Rob,

[]...
>>>>> +   rpmhpd_opp_table: opp-table {
>>>>> +           compatible = "operating-points-v2-qcom-level";
>>>>> +
>>>>> +           rpmhpd_opp_ret: opp1 {
>>>>> +                   qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
>>>>> +           };
>>>>
>>>> I don't see the point in using the OPP binding here when you aren't
>>>> using *any* of the properties from it.
>>>
>>> Yeah, that's the case for now. But there are cases (as Stephen
>>> mentioned earlier [1]) where the voltage values (and maybe other
>>> values like current, etc) would be known and filled in DT. And that's
>>> why we all agreed to use OPP tables for PM domains as well, as these
>>> are really "operating performance points" of these PM domains.
>>
>> Rob, are you fine with these bindings then?
> 
> Okay, my only thought is whether we should just use 'reg' here, or do
> we need 'level' for anything else and should make it common?

I am not quite sure I understood what you are suggesting here :(
Rob Herring (Arm) Sept. 25, 2018, 7:43 p.m. UTC | #6
On Tue, Sep 25, 2018 at 5:25 AM Rajendra Nayak <rnayak@codeaurora.org> wrote:
>
> Hi Rob,
>
> []...
> >>>>> +   rpmhpd_opp_table: opp-table {
> >>>>> +           compatible = "operating-points-v2-qcom-level";
> >>>>> +
> >>>>> +           rpmhpd_opp_ret: opp1 {
> >>>>> +                   qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
> >>>>> +           };
> >>>>
> >>>> I don't see the point in using the OPP binding here when you aren't
> >>>> using *any* of the properties from it.
> >>>
> >>> Yeah, that's the case for now. But there are cases (as Stephen
> >>> mentioned earlier [1]) where the voltage values (and maybe other
> >>> values like current, etc) would be known and filled in DT. And that's
> >>> why we all agreed to use OPP tables for PM domains as well, as these
> >>> are really "operating performance points" of these PM domains.
> >>
> >> Rob, are you fine with these bindings then?
> >
> > Okay, my only thought is whether we should just use 'reg' here, or do
> > we need 'level' for anything else and should make it common?
>
> I am not quite sure I understood what you are suggesting here :(

You could use the  'reg' property instead of 'qcom,level'. Any reason
not to do that?

Alternatively, would 'level' be something useful in other situations
and should not be QCom specific?

Rob
Viresh Kumar Oct. 4, 2018, 8:36 a.m. UTC | #7
On 25-09-18, 14:43, Rob Herring wrote:
> On Tue, Sep 25, 2018 at 5:25 AM Rajendra Nayak <rnayak@codeaurora.org> wrote:
> >
> > Hi Rob,
> >
> > []...
> > >>>>> +   rpmhpd_opp_table: opp-table {
> > >>>>> +           compatible = "operating-points-v2-qcom-level";
> > >>>>> +
> > >>>>> +           rpmhpd_opp_ret: opp1 {
> > >>>>> +                   qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
> > >>>>> +           };
> > >>>>
> > >>>> I don't see the point in using the OPP binding here when you aren't
> > >>>> using *any* of the properties from it.
> > >>>
> > >>> Yeah, that's the case for now. But there are cases (as Stephen
> > >>> mentioned earlier [1]) where the voltage values (and maybe other
> > >>> values like current, etc) would be known and filled in DT. And that's
> > >>> why we all agreed to use OPP tables for PM domains as well, as these
> > >>> are really "operating performance points" of these PM domains.
> > >>
> > >> Rob, are you fine with these bindings then?
> > >
> > > Okay, my only thought is whether we should just use 'reg' here, or do
> > > we need 'level' for anything else and should make it common?
> >
> > I am not quite sure I understood what you are suggesting here :(
> 
> You could use the  'reg' property instead of 'qcom,level'. Any reason
> not to do that?

They can use any property which uniquely identifies the OPP nodes in
the table. Though I never thought we can use 'reg' property in such a
way. I always thought it must be related to registers somehow :)

Yeah, CPU is one of the examples where 'reg' has a special meaning.

> Alternatively, would 'level' be something useful in other situations
> and should not be QCom specific?

It is too early to say that. The only platform which needs this is
Qcom right now, lets see what the requirements from other users are.
Rob Herring (Arm) Oct. 4, 2018, 3:18 p.m. UTC | #8
On Thu, Oct 4, 2018 at 3:36 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
>
> On 25-09-18, 14:43, Rob Herring wrote:
> > On Tue, Sep 25, 2018 at 5:25 AM Rajendra Nayak <rnayak@codeaurora.org> wrote:
> > >
> > > Hi Rob,
> > >
> > > []...
> > > >>>>> +   rpmhpd_opp_table: opp-table {
> > > >>>>> +           compatible = "operating-points-v2-qcom-level";
> > > >>>>> +
> > > >>>>> +           rpmhpd_opp_ret: opp1 {
> > > >>>>> +                   qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
> > > >>>>> +           };
> > > >>>>
> > > >>>> I don't see the point in using the OPP binding here when you aren't
> > > >>>> using *any* of the properties from it.
> > > >>>
> > > >>> Yeah, that's the case for now. But there are cases (as Stephen
> > > >>> mentioned earlier [1]) where the voltage values (and maybe other
> > > >>> values like current, etc) would be known and filled in DT. And that's
> > > >>> why we all agreed to use OPP tables for PM domains as well, as these
> > > >>> are really "operating performance points" of these PM domains.
> > > >>
> > > >> Rob, are you fine with these bindings then?
> > > >
> > > > Okay, my only thought is whether we should just use 'reg' here, or do
> > > > we need 'level' for anything else and should make it common?
> > >
> > > I am not quite sure I understood what you are suggesting here :(
> >
> > You could use the  'reg' property instead of 'qcom,level'. Any reason
> > not to do that?
>
> They can use any property which uniquely identifies the OPP nodes in
> the table. Though I never thought we can use 'reg' property in such a
> way. I always thought it must be related to registers somehow :)

That's almost certainly where the name originates from back in the
90s. I view 'reg' as how you identify or address a device. This can be
channels of something like an ADC.

It's perhaps a stretch for OPP nodes as they aren't really a device,
but if the levels are part of the h/w then perhaps reg is a good
match.

Rob
Niklas Cassel Oct. 4, 2018, 7:17 p.m. UTC | #9
On Thu, Oct 04, 2018 at 10:18:22AM -0500, Rob Herring wrote:
> On Thu, Oct 4, 2018 at 3:36 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> >
> > On 25-09-18, 14:43, Rob Herring wrote:
> > > On Tue, Sep 25, 2018 at 5:25 AM Rajendra Nayak <rnayak@codeaurora.org> wrote:
> > > >
> > > > Hi Rob,
> > > >
> > > > []...
> > > > >>>>> +   rpmhpd_opp_table: opp-table {
> > > > >>>>> +           compatible = "operating-points-v2-qcom-level";
> > > > >>>>> +
> > > > >>>>> +           rpmhpd_opp_ret: opp1 {
> > > > >>>>> +                   qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
> > > > >>>>> +           };
> > > > >>>>
> > > > >>>> I don't see the point in using the OPP binding here when you aren't
> > > > >>>> using *any* of the properties from it.
> > > > >>>
> > > > >>> Yeah, that's the case for now. But there are cases (as Stephen
> > > > >>> mentioned earlier [1]) where the voltage values (and maybe other
> > > > >>> values like current, etc) would be known and filled in DT. And that's
> > > > >>> why we all agreed to use OPP tables for PM domains as well, as these
> > > > >>> are really "operating performance points" of these PM domains.
> > > > >>
> > > > >> Rob, are you fine with these bindings then?
> > > > >
> > > > > Okay, my only thought is whether we should just use 'reg' here, or do
> > > > > we need 'level' for anything else and should make it common?
> > > >
> > > > I am not quite sure I understood what you are suggesting here :(
> > >
> > > You could use the  'reg' property instead of 'qcom,level'. Any reason
> > > not to do that?
> >
> > They can use any property which uniquely identifies the OPP nodes in
> > the table. Though I never thought we can use 'reg' property in such a
> > way. I always thought it must be related to registers somehow :)
> 
> That's almost certainly where the name originates from back in the
> 90s. I view 'reg' as how you identify or address a device. This can be
> channels of something like an ADC.
> 
> It's perhaps a stretch for OPP nodes as they aren't really a device,
> but if the levels are part of the h/w then perhaps reg is a good
> match.
> 

FWIW, I actually have a use case on qcom SoCs.

I'm working on reviving an old patch series from Stephen Boyd:
https://lkml.org/lkml/2015/9/18/833


Rajendra's Documentation/devicetree/bindings/opp/qcom-opp.txt currently has:

Required properties:
- qcom,level: On Qualcomm platforms an OPP node can describe a positive value
representing a corner/level that's communicated with a remote microprocessor
(usually called the RPM) which then translates it into a certain voltage on
a voltage rail


I'm planning on extending it with something like:

Optional properties:
-qcom,fuse-level: On Qualcomm platforms, not all corners/levels are real
corners/levels, i.e., not all corners/levels have a unique eFuse associated.
Usually more than one corner/level uses the same eFuse corner/level.


So for each OPP I would have:

opp1 {
	qcom,level = <foo>;
	qcom,fuse-level = <bar>;
}


Not sure if this changes your opinion about using reg,
but I thought that it was worth mentioning.


Kind regards,
Niklas
Rob Herring (Arm) Oct. 4, 2018, 10:17 p.m. UTC | #10
On Thu, Oct 4, 2018 at 2:17 PM Niklas Cassel <niklas.cassel@linaro.org> wrote:
>
> On Thu, Oct 04, 2018 at 10:18:22AM -0500, Rob Herring wrote:
> > On Thu, Oct 4, 2018 at 3:36 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > >
> > > On 25-09-18, 14:43, Rob Herring wrote:
> > > > On Tue, Sep 25, 2018 at 5:25 AM Rajendra Nayak <rnayak@codeaurora.org> wrote:
> > > > >
> > > > > Hi Rob,
> > > > >
> > > > > []...
> > > > > >>>>> +   rpmhpd_opp_table: opp-table {
> > > > > >>>>> +           compatible = "operating-points-v2-qcom-level";
> > > > > >>>>> +
> > > > > >>>>> +           rpmhpd_opp_ret: opp1 {
> > > > > >>>>> +                   qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
> > > > > >>>>> +           };
> > > > > >>>>
> > > > > >>>> I don't see the point in using the OPP binding here when you aren't
> > > > > >>>> using *any* of the properties from it.
> > > > > >>>
> > > > > >>> Yeah, that's the case for now. But there are cases (as Stephen
> > > > > >>> mentioned earlier [1]) where the voltage values (and maybe other
> > > > > >>> values like current, etc) would be known and filled in DT. And that's
> > > > > >>> why we all agreed to use OPP tables for PM domains as well, as these
> > > > > >>> are really "operating performance points" of these PM domains.
> > > > > >>
> > > > > >> Rob, are you fine with these bindings then?
> > > > > >
> > > > > > Okay, my only thought is whether we should just use 'reg' here, or do
> > > > > > we need 'level' for anything else and should make it common?
> > > > >
> > > > > I am not quite sure I understood what you are suggesting here :(
> > > >
> > > > You could use the  'reg' property instead of 'qcom,level'. Any reason
> > > > not to do that?
> > >
> > > They can use any property which uniquely identifies the OPP nodes in
> > > the table. Though I never thought we can use 'reg' property in such a
> > > way. I always thought it must be related to registers somehow :)
> >
> > That's almost certainly where the name originates from back in the
> > 90s. I view 'reg' as how you identify or address a device. This can be
> > channels of something like an ADC.
> >
> > It's perhaps a stretch for OPP nodes as they aren't really a device,
> > but if the levels are part of the h/w then perhaps reg is a good
> > match.
> >
>
> FWIW, I actually have a use case on qcom SoCs.
>
> I'm working on reviving an old patch series from Stephen Boyd:
> https://lkml.org/lkml/2015/9/18/833
>
>
> Rajendra's Documentation/devicetree/bindings/opp/qcom-opp.txt currently has:
>
> Required properties:
> - qcom,level: On Qualcomm platforms an OPP node can describe a positive value
> representing a corner/level that's communicated with a remote microprocessor
> (usually called the RPM) which then translates it into a certain voltage on
> a voltage rail
>
>
> I'm planning on extending it with something like:
>
> Optional properties:
> -qcom,fuse-level: On Qualcomm platforms, not all corners/levels are real
> corners/levels, i.e., not all corners/levels have a unique eFuse associated.
> Usually more than one corner/level uses the same eFuse corner/level.

Is that because there's additional parameters not covered as part of a corner?

> So for each OPP I would have:
>
> opp1 {
>         qcom,level = <foo>;
>         qcom,fuse-level = <bar>;
> }
>
>
> Not sure if this changes your opinion about using reg,
> but I thought that it was worth mentioning.

'reg' is probably not the right fit then.

Does any of this fuse-level apply to platforms using this binding? If
so, then it should be incorporated here. I don't want incomplete
bindings that get one property added at a time.

Rob
Niklas Cassel Oct. 5, 2018, 8:44 p.m. UTC | #11
On Thu, Oct 04, 2018 at 05:17:42PM -0500, Rob Herring wrote:
> On Thu, Oct 4, 2018 at 2:17 PM Niklas Cassel <niklas.cassel@linaro.org> wrote:
> >
> > On Thu, Oct 04, 2018 at 10:18:22AM -0500, Rob Herring wrote:
> > > On Thu, Oct 4, 2018 at 3:36 AM Viresh Kumar <viresh.kumar@linaro.org> wrote:
> > > >
> > > > On 25-09-18, 14:43, Rob Herring wrote:
> > > > > On Tue, Sep 25, 2018 at 5:25 AM Rajendra Nayak <rnayak@codeaurora.org> wrote:
> > > > > >
> > > > > > Hi Rob,
> > > > > >
> > > > > > []...
> > > > > > >>>>> +   rpmhpd_opp_table: opp-table {
> > > > > > >>>>> +           compatible = "operating-points-v2-qcom-level";
> > > > > > >>>>> +
> > > > > > >>>>> +           rpmhpd_opp_ret: opp1 {
> > > > > > >>>>> +                   qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
> > > > > > >>>>> +           };
> > > > > > >>>>
> > > > > > >>>> I don't see the point in using the OPP binding here when you aren't
> > > > > > >>>> using *any* of the properties from it.
> > > > > > >>>
> > > > > > >>> Yeah, that's the case for now. But there are cases (as Stephen
> > > > > > >>> mentioned earlier [1]) where the voltage values (and maybe other
> > > > > > >>> values like current, etc) would be known and filled in DT. And that's
> > > > > > >>> why we all agreed to use OPP tables for PM domains as well, as these
> > > > > > >>> are really "operating performance points" of these PM domains.
> > > > > > >>
> > > > > > >> Rob, are you fine with these bindings then?
> > > > > > >
> > > > > > > Okay, my only thought is whether we should just use 'reg' here, or do
> > > > > > > we need 'level' for anything else and should make it common?
> > > > > >
> > > > > > I am not quite sure I understood what you are suggesting here :(
> > > > >
> > > > > You could use the  'reg' property instead of 'qcom,level'. Any reason
> > > > > not to do that?
> > > >
> > > > They can use any property which uniquely identifies the OPP nodes in
> > > > the table. Though I never thought we can use 'reg' property in such a
> > > > way. I always thought it must be related to registers somehow :)
> > >
> > > That's almost certainly where the name originates from back in the
> > > 90s. I view 'reg' as how you identify or address a device. This can be
> > > channels of something like an ADC.
> > >
> > > It's perhaps a stretch for OPP nodes as they aren't really a device,
> > > but if the levels are part of the h/w then perhaps reg is a good
> > > match.
> > >
> >
> > FWIW, I actually have a use case on qcom SoCs.
> >
> > I'm working on reviving an old patch series from Stephen Boyd:
> > https://lkml.org/lkml/2015/9/18/833
> >
> >
> > Rajendra's Documentation/devicetree/bindings/opp/qcom-opp.txt currently has:
> >
> > Required properties:
> > - qcom,level: On Qualcomm platforms an OPP node can describe a positive value
> > representing a corner/level that's communicated with a remote microprocessor
> > (usually called the RPM) which then translates it into a certain voltage on
> > a voltage rail
> >
> >
> > I'm planning on extending it with something like:
> >
> > Optional properties:
> > -qcom,fuse-level: On Qualcomm platforms, not all corners/levels are real
> > corners/levels, i.e., not all corners/levels have a unique eFuse associated.
> > Usually more than one corner/level uses the same eFuse corner/level.
> 
> Is that because there's additional parameters not covered as part of a corner?


Turns out that while qcom,fuse-level is a good idea for msm8916,
it will not suffice for msm8996.. Feel free to jump the the TL;DR below.


Looking at downstream, a corner is just something virtual:

https://source.codeaurora.org/quic/la/kernel/msm-3.10/tree/Documentation/devicetree/bindings/regulator/cpr-regulator.txt?h=msm-3.10#n362

In this example there are 9 virtual corners, but only 3 fuse-corners:

https://source.codeaurora.org/quic/la/kernel/msm-3.10/tree/arch/arm/boot/dts/qcom/msm8916-regulator.dtsi?h=msm-3.10#n90

qcom,cpr-corner-frequency-map = each frequency gets a virtual corner (probably
for simplicity).

qcom,cpr-corner-map = has a member for each virtual corner, defining what
fuse-corner each virtual corner really maps to.

Looking at the code:

https://source.codeaurora.org/quic/la/kernel/msm-3.10/tree/drivers/regulator/cpr-regulator.c?h=msm-3.10#n5460

These fuse-corners are really just efuses, where each fuse-corner
contains e.g. ref_uV, min_uV, max_uV.

> 
> > So for each OPP I would have:
> >
> > opp1 {
> >         qcom,level = <foo>;
> >         qcom,fuse-level = <bar>;
> > }
> >
> >
> > Not sure if this changes your opinion about using reg,
> > but I thought that it was worth mentioning.
> 
> 'reg' is probably not the right fit then.
> 
> Does any of this fuse-level apply to platforms using this binding? If
> so, then it should be incorporated here. I don't want incomplete
> bindings that get one property added at a time.

This binding is new, but Rajendra uses it for RPM in msm8996 and sdm845.

RPM does not need the fuse-corner property. (Not sure why it doesn't.)

Looking at the downstream CPR DT bindings for msm8996, they still have
a fuse-corner for each corner. However, the DT binding has changed
compared to msm8916. They now have:

https://source.codeaurora.org/quic/la/kernel/msm-4.4/tree/arch/arm/boot/dts/qcom/msm8996-regulator.dtsi?h=msm-4.4#n646

qcom,cpr-corner-fmax-map = array for each fuse-corner, defining the
maximum virtual corner that this fuse-corner maps to.

Each speed bin has a different number of supported OPPs.

In upstream we use opp-supported-hw, together with the speedbin efuse,
to determine what subset of OPPs the hardware supports.

The problem with msm8996, compared to msm8916, is that each speed bin
has its own qcom,cpr-corner-fmax-map.

So for msm8996, it will not be enough to simply have a single
qcom,fuse-level property for each OPP.
We could add a qcom,fuse-level property for each speedbin, for each OPP.

Like this:

opp1 {
     qcom,level = <foo>;
     qcom-fuse-level-speed0 = <bar>;
     qcom-fuse-level-speed1 = <bax>;
     qcom-fuse-level-speed2 = <baz>;
}



TL;DR:

Perhaps I should just try to add something like
qcom,cpr-corner-fmax-map, where there is an array per speedbin,
to Documentation/devicetree/bindings/opp/qcom-opp.txt
Like "compatible", it could be a property in the opp-table node.

Something like:

qcom,speed-bins = <3>;
qcom,fuse-level-to-max-level-map =
					/* Speed bin 0 */
					<1 2 7 12 16>,

					/* Speed bin 1 */
					<1 2 7 12 13>,

					/* Speed bin 2 */
					<1 2 7 12 16>;

Since this would work for both msm8916 and msm8996.
And this way you could still change qcom,level to use
reg if you want.


Kind regards,
Niklas
diff mbox

Patch

diff --git a/Documentation/devicetree/bindings/power/qcom,rpmpd.txt b/Documentation/devicetree/bindings/power/qcom,rpmpd.txt
new file mode 100644
index 000000000000..8825080afa5a
--- /dev/null
+++ b/Documentation/devicetree/bindings/power/qcom,rpmpd.txt
@@ -0,0 +1,146 @@ 
+Qualcomm RPM/RPMh Power domains
+
+For RPM/RPMh Power domains, we communicate a performance state to RPM/RPMh
+which then translates it into a corresponding voltage on a rail
+
+Required Properties:
+ - compatible: Should be one of the following
+	* qcom,msm8996-rpmpd: RPM Power domain for the msm8996 family of SoC
+	* qcom,sdm845-rpmhpd: RPMh Power domain for the sdm845 family of SoC
+ - power-domain-cells: number of cells in Power domain specifier
+	must be 1.
+ - operating-points-v2: Phandle to the OPP table for the Power domain.
+	Refer to Documentation/devicetree/bindings/power/power_domain.txt
+	and Documentation/devicetree/bindings/opp/qcom-opp.txt for more details
+
+Refer to <dt-bindings/power/qcom-rpmpd.h> for the level values for
+various OPPs for different platforms as well as Power domain indexes
+
+Example: rpmh power domain controller and OPP table
+
+#include <dt-bindings/power/qcom-rpmhpd.h>
+
+qcom,level values specified in the OPP tables for RPMh power domains
+should use the RPMH_REGULATOR_LEVEL_* constants from
+<dt-bindings/power/qcom-rpmhpd.h>
+
+	rpmhpd: power-controller {
+		compatible = "qcom,sdm845-rpmhpd";
+		#power-domain-cells = <1>;
+		operating-points-v2 = <&rpmhpd_opp_table>;
+	};
+
+	rpmhpd_opp_table: opp-table {
+		compatible = "operating-points-v2-qcom-level";
+
+		rpmhpd_opp_ret: opp1 {
+			qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>;
+		};
+
+		rpmhpd_opp_min_svs: opp2 {
+			qcom,level = <RPMH_REGULATOR_LEVEL_MIN_SVS>;
+		};
+
+		rpmhpd_opp_low_svs: opp3 {
+			qcom,level = <RPMH_REGULATOR_LEVEL_LOW_SVS>;
+		};
+
+		rpmhpd_opp_svs: opp4 {
+			qcom,level = <RPMH_REGULATOR_LEVEL_SVS>;
+		};
+
+		rpmhpd_opp_svs_l1: opp5 {
+			qcom,level = <RPMH_REGULATOR_LEVEL_SVS_L1>;
+		};
+
+		rpmhpd_opp_nom: opp6 {
+			qcom,level = <RPMH_REGULATOR_LEVEL_NOM>;
+		};
+
+		rpmhpd_opp_nom_l1: opp7 {
+			qcom,level = <RPMH_REGULATOR_LEVEL_NOM_L1>;
+		};
+
+		rpmhpd_opp_nom_l2: opp8 {
+			qcom,level = <RPMH_REGULATOR_LEVEL_NOM_L2>;
+		};
+
+		rpmhpd_opp_turbo: opp9 {
+			qcom,level = <RPMH_REGULATOR_LEVEL_TURBO>;
+		};
+
+		rpmhpd_opp_turbo_l1: opp10 {
+			qcom,level = <RPMH_REGULATOR_LEVEL_TURBO_L1>;
+		};
+	};
+
+Example: rpm power domain controller and OPP table
+
+	rpmpd: power-controller {
+		compatible = "qcom,msm8996-rpmpd";
+		#power-domain-cells = <1>;
+		operating-points-v2 = <&rpmpd_opp_table>;
+	};
+
+	rpmpd_opp_table: opp-table {
+		compatible = "operating-points-v2-qcom-level";
+
+		rpmpd_opp_low: opp1 {
+			qcom,level = <1>;
+		};
+
+		rpmpd_opp_ret: opp2 {
+			qcom,level = <2>;
+		};
+
+		rpmpd_opp_svs: opp3 {
+			qcom,level = <3>;
+		};
+
+		rpmpd_opp_normal: opp4 {
+			qcom,level = <4>;
+		};
+
+		rpmpd_opp_high: opp5 {
+			qcom,level = <5>;
+		};
+
+		rpmpd_opp_turbo: opp6 {
+			qcom,level = <6>;
+		};
+	};
+
+Example: Client/Consumer device using OPP table
+
+	leaky-device0@12350000 {
+		compatible = "foo,i-leak-current";
+		reg = <0x12350000 0x1000>;
+		power-domains = <&rpmhpd SDM845_MX>;
+		operating-points-v2 = <&leaky_opp_table>;
+	};
+
+
+	leaky_opp_table: opp-table {
+		compatible = "operating-points-v2";
+
+		opp1 {
+			opp-hz = /bits/ 64 <144000>;
+			required-opps = <&rpmhpd_opp_low>;
+		};
+
+		opp2 {
+			opp-hz = /bits/ 64 <400000>;
+			required-opps = <&rpmhpd_opp_ret>;
+		};
+
+		opp3 {
+			opp-hz = /bits/ 64 <20000000>;
+			required-opps = <&rpmpd_opp_svs>;
+		};
+
+		opp4 {
+			opp-hz = /bits/ 64 <25000000>;
+			required-opps = <&rpmpd_opp_normal>;
+		};
+
+	};
diff --git a/include/dt-bindings/power/qcom-rpmpd.h b/include/dt-bindings/power/qcom-rpmpd.h
new file mode 100644
index 000000000000..87d9c6611682
--- /dev/null
+++ b/include/dt-bindings/power/qcom-rpmpd.h
@@ -0,0 +1,39 @@ 
+/* SPDX-License-Identifier: GPL-2.0 */
+/* Copyright (c) 2018, The Linux Foundation. All rights reserved. */
+
+#ifndef _DT_BINDINGS_POWER_QCOM_RPMPD_H
+#define _DT_BINDINGS_POWER_QCOM_RPMPD_H
+
+/* SDM845 Power Domain Indexes */
+#define SDM845_EBI	0
+#define SDM845_MX	1
+#define SDM845_MX_AO	2
+#define SDM845_CX	3
+#define SDM845_CX_AO	4
+#define SDM845_LMX	5
+#define SDM845_LCX	6
+#define SDM845_GFX	7
+#define SDM845_MSS	8
+
+/* SDM845 Power Domain performance levels */
+#define RPMH_REGULATOR_LEVEL_RETENTION	16
+#define RPMH_REGULATOR_LEVEL_MIN_SVS	48
+#define RPMH_REGULATOR_LEVEL_LOW_SVS	64
+#define RPMH_REGULATOR_LEVEL_SVS	128
+#define RPMH_REGULATOR_LEVEL_SVS_L1	192
+#define RPMH_REGULATOR_LEVEL_NOM	256
+#define RPMH_REGULATOR_LEVEL_NOM_L1	320
+#define RPMH_REGULATOR_LEVEL_NOM_L2	336
+#define RPMH_REGULATOR_LEVEL_TURBO	384
+#define RPMH_REGULATOR_LEVEL_TURBO_L1	416
+
+/* MSM8996 Power Domain Indexes */
+#define MSM8996_VDDCX		0
+#define MSM8996_VDDCX_AO	1
+#define MSM8996_VDDCX_VFC	2
+#define MSM8996_VDDMX		3
+#define MSM8996_VDDMX_AO	4
+#define MSM8996_VDDSSCX		5
+#define MSM8996_VDDSSCX_VFC	6
+
+#endif