arm64: dts: qcom: sm6125: Add cpufreq-hw and CPU idle states
Subsystems (4)
cover arm64: dts: qcom: sm6125: Add cpufreq-hw and CPU idle states
SM6125 has no CPU frequency scaling and no CPU idle states in mainline:
the CPUs stay at the bootloader clock and only ever enter WFI.
The blocks are the same as on SM6115. Register addresses and idle latencies come from the downstream "trinket" device tree of a Xiaomi Mi A3 (laurel-sprout), where the CPU low power levels match the SM6115 values exactly.
Tested on the Mi A3 on next-20261113: cpufreq 300 MHz - 1.80/2.02 GHz with schedutil, WFI plus per-CPU power collapse in cpuidle with rising usage counters.
This is meant to go together with Roman Linev's SM6125 TSENS series [1], which adds #cooling-cells to the CPUs and per-CPU cooling maps that stay inert until a cpufreq driver registers cooling devices. That is why #cooling-cells is not added here. On my phone the same TSENS description (derived independently) runs together with this series and the cpufreq cooling devices bind.
Not done yet: cluster idle states (PSCI OSI parameters need checking) and an energy model.
[1] https://lore.kernel.org/r/[email protected]/
Majid Hajiheidari (3):
dt-bindings: cpufreq: cpufreq-qcom-hw: Add SM6125 compatible
arm64: dts: qcom: sm6125: Add cpufreq-hw node
arm64: dts: qcom: sm6125: Add CPU idle states
.../bindings/cpufreq/cpufreq-qcom-hw.yaml | 2 + arch/arm64/boot/dts/qcom/sm6125.dtsi | 61 +++++++++++++++++++ 2 files changed, 63 insertions(+)
base-commit: 84abb955b1015477aa11a96e2f3ac1b938b77f48
Signature · 1 line
2.56.1
PATCH 1/3 dt-bindings: cpufreq: cpufreq-qcom-hw: Add SM6125 compatible
Document the cpufreq-hw (OSM) block on SM6125. Like SM6115 it has two frequency domains with one register region each, so add it to both the compatible list and the two-region constraint.
--- Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.yaml | 2 ++ 1 file changed, 2 insertions(+)
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.yaml +2 -0
@@ -28,6 +28,7 @@ properties: - qcom,sdm670-cpufreq-hw - qcom,sdm845-cpufreq-hw - qcom,sm6115-cpufreq-hw + - qcom,sm6125-cpufreq-hw - qcom,sm6350-cpufreq-hw - qcom,sm8150-cpufreq-hw - const: qcom,cpufreq-hw
@@ -146,6 +147,7 @@ allOf: - qcom,sdm845-cpufreq-hw - qcom,sm4450-cpufreq-epss - qcom,sm6115-cpufreq-hw + - qcom,sm6125-cpufreq-hw - qcom,sm6350-cpufreq-hw - qcom,sm6375-cpufreq-epss then:
Signature · 1 line
2.56.1
Re: [PATCH 1/3] dt-bindings: cpufreq: cpufreq-qcom-hw: Add SM6125 compatible
Quoted 22 lines · Majid Hajiheidari
Document the cpufreq-hw (OSM) block on SM6125. Like SM6115 it has two frequency domains with one register region each, so add it to both the compatible list and the two-region constraint.
Signed-off-by Majid Hajiheidari <[email protected]>--- Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.yaml | 2 ++ 1 file changed, 2 insertions(+)Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.yaml +1
-0@@ -28,6 +28,7 @@ properties: - qcom,sdm670-cpufreq-hw - qcom,sdm845-cpufreq-hw - qcom,sm6115-cpufreq-hw + - qcom,sm6125-cpufreq-hw - qcom,sm6350-cpufreq-hw - qcom,sm8150-cpufreq-hw - const: qcom,cpufreq-hw
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.yaml allOf: · line 153
Quoted 7 lines
Documentation/devicetree/bindings/cpufreq/cpufreq-qcom-hw.yaml +1
-0@@ -146,6 +147,7 @@ allOf: - qcom,sdm845-cpufreq-hw - qcom,sm4450-cpufreq-epss - qcom,sm6115-cpufreq-hw + - qcom,sm6125-cpufreq-hw - qcom,sm6350-cpufreq-hw - qcom,sm6375-cpufreq-epss then:
I hope this can be applied independently.
Applied. Thanks.
Signature · 1 line
viresh
PATCH 2/3 arm64: dts: qcom: sm6125: Add cpufreq-hw node
In reply to Majid HajiheidariSM6125 has the same cpufreq-hw (OSM) blocks as SM6115, at 0xf521000 (silver cluster) and 0xf523000 (gold cluster), per the downstream "trinket" device tree. Describe them and hook up the CPUs so the frequency can scale instead of staying at the bootloader setting.
GCC on SM6125 has no plain GPLL0 output; GPLL0_OUT_EARLY is the PLL itself and is used as the alternate source.
Tested on a Xiaomi Mi A3: policy0 300 MHz - 1.80 GHz, policy4 300 MHz - 2.02 GHz, scaling with schedutil; a single gold core holds 1998 MHz under 7-Zip.
--- arch/arm64/boot/dts/qcom/sm6125.dtsi | 29 ++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+)
arch/arm64/boot/dts/qcom/sm6125.dtsi +29 -0
@@ -43,6 +43,8 @@ cpu0: cpu@0 { compatible = "qcom,kryo260"; reg = <0x0 0x0>; enable-method = "psci"; + clocks = <&cpufreq_hw 0>; + qcom,freq-domain = <&cpufreq_hw 0>; capacity-dmips-mhz = <1024>; next-level-cache = <&l2_0>; l2_0: l2-cache {
@@ -57,6 +59,8 @@ cpu1: cpu@1 { compatible = "qcom,kryo260"; reg = <0x0 0x1>; enable-method = "psci"; + clocks = <&cpufreq_hw 0>; + qcom,freq-domain = <&cpufreq_hw 0>; capacity-dmips-mhz = <1024>; next-level-cache = <&l2_0>; };
@@ -66,6 +70,8 @@ cpu2: cpu@2 { compatible = "qcom,kryo260"; reg = <0x0 0x2>; enable-method = "psci"; + clocks = <&cpufreq_hw 0>; + qcom,freq-domain = <&cpufreq_hw 0>; capacity-dmips-mhz = <1024>; next-level-cache = <&l2_0>; };
@@ -75,6 +81,8 @@ cpu3: cpu@3 { compatible = "qcom,kryo260"; reg = <0x0 0x3>; enable-method = "psci"; + clocks = <&cpufreq_hw 0>; + qcom,freq-domain = <&cpufreq_hw 0>; capacity-dmips-mhz = <1024>; next-level-cache = <&l2_0>; };
@@ -84,6 +92,8 @@ cpu4: cpu@100 { compatible = "qcom,kryo260"; reg = <0x0 0x100>; enable-method = "psci"; + clocks = <&cpufreq_hw 1>; + qcom,freq-domain = <&cpufreq_hw 1>; capacity-dmips-mhz = <1638>; next-level-cache = <&l2_1>; l2_1: l2-cache {
@@ -98,6 +108,8 @@ cpu5: cpu@101 { compatible = "qcom,kryo260"; reg = <0x0 0x101>; enable-method = "psci"; + clocks = <&cpufreq_hw 1>; + qcom,freq-domain = <&cpufreq_hw 1>; capacity-dmips-mhz = <1638>; next-level-cache = <&l2_1>; };
@@ -107,6 +119,8 @@ cpu6: cpu@102 { compatible = "qcom,kryo260"; reg = <0x0 0x102>; enable-method = "psci"; + clocks = <&cpufreq_hw 1>; + qcom,freq-domain = <&cpufreq_hw 1>; capacity-dmips-mhz = <1638>; next-level-cache = <&l2_1>; };
@@ -116,6 +130,8 @@ cpu7: cpu@103 { compatible = "qcom,kryo260"; reg = <0x0 0x103>; enable-method = "psci"; + clocks = <&cpufreq_hw 1>; + qcom,freq-domain = <&cpufreq_hw 1>; capacity-dmips-mhz = <1638>; next-level-cache = <&l2_1>; };
@@ -1633,6 +1649,19 @@ intc: interrupt-controller@f200000 { interrupt-controller; interrupts = <GIC_PPI 9 IRQ_TYPE_LEVEL_HIGH>; }; + + cpufreq_hw: cpufreq@f521000 { + compatible = "qcom,sm6125-cpufreq-hw", "qcom,cpufreq-hw"; + reg = <0x0 0x0f521000 0x0 0x1000>, + <0x0 0x0f523000 0x0 0x1000>; + reg-names = "freq-domain0", "freq-domain1"; + + clocks = <&rpmcc RPM_SMD_XO_CLK_SRC>, <&gcc GPLL0_OUT_EARLY>; + clock-names = "xo", "alternate"; + + #freq-domain-cells = <1>; + #clock-cells = <1>; + }; }; timer {
Signature · 1 line
2.56.1
PATCH 3/3 arm64: dts: qcom: sm6125: Add CPU idle states
In reply to Majid HajiheidariAdd per-CPU power collapse states. The downstream "trinket" low power levels use exactly the SM6115 numbers (silver: entry 290 us, exit 376 us, min residency 1182 us; gold: 297/324/1110 us; PSCI CPU mode 3), so reuse them in platform-coordinated mode.
Cluster (domain) idle states are left for later; their PSCI parameters still need to be checked against the downstream levels.
Tested on a Xiaomi Mi A3: WFI and cpu-sleep-N-0 show up in cpuidle and the usage counters increase.
--- arch/arm64/boot/dts/qcom/sm6125.dtsi | 32 ++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+)
arch/arm64/boot/dts/qcom/sm6125.dtsi +32 -0
@@ -44,6 +44,7 @@ cpu0: cpu@0 { reg = <0x0 0x0>; enable-method = "psci"; clocks = <&cpufreq_hw 0>; + cpu-idle-states = <&little_cpu_sleep_0>; qcom,freq-domain = <&cpufreq_hw 0>; capacity-dmips-mhz = <1024>; next-level-cache = <&l2_0>;
@@ -60,6 +61,7 @@ cpu1: cpu@1 { reg = <0x0 0x1>; enable-method = "psci"; clocks = <&cpufreq_hw 0>; + cpu-idle-states = <&little_cpu_sleep_0>; qcom,freq-domain = <&cpufreq_hw 0>; capacity-dmips-mhz = <1024>; next-level-cache = <&l2_0>;
@@ -71,6 +73,7 @@ cpu2: cpu@2 { reg = <0x0 0x2>; enable-method = "psci"; clocks = <&cpufreq_hw 0>; + cpu-idle-states = <&little_cpu_sleep_0>; qcom,freq-domain = <&cpufreq_hw 0>; capacity-dmips-mhz = <1024>; next-level-cache = <&l2_0>;
@@ -82,6 +85,7 @@ cpu3: cpu@3 { reg = <0x0 0x3>; enable-method = "psci"; clocks = <&cpufreq_hw 0>; + cpu-idle-states = <&little_cpu_sleep_0>; qcom,freq-domain = <&cpufreq_hw 0>; capacity-dmips-mhz = <1024>; next-level-cache = <&l2_0>;
@@ -93,6 +97,7 @@ cpu4: cpu@100 { reg = <0x0 0x100>; enable-method = "psci"; clocks = <&cpufreq_hw 1>; + cpu-idle-states = <&big_cpu_sleep_0>; qcom,freq-domain = <&cpufreq_hw 1>; capacity-dmips-mhz = <1638>; next-level-cache = <&l2_1>;
@@ -109,6 +114,7 @@ cpu5: cpu@101 { reg = <0x0 0x101>; enable-method = "psci"; clocks = <&cpufreq_hw 1>; + cpu-idle-states = <&big_cpu_sleep_0>; qcom,freq-domain = <&cpufreq_hw 1>; capacity-dmips-mhz = <1638>; next-level-cache = <&l2_1>;
@@ -120,6 +126,7 @@ cpu6: cpu@102 { reg = <0x0 0x102>; enable-method = "psci"; clocks = <&cpufreq_hw 1>; + cpu-idle-states = <&big_cpu_sleep_0>; qcom,freq-domain = <&cpufreq_hw 1>; capacity-dmips-mhz = <1638>; next-level-cache = <&l2_1>;
@@ -131,6 +138,7 @@ cpu7: cpu@103 { reg = <0x0 0x103>; enable-method = "psci"; clocks = <&cpufreq_hw 1>; + cpu-idle-states = <&big_cpu_sleep_0>; qcom,freq-domain = <&cpufreq_hw 1>; capacity-dmips-mhz = <1638>; next-level-cache = <&l2_1>;
@@ -173,6 +181,30 @@ core3 { }; }; }; + + idle-states { + entry-method = "psci"; + + little_cpu_sleep_0: cpu-sleep-0-0 { + compatible = "arm,idle-state"; + idle-state-name = "silver-rail-power-collapse"; + arm,psci-suspend-param = <0x40000003>; + entry-latency-us = <290>; + exit-latency-us = <376>; + min-residency-us = <1182>; + local-timer-stop; + }; + + big_cpu_sleep_0: cpu-sleep-1-0 { + compatible = "arm,idle-state"; + idle-state-name = "gold-rail-power-collapse"; + arm,psci-suspend-param = <0x40000003>; + entry-latency-us = <297>; + exit-latency-us = <324>; + min-residency-us = <1110>; + local-timer-stop; + }; + }; }; firmware {
Signature · 1 line
2.56.1
Hi Barnabás,
I should have put you on Cc of this series, sorry. After sending it I looked at your sm61x5 7.3-develop branch and saw that you have cpufreq for SM6125 there as well, done differently, so I would like to sort this out with you rather than have two versions on the list.
The differences as far as I can see:
- Your branch gives qcom,sm6125-cpufreq-hw its own soc data in the driver (lut_max_entries = 12) and makes the clocks optional, with 19.2 MHz and 300 MHz as defaults. This series uses the generic qcom,cpufreq-hw fallback like SM6115 does, and takes "xo" from rpmcc and "alternate" from GCC GPLL0_OUT_EARLY, so it needs no driver change.
- I booted your branch (cdcfb1386, plus the laurel-sprout board part for mpss and wifi) on my Mi A3 to compare. Both versions give exactly the same tables:
policy0: 300000 614400 864000 1017600 1305600 1420800 1612800 1804800
policy4: 300000 652800 902400 1056000 1401600 1536000 1804800 2016000With the generic data the LUT read stops at the first repeated row, so the 40 row limit is never reached on this phone. Did you see it cause a problem on another device, or is the 12 from the downstream max-lut-entries? If some SM6125 board fills all 12 rows I see why the limit matters, and I am happy to rework this series or to drop the cpufreq part in favour of yours, whichever you and the maintainers prefer.
Beyond cpufreq: on that boot your mpss and wifi nodes worked on laurel-sprout with only the board enablement added (firmware-name and the four WCN3990 supplies): the modem came up and wlan0 associated. Two things I noticed, in case they are useful:
- the modem crashed twice during startup ("fatal error without message" at 103 s and 145 s), recovered both times and then stayed up;
- ModemManager did not find a modem. On my own tree, which also has the IPA node and a dynamically allocated rmtfs region, it registers and I see no crashes. I have not tried to find out which difference matters.
I have modem, WiFi, ADSP/CDSP, Bluetooth and IPA device tree running on this phone on next-20261113, but since you have modem and WiFi in progress I will not post those. I can test your patches on laurel-sprout and reply with Tested-by, and if it helps I can send the parts you do not have yet (for example Bluetooth, ADSP/CDSP or the laurel-sprout board enablement). Just tell me what would be useful.
Thanks,
Majid