diff --git a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml index 9163560a19..154039cd40 100644 --- a/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml +++ b/Documentation/devicetree/bindings/firmware/google,gs101-acpm-ipc.yaml @@ -78,7 +78,7 @@ properties: description: The SoC's thermal sensors, which the ACPM firmware reads on the kernel's behalf. Cells are the sensor index (0 big, 1 mid, 2 little - CPU cluster, 3 GPU, 4 ISP, 5 TPU, and on zumapro 6 AUR). + CPU cluster, 3 GPU, 4 ISP, 5 TPU, and on gs201 and zumapro 6 AUR). type: object $ref: /schemas/thermal/thermal-sensor.yaml# unevaluatedProperties: false @@ -87,6 +87,7 @@ properties: compatible: enum: - google,gs101-acpm-tmu + - google,gs201-acpm-tmu - google,zumapro-acpm-tmu "#thermal-sensor-cells": diff --git a/arch/arm64/boot/dts/exynos/google/gs201.dtsi b/arch/arm64/boot/dts/exynos/google/gs201.dtsi index e1e6508ec9..bc2375a37c 100644 --- a/arch/arm64/boot/dts/exynos/google/gs201.dtsi +++ b/arch/arm64/boot/dts/exynos/google/gs201.dtsi @@ -9,6 +9,7 @@ #include #include #include +#include / { compatible = "google,gs201"; @@ -51,65 +52,97 @@ device_type = "cpu"; compatible = "arm,cortex-a55"; reg = <0x000>; + clocks = <&acpm_ipc GS201_CLK_ACPM_DVFS_CPUCL0>; enable-method = "psci"; cpu-idle-states = <&ananke_cpu_sleep>; capacity-dmips-mhz = <250>; + dynamic-power-coefficient = <89>; + operating-points-v2 = <&cpucl0_opp_table>; + #cooling-cells = <2>; }; cpu1: cpu@100 { device_type = "cpu"; compatible = "arm,cortex-a55"; reg = <0x100>; + clocks = <&acpm_ipc GS201_CLK_ACPM_DVFS_CPUCL0>; enable-method = "psci"; cpu-idle-states = <&ananke_cpu_sleep>; capacity-dmips-mhz = <250>; + dynamic-power-coefficient = <89>; + operating-points-v2 = <&cpucl0_opp_table>; + #cooling-cells = <2>; }; cpu2: cpu@200 { device_type = "cpu"; compatible = "arm,cortex-a55"; reg = <0x200>; + clocks = <&acpm_ipc GS201_CLK_ACPM_DVFS_CPUCL0>; enable-method = "psci"; cpu-idle-states = <&ananke_cpu_sleep>; capacity-dmips-mhz = <250>; + dynamic-power-coefficient = <89>; + operating-points-v2 = <&cpucl0_opp_table>; + #cooling-cells = <2>; }; cpu3: cpu@300 { device_type = "cpu"; compatible = "arm,cortex-a55"; reg = <0x300>; + clocks = <&acpm_ipc GS201_CLK_ACPM_DVFS_CPUCL0>; enable-method = "psci"; cpu-idle-states = <&ananke_cpu_sleep>; capacity-dmips-mhz = <250>; + dynamic-power-coefficient = <89>; + operating-points-v2 = <&cpucl0_opp_table>; + #cooling-cells = <2>; }; cpu4: cpu@400 { device_type = "cpu"; compatible = "arm,cortex-a78"; reg = <0x400>; + clocks = <&acpm_ipc GS201_CLK_ACPM_DVFS_CPUCL1>; enable-method = "psci"; cpu-idle-states = <&hercules_cpu_sleep>; capacity-dmips-mhz = <927>; + dynamic-power-coefficient = <513>; + operating-points-v2 = <&cpucl1_opp_table>; + #cooling-cells = <2>; }; cpu5: cpu@500 { device_type = "cpu"; compatible = "arm,cortex-a78"; reg = <0x500>; + clocks = <&acpm_ipc GS201_CLK_ACPM_DVFS_CPUCL1>; enable-method = "psci"; cpu-idle-states = <&hercules_cpu_sleep>; capacity-dmips-mhz = <927>; + dynamic-power-coefficient = <513>; + operating-points-v2 = <&cpucl1_opp_table>; + #cooling-cells = <2>; }; cpu6: cpu@600 { device_type = "cpu"; compatible = "arm,cortex-x1"; reg = <0x600>; + clocks = <&acpm_ipc GS201_CLK_ACPM_DVFS_CPUCL2>; enable-method = "psci"; cpu-idle-states = <&hera_cpu_sleep>; capacity-dmips-mhz = <1024>; + dynamic-power-coefficient = <757>; + operating-points-v2 = <&cpucl2_opp_table>; + #cooling-cells = <2>; }; cpu7: cpu@700 { device_type = "cpu"; compatible = "arm,cortex-x1"; reg = <0x700>; + clocks = <&acpm_ipc GS201_CLK_ACPM_DVFS_CPUCL2>; enable-method = "psci"; cpu-idle-states = <&hera_cpu_sleep>; capacity-dmips-mhz = <1024>; + dynamic-power-coefficient = <757>; + operating-points-v2 = <&cpucl2_opp_table>; + #cooling-cells = <2>; }; /* * C2: core power-down through PSCI CPU_SUSPEND, with latencies @@ -154,11 +187,463 @@ }; }; + /* + * CPU levels: the ACPM firmware's own DVFS levels (the ECT the + * bootloader leaves at 0x90000000; the same lists are stock's + * pixel-em table), up to each cluster's max-freq in stock's + * exynos-acme domains (Google's gs201-cpu.dtsi): 1803 MHz little, + * 2348 MHz mid, 2850 MHz big. The firmware sets the rail voltages + * from its fused ASV tables, so there is no opp-microvolt. + * + * Stock caps the mid and big clusters at 1999 and 2252 MHz whenever + * its battery current limiter (BCL) sees the battery voltage droop + * (freq_qos vdroop1/vdroop2/smpl_gm in Google's + * gs201-cloudripper-bcl.dtsi). There is no BCL driver here, so the + * levels above those caps are turbo-mode: off until boost is enabled + * (/sys/devices/system/cpu/cpufreq/boost). opp-suspend is stock's + * resume-freq, the level stock holds through suspend. + */ + cpucl0_opp_table: opp-table-0 { + compatible = "operating-points-v2"; + opp-shared; + + opp-300000000 { + opp-hz = /bits/ 64 <300000000>; + clock-latency-ns = <500000>; + }; + + opp-574000000 { + opp-hz = /bits/ 64 <574000000>; + clock-latency-ns = <500000>; + }; + + opp-738000000 { + opp-hz = /bits/ 64 <738000000>; + clock-latency-ns = <500000>; + }; + + opp-930000000 { + opp-hz = /bits/ 64 <930000000>; + clock-latency-ns = <500000>; + }; + + opp-1098000000 { + opp-hz = /bits/ 64 <1098000000>; + clock-latency-ns = <500000>; + }; + + opp-1197000000 { + opp-hz = /bits/ 64 <1197000000>; + clock-latency-ns = <500000>; + opp-suspend; + }; + + opp-1328000000 { + opp-hz = /bits/ 64 <1328000000>; + clock-latency-ns = <500000>; + }; + + opp-1401000000 { + opp-hz = /bits/ 64 <1401000000>; + clock-latency-ns = <500000>; + }; + + opp-1598000000 { + opp-hz = /bits/ 64 <1598000000>; + clock-latency-ns = <500000>; + }; + + opp-1704000000 { + opp-hz = /bits/ 64 <1704000000>; + clock-latency-ns = <500000>; + }; + + opp-1803000000 { + opp-hz = /bits/ 64 <1803000000>; + clock-latency-ns = <500000>; + }; + + /* 1950, 2024, 2098 and 2196 MHz stay off, as on stock. */ + }; + + cpucl1_opp_table: opp-table-1 { + compatible = "operating-points-v2"; + opp-shared; + + opp-400000000 { + opp-hz = /bits/ 64 <400000000>; + clock-latency-ns = <500000>; + }; + + opp-553000000 { + opp-hz = /bits/ 64 <553000000>; + clock-latency-ns = <500000>; + }; + + opp-696000000 { + opp-hz = /bits/ 64 <696000000>; + clock-latency-ns = <500000>; + }; + + opp-799000000 { + opp-hz = /bits/ 64 <799000000>; + clock-latency-ns = <500000>; + }; + + opp-910000000 { + opp-hz = /bits/ 64 <910000000>; + clock-latency-ns = <500000>; + }; + + opp-1024000000 { + opp-hz = /bits/ 64 <1024000000>; + clock-latency-ns = <500000>; + }; + + opp-1197000000 { + opp-hz = /bits/ 64 <1197000000>; + clock-latency-ns = <500000>; + }; + + opp-1328000000 { + opp-hz = /bits/ 64 <1328000000>; + clock-latency-ns = <500000>; + }; + + opp-1491000000 { + opp-hz = /bits/ 64 <1491000000>; + clock-latency-ns = <500000>; + opp-suspend; + }; + + opp-1663000000 { + opp-hz = /bits/ 64 <1663000000>; + clock-latency-ns = <500000>; + }; + + opp-1836000000 { + opp-hz = /bits/ 64 <1836000000>; + clock-latency-ns = <500000>; + }; + + opp-1999000000 { + opp-hz = /bits/ 64 <1999000000>; + clock-latency-ns = <500000>; + }; + + opp-2130000000 { + opp-hz = /bits/ 64 <2130000000>; + clock-latency-ns = <500000>; + turbo-mode; + }; + + opp-2253000000 { + opp-hz = /bits/ 64 <2253000000>; + clock-latency-ns = <500000>; + turbo-mode; + }; + + opp-2348000000 { + opp-hz = /bits/ 64 <2348000000>; + clock-latency-ns = <500000>; + turbo-mode; + }; + + /* 2393 and 2466 MHz stay off, as on stock. */ + }; + + cpucl2_opp_table: opp-table-2 { + compatible = "operating-points-v2"; + opp-shared; + + opp-500000000 { + opp-hz = /bits/ 64 <500000000>; + clock-latency-ns = <500000>; + }; + + opp-851000000 { + opp-hz = /bits/ 64 <851000000>; + clock-latency-ns = <500000>; + }; + + opp-984000000 { + opp-hz = /bits/ 64 <984000000>; + clock-latency-ns = <500000>; + }; + + opp-1106000000 { + opp-hz = /bits/ 64 <1106000000>; + clock-latency-ns = <500000>; + }; + + opp-1277000000 { + opp-hz = /bits/ 64 <1277000000>; + clock-latency-ns = <500000>; + }; + + opp-1426000000 { + opp-hz = /bits/ 64 <1426000000>; + clock-latency-ns = <500000>; + }; + + opp-1582000000 { + opp-hz = /bits/ 64 <1582000000>; + clock-latency-ns = <500000>; + }; + + opp-1745000000 { + opp-hz = /bits/ 64 <1745000000>; + clock-latency-ns = <500000>; + }; + + opp-1826000000 { + opp-hz = /bits/ 64 <1826000000>; + clock-latency-ns = <500000>; + opp-suspend; + }; + + opp-2048000000 { + opp-hz = /bits/ 64 <2048000000>; + clock-latency-ns = <500000>; + }; + + opp-2188000000 { + opp-hz = /bits/ 64 <2188000000>; + clock-latency-ns = <500000>; + }; + + opp-2252000000 { + opp-hz = /bits/ 64 <2252000000>; + clock-latency-ns = <500000>; + }; + + opp-2401000000 { + opp-hz = /bits/ 64 <2401000000>; + clock-latency-ns = <500000>; + turbo-mode; + }; + + opp-2507000000 { + opp-hz = /bits/ 64 <2507000000>; + clock-latency-ns = <500000>; + turbo-mode; + }; + + opp-2630000000 { + opp-hz = /bits/ 64 <2630000000>; + clock-latency-ns = <500000>; + turbo-mode; + }; + + opp-2704000000 { + opp-hz = /bits/ 64 <2704000000>; + clock-latency-ns = <500000>; + turbo-mode; + }; + + opp-2802000000 { + opp-hz = /bits/ 64 <2802000000>; + clock-latency-ns = <500000>; + turbo-mode; + }; + + opp-2850000000 { + opp-hz = /bits/ 64 <2850000000>; + clock-latency-ns = <500000>; + turbo-mode; + }; + + /* 2950, 3097 and 3195 MHz stay off, as on stock. */ + }; + psci { compatible = "arm,psci-1.0"; method = "smc"; }; + /* + * Zones on the ACPM TMU sensors (0 big, 1 mid, 2 little, 3 GPU, 4 ISP, + * 5 TPU). Every zone is critical at 110 C, below stock's 120 C "hot" + * trips (Google's gs201-b0.dts). + * + * A CPU zone throttles its cluster from 75 C, as gs101 does: at 75 C + * the mid and big clusters leave their turbo levels at once (states 3 + * and 6: 1999 and 2252 MHz), then step down; at 85 C each cluster + * drops to stock's battery-overcurrent caps (BATOILO in Google's + * gs201-cloudripper-bcl.dtsi): 930, 1197 and 1426 MHz, states 7, 8 + * and 12. Stock throttles from 100 C. + */ + thermal-zones { + big-thermal { + polling-delay-passive = <100>; + polling-delay = <250>; + thermal-sensors = <&acpm_tmu 0>; + + trips { + big_hot: big-hot { + temperature = <75000>; + hysteresis = <5000>; + type = "passive"; + }; + + /* a fast burst outruns step_wise: throttle deep at once */ + big_hotter: big-hotter { + temperature = <85000>; + hysteresis = <5000>; + type = "passive"; + }; + + big_crit: big-crit { + temperature = <110000>; + hysteresis = <0>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&big_hot>; + cooling-device = <&cpu6 6 THERMAL_NO_LIMIT>, + <&cpu7 6 THERMAL_NO_LIMIT>; + }; + + map1 { + trip = <&big_hotter>; + cooling-device = <&cpu6 12 THERMAL_NO_LIMIT>, + <&cpu7 12 THERMAL_NO_LIMIT>; + }; + }; + }; + + mid-thermal { + polling-delay-passive = <100>; + polling-delay = <250>; + thermal-sensors = <&acpm_tmu 1>; + + trips { + mid_hot: mid-hot { + temperature = <75000>; + hysteresis = <5000>; + type = "passive"; + }; + + /* a fast burst outruns step_wise: throttle deep at once */ + mid_hotter: mid-hotter { + temperature = <85000>; + hysteresis = <5000>; + type = "passive"; + }; + + mid_crit: mid-crit { + temperature = <110000>; + hysteresis = <0>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&mid_hot>; + cooling-device = <&cpu4 3 THERMAL_NO_LIMIT>, + <&cpu5 3 THERMAL_NO_LIMIT>; + }; + + map1 { + trip = <&mid_hotter>; + cooling-device = <&cpu4 8 THERMAL_NO_LIMIT>, + <&cpu5 8 THERMAL_NO_LIMIT>; + }; + }; + }; + + little-thermal { + polling-delay-passive = <100>; + polling-delay = <250>; + thermal-sensors = <&acpm_tmu 2>; + + trips { + little_hot: little-hot { + temperature = <75000>; + hysteresis = <5000>; + type = "passive"; + }; + + /* a fast burst outruns step_wise: throttle deep at once */ + little_hotter: little-hotter { + temperature = <85000>; + hysteresis = <5000>; + type = "passive"; + }; + + little_crit: little-crit { + temperature = <110000>; + hysteresis = <0>; + type = "critical"; + }; + }; + + cooling-maps { + map0 { + trip = <&little_hot>; + cooling-device = <&cpu0 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu1 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu2 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>, + <&cpu3 THERMAL_NO_LIMIT THERMAL_NO_LIMIT>; + }; + + map1 { + trip = <&little_hotter>; + cooling-device = <&cpu0 7 THERMAL_NO_LIMIT>, + <&cpu1 7 THERMAL_NO_LIMIT>, + <&cpu2 7 THERMAL_NO_LIMIT>, + <&cpu3 7 THERMAL_NO_LIMIT>; + }; + }; + }; + + gpu-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&acpm_tmu 3>; + + trips { + gpu_crit: gpu-crit { + temperature = <110000>; + hysteresis = <0>; + type = "critical"; + }; + }; + }; + + isp-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&acpm_tmu 4>; + + trips { + isp_crit: isp-crit { + temperature = <110000>; + hysteresis = <0>; + type = "critical"; + }; + }; + }; + + tpu-thermal { + polling-delay-passive = <250>; + polling-delay = <1000>; + thermal-sensors = <&acpm_tmu 5>; + + trips { + tpu_crit: tpu-crit { + temperature = <110000>; + hysteresis = <0>; + type = "critical"; + }; + }; + }; + }; + timer { compatible = "arm,armv8-timer"; interrupts = , @@ -205,6 +690,12 @@ #clock-cells = <1>; mboxes = <&ap2apm_mailbox>; shmem = <&apm_sram>; + + /* TMU sensors, read through the ACPM firmware (channel 9) */ + acpm_tmu: thermal-sensor { + compatible = "google,gs201-acpm-tmu"; + #thermal-sensor-cells = <1>; + }; }; }; diff --git a/drivers/thermal/samsung/Kconfig b/drivers/thermal/samsung/Kconfig index ab491d061b..74fd917870 100644 --- a/drivers/thermal/samsung/Kconfig +++ b/drivers/thermal/samsung/Kconfig @@ -12,7 +12,7 @@ config EXYNOS_THERMAL data from the supported SoCs. config GS101_ACPM_THERMAL - tristate "Google gs101 and Tensor G4 thermal sensors through ACPM" + tristate "Google gs101, Tensor G2 and Tensor G4 thermal sensors through ACPM" depends on THERMAL_OF depends on EXYNOS_ACPM_PROTOCOL help @@ -22,5 +22,5 @@ config GS101_ACPM_THERMAL TMU channel. The driver only reads; the firmware's own hardware trips stay as the bootloader left them. - Say Y or M here on Google gs101 (Pixel 6) and Tensor G4 - (zumapro, Pixel 9a) devices. + Say Y or M here on Google gs101 (Pixel 6), Tensor G2 (gs201, + Pixel 7) and Tensor G4 (zumapro, Pixel 9a) devices. diff --git a/drivers/thermal/samsung/gs101_acpm_tmu.c b/drivers/thermal/samsung/gs101_acpm_tmu.c index 8ea276ce96..7950e9b582 100644 --- a/drivers/thermal/samsung/gs101_acpm_tmu.c +++ b/drivers/thermal/samsung/gs101_acpm_tmu.c @@ -17,8 +17,8 @@ #include /* - * The sensors: BIG, MID, LITTLE, G3D, ISP, TPU, and on zumapro also AUR, - * in the firmware's order. + * The sensors: BIG, MID, LITTLE, G3D, ISP, TPU, and on gs201 and zumapro + * also AUR, in the firmware's order. */ #define GS101_ACPM_TMU_MAX_SENSORS 7 @@ -110,6 +110,11 @@ static const struct gs101_tmu_data gs101_tmu_data = { .nr_sensors = 6, }; +static const struct gs101_tmu_data gs201_tmu_data = { + .acpm_chan = 9, + .nr_sensors = 7, +}; + static const struct gs101_tmu_data zumapro_tmu_data = { .acpm_chan = 9, .nr_sensors = 7, @@ -117,6 +122,7 @@ static const struct gs101_tmu_data zumapro_tmu_data = { static const struct of_device_id gs101_tmu_of_match[] = { { .compatible = "google,gs101-acpm-tmu", .data = &gs101_tmu_data }, + { .compatible = "google,gs201-acpm-tmu", .data = &gs201_tmu_data }, { .compatible = "google,zumapro-acpm-tmu", .data = &zumapro_tmu_data }, { } };