From ec0df9b956a8420189eba29dc4eff09598b6f9d3 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 13:27:38 -0647 Subject: [PATCH 1/2] dt-bindings: firmware: google,gs101-acpm-ipc: Add the Tensor G4 clock ids The Tensor G4 (zumapro) ACPM firmware has 17 DVFS domains, numbered as Google's enum acpm_dvfs_id: MIF, INT, CPUCL0-2, DSU, BCI, G3D, G3DL2, TPU, INTCAM, TNR, CAM, MFC, DISP, AOC and BW. Add their clock ids, and the paired GPU clock after them (17), as gs201's header does, so device trees can name them. Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/soc/google/cal-if/zuma/acpm_dvfs_zuma.h Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- .../dt-bindings/clock/google,zumapro-acpm.h | 35 +++++++++++++++++++ 1 file changed, 35 insertions(+) create mode 100644 include/dt-bindings/clock/google,zumapro-acpm.h diff --git a/include/dt-bindings/clock/google,zumapro-acpm.h b/include/dt-bindings/clock/google,zumapro-acpm.h new file mode 100644 index 0000000000..cdbeff96b2 --- /dev/null +++ b/include/dt-bindings/clock/google,zumapro-acpm.h @@ -0,0 +1,35 @@ +/* SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) */ +/* + * Device Tree binding constants for the clocks of the Google Tensor G4 + * (zumapro) ACPM firmware. + */ + +#ifndef _DT_BINDINGS_CLOCK_GOOGLE_ZUMAPRO_ACPM_H +#define _DT_BINDINGS_CLOCK_GOOGLE_ZUMAPRO_ACPM_H + +/* DVFS domains, numbered as in the firmware messages (enum acpm_dvfs_id). */ +#define ZUMAPRO_CLK_ACPM_DVFS_MIF 0 +#define ZUMAPRO_CLK_ACPM_DVFS_INT 1 +#define ZUMAPRO_CLK_ACPM_DVFS_CPUCL0 2 +#define ZUMAPRO_CLK_ACPM_DVFS_CPUCL1 3 +#define ZUMAPRO_CLK_ACPM_DVFS_CPUCL2 4 +#define ZUMAPRO_CLK_ACPM_DVFS_DSU 5 +#define ZUMAPRO_CLK_ACPM_DVFS_BCI 6 +#define ZUMAPRO_CLK_ACPM_DVFS_G3D 7 +#define ZUMAPRO_CLK_ACPM_DVFS_G3DL2 8 +#define ZUMAPRO_CLK_ACPM_DVFS_TPU 9 +#define ZUMAPRO_CLK_ACPM_DVFS_INTCAM 10 +#define ZUMAPRO_CLK_ACPM_DVFS_TNR 11 +#define ZUMAPRO_CLK_ACPM_DVFS_CAM 12 +#define ZUMAPRO_CLK_ACPM_DVFS_MFC 13 +#define ZUMAPRO_CLK_ACPM_DVFS_DISP 14 +#define ZUMAPRO_CLK_ACPM_DVFS_AOC 15 +#define ZUMAPRO_CLK_ACPM_DVFS_BW 16 + +/* + * The GPU as one clock: its rate is the shader (G3D) rate, and setting it + * also moves the top/L2 domain (G3DL2) to the level paired with it. + */ +#define ZUMAPRO_CLK_ACPM_GPU 17 + +#endif /* _DT_BINDINGS_CLOCK_GOOGLE_ZUMAPRO_ACPM_H */ From e90c23e615c76d5aec4680612548406bee4967e8 Mon Sep 17 00:00:00 2001 From: W4HO <87742609+W4HO-ham@users.noreply.github.com> Date: Tue, 27 Oct 2026 11:35:48 -0647 Subject: [PATCH 2/2] clk: samsung: acpm: Add Tensor G4 (zumapro) with a paired GPU clock The ACPM protocol driver already creates a "zumapro-acpm-clk" child for the Tensor G4, but clk-acpm had no match for it. The G4 firmware has 17 DVFS domains, with DSU, BCI, AOC and BW among them, so the indices differ from gs101's: G3D is 7 and G3DL2 is 8. Add the zumapro variant: the 17 domains as clocks, and a paired "gpu" clock (index 17) that moves G3D and G3DL2 together through the Pixel 9a's GPU DVFS table, the same way the gs201 "gpu" clock does. Its rate is capped by zumapro_gpu_max_khz, read-only by default, as gs201's is. Tested on the Pixel 9a: clk-acpm binds zumapro-acpm-clk in place of the out-of-tree driver it replaces, cpufreq-dt runs the three CPU clusters on cpucl0-2, and with zumapro_gpu_max_khz=890000 panthor's devfreq moves the GPU between 150 and 890 MHz under load. The tested clk-acpm.c is this one (blob 82dae93f4f46). The 940 MHz point was not sent: the cap stayed at 890 MHz. Link: https://android.googlesource.com/kernel/google-modules/soc/gs/+/204078758737776959ecc85c527a00fd2cabb62f/drivers/soc/google/cal-if/zuma/acpm_dvfs_zuma.h Link: https://android.googlesource.com/kernel/devices/google/zuma/+/42395e8adcb880aa336f0da6bb2a19ed53929c40/dts/zuma-gpu.dtsi Link: https://android.googlesource.com/kernel/devices/google/zumapro/+/8831630eee2ad095b85ed452944e6353940966a5/dts/zumapro-gpu.dtsi Signed-off-by: W4HO <87742609+W4HO-ham@users.noreply.github.com> --- drivers/clk/samsung/clk-acpm.c | 77 ++++++++++++++++++++++++++++++++++ 1 file changed, 77 insertions(+) diff --git a/drivers/clk/samsung/clk-acpm.c b/drivers/clk/samsung/clk-acpm.c index 996e69d9df..82dae93f4f 100644 --- a/drivers/clk/samsung/clk-acpm.c +++ b/drivers/clk/samsung/clk-acpm.c @@ -163,6 +163,80 @@ static const struct acpm_clk_driver_data acpm_clk_gs201 = { .mbox_chan_id = 0, }; +/* + * Tensor G4 (zumapro) DVFS domains, in the ACPM firmware's order: there are + * 17, with DSU, BCI, AOC and BW among them, so the indices differ from gs101. + */ +static const struct acpm_clk_variant zumapro_acpm_clks[] = { + ACPM_CLK("mif"), + ACPM_CLK("int"), + ACPM_CLK("cpucl0"), + ACPM_CLK("cpucl1"), + ACPM_CLK("cpucl2"), + ACPM_CLK("dsu"), + ACPM_CLK("bci"), + ACPM_CLK("g3d"), + ACPM_CLK("g3dl2"), + ACPM_CLK("tpu"), + ACPM_CLK("intcam"), + ACPM_CLK("tnr"), + ACPM_CLK("cam"), + ACPM_CLK("mfc"), + ACPM_CLK("disp"), + ACPM_CLK("aoc"), + ACPM_CLK("bw"), +}; + +/* + * zumapro GPU operating points: shader (G3D) rate and the top/L2 (G3DL2) + * rate paired with it, in kHz, from the Pixel 9a's GPU DVFS table (its + * gpu_dvfs_table_v2). 940 MHz is the top level (gpu_dvfs_max_freq in + * Google's zumapro-gpu.dtsi). + */ +static const struct acpm_clk_pair zumapro_gpu_pairs[] = { + { 150000, 160000 }, + { 302000, 386000 }, + { 337000, 430000 }, + { 376000, 531000 }, + { 419000, 531000 }, + { 467000, 659000 }, + { 521000, 659000 }, + { 580000, 749000 }, + { 649000, 749000 }, + { 723000, 900000 }, + { 807000, 900000 }, + { 850000, 900000 }, + { 890000, 900000 }, + { 940000, 950000 }, +}; + +/* As gs201_gpu_max_khz: 0 (the default) leaves the GPU clock read-only. */ +static unsigned int zumapro_gpu_max_khz; +module_param(zumapro_gpu_max_khz, uint, 0644); +MODULE_PARM_DESC(zumapro_gpu_max_khz, + "zumapro: highest GPU shader rate in kHz, 0 = read-only (default)"); + +static const struct acpm_clk_paired zumapro_acpm_paired[] = { + { + .name = "gpu", + .id = 7, /* G3D: shader cores */ + .id2 = 8, /* G3DL2: top level and L2 */ + .pairs = zumapro_gpu_pairs, + .nr_pairs = ARRAY_SIZE(zumapro_gpu_pairs), + .max_khz = &zumapro_gpu_max_khz, + }, +}; + +static const struct acpm_clk_driver_data acpm_clk_zumapro = { + .clks = zumapro_acpm_clks, + .nr_clks = ARRAY_SIZE(zumapro_acpm_clks), + .paired = zumapro_acpm_paired, + .nr_paired = ARRAY_SIZE(zumapro_acpm_paired), + /* Show the firmware's rate, not the last one asked for. */ + .flags = CLK_GET_RATE_NOCACHE, + .mbox_chan_id = 0, +}; + static unsigned long acpm_clk_recalc_rate(struct clk_hw *hw, unsigned long parent_rate) { @@ -402,6 +476,9 @@ static const struct platform_device_id acpm_clk_id[] = { }, { .name = "gs201-acpm-clk", .driver_data = (kernel_ulong_t)&acpm_clk_gs201, + }, { + .name = "zumapro-acpm-clk", + .driver_data = (kernel_ulong_t)&acpm_clk_zumapro, }, { } };