2023-11-06 12:10:37

by Dang Huynh

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

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

Signed-off-by: Dang Huynh <[email protected]>
---
Dang Huynh (8):
mfd: qcom-spmi-pmic: Add support for PM8937
dt-bindings: mfd: qcom-spmi-pmic: Document PM8937 PMIC
regulator: qcom_spmi: Add PM8937 SPMI regulator
dt-bindings: regulator: qcom,spmi-regulator: Document PM8937 PMIC
regulator: qcom_smd: Add PM8937 regulators
dt-bindings: regulator: qcom,smd-rpm-regulator: Document PM8937 IC
arm64: dts: qcom: Add PM8937 PMIC
soc: qcom: socinfo: Add PM8937 Power IC

.../devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 1 +
.../bindings/regulator/qcom,smd-rpm-regulator.yaml | 4 +
.../bindings/regulator/qcom,spmi-regulator.yaml | 19 ++
arch/arm64/boot/dts/qcom/pm8937.dtsi | 202 +++++++++++++++++++++
drivers/mfd/qcom-spmi-pmic.c | 1 +
drivers/regulator/qcom_smd-regulator.c | 34 ++++
drivers/regulator/qcom_spmi-regulator.c | 34 ++++
drivers/soc/qcom/socinfo.c | 2 +-
include/soc/qcom/qcom-spmi-pmic.h | 1 +
9 files changed, 297 insertions(+), 1 deletion(-)
---
base-commit: 12c9e8890929813dc852d9739f8d900ff51d9814
change-id: 20231106-pm8937-000e423a75fb

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


2023-11-06 12:10:53

by Dang Huynh

[permalink] [raw]
Subject: [PATCH 5/8] regulator: qcom_smd: Add PM8937 regulators

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

It provides 6 SMPS (two are controlled by SPMI) and 23 LDO regulators.

Signed-off-by: Dang Huynh <[email protected]>
---
drivers/regulator/qcom_smd-regulator.c | 34 ++++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c
index f53ada076252..09c471a0ba2e 100644
--- a/drivers/regulator/qcom_smd-regulator.c
+++ b/drivers/regulator/qcom_smd-regulator.c
@@ -1012,6 +1012,39 @@ static const struct rpm_regulator_data rpm_pm8916_regulators[] = {
{}
};

+static const struct rpm_regulator_data rpm_pm8937_regulators[] = {
+ { "s1", QCOM_SMD_RPM_SMPA, 1, &pm8994_hfsmps, "vdd_s1" },
+ { "s2", QCOM_SMD_RPM_SMPA, 2, &pm8994_hfsmps, "vdd_s2" },
+ { "s3", QCOM_SMD_RPM_SMPA, 3, &pm8994_hfsmps, "vdd_s3" },
+ { "s4", QCOM_SMD_RPM_SMPA, 4, &pm8994_hfsmps, "vdd_s4" },
+ /* S5 - S6 are managed by SPMI */
+
+ { "l1", QCOM_SMD_RPM_LDOA, 1, &pm8953_ult_nldo, "vdd_l1_l19" },
+ { "l2", QCOM_SMD_RPM_LDOA, 2, &pm8953_ult_nldo, "vdd_l2_l23" },
+ { "l3", QCOM_SMD_RPM_LDOA, 3, &pm8953_ult_nldo, "vdd_l3" },
+ { "l4", QCOM_SMD_RPM_LDOA, 4, &pm8950_ult_pldo, "vdd_l4_l5_l6_l7_l16" },
+ { "l5", QCOM_SMD_RPM_LDOA, 5, &pm8950_ult_pldo, "vdd_l4_l5_l6_l7_l16" },
+ { "l6", QCOM_SMD_RPM_LDOA, 6, &pm8950_ult_pldo, "vdd_l4_l5_l6_l7_l16" },
+ { "l7", QCOM_SMD_RPM_LDOA, 7, &pm8950_ult_pldo, "vdd_l4_l5_l6_l7_l16" },
+ { "l8", QCOM_SMD_RPM_LDOA, 8, &pm8950_ult_pldo, "vdd_l8_l11_l12_l17_l22" },
+ { "l9", QCOM_SMD_RPM_LDOA, 9, &pm8950_ult_pldo, "vdd_l9_l10_l13_l14_l15_l18" },
+ { "l10", QCOM_SMD_RPM_LDOA, 10, &pm8950_ult_pldo, "vdd_l9_l10_l13_l14_l15_l18"},
+ { "l11", QCOM_SMD_RPM_LDOA, 11, &pm8950_ult_pldo, "vdd_l8_l11_l12_l17_l22" },
+ { "l12", QCOM_SMD_RPM_LDOA, 12, &pm8950_ult_pldo, "vdd_l8_l11_l12_l17_l22" },
+ { "l13", QCOM_SMD_RPM_LDOA, 13, &pm8950_ult_pldo, "vdd_l9_l10_l13_l14_l15_l18" },
+ { "l14", QCOM_SMD_RPM_LDOA, 14, &pm8950_ult_pldo, "vdd_l9_l10_l13_l14_l15_l18" },
+ { "l15", QCOM_SMD_RPM_LDOA, 15, &pm8950_ult_pldo, "vdd_l9_l10_l13_l14_l15_l18" },
+ { "l16", QCOM_SMD_RPM_LDOA, 16, &pm8950_ult_pldo, "vdd_l4_l5_l6_l7_l16" },
+ { "l17", QCOM_SMD_RPM_LDOA, 17, &pm8950_ult_pldo, "vdd_l8_l11_l12_l17_l22" },
+ { "l18", QCOM_SMD_RPM_LDOA, 18, &pm8950_ult_pldo, "vdd_l9_l10_l13_l14_l15_l18" },
+ { "l19", QCOM_SMD_RPM_LDOA, 19, &pm8953_ult_nldo, "vdd_l1_l19" },
+ { "l20", QCOM_SMD_RPM_LDOA, 20, &pm8953_lnldo, "vdd_l20_l21" },
+ { "l21", QCOM_SMD_RPM_LDOA, 21, &pm8953_lnldo, "vdd_l20_l21" },
+ { "l22", QCOM_SMD_RPM_LDOA, 22, &pm8950_ult_pldo, "vdd_l8_l11_l12_l17_l22" },
+ { "l23", QCOM_SMD_RPM_LDOA, 23, &pm8994_nldo, "vdd_l2_l23" },
+ {}
+};
+
static const struct rpm_regulator_data rpm_pm8941_regulators[] = {
{ "s1", QCOM_SMD_RPM_SMPA, 1, &pm8x41_hfsmps, "vdd_s1" },
{ "s2", QCOM_SMD_RPM_SMPA, 2, &pm8x41_hfsmps, "vdd_s2" },
@@ -1329,6 +1362,7 @@ static const struct of_device_id rpm_of_match[] = {
{ .compatible = "qcom,rpm-pm8841-regulators", .data = &rpm_pm8841_regulators },
{ .compatible = "qcom,rpm-pm8909-regulators", .data = &rpm_pm8909_regulators },
{ .compatible = "qcom,rpm-pm8916-regulators", .data = &rpm_pm8916_regulators },
+ { .compatible = "qcom,rpm-pm8937-regulators", .data = &rpm_pm8937_regulators },
{ .compatible = "qcom,rpm-pm8941-regulators", .data = &rpm_pm8941_regulators },
{ .compatible = "qcom,rpm-pm8950-regulators", .data = &rpm_pm8950_regulators },
{ .compatible = "qcom,rpm-pm8953-regulators", .data = &rpm_pm8953_regulators },

--
2.42.1

2023-11-06 12:11:02

by Dang Huynh

[permalink] [raw]
Subject: [PATCH 8/8] 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-06 12:11:05

by Dang Huynh

[permalink] [raw]
Subject: [PATCH 7/8] 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.

Signed-off-by: Dang Huynh <[email protected]>
---
arch/arm64/boot/dts/qcom/pm8937.dtsi | 202 +++++++++++++++++++++++++++++++++++
1 file changed, 202 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..6091d6938885
--- /dev/null
+++ b/arch/arm64/boot/dts/qcom/pm8937.dtsi
@@ -0,0 +1,202 @@
+// 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 {
+ pm8937_trip0: pm8937-trip0 {
+ temperature = <105000>;
+ hysteresis = <0>;
+ type = "passive";
+ };
+ pm8937_trip1: pm8937-trip1 {
+ temperature = <125000>;
+ hysteresis = <0>;
+ type = "passive";
+ };
+ pm8937_trip2: pm8937-trip2 {
+ temperature = <145000>;
+ hysteresis = <0>;
+ type = "passive";
+ };
+ };
+ };
+ };
+};
+
+&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;
+ linux,code = <KEY_VOLUMEDOWN>;
+ };
+ };
+
+ 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@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_NONE>;
+ };
+ };
+
+ 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-06 12:15:32

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH 5/8] regulator: qcom_smd: Add PM8937 regulators

On Mon, 6 Nov 2023 at 14:11, Dang Huynh <[email protected]> wrote:
>
> The PM8937 is found on boards with MSM8917, MSM8937, MSM8940 SoCs and
> APQ variants.
>
> It provides 6 SMPS (two are controlled by SPMI) and 23 LDO regulators.
>
> Signed-off-by: Dang Huynh <[email protected]>

I haven't checked LDO / SMPS types. Other than that:

Reviewed-by: Dmitry Baryshkov <[email protected]>

> ---
> drivers/regulator/qcom_smd-regulator.c | 34 ++++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)

--
With best wishes
Dmitry

2023-11-06 12:17:06

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH 0/8] Add PM8937 PMIC support

On Mon, 6 Nov 2023 at 14:11, Dang Huynh <[email protected]> wrote:
>
> PM8937 is a power management IC. It is used in various boards with
> MSM8917, MSM8937, MSM8940 and APQ variants.
>
> Signed-off-by: Dang Huynh <[email protected]>
> ---
> Dang Huynh (8):
> mfd: qcom-spmi-pmic: Add support for PM8937
> dt-bindings: mfd: qcom-spmi-pmic: Document PM8937 PMIC
> regulator: qcom_spmi: Add PM8937 SPMI regulator
> dt-bindings: regulator: qcom,spmi-regulator: Document PM8937 PMIC
> regulator: qcom_smd: Add PM8937 regulators
> dt-bindings: regulator: qcom,smd-rpm-regulator: Document PM8937 IC
> arm64: dts: qcom: Add PM8937 PMIC
> soc: qcom: socinfo: Add PM8937 Power IC

It seems that some of the patches didn't get it to linux-arm-msm@.
Could you please check, what was wrong and resend your patchset?

>
> .../devicetree/bindings/mfd/qcom,spmi-pmic.yaml | 1 +
> .../bindings/regulator/qcom,smd-rpm-regulator.yaml | 4 +
> .../bindings/regulator/qcom,spmi-regulator.yaml | 19 ++
> arch/arm64/boot/dts/qcom/pm8937.dtsi | 202 +++++++++++++++++++++
> drivers/mfd/qcom-spmi-pmic.c | 1 +
> drivers/regulator/qcom_smd-regulator.c | 34 ++++
> drivers/regulator/qcom_spmi-regulator.c | 34 ++++
> drivers/soc/qcom/socinfo.c | 2 +-
> include/soc/qcom/qcom-spmi-pmic.h | 1 +
> 9 files changed, 297 insertions(+), 1 deletion(-)
> ---
> base-commit: 12c9e8890929813dc852d9739f8d900ff51d9814
> change-id: 20231106-pm8937-000e423a75fb
>
> Best regards,
> --
> Dang Huynh <[email protected]>
>


--
With best wishes
Dmitry

2023-11-06 12:18:18

by Dang Huynh

[permalink] [raw]
Subject: [PATCH 1/8] mfd: qcom-spmi-pmic: Add support for PM8937

Add the subtype and compatible strings for PM8937.

The PM8937 is found in various SoCs, including MSM8917, MSM8937,
MSM8940 and APQ variants.

Signed-off-by: Dang Huynh <[email protected]>
---
drivers/mfd/qcom-spmi-pmic.c | 1 +
include/soc/qcom/qcom-spmi-pmic.h | 1 +
2 files changed, 2 insertions(+)

diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c
index 4549fa9f7d4b..eab5bf6cff10 100644
--- a/drivers/mfd/qcom-spmi-pmic.c
+++ b/drivers/mfd/qcom-spmi-pmic.c
@@ -53,6 +53,7 @@ static const struct of_device_id pmic_spmi_id_table[] = {
{ .compatible = "qcom,pm8901", .data = N_USIDS(2) },
{ .compatible = "qcom,pm8909", .data = N_USIDS(2) },
{ .compatible = "qcom,pm8916", .data = N_USIDS(2) },
+ { .compatible = "qcom,pm8937", .data = N_USIDS(2) },
{ .compatible = "qcom,pm8941", .data = N_USIDS(2) },
{ .compatible = "qcom,pm8950", .data = N_USIDS(2) },
{ .compatible = "qcom,pm8994", .data = N_USIDS(2) },
diff --git a/include/soc/qcom/qcom-spmi-pmic.h b/include/soc/qcom/qcom-spmi-pmic.h
index c47cc71a999e..17a0a8c3d656 100644
--- a/include/soc/qcom/qcom-spmi-pmic.h
+++ b/include/soc/qcom/qcom-spmi-pmic.h
@@ -31,6 +31,7 @@
#define PM8998_SUBTYPE 0x14
#define PMI8998_SUBTYPE 0x15
#define PM8005_SUBTYPE 0x18
+#define PM8937_SUBTYPE 0x19
#define PM660L_SUBTYPE 0x1a
#define PM660_SUBTYPE 0x1b
#define PM8150_SUBTYPE 0x1e

--
2.42.1

2023-11-06 12:18:25

by Dang Huynh

[permalink] [raw]
Subject: [PATCH 2/8] 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.

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-06 12:18:31

by Dang Huynh

[permalink] [raw]
Subject: [PATCH 3/8] regulator: qcom_spmi: Add PM8937 SPMI regulator

The PM8937 has 4 HFSMPS, 2 FTSMPS2.5 (for controlling APC voltage)
and 23 LDO regulators.
Add the configuration for this chip.

Signed-off-by: Dang Huynh <[email protected]>
---
drivers/regulator/qcom_spmi-regulator.c | 34 +++++++++++++++++++++++++++++++++
1 file changed, 34 insertions(+)

diff --git a/drivers/regulator/qcom_spmi-regulator.c b/drivers/regulator/qcom_spmi-regulator.c
index 94f9092b29ef..9a9fa20dcd95 100644
--- a/drivers/regulator/qcom_spmi-regulator.c
+++ b/drivers/regulator/qcom_spmi-regulator.c
@@ -2239,6 +2239,39 @@ static const struct spmi_regulator_data pm8916_regulators[] = {
{ }
};

+static const struct spmi_regulator_data pm8937_regulators[] = {
+ { "s1", 0x1400, "vdd_s1", },
+ { "s2", 0x1700, "vdd_s2", },
+ { "s3", 0x1a00, "vdd_s3", },
+ { "s4", 0x1d00, "vdd_s4", },
+ { "s5", 0x2000, "vdd_s5", },
+ { "s6", 0x2300, "vdd_s6", },
+ { "l1", 0x4000, "vdd_l1_l19", },
+ { "l2", 0x4100, "vdd_l2_l23", },
+ { "l3", 0x4200, "vdd_l3", },
+ { "l4", 0x4300, "vdd_l4_l5_l6_l7_l16", },
+ { "l5", 0x4400, "vdd_l4_l5_l6_l7_l16", },
+ { "l6", 0x4500, "vdd_l4_l5_l6_l7_l16", },
+ { "l7", 0x4600, "vdd_l4_l5_l6_l7_l16", },
+ { "l8", 0x4700, "vdd_l8_l11_l12_l17_l22", },
+ { "l9", 0x4800, "vdd_l9_l10_l13_l14_l15_l18", },
+ { "l10", 0x4900, "vdd_l9_l10_l13_l14_l15_l18", },
+ { "l11", 0x4a00, "vdd_l8_l11_l12_l17_l22", },
+ { "l12", 0x4b00, "vdd_l8_l11_l12_l17_l22", },
+ { "l13", 0x4c00, "vdd_l9_l10_l13_l14_l15_l18", },
+ { "l14", 0x4d00, "vdd_l9_l10_l13_l14_l15_l18", },
+ { "l15", 0x4e00, "vdd_l9_l10_l13_l14_l15_l18", },
+ { "l16", 0x4f00, "vdd_l4_l5_l6_l7_l16", },
+ { "l17", 0x5000, "vdd_l8_l11_l12_l17_l22", },
+ { "l18", 0x5100, "vdd_l9_l10_l13_l14_l15_l18", },
+ { "l19", 0x5200, "vdd_l1_l19", },
+ { "l20", 0x5300, "vdd_l20_l21", },
+ { "l21", 0x5400, "vdd_l21_l21", },
+ { "l22", 0x5500, "vdd_l8_l11_l12_l17_l22", },
+ { "l23", 0x5600, "vdd_l2_l23", },
+ { }
+};
+
static const struct spmi_regulator_data pm8941_regulators[] = {
{ "s1", 0x1400, "vdd_s1", },
{ "s2", 0x1700, "vdd_s2", },
@@ -2453,6 +2486,7 @@ static const struct of_device_id qcom_spmi_regulator_match[] = {
{ .compatible = "qcom,pm8841-regulators", .data = &pm8841_regulators },
{ .compatible = "qcom,pm8909-regulators", .data = &pm8909_regulators },
{ .compatible = "qcom,pm8916-regulators", .data = &pm8916_regulators },
+ { .compatible = "qcom,pm8937-regulators", .data = &pm8937_regulators },
{ .compatible = "qcom,pm8941-regulators", .data = &pm8941_regulators },
{ .compatible = "qcom,pm8950-regulators", .data = &pm8950_regulators },
{ .compatible = "qcom,pm8994-regulators", .data = &pm8994_regulators },

--
2.42.1

2023-11-06 12:18:40

by Dang Huynh

[permalink] [raw]
Subject: [PATCH 4/8] dt-bindings: regulator: qcom,spmi-regulator: Document PM8937 PMIC

Add support for qcom,pm8937-regulators compatible string and add
relevant supplies in QCOM's SPMI regulator documentation.

Signed-off-by: Dang Huynh <[email protected]>
---
.../bindings/regulator/qcom,spmi-regulator.yaml | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
index 7a1b7d2abbd4..aea849e8eadf 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/qcom,spmi-regulator.yaml
@@ -22,6 +22,7 @@ properties:
- qcom,pm8841-regulators
- qcom,pm8909-regulators
- qcom,pm8916-regulators
+ - qcom,pm8937-regulators
- qcom,pm8941-regulators
- qcom,pm8950-regulators
- qcom,pm8994-regulators
@@ -291,6 +292,24 @@ allOf:
patternProperties:
"^vdd_s[1-3]-supply$": true

+ - if:
+ properties:
+ compatible:
+ contains:
+ enum:
+ - qcom,pm8937-regulators
+ then:
+ properties:
+ vdd_l1_l19-supply: true
+ vdd_l20_l21-supply: true
+ vdd_l2_l23-supply: true
+ vdd_l3-supply: true
+ vdd_l4_l5_l6_l7_l16-supply: true
+ vdd_l8_l11_l12_l17_l22-supply: true
+ vdd_l9_l10_l13_l14_l15_l18-supply: true
+ patternProperties:
+ "^vdd_s[1-6]-supply$": true
+
- if:
properties:
compatible:

--
2.42.1

2023-11-06 12:18:49

by Dang Huynh

[permalink] [raw]
Subject: [PATCH 6/8] dt-bindings: regulator: qcom,smd-rpm-regulator: Document PM8937 IC

Document the pm8937 compatible string and available regulators in
the QCOM SMD RPM regulator documentation.

Signed-off-by: Dang Huynh <[email protected]>
---
.../devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml | 4 ++++
1 file changed, 4 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml
index 9ea8ac0786ac..f2fd2df68a9e 100644
--- a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml
+++ b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml
@@ -47,6 +47,9 @@ description:
For pm8916, s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
l12, l13, l14, l15, l16, l17, l18

+ For pm8937, s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10,
+ l11, l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22, l23
+
For pm8941, s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2,
lvs3, 5vs1, 5vs2
@@ -92,6 +95,7 @@ properties:
- qcom,rpm-pm8841-regulators
- qcom,rpm-pm8909-regulators
- qcom,rpm-pm8916-regulators
+ - qcom,rpm-pm8937-regulators
- qcom,rpm-pm8941-regulators
- qcom,rpm-pm8950-regulators
- qcom,rpm-pm8953-regulators

--
2.42.1

2023-11-06 12:21:20

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH 7/8] arm64: dts: qcom: Add PM8937 PMIC

On Mon, 6 Nov 2023 at 14:11, Dang Huynh <[email protected]> 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.
>
> Signed-off-by: Dang Huynh <[email protected]>
> ---
> arch/arm64/boot/dts/qcom/pm8937.dtsi | 202 +++++++++++++++++++++++++++++++++++
> 1 file changed, 202 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..6091d6938885
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/pm8937.dtsi
> @@ -0,0 +1,202 @@
> +// 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 {
> + pm8937_trip0: pm8937-trip0 {

I don't think you need labels here. Also you can drop PMIC name from
trip point node names.

> + temperature = <105000>;
> + hysteresis = <0>;
> + type = "passive";
> + };
> + pm8937_trip1: pm8937-trip1 {
> + temperature = <125000>;
> + hysteresis = <0>;
> + type = "passive";
> + };
> + pm8937_trip2: pm8937-trip2 {
> + temperature = <145000>;
> + hysteresis = <0>;
> + type = "passive";

145°C is very hot for the passive trip point

Comparing this with other platforms, 125°C can be "hot" and 145°C is "critical".

Other than that:

Reviewed-by: Dmitry Baryshkov <[email protected]>

> + };
> + };
> + };
> + };
> +};


--
With best wishes
Dmitry

2023-11-06 12:36:29

by Dmitry Baryshkov

[permalink] [raw]
Subject: Re: [PATCH 3/8] regulator: qcom_spmi: Add PM8937 SPMI regulator

On Mon, 6 Nov 2023 at 14:19, Dang Huynh <[email protected]> wrote:
>
> The PM8937 has 4 HFSMPS, 2 FTSMPS2.5 (for controlling APC voltage)
> and 23 LDO regulators.
> Add the configuration for this chip.
>
> Signed-off-by: Dang Huynh <[email protected]>
> ---
> drivers/regulator/qcom_spmi-regulator.c | 34 +++++++++++++++++++++++++++++++++
> 1 file changed, 34 insertions(+)

Reviewed-by: Dmitry Baryshkov <[email protected]>



--
With best wishes
Dmitry

2023-11-06 13:12:00

by Krzysztof Kozlowski

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

On 06/11/2023 13:08, Dang Huynh wrote:
> Add bindings for PM8937 PMIC (qcom,pm8937). This PMIC is found in
> boards with MSM8917, MSM8937, MSM8940 and APQ variants.
>
> Signed-off-by: Dang Huynh <[email protected]>

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2023-11-06 13:13:04

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 4/8] dt-bindings: regulator: qcom,spmi-regulator: Document PM8937 PMIC

On 06/11/2023 13:08, Dang Huynh wrote:
> Add support for qcom,pm8937-regulators compatible string and add
> relevant supplies in QCOM's SPMI regulator documentation.
>
> Signed-off-by: Dang Huynh <[email protected]>
> ---
> .../bindings/regulator/qcom,spmi-regulator.yaml | 19 +++++++++++++++++++
> 1 file changed, 19 insertions(+)

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2023-11-06 13:13:45

by Krzysztof Kozlowski

[permalink] [raw]
Subject: Re: [PATCH 6/8] dt-bindings: regulator: qcom,smd-rpm-regulator: Document PM8937 IC

On 06/11/2023 13:08, Dang Huynh wrote:
> Document the pm8937 compatible string and available regulators in
> the QCOM SMD RPM regulator documentation.
>
> Signed-off-by: Dang Huynh <[email protected]>
> ---

Reviewed-by: Krzysztof Kozlowski <[email protected]>

Best regards,
Krzysztof

2023-11-06 13:57:02

by Caleb Connolly

[permalink] [raw]
Subject: Re: [PATCH 1/8] mfd: qcom-spmi-pmic: Add support for PM8937



On 06/11/2023 12:08, Dang Huynh wrote:
> Add the subtype and compatible strings for PM8937.
>
> The PM8937 is found in various SoCs, including MSM8917, MSM8937,
> MSM8940 and APQ variants.
>
> Signed-off-by: Dang Huynh <[email protected]>

Reviewed-by: Caleb Connolly <[email protected]>
> ---
> drivers/mfd/qcom-spmi-pmic.c | 1 +
> include/soc/qcom/qcom-spmi-pmic.h | 1 +
> 2 files changed, 2 insertions(+)
>
> diff --git a/drivers/mfd/qcom-spmi-pmic.c b/drivers/mfd/qcom-spmi-pmic.c
> index 4549fa9f7d4b..eab5bf6cff10 100644
> --- a/drivers/mfd/qcom-spmi-pmic.c
> +++ b/drivers/mfd/qcom-spmi-pmic.c
> @@ -53,6 +53,7 @@ static const struct of_device_id pmic_spmi_id_table[] = {
> { .compatible = "qcom,pm8901", .data = N_USIDS(2) },
> { .compatible = "qcom,pm8909", .data = N_USIDS(2) },
> { .compatible = "qcom,pm8916", .data = N_USIDS(2) },
> + { .compatible = "qcom,pm8937", .data = N_USIDS(2) },
> { .compatible = "qcom,pm8941", .data = N_USIDS(2) },
> { .compatible = "qcom,pm8950", .data = N_USIDS(2) },
> { .compatible = "qcom,pm8994", .data = N_USIDS(2) },
> diff --git a/include/soc/qcom/qcom-spmi-pmic.h b/include/soc/qcom/qcom-spmi-pmic.h
> index c47cc71a999e..17a0a8c3d656 100644
> --- a/include/soc/qcom/qcom-spmi-pmic.h
> +++ b/include/soc/qcom/qcom-spmi-pmic.h
> @@ -31,6 +31,7 @@
> #define PM8998_SUBTYPE 0x14
> #define PMI8998_SUBTYPE 0x15
> #define PM8005_SUBTYPE 0x18
> +#define PM8937_SUBTYPE 0x19
> #define PM660L_SUBTYPE 0x1a
> #define PM660_SUBTYPE 0x1b
> #define PM8150_SUBTYPE 0x1e
>

--
// Caleb (they/them)

2023-11-06 17:22:21

by Stephan Gerhold

[permalink] [raw]
Subject: Re: [PATCH 7/8] arm64: dts: qcom: Add PM8937 PMIC

On Mon, Nov 06, 2023 at 07:08:35PM +0700, 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.
>
> Signed-off-by: Dang Huynh <[email protected]>
> ---
> arch/arm64/boot/dts/qcom/pm8937.dtsi | 202 +++++++++++++++++++++++++++++++++++
> 1 file changed, 202 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..6091d6938885
> --- /dev/null
> +++ b/arch/arm64/boot/dts/qcom/pm8937.dtsi
> @@ -0,0 +1,202 @@
> +// 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>
> +
> [...]
> +&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;
> + linux,code = <KEY_VOLUMEDOWN>;

Please move the linux,code into the board-specific part and make this
status = "disabled" by default, like in the other PMIC dtsi files.

One could theoretically assign any other function to this key. Also,
some devices don't have this hooked up at all.

Thanks,
Stephan

2023-11-06 19:32:27

by Stephan Gerhold

[permalink] [raw]
Subject: Re: [PATCH 5/8] regulator: qcom_smd: Add PM8937 regulators

On Mon, Nov 06, 2023 at 02:15:12PM +0200, Dmitry Baryshkov wrote:
> On Mon, 6 Nov 2023 at 14:11, Dang Huynh <[email protected]> wrote:
> >
> > The PM8937 is found on boards with MSM8917, MSM8937, MSM8940 SoCs and
> > APQ variants.
> >
> > It provides 6 SMPS (two are controlled by SPMI) and 23 LDO regulators.
> >
> > Signed-off-by: Dang Huynh <[email protected]>
>
> I haven't checked LDO / SMPS types.

That's kind of the part where one would most likely make mistakes
though. :D

I checked them based on the log Dang posted on IRC, by cross-referencing
the voltage ranges with the regulator types in the SPMI regulator driver.

Looks good :)

Reviewed-by: Stephan Gerhold <[email protected]>

Thanks,
Stephan

(bootloader) Detected PMIC 0x10019
(bootloader) s1: 1225000 mV, disabled, fast (smps)
(bootloader) s2: 1162500 mV, enabled, fast (smps)
(bootloader) s3: 1412500 mV, enabled, fast (smps)
(bootloader) s4: 2050000 mV, enabled, fast (smps)
(bootloader) s5: 1225000 mV, enabled, fast (ftsmps2p5)
(bootloader) s6: 1225000 mV, enabled, fast (ftsmps2p5)
(bootloader) l1: 1000000 mV, disabled, normal (ult_nldo)
(bootloader) l2: 1250000 mV, enabled, normal (ult_nldo)
(bootloader) l3: 1350000 mV, enabled, idle (ult_nldo)
(bootloader) l4: 1800000 mV, disabled, normal (ult_pldo)
(bootloader) l5: 1800000 mV, enabled, idle (ult_pldo)
(bootloader) l6: 1800000 mV, enabled, normal (ult_pldo)
(bootloader) l7: 1800000 mV, enabled, normal (ult_pldo)
(bootloader) l8: 2900000 mV, enabled, normal (ult_pldo)
(bootloader) l9: 3300000 mV, disabled, normal (ult_pldo)
(bootloader) l10: 2800000 mV, disabled, normal (ult_pldo)
(bootloader) l11: 2950000 mV, enabled, normal (ult_pldo)
(bootloader) l12: 2950000 mV, enabled, normal (ult_pldo)
(bootloader) l13: 3075000 mV, enabled, normal (ult_pldo)
(bootloader) l14: 1800000 mV, disabled, normal (ult_pldo)
(bootloader) l15: 1800000 mV, disabled, normal (ult_pldo)
(bootloader) l16: 1800000 mV, disabled, normal (ult_pldo)
(bootloader) l17: 2850000 mV, enabled, normal (ult_pldo)
(bootloader) l18: 2700000 mV, disabled, normal (ult_pldo)
(bootloader) l19: 1300000 mV, disabled, normal (ult_nldo)
(bootloader) l20: 1740000 mV, disabled (ln_ldo)
(bootloader) l21: 1740000 mV, disabled (ln_ldo)
(bootloader) l22: 2800000 mV, disabled, normal (ult_pldo)
(bootloader) l23: 1300000 mV, disabled, normal (nldo1)