[PATCH v4 0/3] Add Qualcomm SPEL powercap driver
From: Manaf Meethalavalappu Pallikunhi
Date: Sun Dec 06 2026 - 06:56:55 EST
This patch series introduces support for Qualcomm's SPEL (SoC Power
and Electrical Limits) hardware, which provides power monitoring and
limiting capabilities for various power domains in Qualcomm SoCs.
The SPEL hardware enables:
- Real-time energy consumption monitoring across multiple power domains
- Hardware-enforced power limits with configurable time windows
- Support for up to 4 power limits (PL1-PL4) per domain
- Hierarchical power domain organization (SYS -> SOC -> subsystems)
The driver integrates with the Linux powercap framework, exposing SPEL
capabilities through standard sysfs interfaces. This allows userspace
applications and thermal management daemons to monitor energy consumption
and configure power limits for optimal power/performance balance.
This series is based on top of the powercap hierarchy patchset [1], which
is already part of linux-next.
[1] https://lore.kernel.org/all/cover.1793666444.git.daniel.lezcano@xxxxxxxxxxxxxxxx
Signed-off-by: Manaf Meethalavalappu Pallikunhi <manaf.pallikunhi@xxxxxxxxxxxxxxxx>
---
Changes in v4:
- Reworked the driver onto that generic powercap hierarchy API.(Daniel)
- Single self-contained qcom,glymur-spel.yaml moved to Documentation/devicetree/bindings/soc/qcom/
and dropped the separate power-limit-controller.yaml and the power/limits/ path.
- Moved the driver file under powercap/qcom path and added MAINTAINERS update.(Daniel)
- Added hibernation support: spel_domain_pm_freeze()/spel_domain_pm_restore() snapshot and
replay per-domain power limits, time windows, and cumulative energy across a hibernation cycle.
- Fixed two use-after-free bugs: dangling released pointer in spel_create_zone()/spel_probe()
after successful registration, plus a u64 overflow in spel_unit_xlate()'s unit conversion (Sashiko).
- Addressed v3 other review feedback from Daniel/Krzysztof/Konrad/Sashiko/Uwe.
- Preserved fractional unit precision.(Daniel)
- Updated glymur powercap hierarchy nodes and removed usb* nodes.
- Link to v3: https://lore.kernel.org/r/20260702-qcom_spel_driver_upstream-v3-0-434d50f0c5b0@xxxxxxxxxxxxxxxx
Changes in v3:
- Created common power-limit-controller schema under power/limits and described
power-limit-controller device common capabilities.(Krzysztof)
- Created SoC-specific qcom,glymur-spel.yaml file instead of generic one and updated
description and commit.(Krzysztof)
- Used FIELD_MODIFY() macro at different places.(Konrad)
- Updated glymur specific domain info table.(Konrad)
- Updated all for-loops iterator declaration to C99 style.(Konrad)
- Fixed use-after-free bugs.(Sashiko)
- Corrected time_unit documention to reflect the logic.(Sashiko)
- Link to v2: https://lore.kernel.org/r/20260620-qcom_spel_driver_upstream-v2-0-a3ee6837c18f@xxxxxxxxxxxxxxxx
Changes in v2:
- Fixed DT issues: corrected unit-address mismatch and made compatible
platform-specific.(Konrad/Krzysztof)
- Cleaned up bitfield handling: switched to GENMASK, FIELD_* macros.(Konrad)
- Converted hex values to lowercase and simplified array definitions.(Konrad)
- used devm_platform_ioremap_resource_byname().(Konrad)
- Refactored data structures: merged domain data into spel_domain_info
and removed hardcoded limits using ARRAY_SIZE().(Daniel)
- Added bounds checks (TIME_WINDOW_MAX) and fixed time window RMW
handling (preserving reserved bits + firmware notify).(Sashiko)
- Resolved use-after-free, replaced allocation strategy, and
added proper cleanup in .release().(Sashiko)
- Updated time window calculation logic.
- Removed cyclic dependency, improved validation logic, and aligned
naming consistency.(Daniel)
- Link to v1: https://lore.kernel.org/r/20260519-qcom_spel_driver_upstream-v1-0-75356d1b7f94@xxxxxxxxxxxxxxxx
---
Manaf Meethalavalappu Pallikunhi (3):
dt-bindings: soc: qcom: Describe Qualcomm SPEL hardware
powercap: qcom: Add SPEL powercap driver
arm64: dts: qcom: glymur: Enable SPEL powercap driver
.../bindings/soc/qcom/qcom,glymur-spel.yaml | 63 ++
MAINTAINERS | 13 +
arch/arm64/boot/dts/qcom/glymur.dtsi | 10 +
drivers/powercap/Kconfig | 3 +
drivers/powercap/Makefile | 1 +
drivers/powercap/qcom/Kconfig | 13 +
drivers/powercap/qcom/Makefile | 2 +
drivers/powercap/qcom/spel.c | 949 +++++++++++++++++++++
8 files changed, 1054 insertions(+)
---
base-commit: 29beb21c21ada7207692b2d69fc58dcd15dab6e9
change-id: 20261206-qcom_spel_driver_upstream-a5741cbe43ac
Best regards,
--
Manaf Meethalavalappu Pallikunhi <manaf.pallikunhi@xxxxxxxxxxxxxxxx>