Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Merge tag 'regulator-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator

Pull regulator updates from Mark Brown:
"Quite a quiet release for regulator, the diffstat is dominated by the
I2C migration to probe_new() and the newly added MT6357 driver. We've
just one framework addition and the rest is all new device support,
fixes and cleanups.

The framework addition is an API for requesting all regulators defined
in DT, this isn't great practice but has reasonable applications when
there is generic code handling devices on buses where the bus
specification doesn't include power. The immediate application is MDIO
but I believe there's others, it's another API that'll need an eye
keeping on it for undesirable usage.

Summary:

- An API for requesting all regulators defined in DT

- Conversion of lots of drivers to the I2C probe_new() API

- Support for Mediatek MT6357, Qualcomm PM8550, PMR735a and Richtek
RT6190"

* tag 'regulator-v6.2' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (56 commits)
regulator: core: Use different devices for resource allocation and DT lookup
dt-bindings: Add missing 'unevaluatedProperties' to regulator nodes
regulator: qcom-labibb: Fix missing of_node_put() in qcom_labibb_regulator_probe()
regulator: add mt6357 regulator
regulator: dt-bindings: Add binding schema for mt6357 regulators
regulator: core: fix resource leak in regulator_register()
regulator: core: fix module refcount leak in set_supply()
regulator: core: fix use_count leakage when handling boot-on
regulator: rk808: Use dev_err_probe
regulator: rk808: reduce 'struct rk808' usage
regulator: Drop obsolete dependencies on COMPILE_TEST
regulator: pv88080-regulator: Convert to i2c's .probe_new()
regulator: pfuze100-regulator: Convert to i2c's .probe_new()
regulator: isl6271a-regulator: Convert to i2c's .probe_new()
regulator: fan53555: Convert to i2c's .probe_new()
regulator: act8865-regulator: Convert to i2c's .probe_new()
regulator: qcom-rpmh: Add support for PM8550 regulators
regulator: dt-bindings: qcom,rpmh: Add compatible for PM8550
regulator: tps65023-regulator: Convert to i2c's .probe_new()
regulator: tps62360-regulator: Convert to i2c's .probe_new()
...

+1998 -288
-2
Documentation/devicetree/bindings/mfd/max77650.yaml
··· 100 100 compatible = "maxim,max77650-regulator"; 101 101 102 102 max77650_ldo: regulator-ldo { 103 - regulator-compatible = "ldo"; 104 103 regulator-name = "max77650-ldo"; 105 104 regulator-min-microvolt = <1350000>; 106 105 regulator-max-microvolt = <2937500>; 107 106 }; 108 107 109 108 max77650_sbb0: regulator-sbb0 { 110 - regulator-compatible = "sbb0"; 111 109 regulator-name = "max77650-sbb0"; 112 110 regulator-min-microvolt = <800000>; 113 111 regulator-max-microvolt = <1587500>;
-9
Documentation/devicetree/bindings/mfd/mediatek,mt6360.yaml
··· 83 83 richtek,vinovp-microvolt = <14500000>; 84 84 85 85 otg_vbus_regulator: usb-otg-vbus-regulator { 86 - regulator-compatible = "usb-otg-vbus"; 87 86 regulator-name = "usb-otg-vbus"; 88 87 regulator-min-microvolt = <4425000>; 89 88 regulator-max-microvolt = <5825000>; ··· 144 145 compatible = "mediatek,mt6360-regulator"; 145 146 LDO_VIN3-supply = <&BUCK2>; 146 147 buck1 { 147 - regulator-compatible = "BUCK1"; 148 148 regulator-name = "mt6360,buck1"; 149 149 regulator-min-microvolt = <300000>; 150 150 regulator-max-microvolt = <1300000>; ··· 152 154 MT6360_OPMODE_ULP>; 153 155 }; 154 156 BUCK2: buck2 { 155 - regulator-compatible = "BUCK2"; 156 157 regulator-name = "mt6360,buck2"; 157 158 regulator-min-microvolt = <300000>; 158 159 regulator-max-microvolt = <1300000>; ··· 160 163 MT6360_OPMODE_ULP>; 161 164 }; 162 165 ldo6 { 163 - regulator-compatible = "LDO6"; 164 166 regulator-name = "mt6360,ldo6"; 165 167 regulator-min-microvolt = <500000>; 166 168 regulator-max-microvolt = <2100000>; ··· 167 171 MT6360_OPMODE_LP>; 168 172 }; 169 173 ldo7 { 170 - regulator-compatible = "LDO7"; 171 174 regulator-name = "mt6360,ldo7"; 172 175 regulator-min-microvolt = <500000>; 173 176 regulator-max-microvolt = <2100000>; ··· 174 179 MT6360_OPMODE_LP>; 175 180 }; 176 181 ldo1 { 177 - regulator-compatible = "LDO1"; 178 182 regulator-name = "mt6360,ldo1"; 179 183 regulator-min-microvolt = <1200000>; 180 184 regulator-max-microvolt = <3600000>; ··· 181 187 MT6360_OPMODE_LP>; 182 188 }; 183 189 ldo2 { 184 - regulator-compatible = "LDO2"; 185 190 regulator-name = "mt6360,ldo2"; 186 191 regulator-min-microvolt = <1200000>; 187 192 regulator-max-microvolt = <3600000>; ··· 188 195 MT6360_OPMODE_LP>; 189 196 }; 190 197 ldo3 { 191 - regulator-compatible = "LDO3"; 192 198 regulator-name = "mt6360,ldo3"; 193 199 regulator-min-microvolt = <1200000>; 194 200 regulator-max-microvolt = <3600000>; ··· 195 203 MT6360_OPMODE_LP>; 196 204 }; 197 205 ldo5 { 198 - regulator-compatible = "LDO5"; 199 206 regulator-name = "mt6360,ldo5"; 200 207 regulator-min-microvolt = <2700000>; 201 208 regulator-max-microvolt = <3600000>;
+1 -1
Documentation/devicetree/bindings/power/supply/mt6360_charger.yaml
··· 26 26 type: object 27 27 description: OTG boost regulator. 28 28 $ref: /schemas/regulator/regulator.yaml# 29 + unevaluatedProperties: false 29 30 30 31 required: 31 32 - compatible ··· 40 39 richtek,vinovp-microvolt = <14500000>; 41 40 42 41 otg_vbus_regulator: usb-otg-vbus-regulator { 43 - regulator-compatible = "usb-otg-vbus"; 44 42 regulator-name = "usb-otg-vbus"; 45 43 regulator-min-microvolt = <4425000>; 46 44 regulator-max-microvolt = <5825000>;
+1
Documentation/devicetree/bindings/regulator/max77650-regulator.yaml
··· 26 26 patternProperties: 27 27 "^regulator-(ldo|sbb[0-2])$": 28 28 $ref: "regulator.yaml#" 29 + unevaluatedProperties: false 29 30 30 31 required: 31 32 - compatible
+1 -5
Documentation/devicetree/bindings/regulator/max8660.yaml
··· 26 26 patternProperties: 27 27 "regulator-.+": 28 28 $ref: "regulator.yaml#" 29 + unevaluatedProperties: false 29 30 30 31 additionalProperties: false 31 32 ··· 44 43 45 44 regulators { 46 45 regulator-V3 { 47 - regulator-compatible= "V3(DCDC)"; 48 46 regulator-min-microvolt = <725000>; 49 47 regulator-max-microvolt = <1800000>; 50 48 }; 51 49 52 50 regulator-V4 { 53 - regulator-compatible= "V4(DCDC)"; 54 51 regulator-min-microvolt = <725000>; 55 52 regulator-max-microvolt = <1800000>; 56 53 }; 57 54 58 55 regulator-V5 { 59 - regulator-compatible= "V5(LDO)"; 60 56 regulator-min-microvolt = <1700000>; 61 57 regulator-max-microvolt = <2000000>; 62 58 }; 63 59 64 60 regulator-V6 { 65 - regulator-compatible= "V6(LDO)"; 66 61 regulator-min-microvolt = <1800000>; 67 62 regulator-max-microvolt = <3300000>; 68 63 }; 69 64 70 65 regulator-V7 { 71 - regulator-compatible= "V7(LDO)"; 72 66 regulator-min-microvolt = <1800000>; 73 67 regulator-max-microvolt = <3300000>; 74 68 };
+294
Documentation/devicetree/bindings/regulator/mediatek,mt6357-regulator.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/regulator/mediatek,mt6357-regulator.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: MediaTek MT6357 Regulators 8 + 9 + maintainers: 10 + - Chen Zhong <chen.zhong@mediatek.com> 11 + - Fabien Parent <fabien.parent@linaro.org> 12 + - Alexandre Mergnat <amergnat@baylibre.com> 13 + 14 + description: | 15 + The MT6357 PMIC provides 5 BUCK and 29 LDO. 16 + Regulators and nodes are named according to the regulator type: 17 + - buck-<name> 18 + - ldo-<name>. 19 + MT6357 regulators node should be sub node of the MT6397 MFD node. 20 + 21 + patternProperties: 22 + "^buck-v(core|modem|pa|proc|s1)$": 23 + type: object 24 + $ref: regulator.yaml# 25 + unevaluatedProperties: false 26 + description: 27 + Properties for single BUCK regulator. 28 + 29 + required: 30 + - regulator-name 31 + - regulator-min-microvolt 32 + - regulator-max-microvolt 33 + 34 + "^ldo-v(camio18|aud28|aux18|io18|io28|rf12|rf18|cn18|cn28|fe28)$": 35 + type: object 36 + $ref: fixed-regulator.yaml# 37 + unevaluatedProperties: false 38 + description: 39 + Properties for single fixed LDO regulator. 40 + 41 + required: 42 + - regulator-name 43 + - regulator-min-microvolt 44 + - regulator-max-microvolt 45 + 46 + "^ldo-v(efuse|ibr|ldo28|mch|cama|camd|cn33-bt|cn33-wifi)$": 47 + type: object 48 + $ref: regulator.yaml# 49 + unevaluatedProperties: false 50 + description: 51 + Properties for single LDO regulator. 52 + 53 + required: 54 + - regulator-name 55 + - regulator-min-microvolt 56 + - regulator-max-microvolt 57 + 58 + "^ldo-v(xo22|emc|mc|sim1|sim2|sram-others|sram-proc|dram|usb33)$": 59 + type: object 60 + $ref: regulator.yaml# 61 + unevaluatedProperties: false 62 + description: 63 + Properties for single LDO regulator. 64 + 65 + required: 66 + - regulator-name 67 + - regulator-min-microvolt 68 + - regulator-max-microvolt 69 + 70 + additionalProperties: false 71 + 72 + examples: 73 + - | 74 + pmic { 75 + regulators { 76 + mt6357_vproc_reg: buck-vproc { 77 + regulator-name = "vproc"; 78 + regulator-min-microvolt = <518750>; 79 + regulator-max-microvolt = <1312500>; 80 + regulator-ramp-delay = <6250>; 81 + regulator-enable-ramp-delay = <220>; 82 + regulator-always-on; 83 + }; 84 + mt6357_vcore_reg: buck-vcore { 85 + regulator-name = "vcore"; 86 + regulator-min-microvolt = <518750>; 87 + regulator-max-microvolt = <1312500>; 88 + regulator-ramp-delay = <6250>; 89 + regulator-enable-ramp-delay = <220>; 90 + regulator-always-on; 91 + }; 92 + mt6357_vmodem_reg: buck-vmodem { 93 + regulator-name = "vmodem"; 94 + regulator-min-microvolt = <500000>; 95 + regulator-max-microvolt = <1193750>; 96 + regulator-ramp-delay = <6250>; 97 + regulator-enable-ramp-delay = <220>; 98 + }; 99 + mt6357_vs1_reg: buck-vs1 { 100 + regulator-name = "vs1"; 101 + regulator-min-microvolt = <1200000>; 102 + regulator-max-microvolt = <2200000>; 103 + regulator-ramp-delay = <12500>; 104 + regulator-enable-ramp-delay = <220>; 105 + regulator-always-on; 106 + }; 107 + mt6357_vpa_reg: buck-vpa { 108 + regulator-name = "vpa"; 109 + regulator-min-microvolt = <500000>; 110 + regulator-max-microvolt = <3650000>; 111 + regulator-ramp-delay = <50000>; 112 + regulator-enable-ramp-delay = <220>; 113 + }; 114 + mt6357_vfe28_reg: ldo-vfe28 { 115 + compatible = "regulator-fixed"; 116 + regulator-name = "vfe28"; 117 + regulator-min-microvolt = <2800000>; 118 + regulator-max-microvolt = <2800000>; 119 + regulator-enable-ramp-delay = <264>; 120 + }; 121 + mt6357_vxo22_reg: ldo-vxo22 { 122 + regulator-name = "vxo22"; 123 + regulator-min-microvolt = <2200000>; 124 + regulator-max-microvolt = <2400000>; 125 + regulator-enable-ramp-delay = <110>; 126 + }; 127 + mt6357_vrf18_reg: ldo-vrf18 { 128 + compatible = "regulator-fixed"; 129 + regulator-name = "vrf18"; 130 + regulator-min-microvolt = <1800000>; 131 + regulator-max-microvolt = <1800000>; 132 + regulator-enable-ramp-delay = <110>; 133 + }; 134 + mt6357_vrf12_reg: ldo-vrf12 { 135 + compatible = "regulator-fixed"; 136 + regulator-name = "vrf12"; 137 + regulator-min-microvolt = <1200000>; 138 + regulator-max-microvolt = <1200000>; 139 + regulator-enable-ramp-delay = <110>; 140 + }; 141 + mt6357_vefuse_reg: ldo-vefuse { 142 + regulator-name = "vefuse"; 143 + regulator-min-microvolt = <1200000>; 144 + regulator-max-microvolt = <3300000>; 145 + regulator-enable-ramp-delay = <264>; 146 + }; 147 + mt6357_vcn33_bt_reg: ldo-vcn33-bt { 148 + regulator-name = "vcn33-bt"; 149 + regulator-min-microvolt = <3300000>; 150 + regulator-max-microvolt = <3500000>; 151 + regulator-enable-ramp-delay = <264>; 152 + }; 153 + mt6357_vcn33_wifi_reg: ldo-vcn33-wifi { 154 + regulator-name = "vcn33-wifi"; 155 + regulator-min-microvolt = <3300000>; 156 + regulator-max-microvolt = <3500000>; 157 + regulator-enable-ramp-delay = <264>; 158 + }; 159 + mt6357_vcn28_reg: ldo-vcn28 { 160 + compatible = "regulator-fixed"; 161 + regulator-name = "vcn28"; 162 + regulator-min-microvolt = <2800000>; 163 + regulator-max-microvolt = <2800000>; 164 + regulator-enable-ramp-delay = <264>; 165 + }; 166 + mt6357_vcn18_reg: ldo-vcn18 { 167 + compatible = "regulator-fixed"; 168 + regulator-name = "vcn18"; 169 + regulator-min-microvolt = <1800000>; 170 + regulator-max-microvolt = <1800000>; 171 + regulator-enable-ramp-delay = <264>; 172 + }; 173 + mt6357_vcama_reg: ldo-vcama { 174 + regulator-name = "vcama"; 175 + regulator-min-microvolt = <2500000>; 176 + regulator-max-microvolt = <2800000>; 177 + regulator-enable-ramp-delay = <264>; 178 + }; 179 + mt6357_vcamd_reg: ldo-vcamd { 180 + regulator-name = "vcamd"; 181 + regulator-min-microvolt = <1000000>; 182 + regulator-max-microvolt = <1800000>; 183 + regulator-enable-ramp-delay = <264>; 184 + }; 185 + mt6357_vcamio_reg: ldo-vcamio18 { 186 + compatible = "regulator-fixed"; 187 + regulator-name = "vcamio"; 188 + regulator-min-microvolt = <1800000>; 189 + regulator-max-microvolt = <1800000>; 190 + regulator-enable-ramp-delay = <264>; 191 + }; 192 + mt6357_vldo28_reg: ldo-vldo28 { 193 + regulator-name = "vldo28"; 194 + regulator-min-microvolt = <2800000>; 195 + regulator-max-microvolt = <3000000>; 196 + regulator-enable-ramp-delay = <264>; 197 + }; 198 + mt6357_vsram_others_reg: ldo-vsram-others { 199 + regulator-name = "vsram-others"; 200 + regulator-min-microvolt = <518750>; 201 + regulator-max-microvolt = <1312500>; 202 + regulator-ramp-delay = <6250>; 203 + regulator-enable-ramp-delay = <110>; 204 + regulator-always-on; 205 + }; 206 + mt6357_vsram_proc_reg: ldo-vsram-proc { 207 + regulator-name = "vsram-proc"; 208 + regulator-min-microvolt = <518750>; 209 + regulator-max-microvolt = <1312500>; 210 + regulator-ramp-delay = <6250>; 211 + regulator-enable-ramp-delay = <110>; 212 + regulator-always-on; 213 + }; 214 + mt6357_vaux18_reg: ldo-vaux18 { 215 + compatible = "regulator-fixed"; 216 + regulator-name = "vaux18"; 217 + regulator-min-microvolt = <1800000>; 218 + regulator-max-microvolt = <1800000>; 219 + regulator-enable-ramp-delay = <264>; 220 + }; 221 + mt6357_vaud28_reg: ldo-vaud28 { 222 + compatible = "regulator-fixed"; 223 + regulator-name = "vaud28"; 224 + regulator-min-microvolt = <2800000>; 225 + regulator-max-microvolt = <2800000>; 226 + regulator-enable-ramp-delay = <264>; 227 + }; 228 + mt6357_vio28_reg: ldo-vio28 { 229 + compatible = "regulator-fixed"; 230 + regulator-name = "vio28"; 231 + regulator-min-microvolt = <2800000>; 232 + regulator-max-microvolt = <2800000>; 233 + regulator-enable-ramp-delay = <264>; 234 + }; 235 + mt6357_vio18_reg: ldo-vio18 { 236 + compatible = "regulator-fixed"; 237 + regulator-name = "vio18"; 238 + regulator-min-microvolt = <1800000>; 239 + regulator-max-microvolt = <1800000>; 240 + regulator-enable-ramp-delay = <264>; 241 + regulator-always-on; 242 + }; 243 + mt6357_vdram_reg: ldo-vdram { 244 + regulator-name = "vdram"; 245 + regulator-min-microvolt = <1100000>; 246 + regulator-max-microvolt = <1200000>; 247 + regulator-enable-ramp-delay = <3300>; 248 + }; 249 + mt6357_vmc_reg: ldo-vmc { 250 + regulator-name = "vmc"; 251 + regulator-min-microvolt = <1800000>; 252 + regulator-max-microvolt = <3300000>; 253 + regulator-enable-ramp-delay = <44>; 254 + }; 255 + mt6357_vmch_reg: ldo-vmch { 256 + regulator-name = "vmch"; 257 + regulator-min-microvolt = <2900000>; 258 + regulator-max-microvolt = <3300000>; 259 + regulator-enable-ramp-delay = <44>; 260 + }; 261 + mt6357_vemc_reg: ldo-vemc { 262 + regulator-name = "vemc"; 263 + regulator-min-microvolt = <2900000>; 264 + regulator-max-microvolt = <3300000>; 265 + regulator-enable-ramp-delay = <44>; 266 + regulator-always-on; 267 + }; 268 + mt6357_vsim1_reg: ldo-vsim1 { 269 + regulator-name = "vsim1"; 270 + regulator-min-microvolt = <1700000>; 271 + regulator-max-microvolt = <3100000>; 272 + regulator-enable-ramp-delay = <264>; 273 + }; 274 + mt6357_vsim2_reg: ldo-vsim2 { 275 + regulator-name = "vsim2"; 276 + regulator-min-microvolt = <1700000>; 277 + regulator-max-microvolt = <3100000>; 278 + regulator-enable-ramp-delay = <264>; 279 + }; 280 + mt6357_vibr_reg: ldo-vibr { 281 + regulator-name = "vibr"; 282 + regulator-min-microvolt = <1200000>; 283 + regulator-max-microvolt = <3300000>; 284 + regulator-enable-ramp-delay = <44>; 285 + }; 286 + mt6357_vusb33_reg: ldo-vusb33 { 287 + regulator-name = "vusb33"; 288 + regulator-min-microvolt = <3000000>; 289 + regulator-max-microvolt = <3100000>; 290 + regulator-enable-ramp-delay = <264>; 291 + }; 292 + }; 293 + }; 294 + ...
+3 -9
Documentation/devicetree/bindings/regulator/mt6360-regulator.yaml
··· 27 27 patternProperties: 28 28 "^buck[12]$": 29 29 $ref: "regulator.yaml#" 30 + unevaluatedProperties: false 30 31 31 32 "^ldo[123567]$": 32 33 $ref: "regulator.yaml#" 34 + unevaluatedProperties: false 33 35 34 36 required: 35 37 - compatible ··· 46 44 compatible = "mediatek,mt6360-regulator"; 47 45 LDO_VIN3-supply = <&BUCK2>; 48 46 buck1 { 49 - regulator-compatible = "BUCK1"; 50 47 regulator-name = "mt6360,buck1"; 51 48 regulator-min-microvolt = <300000>; 52 49 regulator-max-microvolt = <1300000>; ··· 54 53 MT6360_OPMODE_ULP>; 55 54 }; 56 55 BUCK2: buck2 { 57 - regulator-compatible = "BUCK2"; 58 56 regulator-name = "mt6360,buck2"; 59 57 regulator-min-microvolt = <300000>; 60 58 regulator-max-microvolt = <1300000>; ··· 62 62 MT6360_OPMODE_ULP>; 63 63 }; 64 64 ldo6 { 65 - regulator-compatible = "LDO6"; 66 65 regulator-name = "mt6360,ldo6"; 67 66 regulator-min-microvolt = <500000>; 68 67 regulator-max-microvolt = <2100000>; ··· 69 70 MT6360_OPMODE_LP>; 70 71 }; 71 72 ldo7 { 72 - regulator-compatible = "LDO7"; 73 73 regulator-name = "mt6360,ldo7"; 74 74 regulator-min-microvolt = <500000>; 75 75 regulator-max-microvolt = <2100000>; ··· 76 78 MT6360_OPMODE_LP>; 77 79 }; 78 80 ldo1 { 79 - regulator-compatible = "LDO1"; 80 81 regulator-name = "mt6360,ldo1"; 81 82 regulator-min-microvolt = <1200000>; 82 83 regulator-max-microvolt = <3600000>; 83 84 regulator-allowed-modes = <MT6360_OPMODE_NORMAL 84 85 MT6360_OPMODE_LP>; 85 86 }; 86 - ldo2 { 87 - regulator-compatible = "LDO2"; 87 + ldo2 { 88 88 regulator-name = "mt6360,ldo2"; 89 89 regulator-min-microvolt = <1200000>; 90 90 regulator-max-microvolt = <3600000>; ··· 90 94 MT6360_OPMODE_LP>; 91 95 }; 92 96 ldo3 { 93 - regulator-compatible = "LDO3"; 94 97 regulator-name = "mt6360,ldo3"; 95 98 regulator-min-microvolt = <1200000>; 96 99 regulator-max-microvolt = <3600000>; ··· 97 102 MT6360_OPMODE_LP>; 98 103 }; 99 104 ldo5 { 100 - regulator-compatible = "LDO5"; 101 105 regulator-name = "mt6360,ldo5"; 102 106 regulator-min-microvolt = <2700000>; 103 107 regulator-max-microvolt = <3600000>;
+28 -8
Documentation/devicetree/bindings/regulator/qcom,rpmh-regulator.yaml
··· 47 47 For PM8350, smps1 - smps12, ldo1 - ldo10 48 48 For PM8350C, smps1 - smps10, ldo1 - ldo13, bob 49 49 For PM8450, smps1 - smps6, ldo1 - ldo4 50 + For PM8550, smps1 - smps6, ldo1 - ldo17, bob1 - bob2 50 51 For PM8998, smps1 - smps13, ldo1 - ldo28, lvs1 - lvs2 51 52 For PMI8998, bob 52 53 For PMR735A, smps1 - smps3, ldo1 - ldo7 ··· 71 70 - qcom,pm8350-rpmh-regulators 72 71 - qcom,pm8350c-rpmh-regulators 73 72 - qcom,pm8450-rpmh-regulators 73 + - qcom,pm8550-rpmh-regulators 74 + - qcom,pm8550ve-rpmh-regulators 75 + - qcom,pm8550vs-rpmh-regulators 74 76 - qcom,pm8998-rpmh-regulators 75 77 - qcom,pmg1110-rpmh-regulators 76 78 - qcom,pmi8998-rpmh-regulators ··· 87 83 RPMh resource name suffix used for the regulators found 88 84 on this PMIC. 89 85 $ref: /schemas/types.yaml#/definitions/string 90 - enum: [a, b, c, d, e, f, h, k] 86 + enum: [a, b, c, d, e, f, g, h, k] 91 87 92 88 qcom,always-wait-for-ack: 93 89 description: | ··· 111 107 regulator-allow-set-load: ["regulator-allowed-modes"] 112 108 113 109 patternProperties: 114 - "^(smps|ldo|lvs)[0-9]+$": 110 + "^(smps|ldo|lvs|bob)[0-9]+$": 115 111 type: object 116 112 $ref: "regulator.yaml#" 117 113 description: smps/ldo regulator nodes(s). ··· 307 303 properties: 308 304 compatible: 309 305 enum: 306 + - qcom,pm8550-rpmh-regulators 307 + - qcom,pm8550ve-rpmh-regulators 308 + - qcom,pm8550vs-rpmh-regulators 309 + then: 310 + properties: 311 + vdd-l2-l13-l14-supply: true 312 + vdd-l5-l16-supply: true 313 + vdd-l6-l7-supply: true 314 + vdd-l8-l9-supply: true 315 + patternProperties: 316 + "^vdd-l([1-4]|1[0-7])-supply$": true 317 + "^vdd-s[1-6]-supply$": true 318 + "^vdd-bob[1-2]-supply$": true 319 + 320 + - if: 321 + properties: 322 + compatible: 323 + enum: 310 324 - qcom,pm8998-rpmh-regulators 311 325 then: 312 326 properties: ··· 434 412 regulator-min-microvolt = <1800000>; 435 413 regulator-max-microvolt = <1800000>; 436 414 regulator-initial-mode = <RPMH_REGULATOR_MODE_HPM>; 437 - regulator-allowed-modes = 438 - <RPMH_REGULATOR_MODE_LPM 439 - RPMH_REGULATOR_MODE_HPM>; 415 + regulator-allowed-modes = <RPMH_REGULATOR_MODE_LPM 416 + RPMH_REGULATOR_MODE_HPM>; 440 417 regulator-allow-set-load; 441 418 }; 442 419 ··· 452 431 bob { 453 432 regulator-min-microvolt = <3312000>; 454 433 regulator-max-microvolt = <3600000>; 455 - regulator-allowed-modes = 456 - <RPMH_REGULATOR_MODE_AUTO 457 - RPMH_REGULATOR_MODE_HPM>; 434 + regulator-allowed-modes = <RPMH_REGULATOR_MODE_AUTO 435 + RPMH_REGULATOR_MODE_HPM>; 458 436 regulator-initial-mode = <RPMH_REGULATOR_MODE_AUTO>; 459 437 }; 460 438 };
+3
Documentation/devicetree/bindings/regulator/qcom,smd-rpm-regulator.yaml
··· 71 71 72 72 For pmi8998, bob 73 73 74 + For pmr735a, s1, s2, s3, l1, l2, l3, l4, l5, l6, l7 75 + 74 76 For pms405, s1, s2, s3, s4, s5, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, 75 77 l12, l13 76 78 ··· 100 98 - qcom,rpm-pma8084-regulators 101 99 - qcom,rpm-pmi8994-regulators 102 100 - qcom,rpm-pmi8998-regulators 101 + - qcom,rpm-pmr735a-regulators 103 102 - qcom,rpm-pms405-regulators 104 103 105 104 patternProperties:
+39
Documentation/devicetree/bindings/regulator/regulator-output.yaml
··· 1 + # SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause) 2 + %YAML 1.2 3 + --- 4 + 5 + $id: http://devicetree.org/schemas/regulator/regulator-output.yaml# 6 + $schema: http://devicetree.org/meta-schemas/core.yaml# 7 + 8 + title: Regulator output connector 9 + 10 + maintainers: 11 + - Zev Weiss <zev@bewilderbeest.net> 12 + 13 + description: | 14 + This describes a power output connector supplied by a regulator, 15 + such as a power outlet on a power distribution unit (PDU). The 16 + connector may be standalone or merely one channel or set of pins 17 + within a ganged physical connector carrying multiple independent 18 + power outputs. 19 + 20 + properties: 21 + compatible: 22 + const: regulator-output 23 + 24 + vout-supply: 25 + description: 26 + Phandle of the regulator supplying the output. 27 + 28 + required: 29 + - compatible 30 + - vout-supply 31 + 32 + additionalProperties: false 33 + 34 + examples: 35 + - | 36 + output { 37 + compatible = "regulator-output"; 38 + vout-supply = <&output_reg>; 39 + };
+79
Documentation/devicetree/bindings/regulator/richtek,rt6190.yaml
··· 1 + # SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause 2 + %YAML 1.2 3 + --- 4 + $id: http://devicetree.org/schemas/regulator/richtek,rt6190.yaml# 5 + $schema: http://devicetree.org/meta-schemas/core.yaml# 6 + 7 + title: Richtek RT6190 4-Switch BuckBoost controller 8 + 9 + maintainers: 10 + - ChiYuan Huang <cy_huang@richtek.com> 11 + 12 + description: | 13 + The RT6190 is 4-Switch BuckBoost controller designed for converting input 14 + voltage to output voltage that can be equal to, higher or lower than input 15 + voltage. It operates with wide input voltage range from 4.5V to 36V, and 16 + the output voltage can be set from 3V to 36V by external FB pin. It's commonly 17 + used for the application like as BuckBoost bus supply, docking station and USB 18 + power delivery product. 19 + 20 + Datasheet is available at 21 + https://www.richtek.com/assets/product_file/RT6190/DS6190-02.pdf 22 + 23 + allOf: 24 + - $ref: regulator.yaml# 25 + 26 + properties: 27 + compatible: 28 + enum: 29 + - richtek,rt6190 30 + 31 + reg: 32 + maxItems: 1 33 + 34 + enable-gpios: 35 + maxItems: 1 36 + 37 + wakeup-source: true 38 + 39 + interrupts: 40 + maxItems: 1 41 + 42 + regulator-allowed-modes: 43 + description: | 44 + buck allowed operating mode 45 + 0: PSM mode (light load Power Saving Mode) 46 + 1: FCCM mode (Forced-CCM mode) 47 + maxItems: 2 48 + items: 49 + enum: [0, 1] 50 + 51 + required: 52 + - compatible 53 + - reg 54 + 55 + unevaluatedProperties: false 56 + 57 + examples: 58 + - | 59 + #include <dt-bindings/gpio/gpio.h> 60 + #include <dt-bindings/interrupt-controller/irq.h> 61 + 62 + i2c { 63 + #address-cells = <1>; 64 + #size-cells = <0>; 65 + 66 + regulator@2c { 67 + compatible = "richtek,rt6190"; 68 + reg = <0x2c>; 69 + wakeup-source; 70 + interrupts-extended = <&gpio26 0 IRQ_TYPE_LEVEL_LOW>; 71 + enable-gpios = <&gpio26 1 GPIO_ACTIVE_HIGH>; 72 + regulator-name = "richtek,rt6190-buckboost"; 73 + regulator-min-microvolt = <3000000>; 74 + regulator-max-microvolt = <32000000>; 75 + regulator-min-microamp = <306000>; 76 + regulator-max-microamp = <12114000>; 77 + regulator-allowed-modes = <0 1>; 78 + }; 79 + };
+1
Documentation/driver-api/driver-model/devres.rst
··· 417 417 REGULATOR 418 418 devm_regulator_bulk_register_supply_alias() 419 419 devm_regulator_bulk_get() 420 + devm_regulator_bulk_get_const() 420 421 devm_regulator_bulk_get_enable() 421 422 devm_regulator_bulk_put() 422 423 devm_regulator_get()
+2 -1
drivers/platform/x86/intel/int3472/clk_and_regulator.c
··· 185 185 cfg.init_data = &init_data; 186 186 cfg.ena_gpiod = int3472->regulator.gpio; 187 187 188 - int3472->regulator.rdev = regulator_register(&int3472->regulator.rdesc, 188 + int3472->regulator.rdev = regulator_register(int3472->dev, 189 + &int3472->regulator.rdesc, 189 190 &cfg); 190 191 if (IS_ERR(int3472->regulator.rdev)) { 191 192 ret = PTR_ERR(int3472->regulator.rdev);
+25 -5
drivers/regulator/Kconfig
··· 377 377 378 378 config REGULATOR_FAN53880 379 379 tristate "Fairchild FAN53880 Regulator" 380 - depends on I2C && (OF || COMPILE_TEST) 380 + depends on I2C && OF 381 381 select REGMAP_I2C 382 382 help 383 383 This driver supports Fairchild (ON Semiconductor) FAN53880 ··· 743 743 744 744 config REGULATOR_MP886X 745 745 tristate "MPS MP8869 regulator driver" 746 - depends on I2C && (OF || COMPILE_TEST) 746 + depends on I2C && OF 747 747 select REGMAP_I2C 748 748 help 749 749 This driver supports the MP8869 voltage regulator. ··· 804 804 MediaTek MT6332 PMIC. 805 805 This driver supports the control of different power rails of device 806 806 through regulator interface 807 + 808 + config REGULATOR_MT6357 809 + tristate "MediaTek MT6357 PMIC" 810 + depends on MFD_MT6397 811 + help 812 + Say y here to select this option to enable the power regulator of 813 + MediaTek MT6357 PMIC. 814 + This driver supports the control of different power rails of device 815 + through regulator interface. 807 816 808 817 config REGULATOR_MT6358 809 818 tristate "MediaTek MT6358 PMIC" ··· 1133 1124 The wide output range is from 2025mV to 5200mV and can be used on most 1134 1125 common application scenario. 1135 1126 1127 + config REGULATOR_RT6190 1128 + tristate "Richtek RT6190 4-Switch BuckBoost controller" 1129 + depends on I2C 1130 + select REGMAP_I2C 1131 + help 1132 + The RT6190 is a 4-Switch BuckBoost controller designed for converting 1133 + input voltage to output voltage that can be equal to, higher or lower 1134 + than input voltage. It operates with wide input voltage range from 1135 + 4.5V to 36V, and the output voltage can be set from 3V to 36V by 1136 + external FB pin. 1137 + 1136 1138 config REGULATOR_RT6245 1137 1139 tristate "Richtek RT6245 voltage regulator" 1138 1140 depends on I2C ··· 1308 1288 1309 1289 config REGULATOR_SY8106A 1310 1290 tristate "Silergy SY8106A regulator" 1311 - depends on I2C && (OF || COMPILE_TEST) 1291 + depends on I2C && OF 1312 1292 select REGMAP_I2C 1313 1293 help 1314 1294 This driver supports SY8106A single output regulator. 1315 1295 1316 1296 config REGULATOR_SY8824X 1317 1297 tristate "Silergy SY8824C/SY8824E regulator" 1318 - depends on I2C && (OF || COMPILE_TEST) 1298 + depends on I2C && OF 1319 1299 select REGMAP_I2C 1320 1300 help 1321 1301 This driver supports SY8824C single output regulator. 1322 1302 1323 1303 config REGULATOR_SY8827N 1324 1304 tristate "Silergy SY8827N regulator" 1325 - depends on I2C && (OF || COMPILE_TEST) 1305 + depends on I2C && OF 1326 1306 select REGMAP_I2C 1327 1307 help 1328 1308 This driver supports SY8827N single output regulator.
+2
drivers/regulator/Makefile
··· 97 97 obj-$(CONFIG_REGULATOR_MT6323) += mt6323-regulator.o 98 98 obj-$(CONFIG_REGULATOR_MT6331) += mt6331-regulator.o 99 99 obj-$(CONFIG_REGULATOR_MT6332) += mt6332-regulator.o 100 + obj-$(CONFIG_REGULATOR_MT6357) += mt6357-regulator.o 100 101 obj-$(CONFIG_REGULATOR_MT6358) += mt6358-regulator.o 101 102 obj-$(CONFIG_REGULATOR_MT6359) += mt6359-regulator.o 102 103 obj-$(CONFIG_REGULATOR_MT6360) += mt6360-regulator.o ··· 135 134 obj-$(CONFIG_REGULATOR_RT5190A) += rt5190a-regulator.o 136 135 obj-$(CONFIG_REGULATOR_RT5759) += rt5759-regulator.o 137 136 obj-$(CONFIG_REGULATOR_RT6160) += rt6160-regulator.o 137 + obj-$(CONFIG_REGULATOR_RT6190) += rt6190-regulator.o 138 138 obj-$(CONFIG_REGULATOR_RT6245) += rt6245-regulator.o 139 139 obj-$(CONFIG_REGULATOR_RTMV20) += rtmv20-regulator.o 140 140 obj-$(CONFIG_REGULATOR_RTQ2134) += rtq2134-regulator.o
+3 -3
drivers/regulator/act8865-regulator.c
··· 651 651 return PTR_ERR_OR_ZERO(charger); 652 652 } 653 653 654 - static int act8865_pmic_probe(struct i2c_client *client, 655 - const struct i2c_device_id *i2c_id) 654 + static int act8865_pmic_probe(struct i2c_client *client) 656 655 { 656 + const struct i2c_device_id *i2c_id = i2c_client_get_device_id(client); 657 657 const struct regulator_desc *regulators; 658 658 struct act8865_platform_data *pdata = NULL; 659 659 struct device *dev = &client->dev; ··· 790 790 .driver = { 791 791 .name = "act8865", 792 792 }, 793 - .probe = act8865_pmic_probe, 793 + .probe_new = act8865_pmic_probe, 794 794 .id_table = act8865_ids, 795 795 }; 796 796
+3 -3
drivers/regulator/ad5398.c
··· 212 212 }; 213 213 MODULE_DEVICE_TABLE(i2c, ad5398_id); 214 214 215 - static int ad5398_probe(struct i2c_client *client, 216 - const struct i2c_device_id *id) 215 + static int ad5398_probe(struct i2c_client *client) 217 216 { 217 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 218 218 struct regulator_init_data *init_data = dev_get_platdata(&client->dev); 219 219 struct regulator_config config = { }; 220 220 struct ad5398_chip_info *chip; ··· 254 254 } 255 255 256 256 static struct i2c_driver ad5398_driver = { 257 - .probe = ad5398_probe, 257 + .probe_new = ad5398_probe, 258 258 .driver = { 259 259 .name = "ad5398", 260 260 },
+11 -9
drivers/regulator/arizona-micsupp.c
··· 34 34 struct regulator_dev *regulator; 35 35 struct regmap *regmap; 36 36 struct snd_soc_dapm_context **dapm; 37 - unsigned int enable_reg; 37 + const struct regulator_desc *desc; 38 38 struct device *dev; 39 39 40 40 struct regulator_consumer_supply supply; ··· 49 49 container_of(work, struct arizona_micsupp, check_cp_work); 50 50 struct snd_soc_dapm_context *dapm = *micsupp->dapm; 51 51 struct snd_soc_component *component; 52 + const struct regulator_desc *desc = micsupp->desc; 52 53 unsigned int val; 53 54 int ret; 54 55 55 - ret = regmap_read(micsupp->regmap, micsupp->enable_reg, &val); 56 + ret = regmap_read(micsupp->regmap, desc->enable_reg, &val); 56 57 if (ret != 0) { 57 58 dev_err(micsupp->dev, 58 59 "Failed to read CP state: %d\n", ret); ··· 63 62 if (dapm) { 64 63 component = snd_soc_dapm_to_component(dapm); 65 64 66 - if ((val & (ARIZONA_CPMIC_ENA | ARIZONA_CPMIC_BYPASS)) == 67 - ARIZONA_CPMIC_ENA) 65 + if ((val & (desc->enable_mask | desc->bypass_mask)) == 66 + desc->enable_mask) 68 67 snd_soc_component_force_enable_pin(component, 69 68 "MICSUPP"); 70 69 else ··· 210 209 .type = REGULATOR_VOLTAGE, 211 210 .n_voltages = 40, 212 211 .ops = &arizona_micsupp_ops, 213 - 214 212 .vsel_reg = MADERA_LDO2_CONTROL_1, 215 213 .vsel_mask = MADERA_LDO2_VSEL_MASK, 216 214 .enable_reg = MADERA_MIC_CHARGE_PUMP_1, ··· 262 262 INIT_WORK(&micsupp->check_cp_work, arizona_micsupp_check_cp); 263 263 264 264 micsupp->init_data.consumer_supplies = &micsupp->supply; 265 - micsupp->supply.supply = "MICVDD"; 266 265 micsupp->supply.dev_name = dev_name(micsupp->dev); 267 - micsupp->enable_reg = desc->enable_reg; 266 + micsupp->desc = desc; 268 267 269 268 config.dev = micsupp->dev; 270 269 config.driver_data = micsupp; ··· 284 285 config.init_data = &micsupp->init_data; 285 286 286 287 /* Default to regulated mode */ 287 - regmap_update_bits(micsupp->regmap, micsupp->enable_reg, 288 - ARIZONA_CPMIC_BYPASS, 0); 288 + regmap_update_bits(micsupp->regmap, desc->enable_reg, desc->bypass_mask, 0); 289 289 290 290 micsupp->regulator = devm_regulator_register(&pdev->dev, 291 291 desc, ··· 317 319 micsupp->regmap = arizona->regmap; 318 320 micsupp->dapm = &arizona->dapm; 319 321 micsupp->dev = arizona->dev; 322 + 323 + micsupp->supply.supply = "MICVDD"; 320 324 321 325 /* 322 326 * Since the chip usually supplies itself we provide some ··· 354 354 micsupp->dapm = &madera->dapm; 355 355 micsupp->dev = madera->dev; 356 356 micsupp->init_data = arizona_micsupp_ext_default; 357 + 358 + micsupp->supply.supply = "MICVDD"; 357 359 358 360 return arizona_micsupp_common_init(pdev, micsupp, &madera_micsupp, 359 361 &madera->pdata.micvdd);
+4 -6
drivers/regulator/bd71815-regulator.c
··· 602 602 config.ena_gpiod = NULL; 603 603 604 604 rdev = devm_regulator_register(&pdev->dev, desc, &config); 605 - if (IS_ERR(rdev)) { 606 - dev_err(&pdev->dev, 607 - "failed to register %s regulator\n", 608 - desc->name); 609 - return PTR_ERR(rdev); 610 - } 605 + if (IS_ERR(rdev)) 606 + return dev_err_probe(&pdev->dev, PTR_ERR(rdev), 607 + "failed to register %s regulator\n", 608 + desc->name); 611 609 } 612 610 return 0; 613 611 }
+9 -12
drivers/regulator/bd71828-regulator.c
··· 750 750 rd = &bd71828_rdata[i]; 751 751 rdev = devm_regulator_register(&pdev->dev, 752 752 &rd->desc, &config); 753 - if (IS_ERR(rdev)) { 754 - dev_err(&pdev->dev, 755 - "failed to register %s regulator\n", 756 - rd->desc.name); 757 - return PTR_ERR(rdev); 758 - } 753 + if (IS_ERR(rdev)) 754 + return dev_err_probe(&pdev->dev, PTR_ERR(rdev), 755 + "failed to register %s regulator\n", 756 + rd->desc.name); 757 + 759 758 for (j = 0; j < rd->reg_init_amnt; j++) { 760 759 ret = regmap_update_bits(config.regmap, 761 760 rd->reg_inits[j].reg, 762 761 rd->reg_inits[j].mask, 763 762 rd->reg_inits[j].val); 764 - if (ret) { 765 - dev_err(&pdev->dev, 766 - "regulator %s init failed\n", 767 - rd->desc.name); 768 - return ret; 769 - } 763 + if (ret) 764 + return dev_err_probe(&pdev->dev, ret, 765 + "regulator %s init failed\n", 766 + rd->desc.name); 770 767 } 771 768 } 772 769 return 0;
+19 -34
drivers/regulator/bd718x7-regulator.c
··· 1576 1576 if (!of_node_name_eq(np, desc->of_match)) 1577 1577 continue; 1578 1578 1579 - pr_info("Looking at node '%s'\n", desc->of_match); 1580 - 1581 1579 /* The feedback loop connection does not make sense for LDOs */ 1582 1580 if (desc->id >= BD718XX_LDO1) 1583 1581 return -EINVAL; ··· 1706 1708 break; 1707 1709 default: 1708 1710 dev_err(&pdev->dev, "Unsupported chip type\n"); 1709 - err = -EINVAL; 1710 - goto err; 1711 + return -EINVAL; 1711 1712 } 1712 1713 1713 1714 /* Register LOCK release */ 1714 1715 err = regmap_update_bits(regmap, BD718XX_REG_REGLOCK, 1715 1716 (REGLOCK_PWRSEQ | REGLOCK_VREG), 0); 1716 - if (err) { 1717 - dev_err(&pdev->dev, "Failed to unlock PMIC (%d)\n", err); 1718 - goto err; 1719 - } else { 1720 - dev_dbg(&pdev->dev, "Unlocked lock register 0x%x\n", 1721 - BD718XX_REG_REGLOCK); 1722 - } 1717 + if (err) 1718 + return dev_err_probe(&pdev->dev, err, "Failed to unlock PMIC\n"); 1719 + 1720 + dev_dbg(&pdev->dev, "Unlocked lock register 0x%x\n", 1721 + BD718XX_REG_REGLOCK); 1723 1722 1724 1723 use_snvs = of_property_read_bool(pdev->dev.parent->of_node, 1725 1724 "rohm,reset-snvs-powered"); ··· 1733 1738 BD718XX_WDOG_POWEROFF_MASK | 1734 1739 BD718XX_KEY_L_POWEROFF_MASK, 1735 1740 BD718XX_POWOFF_TO_RDY); 1736 - if (err) { 1737 - dev_err(&pdev->dev, "Failed to change reset target\n"); 1738 - goto err; 1739 - } else { 1740 - dev_dbg(&pdev->dev, 1741 - "Changed all resets from SVNS to READY\n"); 1742 - } 1741 + if (err) 1742 + return dev_err_probe(&pdev->dev, err, 1743 + "Failed to change reset target\n"); 1744 + 1745 + dev_dbg(&pdev->dev, "Changed all resets from SVNS to READY\n"); 1743 1746 } 1744 1747 1745 1748 config.dev = pdev->dev.parent; ··· 1773 1780 desc->ops = swops[i]; 1774 1781 1775 1782 rdev = devm_regulator_register(&pdev->dev, desc, &config); 1776 - if (IS_ERR(rdev)) { 1777 - dev_err(&pdev->dev, 1778 - "failed to register %s regulator\n", 1779 - desc->name); 1780 - err = PTR_ERR(rdev); 1781 - goto err; 1782 - } 1783 + if (IS_ERR(rdev)) 1784 + return dev_err_probe(&pdev->dev, PTR_ERR(rdev), 1785 + "failed to register %s regulator\n", 1786 + desc->name); 1783 1787 1784 1788 /* 1785 1789 * Regulator register gets the regulator constraints and ··· 1799 1809 !rdev->constraints->boot_on)) { 1800 1810 err = regmap_update_bits(regmap, r->init.reg, 1801 1811 r->init.mask, r->init.val); 1802 - if (err) { 1803 - dev_err(&pdev->dev, 1812 + if (err) 1813 + return dev_err_probe(&pdev->dev, err, 1804 1814 "Failed to take control for (%s)\n", 1805 1815 desc->name); 1806 - goto err; 1807 - } 1808 1816 } 1809 1817 for (j = 0; j < r->additional_init_amnt; j++) { 1810 1818 err = regmap_update_bits(regmap, 1811 1819 r->additional_inits[j].reg, 1812 1820 r->additional_inits[j].mask, 1813 1821 r->additional_inits[j].val); 1814 - if (err) { 1815 - dev_err(&pdev->dev, 1822 + if (err) 1823 + return dev_err_probe(&pdev->dev, err, 1816 1824 "Buck (%s) initialization failed\n", 1817 1825 desc->name); 1818 - goto err; 1819 - } 1820 1826 } 1821 1827 } 1822 1828 1823 - err: 1824 1829 return err; 1825 1830 } 1826 1831
+25 -29
drivers/regulator/bd9576-regulator.c
··· 953 953 dev_fwnode(pdev->dev.parent), 954 954 "rohm,vout1-en", GPIOD_OUT_LOW, 955 955 "vout1-en"); 956 - if (!IS_ERR(en)) { 957 - /* VOUT1_OPS gpio ctrl */ 958 - /* 959 - * Regulator core prioritizes the ena_gpio over 960 - * enable/disable/is_enabled callbacks so no need to 961 - * clear them. We can still use same ops 962 - */ 956 + 957 + /* VOUT1_OPS gpio ctrl */ 958 + /* 959 + * Regulator core prioritizes the ena_gpio over 960 + * enable/disable/is_enabled callbacks so no need to clear them 961 + * even if GPIO is used. So, we can still use same ops. 962 + * 963 + * In theory it is possible someone wants to set vout1-en LOW 964 + * during OTP loading and set VOUT1 to be controlled by GPIO - 965 + * but control the GPIO from some where else than this driver. 966 + * For that to work we should unset the is_enabled callback 967 + * here. 968 + * 969 + * I believe such case where rohm,vout1-en-low is set and 970 + * vout1-en-gpios is not is likely to be a misconfiguration. 971 + * So let's just err out for now. 972 + */ 973 + if (!IS_ERR(en)) 963 974 config.ena_gpiod = en; 964 - } else { 965 - /* 966 - * In theory it is possible someone wants to set 967 - * vout1-en LOW during OTP loading and set VOUT1 to be 968 - * controlled by GPIO - but control the GPIO from some 969 - * where else than this driver. For that to work we 970 - * should unset the is_enabled callback here. 971 - * 972 - * I believe such case where rohm,vout1-en-low is set 973 - * and vout1-en-gpios is not is likely to be a 974 - * misconfiguration. So let's just err out for now. 975 - */ 976 - dev_err(&pdev->dev, 977 - "Failed to get VOUT1 control GPIO\n"); 978 - return PTR_ERR(en); 979 - } 975 + else 976 + return dev_err_probe(&pdev->dev, PTR_ERR(en), 977 + "Failed to get VOUT1 control GPIO\n"); 980 978 } 981 979 982 980 /* ··· 1035 1037 1036 1038 r->rdev = devm_regulator_register(&pdev->dev, desc, 1037 1039 &config); 1038 - if (IS_ERR(r->rdev)) { 1039 - dev_err(&pdev->dev, 1040 - "failed to register %s regulator\n", 1041 - desc->name); 1042 - return PTR_ERR(r->rdev); 1043 - } 1040 + if (IS_ERR(r->rdev)) 1041 + return dev_err_probe(&pdev->dev, PTR_ERR(r->rdev), 1042 + "failed to register %s regulator\n", 1043 + desc->name); 1044 1044 /* 1045 1045 * Clear the VOUT1 GPIO setting - rest of the regulators do not 1046 1046 * support GPIO control
+39 -24
drivers/regulator/core.c
··· 1596 1596 if (rdev->supply_name && !rdev->supply) 1597 1597 return -EPROBE_DEFER; 1598 1598 1599 - if (rdev->supply) { 1599 + /* If supplying regulator has already been enabled, 1600 + * it's not intended to have use_count increment 1601 + * when rdev is only boot-on. 1602 + */ 1603 + if (rdev->supply && 1604 + (rdev->constraints->always_on || 1605 + !regulator_is_enabled(rdev->supply))) { 1600 1606 ret = regulator_enable(rdev->supply); 1601 1607 if (ret < 0) { 1602 1608 _regulator_put(rdev->supply); ··· 1646 1640 1647 1641 rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY"); 1648 1642 if (rdev->supply == NULL) { 1643 + module_put(supply_rdev->owner); 1649 1644 err = -ENOMEM; 1650 1645 return err; 1651 1646 } ··· 1820 1813 1821 1814 regulator = kzalloc(sizeof(*regulator), GFP_KERNEL); 1822 1815 if (regulator == NULL) { 1823 - kfree(supply_name); 1816 + kfree_const(supply_name); 1824 1817 return NULL; 1825 1818 } 1826 1819 ··· 1950 1943 node = of_get_regulator(dev, supply); 1951 1944 if (node) { 1952 1945 r = of_find_regulator_by_node(node); 1946 + of_node_put(node); 1953 1947 if (r) 1954 1948 return r; 1955 1949 ··· 4786 4778 return blocking_notifier_call_chain(&rdev->notifier, event, data); 4787 4779 } 4788 4780 4789 - /** 4790 - * regulator_bulk_get - get multiple regulator consumers 4791 - * 4792 - * @dev: Device to supply 4793 - * @num_consumers: Number of consumers to register 4794 - * @consumers: Configuration of consumers; clients are stored here. 4795 - * 4796 - * @return 0 on success, an errno on failure. 4797 - * 4798 - * This helper function allows drivers to get several regulator 4799 - * consumers in one operation. If any of the regulators cannot be 4800 - * acquired then any regulators that were allocated will be freed 4801 - * before returning to the caller. 4802 - */ 4803 - int regulator_bulk_get(struct device *dev, int num_consumers, 4804 - struct regulator_bulk_data *consumers) 4781 + int _regulator_bulk_get(struct device *dev, int num_consumers, 4782 + struct regulator_bulk_data *consumers, enum regulator_get_type get_type) 4805 4783 { 4806 4784 int i; 4807 4785 int ret; ··· 4796 4802 consumers[i].consumer = NULL; 4797 4803 4798 4804 for (i = 0; i < num_consumers; i++) { 4799 - consumers[i].consumer = regulator_get(dev, 4800 - consumers[i].supply); 4805 + consumers[i].consumer = _regulator_get(dev, 4806 + consumers[i].supply, get_type); 4801 4807 if (IS_ERR(consumers[i].consumer)) { 4802 4808 ret = dev_err_probe(dev, PTR_ERR(consumers[i].consumer), 4803 4809 "Failed to get supply '%s'", ··· 4823 4829 regulator_put(consumers[i].consumer); 4824 4830 4825 4831 return ret; 4832 + } 4833 + 4834 + /** 4835 + * regulator_bulk_get - get multiple regulator consumers 4836 + * 4837 + * @dev: Device to supply 4838 + * @num_consumers: Number of consumers to register 4839 + * @consumers: Configuration of consumers; clients are stored here. 4840 + * 4841 + * @return 0 on success, an errno on failure. 4842 + * 4843 + * This helper function allows drivers to get several regulator 4844 + * consumers in one operation. If any of the regulators cannot be 4845 + * acquired then any regulators that were allocated will be freed 4846 + * before returning to the caller. 4847 + */ 4848 + int regulator_bulk_get(struct device *dev, int num_consumers, 4849 + struct regulator_bulk_data *consumers) 4850 + { 4851 + return _regulator_bulk_get(dev, num_consumers, consumers, NORMAL_GET); 4826 4852 } 4827 4853 EXPORT_SYMBOL_GPL(regulator_bulk_get); 4828 4854 ··· 5410 5396 5411 5397 /** 5412 5398 * regulator_register - register regulator 5399 + * @dev: the device that drive the regulator 5413 5400 * @regulator_desc: regulator to register 5414 5401 * @cfg: runtime configuration for regulator 5415 5402 * ··· 5419 5404 * or an ERR_PTR() on error. 5420 5405 */ 5421 5406 struct regulator_dev * 5422 - regulator_register(const struct regulator_desc *regulator_desc, 5407 + regulator_register(struct device *dev, 5408 + const struct regulator_desc *regulator_desc, 5423 5409 const struct regulator_config *cfg) 5424 5410 { 5425 5411 const struct regulator_init_data *init_data; ··· 5429 5413 struct regulator_dev *rdev; 5430 5414 bool dangling_cfg_gpiod = false; 5431 5415 bool dangling_of_gpiod = false; 5432 - struct device *dev; 5433 5416 int ret, i; 5434 5417 bool resolved_early = false; 5435 5418 ··· 5441 5426 goto rinse; 5442 5427 } 5443 5428 5444 - dev = cfg->dev; 5445 - WARN_ON(!dev); 5429 + WARN_ON(!dev || !cfg->dev); 5446 5430 5447 5431 if (regulator_desc->name == NULL || regulator_desc->ops == NULL) { 5448 5432 ret = -EINVAL; ··· 5655 5641 regulator_remove_coupling(rdev); 5656 5642 mutex_unlock(&regulator_list_mutex); 5657 5643 wash: 5644 + regulator_put(rdev->supply); 5658 5645 kfree(rdev->coupling_desc.coupled_rdevs); 5659 5646 mutex_lock(&regulator_list_mutex); 5660 5647 regulator_ena_gpio_free(rdev);
+2 -3
drivers/regulator/da9121-regulator.c
··· 1128 1128 return (uintptr_t)id->data; 1129 1129 } 1130 1130 1131 - static int da9121_i2c_probe(struct i2c_client *i2c, 1132 - const struct i2c_device_id *id) 1131 + static int da9121_i2c_probe(struct i2c_client *i2c) 1133 1132 { 1134 1133 struct da9121 *chip; 1135 1134 const int mask_all[4] = { 0xFF, 0xFF, 0xFF, 0xFF }; ··· 1196 1197 .name = "da9121", 1197 1198 .of_match_table = of_match_ptr(da9121_dt_ids), 1198 1199 }, 1199 - .probe = da9121_i2c_probe, 1200 + .probe_new = da9121_i2c_probe, 1200 1201 .remove = da9121_i2c_remove, 1201 1202 .id_table = da9121_i2c_id, 1202 1203 };
+49 -19
drivers/regulator/devres.c
··· 186 186 regulator_bulk_free(devres->num_consumers, devres->consumers); 187 187 } 188 188 189 + static int _devm_regulator_bulk_get(struct device *dev, int num_consumers, 190 + struct regulator_bulk_data *consumers, 191 + enum regulator_get_type get_type) 192 + { 193 + struct regulator_bulk_devres *devres; 194 + int ret; 195 + 196 + devres = devres_alloc(devm_regulator_bulk_release, 197 + sizeof(*devres), GFP_KERNEL); 198 + if (!devres) 199 + return -ENOMEM; 200 + 201 + ret = _regulator_bulk_get(dev, num_consumers, consumers, get_type); 202 + if (!ret) { 203 + devres->consumers = consumers; 204 + devres->num_consumers = num_consumers; 205 + devres_add(dev, devres); 206 + } else { 207 + devres_free(devres); 208 + } 209 + 210 + return ret; 211 + } 212 + 189 213 /** 190 214 * devm_regulator_bulk_get - managed get multiple regulator consumers 191 215 * ··· 228 204 int devm_regulator_bulk_get(struct device *dev, int num_consumers, 229 205 struct regulator_bulk_data *consumers) 230 206 { 231 - struct regulator_bulk_devres *devres; 232 - int ret; 233 - 234 - devres = devres_alloc(devm_regulator_bulk_release, 235 - sizeof(*devres), GFP_KERNEL); 236 - if (!devres) 237 - return -ENOMEM; 238 - 239 - ret = regulator_bulk_get(dev, num_consumers, consumers); 240 - if (!ret) { 241 - devres->consumers = consumers; 242 - devres->num_consumers = num_consumers; 243 - devres_add(dev, devres); 244 - } else { 245 - devres_free(devres); 246 - } 247 - 248 - return ret; 207 + return _devm_regulator_bulk_get(dev, num_consumers, consumers, NORMAL_GET); 249 208 } 250 209 EXPORT_SYMBOL_GPL(devm_regulator_bulk_get); 210 + 211 + /** 212 + * devm_regulator_bulk_get_exclusive - managed exclusive get of multiple 213 + * regulator consumers 214 + * 215 + * @dev: device to supply 216 + * @num_consumers: number of consumers to register 217 + * @consumers: configuration of consumers; clients are stored here. 218 + * 219 + * @return 0 on success, an errno on failure. 220 + * 221 + * This helper function allows drivers to exclusively get several 222 + * regulator consumers in one operation with management, the regulators 223 + * will automatically be freed when the device is unbound. If any of 224 + * the regulators cannot be acquired then any regulators that were 225 + * allocated will be freed before returning to the caller. 226 + */ 227 + int devm_regulator_bulk_get_exclusive(struct device *dev, int num_consumers, 228 + struct regulator_bulk_data *consumers) 229 + { 230 + return _devm_regulator_bulk_get(dev, num_consumers, consumers, EXCLUSIVE_GET); 231 + } 232 + EXPORT_SYMBOL_GPL(devm_regulator_bulk_get_exclusive); 251 233 252 234 /** 253 235 * devm_regulator_bulk_get_const - devm_regulator_bulk_get() w/ const data ··· 415 385 if (!ptr) 416 386 return ERR_PTR(-ENOMEM); 417 387 418 - rdev = regulator_register(regulator_desc, config); 388 + rdev = regulator_register(dev, regulator_desc, config); 419 389 if (!IS_ERR(rdev)) { 420 390 *ptr = rdev; 421 391 devres_add(dev, ptr);
+3 -3
drivers/regulator/fan53555.c
··· 549 549 }; 550 550 MODULE_DEVICE_TABLE(of, fan53555_dt_ids); 551 551 552 - static int fan53555_regulator_probe(struct i2c_client *client, 553 - const struct i2c_device_id *id) 552 + static int fan53555_regulator_probe(struct i2c_client *client) 554 553 { 554 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 555 555 struct device_node *np = client->dev.of_node; 556 556 struct fan53555_device_info *di; 557 557 struct fan53555_platform_data *pdata; ··· 665 665 .name = "fan53555-regulator", 666 666 .of_match_table = of_match_ptr(fan53555_dt_ids), 667 667 }, 668 - .probe = fan53555_regulator_probe, 668 + .probe_new = fan53555_regulator_probe, 669 669 .id_table = fan53555_id, 670 670 }; 671 671
+7 -9
drivers/regulator/fan53880.c
··· 42 42 #define FAN53880_LDO(_num, _supply, _default) \ 43 43 [FAN53880_LDO ## _num] = { \ 44 44 .name = "LDO"#_num, \ 45 - .of_match = of_match_ptr("LDO"#_num), \ 46 - .regulators_node = of_match_ptr("regulators"), \ 45 + .of_match = "LDO"#_num, \ 46 + .regulators_node = "regulators", \ 47 47 .type = REGULATOR_VOLTAGE, \ 48 48 .owner = THIS_MODULE, \ 49 49 .linear_ranges = (struct linear_range[]) { \ ··· 68 68 FAN53880_LDO(4, "VIN4", 1800000), 69 69 [FAN53880_BUCK] = { 70 70 .name = "BUCK", 71 - .of_match = of_match_ptr("BUCK"), 72 - .regulators_node = of_match_ptr("regulators"), 71 + .of_match = "BUCK", 72 + .regulators_node = "regulators", 73 73 .type = REGULATOR_VOLTAGE, 74 74 .owner = THIS_MODULE, 75 75 .linear_ranges = (struct linear_range[]) { ··· 88 88 }, 89 89 [FAN53880_BOOST] = { 90 90 .name = "BOOST", 91 - .of_match = of_match_ptr("BOOST"), 92 - .regulators_node = of_match_ptr("regulators"), 91 + .of_match = "BOOST", 92 + .regulators_node = "regulators", 93 93 .type = REGULATOR_VOLTAGE, 94 94 .owner = THIS_MODULE, 95 95 .linear_ranges = (struct linear_range[]) { ··· 157 157 return 0; 158 158 } 159 159 160 - #ifdef CONFIG_OF 161 160 static const struct of_device_id fan53880_dt_ids[] = { 162 161 { .compatible = "onnn,fan53880", }, 163 162 {} 164 163 }; 165 164 MODULE_DEVICE_TABLE(of, fan53880_dt_ids); 166 - #endif 167 165 168 166 static const struct i2c_device_id fan53880_i2c_id[] = { 169 167 { "fan53880", }, ··· 172 174 static struct i2c_driver fan53880_regulator_driver = { 173 175 .driver = { 174 176 .name = "fan53880", 175 - .of_match_table = of_match_ptr(fan53880_dt_ids), 177 + .of_match_table = fan53880_dt_ids, 176 178 }, 177 179 .probe_new = fan53880_i2c_probe, 178 180 .id_table = fan53880_i2c_id,
+2
drivers/regulator/internal.h
··· 122 122 123 123 struct regulator *_regulator_get(struct device *dev, const char *id, 124 124 enum regulator_get_type get_type); 125 + int _regulator_bulk_get(struct device *dev, int num_consumers, 126 + struct regulator_bulk_data *consumers, enum regulator_get_type get_type); 125 127 #endif
+3 -3
drivers/regulator/isl6271a-regulator.c
··· 97 97 }, 98 98 }; 99 99 100 - static int isl6271a_probe(struct i2c_client *i2c, 101 - const struct i2c_device_id *id) 100 + static int isl6271a_probe(struct i2c_client *i2c) 102 101 { 102 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 103 103 struct regulator_dev *rdev; 104 104 struct regulator_config config = { }; 105 105 struct regulator_init_data *init_data = dev_get_platdata(&i2c->dev); ··· 148 148 .driver = { 149 149 .name = "isl6271a", 150 150 }, 151 - .probe = isl6271a_probe, 151 + .probe_new = isl6271a_probe, 152 152 .id_table = isl6271a_id, 153 153 }; 154 154
+2 -3
drivers/regulator/lp3972.c
··· 495 495 return 0; 496 496 } 497 497 498 - static int lp3972_i2c_probe(struct i2c_client *i2c, 499 - const struct i2c_device_id *id) 498 + static int lp3972_i2c_probe(struct i2c_client *i2c) 500 499 { 501 500 struct lp3972 *lp3972; 502 501 struct lp3972_platform_data *pdata = dev_get_platdata(&i2c->dev); ··· 546 547 .driver = { 547 548 .name = "lp3972", 548 549 }, 549 - .probe = lp3972_i2c_probe, 550 + .probe_new = lp3972_i2c_probe, 550 551 .id_table = lp3972_i2c_id, 551 552 }; 552 553
+3 -2
drivers/regulator/lp872x.c
··· 879 879 } 880 880 #endif 881 881 882 - static int lp872x_probe(struct i2c_client *cl, const struct i2c_device_id *id) 882 + static int lp872x_probe(struct i2c_client *cl) 883 883 { 884 + const struct i2c_device_id *id = i2c_client_get_device_id(cl); 884 885 struct lp872x *lp; 885 886 struct lp872x_platform_data *pdata; 886 887 int ret; ··· 947 946 .name = "lp872x", 948 947 .of_match_table = of_match_ptr(lp872x_dt_ids), 949 948 }, 950 - .probe = lp872x_probe, 949 + .probe_new = lp872x_probe, 951 950 .id_table = lp872x_ids, 952 951 }; 953 952
+2 -3
drivers/regulator/lp8755.c
··· 357 357 .max_register = LP8755_REG_MAX, 358 358 }; 359 359 360 - static int lp8755_probe(struct i2c_client *client, 361 - const struct i2c_device_id *id) 360 + static int lp8755_probe(struct i2c_client *client) 362 361 { 363 362 int ret, icnt; 364 363 struct lp8755_chip *pchip; ··· 441 442 .driver = { 442 443 .name = LP8755_NAME, 443 444 }, 444 - .probe = lp8755_probe, 445 + .probe_new = lp8755_probe, 445 446 .remove = lp8755_remove, 446 447 .id_table = lp8755_id, 447 448 };
+3 -3
drivers/regulator/ltc3589.c
··· 378 378 return IRQ_HANDLED; 379 379 } 380 380 381 - static int ltc3589_probe(struct i2c_client *client, 382 - const struct i2c_device_id *id) 381 + static int ltc3589_probe(struct i2c_client *client) 383 382 { 383 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 384 384 struct device *dev = &client->dev; 385 385 struct regulator_desc *descs; 386 386 struct ltc3589 *ltc3589; ··· 476 476 .name = DRIVER_NAME, 477 477 .of_match_table = of_match_ptr(ltc3589_of_match), 478 478 }, 479 - .probe = ltc3589_probe, 479 + .probe_new = ltc3589_probe, 480 480 .id_table = ltc3589_i2c_id, 481 481 }; 482 482 module_i2c_driver(ltc3589_driver);
+2 -3
drivers/regulator/max1586.c
··· 207 207 }; 208 208 MODULE_DEVICE_TABLE(of, max1586_of_match); 209 209 210 - static int max1586_pmic_probe(struct i2c_client *client, 211 - const struct i2c_device_id *i2c_id) 210 + static int max1586_pmic_probe(struct i2c_client *client) 212 211 { 213 212 struct max1586_platform_data *pdata, pdata_of; 214 213 struct regulator_config config = { }; ··· 289 290 MODULE_DEVICE_TABLE(i2c, max1586_id); 290 291 291 292 static struct i2c_driver max1586_pmic_driver = { 292 - .probe = max1586_pmic_probe, 293 + .probe_new = max1586_pmic_probe, 293 294 .driver = { 294 295 .name = "max1586", 295 296 .of_match_table = of_match_ptr(max1586_of_match),
+2 -3
drivers/regulator/max8649.c
··· 145 145 .val_bits = 8, 146 146 }; 147 147 148 - static int max8649_regulator_probe(struct i2c_client *client, 149 - const struct i2c_device_id *id) 148 + static int max8649_regulator_probe(struct i2c_client *client) 150 149 { 151 150 struct max8649_platform_data *pdata = dev_get_platdata(&client->dev); 152 151 struct max8649_regulator_info *info = NULL; ··· 246 247 MODULE_DEVICE_TABLE(i2c, max8649_id); 247 248 248 249 static struct i2c_driver max8649_driver = { 249 - .probe = max8649_regulator_probe, 250 + .probe_new = max8649_regulator_probe, 250 251 .driver = { 251 252 .name = "max8649", 252 253 },
+3 -3
drivers/regulator/max8660.c
··· 367 367 } 368 368 #endif 369 369 370 - static int max8660_probe(struct i2c_client *client, 371 - const struct i2c_device_id *i2c_id) 370 + static int max8660_probe(struct i2c_client *client) 372 371 { 372 + const struct i2c_device_id *i2c_id = i2c_client_get_device_id(client); 373 373 struct device *dev = &client->dev; 374 374 struct max8660_platform_data pdata_of, *pdata = dev_get_platdata(dev); 375 375 struct regulator_config config = { }; ··· 503 503 MODULE_DEVICE_TABLE(i2c, max8660_id); 504 504 505 505 static struct i2c_driver max8660_driver = { 506 - .probe = max8660_probe, 506 + .probe_new = max8660_probe, 507 507 .driver = { 508 508 .name = "max8660", 509 509 },
+2 -3
drivers/regulator/max8952.c
··· 171 171 } 172 172 #endif 173 173 174 - static int max8952_pmic_probe(struct i2c_client *client, 175 - const struct i2c_device_id *i2c_id) 174 + static int max8952_pmic_probe(struct i2c_client *client) 176 175 { 177 176 struct i2c_adapter *adapter = client->adapter; 178 177 struct max8952_platform_data *pdata = dev_get_platdata(&client->dev); ··· 313 314 MODULE_DEVICE_TABLE(i2c, max8952_ids); 314 315 315 316 static struct i2c_driver max8952_pmic_driver = { 316 - .probe = max8952_pmic_probe, 317 + .probe_new = max8952_pmic_probe, 317 318 .driver = { 318 319 .name = "max8952", 319 320 .of_match_table = of_match_ptr(max8952_dt_match),
+3 -3
drivers/regulator/max8973-regulator.c
··· 586 586 }; 587 587 MODULE_DEVICE_TABLE(of, of_max8973_match_tbl); 588 588 589 - static int max8973_probe(struct i2c_client *client, 590 - const struct i2c_device_id *id) 589 + static int max8973_probe(struct i2c_client *client) 591 590 { 591 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 592 592 struct max8973_regulator_platform_data *pdata; 593 593 struct regulator_init_data *ridata; 594 594 struct regulator_config config = { }; ··· 806 806 .name = "max8973", 807 807 .of_match_table = of_max8973_match_tbl, 808 808 }, 809 - .probe = max8973_probe, 809 + .probe_new = max8973_probe, 810 810 .id_table = max8973_id, 811 811 }; 812 812
+1 -1
drivers/regulator/mp886x.c
··· 362 362 static struct i2c_driver mp886x_regulator_driver = { 363 363 .driver = { 364 364 .name = "mp886x-regulator", 365 - .of_match_table = of_match_ptr(mp886x_dt_ids), 365 + .of_match_table = mp886x_dt_ids, 366 366 }, 367 367 .probe_new = mp886x_i2c_probe, 368 368 .id_table = mp886x_id,
+453
drivers/regulator/mt6357-regulator.c
··· 1 + // SPDX-License-Identifier: GPL-2.0 2 + // 3 + // Copyright (c) 2022 MediaTek Inc. 4 + // Copyright (c) 2022 BayLibre, SAS. 5 + // Author: Chen Zhong <chen.zhong@mediatek.com> 6 + // Author: Fabien Parent <fparent@baylibre.com> 7 + // Author: Alexandre Mergnat <amergnat@baylibre.com> 8 + // 9 + // Based on mt6397-regulator.c 10 + // 11 + 12 + #include <linux/module.h> 13 + #include <linux/of.h> 14 + #include <linux/platform_device.h> 15 + #include <linux/regmap.h> 16 + #include <linux/mfd/mt6397/core.h> 17 + #include <linux/mfd/mt6357/registers.h> 18 + #include <linux/regulator/driver.h> 19 + #include <linux/regulator/machine.h> 20 + #include <linux/regulator/mt6357-regulator.h> 21 + #include <linux/regulator/of_regulator.h> 22 + 23 + /* 24 + * MT6357 regulators' information 25 + * 26 + * @desc: standard fields of regulator description. 27 + * @da_vsel_reg: Monitor register for query buck's voltage. 28 + * @da_vsel_mask: Mask for query buck's voltage. 29 + */ 30 + struct mt6357_regulator_info { 31 + struct regulator_desc desc; 32 + u32 da_vsel_reg; 33 + u32 da_vsel_mask; 34 + }; 35 + 36 + #define MT6357_BUCK(match, vreg, min, max, step, \ 37 + volt_ranges, vosel_reg, vosel_mask, _da_vsel_mask) \ 38 + [MT6357_ID_##vreg] = { \ 39 + .desc = { \ 40 + .name = #vreg, \ 41 + .of_match = of_match_ptr(match), \ 42 + .regulators_node = "regulators", \ 43 + .ops = &mt6357_volt_range_ops, \ 44 + .type = REGULATOR_VOLTAGE, \ 45 + .id = MT6357_ID_##vreg, \ 46 + .owner = THIS_MODULE, \ 47 + .n_voltages = ((max) - (min)) / (step) + 1, \ 48 + .linear_ranges = volt_ranges, \ 49 + .n_linear_ranges = ARRAY_SIZE(volt_ranges), \ 50 + .vsel_reg = vosel_reg, \ 51 + .vsel_mask = vosel_mask, \ 52 + .enable_reg = MT6357_BUCK_##vreg##_CON0, \ 53 + .enable_mask = BIT(0), \ 54 + }, \ 55 + .da_vsel_reg = MT6357_BUCK_##vreg##_DBG0, \ 56 + .da_vsel_mask = vosel_mask, \ 57 + } 58 + 59 + #define MT6357_LDO(match, vreg, ldo_volt_table, \ 60 + enreg, vosel, vosel_mask) \ 61 + [MT6357_ID_##vreg] = { \ 62 + .desc = { \ 63 + .name = #vreg, \ 64 + .of_match = of_match_ptr(match), \ 65 + .regulators_node = "regulators", \ 66 + .ops = &mt6357_volt_table_ops, \ 67 + .type = REGULATOR_VOLTAGE, \ 68 + .id = MT6357_ID_##vreg, \ 69 + .owner = THIS_MODULE, \ 70 + .n_voltages = ARRAY_SIZE(ldo_volt_table), \ 71 + .volt_table = ldo_volt_table, \ 72 + .vsel_reg = vosel, \ 73 + .vsel_mask = vosel_mask, \ 74 + .enable_reg = enreg, \ 75 + .enable_mask = BIT(0), \ 76 + }, \ 77 + } 78 + 79 + #define MT6357_LDO1(match, vreg, min, max, step, volt_ranges, \ 80 + enreg, vosel, vosel_mask) \ 81 + [MT6357_ID_##vreg] = { \ 82 + .desc = { \ 83 + .name = #vreg, \ 84 + .of_match = of_match_ptr(match), \ 85 + .regulators_node = "regulators", \ 86 + .ops = &mt6357_volt_range_ops, \ 87 + .type = REGULATOR_VOLTAGE, \ 88 + .id = MT6357_ID_##vreg, \ 89 + .owner = THIS_MODULE, \ 90 + .n_voltages = ((max) - (min)) / (step) + 1, \ 91 + .linear_ranges = volt_ranges, \ 92 + .n_linear_ranges = ARRAY_SIZE(volt_ranges), \ 93 + .vsel_reg = vosel, \ 94 + .vsel_mask = vosel_mask, \ 95 + .enable_reg = enreg, \ 96 + .enable_mask = BIT(0), \ 97 + }, \ 98 + .da_vsel_reg = MT6357_LDO_##vreg##_DBG0, \ 99 + .da_vsel_mask = 0x7f00, \ 100 + } 101 + 102 + #define MT6357_REG_FIXED(match, vreg, volt) \ 103 + [MT6357_ID_##vreg] = { \ 104 + .desc = { \ 105 + .name = #vreg, \ 106 + .of_match = of_match_ptr(match), \ 107 + .regulators_node = "regulators", \ 108 + .ops = &mt6357_volt_fixed_ops, \ 109 + .type = REGULATOR_VOLTAGE, \ 110 + .id = MT6357_ID_##vreg, \ 111 + .owner = THIS_MODULE, \ 112 + .n_voltages = 1, \ 113 + .enable_reg = MT6357_LDO_##vreg##_CON0, \ 114 + .enable_mask = BIT(0), \ 115 + .min_uV = volt, \ 116 + }, \ 117 + } 118 + 119 + /** 120 + * mt6357_get_buck_voltage_sel - get_voltage_sel for regmap users 121 + * 122 + * @rdev: regulator to operate on 123 + * 124 + * Regulators that use regmap for their register I/O can set the 125 + * da_vsel_reg and da_vsel_mask fields in the info structure and 126 + * then use this as their get_voltage_vsel operation. 127 + */ 128 + static int mt6357_get_buck_voltage_sel(struct regulator_dev *rdev) 129 + { 130 + int ret, regval; 131 + struct mt6357_regulator_info *info = rdev_get_drvdata(rdev); 132 + 133 + ret = regmap_read(rdev->regmap, info->da_vsel_reg, &regval); 134 + if (ret != 0) { 135 + dev_err(&rdev->dev, 136 + "Failed to get mt6357 Buck %s vsel reg: %d\n", 137 + info->desc.name, ret); 138 + return ret; 139 + } 140 + 141 + regval &= info->da_vsel_mask; 142 + regval >>= ffs(info->da_vsel_mask) - 1; 143 + 144 + return regval; 145 + } 146 + 147 + static const struct regulator_ops mt6357_volt_range_ops = { 148 + .list_voltage = regulator_list_voltage_linear_range, 149 + .map_voltage = regulator_map_voltage_linear_range, 150 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 151 + .get_voltage_sel = mt6357_get_buck_voltage_sel, 152 + .set_voltage_time_sel = regulator_set_voltage_time_sel, 153 + .enable = regulator_enable_regmap, 154 + .disable = regulator_disable_regmap, 155 + .is_enabled = regulator_is_enabled_regmap, 156 + }; 157 + 158 + static const struct regulator_ops mt6357_volt_table_ops = { 159 + .list_voltage = regulator_list_voltage_table, 160 + .map_voltage = regulator_map_voltage_iterate, 161 + .set_voltage_sel = regulator_set_voltage_sel_regmap, 162 + .get_voltage_sel = regulator_get_voltage_sel_regmap, 163 + .set_voltage_time_sel = regulator_set_voltage_time_sel, 164 + .enable = regulator_enable_regmap, 165 + .disable = regulator_disable_regmap, 166 + .is_enabled = regulator_is_enabled_regmap, 167 + }; 168 + 169 + static const struct regulator_ops mt6357_volt_fixed_ops = { 170 + .list_voltage = regulator_list_voltage_linear, 171 + .enable = regulator_enable_regmap, 172 + .disable = regulator_disable_regmap, 173 + .is_enabled = regulator_is_enabled_regmap, 174 + }; 175 + 176 + static const int vxo22_voltages[] = { 177 + 2200000, 178 + 0, 179 + 2400000, 180 + }; 181 + 182 + static const int vefuse_voltages[] = { 183 + 1200000, 184 + 1300000, 185 + 1500000, 186 + 0, 187 + 1800000, 188 + 0, 189 + 0, 190 + 0, 191 + 0, 192 + 2800000, 193 + 2900000, 194 + 3000000, 195 + 0, 196 + 3300000, 197 + }; 198 + 199 + static const int vcn33_voltages[] = { 200 + 0, 201 + 3300000, 202 + 3400000, 203 + 3500000, 204 + }; 205 + 206 + static const int vcama_voltages[] = { 207 + 0, 208 + 0, 209 + 0, 210 + 0, 211 + 0, 212 + 0, 213 + 0, 214 + 2500000, 215 + 0, 216 + 0, 217 + 2800000, 218 + }; 219 + 220 + static const int vcamd_voltages[] = { 221 + 0, 222 + 0, 223 + 0, 224 + 0, 225 + 1000000, 226 + 1100000, 227 + 1200000, 228 + 1300000, 229 + 0, 230 + 1500000, 231 + 0, 232 + 0, 233 + 1800000, 234 + }; 235 + 236 + static const int vldo28_voltages[] = { 237 + 0, 238 + 2800000, 239 + 0, 240 + 3000000, 241 + }; 242 + 243 + static const int vdram_voltages[] = { 244 + 0, 245 + 1100000, 246 + 1200000, 247 + }; 248 + 249 + static const int vsim_voltages[] = { 250 + 0, 251 + 0, 252 + 0, 253 + 1700000, 254 + 1800000, 255 + 0, 256 + 0, 257 + 0, 258 + 2700000, 259 + 0, 260 + 0, 261 + 3000000, 262 + 3100000, 263 + }; 264 + 265 + static const int vibr_voltages[] = { 266 + 1200000, 267 + 1300000, 268 + 1500000, 269 + 0, 270 + 1800000, 271 + 2000000, 272 + 0, 273 + 0, 274 + 0, 275 + 2800000, 276 + 0, 277 + 3000000, 278 + 0, 279 + 3300000, 280 + }; 281 + 282 + static const int vmc_voltages[] = { 283 + 0, 284 + 0, 285 + 0, 286 + 0, 287 + 1800000, 288 + 0, 289 + 0, 290 + 0, 291 + 0, 292 + 0, 293 + 2900000, 294 + 3000000, 295 + 0, 296 + 3300000, 297 + }; 298 + 299 + static const int vmch_voltages[] = { 300 + 0, 301 + 0, 302 + 2900000, 303 + 3000000, 304 + 0, 305 + 3300000, 306 + }; 307 + 308 + static const int vemc_voltages[] = { 309 + 0, 310 + 0, 311 + 2900000, 312 + 3000000, 313 + 0, 314 + 3300000, 315 + }; 316 + 317 + static const int vusb_voltages[] = { 318 + 0, 319 + 0, 320 + 0, 321 + 3000000, 322 + 3100000, 323 + }; 324 + 325 + static const struct linear_range buck_volt_range1[] = { 326 + REGULATOR_LINEAR_RANGE(518750, 0, 0x7f, 6250), 327 + }; 328 + 329 + static const struct linear_range buck_volt_range2[] = { 330 + REGULATOR_LINEAR_RANGE(500000, 0, 0x7f, 6250), 331 + }; 332 + 333 + static const struct linear_range buck_volt_range3[] = { 334 + REGULATOR_LINEAR_RANGE(500000, 0, 0x3f, 50000), 335 + }; 336 + 337 + static const struct linear_range buck_volt_range4[] = { 338 + REGULATOR_LINEAR_RANGE(1200000, 0, 0x7f, 12500), 339 + }; 340 + 341 + /* The array is indexed by id(MT6357_ID_XXX) */ 342 + static struct mt6357_regulator_info mt6357_regulators[] = { 343 + /* Bucks */ 344 + MT6357_BUCK("buck-vcore", VCORE, 518750, 1312500, 6250, 345 + buck_volt_range1, MT6357_BUCK_VCORE_ELR0, 0x7f, 0x7f), 346 + MT6357_BUCK("buck-vproc", VPROC, 518750, 1312500, 6250, 347 + buck_volt_range1, MT6357_BUCK_VPROC_ELR0, 0x7f, 0x7f), 348 + MT6357_BUCK("buck-vmodem", VMODEM, 500000, 1293750, 6250, 349 + buck_volt_range2, MT6357_BUCK_VMODEM_ELR0, 0x7f, 0x7f), 350 + MT6357_BUCK("buck-vpa", VPA, 500000, 3650000, 50000, 351 + buck_volt_range3, MT6357_BUCK_VPA_CON1, 0x3f, 0x3f), 352 + MT6357_BUCK("buck-vs1", VS1, 1200000, 2787500, 12500, 353 + buck_volt_range4, MT6357_BUCK_VS1_ELR0, 0x7f, 0x7f), 354 + 355 + /* LDOs */ 356 + MT6357_LDO("ldo-vcama", VCAMA, vcama_voltages, 357 + MT6357_LDO_VCAMA_CON0, MT6357_VCAMA_ANA_CON0, 0xf00), 358 + MT6357_LDO("ldo-vcamd", VCAMD, vcamd_voltages, 359 + MT6357_LDO_VCAMD_CON0, MT6357_VCAMD_ANA_CON0, 0xf00), 360 + MT6357_LDO("ldo-vcn33-bt", VCN33_BT, vcn33_voltages, 361 + MT6357_LDO_VCN33_CON0_0, MT6357_VCN33_ANA_CON0, 0x300), 362 + MT6357_LDO("ldo-vcn33-wifi", VCN33_WIFI, vcn33_voltages, 363 + MT6357_LDO_VCN33_CON0_1, MT6357_VCN33_ANA_CON0, 0x300), 364 + MT6357_LDO("ldo-vdram", VDRAM, vdram_voltages, 365 + MT6357_LDO_VDRAM_CON0, MT6357_VDRAM_ELR_2, 0x300), 366 + MT6357_LDO("ldo-vefuse", VEFUSE, vefuse_voltages, 367 + MT6357_LDO_VEFUSE_CON0, MT6357_VEFUSE_ANA_CON0, 0xf00), 368 + MT6357_LDO("ldo-vemc", VEMC, vemc_voltages, 369 + MT6357_LDO_VEMC_CON0, MT6357_VEMC_ANA_CON0, 0x700), 370 + MT6357_LDO("ldo-vibr", VIBR, vibr_voltages, 371 + MT6357_LDO_VIBR_CON0, MT6357_VIBR_ANA_CON0, 0xf00), 372 + MT6357_LDO("ldo-vldo28", VLDO28, vldo28_voltages, 373 + MT6357_LDO_VLDO28_CON0_0, MT6357_VLDO28_ANA_CON0, 0x300), 374 + MT6357_LDO("ldo-vmc", VMC, vmc_voltages, 375 + MT6357_LDO_VMC_CON0, MT6357_VMC_ANA_CON0, 0xf00), 376 + MT6357_LDO("ldo-vmch", VMCH, vmch_voltages, 377 + MT6357_LDO_VMCH_CON0, MT6357_VMCH_ANA_CON0, 0x700), 378 + MT6357_LDO("ldo-vsim1", VSIM1, vsim_voltages, 379 + MT6357_LDO_VSIM1_CON0, MT6357_VSIM1_ANA_CON0, 0xf00), 380 + MT6357_LDO("ldo-vsim2", VSIM2, vsim_voltages, 381 + MT6357_LDO_VSIM2_CON0, MT6357_VSIM2_ANA_CON0, 0xf00), 382 + MT6357_LDO("ldo-vusb33", VUSB33, vusb_voltages, 383 + MT6357_LDO_VUSB33_CON0_0, MT6357_VUSB33_ANA_CON0, 0x700), 384 + MT6357_LDO("ldo-vxo22", VXO22, vxo22_voltages, 385 + MT6357_LDO_VXO22_CON0, MT6357_VXO22_ANA_CON0, 0x300), 386 + 387 + MT6357_LDO1("ldo-vsram-proc", VSRAM_PROC, 518750, 1312500, 6250, 388 + buck_volt_range1, MT6357_LDO_VSRAM_PROC_CON0, 389 + MT6357_LDO_VSRAM_CON0, 0x7f00), 390 + MT6357_LDO1("ldo-vsram-others", VSRAM_OTHERS, 518750, 1312500, 6250, 391 + buck_volt_range1, MT6357_LDO_VSRAM_OTHERS_CON0, 392 + MT6357_LDO_VSRAM_CON1, 0x7f00), 393 + 394 + MT6357_REG_FIXED("ldo-vaud28", VAUD28, 2800000), 395 + MT6357_REG_FIXED("ldo-vaux18", VAUX18, 1800000), 396 + MT6357_REG_FIXED("ldo-vcamio18", VCAMIO, 1800000), 397 + MT6357_REG_FIXED("ldo-vcn18", VCN18, 1800000), 398 + MT6357_REG_FIXED("ldo-vcn28", VCN28, 2800000), 399 + MT6357_REG_FIXED("ldo-vfe28", VFE28, 2800000), 400 + MT6357_REG_FIXED("ldo-vio18", VIO18, 1800000), 401 + MT6357_REG_FIXED("ldo-vio28", VIO28, 2800000), 402 + MT6357_REG_FIXED("ldo-vrf12", VRF12, 1200000), 403 + MT6357_REG_FIXED("ldo-vrf18", VRF18, 1800000), 404 + }; 405 + 406 + static int mt6357_regulator_probe(struct platform_device *pdev) 407 + { 408 + struct mt6397_chip *mt6357 = dev_get_drvdata(pdev->dev.parent); 409 + struct regulator_config config = {}; 410 + struct regulator_dev *rdev; 411 + int i; 412 + 413 + pdev->dev.of_node = pdev->dev.parent->of_node; 414 + 415 + for (i = 0; i < MT6357_MAX_REGULATOR; i++) { 416 + config.dev = &pdev->dev; 417 + config.driver_data = &mt6357_regulators[i]; 418 + config.regmap = mt6357->regmap; 419 + 420 + rdev = devm_regulator_register(&pdev->dev, 421 + &mt6357_regulators[i].desc, 422 + &config); 423 + if (IS_ERR(rdev)) { 424 + dev_err(&pdev->dev, "failed to register %s\n", 425 + mt6357_regulators[i].desc.name); 426 + return PTR_ERR(rdev); 427 + } 428 + } 429 + 430 + return 0; 431 + } 432 + 433 + static const struct platform_device_id mt6357_platform_ids[] = { 434 + { "mt6357-regulator" }, 435 + { /* sentinel */ }, 436 + }; 437 + MODULE_DEVICE_TABLE(platform, mt6357_platform_ids); 438 + 439 + static struct platform_driver mt6357_regulator_driver = { 440 + .driver = { 441 + .name = "mt6357-regulator", 442 + }, 443 + .probe = mt6357_regulator_probe, 444 + .id_table = mt6357_platform_ids, 445 + }; 446 + 447 + module_platform_driver(mt6357_regulator_driver); 448 + 449 + MODULE_AUTHOR("Chen Zhong <chen.zhong@mediatek.com>"); 450 + MODULE_AUTHOR("Fabien Parent <fabien.parent@linaro.org>"); 451 + MODULE_AUTHOR("Alexandre Mergnat <amergnat@baylibre.com>"); 452 + MODULE_DESCRIPTION("Regulator Driver for MediaTek MT6357 PMIC"); 453 + MODULE_LICENSE("GPL");
+93 -1
drivers/regulator/of_regulator.c
··· 505 505 struct device_node *child; 506 506 struct regulator_init_data *init_data = NULL; 507 507 508 - child = regulator_of_get_init_node(dev, desc); 508 + child = regulator_of_get_init_node(config->dev, desc); 509 509 if (!child) 510 510 return NULL; 511 511 ··· 701 701 702 702 return c_rdev; 703 703 } 704 + 705 + /* 706 + * Check if name is a supply name according to the '*-supply' pattern 707 + * return 0 if false 708 + * return length of supply name without the -supply 709 + */ 710 + static int is_supply_name(const char *name) 711 + { 712 + int strs, i; 713 + 714 + strs = strlen(name); 715 + /* string need to be at minimum len(x-supply) */ 716 + if (strs < 8) 717 + return 0; 718 + for (i = strs - 6; i > 0; i--) { 719 + /* find first '-' and check if right part is supply */ 720 + if (name[i] != '-') 721 + continue; 722 + if (strcmp(name + i + 1, "supply") != 0) 723 + return 0; 724 + return i; 725 + } 726 + return 0; 727 + } 728 + 729 + /* 730 + * of_regulator_bulk_get_all - get multiple regulator consumers 731 + * 732 + * @dev: Device to supply 733 + * @np: device node to search for consumers 734 + * @consumers: Configuration of consumers; clients are stored here. 735 + * 736 + * @return number of regulators on success, an errno on failure. 737 + * 738 + * This helper function allows drivers to get several regulator 739 + * consumers in one operation. If any of the regulators cannot be 740 + * acquired then any regulators that were allocated will be freed 741 + * before returning to the caller. 742 + */ 743 + int of_regulator_bulk_get_all(struct device *dev, struct device_node *np, 744 + struct regulator_bulk_data **consumers) 745 + { 746 + int num_consumers = 0; 747 + struct regulator *tmp; 748 + struct property *prop; 749 + int i, n = 0, ret; 750 + char name[64]; 751 + 752 + *consumers = NULL; 753 + 754 + /* 755 + * first pass: get numbers of xxx-supply 756 + * second pass: fill consumers 757 + */ 758 + restart: 759 + for_each_property_of_node(np, prop) { 760 + i = is_supply_name(prop->name); 761 + if (i == 0) 762 + continue; 763 + if (!*consumers) { 764 + num_consumers++; 765 + continue; 766 + } else { 767 + memcpy(name, prop->name, i); 768 + name[i] = '\0'; 769 + tmp = regulator_get(dev, name); 770 + if (IS_ERR(tmp)) { 771 + ret = -EINVAL; 772 + goto error; 773 + } 774 + (*consumers)[n].consumer = tmp; 775 + n++; 776 + continue; 777 + } 778 + } 779 + if (*consumers) 780 + return num_consumers; 781 + if (num_consumers == 0) 782 + return 0; 783 + *consumers = kmalloc_array(num_consumers, 784 + sizeof(struct regulator_bulk_data), 785 + GFP_KERNEL); 786 + if (!*consumers) 787 + return -ENOMEM; 788 + goto restart; 789 + 790 + error: 791 + while (--n >= 0) 792 + regulator_put(consumers[n]->consumer); 793 + return ret; 794 + } 795 + EXPORT_SYMBOL_GPL(of_regulator_bulk_get_all);
+2 -3
drivers/regulator/pca9450-regulator.c
··· 701 701 return IRQ_HANDLED; 702 702 } 703 703 704 - static int pca9450_i2c_probe(struct i2c_client *i2c, 705 - const struct i2c_device_id *id) 704 + static int pca9450_i2c_probe(struct i2c_client *i2c) 706 705 { 707 706 enum pca9450_chip_type type = (unsigned int)(uintptr_t) 708 707 of_device_get_match_data(&i2c->dev); ··· 874 875 .name = "nxp-pca9450", 875 876 .of_match_table = pca9450_of_match, 876 877 }, 877 - .probe = pca9450_i2c_probe, 878 + .probe_new = pca9450_i2c_probe, 878 879 }; 879 880 880 881 module_i2c_driver(pca9450_i2c_driver);
+3 -3
drivers/regulator/pfuze100-regulator.c
··· 683 683 .cache_type = REGCACHE_RBTREE, 684 684 }; 685 685 686 - static int pfuze100_regulator_probe(struct i2c_client *client, 687 - const struct i2c_device_id *id) 686 + static int pfuze100_regulator_probe(struct i2c_client *client) 688 687 { 688 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 689 689 struct pfuze_chip *pfuze_chip; 690 690 struct regulator_config config = { }; 691 691 int i, ret; ··· 847 847 .name = "pfuze100-regulator", 848 848 .of_match_table = pfuze_dt_ids, 849 849 }, 850 - .probe = pfuze100_regulator_probe, 850 + .probe_new = pfuze100_regulator_probe, 851 851 }; 852 852 module_i2c_driver(pfuze_driver); 853 853
+3 -3
drivers/regulator/pv88080-regulator.c
··· 374 374 /* 375 375 * I2C driver interface functions 376 376 */ 377 - static int pv88080_i2c_probe(struct i2c_client *i2c, 378 - const struct i2c_device_id *id) 377 + static int pv88080_i2c_probe(struct i2c_client *i2c) 379 378 { 379 + const struct i2c_device_id *id = i2c_client_get_device_id(i2c); 380 380 struct regulator_init_data *init_data = dev_get_platdata(&i2c->dev); 381 381 struct pv88080 *chip; 382 382 const struct pv88080_compatible_regmap *regmap_config; ··· 559 559 .name = "pv88080", 560 560 .of_match_table = of_match_ptr(pv88080_dt_ids), 561 561 }, 562 - .probe = pv88080_i2c_probe, 562 + .probe_new = pv88080_i2c_probe, 563 563 .id_table = pv88080_i2c_id, 564 564 }; 565 565
+1
drivers/regulator/qcom-labibb-regulator.c
··· 822 822 if (irq == 0) 823 823 irq = -EINVAL; 824 824 825 + of_node_put(reg_node); 825 826 return dev_err_probe(vreg->dev, irq, 826 827 "Short-circuit irq not found.\n"); 827 828 }
+82 -1
drivers/regulator/qcom-rpmh-regulator.c
··· 731 731 .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, 732 732 }; 733 733 734 + static const struct rpmh_vreg_hw_data pmic5_ftsmps525_lv = { 735 + .regulator_type = VRM, 736 + .ops = &rpmh_regulator_vrm_ops, 737 + .voltage_range = REGULATOR_LINEAR_RANGE(300000, 0, 267, 4000), 738 + .n_voltages = 268, 739 + .pmic_mode_map = pmic_mode_map_pmic5_smps, 740 + .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, 741 + }; 742 + 743 + static const struct rpmh_vreg_hw_data pmic5_ftsmps525_mv = { 744 + .regulator_type = VRM, 745 + .ops = &rpmh_regulator_vrm_ops, 746 + .voltage_range = REGULATOR_LINEAR_RANGE(600000, 0, 267, 8000), 747 + .n_voltages = 268, 748 + .pmic_mode_map = pmic_mode_map_pmic5_smps, 749 + .of_map_mode = rpmh_regulator_pmic4_smps_of_map_mode, 750 + }; 751 + 734 752 static const struct rpmh_vreg_hw_data pmic5_hfsmps515 = { 735 753 .regulator_type = VRM, 736 754 .ops = &rpmh_regulator_vrm_ops, ··· 1005 987 {} 1006 988 }; 1007 989 990 + static const struct rpmh_vreg_init_data pm8550_vreg_data[] = { 991 + RPMH_VREG("ldo1", "ldo%s1", &pmic5_pldo, "vdd-l1-l4-l10"), 992 + RPMH_VREG("ldo2", "ldo%s2", &pmic5_pldo, "vdd-l2-l13-l14"), 993 + RPMH_VREG("ldo3", "ldo%s3", &pmic5_nldo, "vdd-l3"), 994 + RPMH_VREG("ldo4", "ldo%s4", &pmic5_nldo, "vdd-l1-l4-l10"), 995 + RPMH_VREG("ldo5", "ldo%s5", &pmic5_pldo, "vdd-l5-l16"), 996 + RPMH_VREG("ldo6", "ldo%s6", &pmic5_pldo_lv, "vdd-l6-l7"), 997 + RPMH_VREG("ldo7", "ldo%s7", &pmic5_pldo_lv, "vdd-l6-l7"), 998 + RPMH_VREG("ldo8", "ldo%s8", &pmic5_pldo_lv, "vdd-l8-l9"), 999 + RPMH_VREG("ldo9", "ldo%s9", &pmic5_pldo, "vdd-l8-l9"), 1000 + RPMH_VREG("ldo10", "ldo%s10", &pmic5_nldo, "vdd-l1-l4-l10"), 1001 + RPMH_VREG("ldo11", "ldo%s11", &pmic5_pldo, "vdd-l11"), 1002 + RPMH_VREG("ldo12", "ldo%s12", &pmic5_pldo, "vdd-l12"), 1003 + RPMH_VREG("ldo13", "ldo%s13", &pmic5_pldo, "vdd-l2-l13-l14"), 1004 + RPMH_VREG("ldo14", "ldo%s14", &pmic5_pldo, "vdd-l2-l13-l14"), 1005 + RPMH_VREG("ldo15", "ldo%s15", &pmic5_pldo, "vdd-l15"), 1006 + RPMH_VREG("ldo16", "ldo%s16", &pmic5_pldo, "vdd-l5-l16"), 1007 + RPMH_VREG("ldo17", "ldo%s17", &pmic5_pldo, "vdd-l17"), 1008 + RPMH_VREG("bob1", "bob%s1", &pmic5_bob, "vdd-bob1"), 1009 + RPMH_VREG("bob2", "bob%s2", &pmic5_bob, "vdd-bob2"), 1010 + {} 1011 + }; 1012 + 1013 + static const struct rpmh_vreg_init_data pm8550vs_vreg_data[] = { 1014 + RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps525_lv, "vdd-s1"), 1015 + RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps525_lv, "vdd-s2"), 1016 + RPMH_VREG("smps3", "smp%s3", &pmic5_ftsmps525_lv, "vdd-s3"), 1017 + RPMH_VREG("smps4", "smp%s4", &pmic5_ftsmps525_lv, "vdd-s4"), 1018 + RPMH_VREG("smps5", "smp%s5", &pmic5_ftsmps525_lv, "vdd-s5"), 1019 + RPMH_VREG("smps6", "smp%s6", &pmic5_ftsmps525_mv, "vdd-s6"), 1020 + RPMH_VREG("ldo1", "ldo%s1", &pmic5_nldo, "vdd-l1"), 1021 + RPMH_VREG("ldo2", "ldo%s2", &pmic5_nldo, "vdd-l2"), 1022 + RPMH_VREG("ldo3", "ldo%s3", &pmic5_nldo, "vdd-l3"), 1023 + {} 1024 + }; 1025 + 1026 + static const struct rpmh_vreg_init_data pm8550ve_vreg_data[] = { 1027 + RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps525_lv, "vdd-s1"), 1028 + RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps525_lv, "vdd-s2"), 1029 + RPMH_VREG("smps3", "smp%s3", &pmic5_ftsmps525_lv, "vdd-s3"), 1030 + RPMH_VREG("smps4", "smp%s4", &pmic5_ftsmps525_lv, "vdd-s4"), 1031 + RPMH_VREG("smps5", "smp%s5", &pmic5_ftsmps525_lv, "vdd-s5"), 1032 + RPMH_VREG("smps6", "smp%s6", &pmic5_ftsmps525_lv, "vdd-s6"), 1033 + RPMH_VREG("smps7", "smp%s7", &pmic5_ftsmps525_lv, "vdd-s7"), 1034 + RPMH_VREG("smps8", "smp%s8", &pmic5_ftsmps525_lv, "vdd-s8"), 1035 + RPMH_VREG("ldo1", "ldo%s1", &pmic5_nldo, "vdd-l1"), 1036 + RPMH_VREG("ldo2", "ldo%s2", &pmic5_nldo, "vdd-l2"), 1037 + RPMH_VREG("ldo3", "ldo%s3", &pmic5_nldo, "vdd-l3"), 1038 + {} 1039 + }; 1040 + 1008 1041 static const struct rpmh_vreg_init_data pm8009_vreg_data[] = { 1009 1042 RPMH_VREG("smps1", "smp%s1", &pmic5_hfsmps510, "vdd-s1"), 1010 1043 RPMH_VREG("smps2", "smp%s2", &pmic5_hfsmps515, "vdd-s2"), ··· 1256 1187 static const struct rpmh_vreg_init_data pmr735a_vreg_data[] = { 1257 1188 RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps520, "vdd-s1"), 1258 1189 RPMH_VREG("smps2", "smp%s2", &pmic5_ftsmps520, "vdd-s2"), 1259 - RPMH_VREG("smps3", "smp%s3", &pmic5_hfsmps510, "vdd-s3"), 1190 + RPMH_VREG("smps3", "smp%s3", &pmic5_hfsmps515, "vdd-s3"), 1260 1191 RPMH_VREG("ldo1", "ldo%s1", &pmic5_nldo, "vdd-l1-l2"), 1261 1192 RPMH_VREG("ldo2", "ldo%s2", &pmic5_nldo, "vdd-l1-l2"), 1262 1193 RPMH_VREG("ldo3", "ldo%s3", &pmic5_nldo, "vdd-l3"), ··· 1382 1313 { 1383 1314 .compatible = "qcom,pm8450-rpmh-regulators", 1384 1315 .data = pm8450_vreg_data, 1316 + }, 1317 + { 1318 + .compatible = "qcom,pm8550-rpmh-regulators", 1319 + .data = pm8550_vreg_data, 1320 + }, 1321 + { 1322 + .compatible = "qcom,pm8550ve-rpmh-regulators", 1323 + .data = pm8550ve_vreg_data, 1324 + }, 1325 + { 1326 + .compatible = "qcom,pm8550vs-rpmh-regulators", 1327 + .data = pm8550vs_vreg_data, 1385 1328 }, 1386 1329 { 1387 1330 .compatible = "qcom,pm8998-rpmh-regulators",
+33
drivers/regulator/qcom_smd-regulator.c
··· 677 677 .ops = &rpm_smps_ldo_ops, 678 678 }; 679 679 680 + static const struct regulator_desc pmic5_ftsmps520 = { 681 + .linear_ranges = (struct linear_range[]) { 682 + REGULATOR_LINEAR_RANGE(300000, 0, 263, 4000), 683 + }, 684 + .n_linear_ranges = 1, 685 + .n_voltages = 264, 686 + .ops = &rpm_smps_ldo_ops, 687 + }; 688 + 689 + static const struct regulator_desc pmic5_hfsmps515 = { 690 + .linear_ranges = (struct linear_range[]) { 691 + REGULATOR_LINEAR_RANGE(320000, 0, 235, 16000), 692 + }, 693 + .n_linear_ranges = 1, 694 + .n_voltages = 236, 695 + .ops = &rpm_smps_ldo_ops, 696 + }; 697 + 680 698 static const struct regulator_desc pms405_hfsmps3 = { 681 699 .linear_ranges = (struct linear_range[]) { 682 700 REGULATOR_LINEAR_RANGE(320000, 0, 215, 8000), ··· 1283 1265 {} 1284 1266 }; 1285 1267 1268 + static const struct rpm_regulator_data rpm_pmr735a_regulators[] = { 1269 + { "s1", QCOM_SMD_RPM_SMPE, 1, &pmic5_ftsmps520, "vdd_s1"}, 1270 + { "s2", QCOM_SMD_RPM_SMPE, 2, &pmic5_ftsmps520, "vdd_s2"}, 1271 + { "s3", QCOM_SMD_RPM_SMPE, 3, &pmic5_hfsmps515, "vdd_s3"}, 1272 + { "l1", QCOM_SMD_RPM_LDOE, 1, &pm660_nldo660, "vdd_l1_l2"}, 1273 + { "l2", QCOM_SMD_RPM_LDOE, 2, &pm660_nldo660, "vdd_l1_l2"}, 1274 + { "l3", QCOM_SMD_RPM_LDOE, 3, &pm660_nldo660, "vdd_l3"}, 1275 + { "l4", QCOM_SMD_RPM_LDOE, 4, &pm660_ht_lvpldo, "vdd_l4"}, 1276 + { "l5", QCOM_SMD_RPM_LDOE, 5, &pm660_nldo660, "vdd_l5_l6"}, 1277 + { "l6", QCOM_SMD_RPM_LDOE, 6, &pm660_nldo660, "vdd_l5_l6"}, 1278 + { "l7", QCOM_SMD_RPM_LDOE, 7, &pm660_pldo660, "vdd_l7_bob"}, 1279 + {} 1280 + }; 1281 + 1286 1282 static const struct rpm_regulator_data rpm_pms405_regulators[] = { 1287 1283 { "s1", QCOM_SMD_RPM_SMPA, 1, &pms405_hfsmps3, "vdd_s1" }, 1288 1284 { "s2", QCOM_SMD_RPM_SMPA, 2, &pms405_hfsmps3, "vdd_s2" }, ··· 1337 1305 { .compatible = "qcom,rpm-pma8084-regulators", .data = &rpm_pma8084_regulators }, 1338 1306 { .compatible = "qcom,rpm-pmi8994-regulators", .data = &rpm_pmi8994_regulators }, 1339 1307 { .compatible = "qcom,rpm-pmi8998-regulators", .data = &rpm_pmi8998_regulators }, 1308 + { .compatible = "qcom,rpm-pmr735a-regulators", .data = &rpm_pmr735a_regulators }, 1340 1309 { .compatible = "qcom,rpm-pms405-regulators", .data = &rpm_pms405_regulators }, 1341 1310 {} 1342 1311 };
+14 -12
drivers/regulator/rk808-regulator.c
··· 14 14 15 15 #include <linux/delay.h> 16 16 #include <linux/gpio.h> 17 - #include <linux/i2c.h> 18 17 #include <linux/module.h> 19 18 #include <linux/of_device.h> 20 19 #include <linux/of_gpio.h> ··· 1285 1286 static int rk808_regulator_probe(struct platform_device *pdev) 1286 1287 { 1287 1288 struct rk808 *rk808 = dev_get_drvdata(pdev->dev.parent); 1288 - struct i2c_client *client = rk808->i2c; 1289 1289 struct regulator_config config = {}; 1290 1290 struct regulator_dev *rk808_rdev; 1291 1291 struct rk808_regulator_data *pdata; 1292 1292 const struct regulator_desc *regulators; 1293 + struct regmap *regmap; 1293 1294 int ret, i, nregulators; 1295 + 1296 + regmap = dev_get_regmap(pdev->dev.parent, NULL); 1297 + if (!regmap) 1298 + return -ENODEV; 1294 1299 1295 1300 pdata = devm_kzalloc(&pdev->dev, sizeof(*pdata), GFP_KERNEL); 1296 1301 if (!pdata) 1297 1302 return -ENOMEM; 1298 1303 1299 - ret = rk808_regulator_dt_parse_pdata(&pdev->dev, &client->dev, 1300 - rk808->regmap, pdata); 1304 + ret = rk808_regulator_dt_parse_pdata(&pdev->dev, pdev->dev.parent, 1305 + regmap, pdata); 1301 1306 if (ret < 0) 1302 1307 return ret; 1303 1308 ··· 1329 1326 nregulators = RK818_NUM_REGULATORS; 1330 1327 break; 1331 1328 default: 1332 - dev_err(&client->dev, "unsupported RK8XX ID %lu\n", 1329 + dev_err(&pdev->dev, "unsupported RK8XX ID %lu\n", 1333 1330 rk808->variant); 1334 1331 return -EINVAL; 1335 1332 } 1336 1333 1337 - config.dev = &client->dev; 1334 + config.dev = &pdev->dev; 1335 + config.dev->of_node = pdev->dev.parent->of_node; 1338 1336 config.driver_data = pdata; 1339 - config.regmap = rk808->regmap; 1337 + config.regmap = regmap; 1340 1338 1341 1339 /* Instantiate the regulators */ 1342 1340 for (i = 0; i < nregulators; i++) { 1343 1341 rk808_rdev = devm_regulator_register(&pdev->dev, 1344 1342 &regulators[i], &config); 1345 - if (IS_ERR(rk808_rdev)) { 1346 - dev_err(&client->dev, 1347 - "failed to register %d regulator\n", i); 1348 - return PTR_ERR(rk808_rdev); 1349 - } 1343 + if (IS_ERR(rk808_rdev)) 1344 + return dev_err_probe(&pdev->dev, PTR_ERR(rk808_rdev), 1345 + "failed to register %d regulator\n", i); 1350 1346 } 1351 1347 1352 1348 return 0;
+2 -3
drivers/regulator/rpi-panel-attiny-regulator.c
··· 282 282 /* 283 283 * I2C driver interface functions 284 284 */ 285 - static int attiny_i2c_probe(struct i2c_client *i2c, 286 - const struct i2c_device_id *id) 285 + static int attiny_i2c_probe(struct i2c_client *i2c) 287 286 { 288 287 struct backlight_properties props = { }; 289 288 struct regulator_config config = { }; ··· 398 399 .name = "rpi_touchscreen_attiny", 399 400 .of_match_table = of_match_ptr(attiny_dt_ids), 400 401 }, 401 - .probe = attiny_i2c_probe, 402 + .probe_new = attiny_i2c_probe, 402 403 .remove = attiny_i2c_remove, 403 404 }; 404 405
+495
drivers/regulator/rt6190-regulator.c
··· 1 + // SPDX-License-Identifier: GPL-2.0-only 2 + /* 3 + * Copyright (C) 2022 Richtek Technology Corp. 4 + * 5 + * Author: ChiYuan Huang <cy_huang@richtek.com> 6 + * 7 + */ 8 + 9 + #include <linux/bits.h> 10 + #include <linux/delay.h> 11 + #include <linux/gpio/consumer.h> 12 + #include <linux/i2c.h> 13 + #include <linux/interrupt.h> 14 + #include <linux/kernel.h> 15 + #include <linux/mod_devicetable.h> 16 + #include <linux/module.h> 17 + #include <linux/pm_runtime.h> 18 + #include <linux/regmap.h> 19 + #include <linux/regulator/consumer.h> 20 + #include <linux/regulator/driver.h> 21 + #include <linux/regulator/of_regulator.h> 22 + 23 + #define RT6190_REG_VID 0x00 24 + #define RT6190_REG_OUTV 0x01 25 + #define RT6190_REG_OUTC 0x03 26 + #define RT6190_REG_SET1 0x0D 27 + #define RT6190_REG_SET2 0x0E 28 + #define RT6190_REG_SET4 0x10 29 + #define RT6190_REG_RATIO 0x11 30 + #define RT6190_REG_OUT_VOLT_L 0x12 31 + #define RT6190_REG_TEMP_H 0x1B 32 + #define RT6190_REG_STAT1 0x1C 33 + #define RT6190_REG_ALERT1 0x1E 34 + #define RT6190_REG_ALERT2 0x1F 35 + #define RT6190_REG_MASK2 0x21 36 + #define RT6190_REG_OCPEN 0x28 37 + #define RT6190_REG_SET5 0x29 38 + #define RT6190_REG_VBUSC_ADC 0x32 39 + #define RT6190_REG_BUSC_VOLT_L 0x33 40 + #define RT6190_REG_BUSC_VOLT_H 0x34 41 + #define RT6190_REG_STAT3 0x37 42 + #define RT6190_REG_ALERT3 0x38 43 + #define RT6190_REG_MASK3 0x39 44 + 45 + #define RT6190_ENPWM_MASK BIT(7) 46 + #define RT6190_ENDCHG_MASK BIT(4) 47 + #define RT6190_ALERT_OTPEVT BIT(6) 48 + #define RT6190_ALERT_UVPEVT BIT(5) 49 + #define RT6190_ALERT_OVPEVT BIT(4) 50 + #define RT6190_ENGCP_MASK BIT(1) 51 + #define RT6190_FCCM_MASK BIT(7) 52 + 53 + #define RICHTEK_VID 0x82 54 + #define RT6190_OUT_MIN_UV 3000000 55 + #define RT6190_OUT_MAX_UV 32000000 56 + #define RT6190_OUT_STEP_UV 20000 57 + #define RT6190_OUT_N_VOLT (RT6190_OUT_MAX_UV / RT6190_OUT_STEP_UV + 1) 58 + #define RT6190_OUTV_MINSEL 150 59 + #define RT6190_OUT_MIN_UA 306000 60 + #define RT6190_OUT_MAX_UA 12114000 61 + #define RT6190_OUT_STEP_UA 24000 62 + #define RT6190_OUTC_MINSEL 19 63 + #define RT6190_EN_TIME_US 500 64 + 65 + #define RT6190_PSM_MODE 0 66 + #define RT6190_FCCM_MODE 1 67 + 68 + struct rt6190_data { 69 + struct device *dev; 70 + struct regmap *regmap; 71 + struct gpio_desc *enable_gpio; 72 + unsigned int cached_alert_evt; 73 + }; 74 + 75 + static int rt6190_out_set_voltage_sel(struct regulator_dev *rdev, 76 + unsigned int selector) 77 + { 78 + struct regmap *regmap = rdev_get_regmap(rdev); 79 + __le16 le_sel = cpu_to_le16(selector); 80 + 81 + return regmap_raw_write(regmap, RT6190_REG_OUTV, &le_sel, 82 + sizeof(le_sel)); 83 + } 84 + 85 + static int rt6190_out_get_voltage_sel(struct regulator_dev *rdev) 86 + { 87 + struct regmap *regmap = rdev_get_regmap(rdev); 88 + __le16 le_sel; 89 + int ret; 90 + 91 + ret = regmap_raw_read(regmap, RT6190_REG_OUTV, &le_sel, sizeof(le_sel)); 92 + 93 + return ret ?: le16_to_cpu(le_sel); 94 + } 95 + 96 + static int rt6190_out_enable(struct regulator_dev *rdev) 97 + { 98 + struct rt6190_data *data = rdev_get_drvdata(rdev); 99 + struct regmap *regmap = rdev_get_regmap(rdev); 100 + u8 out_cfg[4]; 101 + int ret; 102 + 103 + pm_runtime_get_sync(data->dev); 104 + 105 + /* 106 + * From off to on, vout config will restore to IC default. 107 + * Read vout configs before enable, and restore them after enable 108 + */ 109 + ret = regmap_raw_read(regmap, RT6190_REG_OUTV, out_cfg, 110 + sizeof(out_cfg)); 111 + if (ret) 112 + return ret; 113 + 114 + ret = regulator_enable_regmap(rdev); 115 + if (ret) 116 + return ret; 117 + 118 + ret = regmap_raw_write(regmap, RT6190_REG_OUTV, out_cfg, 119 + sizeof(out_cfg)); 120 + if (ret) 121 + return ret; 122 + 123 + return regmap_update_bits(regmap, RT6190_REG_SET5, RT6190_ENGCP_MASK, 124 + RT6190_ENGCP_MASK); 125 + } 126 + 127 + static int rt6190_out_disable(struct regulator_dev *rdev) 128 + { 129 + struct rt6190_data *data = rdev_get_drvdata(rdev); 130 + struct regmap *regmap = rdev_get_regmap(rdev); 131 + int ret; 132 + 133 + ret = regmap_update_bits(regmap, RT6190_REG_SET5, RT6190_ENGCP_MASK, 0); 134 + if (ret) 135 + return ret; 136 + 137 + ret = regulator_disable_regmap(rdev); 138 + if (ret) 139 + return ret; 140 + 141 + /* cleared cached alert event */ 142 + data->cached_alert_evt = 0; 143 + 144 + pm_runtime_put(data->dev); 145 + 146 + return 0; 147 + } 148 + 149 + static int rt6190_out_set_current_limit(struct regulator_dev *rdev, int min_uA, 150 + int max_uA) 151 + { 152 + struct regmap *regmap = rdev_get_regmap(rdev); 153 + int csel, clim; 154 + __le16 le_csel; 155 + 156 + if (min_uA < RT6190_OUT_MIN_UA || max_uA > RT6190_OUT_MAX_UA) 157 + return -EINVAL; 158 + 159 + csel = DIV_ROUND_UP(min_uA - RT6190_OUT_MIN_UA, RT6190_OUT_STEP_UA); 160 + 161 + clim = RT6190_OUT_MIN_UA + RT6190_OUT_STEP_UA * csel; 162 + if (clim > max_uA) 163 + return -EINVAL; 164 + 165 + csel += RT6190_OUTC_MINSEL; 166 + le_csel = cpu_to_le16(csel); 167 + 168 + return regmap_raw_write(regmap, RT6190_REG_OUTC, &le_csel, 169 + sizeof(le_csel)); 170 + } 171 + 172 + static int rt6190_out_get_current_limit(struct regulator_dev *rdev) 173 + { 174 + struct regmap *regmap = rdev_get_regmap(rdev); 175 + __le16 le_csel; 176 + int csel, ret; 177 + 178 + ret = regmap_raw_read(regmap, RT6190_REG_OUTC, &le_csel, 179 + sizeof(le_csel)); 180 + if (ret) 181 + return ret; 182 + 183 + csel = le16_to_cpu(le_csel); 184 + csel -= RT6190_OUTC_MINSEL; 185 + 186 + return RT6190_OUT_MIN_UA + RT6190_OUT_STEP_UA * csel; 187 + } 188 + 189 + static int rt6190_out_set_mode(struct regulator_dev *rdev, unsigned int mode) 190 + { 191 + struct regmap *regmap = rdev_get_regmap(rdev); 192 + unsigned int val; 193 + 194 + switch (mode) { 195 + case REGULATOR_MODE_FAST: 196 + val = RT6190_FCCM_MASK; 197 + break; 198 + case REGULATOR_MODE_NORMAL: 199 + val = 0; 200 + break; 201 + default: 202 + return -EINVAL; 203 + } 204 + 205 + return regmap_update_bits(regmap, RT6190_REG_SET1, RT6190_FCCM_MASK, 206 + val); 207 + } 208 + 209 + static unsigned int rt6190_out_get_mode(struct regulator_dev *rdev) 210 + { 211 + struct regmap *regmap = rdev_get_regmap(rdev); 212 + unsigned int config; 213 + int ret; 214 + 215 + ret = regmap_read(regmap, RT6190_REG_SET1, &config); 216 + if (ret) 217 + return REGULATOR_MODE_INVALID; 218 + 219 + if (config & RT6190_FCCM_MASK) 220 + return REGULATOR_MODE_FAST; 221 + 222 + return REGULATOR_MODE_NORMAL; 223 + } 224 + 225 + static int rt6190_out_get_error_flags(struct regulator_dev *rdev, 226 + unsigned int *flags) 227 + { 228 + struct rt6190_data *data = rdev_get_drvdata(rdev); 229 + unsigned int state, rpt_flags = 0; 230 + int ret; 231 + 232 + ret = regmap_read(data->regmap, RT6190_REG_STAT1, &state); 233 + if (ret) 234 + return ret; 235 + 236 + state |= data->cached_alert_evt; 237 + 238 + if (state & RT6190_ALERT_OTPEVT) 239 + rpt_flags |= REGULATOR_ERROR_OVER_TEMP; 240 + 241 + if (state & RT6190_ALERT_UVPEVT) 242 + rpt_flags |= REGULATOR_ERROR_UNDER_VOLTAGE; 243 + 244 + if (state & RT6190_ALERT_OVPEVT) 245 + rpt_flags |= REGULATOR_ERROR_REGULATION_OUT; 246 + 247 + *flags = rpt_flags; 248 + 249 + return 0; 250 + } 251 + 252 + static unsigned int rt6190_out_of_map_mode(unsigned int mode) 253 + { 254 + switch (mode) { 255 + case RT6190_PSM_MODE: 256 + return REGULATOR_MODE_NORMAL; 257 + case RT6190_FCCM_MODE: 258 + return REGULATOR_MODE_FAST; 259 + default: 260 + return REGULATOR_MODE_INVALID; 261 + } 262 + } 263 + 264 + static const struct regulator_ops rt6190_regulator_ops = { 265 + .list_voltage = regulator_list_voltage_linear, 266 + .set_voltage_sel = rt6190_out_set_voltage_sel, 267 + .get_voltage_sel = rt6190_out_get_voltage_sel, 268 + .enable = rt6190_out_enable, 269 + .disable = rt6190_out_disable, 270 + .is_enabled = regulator_is_enabled_regmap, 271 + .set_current_limit = rt6190_out_set_current_limit, 272 + .get_current_limit = rt6190_out_get_current_limit, 273 + .set_active_discharge = regulator_set_active_discharge_regmap, 274 + .set_mode = rt6190_out_set_mode, 275 + .get_mode = rt6190_out_get_mode, 276 + .get_error_flags = rt6190_out_get_error_flags, 277 + }; 278 + 279 + static const struct regulator_desc rt6190_regulator_desc = { 280 + .name = "rt6190-regulator", 281 + .type = REGULATOR_VOLTAGE, 282 + .owner = THIS_MODULE, 283 + .ops = &rt6190_regulator_ops, 284 + .min_uV = RT6190_OUT_MIN_UV, 285 + .uV_step = RT6190_OUT_STEP_UV, 286 + .n_voltages = RT6190_OUT_N_VOLT, 287 + .linear_min_sel = RT6190_OUTV_MINSEL, 288 + .enable_reg = RT6190_REG_SET2, 289 + .enable_mask = RT6190_ENPWM_MASK, 290 + .active_discharge_reg = RT6190_REG_SET2, 291 + .active_discharge_mask = RT6190_ENDCHG_MASK, 292 + .active_discharge_on = RT6190_ENDCHG_MASK, 293 + .of_map_mode = rt6190_out_of_map_mode, 294 + }; 295 + 296 + static bool rt6190_is_volatile_reg(struct device *dev, unsigned int reg) 297 + { 298 + switch (reg) { 299 + case RT6190_REG_OUT_VOLT_L ... RT6190_REG_ALERT2: 300 + case RT6190_REG_BUSC_VOLT_L ... RT6190_REG_BUSC_VOLT_H: 301 + case RT6190_REG_STAT3 ... RT6190_REG_ALERT3: 302 + return true; 303 + default: 304 + return false; 305 + } 306 + } 307 + 308 + static const struct regmap_config rt6190_regmap_config = { 309 + .name = "rt6190", 310 + .cache_type = REGCACHE_FLAT, 311 + .reg_bits = 8, 312 + .val_bits = 8, 313 + .max_register = RT6190_REG_MASK3, 314 + .num_reg_defaults_raw = RT6190_REG_MASK3 + 1, 315 + .volatile_reg = rt6190_is_volatile_reg, 316 + }; 317 + 318 + static irqreturn_t rt6190_irq_handler(int irq, void *devid) 319 + { 320 + struct regulator_dev *rdev = devid; 321 + struct rt6190_data *data = rdev_get_drvdata(rdev); 322 + unsigned int alert; 323 + int ret; 324 + 325 + ret = regmap_read(data->regmap, RT6190_REG_ALERT1, &alert); 326 + if (ret) 327 + return IRQ_NONE; 328 + 329 + /* Write clear alert events */ 330 + ret = regmap_write(data->regmap, RT6190_REG_ALERT1, alert); 331 + if (ret) 332 + return IRQ_NONE; 333 + 334 + data->cached_alert_evt |= alert; 335 + 336 + if (alert & RT6190_ALERT_OTPEVT) 337 + regulator_notifier_call_chain(rdev, REGULATOR_EVENT_OVER_TEMP, NULL); 338 + 339 + if (alert & RT6190_ALERT_UVPEVT) 340 + regulator_notifier_call_chain(rdev, REGULATOR_EVENT_UNDER_VOLTAGE, NULL); 341 + 342 + if (alert & RT6190_ALERT_OVPEVT) 343 + regulator_notifier_call_chain(rdev, REGULATOR_EVENT_REGULATION_OUT, NULL); 344 + 345 + return IRQ_HANDLED; 346 + } 347 + 348 + static int rt6190_init_registers(struct regmap *regmap) 349 + { 350 + int ret; 351 + 352 + /* Enable_ADC = 1 */ 353 + ret = regmap_write(regmap, RT6190_REG_SET4, 0x82); 354 + if (ret) 355 + return ret; 356 + 357 + /* Config default VOUT ratio to be higher */ 358 + ret = regmap_write(regmap, RT6190_REG_RATIO, 0x20); 359 + 360 + /* Mask unused alert */ 361 + ret = regmap_write(regmap, RT6190_REG_MASK2, 0); 362 + if (ret) 363 + return ret; 364 + 365 + /* OCP config */ 366 + ret = regmap_write(regmap, RT6190_REG_OCPEN, 0); 367 + if (ret) 368 + return ret; 369 + 370 + /* Enable VBUSC ADC */ 371 + return regmap_write(regmap, RT6190_REG_VBUSC_ADC, 0x02); 372 + } 373 + 374 + static int rt6190_probe(struct i2c_client *i2c) 375 + { 376 + struct device *dev = &i2c->dev; 377 + struct rt6190_data *data; 378 + struct gpio_desc *enable_gpio; 379 + struct regmap *regmap; 380 + struct regulator_dev *rdev; 381 + struct regulator_config cfg = {}; 382 + unsigned int vid; 383 + int ret; 384 + 385 + data = devm_kzalloc(dev, sizeof(*data), GFP_KERNEL); 386 + if (!data) 387 + return -ENOMEM; 388 + 389 + enable_gpio = devm_gpiod_get_optional(dev, "enable", GPIOD_OUT_HIGH); 390 + if (IS_ERR(enable_gpio)) 391 + return dev_err_probe(dev, PTR_ERR(enable_gpio), "Failed to get 'enable' gpio\n"); 392 + else if (enable_gpio) 393 + usleep_range(RT6190_EN_TIME_US, RT6190_EN_TIME_US * 2); 394 + 395 + regmap = devm_regmap_init_i2c(i2c, &rt6190_regmap_config); 396 + if (IS_ERR(regmap)) 397 + return dev_err_probe(dev, PTR_ERR(regmap), "Failed to init regmap\n"); 398 + 399 + data->dev = dev; 400 + data->enable_gpio = enable_gpio; 401 + data->regmap = regmap; 402 + i2c_set_clientdata(i2c, data); 403 + 404 + ret = regmap_read(regmap, RT6190_REG_VID, &vid); 405 + if (ret) 406 + return dev_err_probe(dev, ret, "Failed to read VID\n"); 407 + 408 + if (vid != RICHTEK_VID) 409 + return dev_err_probe(dev, -ENODEV, "Incorrect VID 0x%02x\n", vid); 410 + 411 + ret = rt6190_init_registers(regmap); 412 + if (ret) 413 + return dev_err_probe(dev, ret, "Failed to init registers\n"); 414 + 415 + pm_runtime_set_active(dev); 416 + ret = devm_pm_runtime_enable(dev); 417 + if (ret) 418 + return dev_err_probe(dev, ret, "Failed to set pm_runtime enable\n"); 419 + 420 + cfg.dev = dev; 421 + cfg.of_node = dev->of_node; 422 + cfg.driver_data = data; 423 + cfg.init_data = of_get_regulator_init_data(dev, dev->of_node, 424 + &rt6190_regulator_desc); 425 + 426 + rdev = devm_regulator_register(dev, &rt6190_regulator_desc, &cfg); 427 + if (IS_ERR(rdev)) 428 + return dev_err_probe(dev, PTR_ERR(rdev), "Failed to register regulator\n"); 429 + 430 + if (i2c->irq) { 431 + ret = devm_request_threaded_irq(dev, i2c->irq, NULL, 432 + rt6190_irq_handler, 433 + IRQF_ONESHOT, dev_name(dev), 434 + rdev); 435 + if (ret) 436 + return dev_err_probe(dev, ret, "Failed to register interrupt\n"); 437 + } 438 + 439 + return 0; 440 + } 441 + 442 + static int rt6190_runtime_suspend(struct device *dev) 443 + { 444 + struct rt6190_data *data = dev_get_drvdata(dev); 445 + struct regmap *regmap = data->regmap; 446 + 447 + if (!data->enable_gpio) 448 + return 0; 449 + 450 + regcache_cache_only(regmap, true); 451 + regcache_mark_dirty(regmap); 452 + 453 + gpiod_set_value(data->enable_gpio, 0); 454 + 455 + return 0; 456 + } 457 + 458 + static int rt6190_runtime_resume(struct device *dev) 459 + { 460 + struct rt6190_data *data = dev_get_drvdata(dev); 461 + struct regmap *regmap = data->regmap; 462 + 463 + if (!data->enable_gpio) 464 + return 0; 465 + 466 + gpiod_set_value(data->enable_gpio, 1); 467 + usleep_range(RT6190_EN_TIME_US, RT6190_EN_TIME_US * 2); 468 + 469 + regcache_cache_only(regmap, false); 470 + return regcache_sync(regmap); 471 + } 472 + 473 + static const struct dev_pm_ops __maybe_unused rt6190_dev_pm = { 474 + RUNTIME_PM_OPS(rt6190_runtime_suspend, rt6190_runtime_resume, NULL) 475 + }; 476 + 477 + static const struct of_device_id rt6190_of_dev_table[] = { 478 + { .compatible = "richtek,rt6190" }, 479 + {} 480 + }; 481 + MODULE_DEVICE_TABLE(of, rt6190_of_dev_table); 482 + 483 + static struct i2c_driver rt6190_driver = { 484 + .driver = { 485 + .name = "rt6190", 486 + .of_match_table = rt6190_of_dev_table, 487 + .pm = pm_ptr(&rt6190_dev_pm), 488 + }, 489 + .probe_new = rt6190_probe, 490 + }; 491 + module_i2c_driver(rt6190_driver); 492 + 493 + MODULE_DESCRIPTION("Richtek RT6190 regulator driver"); 494 + MODULE_AUTHOR("ChiYuan Huang <cy_huang@richtek.com>"); 495 + MODULE_LICENSE("GPL");
+1 -1
drivers/regulator/stm32-vrefbuf.c
··· 210 210 pdev->dev.of_node, 211 211 &stm32_vrefbuf_regu); 212 212 213 - rdev = regulator_register(&stm32_vrefbuf_regu, &config); 213 + rdev = regulator_register(&pdev->dev, &stm32_vrefbuf_regu, &config); 214 214 if (IS_ERR(rdev)) { 215 215 ret = PTR_ERR(rdev); 216 216 dev_err(&pdev->dev, "register failed with error %d\n", ret);
+2 -2
drivers/regulator/sy8106a-regulator.c
··· 123 123 return 0; 124 124 } 125 125 126 - static const struct of_device_id __maybe_unused sy8106a_i2c_of_match[] = { 126 + static const struct of_device_id sy8106a_i2c_of_match[] = { 127 127 { .compatible = "silergy,sy8106a" }, 128 128 { }, 129 129 }; ··· 138 138 static struct i2c_driver sy8106a_regulator_driver = { 139 139 .driver = { 140 140 .name = "sy8106a", 141 - .of_match_table = of_match_ptr(sy8106a_i2c_of_match), 141 + .of_match_table = sy8106a_i2c_of_match, 142 142 }, 143 143 .probe_new = sy8106a_i2c_probe, 144 144 .id_table = sy8106a_i2c_id,
+1 -1
drivers/regulator/sy8824x.c
··· 233 233 static struct i2c_driver sy8824_regulator_driver = { 234 234 .driver = { 235 235 .name = "sy8824-regulator", 236 - .of_match_table = of_match_ptr(sy8824_dt_ids), 236 + .of_match_table = sy8824_dt_ids, 237 237 }, 238 238 .probe_new = sy8824_i2c_probe, 239 239 .id_table = sy8824_id,
+1 -3
drivers/regulator/sy8827n.c
··· 170 170 return ret; 171 171 } 172 172 173 - #ifdef CONFIG_OF 174 173 static const struct of_device_id sy8827n_dt_ids[] = { 175 174 { 176 175 .compatible = "silergy,sy8827n", ··· 177 178 { } 178 179 }; 179 180 MODULE_DEVICE_TABLE(of, sy8827n_dt_ids); 180 - #endif 181 181 182 182 static const struct i2c_device_id sy8827n_id[] = { 183 183 { "sy8827n", }, ··· 187 189 static struct i2c_driver sy8827n_regulator_driver = { 188 190 .driver = { 189 191 .name = "sy8827n-regulator", 190 - .of_match_table = of_match_ptr(sy8827n_dt_ids), 192 + .of_match_table = sy8827n_dt_ids, 191 193 }, 192 194 .probe_new = sy8827n_i2c_probe, 193 195 .id_table = sy8827n_id,
+2 -3
drivers/regulator/tps51632-regulator.c
··· 247 247 } 248 248 #endif 249 249 250 - static int tps51632_probe(struct i2c_client *client, 251 - const struct i2c_device_id *id) 250 + static int tps51632_probe(struct i2c_client *client) 252 251 { 253 252 struct tps51632_regulator_platform_data *pdata; 254 253 struct regulator_dev *rdev; ··· 353 354 .name = "tps51632", 354 355 .of_match_table = of_match_ptr(tps51632_of_match), 355 356 }, 356 - .probe = tps51632_probe, 357 + .probe_new = tps51632_probe, 357 358 .id_table = tps51632_id, 358 359 }; 359 360
+3 -3
drivers/regulator/tps62360-regulator.c
··· 322 322 MODULE_DEVICE_TABLE(of, tps62360_of_match); 323 323 #endif 324 324 325 - static int tps62360_probe(struct i2c_client *client, 326 - const struct i2c_device_id *id) 325 + static int tps62360_probe(struct i2c_client *client) 327 326 { 327 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 328 328 struct regulator_config config = { }; 329 329 struct tps62360_regulator_platform_data *pdata; 330 330 struct regulator_dev *rdev; ··· 497 497 .name = "tps62360", 498 498 .of_match_table = of_match_ptr(tps62360_of_match), 499 499 }, 500 - .probe = tps62360_probe, 500 + .probe_new = tps62360_probe, 501 501 .shutdown = tps62360_shutdown, 502 502 .id_table = tps62360_id, 503 503 };
+2 -3
drivers/regulator/tps6286x-regulator.c
··· 111 111 }; 112 112 MODULE_DEVICE_TABLE(of, tps6286x_dt_ids); 113 113 114 - static int tps6286x_i2c_probe(struct i2c_client *i2c, 115 - const struct i2c_device_id *id) 114 + static int tps6286x_i2c_probe(struct i2c_client *i2c) 116 115 { 117 116 struct device *dev = &i2c->dev; 118 117 struct regulator_config config = {}; ··· 149 150 .name = "tps6286x", 150 151 .of_match_table = of_match_ptr(tps6286x_dt_ids), 151 152 }, 152 - .probe = tps6286x_i2c_probe, 153 + .probe_new = tps6286x_i2c_probe, 153 154 .id_table = tps6286x_i2c_id, 154 155 }; 155 156
+3 -3
drivers/regulator/tps65023-regulator.c
··· 257 257 .core_regulator = TPS65023_DCDC_1, 258 258 }; 259 259 260 - static int tps_65023_probe(struct i2c_client *client, 261 - const struct i2c_device_id *id) 260 + static int tps_65023_probe(struct i2c_client *client) 262 261 { 262 + const struct i2c_device_id *id = i2c_client_get_device_id(client); 263 263 struct regulator_init_data *init_data = dev_get_platdata(&client->dev); 264 264 struct regulator_config config = { }; 265 265 struct tps_pmic *tps; ··· 336 336 .name = "tps65023", 337 337 .of_match_table = of_match_ptr(tps65023_of_match), 338 338 }, 339 - .probe = tps_65023_probe, 339 + .probe_new = tps_65023_probe, 340 340 .id_table = tps_65023_id, 341 341 }; 342 342
+53 -7
drivers/regulator/userspace-consumer.c
··· 14 14 #include <linux/err.h> 15 15 #include <linux/mutex.h> 16 16 #include <linux/module.h> 17 + #include <linux/of.h> 17 18 #include <linux/platform_device.h> 18 19 #include <linux/regulator/consumer.h> 19 20 #include <linux/regulator/userspace-consumer.h> ··· 25 24 26 25 struct mutex lock; 27 26 bool enabled; 27 + bool no_autoswitch; 28 28 29 29 int num_supplies; 30 30 struct regulator_bulk_data *supplies; ··· 98 96 NULL, 99 97 }; 100 98 99 + static umode_t attr_visible(struct kobject *kobj, struct attribute *attr, int idx) 100 + { 101 + struct device *dev = kobj_to_dev(kobj); 102 + struct userspace_consumer_data *data = dev_get_drvdata(dev); 103 + 104 + /* If a name hasn't been set, don't bother with the attribute */ 105 + if (attr == &dev_attr_name.attr && !data->name) 106 + return 0; 107 + 108 + return attr->mode; 109 + } 110 + 101 111 static const struct attribute_group attr_group = { 102 112 .attrs = attributes, 113 + .is_visible = attr_visible, 103 114 }; 104 115 105 116 static int regulator_userspace_consumer_probe(struct platform_device *pdev) 106 117 { 118 + struct regulator_userspace_consumer_data tmpdata; 107 119 struct regulator_userspace_consumer_data *pdata; 108 120 struct userspace_consumer_data *drvdata; 109 121 int ret; 110 122 111 123 pdata = dev_get_platdata(&pdev->dev); 112 - if (!pdata) 124 + if (!pdata) { 125 + if (!pdev->dev.of_node) 126 + return -EINVAL; 127 + 128 + pdata = &tmpdata; 129 + memset(pdata, 0, sizeof(*pdata)); 130 + 131 + pdata->no_autoswitch = true; 132 + pdata->num_supplies = 1; 133 + pdata->supplies = devm_kzalloc(&pdev->dev, sizeof(*pdata->supplies), GFP_KERNEL); 134 + if (!pdata->supplies) 135 + return -ENOMEM; 136 + pdata->supplies[0].supply = "vout"; 137 + } 138 + 139 + if (pdata->num_supplies < 1) { 140 + dev_err(&pdev->dev, "At least one supply required\n"); 113 141 return -EINVAL; 142 + } 114 143 115 144 drvdata = devm_kzalloc(&pdev->dev, 116 145 sizeof(struct userspace_consumer_data), ··· 152 119 drvdata->name = pdata->name; 153 120 drvdata->num_supplies = pdata->num_supplies; 154 121 drvdata->supplies = pdata->supplies; 122 + drvdata->no_autoswitch = pdata->no_autoswitch; 155 123 156 124 mutex_init(&drvdata->lock); 157 125 158 - ret = devm_regulator_bulk_get(&pdev->dev, drvdata->num_supplies, 159 - drvdata->supplies); 126 + ret = devm_regulator_bulk_get_exclusive(&pdev->dev, drvdata->num_supplies, 127 + drvdata->supplies); 160 128 if (ret) { 161 129 dev_err(&pdev->dev, "Failed to get supplies: %d\n", ret); 162 130 return ret; 163 131 } 164 132 133 + platform_set_drvdata(pdev, drvdata); 134 + 165 135 ret = sysfs_create_group(&pdev->dev.kobj, &attr_group); 166 136 if (ret != 0) 167 137 return ret; 168 138 169 - if (pdata->init_on) { 139 + if (pdata->init_on && !pdata->no_autoswitch) { 170 140 ret = regulator_bulk_enable(drvdata->num_supplies, 171 141 drvdata->supplies); 172 142 if (ret) { ··· 179 143 } 180 144 } 181 145 182 - drvdata->enabled = pdata->init_on; 183 - platform_set_drvdata(pdev, drvdata); 146 + ret = regulator_is_enabled(pdata->supplies[0].consumer); 147 + if (ret < 0) { 148 + dev_err(&pdev->dev, "Failed to get regulator status\n"); 149 + goto err_enable; 150 + } 151 + drvdata->enabled = !!ret; 184 152 185 153 return 0; 186 154 ··· 200 160 201 161 sysfs_remove_group(&pdev->dev.kobj, &attr_group); 202 162 203 - if (data->enabled) 163 + if (data->enabled && !data->no_autoswitch) 204 164 regulator_bulk_disable(data->num_supplies, data->supplies); 205 165 206 166 return 0; 207 167 } 168 + 169 + static const struct of_device_id regulator_userspace_consumer_of_match[] = { 170 + { .compatible = "regulator-output", }, 171 + {}, 172 + }; 208 173 209 174 static struct platform_driver regulator_userspace_consumer_driver = { 210 175 .probe = regulator_userspace_consumer_probe, 211 176 .remove = regulator_userspace_consumer_remove, 212 177 .driver = { 213 178 .name = "reg-userspace-consumer", 179 + .of_match_table = regulator_userspace_consumer_of_match, 214 180 }, 215 181 }; 216 182
+10
include/linux/regulator/consumer.h
··· 244 244 245 245 int __must_check regulator_bulk_get(struct device *dev, int num_consumers, 246 246 struct regulator_bulk_data *consumers); 247 + int __must_check of_regulator_bulk_get_all(struct device *dev, struct device_node *np, 248 + struct regulator_bulk_data **consumers); 247 249 int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers, 248 250 struct regulator_bulk_data *consumers); 249 251 void devm_regulator_bulk_put(struct regulator_bulk_data *consumers); 252 + int __must_check devm_regulator_bulk_get_exclusive(struct device *dev, int num_consumers, 253 + struct regulator_bulk_data *consumers); 250 254 int __must_check devm_regulator_bulk_get_const( 251 255 struct device *dev, int num_consumers, 252 256 const struct regulator_bulk_data *in_consumers, ··· 479 475 480 476 static inline int devm_regulator_bulk_get(struct device *dev, int num_consumers, 481 477 struct regulator_bulk_data *consumers) 478 + { 479 + return 0; 480 + } 481 + 482 + static inline int of_regulator_bulk_get_all(struct device *dev, struct device_node *np, 483 + struct regulator_bulk_data **consumers) 482 484 { 483 485 return 0; 484 486 }
+2 -1
include/linux/regulator/driver.h
··· 687 687 688 688 689 689 struct regulator_dev * 690 - regulator_register(const struct regulator_desc *regulator_desc, 690 + regulator_register(struct device *dev, 691 + const struct regulator_desc *regulator_desc, 691 692 const struct regulator_config *config); 692 693 struct regulator_dev * 693 694 devm_regulator_register(struct device *dev,
+51
include/linux/regulator/mt6357-regulator.h
··· 1 + /* SPDX-License-Identifier: GPL-2.0 */ 2 + /* 3 + * Copyright (c) 2022 MediaTek Inc. 4 + */ 5 + 6 + #ifndef __LINUX_REGULATOR_MT6357_H 7 + #define __LINUX_REGULATOR_MT6357_H 8 + 9 + enum { 10 + /* Bucks */ 11 + MT6357_ID_VCORE, 12 + MT6357_ID_VMODEM, 13 + MT6357_ID_VPA, 14 + MT6357_ID_VPROC, 15 + MT6357_ID_VS1, 16 + 17 + /* LDOs */ 18 + MT6357_ID_VAUX18, 19 + MT6357_ID_VAUD28, 20 + MT6357_ID_VCAMA, 21 + MT6357_ID_VCAMD, 22 + MT6357_ID_VCAMIO, 23 + MT6357_ID_VCN18, 24 + MT6357_ID_VCN28, 25 + MT6357_ID_VCN33_BT, 26 + MT6357_ID_VCN33_WIFI, 27 + MT6357_ID_VDRAM, 28 + MT6357_ID_VEFUSE, 29 + MT6357_ID_VEMC, 30 + MT6357_ID_VFE28, 31 + MT6357_ID_VIBR, 32 + MT6357_ID_VIO18, 33 + MT6357_ID_VIO28, 34 + MT6357_ID_VLDO28, 35 + MT6357_ID_VMC, 36 + MT6357_ID_VMCH, 37 + MT6357_ID_VRF12, 38 + MT6357_ID_VRF18, 39 + MT6357_ID_VSIM1, 40 + MT6357_ID_VSIM2, 41 + MT6357_ID_VSRAM_OTHERS, 42 + MT6357_ID_VSRAM_PROC, 43 + MT6357_ID_VUSB33, 44 + MT6357_ID_VXO22, 45 + 46 + MT6357_ID_RG_MAX, 47 + }; 48 + 49 + #define MT6357_MAX_REGULATOR MT6357_ID_RG_MAX 50 + 51 + #endif /* __LINUX_REGULATOR_MT6357_H */
+1
include/linux/regulator/userspace-consumer.h
··· 21 21 struct regulator_bulk_data *supplies; 22 22 23 23 bool init_on; 24 + bool no_autoswitch; 24 25 }; 25 26 26 27 #endif /* __REGULATOR_PLATFORM_CONSUMER_H_ */
+2
include/linux/soc/qcom/smd-rpm.h
··· 19 19 #define QCOM_SMD_RPM_CLK_BUF_A 0x616B6C63 20 20 #define QCOM_SMD_RPM_LDOA 0x616f646c 21 21 #define QCOM_SMD_RPM_LDOB 0x626F646C 22 + #define QCOM_SMD_RPM_LDOE 0x656f646c 22 23 #define QCOM_SMD_RPM_RWCX 0x78637772 23 24 #define QCOM_SMD_RPM_RWMX 0x786d7772 24 25 #define QCOM_SMD_RPM_RWLC 0x636c7772 ··· 33 32 #define QCOM_SMD_RPM_QUP_CLK 0x707571 34 33 #define QCOM_SMD_RPM_SMPA 0x61706d73 35 34 #define QCOM_SMD_RPM_SMPB 0x62706d73 35 + #define QCOM_SMD_RPM_SMPE 0x65706d73 36 36 #define QCOM_SMD_RPM_SPDM 0x63707362 37 37 #define QCOM_SMD_RPM_VSA 0x00617376 38 38 #define QCOM_SMD_RPM_MMAXI_CLK 0x69786d6d
+2 -11
lib/test_linear_ranges.c
··· 107 107 #define SMALLEST_VAL RANGE1_MIN 108 108 109 109 static struct linear_range testr[] = { 110 - { 111 - .min = RANGE1_MIN, 112 - .min_sel = RANGE1_MIN_SEL, 113 - .max_sel = RANGE1_MAX_SEL, 114 - .step = RANGE1_STEP, 115 - }, { 116 - .min = RANGE2_MIN, 117 - .min_sel = RANGE2_MIN_SEL, 118 - .max_sel = RANGE2_MAX_SEL, 119 - .step = RANGE2_STEP 120 - }, 110 + LINEAR_RANGE(RANGE1_MIN, RANGE1_MIN_SEL, RANGE1_MAX_SEL, RANGE1_STEP), 111 + LINEAR_RANGE(RANGE2_MIN, RANGE2_MIN_SEL, RANGE2_MAX_SEL, RANGE2_STEP), 121 112 }; 122 113 123 114 static void range_test_get_value(struct kunit *test)