ipq807x: switch to kernel 6.1
[openwrt/openwrt.git] / target / linux / ipq807x / patches-5.15 / 0061-v6.0-regulator-qcom_spmi-add-support-for-HT_P150.patch
1 From dedc087d43013ab6043dd1da4cd585dd4242a6bb Mon Sep 17 00:00:00 2001
2 From: Robert Marko <robimarko@gmail.com>
3 Date: Mon, 4 Jul 2022 23:23:54 +0200
4 Subject: [PATCH] regulator: qcom_spmi: add support for HT_P150
5
6 HT_P150 is a LDO PMOS regulator based on LV P150 using HFS430 layout
7 found in PMP8074 and PMS405 PMIC-s.
8
9 Both PMP8074 and PMS405 define the programmable range as 1.616V to 3.304V
10 but the actual MAX output voltage depends on the exact LDO in each of
11 the PMIC-s.
12
13 It has a max current of 150mA, voltage step of 8mV.
14
15 Signed-off-by: Robert Marko <robimarko@gmail.com>
16 Link: https://lore.kernel.org/r/20220704212402.1715182-4-robimarko@gmail.com
17 Signed-off-by: Mark Brown <broonie@kernel.org>
18 ---
19 drivers/regulator/qcom_spmi-regulator.c | 7 +++++++
20 1 file changed, 7 insertions(+)
21
22 --- a/drivers/regulator/qcom_spmi-regulator.c
23 +++ b/drivers/regulator/qcom_spmi-regulator.c
24 @@ -164,6 +164,7 @@ enum spmi_regulator_subtype {
25 SPMI_REGULATOR_SUBTYPE_ULT_HF_CTL3 = 0x0f,
26 SPMI_REGULATOR_SUBTYPE_ULT_HF_CTL4 = 0x10,
27 SPMI_REGULATOR_SUBTYPE_HFS430 = 0x0a,
28 + SPMI_REGULATOR_SUBTYPE_HT_P150 = 0x35,
29 };
30
31 enum spmi_common_regulator_registers {
32 @@ -544,6 +545,10 @@ static struct spmi_voltage_range hfs430_
33 SPMI_VOLTAGE_RANGE(0, 320000, 320000, 2040000, 2040000, 8000),
34 };
35
36 +static struct spmi_voltage_range ht_p150_ranges[] = {
37 + SPMI_VOLTAGE_RANGE(0, 1616000, 1616000, 3304000, 3304000, 8000),
38 +};
39 +
40 static DEFINE_SPMI_SET_POINTS(pldo);
41 static DEFINE_SPMI_SET_POINTS(nldo1);
42 static DEFINE_SPMI_SET_POINTS(nldo2);
43 @@ -564,6 +569,7 @@ static DEFINE_SPMI_SET_POINTS(nldo660);
44 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
49 static inline int spmi_vreg_read(struct spmi_regulator *vreg, u16 addr, u8 *buf,
50 int len)
51 @@ -1458,6 +1464,7 @@ static const struct regulator_ops spmi_h
52
53 static const struct spmi_regulator_mapping supported_regulators[] = {
54 /* type subtype dig_min dig_max ltype ops setpoints hpm_min */
55 + SPMI_VREG(LDO, HT_P150, 0, INF, HFS430, hfs430, ht_p150, 10000),
56 SPMI_VREG(BUCK, GP_CTL, 0, INF, SMPS, smps, smps, 100000),
57 SPMI_VREG(BUCK, HFS430, 0, INF, HFS430, hfs430, hfs430, 10000),
58 SPMI_VREG(LDO, N300, 0, INF, LDO, ldo, nldo1, 10000),