diff mbox series

[5/8] regulator: qcom_smd: Add PM8937 regulators

Message ID 20231106-pm8937-v1-5-ec51d9eeec53@riseup.net (mailing list archive)
State Superseded
Headers show
Series Add PM8937 PMIC support | expand

Commit Message

Dang Huynh Nov. 6, 2023, 12:08 p.m. UTC
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 <danct12@riseup.net>
---
 drivers/regulator/qcom_smd-regulator.c | 34 ++++++++++++++++++++++++++++++++++
 1 file changed, 34 insertions(+)

Comments

Dmitry Baryshkov Nov. 6, 2023, 12:15 p.m. UTC | #1
On Mon, 6 Nov 2023 at 14:11, Dang Huynh <danct12@riseup.net> 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 <danct12@riseup.net>

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

Reviewed-by: Dmitry Baryshkov <dmitry.baryshkov@linaro.org>

> ---
>  drivers/regulator/qcom_smd-regulator.c | 34 ++++++++++++++++++++++++++++++++++
>  1 file changed, 34 insertions(+)
Stephan Gerhold Nov. 6, 2023, 7:32 p.m. UTC | #2
On Mon, Nov 06, 2023 at 02:15:12PM +0200, Dmitry Baryshkov wrote:
> On Mon, 6 Nov 2023 at 14:11, Dang Huynh <danct12@riseup.net> 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 <danct12@riseup.net>
> 
> 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 <stephan@gerhold.net>

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)
diff mbox series

Patch

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 },