ipq807x: add Qualcomm Atheros IPQ807x target
[openwrt/staging/jow.git] / target / linux / ipq807x / patches-5.15 / 0062-v6.0-regulator-qcom_spmi-add-support-for-HT_P600.patch
1 From 14789f38e03c42857613b69ff0f032e03653b246 Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Mon, 4 Jul 2022 23:23:55 +0200
4 Subject: [PATCH] regulator: qcom_spmi: add support for HT_P600
5
6 HT_P600 is a LDO PMOS regulator based on LV P600 using HFS430 layout
7 found in PMP8074 and PMS405 PMIC-s.
8
9 Both PMP8074 and PMS405 define the programmable range as 1.704 to 1.896V
10 but the actual MAX output voltage depends on the exact LDO in each of
11 the PMIC-s.
12 Their usual voltage that they are used is 1.8V.
13
14 It has a max current of 600mA, voltage step of 8mV.
15
16 Signed-off-by: Robert Marko <robimarko@gmail.com>
17 Link: https://lore.kernel.org/r/20220704212402.1715182-5-robimarko@gmail.com
18 Signed-off-by: Mark Brown <broonie@kernel.org>
19 ---
20 drivers/regulator/qcom_spmi-regulator.c | 7 +++++++
21 1 file changed, 7 insertions(+)
22
23 --- a/drivers/regulator/qcom_spmi-regulator.c
24 +++ b/drivers/regulator/qcom_spmi-regulator.c
25 @@ -165,6 +165,7 @@ enum spmi_regulator_subtype {
26 SPMI_REGULATOR_SUBTYPE_ULT_HF_CTL4 = 0x10,
27 SPMI_REGULATOR_SUBTYPE_HFS430 = 0x0a,
28 SPMI_REGULATOR_SUBTYPE_HT_P150 = 0x35,
29 + SPMI_REGULATOR_SUBTYPE_HT_P600 = 0x3d,
30 };
31
32 enum spmi_common_regulator_registers {
33 @@ -549,6 +550,10 @@ static struct spmi_voltage_range ht_p150
34 SPMI_VOLTAGE_RANGE(0, 1616000, 1616000, 3304000, 3304000, 8000),
35 };
36
37 +static struct spmi_voltage_range ht_p600_ranges[] = {
38 + SPMI_VOLTAGE_RANGE(0, 1704000, 1704000, 1896000, 1896000, 8000),
39 +};
40 +
41 static DEFINE_SPMI_SET_POINTS(pldo);
42 static DEFINE_SPMI_SET_POINTS(nldo1);
43 static DEFINE_SPMI_SET_POINTS(nldo2);
44 @@ -570,6 +575,7 @@ static DEFINE_SPMI_SET_POINTS(ht_lvpldo)
45 static DEFINE_SPMI_SET_POINTS(ht_nldo);
46 static DEFINE_SPMI_SET_POINTS(hfs430);
47 static DEFINE_SPMI_SET_POINTS(ht_p150);
48 +static DEFINE_SPMI_SET_POINTS(ht_p600);
49
50 static inline int spmi_vreg_read(struct spmi_regulator *vreg, u16 addr, u8 *buf,
51 int len)
52 @@ -1464,6 +1470,7 @@ static const struct regulator_ops spmi_h
53
54 static const struct spmi_regulator_mapping supported_regulators[] = {
55 /* type subtype dig_min dig_max ltype ops setpoints hpm_min */
56 + SPMI_VREG(LDO, HT_P600, 0, INF, HFS430, hfs430, ht_p600, 10000),
57 SPMI_VREG(LDO, HT_P150, 0, INF, HFS430, hfs430, ht_p150, 10000),
58 SPMI_VREG(BUCK, GP_CTL, 0, INF, SMPS, smps, smps, 100000),
59 SPMI_VREG(BUCK, HFS430, 0, INF, HFS430, hfs430, hfs430, 10000),