This series introduces Runtime Power Management (PM) support for the Raspberry Pi V3D GPU.
Currently, the V3D clock remains enabled for the entire system uptime, even when the GPU is idle. With the introduction of Runtime PM, the clock can now be disabled during idle periods. For example, with this series applied on a Raspberry Pi 5, if we check `vcgencmd measure_clock v3d`, we get: (idle) $ vcgencmd measure_clock v3d frequency(0)=0 (running glmark2) $ vcgencmd measure_clock v3d frequency(0)=960016128 One particular change was required in v3 to ensure a meaningful reduction in idle power consumption: the V3D clock rate must be explicitly set to the minimum rate during suspend. As explained in an inline comment, this is needed as some firmware versions may not fully power off the clock when its state is set to off. This issue can be mitigated by setting the clock rate to 0 during suspend. For this same reason, PATCH 1/6 has been added in v3. Apart from that, the v3d patches are mostly identical to v2, but rebased on top of drm-misc-next. To ease testing in Raspberry Pi 4 and 5, I prepared a downstream branch backporting this series to rpi-6.18.y [1]. [1] https://github.com/mairacanal/linux-rpi/tree/v3d/downstream/power-management-6.18 Best regards, - Maíra --- v1 -> v2: https://lore.kernel.org/r/[email protected] - [1/5] NEW PATCH: "clk: bcm: rpi: Add missing logs if firmware fails" (Stefan Wahren) - [2/5] Remove the "Fixes:" tag (Stefan Wahren) - [2/5] dev_err_ratelimited() instead of dev_err() (Stefan Wahren) - [2/5] Instead of logging the clock ID, use clk_hw_get_name(hw) to log the name (Stefan Wahren) - [2/5] Add a newline character at the end of the log message (Stefan Wahren) - [2/5] Use CLK_IS_CRITICAL for all clocks that can't be disabled (Maxime Ripard) - [3/5] NEW PATCH: "clk: bcm: rpi: Maximize V3D clock" - [4/5] Use devm_reset_control_get_optional_exclusive() (Philipp Zabel) - [4/5] Make sure that resource are cleaned in the inverse order of allocation (Philipp Zabel) v2 -> v3: https://lore.kernel.org/r/[email protected] - Rebased on top of drm-misc-next - Patches "[PATCH v2 1/5] clk: bcm: rpi: Add missing logs if firmware fails", "[PATCH v2 2/5] clk: bcm: rpi: Turn firmware clock on/off when preparing/unpreparing", and "[PATCH v2 3/5] clk: bcm: rpi: Maximize V3D clock" were applied to clk-next. - [1/4] NEW PATCH: "clk: bcm: rpi: Let V3D consumers manage clock rate" - [2/4] NEW PATCH: "clk: bcm: rpi: Mark PIXEL_CLK and HEVC_CLK as CLK_IGNORE_UNUSED" - [3/4] Added Philipp's R-b (Philipp Zabel) - [4/4] s/drm_err/DRM_ERROR - [4/4] Set the clock rate to 0 during suspend and to the maximum rate during resume v3 -> v4: https://lore.kernel.org/r/[email protected] - Rebased on top of drm-misc-next - [1/6, 3/6] Add Melissa's A-b (Melissa Wen) - [2/6] NEW PATCH: "clk: bcm: rpi: Add a comment about RPI_FIRMWARE_SET_CLOCK_STATE behavior" (Stefan Wahren) - [4/6] NEW PATCH: "drm/v3d: Use devm_reset_control_get_optional_exclusive()" (Melissa Wen) - [5/6] Include more context to the commit message (Melissa Wen) - [5/6, 6/6] Instead of creating the function v3d_gem_allocate(), use v3d_gem_init() and move HW initialization out of it (Melissa Wen) --- Maíra Canal (6): clk: bcm: rpi: Let V3D consumers manage clock rate clk: bcm: rpi: Add a comment about RPI_FIRMWARE_SET_CLOCK_STATE behavior clk: bcm: rpi: Mark PIXEL_CLK and HEVC_CLK as CLK_IGNORE_UNUSED drm/v3d: Use devm_reset_control_get_optional_exclusive() drm/v3d: Allocate all resources before enabling the clock drm/v3d: Introduce Runtime Power Management drivers/clk/bcm/clk-raspberrypi.c | 15 ++-- drivers/gpu/drm/v3d/Makefile | 3 +- drivers/gpu/drm/v3d/v3d_debugfs.c | 23 +++++- drivers/gpu/drm/v3d/v3d_drv.c | 163 ++++++++++++++++++-------------------- drivers/gpu/drm/v3d/v3d_drv.h | 21 +++++ drivers/gpu/drm/v3d/v3d_gem.c | 25 +++--- drivers/gpu/drm/v3d/v3d_irq.c | 15 ++-- drivers/gpu/drm/v3d/v3d_mmu.c | 12 ++- drivers/gpu/drm/v3d/v3d_power.c | 96 ++++++++++++++++++++++ drivers/gpu/drm/v3d/v3d_submit.c | 19 ++++- 10 files changed, 273 insertions(+), 119 deletions(-) --- base-commit: 68e28facbc8ab3e701e1814323d397a75b400865 change-id: 20250728-v3d-power-management-eebb2024dc96
