2023-11-21 05:36:17

by Dang Huynh

[permalink] [raw]
Subject: [PATCH v2 0/4] Add PM8937 PMIC support

PM8937 is a power management IC. It is used in various boards with
MSM8917, MSM8937, MSM8940 and APQ variants.

This patchset has been tested on Xiaomi Redmi 4X (MSM8940).

Signed-off-by: Dang Huynh <[email protected]>
---
Changes in v2:
- Remove PATCH 3-6 as it has been picked up.
- Applied suggestions from reviewers.
- Add VDD, GND to VADC.
- Link to v1: https://lore.kernel.org/r/[email protected]

---
Dang Huynh (4):
mfd: qcom-spmi-pmic: Add support for PM8937
dt-bindings: mfd: qcom-spmi-pmic: Document PM8937 PMIC
arm64: dts: qcom: Add PM8937 PMIC
soc: qcom: socinfo: Add PM8937 Power IC

.../devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 1 +
arch/arm64/boot/dts/qcom/pm8937.dtsi | 216 +++++++++++++++++++++
drivers/mfd/qcom-spmi-pmic.c | 1 +
drivers/soc/qcom/socinfo.c | 2 +-
include/soc/qcom/qcom-spmi-pmic.h | 1 +
5 files changed, 220 insertions(+), 1 deletion(-)
---
base-commit: 408a8e748eb5f10026ea9d87f8f218e759101c9a
change-id: 20231106-pm8937-000e423a75fb

Best regards,
--
Dang Huynh <[email protected]>


2023-11-21 05:36:21

by Dang Huynh

[permalink] [raw]
Subject: [PATCH v2 2/4] dt-bindings: mfd: qcom-spmi-pmic: Document PM8937 PMIC

Add bindings for PM8937 PMIC (qcom,pm8937). This PMIC is found in
boards with MSM8917, MSM8937, MSM8940 and APQ variants.

Reviewed-by: Krzysztof Kozlowski <[email protected]>
Signed-off-by: Dang Huynh <[email protected]>
---
Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 1 +
1 file changed, 1 insertion(+)

diff --git a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
index 9fa568603930..8f728920df9e 100644
--- a/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
+++ b/Documentation/devicetree/bindings/mfd/qcom,spmi-pmic.yaml
@@ -66,6 +66,7 @@ properties:
- qcom,pm8841
- qcom,pm8909
- qcom,pm8916
+ - qcom,pm8937
- qcom,pm8941
- qcom,pm8950
- qcom,pm8953

--
2.42.1

2023-11-21 05:36:26

by Dang Huynh

[permalink] [raw]
Subject: [PATCH v2 3/4] arm64: dts: qcom: Add PM8937 PMIC

The PM8937 features integrated peripherals like ADC, GPIO controller,
MPPs, PON keys and others.

Add the device tree so that any boards with this PMIC can use it.

Reviewed-by: Dmitry Baryshkov <[email protected]>
Signed-off-by: Dang Huynh <[email protected]>
---
arch/arm64/boot/dts/qcom/pm8937.dtsi | 216 +++++++++++++++++++++++++++++++++++
1 file changed, 216 insertions(+)

diff --git a/arch/arm64/boot/dts/qcom/pm8937.dtsi b/arch/arm64/boot/dts/qcom/pm8937.dtsi
new file mode 100644
index 000000000000..34e2b4cd0d5f
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/pm8937.dtsi
@@ -0,0 +1,216 @@
+// SPDX-License-Identifier: BSD-3-Clause
+/*
+ * Copyright (c) 2023, Dang Huynh <[email protected]>
+ */
+
+#include <dt-bindings/iio/qcom,spmi-vadc.h>
+#include <dt-bindings/input/linux-event-codes.h>
+#include <dt-bindings/interrupt-controller/irq.h>
+#include <dt-bindings/pinctrl/qcom,pmic-mpp.h>
+#include <dt-bindings/spmi/spmi.h>
+
+/ {
+ thermal-zones {
+ pm8937-thermal {
+ polling-delay-passive = <0>;
+ polling-delay = <0>;
+ thermal-sensors = <&pm8937_temp>;
+
+ trips {
+ trip0 {
+ temperature = <105000>;
+ hysteresis = <0>;
+ type = "passive";
+ };
+
+ trip1 {
+ temperature = <125000>;
+ hysteresis = <0>;
+ type = "hot";
+ };
+
+ trip2 {
+ temperature = <145000>;
+ hysteresis = <0>;
+ type = "critical";
+ };
+ };
+ };
+ };
+};
+
+&spmi_bus {
+ pmic@0 {
+ compatible = "qcom,pm8937", "qcom,spmi-pmic";
+ reg = <0x0 SPMI_USID>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pon@800 {
+ compatible = "qcom,pm8916-pon";
+ reg = <0x800>;
+ mode-bootloader = <0x2>;
+ mode-recovery = <0x1>;
+
+ pm8937_pwrkey: pwrkey {
+ compatible = "qcom,pm8941-pwrkey";
+ interrupts = <0 0x8 0 IRQ_TYPE_EDGE_BOTH>;
+ debounce = <15625>;
+ bias-pull-up;
+ linux,code = <KEY_POWER>;
+ };
+
+ pm8937_resin: resin {
+ compatible = "qcom,pm8941-resin";
+ interrupts = <0 0x8 1 IRQ_TYPE_EDGE_BOTH>;
+ debounce = <15625>;
+ bias-pull-up;
+ status = "disabled";
+ };
+ };
+
+ pm8937_gpios: gpio@c000 {
+ compatible = "qcom,pm8937-gpio", "qcom,spmi-gpio";
+ reg = <0xc000>;
+ gpio-controller;
+ gpio-ranges = <&pm8937_gpios 0 0 8>;
+ #gpio-cells = <2>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+
+ pm8937_mpps: mpps@a000 {
+ compatible = "qcom,pm8937-mpp", "qcom,spmi-mpp";
+ reg = <0xa000>;
+ gpio-controller;
+ gpio-ranges = <&pm8937_mpps 0 0 4>;
+ #gpio-cells = <2>;
+ interrupt-controller;
+ #interrupt-cells = <2>;
+ };
+
+ pm8937_temp: temp-alarm@2400 {
+ compatible = "qcom,spmi-temp-alarm";
+ reg = <0x2400>;
+ interrupts = <0 0x24 0 IRQ_TYPE_EDGE_RISING>;
+ io-channels = <&pm8937_vadc VADC_DIE_TEMP>;
+ io-channel-names = "thermal";
+ #thermal-sensor-cells = <0>;
+ };
+
+ pm8937_vadc: adc@3100 {
+ compatible = "qcom,spmi-vadc";
+ reg = <0x3100>;
+ interrupts = <0 0x31 0 IRQ_TYPE_EDGE_RISING>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+ #io-channel-cells = <1>;
+
+ channel@5 {
+ reg = <VADC_VCOIN>;
+ qcom,pre-scaling = <1 1>;
+ label = "vcoin";
+ };
+
+ channel@7 {
+ reg = <VADC_VSYS>;
+ qcom,pre-scaling = <1 1>;
+ label = "vph_pwr";
+ };
+
+ channel@8 {
+ reg = <VADC_DIE_TEMP>;
+ qcom,pre-scaling = <1 1>;
+ label = "die_temp";
+ };
+
+ channel@9 {
+ reg = <VADC_REF_625MV>;
+ qcom,pre-scaling = <1 1>;
+ label = "ref_625mv";
+ };
+
+ channel@a {
+ reg = <VADC_REF_1250MV>;
+ qcom,pre-scaling = <1 1>;
+ label = "ref_1250mv";
+ };
+
+ channel@c {
+ reg = <VADC_SPARE1>;
+ qcom,pre-scaling = <1 1>;
+ label = "ref_buf_625mv";
+ };
+
+ channel@e {
+ reg = <VADC_GND_REF>;
+ qcom,pre-scaling = <1 1>;
+ label = "ref_gnd";
+ };
+
+ channel@f {
+ reg = <VADC_VDD_VADC>;
+ qcom,pre-scaling = <1 1>;
+ label = "ref_vdd";
+ };
+
+ channel@11 {
+ reg = <VADC_P_MUX2_1_1>;
+ qcom,pre-scaling = <1 1>;
+ qcom,ratiometric;
+ qcom,hw-settle-time = <200>;
+ label = "pa_therm1";
+ };
+
+ channel@13 {
+ reg = <VADC_P_MUX4_1_1>;
+ qcom,pre-scaling = <1 1>;
+ qcom,ratiometric;
+ qcom,hw-settle-time = <200>;
+ label = "case_therm";
+ };
+
+ channel@32 {
+ reg = <VADC_LR_MUX3_XO_THERM>;
+ qcom,pre-scaling = <1 1>;
+ qcom,ratiometric;
+ qcom,hw-settle-time = <200>;
+ label = "xo_therm";
+ };
+
+ channel@36 {
+ reg = <VADC_LR_MUX7_HW_ID>;
+ qcom,pre-scaling = <1 1>;
+ qcom,ratiometric;
+ qcom,hw-settle-time = <200>;
+ label = "pa_therm0";
+ };
+
+ channel@3c {
+ reg = <VADC_LR_MUX3_BUF_XO_THERM>;
+ qcom,pre-scaling = <1 1>;
+ qcom,ratiometric;
+ qcom,hw-settle-time = <200>;
+ label = "xo_therm_buf";
+ };
+ };
+
+ rtc@6000 {
+ compatible = "qcom,pm8941-rtc";
+ reg = <0x6000>, <0x6100>;
+ reg-names = "rtc", "alarm";
+ interrupts = <0x0 0x61 0x1 IRQ_TYPE_EDGE_RISING>;
+ };
+ };
+
+ pmic@1 {
+ compatible = "qcom,pm8937", "qcom,spmi-pmic";
+ reg = <0x1 SPMI_USID>;
+ #address-cells = <1>;
+ #size-cells = <0>;
+
+ pm8937_spmi_regulators: regulators {
+ compatible = "qcom,pm8937-regulators";
+ };
+ };
+};

--
2.42.1

2023-11-21 05:36:42

by Dang Huynh

[permalink] [raw]
Subject: [PATCH v2 4/4] soc: qcom: socinfo: Add PM8937 Power IC

The PM8917 and PM8937 uses the same SUBTYPE ID.

The PM8937 is found in boards with MSM8917, MSM8937 and MSM8940
and APQ variants.

Signed-off-by: Dang Huynh <[email protected]>
---
drivers/soc/qcom/socinfo.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/soc/qcom/socinfo.c b/drivers/soc/qcom/socinfo.c
index 51e05bec5bfc..37692fc1aefb 100644
--- a/drivers/soc/qcom/socinfo.c
+++ b/drivers/soc/qcom/socinfo.c
@@ -93,7 +93,7 @@ static const char *const pmic_models[] = {
[22] = "PM8821",
[23] = "PM8038",
[24] = "PM8005/PM8922",
- [25] = "PM8917",
+ [25] = "PM8917/PM8937",
[26] = "PM660L",
[27] = "PM660",
[30] = "PM8150",

--
2.42.1

2023-11-22 16:47:38

by Konrad Dybcio

[permalink] [raw]
Subject: Re: [PATCH v2 3/4] arm64: dts: qcom: Add PM8937 PMIC



On 11/21/23 06:35, Dang Huynh wrote:
> The PM8937 features integrated peripherals like ADC, GPIO controller,
> MPPs, PON keys and others.
>
> Add the device tree so that any boards with this PMIC can use it.
>
> Reviewed-by: Dmitry Baryshkov <[email protected]>
> Signed-off-by: Dang Huynh <[email protected]>
> ---
No users?

Konrad

2023-11-23 17:16:41

by Lee Jones

[permalink] [raw]
Subject: Re: (subset) [PATCH v2 0/4] Add PM8937 PMIC support

On Tue, 21 Nov 2023 12:34:58 +0700, Dang Huynh wrote:
> PM8937 is a power management IC. It is used in various boards with
> MSM8917, MSM8937, MSM8940 and APQ variants.
>
> This patchset has been tested on Xiaomi Redmi 4X (MSM8940).
>
>

Applied, thanks!

[1/4] mfd: qcom-spmi-pmic: Add support for PM8937
commit: 587fcef6762cef9f44eb1aadc294d515262e6da3
[2/4] dt-bindings: mfd: qcom-spmi-pmic: Document PM8937 PMIC
commit: 2a7b788e2ee041ee8b96481952b3cf4bebed60f3

--
Lee Jones [李琼斯]

2023-12-08 14:51:25

by Bjorn Andersson

[permalink] [raw]
Subject: Re: (subset) [PATCH v2 0/4] Add PM8937 PMIC support


On Tue, 21 Nov 2023 12:34:58 +0700, Dang Huynh wrote:
> PM8937 is a power management IC. It is used in various boards with
> MSM8917, MSM8937, MSM8940 and APQ variants.
>
> This patchset has been tested on Xiaomi Redmi 4X (MSM8940).
>
>

Applied, thanks!

[4/4] soc: qcom: socinfo: Add PM8937 Power IC
commit: d50b5cb1a8f7db8ad2dc6a13f0cabedf7a7e1540

Best regards,
--
Bjorn Andersson <[email protected]>