diff options
48 files changed, 910 insertions, 204 deletions
diff --git a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt index 37c4ea076f88..1d58c8cfdbc0 100644 --- a/Documentation/devicetree/bindings/regulator/anatop-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/anatop-regulator.txt | |||
@@ -14,6 +14,7 @@ Optional properties: | |||
14 | - anatop-delay-bit-shift: Bit shift for the step time register | 14 | - anatop-delay-bit-shift: Bit shift for the step time register |
15 | - anatop-delay-bit-width: Number of bits used in the step time register | 15 | - anatop-delay-bit-width: Number of bits used in the step time register |
16 | - vin-supply: The supply for this regulator | 16 | - vin-supply: The supply for this regulator |
17 | - anatop-enable-bit: Regulator enable bit offset | ||
17 | 18 | ||
18 | Any property defined as part of the core regulator | 19 | Any property defined as part of the core regulator |
19 | binding, defined in regulator.txt, can also be used. | 20 | binding, defined in regulator.txt, can also be used. |
diff --git a/Documentation/devicetree/bindings/regulator/cpcap-regulator.txt b/Documentation/devicetree/bindings/regulator/cpcap-regulator.txt new file mode 100644 index 000000000000..675f4437ce92 --- /dev/null +++ b/Documentation/devicetree/bindings/regulator/cpcap-regulator.txt | |||
@@ -0,0 +1,34 @@ | |||
1 | Motorola CPCAP PMIC voltage regulators | ||
2 | ------------------------------------ | ||
3 | |||
4 | Requires node properties: | ||
5 | - "compatible" value one of: | ||
6 | "motorola,cpcap-regulator" | ||
7 | "motorola,mapphone-cpcap-regulator" | ||
8 | |||
9 | Required regulator properties: | ||
10 | - "regulator-name" | ||
11 | - "regulator-enable-ramp-delay" | ||
12 | - "regulator-min-microvolt" | ||
13 | - "regulator-max-microvolt" | ||
14 | |||
15 | Optional regulator properties: | ||
16 | - "regulator-boot-on" | ||
17 | |||
18 | See Documentation/devicetree/bindings/regulator/regulator.txt | ||
19 | for more details about the regulator properties. | ||
20 | |||
21 | Example: | ||
22 | |||
23 | cpcap_regulator: regulator { | ||
24 | compatible = "motorola,cpcap-regulator"; | ||
25 | |||
26 | cpcap_regulators: regulators { | ||
27 | sw5: SW5 { | ||
28 | regulator-min-microvolt = <5050000>; | ||
29 | regulator-max-microvolt = <5050000>; | ||
30 | regulator-enable-ramp-delay = <50000>; | ||
31 | regulator-boot-on; | ||
32 | }; | ||
33 | }; | ||
34 | }; | ||
diff --git a/Documentation/devicetree/bindings/regulator/gpio-regulator.txt b/Documentation/devicetree/bindings/regulator/gpio-regulator.txt index e5cac1e0ca8a..dd1ed789728e 100644 --- a/Documentation/devicetree/bindings/regulator/gpio-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/gpio-regulator.txt | |||
@@ -13,7 +13,7 @@ Optional properties: | |||
13 | - startup-delay-us : Startup time in microseconds. | 13 | - startup-delay-us : Startup time in microseconds. |
14 | - enable-active-high : Polarity of GPIO is active high (default is low). | 14 | - enable-active-high : Polarity of GPIO is active high (default is low). |
15 | - regulator-type : Specifies what is being regulated, must be either | 15 | - regulator-type : Specifies what is being regulated, must be either |
16 | "voltage" or "current", defaults to current. | 16 | "voltage" or "current", defaults to voltage. |
17 | 17 | ||
18 | Any property defined as part of the core regulator binding defined in | 18 | Any property defined as part of the core regulator binding defined in |
19 | regulator.txt can also be used. | 19 | regulator.txt can also be used. |
diff --git a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt index 1f8d6f84b657..4e3dfb5b5f16 100644 --- a/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.txt | |||
@@ -22,6 +22,7 @@ Regulator nodes are identified by their compatible: | |||
22 | "qcom,rpm-pm8841-regulators" | 22 | "qcom,rpm-pm8841-regulators" |
23 | "qcom,rpm-pm8916-regulators" | 23 | "qcom,rpm-pm8916-regulators" |
24 | "qcom,rpm-pm8941-regulators" | 24 | "qcom,rpm-pm8941-regulators" |
25 | "qcom,rpm-pm8994-regulators" | ||
25 | "qcom,rpm-pma8084-regulators" | 26 | "qcom,rpm-pma8084-regulators" |
26 | 27 | ||
27 | - vdd_s1-supply: | 28 | - vdd_s1-supply: |
@@ -80,6 +81,56 @@ Regulator nodes are identified by their compatible: | |||
80 | - vdd_s10-supply: | 81 | - vdd_s10-supply: |
81 | - vdd_s11-supply: | 82 | - vdd_s11-supply: |
82 | - vdd_s12-supply: | 83 | - vdd_s12-supply: |
84 | - vdd_l1-supply: | ||
85 | - vdd_l2_l26_l28-supply: | ||
86 | - vdd_l3_l11-supply: | ||
87 | - vdd_l4_l27_l31-supply: | ||
88 | - vdd_l5_l7-supply: | ||
89 | - vdd_l6_l12_l32-supply: | ||
90 | - vdd_l5_l7-supply: | ||
91 | - vdd_l8_l16_l30-supply: | ||
92 | - vdd_l9_l10_l18_l22-supply: | ||
93 | - vdd_l9_l10_l18_l22-supply: | ||
94 | - vdd_l3_l11-supply: | ||
95 | - vdd_l6_l12_l32-supply: | ||
96 | - vdd_l13_l19_l23_l24-supply: | ||
97 | - vdd_l14_l15-supply: | ||
98 | - vdd_l14_l15-supply: | ||
99 | - vdd_l8_l16_l30-supply: | ||
100 | - vdd_l17_l29-supply: | ||
101 | - vdd_l9_l10_l18_l22-supply: | ||
102 | - vdd_l13_l19_l23_l24-supply: | ||
103 | - vdd_l20_l21-supply: | ||
104 | - vdd_l20_l21-supply: | ||
105 | - vdd_l9_l10_l18_l22-supply: | ||
106 | - vdd_l13_l19_l23_l24-supply: | ||
107 | - vdd_l13_l19_l23_l24-supply: | ||
108 | - vdd_l25-supply: | ||
109 | - vdd_l2_l26_l28-supply: | ||
110 | - vdd_l4_l27_l31-supply: | ||
111 | - vdd_l2_l26_l28-supply: | ||
112 | - vdd_l17_l29-supply: | ||
113 | - vdd_l8_l16_l30-supply: | ||
114 | - vdd_l4_l27_l31-supply: | ||
115 | - vdd_l6_l12_l32-supply: | ||
116 | - vdd_lvs1_2-supply: | ||
117 | Usage: optional (pm8994 only) | ||
118 | Value type: <phandle> | ||
119 | Definition: reference to regulator supplying the input pin, as | ||
120 | described in the data sheet | ||
121 | |||
122 | - vdd_s1-supply: | ||
123 | - vdd_s2-supply: | ||
124 | - vdd_s3-supply: | ||
125 | - vdd_s4-supply: | ||
126 | - vdd_s5-supply: | ||
127 | - vdd_s6-supply: | ||
128 | - vdd_s7-supply: | ||
129 | - vdd_s8-supply: | ||
130 | - vdd_s9-supply: | ||
131 | - vdd_s10-supply: | ||
132 | - vdd_s11-supply: | ||
133 | - vdd_s12-supply: | ||
83 | - vdd_l1_l11-supply: | 134 | - vdd_l1_l11-supply: |
84 | - vdd_l2_l3_l4_l27-supply: | 135 | - vdd_l2_l3_l4_l27-supply: |
85 | - vdd_l5_l7-supply: | 136 | - vdd_l5_l7-supply: |
@@ -113,6 +164,11 @@ pm8941: | |||
113 | l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, | 164 | l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, lvs1, lvs2, |
114 | lvs3, 5vs1, 5vs2 | 165 | lvs3, 5vs1, 5vs2 |
115 | 166 | ||
167 | pm8994: | ||
168 | s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5, | ||
169 | l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20, | ||
170 | l21, l22, l23, l24, l25, l26, l27, l28, l29, l30, l31, l32, lvs1, lvs2 | ||
171 | |||
116 | pma8084: | 172 | pma8084: |
117 | s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5, | 173 | s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3, l4, l5, |
118 | l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20, | 174 | l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19, l20, |
diff --git a/drivers/regulator/88pm800.c b/drivers/regulator/88pm800.c index a62a89674fb5..89bbd6e8bad1 100644 --- a/drivers/regulator/88pm800.c +++ b/drivers/regulator/88pm800.c | |||
@@ -180,7 +180,7 @@ static int pm800_get_current_limit(struct regulator_dev *rdev) | |||
180 | return info->max_ua; | 180 | return info->max_ua; |
181 | } | 181 | } |
182 | 182 | ||
183 | static struct regulator_ops pm800_volt_range_ops = { | 183 | static const struct regulator_ops pm800_volt_range_ops = { |
184 | .list_voltage = regulator_list_voltage_linear_range, | 184 | .list_voltage = regulator_list_voltage_linear_range, |
185 | .map_voltage = regulator_map_voltage_linear_range, | 185 | .map_voltage = regulator_map_voltage_linear_range, |
186 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 186 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
@@ -191,7 +191,7 @@ static struct regulator_ops pm800_volt_range_ops = { | |||
191 | .get_current_limit = pm800_get_current_limit, | 191 | .get_current_limit = pm800_get_current_limit, |
192 | }; | 192 | }; |
193 | 193 | ||
194 | static struct regulator_ops pm800_volt_table_ops = { | 194 | static const struct regulator_ops pm800_volt_table_ops = { |
195 | .list_voltage = regulator_list_voltage_table, | 195 | .list_voltage = regulator_list_voltage_table, |
196 | .map_voltage = regulator_map_voltage_iterate, | 196 | .map_voltage = regulator_map_voltage_iterate, |
197 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 197 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
diff --git a/drivers/regulator/88pm8607.c b/drivers/regulator/88pm8607.c index b100a63ff3b3..fd86446e499b 100644 --- a/drivers/regulator/88pm8607.c +++ b/drivers/regulator/88pm8607.c | |||
@@ -220,7 +220,7 @@ static int pm8607_list_voltage(struct regulator_dev *rdev, unsigned index) | |||
220 | return ret; | 220 | return ret; |
221 | } | 221 | } |
222 | 222 | ||
223 | static struct regulator_ops pm8607_regulator_ops = { | 223 | static const struct regulator_ops pm8607_regulator_ops = { |
224 | .list_voltage = pm8607_list_voltage, | 224 | .list_voltage = pm8607_list_voltage, |
225 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 225 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
226 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 226 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
@@ -229,7 +229,7 @@ static struct regulator_ops pm8607_regulator_ops = { | |||
229 | .is_enabled = regulator_is_enabled_regmap, | 229 | .is_enabled = regulator_is_enabled_regmap, |
230 | }; | 230 | }; |
231 | 231 | ||
232 | static struct regulator_ops pm8606_preg_ops = { | 232 | static const struct regulator_ops pm8606_preg_ops = { |
233 | .enable = regulator_enable_regmap, | 233 | .enable = regulator_enable_regmap, |
234 | .disable = regulator_disable_regmap, | 234 | .disable = regulator_disable_regmap, |
235 | .is_enabled = regulator_is_enabled_regmap, | 235 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/Kconfig b/drivers/regulator/Kconfig index 936f7ccc9736..be06eb29c681 100644 --- a/drivers/regulator/Kconfig +++ b/drivers/regulator/Kconfig | |||
@@ -163,6 +163,13 @@ config REGULATOR_BCM590XX | |||
163 | BCM590xx PMUs. This will enable support for the software | 163 | BCM590xx PMUs. This will enable support for the software |
164 | controllable LDO/Switching regulators. | 164 | controllable LDO/Switching regulators. |
165 | 165 | ||
166 | config REGULATOR_CPCAP | ||
167 | tristate "Motorola CPCAP regulator" | ||
168 | depends on MFD_CPCAP | ||
169 | help | ||
170 | Say y here for CPCAP regulator found on some Motorola phones | ||
171 | and tablets such as Droid 4. | ||
172 | |||
166 | config REGULATOR_DA903X | 173 | config REGULATOR_DA903X |
167 | tristate "Dialog Semiconductor DA9030/DA9034 regulators" | 174 | tristate "Dialog Semiconductor DA9030/DA9034 regulators" |
168 | depends on PMIC_DA903X | 175 | depends on PMIC_DA903X |
diff --git a/drivers/regulator/Makefile b/drivers/regulator/Makefile index 14294692beb9..ef7725e2592a 100644 --- a/drivers/regulator/Makefile +++ b/drivers/regulator/Makefile | |||
@@ -11,6 +11,7 @@ obj-$(CONFIG_REGULATOR_USERSPACE_CONSUMER) += userspace-consumer.o | |||
11 | 11 | ||
12 | obj-$(CONFIG_REGULATOR_88PM800) += 88pm800.o | 12 | obj-$(CONFIG_REGULATOR_88PM800) += 88pm800.o |
13 | obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o | 13 | obj-$(CONFIG_REGULATOR_88PM8607) += 88pm8607.o |
14 | obj-$(CONFIG_REGULATOR_CPCAP) += cpcap-regulator.o | ||
14 | obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o | 15 | obj-$(CONFIG_REGULATOR_AAT2870) += aat2870-regulator.o |
15 | obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o | 16 | obj-$(CONFIG_REGULATOR_AB3100) += ab3100.o |
16 | obj-$(CONFIG_REGULATOR_AB8500) += ab8500-ext.o ab8500.o | 17 | obj-$(CONFIG_REGULATOR_AB8500) += ab8500-ext.o ab8500.o |
diff --git a/drivers/regulator/aat2870-regulator.c b/drivers/regulator/aat2870-regulator.c index 9dfabda8f478..afc5b5900181 100644 --- a/drivers/regulator/aat2870-regulator.c +++ b/drivers/regulator/aat2870-regulator.c | |||
@@ -97,7 +97,7 @@ static int aat2870_ldo_is_enabled(struct regulator_dev *rdev) | |||
97 | return val & ri->enable_mask ? 1 : 0; | 97 | return val & ri->enable_mask ? 1 : 0; |
98 | } | 98 | } |
99 | 99 | ||
100 | static struct regulator_ops aat2870_ldo_ops = { | 100 | static const struct regulator_ops aat2870_ldo_ops = { |
101 | .list_voltage = regulator_list_voltage_table, | 101 | .list_voltage = regulator_list_voltage_table, |
102 | .map_voltage = regulator_map_voltage_ascend, | 102 | .map_voltage = regulator_map_voltage_ascend, |
103 | .set_voltage_sel = aat2870_ldo_set_voltage_sel, | 103 | .set_voltage_sel = aat2870_ldo_set_voltage_sel, |
diff --git a/drivers/regulator/act8945a-regulator.c b/drivers/regulator/act8945a-regulator.c index 441864b9fece..43fda8b4455a 100644 --- a/drivers/regulator/act8945a-regulator.c +++ b/drivers/regulator/act8945a-regulator.c | |||
@@ -69,7 +69,7 @@ static const struct regulator_linear_range act8945a_voltage_ranges[] = { | |||
69 | REGULATOR_LINEAR_RANGE(2400000, 48, 63, 100000), | 69 | REGULATOR_LINEAR_RANGE(2400000, 48, 63, 100000), |
70 | }; | 70 | }; |
71 | 71 | ||
72 | static struct regulator_ops act8945a_ops = { | 72 | static const struct regulator_ops act8945a_ops = { |
73 | .list_voltage = regulator_list_voltage_linear_range, | 73 | .list_voltage = regulator_list_voltage_linear_range, |
74 | .map_voltage = regulator_map_voltage_linear_range, | 74 | .map_voltage = regulator_map_voltage_linear_range, |
75 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 75 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
diff --git a/drivers/regulator/ad5398.c b/drivers/regulator/ad5398.c index 8b0f788a9bbb..11c1f880b7bb 100644 --- a/drivers/regulator/ad5398.c +++ b/drivers/regulator/ad5398.c | |||
@@ -181,7 +181,7 @@ static int ad5398_disable(struct regulator_dev *rdev) | |||
181 | return ret; | 181 | return ret; |
182 | } | 182 | } |
183 | 183 | ||
184 | static struct regulator_ops ad5398_ops = { | 184 | static const struct regulator_ops ad5398_ops = { |
185 | .get_current_limit = ad5398_get_current_limit, | 185 | .get_current_limit = ad5398_get_current_limit, |
186 | .set_current_limit = ad5398_set_current_limit, | 186 | .set_current_limit = ad5398_set_current_limit, |
187 | .enable = ad5398_enable, | 187 | .enable = ad5398_enable, |
diff --git a/drivers/regulator/anatop-regulator.c b/drivers/regulator/anatop-regulator.c index 3a6d0290c54c..b041f277a38b 100644 --- a/drivers/regulator/anatop-regulator.c +++ b/drivers/regulator/anatop-regulator.c | |||
@@ -301,7 +301,19 @@ static int anatop_regulator_probe(struct platform_device *pdev) | |||
301 | return -EINVAL; | 301 | return -EINVAL; |
302 | } | 302 | } |
303 | } else { | 303 | } else { |
304 | u32 enable_bit; | ||
305 | |||
304 | rdesc->ops = &anatop_rops; | 306 | rdesc->ops = &anatop_rops; |
307 | |||
308 | if (!of_property_read_u32(np, "anatop-enable-bit", | ||
309 | &enable_bit)) { | ||
310 | anatop_rops.enable = regulator_enable_regmap; | ||
311 | anatop_rops.disable = regulator_disable_regmap; | ||
312 | anatop_rops.is_enabled = regulator_is_enabled_regmap; | ||
313 | |||
314 | rdesc->enable_reg = sreg->control_reg; | ||
315 | rdesc->enable_mask = BIT(enable_bit); | ||
316 | } | ||
305 | } | 317 | } |
306 | 318 | ||
307 | /* register regulator */ | 319 | /* register regulator */ |
diff --git a/drivers/regulator/arizona-ldo1.c b/drivers/regulator/arizona-ldo1.c index 302b57cb89c6..e76d094591e7 100644 --- a/drivers/regulator/arizona-ldo1.c +++ b/drivers/regulator/arizona-ldo1.c | |||
@@ -109,7 +109,7 @@ static int arizona_ldo1_hc_get_voltage_sel(struct regulator_dev *rdev) | |||
109 | return (val & ARIZONA_LDO1_VSEL_MASK) >> ARIZONA_LDO1_VSEL_SHIFT; | 109 | return (val & ARIZONA_LDO1_VSEL_MASK) >> ARIZONA_LDO1_VSEL_SHIFT; |
110 | } | 110 | } |
111 | 111 | ||
112 | static struct regulator_ops arizona_ldo1_hc_ops = { | 112 | static const struct regulator_ops arizona_ldo1_hc_ops = { |
113 | .list_voltage = arizona_ldo1_hc_list_voltage, | 113 | .list_voltage = arizona_ldo1_hc_list_voltage, |
114 | .map_voltage = arizona_ldo1_hc_map_voltage, | 114 | .map_voltage = arizona_ldo1_hc_map_voltage, |
115 | .get_voltage_sel = arizona_ldo1_hc_get_voltage_sel, | 115 | .get_voltage_sel = arizona_ldo1_hc_get_voltage_sel, |
@@ -135,7 +135,7 @@ static const struct regulator_desc arizona_ldo1_hc = { | |||
135 | .owner = THIS_MODULE, | 135 | .owner = THIS_MODULE, |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static struct regulator_ops arizona_ldo1_ops = { | 138 | static const struct regulator_ops arizona_ldo1_ops = { |
139 | .list_voltage = regulator_list_voltage_linear, | 139 | .list_voltage = regulator_list_voltage_linear, |
140 | .map_voltage = regulator_map_voltage_linear, | 140 | .map_voltage = regulator_map_voltage_linear, |
141 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 141 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
diff --git a/drivers/regulator/arizona-micsupp.c b/drivers/regulator/arizona-micsupp.c index fcb98dbda837..22bd71407622 100644 --- a/drivers/regulator/arizona-micsupp.c +++ b/drivers/regulator/arizona-micsupp.c | |||
@@ -45,6 +45,7 @@ static void arizona_micsupp_check_cp(struct work_struct *work) | |||
45 | struct arizona_micsupp *micsupp = | 45 | struct arizona_micsupp *micsupp = |
46 | container_of(work, struct arizona_micsupp, check_cp_work); | 46 | container_of(work, struct arizona_micsupp, check_cp_work); |
47 | struct snd_soc_dapm_context *dapm = micsupp->arizona->dapm; | 47 | struct snd_soc_dapm_context *dapm = micsupp->arizona->dapm; |
48 | struct snd_soc_component *component = snd_soc_dapm_to_component(dapm); | ||
48 | struct arizona *arizona = micsupp->arizona; | 49 | struct arizona *arizona = micsupp->arizona; |
49 | struct regmap *regmap = arizona->regmap; | 50 | struct regmap *regmap = arizona->regmap; |
50 | unsigned int reg; | 51 | unsigned int reg; |
@@ -59,9 +60,10 @@ static void arizona_micsupp_check_cp(struct work_struct *work) | |||
59 | if (dapm) { | 60 | if (dapm) { |
60 | if ((reg & (ARIZONA_CPMIC_ENA | ARIZONA_CPMIC_BYPASS)) == | 61 | if ((reg & (ARIZONA_CPMIC_ENA | ARIZONA_CPMIC_BYPASS)) == |
61 | ARIZONA_CPMIC_ENA) | 62 | ARIZONA_CPMIC_ENA) |
62 | snd_soc_dapm_force_enable_pin(dapm, "MICSUPP"); | 63 | snd_soc_component_force_enable_pin(component, |
64 | "MICSUPP"); | ||
63 | else | 65 | else |
64 | snd_soc_dapm_disable_pin(dapm, "MICSUPP"); | 66 | snd_soc_component_disable_pin(component, "MICSUPP"); |
65 | 67 | ||
66 | snd_soc_dapm_sync(dapm); | 68 | snd_soc_dapm_sync(dapm); |
67 | } | 69 | } |
@@ -104,7 +106,7 @@ static int arizona_micsupp_set_bypass(struct regulator_dev *rdev, bool ena) | |||
104 | return ret; | 106 | return ret; |
105 | } | 107 | } |
106 | 108 | ||
107 | static struct regulator_ops arizona_micsupp_ops = { | 109 | static const struct regulator_ops arizona_micsupp_ops = { |
108 | .enable = arizona_micsupp_enable, | 110 | .enable = arizona_micsupp_enable, |
109 | .disable = arizona_micsupp_disable, | 111 | .disable = arizona_micsupp_disable, |
110 | .is_enabled = regulator_is_enabled_regmap, | 112 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/as3711-regulator.c b/drivers/regulator/as3711-regulator.c index c0e93b1332f7..874d415d6b4f 100644 --- a/drivers/regulator/as3711-regulator.c +++ b/drivers/regulator/as3711-regulator.c | |||
@@ -82,7 +82,7 @@ static unsigned int as3711_get_mode_sd(struct regulator_dev *rdev) | |||
82 | return -EINVAL; | 82 | return -EINVAL; |
83 | } | 83 | } |
84 | 84 | ||
85 | static struct regulator_ops as3711_sd_ops = { | 85 | static const struct regulator_ops as3711_sd_ops = { |
86 | .is_enabled = regulator_is_enabled_regmap, | 86 | .is_enabled = regulator_is_enabled_regmap, |
87 | .enable = regulator_enable_regmap, | 87 | .enable = regulator_enable_regmap, |
88 | .disable = regulator_disable_regmap, | 88 | .disable = regulator_disable_regmap, |
@@ -94,7 +94,7 @@ static struct regulator_ops as3711_sd_ops = { | |||
94 | .set_mode = as3711_set_mode_sd, | 94 | .set_mode = as3711_set_mode_sd, |
95 | }; | 95 | }; |
96 | 96 | ||
97 | static struct regulator_ops as3711_aldo_ops = { | 97 | static const struct regulator_ops as3711_aldo_ops = { |
98 | .is_enabled = regulator_is_enabled_regmap, | 98 | .is_enabled = regulator_is_enabled_regmap, |
99 | .enable = regulator_enable_regmap, | 99 | .enable = regulator_enable_regmap, |
100 | .disable = regulator_disable_regmap, | 100 | .disable = regulator_disable_regmap, |
@@ -104,7 +104,7 @@ static struct regulator_ops as3711_aldo_ops = { | |||
104 | .map_voltage = regulator_map_voltage_linear_range, | 104 | .map_voltage = regulator_map_voltage_linear_range, |
105 | }; | 105 | }; |
106 | 106 | ||
107 | static struct regulator_ops as3711_dldo_ops = { | 107 | static const struct regulator_ops as3711_dldo_ops = { |
108 | .is_enabled = regulator_is_enabled_regmap, | 108 | .is_enabled = regulator_is_enabled_regmap, |
109 | .enable = regulator_enable_regmap, | 109 | .enable = regulator_enable_regmap, |
110 | .disable = regulator_disable_regmap, | 110 | .disable = regulator_disable_regmap, |
diff --git a/drivers/regulator/axp20x-regulator.c b/drivers/regulator/axp20x-regulator.c index a3ade9e4ef47..0b9d4e3e52c7 100644 --- a/drivers/regulator/axp20x-regulator.c +++ b/drivers/regulator/axp20x-regulator.c | |||
@@ -128,11 +128,11 @@ | |||
128 | .ops = &axp20x_ops_range, \ | 128 | .ops = &axp20x_ops_range, \ |
129 | } | 129 | } |
130 | 130 | ||
131 | static struct regulator_ops axp20x_ops_fixed = { | 131 | static const struct regulator_ops axp20x_ops_fixed = { |
132 | .list_voltage = regulator_list_voltage_linear, | 132 | .list_voltage = regulator_list_voltage_linear, |
133 | }; | 133 | }; |
134 | 134 | ||
135 | static struct regulator_ops axp20x_ops_range = { | 135 | static const struct regulator_ops axp20x_ops_range = { |
136 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 136 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
137 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 137 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
138 | .list_voltage = regulator_list_voltage_linear_range, | 138 | .list_voltage = regulator_list_voltage_linear_range, |
@@ -141,7 +141,7 @@ static struct regulator_ops axp20x_ops_range = { | |||
141 | .is_enabled = regulator_is_enabled_regmap, | 141 | .is_enabled = regulator_is_enabled_regmap, |
142 | }; | 142 | }; |
143 | 143 | ||
144 | static struct regulator_ops axp20x_ops = { | 144 | static const struct regulator_ops axp20x_ops = { |
145 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 145 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
146 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 146 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
147 | .list_voltage = regulator_list_voltage_linear, | 147 | .list_voltage = regulator_list_voltage_linear, |
@@ -150,7 +150,7 @@ static struct regulator_ops axp20x_ops = { | |||
150 | .is_enabled = regulator_is_enabled_regmap, | 150 | .is_enabled = regulator_is_enabled_regmap, |
151 | }; | 151 | }; |
152 | 152 | ||
153 | static struct regulator_ops axp20x_ops_sw = { | 153 | static const struct regulator_ops axp20x_ops_sw = { |
154 | .enable = regulator_enable_regmap, | 154 | .enable = regulator_enable_regmap, |
155 | .disable = regulator_disable_regmap, | 155 | .disable = regulator_disable_regmap, |
156 | .is_enabled = regulator_is_enabled_regmap, | 156 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/bcm590xx-regulator.c b/drivers/regulator/bcm590xx-regulator.c index 76b01835dcb4..9dd715407b39 100644 --- a/drivers/regulator/bcm590xx-regulator.c +++ b/drivers/regulator/bcm590xx-regulator.c | |||
@@ -250,7 +250,7 @@ static int bcm590xx_get_enable_register(int id) | |||
250 | return reg; | 250 | return reg; |
251 | } | 251 | } |
252 | 252 | ||
253 | static struct regulator_ops bcm590xx_ops_ldo = { | 253 | static const struct regulator_ops bcm590xx_ops_ldo = { |
254 | .is_enabled = regulator_is_enabled_regmap, | 254 | .is_enabled = regulator_is_enabled_regmap, |
255 | .enable = regulator_enable_regmap, | 255 | .enable = regulator_enable_regmap, |
256 | .disable = regulator_disable_regmap, | 256 | .disable = regulator_disable_regmap, |
@@ -260,7 +260,7 @@ static struct regulator_ops bcm590xx_ops_ldo = { | |||
260 | .map_voltage = regulator_map_voltage_iterate, | 260 | .map_voltage = regulator_map_voltage_iterate, |
261 | }; | 261 | }; |
262 | 262 | ||
263 | static struct regulator_ops bcm590xx_ops_dcdc = { | 263 | static const struct regulator_ops bcm590xx_ops_dcdc = { |
264 | .is_enabled = regulator_is_enabled_regmap, | 264 | .is_enabled = regulator_is_enabled_regmap, |
265 | .enable = regulator_enable_regmap, | 265 | .enable = regulator_enable_regmap, |
266 | .disable = regulator_disable_regmap, | 266 | .disable = regulator_disable_regmap, |
@@ -270,7 +270,7 @@ static struct regulator_ops bcm590xx_ops_dcdc = { | |||
270 | .map_voltage = regulator_map_voltage_linear_range, | 270 | .map_voltage = regulator_map_voltage_linear_range, |
271 | }; | 271 | }; |
272 | 272 | ||
273 | static struct regulator_ops bcm590xx_ops_vbus = { | 273 | static const struct regulator_ops bcm590xx_ops_vbus = { |
274 | .is_enabled = regulator_is_enabled_regmap, | 274 | .is_enabled = regulator_is_enabled_regmap, |
275 | .enable = regulator_enable_regmap, | 275 | .enable = regulator_enable_regmap, |
276 | .disable = regulator_disable_regmap, | 276 | .disable = regulator_disable_regmap, |
diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 04baac9a165b..53d4fc70dbd0 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c | |||
@@ -1455,12 +1455,14 @@ static struct regulator_dev *regulator_lookup_by_name(const char *name) | |||
1455 | * lookup could succeed in the future. | 1455 | * lookup could succeed in the future. |
1456 | * | 1456 | * |
1457 | * If successful, returns a struct regulator_dev that corresponds to the name | 1457 | * If successful, returns a struct regulator_dev that corresponds to the name |
1458 | * @supply and with the embedded struct device refcount incremented by one, | 1458 | * @supply and with the embedded struct device refcount incremented by one. |
1459 | * or NULL on failure. The refcount must be dropped by calling put_device(). | 1459 | * The refcount must be dropped by calling put_device(). |
1460 | * On failure one of the following ERR-PTR-encoded values is returned: | ||
1461 | * -ENODEV if lookup fails permanently, -EPROBE_DEFER if lookup could succeed | ||
1462 | * in the future. | ||
1460 | */ | 1463 | */ |
1461 | static struct regulator_dev *regulator_dev_lookup(struct device *dev, | 1464 | static struct regulator_dev *regulator_dev_lookup(struct device *dev, |
1462 | const char *supply, | 1465 | const char *supply) |
1463 | int *ret) | ||
1464 | { | 1466 | { |
1465 | struct regulator_dev *r; | 1467 | struct regulator_dev *r; |
1466 | struct device_node *node; | 1468 | struct device_node *node; |
@@ -1476,16 +1478,12 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev, | |||
1476 | r = of_find_regulator_by_node(node); | 1478 | r = of_find_regulator_by_node(node); |
1477 | if (r) | 1479 | if (r) |
1478 | return r; | 1480 | return r; |
1479 | *ret = -EPROBE_DEFER; | 1481 | |
1480 | return NULL; | ||
1481 | } else { | ||
1482 | /* | 1482 | /* |
1483 | * If we couldn't even get the node then it's | 1483 | * We have a node, but there is no device. |
1484 | * not just that the device didn't register | 1484 | * assume it has not registered yet. |
1485 | * yet, there's no node and we'll never | ||
1486 | * succeed. | ||
1487 | */ | 1485 | */ |
1488 | *ret = -ENODEV; | 1486 | return ERR_PTR(-EPROBE_DEFER); |
1489 | } | 1487 | } |
1490 | } | 1488 | } |
1491 | 1489 | ||
@@ -1506,13 +1504,16 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev, | |||
1506 | 1504 | ||
1507 | if (strcmp(map->supply, supply) == 0 && | 1505 | if (strcmp(map->supply, supply) == 0 && |
1508 | get_device(&map->regulator->dev)) { | 1506 | get_device(&map->regulator->dev)) { |
1509 | mutex_unlock(®ulator_list_mutex); | 1507 | r = map->regulator; |
1510 | return map->regulator; | 1508 | break; |
1511 | } | 1509 | } |
1512 | } | 1510 | } |
1513 | mutex_unlock(®ulator_list_mutex); | 1511 | mutex_unlock(®ulator_list_mutex); |
1514 | 1512 | ||
1515 | return NULL; | 1513 | if (r) |
1514 | return r; | ||
1515 | |||
1516 | return ERR_PTR(-ENODEV); | ||
1516 | } | 1517 | } |
1517 | 1518 | ||
1518 | static int regulator_resolve_supply(struct regulator_dev *rdev) | 1519 | static int regulator_resolve_supply(struct regulator_dev *rdev) |
@@ -1529,8 +1530,10 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) | |||
1529 | if (rdev->supply) | 1530 | if (rdev->supply) |
1530 | return 0; | 1531 | return 0; |
1531 | 1532 | ||
1532 | r = regulator_dev_lookup(dev, rdev->supply_name, &ret); | 1533 | r = regulator_dev_lookup(dev, rdev->supply_name); |
1533 | if (!r) { | 1534 | if (IS_ERR(r)) { |
1535 | ret = PTR_ERR(r); | ||
1536 | |||
1534 | if (ret == -ENODEV) { | 1537 | if (ret == -ENODEV) { |
1535 | /* | 1538 | /* |
1536 | * No supply was specified for this regulator and | 1539 | * No supply was specified for this regulator and |
@@ -1553,6 +1556,19 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) | |||
1553 | } | 1556 | } |
1554 | } | 1557 | } |
1555 | 1558 | ||
1559 | /* | ||
1560 | * If the supply's parent device is not the same as the | ||
1561 | * regulator's parent device, then ensure the parent device | ||
1562 | * is bound before we resolve the supply, in case the parent | ||
1563 | * device get probe deferred and unregisters the supply. | ||
1564 | */ | ||
1565 | if (r->dev.parent && r->dev.parent != rdev->dev.parent) { | ||
1566 | if (!device_is_bound(r->dev.parent)) { | ||
1567 | put_device(&r->dev); | ||
1568 | return -EPROBE_DEFER; | ||
1569 | } | ||
1570 | } | ||
1571 | |||
1556 | /* Recursively resolve the supply of the supply */ | 1572 | /* Recursively resolve the supply of the supply */ |
1557 | ret = regulator_resolve_supply(r); | 1573 | ret = regulator_resolve_supply(r); |
1558 | if (ret < 0) { | 1574 | if (ret < 0) { |
@@ -1580,69 +1596,72 @@ static int regulator_resolve_supply(struct regulator_dev *rdev) | |||
1580 | } | 1596 | } |
1581 | 1597 | ||
1582 | /* Internal regulator request function */ | 1598 | /* Internal regulator request function */ |
1583 | static struct regulator *_regulator_get(struct device *dev, const char *id, | 1599 | struct regulator *_regulator_get(struct device *dev, const char *id, |
1584 | bool exclusive, bool allow_dummy) | 1600 | enum regulator_get_type get_type) |
1585 | { | 1601 | { |
1586 | struct regulator_dev *rdev; | 1602 | struct regulator_dev *rdev; |
1587 | struct regulator *regulator = ERR_PTR(-EPROBE_DEFER); | 1603 | struct regulator *regulator; |
1588 | const char *devname = NULL; | 1604 | const char *devname = dev ? dev_name(dev) : "deviceless"; |
1589 | int ret; | 1605 | int ret; |
1590 | 1606 | ||
1607 | if (get_type >= MAX_GET_TYPE) { | ||
1608 | dev_err(dev, "invalid type %d in %s\n", get_type, __func__); | ||
1609 | return ERR_PTR(-EINVAL); | ||
1610 | } | ||
1611 | |||
1591 | if (id == NULL) { | 1612 | if (id == NULL) { |
1592 | pr_err("get() with no identifier\n"); | 1613 | pr_err("get() with no identifier\n"); |
1593 | return ERR_PTR(-EINVAL); | 1614 | return ERR_PTR(-EINVAL); |
1594 | } | 1615 | } |
1595 | 1616 | ||
1596 | if (dev) | 1617 | rdev = regulator_dev_lookup(dev, id); |
1597 | devname = dev_name(dev); | 1618 | if (IS_ERR(rdev)) { |
1619 | ret = PTR_ERR(rdev); | ||
1598 | 1620 | ||
1599 | if (have_full_constraints()) | 1621 | /* |
1600 | ret = -ENODEV; | 1622 | * If regulator_dev_lookup() fails with error other |
1601 | else | 1623 | * than -ENODEV our job here is done, we simply return it. |
1602 | ret = -EPROBE_DEFER; | 1624 | */ |
1603 | 1625 | if (ret != -ENODEV) | |
1604 | rdev = regulator_dev_lookup(dev, id, &ret); | 1626 | return ERR_PTR(ret); |
1605 | if (rdev) | ||
1606 | goto found; | ||
1607 | |||
1608 | regulator = ERR_PTR(ret); | ||
1609 | 1627 | ||
1610 | /* | 1628 | if (!have_full_constraints()) { |
1611 | * If we have return value from dev_lookup fail, we do not expect to | 1629 | dev_warn(dev, |
1612 | * succeed, so, quit with appropriate error value | 1630 | "incomplete constraints, dummy supplies not allowed\n"); |
1613 | */ | 1631 | return ERR_PTR(-ENODEV); |
1614 | if (ret && ret != -ENODEV) | 1632 | } |
1615 | return regulator; | ||
1616 | 1633 | ||
1617 | if (!devname) | 1634 | switch (get_type) { |
1618 | devname = "deviceless"; | 1635 | case NORMAL_GET: |
1636 | /* | ||
1637 | * Assume that a regulator is physically present and | ||
1638 | * enabled, even if it isn't hooked up, and just | ||
1639 | * provide a dummy. | ||
1640 | */ | ||
1641 | dev_warn(dev, | ||
1642 | "%s supply %s not found, using dummy regulator\n", | ||
1643 | devname, id); | ||
1644 | rdev = dummy_regulator_rdev; | ||
1645 | get_device(&rdev->dev); | ||
1646 | break; | ||
1619 | 1647 | ||
1620 | /* | 1648 | case EXCLUSIVE_GET: |
1621 | * Assume that a regulator is physically present and enabled | 1649 | dev_warn(dev, |
1622 | * even if it isn't hooked up and just provide a dummy. | 1650 | "dummy supplies not allowed for exclusive requests\n"); |
1623 | */ | 1651 | /* fall through */ |
1624 | if (have_full_constraints() && allow_dummy) { | ||
1625 | pr_warn("%s supply %s not found, using dummy regulator\n", | ||
1626 | devname, id); | ||
1627 | 1652 | ||
1628 | rdev = dummy_regulator_rdev; | 1653 | default: |
1629 | get_device(&rdev->dev); | 1654 | return ERR_PTR(-ENODEV); |
1630 | goto found; | 1655 | } |
1631 | /* Don't log an error when called from regulator_get_optional() */ | ||
1632 | } else if (!have_full_constraints() || exclusive) { | ||
1633 | dev_warn(dev, "dummy supplies not allowed\n"); | ||
1634 | } | 1656 | } |
1635 | 1657 | ||
1636 | return regulator; | ||
1637 | |||
1638 | found: | ||
1639 | if (rdev->exclusive) { | 1658 | if (rdev->exclusive) { |
1640 | regulator = ERR_PTR(-EPERM); | 1659 | regulator = ERR_PTR(-EPERM); |
1641 | put_device(&rdev->dev); | 1660 | put_device(&rdev->dev); |
1642 | return regulator; | 1661 | return regulator; |
1643 | } | 1662 | } |
1644 | 1663 | ||
1645 | if (exclusive && rdev->open_count) { | 1664 | if (get_type == EXCLUSIVE_GET && rdev->open_count) { |
1646 | regulator = ERR_PTR(-EBUSY); | 1665 | regulator = ERR_PTR(-EBUSY); |
1647 | put_device(&rdev->dev); | 1666 | put_device(&rdev->dev); |
1648 | return regulator; | 1667 | return regulator; |
@@ -1656,6 +1675,7 @@ found: | |||
1656 | } | 1675 | } |
1657 | 1676 | ||
1658 | if (!try_module_get(rdev->owner)) { | 1677 | if (!try_module_get(rdev->owner)) { |
1678 | regulator = ERR_PTR(-EPROBE_DEFER); | ||
1659 | put_device(&rdev->dev); | 1679 | put_device(&rdev->dev); |
1660 | return regulator; | 1680 | return regulator; |
1661 | } | 1681 | } |
@@ -1669,7 +1689,7 @@ found: | |||
1669 | } | 1689 | } |
1670 | 1690 | ||
1671 | rdev->open_count++; | 1691 | rdev->open_count++; |
1672 | if (exclusive) { | 1692 | if (get_type == EXCLUSIVE_GET) { |
1673 | rdev->exclusive = 1; | 1693 | rdev->exclusive = 1; |
1674 | 1694 | ||
1675 | ret = _regulator_is_enabled(rdev); | 1695 | ret = _regulator_is_enabled(rdev); |
@@ -1697,7 +1717,7 @@ found: | |||
1697 | */ | 1717 | */ |
1698 | struct regulator *regulator_get(struct device *dev, const char *id) | 1718 | struct regulator *regulator_get(struct device *dev, const char *id) |
1699 | { | 1719 | { |
1700 | return _regulator_get(dev, id, false, true); | 1720 | return _regulator_get(dev, id, NORMAL_GET); |
1701 | } | 1721 | } |
1702 | EXPORT_SYMBOL_GPL(regulator_get); | 1722 | EXPORT_SYMBOL_GPL(regulator_get); |
1703 | 1723 | ||
@@ -1724,7 +1744,7 @@ EXPORT_SYMBOL_GPL(regulator_get); | |||
1724 | */ | 1744 | */ |
1725 | struct regulator *regulator_get_exclusive(struct device *dev, const char *id) | 1745 | struct regulator *regulator_get_exclusive(struct device *dev, const char *id) |
1726 | { | 1746 | { |
1727 | return _regulator_get(dev, id, true, false); | 1747 | return _regulator_get(dev, id, EXCLUSIVE_GET); |
1728 | } | 1748 | } |
1729 | EXPORT_SYMBOL_GPL(regulator_get_exclusive); | 1749 | EXPORT_SYMBOL_GPL(regulator_get_exclusive); |
1730 | 1750 | ||
@@ -1750,7 +1770,7 @@ EXPORT_SYMBOL_GPL(regulator_get_exclusive); | |||
1750 | */ | 1770 | */ |
1751 | struct regulator *regulator_get_optional(struct device *dev, const char *id) | 1771 | struct regulator *regulator_get_optional(struct device *dev, const char *id) |
1752 | { | 1772 | { |
1753 | return _regulator_get(dev, id, false, false); | 1773 | return _regulator_get(dev, id, OPTIONAL_GET); |
1754 | } | 1774 | } |
1755 | EXPORT_SYMBOL_GPL(regulator_get_optional); | 1775 | EXPORT_SYMBOL_GPL(regulator_get_optional); |
1756 | 1776 | ||
@@ -3660,7 +3680,7 @@ err: | |||
3660 | for (++i; i < num_consumers; ++i) { | 3680 | for (++i; i < num_consumers; ++i) { |
3661 | r = regulator_enable(consumers[i].consumer); | 3681 | r = regulator_enable(consumers[i].consumer); |
3662 | if (r != 0) | 3682 | if (r != 0) |
3663 | pr_err("Failed to reename %s: %d\n", | 3683 | pr_err("Failed to re-enable %s: %d\n", |
3664 | consumers[i].supply, r); | 3684 | consumers[i].supply, r); |
3665 | } | 3685 | } |
3666 | 3686 | ||
@@ -3686,21 +3706,17 @@ int regulator_bulk_force_disable(int num_consumers, | |||
3686 | struct regulator_bulk_data *consumers) | 3706 | struct regulator_bulk_data *consumers) |
3687 | { | 3707 | { |
3688 | int i; | 3708 | int i; |
3689 | int ret; | 3709 | int ret = 0; |
3690 | 3710 | ||
3691 | for (i = 0; i < num_consumers; i++) | 3711 | for (i = 0; i < num_consumers; i++) { |
3692 | consumers[i].ret = | 3712 | consumers[i].ret = |
3693 | regulator_force_disable(consumers[i].consumer); | 3713 | regulator_force_disable(consumers[i].consumer); |
3694 | 3714 | ||
3695 | for (i = 0; i < num_consumers; i++) { | 3715 | /* Store first error for reporting */ |
3696 | if (consumers[i].ret != 0) { | 3716 | if (consumers[i].ret && !ret) |
3697 | ret = consumers[i].ret; | 3717 | ret = consumers[i].ret; |
3698 | goto out; | ||
3699 | } | ||
3700 | } | 3718 | } |
3701 | 3719 | ||
3702 | return 0; | ||
3703 | out: | ||
3704 | return ret; | 3720 | return ret; |
3705 | } | 3721 | } |
3706 | EXPORT_SYMBOL_GPL(regulator_bulk_force_disable); | 3722 | EXPORT_SYMBOL_GPL(regulator_bulk_force_disable); |
@@ -4391,12 +4407,13 @@ static void regulator_summary_show_subtree(struct seq_file *s, | |||
4391 | seq_puts(s, "\n"); | 4407 | seq_puts(s, "\n"); |
4392 | 4408 | ||
4393 | list_for_each_entry(consumer, &rdev->consumer_list, list) { | 4409 | list_for_each_entry(consumer, &rdev->consumer_list, list) { |
4394 | if (consumer->dev->class == ®ulator_class) | 4410 | if (consumer->dev && consumer->dev->class == ®ulator_class) |
4395 | continue; | 4411 | continue; |
4396 | 4412 | ||
4397 | seq_printf(s, "%*s%-*s ", | 4413 | seq_printf(s, "%*s%-*s ", |
4398 | (level + 1) * 3 + 1, "", | 4414 | (level + 1) * 3 + 1, "", |
4399 | 30 - (level + 1) * 3, dev_name(consumer->dev)); | 4415 | 30 - (level + 1) * 3, |
4416 | consumer->dev ? dev_name(consumer->dev) : "deviceless"); | ||
4400 | 4417 | ||
4401 | switch (rdev->desc->type) { | 4418 | switch (rdev->desc->type) { |
4402 | case REGULATOR_VOLTAGE: | 4419 | case REGULATOR_VOLTAGE: |
@@ -4540,6 +4557,16 @@ static int __init regulator_init_complete(void) | |||
4540 | if (of_have_populated_dt()) | 4557 | if (of_have_populated_dt()) |
4541 | has_full_constraints = true; | 4558 | has_full_constraints = true; |
4542 | 4559 | ||
4560 | /* | ||
4561 | * Regulators may had failed to resolve their input supplies | ||
4562 | * when were registered, either because the input supply was | ||
4563 | * not registered yet or because its parent device was not | ||
4564 | * bound yet. So attempt to resolve the input supplies for | ||
4565 | * pending regulators before trying to disable unused ones. | ||
4566 | */ | ||
4567 | class_for_each_device(®ulator_class, NULL, NULL, | ||
4568 | regulator_register_resolve_supply); | ||
4569 | |||
4543 | /* If we have a full configuration then disable any regulators | 4570 | /* If we have a full configuration then disable any regulators |
4544 | * we have permission to change the status for and which are | 4571 | * we have permission to change the status for and which are |
4545 | * not in use or always_on. This is effectively the default | 4572 | * not in use or always_on. This is effectively the default |
diff --git a/drivers/regulator/cpcap-regulator.c b/drivers/regulator/cpcap-regulator.c new file mode 100644 index 000000000000..cc98aceed1c1 --- /dev/null +++ b/drivers/regulator/cpcap-regulator.c | |||
@@ -0,0 +1,464 @@ | |||
1 | /* | ||
2 | * Motorola CPCAP PMIC regulator driver | ||
3 | * | ||
4 | * Based on cpcap-regulator.c from Motorola Linux kernel tree | ||
5 | * Copyright (C) 2009-2011 Motorola, Inc. | ||
6 | * | ||
7 | * Rewritten for mainline kernel to use device tree and regmap | ||
8 | * Copyright (C) 2017 Tony Lindgren <tony@atomide.com> | ||
9 | * | ||
10 | * This program is free software; you can redistribute it and/or | ||
11 | * modify it under the terms of the GNU General Public License as | ||
12 | * published by the Free Software Foundation version 2. | ||
13 | * | ||
14 | * This program is distributed "as is" WITHOUT ANY WARRANTY of any | ||
15 | * kind, whether express or implied; without even the implied warranty | ||
16 | * of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the | ||
17 | * GNU General Public License for more details. | ||
18 | */ | ||
19 | |||
20 | #include <linux/err.h> | ||
21 | #include <linux/module.h> | ||
22 | #include <linux/of.h> | ||
23 | #include <linux/of_platform.h> | ||
24 | #include <linux/regmap.h> | ||
25 | #include <linux/regulator/driver.h> | ||
26 | #include <linux/regulator/machine.h> | ||
27 | #include <linux/regulator/of_regulator.h> | ||
28 | #include <linux/mfd/motorola-cpcap.h> | ||
29 | |||
30 | /* | ||
31 | * Resource assignment register bits. These seem to control the state | ||
32 | * idle modes adn are used at least for omap4. | ||
33 | */ | ||
34 | |||
35 | /* CPCAP_REG_ASSIGN2 bits - Resource Assignment 2 */ | ||
36 | #define CPCAP_BIT_VSDIO_SEL BIT(15) | ||
37 | #define CPCAP_BIT_VDIG_SEL BIT(14) | ||
38 | #define CPCAP_BIT_VCAM_SEL BIT(13) | ||
39 | #define CPCAP_BIT_SW6_SEL BIT(12) | ||
40 | #define CPCAP_BIT_SW5_SEL BIT(11) | ||
41 | #define CPCAP_BIT_SW4_SEL BIT(10) | ||
42 | #define CPCAP_BIT_SW3_SEL BIT(9) | ||
43 | #define CPCAP_BIT_SW2_SEL BIT(8) | ||
44 | #define CPCAP_BIT_SW1_SEL BIT(7) | ||
45 | |||
46 | /* CPCAP_REG_ASSIGN3 bits - Resource Assignment 3 */ | ||
47 | #define CPCAP_BIT_VUSBINT2_SEL BIT(15) | ||
48 | #define CPCAP_BIT_VUSBINT1_SEL BIT(14) | ||
49 | #define CPCAP_BIT_VVIB_SEL BIT(13) | ||
50 | #define CPCAP_BIT_VWLAN1_SEL BIT(12) | ||
51 | #define CPCAP_BIT_VRF1_SEL BIT(11) | ||
52 | #define CPCAP_BIT_VHVIO_SEL BIT(10) | ||
53 | #define CPCAP_BIT_VDAC_SEL BIT(9) | ||
54 | #define CPCAP_BIT_VUSB_SEL BIT(8) | ||
55 | #define CPCAP_BIT_VSIM_SEL BIT(7) | ||
56 | #define CPCAP_BIT_VRFREF_SEL BIT(6) | ||
57 | #define CPCAP_BIT_VPLL_SEL BIT(5) | ||
58 | #define CPCAP_BIT_VFUSE_SEL BIT(4) | ||
59 | #define CPCAP_BIT_VCSI_SEL BIT(3) | ||
60 | #define CPCAP_BIT_SPARE_14_2 BIT(2) | ||
61 | #define CPCAP_BIT_VWLAN2_SEL BIT(1) | ||
62 | #define CPCAP_BIT_VRF2_SEL BIT(0) | ||
63 | |||
64 | /* CPCAP_REG_ASSIGN4 bits - Resource Assignment 4 */ | ||
65 | #define CPCAP_BIT_VAUDIO_SEL BIT(0) | ||
66 | |||
67 | /* | ||
68 | * Enable register bits. At least CPCAP_BIT_AUDIO_LOW_PWR is generic, | ||
69 | * and not limited to audio regulator. Let's use the Motorola kernel | ||
70 | * naming for now until we have a better understanding of the other | ||
71 | * enable register bits. No idea why BIT(3) is not defined. | ||
72 | */ | ||
73 | #define CPCAP_BIT_AUDIO_LOW_PWR BIT(6) | ||
74 | #define CPCAP_BIT_AUD_LOWPWR_SPEED BIT(5) | ||
75 | #define CPCAP_BIT_VAUDIOPRISTBY BIT(4) | ||
76 | #define CPCAP_BIT_VAUDIO_MODE1 BIT(2) | ||
77 | #define CPCAP_BIT_VAUDIO_MODE0 BIT(1) | ||
78 | #define CPCAP_BIT_V_AUDIO_EN BIT(0) | ||
79 | |||
80 | /* | ||
81 | * Off mode configuration bit. Used currently only by SW5 on omap4. There's | ||
82 | * the following comment in Motorola Linux kernel tree for it: | ||
83 | * | ||
84 | * When set in the regulator mode, the regulator assignment will be changed | ||
85 | * to secondary when the regulator is disabled. The mode will be set back to | ||
86 | * primary when the regulator is turned on. | ||
87 | */ | ||
88 | #define CPCAP_REG_OFF_MODE_SEC BIT(15) | ||
89 | |||
90 | /** | ||
91 | * SoC specific configuraion for CPCAP regulator. There are at least three | ||
92 | * different SoCs each with their own parameters: omap3, omap4 and tegra2. | ||
93 | * | ||
94 | * The assign_reg and assign_mask seem to allow toggling between primary | ||
95 | * and secondary mode that at least omap4 uses for off mode. | ||
96 | */ | ||
97 | struct cpcap_regulator { | ||
98 | struct regulator_desc rdesc; | ||
99 | const u16 assign_reg; | ||
100 | const u16 assign_mask; | ||
101 | const u16 vsel_shift; | ||
102 | }; | ||
103 | |||
104 | #define CPCAP_REG(_ID, reg, assignment_reg, assignment_mask, val_tbl, \ | ||
105 | mode_mask, volt_mask, volt_shft, \ | ||
106 | mode_val, off_val, volt_trans_time) { \ | ||
107 | .rdesc = { \ | ||
108 | .name = #_ID, \ | ||
109 | .of_match = of_match_ptr(#_ID), \ | ||
110 | .ops = &cpcap_regulator_ops, \ | ||
111 | .regulators_node = of_match_ptr("regulators"), \ | ||
112 | .type = REGULATOR_VOLTAGE, \ | ||
113 | .id = CPCAP_##_ID, \ | ||
114 | .owner = THIS_MODULE, \ | ||
115 | .n_voltages = ARRAY_SIZE(val_tbl), \ | ||
116 | .volt_table = (val_tbl), \ | ||
117 | .vsel_reg = (reg), \ | ||
118 | .vsel_mask = (volt_mask), \ | ||
119 | .enable_reg = (reg), \ | ||
120 | .enable_mask = (mode_mask), \ | ||
121 | .enable_val = (mode_val), \ | ||
122 | .disable_val = (off_val), \ | ||
123 | .ramp_delay = (volt_trans_time), \ | ||
124 | }, \ | ||
125 | .assign_reg = (assignment_reg), \ | ||
126 | .assign_mask = (assignment_mask), \ | ||
127 | .vsel_shift = (volt_shft), \ | ||
128 | } | ||
129 | |||
130 | struct cpcap_ddata { | ||
131 | struct regmap *reg; | ||
132 | struct device *dev; | ||
133 | const struct cpcap_regulator *soc; | ||
134 | }; | ||
135 | |||
136 | enum cpcap_regulator_id { | ||
137 | CPCAP_SW1, | ||
138 | CPCAP_SW2, | ||
139 | CPCAP_SW3, | ||
140 | CPCAP_SW4, | ||
141 | CPCAP_SW5, | ||
142 | CPCAP_SW6, | ||
143 | CPCAP_VCAM, | ||
144 | CPCAP_VCSI, | ||
145 | CPCAP_VDAC, | ||
146 | CPCAP_VDIG, | ||
147 | CPCAP_VFUSE, | ||
148 | CPCAP_VHVIO, | ||
149 | CPCAP_VSDIO, | ||
150 | CPCAP_VPLL, | ||
151 | CPCAP_VRF1, | ||
152 | CPCAP_VRF2, | ||
153 | CPCAP_VRFREF, | ||
154 | CPCAP_VWLAN1, | ||
155 | CPCAP_VWLAN2, | ||
156 | CPCAP_VSIM, | ||
157 | CPCAP_VSIMCARD, | ||
158 | CPCAP_VVIB, | ||
159 | CPCAP_VUSB, | ||
160 | CPCAP_VAUDIO, | ||
161 | CPCAP_NR_REGULATORS, | ||
162 | }; | ||
163 | |||
164 | /* | ||
165 | * We need to also configure regulator idle mode for SoC off mode if | ||
166 | * CPCAP_REG_OFF_MODE_SEC is set. | ||
167 | */ | ||
168 | static int cpcap_regulator_enable(struct regulator_dev *rdev) | ||
169 | { | ||
170 | struct cpcap_regulator *regulator = rdev_get_drvdata(rdev); | ||
171 | int error, ignore; | ||
172 | |||
173 | error = regulator_enable_regmap(rdev); | ||
174 | if (error) | ||
175 | return error; | ||
176 | |||
177 | if (rdev->desc->enable_val & CPCAP_REG_OFF_MODE_SEC) { | ||
178 | error = regmap_update_bits(rdev->regmap, regulator->assign_reg, | ||
179 | regulator->assign_mask, | ||
180 | regulator->assign_mask); | ||
181 | if (error) | ||
182 | ignore = regulator_disable_regmap(rdev); | ||
183 | } | ||
184 | |||
185 | return error; | ||
186 | } | ||
187 | |||
188 | /* | ||
189 | * We need to also configure regulator idle mode for SoC off mode if | ||
190 | * CPCAP_REG_OFF_MODE_SEC is set. | ||
191 | */ | ||
192 | static int cpcap_regulator_disable(struct regulator_dev *rdev) | ||
193 | { | ||
194 | struct cpcap_regulator *regulator = rdev_get_drvdata(rdev); | ||
195 | int error, ignore; | ||
196 | |||
197 | if (rdev->desc->enable_val & CPCAP_REG_OFF_MODE_SEC) { | ||
198 | error = regmap_update_bits(rdev->regmap, regulator->assign_reg, | ||
199 | regulator->assign_mask, 0); | ||
200 | if (error) | ||
201 | return error; | ||
202 | } | ||
203 | |||
204 | error = regulator_disable_regmap(rdev); | ||
205 | if (error && (rdev->desc->enable_val & CPCAP_REG_OFF_MODE_SEC)) { | ||
206 | ignore = regmap_update_bits(rdev->regmap, regulator->assign_reg, | ||
207 | regulator->assign_mask, | ||
208 | regulator->assign_mask); | ||
209 | } | ||
210 | |||
211 | return error; | ||
212 | } | ||
213 | |||
214 | static unsigned int cpcap_regulator_get_mode(struct regulator_dev *rdev) | ||
215 | { | ||
216 | int value; | ||
217 | |||
218 | regmap_read(rdev->regmap, rdev->desc->enable_reg, &value); | ||
219 | |||
220 | if (!(value & CPCAP_BIT_AUDIO_LOW_PWR)) | ||
221 | return REGULATOR_MODE_STANDBY; | ||
222 | |||
223 | return REGULATOR_MODE_NORMAL; | ||
224 | } | ||
225 | |||
226 | static int cpcap_regulator_set_mode(struct regulator_dev *rdev, | ||
227 | unsigned int mode) | ||
228 | { | ||
229 | int value; | ||
230 | |||
231 | switch (mode) { | ||
232 | case REGULATOR_MODE_NORMAL: | ||
233 | value = CPCAP_BIT_AUDIO_LOW_PWR; | ||
234 | break; | ||
235 | case REGULATOR_MODE_STANDBY: | ||
236 | value = 0; | ||
237 | break; | ||
238 | default: | ||
239 | return -EINVAL; | ||
240 | } | ||
241 | |||
242 | return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg, | ||
243 | CPCAP_BIT_AUDIO_LOW_PWR, value); | ||
244 | } | ||
245 | |||
246 | static struct regulator_ops cpcap_regulator_ops = { | ||
247 | .enable = cpcap_regulator_enable, | ||
248 | .disable = cpcap_regulator_disable, | ||
249 | .is_enabled = regulator_is_enabled_regmap, | ||
250 | .list_voltage = regulator_list_voltage_table, | ||
251 | .map_voltage = regulator_map_voltage_iterate, | ||
252 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | ||
253 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | ||
254 | .get_mode = cpcap_regulator_get_mode, | ||
255 | .set_mode = cpcap_regulator_set_mode, | ||
256 | }; | ||
257 | |||
258 | static const unsigned int unknown_val_tbl[] = { 0, }; | ||
259 | static const unsigned int sw5_val_tbl[] = { 0, 5050000, }; | ||
260 | static const unsigned int vcam_val_tbl[] = { 2600000, 2700000, 2800000, | ||
261 | 2900000, }; | ||
262 | static const unsigned int vcsi_val_tbl[] = { 1200000, 1800000, }; | ||
263 | static const unsigned int vdac_val_tbl[] = { 1200000, 1500000, 1800000, | ||
264 | 2500000,}; | ||
265 | static const unsigned int vdig_val_tbl[] = { 1200000, 1350000, 1500000, | ||
266 | 1875000, }; | ||
267 | static const unsigned int vfuse_val_tbl[] = { 1500000, 1600000, 1700000, | ||
268 | 1800000, 1900000, 2000000, | ||
269 | 2100000, 2200000, 2300000, | ||
270 | 2400000, 2500000, 2600000, | ||
271 | 2700000, 3150000, }; | ||
272 | static const unsigned int vhvio_val_tbl[] = { 2775000, }; | ||
273 | static const unsigned int vsdio_val_tbl[] = { 1500000, 1600000, 1800000, | ||
274 | 2600000, 2700000, 2800000, | ||
275 | 2900000, 3000000, }; | ||
276 | static const unsigned int vpll_val_tbl[] = { 1200000, 1300000, 1400000, | ||
277 | 1800000, }; | ||
278 | /* Quirk: 2775000 is before 2500000 for vrf1 regulator */ | ||
279 | static const unsigned int vrf1_val_tbl[] = { 2775000, 2500000, }; | ||
280 | static const unsigned int vrf2_val_tbl[] = { 0, 2775000, }; | ||
281 | static const unsigned int vrfref_val_tbl[] = { 2500000, 2775000, }; | ||
282 | static const unsigned int vwlan1_val_tbl[] = { 1800000, 1900000, }; | ||
283 | static const unsigned int vwlan2_val_tbl[] = { 2775000, 3000000, 3300000, | ||
284 | 3300000, }; | ||
285 | static const unsigned int vsim_val_tbl[] = { 1800000, 2900000, }; | ||
286 | static const unsigned int vsimcard_val_tbl[] = { 1800000, 2900000, }; | ||
287 | static const unsigned int vvib_val_tbl[] = { 1300000, 1800000, 2000000, | ||
288 | 3000000, }; | ||
289 | static const unsigned int vusb_val_tbl[] = { 0, 3300000, }; | ||
290 | static const unsigned int vaudio_val_tbl[] = { 0, 2775000, }; | ||
291 | |||
292 | /** | ||
293 | * SoC specific configuration for omap4. The data below is comes from Motorola | ||
294 | * Linux kernel tree. It's basically the values of cpcap_regltr_data, | ||
295 | * cpcap_regulator_mode_values and cpcap_regulator_off_mode_values, see | ||
296 | * CPCAP_REG macro above. | ||
297 | * | ||
298 | * SW1 to SW4 and SW6 seems to be unused for mapphone. Note that VSIM and | ||
299 | * VSIMCARD have a shared resource assignment bit. | ||
300 | */ | ||
301 | static struct cpcap_regulator omap4_regulators[] = { | ||
302 | CPCAP_REG(SW1, CPCAP_REG_S1C1, CPCAP_REG_ASSIGN2, | ||
303 | CPCAP_BIT_SW1_SEL, unknown_val_tbl, | ||
304 | 0, 0, 0, 0, 0, 0), | ||
305 | CPCAP_REG(SW2, CPCAP_REG_S2C1, CPCAP_REG_ASSIGN2, | ||
306 | CPCAP_BIT_SW2_SEL, unknown_val_tbl, | ||
307 | 0, 0, 0, 0, 0, 0), | ||
308 | CPCAP_REG(SW3, CPCAP_REG_S3C, CPCAP_REG_ASSIGN2, | ||
309 | CPCAP_BIT_SW3_SEL, unknown_val_tbl, | ||
310 | 0, 0, 0, 0, 0, 0), | ||
311 | CPCAP_REG(SW4, CPCAP_REG_S4C1, CPCAP_REG_ASSIGN2, | ||
312 | CPCAP_BIT_SW4_SEL, unknown_val_tbl, | ||
313 | 0, 0, 0, 0, 0, 0), | ||
314 | CPCAP_REG(SW5, CPCAP_REG_S5C, CPCAP_REG_ASSIGN2, | ||
315 | CPCAP_BIT_SW5_SEL, sw5_val_tbl, | ||
316 | 0x28, 0, 0, 0x20 | CPCAP_REG_OFF_MODE_SEC, 0, 0), | ||
317 | CPCAP_REG(SW6, CPCAP_REG_S6C, CPCAP_REG_ASSIGN2, | ||
318 | CPCAP_BIT_SW6_SEL, unknown_val_tbl, | ||
319 | 0, 0, 0, 0, 0, 0), | ||
320 | CPCAP_REG(VCAM, CPCAP_REG_VCAMC, CPCAP_REG_ASSIGN2, | ||
321 | CPCAP_BIT_VCAM_SEL, vcam_val_tbl, | ||
322 | 0x87, 0x30, 4, 0x3, 0, 420), | ||
323 | CPCAP_REG(VCSI, CPCAP_REG_VCSIC, CPCAP_REG_ASSIGN3, | ||
324 | CPCAP_BIT_VCSI_SEL, vcsi_val_tbl, | ||
325 | 0x47, 0x10, 4, 0x43, 0x41, 350), | ||
326 | CPCAP_REG(VDAC, CPCAP_REG_VDACC, CPCAP_REG_ASSIGN3, | ||
327 | CPCAP_BIT_VDAC_SEL, vdac_val_tbl, | ||
328 | 0x87, 0x30, 4, 0x3, 0, 420), | ||
329 | CPCAP_REG(VDIG, CPCAP_REG_VDIGC, CPCAP_REG_ASSIGN2, | ||
330 | CPCAP_BIT_VDIG_SEL, vdig_val_tbl, | ||
331 | 0x87, 0x30, 4, 0x82, 0, 420), | ||
332 | CPCAP_REG(VFUSE, CPCAP_REG_VFUSEC, CPCAP_REG_ASSIGN3, | ||
333 | CPCAP_BIT_VFUSE_SEL, vfuse_val_tbl, | ||
334 | 0x80, 0xf, 0, 0x80, 0, 420), | ||
335 | CPCAP_REG(VHVIO, CPCAP_REG_VHVIOC, CPCAP_REG_ASSIGN3, | ||
336 | CPCAP_BIT_VHVIO_SEL, vhvio_val_tbl, | ||
337 | 0x17, 0, 0, 0, 0x12, 0), | ||
338 | CPCAP_REG(VSDIO, CPCAP_REG_VSDIOC, CPCAP_REG_ASSIGN2, | ||
339 | CPCAP_BIT_VSDIO_SEL, vsdio_val_tbl, | ||
340 | 0x87, 0x38, 3, 0x82, 0, 420), | ||
341 | CPCAP_REG(VPLL, CPCAP_REG_VPLLC, CPCAP_REG_ASSIGN3, | ||
342 | CPCAP_BIT_VPLL_SEL, vpll_val_tbl, | ||
343 | 0x43, 0x18, 3, 0x2, 0, 420), | ||
344 | CPCAP_REG(VRF1, CPCAP_REG_VRF1C, CPCAP_REG_ASSIGN3, | ||
345 | CPCAP_BIT_VRF1_SEL, vrf1_val_tbl, | ||
346 | 0xac, 0x2, 1, 0x4, 0, 10), | ||
347 | CPCAP_REG(VRF2, CPCAP_REG_VRF2C, CPCAP_REG_ASSIGN3, | ||
348 | CPCAP_BIT_VRF2_SEL, vrf2_val_tbl, | ||
349 | 0x23, 0x8, 3, 0, 0, 10), | ||
350 | CPCAP_REG(VRFREF, CPCAP_REG_VRFREFC, CPCAP_REG_ASSIGN3, | ||
351 | CPCAP_BIT_VRFREF_SEL, vrfref_val_tbl, | ||
352 | 0x23, 0x8, 3, 0, 0, 420), | ||
353 | CPCAP_REG(VWLAN1, CPCAP_REG_VWLAN1C, CPCAP_REG_ASSIGN3, | ||
354 | CPCAP_BIT_VWLAN1_SEL, vwlan1_val_tbl, | ||
355 | 0x47, 0x10, 4, 0, 0, 420), | ||
356 | CPCAP_REG(VWLAN2, CPCAP_REG_VWLAN2C, CPCAP_REG_ASSIGN3, | ||
357 | CPCAP_BIT_VWLAN2_SEL, vwlan2_val_tbl, | ||
358 | 0x20c, 0xc0, 6, 0x20c, 0, 420), | ||
359 | CPCAP_REG(VSIM, CPCAP_REG_VSIMC, CPCAP_REG_ASSIGN3, | ||
360 | 0xffff, vsim_val_tbl, | ||
361 | 0x23, 0x8, 3, 0x3, 0, 420), | ||
362 | CPCAP_REG(VSIMCARD, CPCAP_REG_VSIMC, CPCAP_REG_ASSIGN3, | ||
363 | 0xffff, vsimcard_val_tbl, | ||
364 | 0x1e80, 0x8, 3, 0x1e00, 0, 420), | ||
365 | CPCAP_REG(VVIB, CPCAP_REG_VVIBC, CPCAP_REG_ASSIGN3, | ||
366 | CPCAP_BIT_VVIB_SEL, vvib_val_tbl, | ||
367 | 0x1, 0xc, 2, 0x1, 0, 500), | ||
368 | CPCAP_REG(VUSB, CPCAP_REG_VUSBC, CPCAP_REG_ASSIGN3, | ||
369 | CPCAP_BIT_VUSB_SEL, vusb_val_tbl, | ||
370 | 0x11c, 0x40, 6, 0xc, 0, 0), | ||
371 | CPCAP_REG(VAUDIO, CPCAP_REG_VAUDIOC, CPCAP_REG_ASSIGN4, | ||
372 | CPCAP_BIT_VAUDIO_SEL, vaudio_val_tbl, | ||
373 | 0x16, 0x1, 0, 0x4, 0, 0), | ||
374 | { /* sentinel */ }, | ||
375 | }; | ||
376 | |||
377 | static const struct of_device_id cpcap_regulator_id_table[] = { | ||
378 | { | ||
379 | .compatible = "motorola,cpcap-regulator", | ||
380 | }, | ||
381 | { | ||
382 | .compatible = "motorola,mapphone-cpcap-regulator", | ||
383 | .data = omap4_regulators, | ||
384 | }, | ||
385 | {}, | ||
386 | }; | ||
387 | MODULE_DEVICE_TABLE(of, cpcap_regulator_id_table); | ||
388 | |||
389 | static int cpcap_regulator_probe(struct platform_device *pdev) | ||
390 | { | ||
391 | struct cpcap_ddata *ddata; | ||
392 | const struct of_device_id *match; | ||
393 | struct regulator_config config; | ||
394 | struct regulator_init_data init_data; | ||
395 | int i; | ||
396 | |||
397 | match = of_match_device(of_match_ptr(cpcap_regulator_id_table), | ||
398 | &pdev->dev); | ||
399 | if (!match) | ||
400 | return -EINVAL; | ||
401 | |||
402 | if (!match->data) { | ||
403 | dev_err(&pdev->dev, "no configuration data found\n"); | ||
404 | |||
405 | return -ENODEV; | ||
406 | } | ||
407 | |||
408 | ddata = devm_kzalloc(&pdev->dev, sizeof(*ddata), GFP_KERNEL); | ||
409 | if (!ddata) | ||
410 | return -ENOMEM; | ||
411 | |||
412 | ddata->reg = dev_get_regmap(pdev->dev.parent, NULL); | ||
413 | if (!ddata->reg) | ||
414 | return -ENODEV; | ||
415 | |||
416 | ddata->dev = &pdev->dev; | ||
417 | ddata->soc = match->data; | ||
418 | platform_set_drvdata(pdev, ddata); | ||
419 | |||
420 | memset(&config, 0, sizeof(config)); | ||
421 | memset(&init_data, 0, sizeof(init_data)); | ||
422 | config.dev = &pdev->dev; | ||
423 | config.regmap = ddata->reg; | ||
424 | config.init_data = &init_data; | ||
425 | |||
426 | for (i = 0; i < CPCAP_NR_REGULATORS; i++) { | ||
427 | const struct cpcap_regulator *regulator = &ddata->soc[i]; | ||
428 | struct regulator_dev *rdev; | ||
429 | |||
430 | if (!regulator->rdesc.name) | ||
431 | break; | ||
432 | |||
433 | if (regulator->rdesc.volt_table == unknown_val_tbl) | ||
434 | continue; | ||
435 | |||
436 | config.driver_data = (void *)regulator; | ||
437 | rdev = devm_regulator_register(&pdev->dev, | ||
438 | ®ulator->rdesc, | ||
439 | &config); | ||
440 | if (IS_ERR(rdev)) { | ||
441 | dev_err(&pdev->dev, "failed to register regulator %s\n", | ||
442 | regulator->rdesc.name); | ||
443 | |||
444 | return PTR_ERR(rdev); | ||
445 | } | ||
446 | } | ||
447 | |||
448 | return 0; | ||
449 | } | ||
450 | |||
451 | static struct platform_driver cpcap_regulator_driver = { | ||
452 | .probe = cpcap_regulator_probe, | ||
453 | .driver = { | ||
454 | .name = "cpcap-regulator", | ||
455 | .of_match_table = of_match_ptr(cpcap_regulator_id_table), | ||
456 | }, | ||
457 | }; | ||
458 | |||
459 | module_platform_driver(cpcap_regulator_driver); | ||
460 | |||
461 | MODULE_ALIAS("platform:cpcap-regulator"); | ||
462 | MODULE_AUTHOR("Tony Lindgren <tony@atomide.com>"); | ||
463 | MODULE_DESCRIPTION("CPCAP regulator driver"); | ||
464 | MODULE_LICENSE("GPL v2"); | ||
diff --git a/drivers/regulator/devres.c b/drivers/regulator/devres.c index 6ec1d400adae..784e3bf32210 100644 --- a/drivers/regulator/devres.c +++ b/drivers/regulator/devres.c | |||
@@ -19,12 +19,6 @@ | |||
19 | 19 | ||
20 | #include "internal.h" | 20 | #include "internal.h" |
21 | 21 | ||
22 | enum { | ||
23 | NORMAL_GET, | ||
24 | EXCLUSIVE_GET, | ||
25 | OPTIONAL_GET, | ||
26 | }; | ||
27 | |||
28 | static void devm_regulator_release(struct device *dev, void *res) | 22 | static void devm_regulator_release(struct device *dev, void *res) |
29 | { | 23 | { |
30 | regulator_put(*(struct regulator **)res); | 24 | regulator_put(*(struct regulator **)res); |
@@ -39,20 +33,7 @@ static struct regulator *_devm_regulator_get(struct device *dev, const char *id, | |||
39 | if (!ptr) | 33 | if (!ptr) |
40 | return ERR_PTR(-ENOMEM); | 34 | return ERR_PTR(-ENOMEM); |
41 | 35 | ||
42 | switch (get_type) { | 36 | regulator = _regulator_get(dev, id, get_type); |
43 | case NORMAL_GET: | ||
44 | regulator = regulator_get(dev, id); | ||
45 | break; | ||
46 | case EXCLUSIVE_GET: | ||
47 | regulator = regulator_get_exclusive(dev, id); | ||
48 | break; | ||
49 | case OPTIONAL_GET: | ||
50 | regulator = regulator_get_optional(dev, id); | ||
51 | break; | ||
52 | default: | ||
53 | regulator = ERR_PTR(-EINVAL); | ||
54 | } | ||
55 | |||
56 | if (!IS_ERR(regulator)) { | 37 | if (!IS_ERR(regulator)) { |
57 | *ptr = regulator; | 38 | *ptr = regulator; |
58 | devres_add(dev, ptr); | 39 | devres_add(dev, ptr); |
@@ -139,6 +120,18 @@ void devm_regulator_put(struct regulator *regulator) | |||
139 | } | 120 | } |
140 | EXPORT_SYMBOL_GPL(devm_regulator_put); | 121 | EXPORT_SYMBOL_GPL(devm_regulator_put); |
141 | 122 | ||
123 | struct regulator_bulk_devres { | ||
124 | struct regulator_bulk_data *consumers; | ||
125 | int num_consumers; | ||
126 | }; | ||
127 | |||
128 | static void devm_regulator_bulk_release(struct device *dev, void *res) | ||
129 | { | ||
130 | struct regulator_bulk_devres *devres = res; | ||
131 | |||
132 | regulator_bulk_free(devres->num_consumers, devres->consumers); | ||
133 | } | ||
134 | |||
142 | /** | 135 | /** |
143 | * devm_regulator_bulk_get - managed get multiple regulator consumers | 136 | * devm_regulator_bulk_get - managed get multiple regulator consumers |
144 | * | 137 | * |
@@ -157,29 +150,22 @@ EXPORT_SYMBOL_GPL(devm_regulator_put); | |||
157 | int devm_regulator_bulk_get(struct device *dev, int num_consumers, | 150 | int devm_regulator_bulk_get(struct device *dev, int num_consumers, |
158 | struct regulator_bulk_data *consumers) | 151 | struct regulator_bulk_data *consumers) |
159 | { | 152 | { |
160 | int i; | 153 | struct regulator_bulk_devres *devres; |
161 | int ret; | 154 | int ret; |
162 | 155 | ||
163 | for (i = 0; i < num_consumers; i++) | 156 | devres = devres_alloc(devm_regulator_bulk_release, |
164 | consumers[i].consumer = NULL; | 157 | sizeof(*devres), GFP_KERNEL); |
165 | 158 | if (!devres) | |
166 | for (i = 0; i < num_consumers; i++) { | 159 | return -ENOMEM; |
167 | consumers[i].consumer = devm_regulator_get(dev, | ||
168 | consumers[i].supply); | ||
169 | if (IS_ERR(consumers[i].consumer)) { | ||
170 | ret = PTR_ERR(consumers[i].consumer); | ||
171 | dev_err(dev, "Failed to get supply '%s': %d\n", | ||
172 | consumers[i].supply, ret); | ||
173 | consumers[i].consumer = NULL; | ||
174 | goto err; | ||
175 | } | ||
176 | } | ||
177 | |||
178 | return 0; | ||
179 | 160 | ||
180 | err: | 161 | ret = regulator_bulk_get(dev, num_consumers, consumers); |
181 | for (i = 0; i < num_consumers && consumers[i].consumer; i++) | 162 | if (!ret) { |
182 | devm_regulator_put(consumers[i].consumer); | 163 | devres->consumers = consumers; |
164 | devres->num_consumers = num_consumers; | ||
165 | devres_add(dev, devres); | ||
166 | } else { | ||
167 | devres_free(devres); | ||
168 | } | ||
183 | 169 | ||
184 | return ret; | 170 | return ret; |
185 | } | 171 | } |
diff --git a/drivers/regulator/fan53555.c b/drivers/regulator/fan53555.c index d7da81a875cf..60f431831582 100644 --- a/drivers/regulator/fan53555.c +++ b/drivers/regulator/fan53555.c | |||
@@ -202,7 +202,7 @@ static int fan53555_set_ramp(struct regulator_dev *rdev, int ramp) | |||
202 | CTL_SLEW_MASK, regval << CTL_SLEW_SHIFT); | 202 | CTL_SLEW_MASK, regval << CTL_SLEW_SHIFT); |
203 | } | 203 | } |
204 | 204 | ||
205 | static struct regulator_ops fan53555_regulator_ops = { | 205 | static const struct regulator_ops fan53555_regulator_ops = { |
206 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 206 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
207 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 207 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
208 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | 208 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
diff --git a/drivers/regulator/hi655x-regulator.c b/drivers/regulator/hi655x-regulator.c index aca18466f522..065c100e9a03 100644 --- a/drivers/regulator/hi655x-regulator.c +++ b/drivers/regulator/hi655x-regulator.c | |||
@@ -96,7 +96,7 @@ static int hi655x_disable(struct regulator_dev *rdev) | |||
96 | return ret; | 96 | return ret; |
97 | } | 97 | } |
98 | 98 | ||
99 | static struct regulator_ops hi655x_regulator_ops = { | 99 | static const struct regulator_ops hi655x_regulator_ops = { |
100 | .enable = regulator_enable_regmap, | 100 | .enable = regulator_enable_regmap, |
101 | .disable = hi655x_disable, | 101 | .disable = hi655x_disable, |
102 | .is_enabled = hi655x_is_enabled, | 102 | .is_enabled = hi655x_is_enabled, |
@@ -105,7 +105,7 @@ static struct regulator_ops hi655x_regulator_ops = { | |||
105 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 105 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
106 | }; | 106 | }; |
107 | 107 | ||
108 | static struct regulator_ops hi655x_ldo_linear_ops = { | 108 | static const struct regulator_ops hi655x_ldo_linear_ops = { |
109 | .enable = regulator_enable_regmap, | 109 | .enable = regulator_enable_regmap, |
110 | .disable = hi655x_disable, | 110 | .disable = hi655x_disable, |
111 | .is_enabled = hi655x_is_enabled, | 111 | .is_enabled = hi655x_is_enabled, |
diff --git a/drivers/regulator/internal.h b/drivers/regulator/internal.h index c74ac8734023..1dd575b28564 100644 --- a/drivers/regulator/internal.h +++ b/drivers/regulator/internal.h | |||
@@ -51,4 +51,14 @@ regulator_of_get_init_data(struct device *dev, | |||
51 | } | 51 | } |
52 | #endif | 52 | #endif |
53 | 53 | ||
54 | enum regulator_get_type { | ||
55 | NORMAL_GET, | ||
56 | EXCLUSIVE_GET, | ||
57 | OPTIONAL_GET, | ||
58 | MAX_GET_TYPE | ||
59 | }; | ||
60 | |||
61 | struct regulator *_regulator_get(struct device *dev, const char *id, | ||
62 | enum regulator_get_type get_type); | ||
63 | |||
54 | #endif | 64 | #endif |
diff --git a/drivers/regulator/lp8755.c b/drivers/regulator/lp8755.c index d6773da925ba..db34e1da75ef 100644 --- a/drivers/regulator/lp8755.c +++ b/drivers/regulator/lp8755.c | |||
@@ -227,7 +227,7 @@ err_i2c: | |||
227 | return ret; | 227 | return ret; |
228 | } | 228 | } |
229 | 229 | ||
230 | static struct regulator_ops lp8755_buck_ops = { | 230 | static const struct regulator_ops lp8755_buck_ops = { |
231 | .map_voltage = regulator_map_voltage_linear, | 231 | .map_voltage = regulator_map_voltage_linear, |
232 | .list_voltage = regulator_list_voltage_linear, | 232 | .list_voltage = regulator_list_voltage_linear, |
233 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 233 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
diff --git a/drivers/regulator/ltc3589.c b/drivers/regulator/ltc3589.c index 47bef328fb58..a7a1a0313bbf 100644 --- a/drivers/regulator/ltc3589.c +++ b/drivers/regulator/ltc3589.c | |||
@@ -161,7 +161,7 @@ static int ltc3589_set_suspend_mode(struct regulator_dev *rdev, | |||
161 | } | 161 | } |
162 | 162 | ||
163 | /* SW1, SW2, SW3, LDO2 */ | 163 | /* SW1, SW2, SW3, LDO2 */ |
164 | static struct regulator_ops ltc3589_linear_regulator_ops = { | 164 | static const struct regulator_ops ltc3589_linear_regulator_ops = { |
165 | .enable = regulator_enable_regmap, | 165 | .enable = regulator_enable_regmap, |
166 | .disable = regulator_disable_regmap, | 166 | .disable = regulator_disable_regmap, |
167 | .is_enabled = regulator_is_enabled_regmap, | 167 | .is_enabled = regulator_is_enabled_regmap, |
@@ -175,18 +175,18 @@ static struct regulator_ops ltc3589_linear_regulator_ops = { | |||
175 | }; | 175 | }; |
176 | 176 | ||
177 | /* BB_OUT, LDO3 */ | 177 | /* BB_OUT, LDO3 */ |
178 | static struct regulator_ops ltc3589_fixed_regulator_ops = { | 178 | static const struct regulator_ops ltc3589_fixed_regulator_ops = { |
179 | .enable = regulator_enable_regmap, | 179 | .enable = regulator_enable_regmap, |
180 | .disable = regulator_disable_regmap, | 180 | .disable = regulator_disable_regmap, |
181 | .is_enabled = regulator_is_enabled_regmap, | 181 | .is_enabled = regulator_is_enabled_regmap, |
182 | }; | 182 | }; |
183 | 183 | ||
184 | /* LDO1 */ | 184 | /* LDO1 */ |
185 | static struct regulator_ops ltc3589_fixed_standby_regulator_ops = { | 185 | static const struct regulator_ops ltc3589_fixed_standby_regulator_ops = { |
186 | }; | 186 | }; |
187 | 187 | ||
188 | /* LDO4 */ | 188 | /* LDO4 */ |
189 | static struct regulator_ops ltc3589_table_regulator_ops = { | 189 | static const struct regulator_ops ltc3589_table_regulator_ops = { |
190 | .enable = regulator_enable_regmap, | 190 | .enable = regulator_enable_regmap, |
191 | .disable = regulator_disable_regmap, | 191 | .disable = regulator_disable_regmap, |
192 | .is_enabled = regulator_is_enabled_regmap, | 192 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/ltc3676.c b/drivers/regulator/ltc3676.c index e2b476ca2b4d..503cd90eba39 100644 --- a/drivers/regulator/ltc3676.c +++ b/drivers/regulator/ltc3676.c | |||
@@ -161,7 +161,7 @@ static int ltc3676_of_parse_cb(struct device_node *np, | |||
161 | } | 161 | } |
162 | 162 | ||
163 | /* SW1, SW2, SW3, SW4 linear 0.8V-3.3V with scalar via R1/R2 feeback res */ | 163 | /* SW1, SW2, SW3, SW4 linear 0.8V-3.3V with scalar via R1/R2 feeback res */ |
164 | static struct regulator_ops ltc3676_linear_regulator_ops = { | 164 | static const struct regulator_ops ltc3676_linear_regulator_ops = { |
165 | .enable = regulator_enable_regmap, | 165 | .enable = regulator_enable_regmap, |
166 | .disable = regulator_disable_regmap, | 166 | .disable = regulator_disable_regmap, |
167 | .is_enabled = regulator_is_enabled_regmap, | 167 | .is_enabled = regulator_is_enabled_regmap, |
@@ -173,11 +173,11 @@ static struct regulator_ops ltc3676_linear_regulator_ops = { | |||
173 | }; | 173 | }; |
174 | 174 | ||
175 | /* LDO1 always on fixed 0.8V-3.3V via scalar via R1/R2 feeback res */ | 175 | /* LDO1 always on fixed 0.8V-3.3V via scalar via R1/R2 feeback res */ |
176 | static struct regulator_ops ltc3676_fixed_standby_regulator_ops = { | 176 | static const struct regulator_ops ltc3676_fixed_standby_regulator_ops = { |
177 | }; | 177 | }; |
178 | 178 | ||
179 | /* LDO2, LDO3 fixed (LDO2 has external scalar via R1/R2 feedback res) */ | 179 | /* LDO2, LDO3 fixed (LDO2 has external scalar via R1/R2 feedback res) */ |
180 | static struct regulator_ops ltc3676_fixed_regulator_ops = { | 180 | static const struct regulator_ops ltc3676_fixed_regulator_ops = { |
181 | .enable = regulator_enable_regmap, | 181 | .enable = regulator_enable_regmap, |
182 | .disable = regulator_disable_regmap, | 182 | .disable = regulator_disable_regmap, |
183 | .is_enabled = regulator_is_enabled_regmap, | 183 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/max14577-regulator.c b/drivers/regulator/max14577-regulator.c index c9ff26199711..0db288ce319c 100644 --- a/drivers/regulator/max14577-regulator.c +++ b/drivers/regulator/max14577-regulator.c | |||
@@ -85,14 +85,14 @@ static int max14577_reg_set_current_limit(struct regulator_dev *rdev, | |||
85 | reg_data); | 85 | reg_data); |
86 | } | 86 | } |
87 | 87 | ||
88 | static struct regulator_ops max14577_safeout_ops = { | 88 | static const struct regulator_ops max14577_safeout_ops = { |
89 | .is_enabled = regulator_is_enabled_regmap, | 89 | .is_enabled = regulator_is_enabled_regmap, |
90 | .enable = regulator_enable_regmap, | 90 | .enable = regulator_enable_regmap, |
91 | .disable = regulator_disable_regmap, | 91 | .disable = regulator_disable_regmap, |
92 | .list_voltage = regulator_list_voltage_linear, | 92 | .list_voltage = regulator_list_voltage_linear, |
93 | }; | 93 | }; |
94 | 94 | ||
95 | static struct regulator_ops max14577_charger_ops = { | 95 | static const struct regulator_ops max14577_charger_ops = { |
96 | .is_enabled = max14577_reg_is_enabled, | 96 | .is_enabled = max14577_reg_is_enabled, |
97 | .enable = regulator_enable_regmap, | 97 | .enable = regulator_enable_regmap, |
98 | .disable = regulator_disable_regmap, | 98 | .disable = regulator_disable_regmap, |
@@ -130,7 +130,7 @@ static const struct regulator_desc max14577_supported_regulators[] = { | |||
130 | [MAX14577_CHARGER] = MAX14577_CHARGER_REG, | 130 | [MAX14577_CHARGER] = MAX14577_CHARGER_REG, |
131 | }; | 131 | }; |
132 | 132 | ||
133 | static struct regulator_ops max77836_ldo_ops = { | 133 | static const struct regulator_ops max77836_ldo_ops = { |
134 | .is_enabled = regulator_is_enabled_regmap, | 134 | .is_enabled = regulator_is_enabled_regmap, |
135 | .enable = regulator_enable_regmap, | 135 | .enable = regulator_enable_regmap, |
136 | .disable = regulator_disable_regmap, | 136 | .disable = regulator_disable_regmap, |
diff --git a/drivers/regulator/max77620-regulator.c b/drivers/regulator/max77620-regulator.c index d088a7c79e60..b94e3a721721 100644 --- a/drivers/regulator/max77620-regulator.c +++ b/drivers/regulator/max77620-regulator.c | |||
@@ -644,7 +644,7 @@ static int max77620_of_parse_cb(struct device_node *np, | |||
644 | return max77620_init_pmic(pmic, desc->id); | 644 | return max77620_init_pmic(pmic, desc->id); |
645 | } | 645 | } |
646 | 646 | ||
647 | static struct regulator_ops max77620_regulator_ops = { | 647 | static const struct regulator_ops max77620_regulator_ops = { |
648 | .is_enabled = max77620_regulator_is_enabled, | 648 | .is_enabled = max77620_regulator_is_enabled, |
649 | .enable = max77620_regulator_enable, | 649 | .enable = max77620_regulator_enable, |
650 | .disable = max77620_regulator_disable, | 650 | .disable = max77620_regulator_disable, |
diff --git a/drivers/regulator/max77686-regulator.c b/drivers/regulator/max77686-regulator.c index ac4fa581e0a5..c301f3733475 100644 --- a/drivers/regulator/max77686-regulator.c +++ b/drivers/regulator/max77686-regulator.c | |||
@@ -289,7 +289,7 @@ static int max77686_of_parse_cb(struct device_node *np, | |||
289 | return 0; | 289 | return 0; |
290 | } | 290 | } |
291 | 291 | ||
292 | static struct regulator_ops max77686_ops = { | 292 | static const struct regulator_ops max77686_ops = { |
293 | .list_voltage = regulator_list_voltage_linear, | 293 | .list_voltage = regulator_list_voltage_linear, |
294 | .map_voltage = regulator_map_voltage_linear, | 294 | .map_voltage = regulator_map_voltage_linear, |
295 | .is_enabled = regulator_is_enabled_regmap, | 295 | .is_enabled = regulator_is_enabled_regmap, |
@@ -301,7 +301,7 @@ static struct regulator_ops max77686_ops = { | |||
301 | .set_suspend_mode = max77686_set_suspend_mode, | 301 | .set_suspend_mode = max77686_set_suspend_mode, |
302 | }; | 302 | }; |
303 | 303 | ||
304 | static struct regulator_ops max77686_ldo_ops = { | 304 | static const struct regulator_ops max77686_ldo_ops = { |
305 | .list_voltage = regulator_list_voltage_linear, | 305 | .list_voltage = regulator_list_voltage_linear, |
306 | .map_voltage = regulator_map_voltage_linear, | 306 | .map_voltage = regulator_map_voltage_linear, |
307 | .is_enabled = regulator_is_enabled_regmap, | 307 | .is_enabled = regulator_is_enabled_regmap, |
@@ -314,7 +314,7 @@ static struct regulator_ops max77686_ldo_ops = { | |||
314 | .set_suspend_disable = max77686_set_suspend_disable, | 314 | .set_suspend_disable = max77686_set_suspend_disable, |
315 | }; | 315 | }; |
316 | 316 | ||
317 | static struct regulator_ops max77686_buck1_ops = { | 317 | static const struct regulator_ops max77686_buck1_ops = { |
318 | .list_voltage = regulator_list_voltage_linear, | 318 | .list_voltage = regulator_list_voltage_linear, |
319 | .map_voltage = regulator_map_voltage_linear, | 319 | .map_voltage = regulator_map_voltage_linear, |
320 | .is_enabled = regulator_is_enabled_regmap, | 320 | .is_enabled = regulator_is_enabled_regmap, |
@@ -326,7 +326,7 @@ static struct regulator_ops max77686_buck1_ops = { | |||
326 | .set_suspend_disable = max77686_set_suspend_disable, | 326 | .set_suspend_disable = max77686_set_suspend_disable, |
327 | }; | 327 | }; |
328 | 328 | ||
329 | static struct regulator_ops max77686_buck_dvs_ops = { | 329 | static const struct regulator_ops max77686_buck_dvs_ops = { |
330 | .list_voltage = regulator_list_voltage_linear, | 330 | .list_voltage = regulator_list_voltage_linear, |
331 | .map_voltage = regulator_map_voltage_linear, | 331 | .map_voltage = regulator_map_voltage_linear, |
332 | .is_enabled = regulator_is_enabled_regmap, | 332 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/max77693-regulator.c b/drivers/regulator/max77693-regulator.c index cfbb9512e486..3fce67982682 100644 --- a/drivers/regulator/max77693-regulator.c +++ b/drivers/regulator/max77693-regulator.c | |||
@@ -141,7 +141,7 @@ static const unsigned int max77693_safeout_table[] = { | |||
141 | 3300000, | 141 | 3300000, |
142 | }; | 142 | }; |
143 | 143 | ||
144 | static struct regulator_ops max77693_safeout_ops = { | 144 | static const struct regulator_ops max77693_safeout_ops = { |
145 | .list_voltage = regulator_list_voltage_table, | 145 | .list_voltage = regulator_list_voltage_table, |
146 | .is_enabled = regulator_is_enabled_regmap, | 146 | .is_enabled = regulator_is_enabled_regmap, |
147 | .enable = regulator_enable_regmap, | 147 | .enable = regulator_enable_regmap, |
diff --git a/drivers/regulator/max77802-regulator.c b/drivers/regulator/max77802-regulator.c index 1d3539324d9a..b6261903818c 100644 --- a/drivers/regulator/max77802-regulator.c +++ b/drivers/regulator/max77802-regulator.c | |||
@@ -288,7 +288,7 @@ static int max77802_set_ramp_delay_4bit(struct regulator_dev *rdev, | |||
288 | /* | 288 | /* |
289 | * LDOs 2, 4-19, 22-35 | 289 | * LDOs 2, 4-19, 22-35 |
290 | */ | 290 | */ |
291 | static struct regulator_ops max77802_ldo_ops_logic1 = { | 291 | static const struct regulator_ops max77802_ldo_ops_logic1 = { |
292 | .list_voltage = regulator_list_voltage_linear, | 292 | .list_voltage = regulator_list_voltage_linear, |
293 | .map_voltage = regulator_map_voltage_linear, | 293 | .map_voltage = regulator_map_voltage_linear, |
294 | .is_enabled = regulator_is_enabled_regmap, | 294 | .is_enabled = regulator_is_enabled_regmap, |
@@ -304,7 +304,7 @@ static struct regulator_ops max77802_ldo_ops_logic1 = { | |||
304 | /* | 304 | /* |
305 | * LDOs 1, 20, 21, 3 | 305 | * LDOs 1, 20, 21, 3 |
306 | */ | 306 | */ |
307 | static struct regulator_ops max77802_ldo_ops_logic2 = { | 307 | static const struct regulator_ops max77802_ldo_ops_logic2 = { |
308 | .list_voltage = regulator_list_voltage_linear, | 308 | .list_voltage = regulator_list_voltage_linear, |
309 | .map_voltage = regulator_map_voltage_linear, | 309 | .map_voltage = regulator_map_voltage_linear, |
310 | .is_enabled = regulator_is_enabled_regmap, | 310 | .is_enabled = regulator_is_enabled_regmap, |
@@ -319,7 +319,7 @@ static struct regulator_ops max77802_ldo_ops_logic2 = { | |||
319 | }; | 319 | }; |
320 | 320 | ||
321 | /* BUCKS 1, 6 */ | 321 | /* BUCKS 1, 6 */ |
322 | static struct regulator_ops max77802_buck_16_dvs_ops = { | 322 | static const struct regulator_ops max77802_buck_16_dvs_ops = { |
323 | .list_voltage = regulator_list_voltage_linear, | 323 | .list_voltage = regulator_list_voltage_linear, |
324 | .map_voltage = regulator_map_voltage_linear, | 324 | .map_voltage = regulator_map_voltage_linear, |
325 | .is_enabled = regulator_is_enabled_regmap, | 325 | .is_enabled = regulator_is_enabled_regmap, |
@@ -333,7 +333,7 @@ static struct regulator_ops max77802_buck_16_dvs_ops = { | |||
333 | }; | 333 | }; |
334 | 334 | ||
335 | /* BUCKs 2-4 */ | 335 | /* BUCKs 2-4 */ |
336 | static struct regulator_ops max77802_buck_234_ops = { | 336 | static const struct regulator_ops max77802_buck_234_ops = { |
337 | .list_voltage = regulator_list_voltage_linear, | 337 | .list_voltage = regulator_list_voltage_linear, |
338 | .map_voltage = regulator_map_voltage_linear, | 338 | .map_voltage = regulator_map_voltage_linear, |
339 | .is_enabled = regulator_is_enabled_regmap, | 339 | .is_enabled = regulator_is_enabled_regmap, |
@@ -348,7 +348,7 @@ static struct regulator_ops max77802_buck_234_ops = { | |||
348 | }; | 348 | }; |
349 | 349 | ||
350 | /* BUCKs 5, 7-10 */ | 350 | /* BUCKs 5, 7-10 */ |
351 | static struct regulator_ops max77802_buck_dvs_ops = { | 351 | static const struct regulator_ops max77802_buck_dvs_ops = { |
352 | .list_voltage = regulator_list_voltage_linear, | 352 | .list_voltage = regulator_list_voltage_linear, |
353 | .map_voltage = regulator_map_voltage_linear, | 353 | .map_voltage = regulator_map_voltage_linear, |
354 | .is_enabled = regulator_is_enabled_regmap, | 354 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/max8907-regulator.c b/drivers/regulator/max8907-regulator.c index 5e941db5ccaf..860400d2cd85 100644 --- a/drivers/regulator/max8907-regulator.c +++ b/drivers/regulator/max8907-regulator.c | |||
@@ -109,7 +109,7 @@ struct max8907_regulator { | |||
109 | #define LDO_650_25(id, supply, base) REG_LDO(id, supply, (base), \ | 109 | #define LDO_650_25(id, supply, base) REG_LDO(id, supply, (base), \ |
110 | 650000, 2225000, 25000) | 110 | 650000, 2225000, 25000) |
111 | 111 | ||
112 | static struct regulator_ops max8907_mbatt_ops = { | 112 | static const struct regulator_ops max8907_mbatt_ops = { |
113 | }; | 113 | }; |
114 | 114 | ||
115 | static struct regulator_ops max8907_ldo_ops = { | 115 | static struct regulator_ops max8907_ldo_ops = { |
@@ -121,13 +121,13 @@ static struct regulator_ops max8907_ldo_ops = { | |||
121 | .is_enabled = regulator_is_enabled_regmap, | 121 | .is_enabled = regulator_is_enabled_regmap, |
122 | }; | 122 | }; |
123 | 123 | ||
124 | static struct regulator_ops max8907_ldo_hwctl_ops = { | 124 | static const struct regulator_ops max8907_ldo_hwctl_ops = { |
125 | .list_voltage = regulator_list_voltage_linear, | 125 | .list_voltage = regulator_list_voltage_linear, |
126 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 126 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
127 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 127 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
128 | }; | 128 | }; |
129 | 129 | ||
130 | static struct regulator_ops max8907_fixed_ops = { | 130 | static const struct regulator_ops max8907_fixed_ops = { |
131 | .list_voltage = regulator_list_voltage_linear, | 131 | .list_voltage = regulator_list_voltage_linear, |
132 | }; | 132 | }; |
133 | 133 | ||
@@ -138,11 +138,11 @@ static struct regulator_ops max8907_out5v_ops = { | |||
138 | .is_enabled = regulator_is_enabled_regmap, | 138 | .is_enabled = regulator_is_enabled_regmap, |
139 | }; | 139 | }; |
140 | 140 | ||
141 | static struct regulator_ops max8907_out5v_hwctl_ops = { | 141 | static const struct regulator_ops max8907_out5v_hwctl_ops = { |
142 | .list_voltage = regulator_list_voltage_linear, | 142 | .list_voltage = regulator_list_voltage_linear, |
143 | }; | 143 | }; |
144 | 144 | ||
145 | static struct regulator_ops max8907_bbat_ops = { | 145 | static const struct regulator_ops max8907_bbat_ops = { |
146 | .list_voltage = regulator_list_voltage_linear, | 146 | .list_voltage = regulator_list_voltage_linear, |
147 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 147 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
148 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 148 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
diff --git a/drivers/regulator/max8925-regulator.c b/drivers/regulator/max8925-regulator.c index c802f0239dc7..39b63ddefeb2 100644 --- a/drivers/regulator/max8925-regulator.c +++ b/drivers/regulator/max8925-regulator.c | |||
@@ -132,7 +132,7 @@ static int max8925_set_dvm_disable(struct regulator_dev *rdev) | |||
132 | return max8925_set_bits(info->i2c, info->vol_reg, 1 << SD1_DVM_EN, 0); | 132 | return max8925_set_bits(info->i2c, info->vol_reg, 1 << SD1_DVM_EN, 0); |
133 | } | 133 | } |
134 | 134 | ||
135 | static struct regulator_ops max8925_regulator_sdv_ops = { | 135 | static const struct regulator_ops max8925_regulator_sdv_ops = { |
136 | .map_voltage = regulator_map_voltage_linear, | 136 | .map_voltage = regulator_map_voltage_linear, |
137 | .list_voltage = regulator_list_voltage_linear, | 137 | .list_voltage = regulator_list_voltage_linear, |
138 | .set_voltage_sel = max8925_set_voltage_sel, | 138 | .set_voltage_sel = max8925_set_voltage_sel, |
@@ -145,7 +145,7 @@ static struct regulator_ops max8925_regulator_sdv_ops = { | |||
145 | .set_suspend_disable = max8925_set_dvm_disable, | 145 | .set_suspend_disable = max8925_set_dvm_disable, |
146 | }; | 146 | }; |
147 | 147 | ||
148 | static struct regulator_ops max8925_regulator_ldo_ops = { | 148 | static const struct regulator_ops max8925_regulator_ldo_ops = { |
149 | .map_voltage = regulator_map_voltage_linear, | 149 | .map_voltage = regulator_map_voltage_linear, |
150 | .list_voltage = regulator_list_voltage_linear, | 150 | .list_voltage = regulator_list_voltage_linear, |
151 | .set_voltage_sel = max8925_set_voltage_sel, | 151 | .set_voltage_sel = max8925_set_voltage_sel, |
diff --git a/drivers/regulator/max8952.c b/drivers/regulator/max8952.c index 1af8f4a2ab86..1096546c05e9 100644 --- a/drivers/regulator/max8952.c +++ b/drivers/regulator/max8952.c | |||
@@ -113,7 +113,7 @@ static int max8952_set_voltage_sel(struct regulator_dev *rdev, | |||
113 | return 0; | 113 | return 0; |
114 | } | 114 | } |
115 | 115 | ||
116 | static struct regulator_ops max8952_ops = { | 116 | static const struct regulator_ops max8952_ops = { |
117 | .list_voltage = max8952_list_voltage, | 117 | .list_voltage = max8952_list_voltage, |
118 | .get_voltage_sel = max8952_get_voltage_sel, | 118 | .get_voltage_sel = max8952_get_voltage_sel, |
119 | .set_voltage_sel = max8952_set_voltage_sel, | 119 | .set_voltage_sel = max8952_set_voltage_sel, |
diff --git a/drivers/regulator/palmas-regulator.c b/drivers/regulator/palmas-regulator.c index f11d41dad9c1..31ae5ee3a80d 100644 --- a/drivers/regulator/palmas-regulator.c +++ b/drivers/regulator/palmas-regulator.c | |||
@@ -528,7 +528,7 @@ static int palmas_smps_set_ramp_delay(struct regulator_dev *rdev, | |||
528 | return ret; | 528 | return ret; |
529 | } | 529 | } |
530 | 530 | ||
531 | static struct regulator_ops palmas_ops_smps = { | 531 | static const struct regulator_ops palmas_ops_smps = { |
532 | .is_enabled = regulator_is_enabled_regmap, | 532 | .is_enabled = regulator_is_enabled_regmap, |
533 | .enable = regulator_enable_regmap, | 533 | .enable = regulator_enable_regmap, |
534 | .disable = regulator_disable_regmap, | 534 | .disable = regulator_disable_regmap, |
@@ -542,7 +542,7 @@ static struct regulator_ops palmas_ops_smps = { | |||
542 | .set_ramp_delay = palmas_smps_set_ramp_delay, | 542 | .set_ramp_delay = palmas_smps_set_ramp_delay, |
543 | }; | 543 | }; |
544 | 544 | ||
545 | static struct regulator_ops palmas_ops_ext_control_smps = { | 545 | static const struct regulator_ops palmas_ops_ext_control_smps = { |
546 | .set_mode = palmas_set_mode_smps, | 546 | .set_mode = palmas_set_mode_smps, |
547 | .get_mode = palmas_get_mode_smps, | 547 | .get_mode = palmas_get_mode_smps, |
548 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 548 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
@@ -553,7 +553,7 @@ static struct regulator_ops palmas_ops_ext_control_smps = { | |||
553 | .set_ramp_delay = palmas_smps_set_ramp_delay, | 553 | .set_ramp_delay = palmas_smps_set_ramp_delay, |
554 | }; | 554 | }; |
555 | 555 | ||
556 | static struct regulator_ops palmas_ops_smps10 = { | 556 | static const struct regulator_ops palmas_ops_smps10 = { |
557 | .is_enabled = regulator_is_enabled_regmap, | 557 | .is_enabled = regulator_is_enabled_regmap, |
558 | .enable = regulator_enable_regmap, | 558 | .enable = regulator_enable_regmap, |
559 | .disable = regulator_disable_regmap, | 559 | .disable = regulator_disable_regmap, |
@@ -565,7 +565,7 @@ static struct regulator_ops palmas_ops_smps10 = { | |||
565 | .get_bypass = regulator_get_bypass_regmap, | 565 | .get_bypass = regulator_get_bypass_regmap, |
566 | }; | 566 | }; |
567 | 567 | ||
568 | static struct regulator_ops tps65917_ops_smps = { | 568 | static const struct regulator_ops tps65917_ops_smps = { |
569 | .is_enabled = regulator_is_enabled_regmap, | 569 | .is_enabled = regulator_is_enabled_regmap, |
570 | .enable = regulator_enable_regmap, | 570 | .enable = regulator_enable_regmap, |
571 | .disable = regulator_disable_regmap, | 571 | .disable = regulator_disable_regmap, |
@@ -578,7 +578,7 @@ static struct regulator_ops tps65917_ops_smps = { | |||
578 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | 578 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
579 | }; | 579 | }; |
580 | 580 | ||
581 | static struct regulator_ops tps65917_ops_ext_control_smps = { | 581 | static const struct regulator_ops tps65917_ops_ext_control_smps = { |
582 | .set_mode = palmas_set_mode_smps, | 582 | .set_mode = palmas_set_mode_smps, |
583 | .get_mode = palmas_get_mode_smps, | 583 | .get_mode = palmas_get_mode_smps, |
584 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 584 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
@@ -602,7 +602,7 @@ static int palmas_is_enabled_ldo(struct regulator_dev *dev) | |||
602 | return !!(reg); | 602 | return !!(reg); |
603 | } | 603 | } |
604 | 604 | ||
605 | static struct regulator_ops palmas_ops_ldo = { | 605 | static const struct regulator_ops palmas_ops_ldo = { |
606 | .is_enabled = palmas_is_enabled_ldo, | 606 | .is_enabled = palmas_is_enabled_ldo, |
607 | .enable = regulator_enable_regmap, | 607 | .enable = regulator_enable_regmap, |
608 | .disable = regulator_disable_regmap, | 608 | .disable = regulator_disable_regmap, |
@@ -612,7 +612,7 @@ static struct regulator_ops palmas_ops_ldo = { | |||
612 | .map_voltage = regulator_map_voltage_linear, | 612 | .map_voltage = regulator_map_voltage_linear, |
613 | }; | 613 | }; |
614 | 614 | ||
615 | static struct regulator_ops palmas_ops_ldo9 = { | 615 | static const struct regulator_ops palmas_ops_ldo9 = { |
616 | .is_enabled = palmas_is_enabled_ldo, | 616 | .is_enabled = palmas_is_enabled_ldo, |
617 | .enable = regulator_enable_regmap, | 617 | .enable = regulator_enable_regmap, |
618 | .disable = regulator_disable_regmap, | 618 | .disable = regulator_disable_regmap, |
@@ -624,23 +624,23 @@ static struct regulator_ops palmas_ops_ldo9 = { | |||
624 | .get_bypass = regulator_get_bypass_regmap, | 624 | .get_bypass = regulator_get_bypass_regmap, |
625 | }; | 625 | }; |
626 | 626 | ||
627 | static struct regulator_ops palmas_ops_ext_control_ldo = { | 627 | static const struct regulator_ops palmas_ops_ext_control_ldo = { |
628 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 628 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
629 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 629 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
630 | .list_voltage = regulator_list_voltage_linear, | 630 | .list_voltage = regulator_list_voltage_linear, |
631 | .map_voltage = regulator_map_voltage_linear, | 631 | .map_voltage = regulator_map_voltage_linear, |
632 | }; | 632 | }; |
633 | 633 | ||
634 | static struct regulator_ops palmas_ops_extreg = { | 634 | static const struct regulator_ops palmas_ops_extreg = { |
635 | .is_enabled = regulator_is_enabled_regmap, | 635 | .is_enabled = regulator_is_enabled_regmap, |
636 | .enable = regulator_enable_regmap, | 636 | .enable = regulator_enable_regmap, |
637 | .disable = regulator_disable_regmap, | 637 | .disable = regulator_disable_regmap, |
638 | }; | 638 | }; |
639 | 639 | ||
640 | static struct regulator_ops palmas_ops_ext_control_extreg = { | 640 | static const struct regulator_ops palmas_ops_ext_control_extreg = { |
641 | }; | 641 | }; |
642 | 642 | ||
643 | static struct regulator_ops tps65917_ops_ldo = { | 643 | static const struct regulator_ops tps65917_ops_ldo = { |
644 | .is_enabled = palmas_is_enabled_ldo, | 644 | .is_enabled = palmas_is_enabled_ldo, |
645 | .enable = regulator_enable_regmap, | 645 | .enable = regulator_enable_regmap, |
646 | .disable = regulator_disable_regmap, | 646 | .disable = regulator_disable_regmap, |
@@ -651,7 +651,7 @@ static struct regulator_ops tps65917_ops_ldo = { | |||
651 | .set_voltage_time_sel = regulator_set_voltage_time_sel, | 651 | .set_voltage_time_sel = regulator_set_voltage_time_sel, |
652 | }; | 652 | }; |
653 | 653 | ||
654 | static struct regulator_ops tps65917_ops_ldo_1_2 = { | 654 | static const struct regulator_ops tps65917_ops_ldo_1_2 = { |
655 | .is_enabled = palmas_is_enabled_ldo, | 655 | .is_enabled = palmas_is_enabled_ldo, |
656 | .enable = regulator_enable_regmap, | 656 | .enable = regulator_enable_regmap, |
657 | .disable = regulator_disable_regmap, | 657 | .disable = regulator_disable_regmap, |
diff --git a/drivers/regulator/pbias-regulator.c b/drivers/regulator/pbias-regulator.c index f9d74d63be7c..0cb76ba29e84 100644 --- a/drivers/regulator/pbias-regulator.c +++ b/drivers/regulator/pbias-regulator.c | |||
@@ -54,7 +54,7 @@ static const unsigned int pbias_volt_table[] = { | |||
54 | 3000000 | 54 | 3000000 |
55 | }; | 55 | }; |
56 | 56 | ||
57 | static struct regulator_ops pbias_regulator_voltage_ops = { | 57 | static const struct regulator_ops pbias_regulator_voltage_ops = { |
58 | .list_voltage = regulator_list_voltage_table, | 58 | .list_voltage = regulator_list_voltage_table, |
59 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 59 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
60 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 60 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
diff --git a/drivers/regulator/pcap-regulator.c b/drivers/regulator/pcap-regulator.c index 9b16e6158f15..79cb971a69bb 100644 --- a/drivers/regulator/pcap-regulator.c +++ b/drivers/regulator/pcap-regulator.c | |||
@@ -210,7 +210,7 @@ static int pcap_regulator_is_enabled(struct regulator_dev *rdev) | |||
210 | return (tmp >> vreg->en) & 1; | 210 | return (tmp >> vreg->en) & 1; |
211 | } | 211 | } |
212 | 212 | ||
213 | static struct regulator_ops pcap_regulator_ops = { | 213 | static const struct regulator_ops pcap_regulator_ops = { |
214 | .list_voltage = regulator_list_voltage_table, | 214 | .list_voltage = regulator_list_voltage_table, |
215 | .set_voltage_sel = pcap_regulator_set_voltage_sel, | 215 | .set_voltage_sel = pcap_regulator_set_voltage_sel, |
216 | .get_voltage_sel = pcap_regulator_get_voltage_sel, | 216 | .get_voltage_sel = pcap_regulator_get_voltage_sel, |
diff --git a/drivers/regulator/pcf50633-regulator.c b/drivers/regulator/pcf50633-regulator.c index 134f90ec9ca1..762e18447cae 100644 --- a/drivers/regulator/pcf50633-regulator.c +++ b/drivers/regulator/pcf50633-regulator.c | |||
@@ -41,7 +41,7 @@ | |||
41 | .enable_mask = PCF50633_REGULATOR_ON, \ | 41 | .enable_mask = PCF50633_REGULATOR_ON, \ |
42 | } | 42 | } |
43 | 43 | ||
44 | static struct regulator_ops pcf50633_regulator_ops = { | 44 | static const struct regulator_ops pcf50633_regulator_ops = { |
45 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 45 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
46 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 46 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
47 | .list_voltage = regulator_list_voltage_linear, | 47 | .list_voltage = regulator_list_voltage_linear, |
diff --git a/drivers/regulator/pfuze100-regulator.c b/drivers/regulator/pfuze100-regulator.c index cb18b5c4f2db..e193bbbb8ffc 100644 --- a/drivers/regulator/pfuze100-regulator.c +++ b/drivers/regulator/pfuze100-regulator.c | |||
@@ -126,7 +126,7 @@ static int pfuze100_set_ramp_delay(struct regulator_dev *rdev, int ramp_delay) | |||
126 | return ret; | 126 | return ret; |
127 | } | 127 | } |
128 | 128 | ||
129 | static struct regulator_ops pfuze100_ldo_regulator_ops = { | 129 | static const struct regulator_ops pfuze100_ldo_regulator_ops = { |
130 | .enable = regulator_enable_regmap, | 130 | .enable = regulator_enable_regmap, |
131 | .disable = regulator_disable_regmap, | 131 | .disable = regulator_disable_regmap, |
132 | .is_enabled = regulator_is_enabled_regmap, | 132 | .is_enabled = regulator_is_enabled_regmap, |
@@ -135,14 +135,14 @@ static struct regulator_ops pfuze100_ldo_regulator_ops = { | |||
135 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 135 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
136 | }; | 136 | }; |
137 | 137 | ||
138 | static struct regulator_ops pfuze100_fixed_regulator_ops = { | 138 | static const struct regulator_ops pfuze100_fixed_regulator_ops = { |
139 | .enable = regulator_enable_regmap, | 139 | .enable = regulator_enable_regmap, |
140 | .disable = regulator_disable_regmap, | 140 | .disable = regulator_disable_regmap, |
141 | .is_enabled = regulator_is_enabled_regmap, | 141 | .is_enabled = regulator_is_enabled_regmap, |
142 | .list_voltage = regulator_list_voltage_linear, | 142 | .list_voltage = regulator_list_voltage_linear, |
143 | }; | 143 | }; |
144 | 144 | ||
145 | static struct regulator_ops pfuze100_sw_regulator_ops = { | 145 | static const struct regulator_ops pfuze100_sw_regulator_ops = { |
146 | .list_voltage = regulator_list_voltage_linear, | 146 | .list_voltage = regulator_list_voltage_linear, |
147 | .set_voltage_sel = regulator_set_voltage_sel_regmap, | 147 | .set_voltage_sel = regulator_set_voltage_sel_regmap, |
148 | .get_voltage_sel = regulator_get_voltage_sel_regmap, | 148 | .get_voltage_sel = regulator_get_voltage_sel_regmap, |
@@ -150,7 +150,7 @@ static struct regulator_ops pfuze100_sw_regulator_ops = { | |||
150 | .set_ramp_delay = pfuze100_set_ramp_delay, | 150 | .set_ramp_delay = pfuze100_set_ramp_delay, |
151 | }; | 151 | }; |
152 | 152 | ||
153 | static struct regulator_ops pfuze100_swb_regulator_ops = { | 153 | static const struct regulator_ops pfuze100_swb_regulator_ops = { |
154 | .enable = regulator_enable_regmap, | 154 | .enable = regulator_enable_regmap, |
155 | .disable = regulator_disable_regmap, | 155 | .disable = regulator_disable_regmap, |
156 | .list_voltage = regulator_list_voltage_table, | 156 | .list_voltage = regulator_list_voltage_table, |
diff --git a/drivers/regulator/pv88060-regulator.c b/drivers/regulator/pv88060-regulator.c index 6c4afc73ecac..a9446056435f 100644 --- a/drivers/regulator/pv88060-regulator.c +++ b/drivers/regulator/pv88060-regulator.c | |||
@@ -162,7 +162,7 @@ static int pv88060_get_current_limit(struct regulator_dev *rdev) | |||
162 | return info->current_limits[data]; | 162 | return info->current_limits[data]; |
163 | } | 163 | } |
164 | 164 | ||
165 | static struct regulator_ops pv88060_buck_ops = { | 165 | static const struct regulator_ops pv88060_buck_ops = { |
166 | .get_mode = pv88060_buck_get_mode, | 166 | .get_mode = pv88060_buck_get_mode, |
167 | .set_mode = pv88060_buck_set_mode, | 167 | .set_mode = pv88060_buck_set_mode, |
168 | .enable = regulator_enable_regmap, | 168 | .enable = regulator_enable_regmap, |
@@ -175,7 +175,7 @@ static struct regulator_ops pv88060_buck_ops = { | |||
175 | .get_current_limit = pv88060_get_current_limit, | 175 | .get_current_limit = pv88060_get_current_limit, |
176 | }; | 176 | }; |
177 | 177 | ||
178 | static struct regulator_ops pv88060_ldo_ops = { | 178 | static const struct regulator_ops pv88060_ldo_ops = { |
179 | .enable = regulator_enable_regmap, | 179 | .enable = regulator_enable_regmap, |
180 | .disable = regulator_disable_regmap, | 180 | .disable = regulator_disable_regmap, |
181 | .is_enabled = regulator_is_enabled_regmap, | 181 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/pv88080-regulator.c b/drivers/regulator/pv88080-regulator.c index 954a20eeb26f..9a08cb2de501 100644 --- a/drivers/regulator/pv88080-regulator.c +++ b/drivers/regulator/pv88080-regulator.c | |||
@@ -306,7 +306,7 @@ static int pv88080_get_current_limit(struct regulator_dev *rdev) | |||
306 | return info->current_limits[data]; | 306 | return info->current_limits[data]; |
307 | } | 307 | } |
308 | 308 | ||
309 | static struct regulator_ops pv88080_buck_ops = { | 309 | static const struct regulator_ops pv88080_buck_ops = { |
310 | .get_mode = pv88080_buck_get_mode, | 310 | .get_mode = pv88080_buck_get_mode, |
311 | .set_mode = pv88080_buck_set_mode, | 311 | .set_mode = pv88080_buck_set_mode, |
312 | .enable = regulator_enable_regmap, | 312 | .enable = regulator_enable_regmap, |
@@ -319,7 +319,7 @@ static struct regulator_ops pv88080_buck_ops = { | |||
319 | .get_current_limit = pv88080_get_current_limit, | 319 | .get_current_limit = pv88080_get_current_limit, |
320 | }; | 320 | }; |
321 | 321 | ||
322 | static struct regulator_ops pv88080_hvbuck_ops = { | 322 | static const struct regulator_ops pv88080_hvbuck_ops = { |
323 | .enable = regulator_enable_regmap, | 323 | .enable = regulator_enable_regmap, |
324 | .disable = regulator_disable_regmap, | 324 | .disable = regulator_disable_regmap, |
325 | .is_enabled = regulator_is_enabled_regmap, | 325 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/pv88090-regulator.c b/drivers/regulator/pv88090-regulator.c index 421641175352..ab51e254d13a 100644 --- a/drivers/regulator/pv88090-regulator.c +++ b/drivers/regulator/pv88090-regulator.c | |||
@@ -184,7 +184,7 @@ static int pv88090_get_current_limit(struct regulator_dev *rdev) | |||
184 | return info->current_limits[data]; | 184 | return info->current_limits[data]; |
185 | } | 185 | } |
186 | 186 | ||
187 | static struct regulator_ops pv88090_buck_ops = { | 187 | static const struct regulator_ops pv88090_buck_ops = { |
188 | .get_mode = pv88090_buck_get_mode, | 188 | .get_mode = pv88090_buck_get_mode, |
189 | .set_mode = pv88090_buck_set_mode, | 189 | .set_mode = pv88090_buck_set_mode, |
190 | .enable = regulator_enable_regmap, | 190 | .enable = regulator_enable_regmap, |
@@ -197,7 +197,7 @@ static struct regulator_ops pv88090_buck_ops = { | |||
197 | .get_current_limit = pv88090_get_current_limit, | 197 | .get_current_limit = pv88090_get_current_limit, |
198 | }; | 198 | }; |
199 | 199 | ||
200 | static struct regulator_ops pv88090_ldo_ops = { | 200 | static const struct regulator_ops pv88090_ldo_ops = { |
201 | .enable = regulator_enable_regmap, | 201 | .enable = regulator_enable_regmap, |
202 | .disable = regulator_disable_regmap, | 202 | .disable = regulator_disable_regmap, |
203 | .is_enabled = regulator_is_enabled_regmap, | 203 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/qcom_smd-regulator.c b/drivers/regulator/qcom_smd-regulator.c index 8ed46a9a55c8..f35994a2a5be 100644 --- a/drivers/regulator/qcom_smd-regulator.c +++ b/drivers/regulator/qcom_smd-regulator.c | |||
@@ -305,6 +305,56 @@ static const struct regulator_desc pm8916_buck_hvo_smps = { | |||
305 | .ops = &rpm_smps_ldo_ops, | 305 | .ops = &rpm_smps_ldo_ops, |
306 | }; | 306 | }; |
307 | 307 | ||
308 | static const struct regulator_desc pm8994_hfsmps = { | ||
309 | .linear_ranges = (struct regulator_linear_range[]) { | ||
310 | REGULATOR_LINEAR_RANGE( 375000, 0, 95, 12500), | ||
311 | REGULATOR_LINEAR_RANGE(1550000, 96, 158, 25000), | ||
312 | }, | ||
313 | .n_linear_ranges = 2, | ||
314 | .n_voltages = 159, | ||
315 | .ops = &rpm_smps_ldo_ops, | ||
316 | }; | ||
317 | |||
318 | static const struct regulator_desc pm8994_ftsmps = { | ||
319 | .linear_ranges = (struct regulator_linear_range[]) { | ||
320 | REGULATOR_LINEAR_RANGE(350000, 0, 199, 5000), | ||
321 | REGULATOR_LINEAR_RANGE(700000, 200, 349, 10000), | ||
322 | }, | ||
323 | .n_linear_ranges = 2, | ||
324 | .n_voltages = 350, | ||
325 | .ops = &rpm_smps_ldo_ops, | ||
326 | }; | ||
327 | |||
328 | static const struct regulator_desc pm8994_nldo = { | ||
329 | .linear_ranges = (struct regulator_linear_range[]) { | ||
330 | REGULATOR_LINEAR_RANGE(750000, 0, 63, 12500), | ||
331 | }, | ||
332 | .n_linear_ranges = 1, | ||
333 | .n_voltages = 64, | ||
334 | .ops = &rpm_smps_ldo_ops, | ||
335 | }; | ||
336 | |||
337 | static const struct regulator_desc pm8994_pldo = { | ||
338 | .linear_ranges = (struct regulator_linear_range[]) { | ||
339 | REGULATOR_LINEAR_RANGE( 750000, 0, 63, 12500), | ||
340 | REGULATOR_LINEAR_RANGE(1550000, 64, 126, 25000), | ||
341 | REGULATOR_LINEAR_RANGE(3100000, 127, 163, 50000), | ||
342 | }, | ||
343 | .n_linear_ranges = 3, | ||
344 | .n_voltages = 164, | ||
345 | .ops = &rpm_smps_ldo_ops, | ||
346 | }; | ||
347 | |||
348 | static const struct regulator_desc pm8994_switch = { | ||
349 | .ops = &rpm_switch_ops, | ||
350 | }; | ||
351 | |||
352 | static const struct regulator_desc pm8994_lnldo = { | ||
353 | .fixed_uV = 1740000, | ||
354 | .n_voltages = 1, | ||
355 | .ops = &rpm_smps_ldo_ops_fixed, | ||
356 | }; | ||
357 | |||
308 | struct rpm_regulator_data { | 358 | struct rpm_regulator_data { |
309 | const char *name; | 359 | const char *name; |
310 | u32 type; | 360 | u32 type; |
@@ -443,10 +493,62 @@ static const struct rpm_regulator_data rpm_pma8084_regulators[] = { | |||
443 | {} | 493 | {} |
444 | }; | 494 | }; |
445 | 495 | ||
496 | static const struct rpm_regulator_data rpm_pm8994_regulators[] = { | ||
497 | { "s1", QCOM_SMD_RPM_SMPA, 1, &pm8994_ftsmps, "vdd_s1" }, | ||
498 | { "s2", QCOM_SMD_RPM_SMPA, 2, &pm8994_ftsmps, "vdd_s2" }, | ||
499 | { "s3", QCOM_SMD_RPM_SMPA, 3, &pm8994_hfsmps, "vdd_s3" }, | ||
500 | { "s4", QCOM_SMD_RPM_SMPA, 4, &pm8994_hfsmps, "vdd_s4" }, | ||
501 | { "s5", QCOM_SMD_RPM_SMPA, 5, &pm8994_hfsmps, "vdd_s5" }, | ||
502 | { "s6", QCOM_SMD_RPM_SMPA, 6, &pm8994_ftsmps, "vdd_s6" }, | ||
503 | { "s7", QCOM_SMD_RPM_SMPA, 7, &pm8994_hfsmps, "vdd_s7" }, | ||
504 | { "s8", QCOM_SMD_RPM_SMPA, 8, &pm8994_ftsmps, "vdd_s8" }, | ||
505 | { "s9", QCOM_SMD_RPM_SMPA, 9, &pm8994_ftsmps, "vdd_s9" }, | ||
506 | { "s10", QCOM_SMD_RPM_SMPA, 10, &pm8994_ftsmps, "vdd_s10" }, | ||
507 | { "s11", QCOM_SMD_RPM_SMPA, 11, &pm8994_ftsmps, "vdd_s11" }, | ||
508 | { "s12", QCOM_SMD_RPM_SMPA, 12, &pm8994_ftsmps, "vdd_s12" }, | ||
509 | { "l1", QCOM_SMD_RPM_LDOA, 1, &pm8994_nldo, "vdd_l1" }, | ||
510 | { "l2", QCOM_SMD_RPM_LDOA, 2, &pm8994_nldo, "vdd_l2_l26_l28" }, | ||
511 | { "l3", QCOM_SMD_RPM_LDOA, 3, &pm8994_nldo, "vdd_l3_l11" }, | ||
512 | { "l4", QCOM_SMD_RPM_LDOA, 4, &pm8994_nldo, "vdd_l4_l27_l31" }, | ||
513 | { "l5", QCOM_SMD_RPM_LDOA, 5, &pm8994_lnldo, "vdd_l5_l7" }, | ||
514 | { "l6", QCOM_SMD_RPM_LDOA, 6, &pm8994_pldo, "vdd_l6_l12_l32" }, | ||
515 | { "l7", QCOM_SMD_RPM_LDOA, 7, &pm8994_lnldo, "vdd_l5_l7" }, | ||
516 | { "l8", QCOM_SMD_RPM_LDOA, 8, &pm8994_pldo, "vdd_l8_l16_l30" }, | ||
517 | { "l9", QCOM_SMD_RPM_LDOA, 9, &pm8994_pldo, "vdd_l9_l10_l18_l22" }, | ||
518 | { "l10", QCOM_SMD_RPM_LDOA, 10, &pm8994_pldo, "vdd_l9_l10_l18_l22" }, | ||
519 | { "l11", QCOM_SMD_RPM_LDOA, 11, &pm8994_nldo, "vdd_l3_l11" }, | ||
520 | { "l12", QCOM_SMD_RPM_LDOA, 12, &pm8994_pldo, "vdd_l6_l12_l32" }, | ||
521 | { "l13", QCOM_SMD_RPM_LDOA, 13, &pm8994_pldo, "vdd_l13_l19_l23_l24" }, | ||
522 | { "l14", QCOM_SMD_RPM_LDOA, 14, &pm8994_pldo, "vdd_l14_l15" }, | ||
523 | { "l15", QCOM_SMD_RPM_LDOA, 15, &pm8994_pldo, "vdd_l14_l15" }, | ||
524 | { "l16", QCOM_SMD_RPM_LDOA, 16, &pm8994_pldo, "vdd_l8_l16_l30" }, | ||
525 | { "l17", QCOM_SMD_RPM_LDOA, 17, &pm8994_pldo, "vdd_l17_l29" }, | ||
526 | { "l18", QCOM_SMD_RPM_LDOA, 18, &pm8994_pldo, "vdd_l9_l10_l18_l22" }, | ||
527 | { "l19", QCOM_SMD_RPM_LDOA, 19, &pm8994_pldo, "vdd_l13_l19_l23_l24" }, | ||
528 | { "l20", QCOM_SMD_RPM_LDOA, 20, &pm8994_pldo, "vdd_l20_l21" }, | ||
529 | { "l21", QCOM_SMD_RPM_LDOA, 21, &pm8994_pldo, "vdd_l20_l21" }, | ||
530 | { "l22", QCOM_SMD_RPM_LDOA, 22, &pm8994_pldo, "vdd_l9_l10_l18_l22" }, | ||
531 | { "l23", QCOM_SMD_RPM_LDOA, 23, &pm8994_pldo, "vdd_l13_l19_l23_l24" }, | ||
532 | { "l24", QCOM_SMD_RPM_LDOA, 24, &pm8994_pldo, "vdd_l13_l19_l23_l24" }, | ||
533 | { "l25", QCOM_SMD_RPM_LDOA, 25, &pm8994_pldo, "vdd_l25" }, | ||
534 | { "l26", QCOM_SMD_RPM_LDOA, 26, &pm8994_nldo, "vdd_l2_l26_l28" }, | ||
535 | { "l27", QCOM_SMD_RPM_LDOA, 27, &pm8994_nldo, "vdd_l4_l27_l31" }, | ||
536 | { "l28", QCOM_SMD_RPM_LDOA, 28, &pm8994_nldo, "vdd_l2_l26_l28" }, | ||
537 | { "l29", QCOM_SMD_RPM_LDOA, 29, &pm8994_pldo, "vdd_l17_l29" }, | ||
538 | { "l30", QCOM_SMD_RPM_LDOA, 30, &pm8994_pldo, "vdd_l8_l16_l30" }, | ||
539 | { "l31", QCOM_SMD_RPM_LDOA, 31, &pm8994_nldo, "vdd_l4_l27_l31" }, | ||
540 | { "l32", QCOM_SMD_RPM_LDOA, 32, &pm8994_pldo, "vdd_l6_l12_l32" }, | ||
541 | { "lvs1", QCOM_SMD_RPM_VSA, 1, &pm8994_switch, "vdd_lvs1_2" }, | ||
542 | { "lvs2", QCOM_SMD_RPM_VSA, 2, &pm8994_switch, "vdd_lvs1_2" }, | ||
543 | |||
544 | {} | ||
545 | }; | ||
546 | |||
446 | static const struct of_device_id rpm_of_match[] = { | 547 | static const struct of_device_id rpm_of_match[] = { |
447 | { .compatible = "qcom,rpm-pm8841-regulators", .data = &rpm_pm8841_regulators }, | 548 | { .compatible = "qcom,rpm-pm8841-regulators", .data = &rpm_pm8841_regulators }, |
448 | { .compatible = "qcom,rpm-pm8916-regulators", .data = &rpm_pm8916_regulators }, | 549 | { .compatible = "qcom,rpm-pm8916-regulators", .data = &rpm_pm8916_regulators }, |
449 | { .compatible = "qcom,rpm-pm8941-regulators", .data = &rpm_pm8941_regulators }, | 550 | { .compatible = "qcom,rpm-pm8941-regulators", .data = &rpm_pm8941_regulators }, |
551 | { .compatible = "qcom,rpm-pm8994-regulators", .data = &rpm_pm8994_regulators }, | ||
450 | { .compatible = "qcom,rpm-pma8084-regulators", .data = &rpm_pma8084_regulators }, | 552 | { .compatible = "qcom,rpm-pma8084-regulators", .data = &rpm_pma8084_regulators }, |
451 | {} | 553 | {} |
452 | }; | 554 | }; |
diff --git a/drivers/regulator/rc5t583-regulator.c b/drivers/regulator/rc5t583-regulator.c index d2e67c512195..d0f1340168b1 100644 --- a/drivers/regulator/rc5t583-regulator.c +++ b/drivers/regulator/rc5t583-regulator.c | |||
@@ -61,7 +61,7 @@ static int rc5t583_regulator_enable_time(struct regulator_dev *rdev) | |||
61 | return DIV_ROUND_UP(curr_uV, reg->reg_info->enable_uv_per_us); | 61 | return DIV_ROUND_UP(curr_uV, reg->reg_info->enable_uv_per_us); |
62 | } | 62 | } |
63 | 63 | ||
64 | static struct regulator_ops rc5t583_ops = { | 64 | static const struct regulator_ops rc5t583_ops = { |
65 | .is_enabled = regulator_is_enabled_regmap, | 65 | .is_enabled = regulator_is_enabled_regmap, |
66 | .enable = regulator_enable_regmap, | 66 | .enable = regulator_enable_regmap, |
67 | .disable = regulator_disable_regmap, | 67 | .disable = regulator_disable_regmap, |
diff --git a/drivers/regulator/rn5t618-regulator.c b/drivers/regulator/rn5t618-regulator.c index 9c930eb68cda..8d2819e36654 100644 --- a/drivers/regulator/rn5t618-regulator.c +++ b/drivers/regulator/rn5t618-regulator.c | |||
@@ -19,7 +19,7 @@ | |||
19 | #include <linux/regulator/driver.h> | 19 | #include <linux/regulator/driver.h> |
20 | #include <linux/regulator/of_regulator.h> | 20 | #include <linux/regulator/of_regulator.h> |
21 | 21 | ||
22 | static struct regulator_ops rn5t618_reg_ops = { | 22 | static const struct regulator_ops rn5t618_reg_ops = { |
23 | .enable = regulator_enable_regmap, | 23 | .enable = regulator_enable_regmap, |
24 | .disable = regulator_disable_regmap, | 24 | .disable = regulator_disable_regmap, |
25 | .is_enabled = regulator_is_enabled_regmap, | 25 | .is_enabled = regulator_is_enabled_regmap, |
diff --git a/drivers/regulator/s2mpa01.c b/drivers/regulator/s2mpa01.c index 92f88753bfed..38ee97a085f9 100644 --- a/drivers/regulator/s2mpa01.c +++ b/drivers/regulator/s2mpa01.c | |||
@@ -26,6 +26,7 @@ | |||
26 | #define S2MPA01_REGULATOR_CNT ARRAY_SIZE(regulators) | 26 | #define S2MPA01_REGULATOR_CNT ARRAY_SIZE(regulators) |
27 | 27 | ||
28 | struct s2mpa01_info { | 28 | struct s2mpa01_info { |
29 | struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX]; | ||
29 | int ramp_delay24; | 30 | int ramp_delay24; |
30 | int ramp_delay3; | 31 | int ramp_delay3; |
31 | int ramp_delay5; | 32 | int ramp_delay5; |
@@ -341,9 +342,9 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev) | |||
341 | { | 342 | { |
342 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); | 343 | struct sec_pmic_dev *iodev = dev_get_drvdata(pdev->dev.parent); |
343 | struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); | 344 | struct sec_platform_data *pdata = dev_get_platdata(iodev->dev); |
344 | struct of_regulator_match rdata[S2MPA01_REGULATOR_MAX] = { }; | ||
345 | struct device_node *reg_np = NULL; | 345 | struct device_node *reg_np = NULL; |
346 | struct regulator_config config = { }; | 346 | struct regulator_config config = { }; |
347 | struct of_regulator_match *rdata; | ||
347 | struct s2mpa01_info *s2mpa01; | 348 | struct s2mpa01_info *s2mpa01; |
348 | int i; | 349 | int i; |
349 | 350 | ||
@@ -351,6 +352,7 @@ static int s2mpa01_pmic_probe(struct platform_device *pdev) | |||
351 | if (!s2mpa01) | 352 | if (!s2mpa01) |
352 | return -ENOMEM; | 353 | return -ENOMEM; |
353 | 354 | ||
355 | rdata = s2mpa01->rdata; | ||
354 | for (i = 0; i < S2MPA01_REGULATOR_CNT; i++) | 356 | for (i = 0; i < S2MPA01_REGULATOR_CNT; i++) |
355 | rdata[i].name = regulators[i].name; | 357 | rdata[i].name = regulators[i].name; |
356 | 358 | ||
diff --git a/drivers/regulator/tps65086-regulator.c b/drivers/regulator/tps65086-regulator.c index ecb0371780af..45e96e154690 100644 --- a/drivers/regulator/tps65086-regulator.c +++ b/drivers/regulator/tps65086-regulator.c | |||
@@ -157,19 +157,19 @@ static struct tps65086_regulator regulators[] = { | |||
157 | VDOA23_VID_MASK, TPS65086_LDOA3CTRL, BIT(0), | 157 | VDOA23_VID_MASK, TPS65086_LDOA3CTRL, BIT(0), |
158 | tps65086_ldoa23_ranges, 0, 0), | 158 | tps65086_ldoa23_ranges, 0, 0), |
159 | TPS65086_SWITCH("SWA1", "swa1", SWA1, TPS65086_SWVTT_EN, BIT(5)), | 159 | TPS65086_SWITCH("SWA1", "swa1", SWA1, TPS65086_SWVTT_EN, BIT(5)), |
160 | TPS65086_SWITCH("SWB1", "swa2", SWB1, TPS65086_SWVTT_EN, BIT(6)), | 160 | TPS65086_SWITCH("SWB1", "swb1", SWB1, TPS65086_SWVTT_EN, BIT(6)), |
161 | TPS65086_SWITCH("SWB2", "swa3", SWB2, TPS65086_SWVTT_EN, BIT(7)), | 161 | TPS65086_SWITCH("SWB2", "swb2", SWB2, TPS65086_SWVTT_EN, BIT(7)), |
162 | TPS65086_SWITCH("VTT", "vtt", VTT, TPS65086_SWVTT_EN, BIT(4)), | 162 | TPS65086_SWITCH("VTT", "vtt", VTT, TPS65086_SWVTT_EN, BIT(4)), |
163 | }; | 163 | }; |
164 | 164 | ||
165 | static int tps65086_of_parse_cb(struct device_node *dev, | 165 | static int tps65086_of_parse_cb(struct device_node *node, |
166 | const struct regulator_desc *desc, | 166 | const struct regulator_desc *desc, |
167 | struct regulator_config *config) | 167 | struct regulator_config *config) |
168 | { | 168 | { |
169 | int ret; | 169 | int ret; |
170 | 170 | ||
171 | /* Check for 25mV step mode */ | 171 | /* Check for 25mV step mode */ |
172 | if (of_property_read_bool(config->of_node, "ti,regulator-step-size-25mv")) { | 172 | if (of_property_read_bool(node, "ti,regulator-step-size-25mv")) { |
173 | switch (desc->id) { | 173 | switch (desc->id) { |
174 | case BUCK1: | 174 | case BUCK1: |
175 | case BUCK2: | 175 | case BUCK2: |
@@ -193,7 +193,7 @@ static int tps65086_of_parse_cb(struct device_node *dev, | |||
193 | } | 193 | } |
194 | 194 | ||
195 | /* Check for decay mode */ | 195 | /* Check for decay mode */ |
196 | if (desc->id <= BUCK6 && of_property_read_bool(config->of_node, "ti,regulator-decay")) { | 196 | if (desc->id <= BUCK6 && of_property_read_bool(node, "ti,regulator-decay")) { |
197 | ret = regmap_write_bits(config->regmap, | 197 | ret = regmap_write_bits(config->regmap, |
198 | regulators[desc->id].decay_reg, | 198 | regulators[desc->id].decay_reg, |
199 | regulators[desc->id].decay_mask, | 199 | regulators[desc->id].decay_mask, |
diff --git a/drivers/regulator/tps65217-regulator.c b/drivers/regulator/tps65217-regulator.c index 2d12b9af3540..5324dc9e6d6e 100644 --- a/drivers/regulator/tps65217-regulator.c +++ b/drivers/regulator/tps65217-regulator.c | |||
@@ -179,7 +179,8 @@ static const struct regulator_desc regulators[] = { | |||
179 | TPS65217_REGULATOR("DCDC1", TPS65217_DCDC_1, "dcdc1", | 179 | TPS65217_REGULATOR("DCDC1", TPS65217_DCDC_1, "dcdc1", |
180 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC1, | 180 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC1, |
181 | TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC1_EN, | 181 | TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC1_EN, |
182 | NULL, tps65217_uv1_ranges, 2, TPS65217_REG_SEQ1, | 182 | NULL, tps65217_uv1_ranges, |
183 | ARRAY_SIZE(tps65217_uv1_ranges), TPS65217_REG_SEQ1, | ||
183 | TPS65217_SEQ1_DC1_SEQ_MASK), | 184 | TPS65217_SEQ1_DC1_SEQ_MASK), |
184 | TPS65217_REGULATOR("DCDC2", TPS65217_DCDC_2, "dcdc2", | 185 | TPS65217_REGULATOR("DCDC2", TPS65217_DCDC_2, "dcdc2", |
185 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC2, | 186 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC2, |
@@ -190,7 +191,8 @@ static const struct regulator_desc regulators[] = { | |||
190 | TPS65217_REGULATOR("DCDC3", TPS65217_DCDC_3, "dcdc3", | 191 | TPS65217_REGULATOR("DCDC3", TPS65217_DCDC_3, "dcdc3", |
191 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC3, | 192 | tps65217_pmic_ops, 64, TPS65217_REG_DEFDCDC3, |
192 | TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC3_EN, | 193 | TPS65217_DEFDCDCX_DCDC_MASK, TPS65217_ENABLE_DC3_EN, |
193 | NULL, tps65217_uv1_ranges, 1, TPS65217_REG_SEQ2, | 194 | NULL, tps65217_uv1_ranges, |
195 | ARRAY_SIZE(tps65217_uv1_ranges), TPS65217_REG_SEQ2, | ||
194 | TPS65217_SEQ2_DC3_SEQ_MASK), | 196 | TPS65217_SEQ2_DC3_SEQ_MASK), |
195 | TPS65217_REGULATOR("LDO1", TPS65217_LDO_1, "ldo1", | 197 | TPS65217_REGULATOR("LDO1", TPS65217_LDO_1, "ldo1", |
196 | tps65217_pmic_ldo1_ops, 16, TPS65217_REG_DEFLDO1, | 198 | tps65217_pmic_ldo1_ops, 16, TPS65217_REG_DEFLDO1, |