[PATCH V10 0/4] Add support for QCOM SPMI PMIC5 Gen3 ADC

Jishnu Prakash
2026-01-30T11:54:36Z

PMIC5 Gen3 has a similar ADC architecture to that on PMIC5 Gen2,
with all SW communication to ADC going through PMK8550 which
communicates with other PMICs through PBS. The major difference is
that the register interface used here is that of an SDAM present on
PMK8550, rather than a dedicated ADC peripheral. There may be more than one
SDAM used for ADC5 Gen3. Each ADC SDAM has eight channels, each of which may
be used for either immediate reads (same functionality as previous PMIC5 and
PMIC5 Gen2 ADC peripherals) or recurring measurements (same as PMIC5 and PMIC5
Gen2 ADC_TM functionality). In this case, we have VADC and ADC_TM functionality
combined into the same module.

Patch 1 splits out the common ADC channel properties used on older
VADC devices, which would also be reused on ADC5 Gen3, into a common
binding file, to be referenced in Gen3 and other ADC binding files.

Patch 2 adds bindings for ADC5 Gen3 peripheral.

Patch 3 adds the main driver for ADC5 Gen3.

Patch 4 adds the auxiliary thermal driver which supports the ADC_TM
functionality of ADC5 Gen3.

Changes since v9:
- In patch 4, replaced the break statement within scoped_guard() in tm_handler_work()
with return statement to fix the error reported by kernel test robot.

Changes since v8:
- Collected Reviewed-by tag from Krzysztof on patch 2.
- Dropped the common module (drivers/iio/adc/qcom-adc5-gen3-common.c) as suggested
by Dmitry.
- Made changes in patches 3 and 4 to simplify auxiliary device structure to use
module_auxiliary_driver() as requested by Dmitry.
- Updated header files included in all newly added files to follow IWYU
(include-what-you-use) principles as requested by Jonathan.
- Addressed all remaining comments from Jonathan in patches 3 and 4, for
refactoring some code.
- More details about all changes are present in per-patch change logs.
- Link to v8: https://lore.kernel.org/all/20251127134036.209905-1-jishnu.prakash@oss.qualcomm.com/

Changes since v7:
- Based on a discussion with Krzysztof concluded here:
https://lore.kernel.org/all/d10e2eea-4b86-4e1a-b7a0-54c55907a605@oss.qualcomm.com/,
patch 1 in the previous series is updated to move ADC header files from binding to
devicetree folders, as they contain HW constants, not exactly bindings.
Earlier in series v7, patches 3 (Gen3 binding) and 4 (driver) were dependent on
patch 1, as it updated the location of include/dt-bindings/iio/qcom,spmi-vadc.h,
which was used in patches 3 and 4 for Gen3 channel macros. In v8, these macros
will be added in other new files, so the former patch 1 will now be a standalone
change separate from this series, as the other patches here are no longer
dependent on it.
- Patches 2/3/4/5 of v7 are now patches 1/2/3/4 in v8. Below comments refer to
v7 patch numbers.
- Updated description of `reg` property in patch 2 to completely drop mentions of binding
file paths, to simplify it and avoid any dependencies with patch 1.
- Dropped all ADC channel macro definitions from patch 3, updated binding example
correspondingly and fixed formatting inconsistancies in property names, to address
Krzysztof's comments.
- Addressed all comments from Jonathan in driver patches 4 and 5, for fixing formatting
and refactoring some code.
- In patch 4, added ADC5 Gen3 channel macros in qcom-adc5-gen3-common.h, for use in main
driver file. Also added a check to fail probe in case ADC channel value obtained
from devicetree is not among list of supported channels.
- More details about all changes are present in per-patch change logs.
- Link to v7: https://lore.kernel.org/all/20250826083657.4005727-1-jishnu.prakash@oss.qualcomm.com/

Changes since v6:
- Collected Acked-by tags from Jonathan on patches 1, 2 and 3.
- Addressed Neil's comment in patch 3.
- Updated copyright to yearless one in newly added files, following new internal guidelines.
- Addressed all comments from Jonathan on patches 4 and 5 (most importantly for updating
auxiliary device cleanup handling to fix memory freeing issues).
- More details about all changes are present in per-patch change logs.
- Link to v6: https://lore.kernel.org/all/20250509110959.3384306-1-jishnu.prakash@oss.qualcomm.com/

Changes since v5:
- Collected Reviewed-by tag from Krzysztof on patch 2.
- Addressed all comments from Krzysztof and Jonathan on patch 3.
- Addressed all comments from Jonathan on patches 4 and 5.
- More details about all changes are present in per-patch change logs.
- Link to v5: https://lore.kernel.org/all/20250131183242.3653595-1-jishnu.prakash@oss.qualcomm.com/

Changes since v4:
- Split common ADC channel properties out into a separate file to use as
ref for ADC5 Gen3 and moved ADC5 Gen3 documentation into a separate
file as suggested by reviewers.
- Addressed few reviewer comments in driver patches.
- Link to v4: https://lore.kernel.org/all/20241030185854.4015348-1-quic_jprakash@quicinc.com/

Changes since v3:
- Updated files affected by adc file path change in /arch/arm folder,
which were missed earlier.
- Added ADC5 Gen3 documentation changes in existing qcom,spmi-vadc.yaml file
instead of adding separate file and addressed reviewer comments for all bindings.
- Addressed review comments in driver patch. Split out TM functionality into
auxiliary driver in separate patch and added required changes in main driver, as
suggested by Dmitry.
- Link to v3: https://lore.kernel.org/all/20231231171237.3322376-1-quic_jprakash@quicinc.com/

Changes since v2:
- Reordered patches to keep cleanup change for ADC files first.
- Moved ADC5 Gen3 documentation into a separate file

Changes since v1:
- Dropped patches 1-5 for changing 'ADC7' peripheral name to 'ADC5 Gen2'.
- Addressed reviewer comments for binding and driver patches for ADC5 Gen3.
- Combined patches 8-11 into a single patch as requested by reviewers to make
the change clearer and made all fixes required in same patch.

Jishnu Prakash (4):
dt-bindings: iio: adc: Split out QCOM VADC channel properties
dt-bindings: iio: adc: Add support for QCOM PMIC5 Gen3 ADC
iio: adc: Add support for QCOM PMIC5 Gen3 ADC
thermal: qcom: add support for PMIC5 Gen3 ADC thermal monitoring

.../bindings/iio/adc/qcom,spmi-adc5-gen3.yaml | 151 +++
.../iio/adc/qcom,spmi-vadc-common.yaml | 84 ++
.../bindings/iio/adc/qcom,spmi-vadc.yaml | 78 +-
.../bindings/mfd/qcom,spmi-pmic.yaml | 1 +
drivers/iio/adc/Kconfig | 26 +
drivers/iio/adc/Makefile | 1 +
drivers/iio/adc/qcom-spmi-adc5-gen3.c | 860 ++++++++++++++++++
drivers/thermal/qcom/Kconfig | 9 +
drivers/thermal/qcom/Makefile | 1 +
drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c | 512 +++++++++++
include/linux/iio/adc/qcom-adc5-gen3-common.h | 211 +++++
11 files changed, 1860 insertions(+), 74 deletions(-)
create mode 100644 Documentation/devicetree/bindings/iio/adc/qcom,spmi-adc5-gen3.yaml
create mode 100644 Documentation/devicetree/bindings/iio/adc/qcom,spmi-vadc-common.yaml
create mode 100644 drivers/iio/adc/qcom-spmi-adc5-gen3.c
create mode 100644 drivers/thermal/qcom/qcom-spmi-adc-tm5-gen3.c
create mode 100644 include/linux/iio/adc/qcom-adc5-gen3-common.h

base-commit: 63804fed149a6750ffd28610c5c1c98cce6bd377
--
2.25.1