Add power domain driver for corners on msm8996/sdm845
Subsystems (4)
v4 cover Add power domain driver for corners on msm8996/sdm845
Changes in v4:
* Included the patch to add qcom-opp bindings (dropped accidentally in v3)
* merged the patches to add bindings for rpm and rpmh, added consumer binding example
* Made the drivers built in, removed .remove
* Added better description in changelog for PATCH 6/6
* Updated rpmhpd_aggregate_corner() based on Davids feedback
* rpmhpd_set_performance_state() returns max corner, in cases where its called with an INT_MAX
* Dropped the patch to max vote on all corners at init, the patch did not work anyway, and it shouldn't be needed now
Changes in v3:
* Bindings split into seperate patches
* Bindings updated to remove duplicate OPP table phandles
* DT headers defining macros for Power domain indexes and OPP levels
* Optimisations to use rpmh_write_async() whereever applicable
* Fixed up handling of ACTIVE_ONLY/WAKE_ONLY/SLEEP voting for RPMh
* Fixed the vlvl to hlvl conversions in set_performance
* Other minor fixes based on review of v2
* TODO: This series does not handle the case where all VDD_MX votes should be higher than VDD_CX from APPs, as pointed out
by David Collins in v2. This needs support at genpd to propogate performance state up the parents, if we model these as Parent/Child to handle the interdependency.
Changes in v2:
* added a power domain driver for sdm845 which supports communicating to RPMh
* dropped the changes to sdhc driver to move over to using OPP
as there is active discussion on using OPP as the interface vs handling all of it in clock drivers
* Other minor binding updates based on review of v1
With performance state support for genpd/OPP merged, this is an effort to model a power domain driver to communicate corner/level values for qualcomm platforms to RPM (Remote Power Manager) and RPMh.
Rajendra Nayak (6):
dt-bindings: opp: Introduce qcom-opp bindings
dt-bindings: power: Add qcom rpm power domain driver bindings
soc: qcom: rpmpd: Add a Power domain driver to model corners
soc: qcom: rpmpd: Add support for get/set performance state
arm64: dts: msm8996: Add rpmpd device node
soc: qcom: rpmhpd: Add RPMh Power domain driver
.../devicetree/bindings/opp/qcom-opp.txt | 25 ++ .../devicetree/bindings/power/qcom,rpmpd.txt | 146 +++++++ arch/arm64/boot/dts/qcom/msm8996.dtsi | 34 ++ drivers/soc/qcom/Kconfig | 18 + drivers/soc/qcom/Makefile | 2 + drivers/soc/qcom/rpmhpd.c | 406 ++++++++++++++++++ drivers/soc/qcom/rpmpd.c | 340 +++++++++++++++ include/dt-bindings/power/qcom-rpmpd.h | 39 ++ 8 files changed, 1010 insertions(+) create mode 100644 Documentation/devicetree/bindings/opp/qcom-opp.txt create mode 100644 Documentation/devicetree/bindings/power/qcom,rpmpd.txt create mode 100644 drivers/soc/qcom/rpmhpd.c create mode 100644 drivers/soc/qcom/rpmpd.c create mode 100644 include/dt-bindings/power/qcom-rpmpd.h
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 1/6 dt-bindings: opp: Introduce qcom-opp bindings
On Qualcomm Technologies, Inc. platforms, an OPP node needs to describe an additional level/corner value that is then communicated to a remote microprocessor by the CPU, which then takes some actions (like adjusting voltage values across various rails) based on the value passed.
Describe these bindings in the qcom-opp bindings document.
--- .../devicetree/bindings/opp/qcom-opp.txt | 25 +++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 Documentation/devicetree/bindings/opp/qcom-opp.txt
Documentation/devicetree/bindings/opp/qcom-opp.txt new file +25 -0
@@ -0,0 +1,25 @@ +Qualcomm OPP bindings to descibe OPP nodes with corner/level values + +OPP tables for devices on Qualcomm platforms require an additional +platform specific corner/level value to be specified. +This value is passed on to the RPM (Resource Power Manager) by +the CPU, which then takes the necessary actions to set a voltage +rail to an appropriate voltage based on the value passed. + +The bindings are based on top of the operating-points-v2 bindings +described in Documentation/devicetree/bindings/opp/opp.txt +Additional properties are described below. + +* OPP Table Node + +Required properties: +- compatible: Allow OPPs to express their compatibility. It should be: + "operating-points-v2-qcom-level" + +* OPP Node + +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.
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 2/6 dt-bindings: power: Add qcom rpm power domain driver bindings
In reply to Rajendra NayakAdd 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.
--- .../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
Documentation/devicetree/bindings/power/qcom,rpmpd.txt new file +146 -0
@@ -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>; + }; + + };
include/dt-bindings/power/qcom-rpmpd.h new file +39 -0
@@ -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
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Rob Herring
maintainerRe: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Quoted 49 lines · Rajendra Nayak
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 <[email protected]>Signed-off-by Viresh Kumar <[email protected]>Reviewed-by Ulf Hansson <[email protected]>--- .../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.hDocumentation/devicetree/bindings/power/qcom,rpmpd.txt new file +28
-0@@ -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";
Documentation/devicetree/bindings/power/qcom,rpmpd.txt line 38
Quoted 10 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt new file +10
-0+ #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
Re: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Quoted 11 lines · Rob Herring
Quoted 11 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt new file +11
-0+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 {
Quoted 8 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt line 38
Quoted 5 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt new file +5
-0+ 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.
Signature · 3 lines
viresh [1] lkml.kernel.org/r/[email protected]
Re: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Quoted 21 lines · Viresh Kumar
Quoted 11 lines · Rob Herring
Quoted 11 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt new file +11
-0+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 {Quoted 8 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt line 38
Quoted 5 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt new file +5
-0+ 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.
Quoted 5 lines
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
maintainerRe: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Quoted 25 lines · Rajendra Nayak
Quoted 21 lines · Viresh Kumar
Quoted 19 lines · Rob Herring
Quoted 6 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt new file +6
-0+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";Documentation/devicetree/bindings/power/qcom,rpmpd.txt line 38
Quoted 10 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt new file +10
-0+ #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.
Quoted 7 lines
Quoted 5 lines
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
Re: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Hi Rob,
[]...
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 9 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt line 38
Quoted 6 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt new file +6
-0+ 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.
Quoted 4 lines
Quoted 1 line
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
maintainerRe: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Quoted 20 lines · Rajendra Nayak
Hi Rob,
[]...
Quoted 16 lines
Quoted 16 lines
Quoted 15 lines
Quoted 9 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt line 38
Quoted 6 lines
Documentation/devicetree/bindings/power/qcom,rpmpd.txt new file +6
-0+ 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.
Quoted 6 lines
Quoted 4 lines
Quoted 1 line
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
Re: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Quoted 23 lines · Rob Herring
Quoted 22 lines · Rajendra Nayak
Hi Rob,
[]...
Quoted 18 lines
Quoted 17 lines
Quoted 7 lines
Quoted 7 lines
Quoted 6 lines
(quoted diff) +6
-0+ rpmhpd_opp_table: opp-table { + compatible = "operating-points-v2-qcom-level"; + + rpmhpd_opp_ret: opp1 { + qcom,level = <RPMH_REGULATOR_LEVEL_RETENTION>; + };Quoted 8 lines
Quoted 2 lines
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?
Quoted 7 lines
Quoted 4 lines
Quoted 2 lines
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.
Quoted 2 lines
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.
Signature · 1 line
viresh
Rob Herring
maintainerRe: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Quoted 28 lines · Viresh Kumar
Quoted 26 lines · Rob Herring
Quoted 25 lines · Rajendra Nayak
Hi Rob,
[]...
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ 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.
Quoted 7 lines
Quoted 5 lines
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?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
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
Re: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Quoted 38 lines · Rob Herring
Quoted 28 lines · Viresh Kumar
Quoted 26 lines · Rob Herring
Quoted 25 lines · Rajendra Nayak
Hi Rob,
[]...
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ 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.
Quoted 7 lines
Quoted 5 lines
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?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
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 :)
Quoted 8 lines
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
maintainerRe: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Quoted 64 lines · Niklas Cassel
Quoted 38 lines · Rob Herring
Quoted 28 lines · Viresh Kumar
Quoted 26 lines · Rob Herring
Quoted 25 lines · Rajendra Nayak
Hi Rob,
[]...
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ 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.
Quoted 7 lines
Quoted 5 lines
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?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
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 :)
Quoted 8 lines
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/833Rajendra's
Documentation/devicetree/bindings/opp/qcom-opp.txtcurrently 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
Quoted 6 lines
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?
Quoted 10 lines
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
Re: [PATCH v4 2/6] dt-bindings: power: Add qcom rpm power domain driver bindings
Quoted 65 lines · Rob Herring
Quoted 64 lines · Niklas Cassel
Quoted 38 lines · Rob Herring
Quoted 28 lines · Viresh Kumar
Quoted 26 lines · Rob Herring
Quoted 25 lines · Rajendra Nayak
Hi Rob,
[]...
Quoted 20 lines
Quoted 10 lines
Quoted 10 lines
Quoted 9 lines
Review
Quoted 6 lines
(quoted diff) +6
-0+ 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.
Quoted 7 lines
Quoted 5 lines
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?
Quoted 8 lines
Quoted 4 lines
Quoted 1 line
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 :)
Quoted 8 lines
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/833Rajendra's
Documentation/devicetree/bindings/opp/qcom-opp.txtcurrently 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
Quoted 8 lines
Quoted 6 lines
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:
In this example there are 9 virtual corners, but only 3 fuse-corners:
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:
These fuse-corners are really just efuses, where each fuse-corner contains e.g. ref_uV, min_uV, max_uV.
Quoted 9 lines
Quoted 9 lines
So for each OPP I would have:
opp1 { qcom,level = <foo>; qcom,fuse-level = <bar>; }
Quoted 8 lines
Quoted 2 lines
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:
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
RFC PATCH 1/1 dt-bindings: opp: Extend qcom-opp bindings with properties needed for CPR
In reply to Rajendra NayakExtend qcom-opp bindings with properties needed for Core Power Reduction (CPR).
CPR is included in a great variety of Qualcomm SoC, e.g. msm8916 and msm8996, and was first introduced in msm8974.
---
Hello Rob, Rajendra,
Sorry for not replying sooner.
Since Rob wanted the binding to be complete before merging, this is my proposal to extend the OPP binding with properties needed to support CPR (both for msm8916 and msm8996). I've discussed the proposal with Viresh, and this proposal seems better than what I previously suggested here:
https://lore.kernel.org/lkml/[email protected]/
.../devicetree/bindings/opp/qcom-opp.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
Documentation/devicetree/bindings/opp/qcom-opp.txt +19 -0
@@ -23,3 +23,22 @@ Required properties: 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. + +Optional properties: +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. Even + though a power domain doesn't need a opp-hz, there can be devices in the + power domain that need to know the highest supported frequency for each + corner/level (e.g. CPR), in order to properly initialize the hardware. + +- qcom,fuse-level: A positive value representing the fuse corner/level + associated with this OPP node. Sometimes several corners/levels shares + a certain fuse corner/level. A fuse corner/level contains e.g. ref uV, + min uV, and max uV. + +- qcom,fuse-level-<name>: Named qcom,fuse-level property. This is exactly + similar to the above qcom,fuse-level property, but allows multiple + fuse corners/levels to be provided for the same OPP. At runtime, the + platform can pick a <name> and matching qcom,fuse-level-<name> property + will be enabled for all OPPs. If the platform doesn't pick a specific + <name> or the <name> doesn't match with any qcom,fuse-level-<name> + properties, then qcom,fuse-level property shall be used, if present.
Signature · 1 line
2.17.2
Re: [RFC PATCH] dt-bindings: opp: Extend qcom-opp bindings with properties needed for CPR
Quoted 38 lines · Niklas Cassel
Extend qcom-opp bindings with properties needed for Core Power Reduction (CPR).
CPR is included in a great variety of Qualcomm SoC, e.g. msm8916 and msm8996, and was first introduced in msm8974.
Signed-off-by Niklas Cassel <[email protected]>---
Hello Rob, Rajendra,Sorry for not replying sooner.
Since Rob wanted the binding to be complete before merging, this is my proposal to extend the OPP binding with properties needed to support CPR (both for msm8916 and msm8996). I've discussed the proposal with Viresh, and this proposal seems better than what I previously suggested here:
https://lore.kernel.org/lkml/[email protected]/.../devicetree/bindings/opp/qcom-opp.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)Documentation/devicetree/bindings/opp/qcom-opp.txt +9
-0@@ -23,3 +23,22 @@ Required properties: 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. + +Optional properties: +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. Even + though a power domain doesn't need a opp-hz, there can be devices in the + power domain that need to know the highest supported frequency for each + corner/level (e.g. CPR), in order to properly initialize the hardware. + +- qcom,fuse-level: A positive value representing the fuse corner/level + associated with this OPP node. Sometimes several corners/levels shares
Documentation/devicetree/bindings/opp/qcom-opp.txt Required properties: · line 44
Quoted 10 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt +10
-0+ a certain fuse corner/level. A fuse corner/level contains e.g. ref uV, + min uV, and max uV. + +- qcom,fuse-level-<name>: Named qcom,fuse-level property. This is exactly + similar to the above qcom,fuse-level property, but allows multiple + fuse corners/levels to be provided for the same OPP. At runtime, the + platform can pick a <name> and matching qcom,fuse-level-<name> property + will be enabled for all OPPs. If the platform doesn't pick a specific + <name> or the <name> doesn't match with any qcom,fuse-level-<name> + properties, then qcom,fuse-level property shall be used, if present.
LGTM.
Signature · 1 line
viresh
Rob Herring
maintainerRe: [RFC PATCH] dt-bindings: opp: Extend qcom-opp bindings with properties needed for CPR
In reply to Niklas CasselQuoted 26 lines · Niklas Cassel
Extend qcom-opp bindings with properties needed for Core Power Reduction (CPR).
CPR is included in a great variety of Qualcomm SoC, e.g. msm8916 and msm8996, and was first introduced in msm8974.
Signed-off-by Niklas Cassel <[email protected]>---
Hello Rob, Rajendra,Sorry for not replying sooner.
Since Rob wanted the binding to be complete before merging, this is my proposal to extend the OPP binding with properties needed to support CPR (both for msm8916 and msm8996). I've discussed the proposal with Viresh, and this proposal seems better than what I previously suggested here:
https://lore.kernel.org/lkml/[email protected]/.../devicetree/bindings/opp/qcom-opp.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)Documentation/devicetree/bindings/opp/qcom-opp.txt +0
-0
Documentation/devicetree/bindings/opp/qcom-opp.txt Required properties: · line 25
Quoted 3 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt +0
-0@@ -23,3 +23,22 @@ Required properties: 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've lost the context here. Please send this all together.
Quoted 9 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt +9
-0+ +Optional properties: +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. Even + though a power domain doesn't need a opp-hz, there can be devices in the + power domain that need to know the highest supported frequency for each + corner/level (e.g. CPR), in order to properly initialize the hardware. + +- qcom,fuse-level: A positive value representing the fuse corner/level + associated with this OPP node. Sometimes several corners/levels shares
Documentation/devicetree/bindings/opp/qcom-opp.txt Required properties: · line 44
Quoted 10 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt +10
-0+ a certain fuse corner/level. A fuse corner/level contains e.g. ref uV, + min uV, and max uV. + +- qcom,fuse-level-<name>: Named qcom,fuse-level property. This is exactly + similar to the above qcom,fuse-level property, but allows multiple + fuse corners/levels to be provided for the same OPP. At runtime, the + platform can pick a <name> and matching qcom,fuse-level-<name> property + will be enabled for all OPPs. If the platform doesn't pick a specific + <name> or the <name> doesn't match with any qcom,fuse-level-<name> + properties, then qcom,fuse-level property shall be used, if present.
We've generally moved away from having variable property names (gpio and regulators are the big exceptions) as they are harder to parse.
I'm not clear why you'd need this. Just make qcom,fuse-level an array and search each 'qcom,fuse-level' for the matching level number.
Rob
Re: [RFC PATCH] dt-bindings: opp: Extend qcom-opp bindings with properties needed for CPR
Quoted 22 lines · Rob Herring
Quoted 21 lines · Niklas Cassel
Extend qcom-opp bindings with properties needed for Core Power Reduction (CPR).
CPR is included in a great variety of Qualcomm SoC, e.g. msm8916 and msm8996, and was first introduced in msm8974.
Signed-off-by Niklas Cassel <[email protected]>---
Hello Rob, Rajendra,Sorry for not replying sooner.
Since Rob wanted the binding to be complete before merging, this is my proposal to extend the OPP binding with properties needed to support CPR (both for msm8916 and msm8996). I've discussed the proposal with Viresh, and this proposal seems better than what I previously suggested here:
https://lore.kernel.org/lkml/[email protected]/.../devicetree/bindings/opp/qcom-opp.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)
Quoted 10 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt Required properties: · line 25
Quoted 8 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt +0
-0@@ -23,3 +23,22 @@ Required properties: 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've lost the context here. Please send this all together.
Will do, as soon as I've gotten your feedback on this mail.
Quoted 24 lines
Quoted 10 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt +9
-0+ +Optional properties: +- opp-hz: Frequency in Hz, expressed as a 64-bit big-endian integer. Even + though a power domain doesn't need a opp-hz, there can be devices in the + power domain that need to know the highest supported frequency for each + corner/level (e.g. CPR), in order to properly initialize the hardware. + +- qcom,fuse-level: A positive value representing the fuse corner/level + associated with this OPP node. Sometimes several corners/levels sharesDocumentation/devicetree/bindings/opp/qcom-opp.txt Required properties: · line 44
Quoted 10 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt +10
-0+ a certain fuse corner/level. A fuse corner/level contains e.g. ref uV, + min uV, and max uV. + +- qcom,fuse-level-<name>: Named qcom,fuse-level property. This is exactly + similar to the above qcom,fuse-level property, but allows multiple + fuse corners/levels to be provided for the same OPP. At runtime, the + platform can pick a <name> and matching qcom,fuse-level-<name> property + will be enabled for all OPPs. If the platform doesn't pick a specific + <name> or the <name> doesn't match with any qcom,fuse-level-<name> + properties, then qcom,fuse-level property shall be used, if present.We've generally moved away from having variable property names (gpio and regulators are the big exceptions) as they are harder to parse.
Quoted 2 lines
I'm not clear why you'd need this. Just make qcom,fuse-level an array and search each 'qcom,fuse-level' for the matching level number.
This was my first thought as well, but then Viresh told me that the OPP framework already has logic for parsing and using this.
If we call dev_pm_opp_set_prop_name(<name>)
We will automatically use all the named-properties with that suffix (e.g.):
opp-microvolt-<name>
opp-microamp-<name>
opp-fuse-corner-<name>
if and only if they exist, otherwise the regular properties will be used:
opp-microvolt
opp-microamp
opp-fuse-corner
This also means that not all OPPs will need the named variants, e.g. if all the speedbins have the same fuse-corner:
opp-fuse-corner-speedbin0 = <1>; opp-fuse-corner-speedbin1 = <1>; opp-fuse-corner-speedbin2 = <1>;
this can simplified to:
opp-fuse-corner = <1>;
Another reason why I think that using named-properties might be good is because I recently found out that certain Qualcomm SoCs have several fuse revisions for each speedbin, e.g. msm8996 SG has 8 fuse revisions per speedbin:
https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/arch/arm/boot/dts/qcom/msm8996pro.dtsi?h=msm-3.18#n62
https://source.codeaurora.org/quic/la/kernel/msm-3.18/tree/drivers/regulator/cpr3-hmss-regulator.c?h=msm-3.18#n88
Which means that some SoCs (in worst case) will actually need:
opp-fuse-corner-speedbin0-rev0 = <x>; opp-fuse-corner-speedbin0-rev1 = <x>; opp-fuse-corner-speedbin0-rev2 = <x>; opp-fuse-corner-speedbin0-rev3 = <x>; opp-fuse-corner-speedbin0-rev4 = <x>; opp-fuse-corner-speedbin0-rev5 = <x>; opp-fuse-corner-speedbin0-rev6 = <x>; opp-fuse-corner-speedbin0-rev7 = <x>; opp-fuse-corner-speedbin1-rev0 = <x>; opp-fuse-corner-speedbin1-rev1 = <x>; opp-fuse-corner-speedbin1-rev2 = <x>; opp-fuse-corner-speedbin1-rev3 = <x>; opp-fuse-corner-speedbin1-rev4 = <x>; opp-fuse-corner-speedbin1-rev5 = <x>; opp-fuse-corner-speedbin1-rev6 = <x>; opp-fuse-corner-speedbin1-rev7 = <x>; opp-fuse-corner-speedbin2-rev0 = <x>; opp-fuse-corner-speedbin2-rev1 = <x>; opp-fuse-corner-speedbin2-rev2 = <x>; opp-fuse-corner-speedbin2-rev3 = <x>; opp-fuse-corner-speedbin2-rev4 = <x>; opp-fuse-corner-speedbin2-rev5 = <x>; opp-fuse-corner-speedbin2-rev6 = <x>; opp-fuse-corner-speedbin2-rev7 = <x>;
For each OPP.
Fortunately, it's not always this messy, some SoCs only have a single fuse revision.
I think that having named-properties probably helps if more speedbins or fuse-revisions are added.
I guess the alternative would be to do like downstream, where they have a bunch of arrays instead, but then we wouldn't be able to use the logic from the OPP framework.
qcom,cpr-corner-fmax-map = /* Speed bin 0 */ <1 6 9 14 19>, //fuse rev0 <1 6 9 14 19>, //fuse rev1 <3 6 9 14 19>, //fuse rev2 <3 6 9 14 19>, //fuse rev3 <3 6 9 14 19>, //fuse rev4 <3 6 9 14 19>, //fuse rev5 <3 6 9 14 19>, //fuse rev6 <3 6 9 14 19>, //fuse rev7 /* Speed bin 1 */ <1 6 9 14 19>, //fuse rev0 <1 6 9 14 19>, //fuse rev1 <3 6 9 14 19>, //fuse rev2 <3 6 9 14 19>, //fuse rev3 <3 6 9 14 19>, //fuse rev4 <3 6 9 14 19>, //fuse rev5 <3 6 9 14 19>, //fuse rev6 <3 6 9 14 19>, //fuse rev7 /* Speed bin 2 */ <1 6 9 14 19>, //fuse rev0 <1 6 9 14 19>, //fuse rev1 <3 6 9 14 19>, //fuse rev2 <3 6 9 14 19>, //fuse rev3 <3 6 9 14 19>, //fuse rev4 <3 6 9 14 19>, //fuse rev5 <3 6 9 14 19>, //fuse rev6 <3 6 9 14 19>; //fuse rev7
Kind regards,
Niklas
Re: [RFC PATCH] dt-bindings: opp: Extend qcom-opp bindings with properties needed for CPR
Quoted 34 lines · Niklas Cassel
Quoted 22 lines · Rob Herring
Quoted 21 lines · Niklas Cassel
Extend qcom-opp bindings with properties needed for Core Power Reduction (CPR).
CPR is included in a great variety of Qualcomm SoC, e.g. msm8916 and msm8996, and was first introduced in msm8974.
Signed-off-by Niklas Cassel <[email protected]>---
Hello Rob, Rajendra,Sorry for not replying sooner.
Since Rob wanted the binding to be complete before merging, this is my proposal to extend the OPP binding with properties needed to support CPR (both for msm8916 and msm8996). I've discussed the proposal with Viresh, and this proposal seems better than what I previously suggested here:
https://lore.kernel.org/lkml/[email protected]/.../devicetree/bindings/opp/qcom-opp.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)Quoted 10 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt Required properties: · line 25
Quoted 8 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt +0
-0@@ -23,3 +23,22 @@ Required properties: 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've lost the context here. Please send this all together.
Quoted 1 line
Will do, as soon as I've gotten your feedback on this mail.
Niklas, are you still waiting for feedback on this mail from Rob?
Re: [RFC PATCH] dt-bindings: opp: Extend qcom-opp bindings with properties needed for CPR
Quoted 37 lines · Rajendra Nayak
Quoted 34 lines · Niklas Cassel
Quoted 32 lines · Rob Herring
Quoted 26 lines · Niklas Cassel
Extend qcom-opp bindings with properties needed for Core Power Reduction (CPR).
CPR is included in a great variety of Qualcomm SoC, e.g. msm8916 and msm8996, and was first introduced in msm8974.
Signed-off-by Niklas Cassel <[email protected]>---
Hello Rob, Rajendra,Sorry for not replying sooner.
Since Rob wanted the binding to be complete before merging, this is my proposal to extend the OPP binding with properties needed to support CPR (both for msm8916 and msm8996). I've discussed the proposal with Viresh, and this proposal seems better than what I previously suggested here:
https://lore.kernel.org/lkml/[email protected]/.../devicetree/bindings/opp/qcom-opp.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)Documentation/devicetree/bindings/opp/qcom-opp.txt +0
-0Documentation/devicetree/bindings/opp/qcom-opp.txt Required properties: · line 25
Quoted 3 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt +0
-0@@ -23,3 +23,22 @@ Required properties: 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've lost the context here. Please send this all together.
Quoted 3 lines
Quoted 1 line
Will do, as soon as I've gotten your feedback on this mail.
Niklas, are you still waiting for feedback on this mail from Rob?
Yes.
Rajendra, I realize that your patches have been ready for merging for a long time, and this fuse-level is quite complex, so the discussion has been taken longer than expected. Sorry for that.
Hopefully Rob will reply soon, or perhaps he could agree to merge your binding as is, and I could extend it later, when we have reached a consensus.
Kind regards,
Niklas
Re: [RFC PATCH] dt-bindings: opp: Extend qcom-opp bindings with properties needed for CPR
Quoted 38 lines · Niklas Cassel
Quoted 37 lines · Rajendra Nayak
Quoted 34 lines · Niklas Cassel
Quoted 32 lines · Rob Herring
Quoted 26 lines · Niklas Cassel
Extend qcom-opp bindings with properties needed for Core Power Reduction (CPR).
CPR is included in a great variety of Qualcomm SoC, e.g. msm8916 and msm8996, and was first introduced in msm8974.
Signed-off-by Niklas Cassel <[email protected]>---
Hello Rob, Rajendra,Sorry for not replying sooner.
Since Rob wanted the binding to be complete before merging, this is my proposal to extend the OPP binding with properties needed to support CPR (both for msm8916 and msm8996). I've discussed the proposal with Viresh, and this proposal seems better than what I previously suggested here:
https://lore.kernel.org/lkml/[email protected]/.../devicetree/bindings/opp/qcom-opp.txt | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+)Documentation/devicetree/bindings/opp/qcom-opp.txt +0
-0Documentation/devicetree/bindings/opp/qcom-opp.txt Required properties: · line 25
Quoted 3 lines
Documentation/devicetree/bindings/opp/qcom-opp.txt +0
-0@@ -23,3 +23,22 @@ Required properties: 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've lost the context here. Please send this all together.
Quoted 5 lines
Quoted 3 lines
Quoted 1 line
Will do, as soon as I've gotten your feedback on this mail.
Niklas, are you still waiting for feedback on this mail from Rob?
Yes.
Rob, did you have any further feedback for Niklas based on his binding proposal?
Quoted 8 lines
Rajendra, I realize that your patches have been ready for merging for a long time, and this fuse-level is quite complex, so the discussion has been taken longer than expected. Sorry for that.
Hopefully Rob will reply soon, or perhaps he could agree to merge your binding as is, and I could extend it later, when we have reached a consensus.
Or should we merge the qcom,level binding for now (since I though we agreed 'reg' is probably not the right fit for it) and then discuss further on how to describe the legacy platforms which require more details like fuse bindings? Note that the current platform (sdm845) only needs the qcom,level binding. What Niklas is proposing is for describing the older SoCs.
PATCH v4 3/6 soc: qcom: rpmpd: Add a Power domain driver to model corners
In reply to Rajendra NayakThe Power domains for corners just pass the performance state set by the consumers to the RPM (Remote Power manager) which then takes care of setting the appropriate voltage on the corresponding rails to meet the performance needs.
We add all Power domain data needed on msm8996 here. This driver can easily be extended by adding data for other qualcomm SoCs as well.
--- drivers/soc/qcom/Kconfig | 9 ++ drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/rpmpd.c | 294 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 304 insertions(+) create mode 100644 drivers/soc/qcom/rpmpd.c
drivers/soc/qcom/Kconfig +9 -0
@@ -74,6 +74,15 @@ config QCOM_RMTFS_MEM Say y here if you intend to boot the modem remoteproc. +config QCOM_RPMPD + bool "Qualcomm RPM Power domain driver" + depends on MFD_QCOM_RPM && QCOM_SMD_RPM + help + QCOM RPM Power domain driver to support power-domains with + performance states. The driver communicates a performance state + value to RPM which then translates it into corresponding voltage + for the voltage rail. + config QCOM_SMEM tristate "Qualcomm Shared Memory Manager (SMEM)" depends on ARCH_QCOM
drivers/soc/qcom/Makefile +1 -0
@@ -15,3 +15,4 @@ obj-$(CONFIG_QCOM_SMP2P) += smp2p.o obj-$(CONFIG_QCOM_SMSM) += smsm.o obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o obj-$(CONFIG_QCOM_APR) += apr.o +obj-$(CONFIG_QCOM_RPMPD) += rpmpd.o
drivers/soc/qcom/rpmpd.c new file +294 -0
294 lines not on this page · raw message
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 4/6 soc: qcom: rpmpd: Add support for get/set performance state
In reply to Rajendra NayakAdd support for the .set_performace_state() and .opp_to_performance_state() callbacks in the rpmpd driver.
--- drivers/soc/qcom/rpmpd.c | 46 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 46 insertions(+)
drivers/soc/qcom/rpmpd.c +46 -0
@@ -12,6 +12,7 @@#include <linux/of.h> #include <linux/of_device.h> #include <linux/platform_device.h> +#include <linux/pm_opp.h> #include <linux/soc/qcom/smd-rpm.h> #include <dt-bindings/mfd/qcom-rpm.h>
@@ -28,6 +29,8 @@#define KEY_ENABLE 0x6e657773/* swen */ #define KEY_FLOOR_CORNER 0x636676/* vfc */ +#define MAX_RPMPD_STATE 6 +#define DEFINE_RPMPD_CORN_SMPA (_platform, _name, _active, r_id) \ static struct rpmpd _platform##_##_active; \ static struct rpmpd _platform##_##_name = { \
@@ -221,6 +224,47 @@ static int rpmpd_power_off(struct generic_pm_domain *domain)return ret; } +static int rpmpd_set_performance (struct generic_pm_domain *domain, +unsigned int state) +{ +int ret =0 ; +struct rpmpd *pd =domain_to_rpmpd (domain); + +mutex_lock (&rpmpd_lock); + +if (state >MAX_RPMPD_STATE ) + goto out; + + pd->corner = state; + +if (!pd->enabled && (pd->key !=KEY_FLOOR_CORNER )) + goto out; + + ret =rpmpd_aggregate_corner (pd); + +out: +mutex_unlock (&rpmpd_lock); + +return ret; +} + +static unsigned int rpmpd_get_performance (struct generic_pm_domain *genpd, +struct dev_pm_opp *opp) +{ +struct device_node *np; +unsigned int corner =0 ; + + np =dev_pm_opp_get_of_node (opp); +if (of_property_read_u32 (np,"qcom,level" , &corner)) { +pr_err ("%s: missing 'qcom,level' property\n" , __func__); +return 0 ; + } + +of_node_put (np); + +return corner; +} +static int rpmpd_probe (struct platform_device *pdev) {int i;
@@ -261,6 +305,8 @@ static int rpmpd_probe(struct platform_device *pdev) rpmpds[i]->rpm = rpm; rpmpds[i]->pd.power_off = rpmpd_power_off; rpmpds[i]->pd.power_on = rpmpd_power_on; + rpmpds[i]->pd.set_performance_state = rpmpd_set_performance; + rpmpds[i]->pd.opp_to_performance_state = rpmpd_get_performance;pm_genpd_init (&rpmpds[i]->pd,NULL , true); data->domains[i] = &rpmpds[i]->pd;
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 5/6 arm64: dts: msm8996: Add rpmpd device node
In reply to Rajendra NayakAdd rpmpd device node and its OPP table
--- arch/arm64/boot/dts/qcom/msm8996.dtsi | 34 +++++++++++++++++++++++++++ 1 file changed, 34 insertions(+)
arch/arm64/boot/dts/qcom/msm8996.dtsi +34 -0
@@ -308,6 +308,40 @@ #clock-cells = <1>; }; + 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_opp1: opp1 { + qcom,level = <1>; + }; + + rpmpd_opp2: opp2 { + qcom,level = <2>; + }; + + rpmpd_opp3: opp3 { + qcom,level = <3>; + }; + + rpmpd_opp4: opp4 { + qcom,level = <4>; + }; + + rpmpd_opp5: opp5 { + qcom,level = <5>; + }; + + rpmpd_opp6: opp6 { + qcom,level = <6>; + }; + }; + pm8994-regulators { compatible = "qcom,rpm-pm8994-regulators";
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
PATCH v4 6/6 soc: qcom: rpmhpd: Add RPMh Power domain driver
In reply to Rajendra NayakThe RPMh Power domain driver aggregates the corner votes from various consumers for the ARC resources and communicates it to RPMh.
With RPMh we use 2 different numbering space for corners, one used by the clients to express their performance needs, and another used to communicate to RPMh hardware.
The clients express their performance requirements using a sparse numbering space which are mapped to meaningful levels like RET, SVS, NOMINAL, TURBO etc which then get mapped to another number space between 0 and 15 which is communicated to RPMh. The sparse number space, also referred to as vlvl is mapped to the continuous number space of 0 to 15, also referred to as hlvl, using command DB.
Some power domain clients could request a performance state only while the CPU is active, while some others could request for a certain performance state all the time regardless of the state of the CPU. We handle this by internally aggregating the votes from both type of clients and then send the aggregated votes to RPMh.
There are also 3 different types of Votes that are comunicated to RPMh for every resource.
1. ACTIVE_ONLY: This specifies the requirement for the resource when the CPU is active
2. SLEEP: This specifies the requirement for the resource when the CPU is going to sleep
3. WAKE_ONLY: This specifies the requirement for the resource when the CPU is coming out of sleep to active state
We add data for all power domains on sdm845 SoC as part of the patch. The driver can be extended to support other SoCs which support RPMh
--- drivers/soc/qcom/Kconfig | 9 + drivers/soc/qcom/Makefile | 1 + drivers/soc/qcom/rpmhpd.c | 406 ++++++++++++++++++++++++++++++++++++++ 3 files changed, 416 insertions(+) create mode 100644 drivers/soc/qcom/rpmhpd.c
drivers/soc/qcom/Kconfig +9 -0
@@ -74,6 +74,15 @@ config QCOM_RMTFS_MEM Say y here if you intend to boot the modem remoteproc. +config QCOM_RPMHPD + bool "Qualcomm RPMh Power domain driver" + depends on QCOM_RPMH && QCOM_COMMAND_DB + help + QCOM RPMh Power domain driver to support power-domains with + performance states. The driver communicates a performance state + value to RPMh which then translates it into corresponding voltage + for the voltage rail. + config QCOM_RPMPD bool "Qualcomm RPM Power domain driver" depends on MFD_QCOM_RPM && QCOM_SMD_RPM
drivers/soc/qcom/Makefile +1 -0
@@ -16,3 +16,4 @@ obj-$(CONFIG_QCOM_SMSM) += smsm.o obj-$(CONFIG_QCOM_WCNSS_CTRL) += wcnss_ctrl.o obj-$(CONFIG_QCOM_APR) += apr.o obj-$(CONFIG_QCOM_RPMPD) += rpmpd.o +obj-$(CONFIG_QCOM_RPMHPD) += rpmhpd.o
drivers/soc/qcom/rpmhpd.c new file +406 -0
406 lines not on this page · raw message
Signature · 2 lines
QUALCOMM INDIA, on behalf of Qualcomm Innovation Center, Inc. is a member of Code Aurora Forum, hosted by The Linux Foundation
Quoted 10 lines · Rajendra Nayak
Changes in v4:
* Included the patch to add qcom-opp bindings (dropped accidentally in v3)
* merged the patches to add bindings for rpm and rpmh, added consumer binding example
* Made the drivers built in, removed .remove
* Added better description in changelog for PATCH 6/6
* Updatedrpmhpd_aggregate_corner()based on Davids feedback
*rpmhpd_set_performance_state()returns max corner, in cases where its called with anINT_MAX
* Dropped the patch to max vote on all corners at init, the patch did not work anyway, and it shouldn't be needed now
These patches have been out on the list for a while (8 weeks). I haven't seen any further comments from anyone, except on PATCH 2/6 by Rob. I requested Rob to provide his Ack if he is fine with the bindings.
Can we plan to pull these in for 4.20?
Quoted 49 lines
Changes in v3:
* Bindings split into seperate patches
* Bindings updated to remove duplicate OPP table phandles
* DT headers defining macros for Power domain indexes and OPP levels
* Optimisations to userpmh_write_async()whereever applicable
* Fixed up handling of ACTIVE_ONLY/WAKE_ONLY/SLEEP voting for RPMh
* Fixed the vlvl to hlvl conversions inset_performance
* Other minor fixes based on review of v2
* TODO: This series does not handle the case where allVDD_MXvotes should be higher thanVDD_CXfrom APPs, as pointed out
by David Collins in v2. This needs support at genpd to propogate performance state up the parents, if we model these as Parent/Child to handle the interdependency.Changes in v2:
* added a power domain driver for sdm845 which supports communicating to RPMh
* dropped the changes to sdhc driver to move over to using OPP
as there is active discussion on using OPP as the interface vs handling all of it in clock drivers
* Other minor binding updates based on review of v1With performance state support for genpd/OPP merged, this is an effort to model a power domain driver to communicate corner/level values for qualcomm platforms to RPM (Remote Power Manager) and RPMh.
Rajendra Nayak (6):
dt-bindings: opp: Introduce qcom-opp bindings
dt-bindings: power: Add qcom rpm power domain driver bindings
soc: qcom: rpmpd: Add a Power domain driver to model corners
soc: qcom: rpmpd: Add support for get/set performance state
arm64: dts: msm8996: Add rpmpd device node
soc: qcom: rpmhpd: Add RPMh Power domain driver.../devicetree/bindings/opp/qcom-opp.txt | 25 ++ .../devicetree/bindings/power/qcom,rpmpd.txt | 146 +++++++ arch/arm64/boot/dts/qcom/msm8996.dtsi | 34 ++ drivers/soc/qcom/Kconfig | 18 + drivers/soc/qcom/Makefile | 2 + drivers/soc/qcom/rpmhpd.c | 406 ++++++++++++++++++ drivers/soc/qcom/rpmpd.c | 340 +++++++++++++++ include/dt-bindings/power/qcom-rpmpd.h | 39 ++ 8 files changed, 1010 insertions(+)create mode 100644
Documentation/devicetree/bindings/opp/qcom-opp.txtcreate mode 100644Documentation/devicetree/bindings/power/qcom,rpmpd.txtcreate mode 100644drivers/soc/qcom/rpmhpd.c
create mode 100644drivers/soc/qcom/rpmpd.c
create mode 100644include/dt-bindings/power/qcom-rpmpd.h
Quoted 14 lines · Rajendra Nayak
Quoted 10 lines · Rajendra Nayak
Changes in v4:
* Included the patch to add qcom-opp bindings (dropped accidentally in v3)
* merged the patches to add bindings for rpm and rpmh, added consumer binding example
* Made the drivers built in, removed .remove
* Added better description in changelog for PATCH 6/6
* Updatedrpmhpd_aggregate_corner()based on Davids feedback
*rpmhpd_set_performance_state()returns max corner, in cases where its called with anINT_MAX
* Dropped the patch to max vote on all corners at init, the patch did not work anyway, and it shouldn't be needed now
Quoted 5 lines
These patches have been out on the list for a while (8 weeks). I haven't seen any further comments from anyone, except on PATCH 2/6 by Rob. I requested Rob to provide his Ack if he is fine with the bindings.
Can we plan to pull these in for 4.20?
Hello Rajendra,
FYI: these patches do no longer cleanly apply to v4.19-rc1, it's a trivial conflict, but most maintainers prefer for the patch author to rebase, not sure what Andy prefers.
If it builds correctly with COMPILE_TEST, please consider adding that to your new Kconfig:
depends on MFD_QCOM_RPM && QCOM_SMD_RPM || COMPILE_TEST
Kind regards,
Niklas
Quoted 50 lines
Quoted 50 lines
Changes in v3:
* Bindings split into seperate patches
* Bindings updated to remove duplicate OPP table phandles
* DT headers defining macros for Power domain indexes and OPP levels
* Optimisations to userpmh_write_async()whereever applicable
* Fixed up handling of ACTIVE_ONLY/WAKE_ONLY/SLEEP voting for RPMh
* Fixed the vlvl to hlvl conversions inset_performance
* Other minor fixes based on review of v2
* TODO: This series does not handle the case where allVDD_MXvotes should be higher thanVDD_CXfrom APPs, as pointed out
by David Collins in v2. This needs support at genpd to propogate performance state up the parents, if we model these as Parent/Child to handle the interdependency.Changes in v2:
* added a power domain driver for sdm845 which supports communicating to RPMh
* dropped the changes to sdhc driver to move over to using OPP
as there is active discussion on using OPP as the interface vs handling all of it in clock drivers
* Other minor binding updates based on review of v1With performance state support for genpd/OPP merged, this is an effort to model a power domain driver to communicate corner/level values for qualcomm platforms to RPM (Remote Power Manager) and RPMh.
Rajendra Nayak (6):
dt-bindings: opp: Introduce qcom-opp bindings
dt-bindings: power: Add qcom rpm power domain driver bindings
soc: qcom: rpmpd: Add a Power domain driver to model corners
soc: qcom: rpmpd: Add support for get/set performance state
arm64: dts: msm8996: Add rpmpd device node
soc: qcom: rpmhpd: Add RPMh Power domain driver.../devicetree/bindings/opp/qcom-opp.txt | 25 ++ .../devicetree/bindings/power/qcom,rpmpd.txt | 146 +++++++ arch/arm64/boot/dts/qcom/msm8996.dtsi | 34 ++ drivers/soc/qcom/Kconfig | 18 + drivers/soc/qcom/Makefile | 2 + drivers/soc/qcom/rpmhpd.c | 406 ++++++++++++++++++ drivers/soc/qcom/rpmpd.c | 340 +++++++++++++++ include/dt-bindings/power/qcom-rpmpd.h | 39 ++ 8 files changed, 1010 insertions(+)create mode 100644
Documentation/devicetree/bindings/opp/qcom-opp.txtcreate mode 100644Documentation/devicetree/bindings/power/qcom,rpmpd.txtcreate mode 100644drivers/soc/qcom/rpmhpd.c
create mode 100644drivers/soc/qcom/rpmpd.c
create mode 100644include/dt-bindings/power/qcom-rpmpd.h