Commit d40c8745 authored by Linus Torvalds's avatar Linus Torvalds

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

Pull regulator updates from Mark Brown:
 "The core work this time around has mostly been around the code to
  manage regulator modes, simplifying the interface for configuring
  modes to not take account of the voltage and as a side effect
  resolving a bootstrapping issue on systems where we can't read the
  voltage from the regulator.

  Otherwise it's been quite a quiet release with some new drivers and a
  devm helper:

   - Make the load handling in the Qualcomm RPMH regulators much more
     idiomatic and general cleanups to the handling of load
     configuration

   - devm helper for a combined get and enable operation

   - Support for MediaTek MT6331, Qualcomm PM660, 660L and PM6125, Texas
     Instruments TPS65219"

* tag 'regulator-v6.1' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (45 commits)
  dt-bindings: gpio-regulator: add vin-supply property support
  regulator: gpio: Add input_supply support in gpio_regulator_config
  regulator: tps65219: Fix is_enabled checking in tps65219_set_bypass
  regulator: qcom,rpmh: add pm660 and pm660l pmics
  regulator: qcom-rpmh: add pm660 and pm660l pmics
  regulator: of: Fix kernel-doc
  regulator: of: Fix kernel-doc
  regulator: Add driver for MT6332 PMIC regulators
  regulator: Add bindings for MT6332 regulator
  regulator: Add driver for MT6331 PMIC regulators
  regulator: Add bindings for MT6331 regulator
  regulator: tps65219: Fix .bypass_val_on setting
  regulator: qcom_rpm: Fix circular deferral regression
  regulator: core: Prevent integer underflow
  regulator: dt-bindings: qcom,rpmh: Indicate regulator-allow-set-load dependencies
  regulator: bd9576: switch to using devm_fwnode_gpiod_get()
  regulator: bd71815: switch to using devm_fwnode_gpiod_get()
  regulator: core: Fix regulator supply registration with sysfs
  regulator: tps65219: change tps65219_regulator_irq_types to static
  regulator: core: Don't err if allow-set-load but no allowed-modes
  ...
parents 521d04e3 392cc0a4
......@@ -83,6 +83,7 @@ properties:
regulators:
type: object
additionalProperties: false
description: |
List of regulators provided by the device
......
......@@ -85,6 +85,9 @@ properties:
- current
default: voltage
vin-supply:
description: Input supply phandle.
required:
- compatible
- regulator-name
......
......@@ -79,6 +79,7 @@ patternProperties:
patternProperties:
regulator-state-(standby|mem|disk):
type: object
additionalProperties: true
properties:
regulator-mode: false
......
......@@ -111,6 +111,7 @@ properties:
regulators:
type: object
additionalProperties: false
description:
List of child nodes that specify the regulators.
......
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/mediatek,mt6331-regulator.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: MT6331 Regulator from MediaTek Integrated
maintainers:
- AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
description: |
The MT6331 PMIC provides 6 BUCK and 21 LDO (Low Dropout) regulators
and nodes are named according to the regulator type:
buck-<name> and ldo-<name>.
MT6331 regulators node should be sub node of the MT6397 MFD node.
patternProperties:
"^buck-v(core2|io18|dvfs11|dvfs12|dvfs13|dvfs14)$":
type: object
$ref: "regulator.yaml#"
properties:
regulator-name:
pattern: "^v(core2|io18|dvfs11|dvfs12|dvfs13|dvfs14)$"
unevaluatedProperties: false
"^ldo-v(avdd32aud|auxa32)$":
type: object
$ref: "regulator.yaml#"
properties:
regulator-name:
pattern: "^v(avdd32aud|auxa32)$"
unevaluatedProperties: false
"^ldo-v(dig18|emc33|ibr|mc|mch|mipi|rtc|sram|usb10)$":
type: object
$ref: "regulator.yaml#"
properties:
regulator-name:
pattern: "^v(dig18|emc33|ibr|mc|mch|mipi|rtc|sram|usb10)$"
unevaluatedProperties: false
"^ldo-vcam(a|af|d|io)$":
type: object
$ref: "regulator.yaml#"
properties:
regulator-name:
pattern: "^vcam(a|af|d|io)$"
unevaluatedProperties: false
"^ldo-vtcxo[12]$":
type: object
$ref: "regulator.yaml#"
properties:
regulator-name:
pattern: "^vtcxo[12]$"
required:
- regulator-name
unevaluatedProperties: false
"^ldo-vgp[1234]$":
type: object
$ref: "regulator.yaml#"
properties:
regulator-name:
pattern: "^vgp[12]$"
required:
- regulator-name
unevaluatedProperties: false
additionalProperties: false
examples:
- |
pmic {
regulators {
mt6331_vdvfs11_reg: buck-vdvfs11 {
regulator-name = "vdvfs11";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1493750>;
regulator-ramp-delay = <12500>;
regulator-enable-ramp-delay = <1>;
regulator-allowed-modes = <0 1>;
};
mt6331_vdvfs12_reg: buck-vdvfs12 {
regulator-name = "vdvfs12";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1493750>;
regulator-ramp-delay = <12500>;
regulator-enable-ramp-delay = <1>;
regulator-allowed-modes = <0 1>;
};
mt6331_vdvfs13_reg: buck-vdvfs13 {
regulator-name = "vdvfs13";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1493750>;
regulator-ramp-delay = <12500>;
regulator-enable-ramp-delay = <1>;
regulator-allowed-modes = <0 1>;
};
mt6331_vdvfs14_reg: buck-vdvfs14 {
regulator-name = "vdvfs14";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1493750>;
regulator-ramp-delay = <12500>;
regulator-enable-ramp-delay = <1>;
regulator-allowed-modes = <0 1>;
};
mt6331_vcore2_reg: buck-vcore2 {
regulator-name = "vcore2";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1493750>;
regulator-ramp-delay = <12500>;
regulator-enable-ramp-delay = <1>;
regulator-allowed-modes = <0 1>;
};
mt6331_vio18_reg: buck-vio18 {
regulator-name = "vio18";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-ramp-delay = <12500>;
regulator-enable-ramp-delay = <0>;
regulator-allowed-modes = <0 1>;
};
mt6331_vtcxo1_reg: ldo-vtcxo1 {
regulator-name = "vtcxo1";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
regulator-always-on;
regulator-boot-on;
};
mt6331_vtcxo2_reg: ldo-vtcxo2 {
regulator-name = "vtcxo2";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
regulator-always-on;
regulator-boot-on;
};
mt6331_avdd32_aud_reg: ldo-avdd32aud {
regulator-name = "avdd32_aud";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <3200000>;
};
mt6331_vauxa32_reg: ldo-vauxa32 {
regulator-name = "vauxa32";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <3200000>;
};
mt6331_vcama_reg: ldo-vcama {
regulator-name = "vcama";
regulator-min-microvolt = <1500000>;
regulator-max-microvolt = <2800000>;
regulator-always-on;
};
mt6331_vio28_reg: ldo-vio28 {
regulator-name = "vio28";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
regulator-always-on;
regulator-boot-on;
};
mt6331_vcamaf_reg: ldo-vcamaf {
regulator-name = "vcam_af";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3300000>;
};
mt6331_vmc_reg: ldo-vmc {
regulator-name = "vmc";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <3300000>;
};
mt6331_vmch_reg: ldo-vmch {
regulator-name = "vmch";
regulator-min-microvolt = <3000000>;
regulator-max-microvolt = <3300000>;
};
mt6331_vemc33_reg: ldo-vemc33 {
regulator-name = "vemc33";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
mt6331_vgp1_reg: ldo-vgp1 {
regulator-name = "vgp1";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3300000>;
};
mt6331_vsim1_reg: ldo-vsim1 {
regulator-name = "vsim1";
regulator-min-microvolt = <1700000>;
regulator-max-microvolt = <3100000>;
};
mt6331_vsim2_reg: ldo-vsim2 {
regulator-name = "vsim2";
regulator-min-microvolt = <1700000>;
regulator-max-microvolt = <3100000>;
};
mt6331_vmipi_reg: ldo-vmipi {
regulator-name = "vmipi";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3300000>;
};
mt6331_vibr_reg: ldo-vibr {
regulator-name = "vibr";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <3300000>;
};
mt6331_vgp4_reg: ldo-vgp4 {
regulator-name = "vgp4";
regulator-min-microvolt = <1600000>;
regulator-max-microvolt = <2200000>;
};
mt6331_vcamd_reg: ldo-vcamd {
regulator-name = "vcamd";
regulator-min-microvolt = <900000>;
regulator-max-microvolt = <1500000>;
};
mt6331_vusb10_reg: ldo-vusb10 {
regulator-name = "vusb";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1300000>;
regulator-boot-on;
};
mt6331_vcamio_reg: ldo-vcamio {
regulator-name = "vcam_io";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1800000>;
};
mt6331_vsram_reg: ldo-vsram {
regulator-name = "vsram";
regulator-min-microvolt = <1012500>;
regulator-max-microvolt = <1012500>;
regulator-always-on;
regulator-boot-on;
};
mt6331_vgp2_reg: ldo-vgp2 {
regulator-name = "vgp2";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1500000>;
regulator-boot-on;
};
mt6331_vgp3_reg: ldo-vgp3 {
regulator-name = "vgp3";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1800000>;
};
mt6331_vrtc_reg: ldo-vrtc {
regulator-name = "vrtc";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
regulator-always-on;
};
mt6331_vdig18_reg: ldo-vdig18 {
regulator-name = "dvdd18_dig";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
};
};
};
...
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/mediatek,mt6332-regulator.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: MT6332 Regulator from MediaTek Integrated
maintainers:
- AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
description: |
The MT6332 Companion PMIC provides 6 BUCK and 4 LDO (Low Dropout)
regulators and nodes are named according to the regulator type:
buck-<name> and ldo-<name>.
MT6332 regulators node should be sub node of the MT6397 MFD node.
patternProperties:
"^buck-v(dram|dvfs2|pa|rf18a|rf18b|sbst)$":
type: object
$ref: "regulator.yaml#"
properties:
regulator-name:
pattern: "^v(dram|dvfs2|pa|rf18a|rf18b|sbst)$"
unevaluatedProperties: false
"^ldo-v(bif28|dig18|sram|usb33)$":
type: object
$ref: "regulator.yaml#"
properties:
regulator-name:
pattern: "^v(bif28|dig18|sram|usb33)$"
unevaluatedProperties: false
additionalProperties: false
examples:
- |
pmic {
regulators {
mt6332_vdram_reg: buck-vdram {
regulator-name = "vdram";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1493750>;
regulator-ramp-delay = <12500>;
regulator-allowed-modes = <0 1>;
regulator-always-on;
};
mt6332_vdvfs2_reg: buck-vdvfs2 {
regulator-name = "vdvfs2";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1312500>;
regulator-ramp-delay = <12500>;
regulator-enable-ramp-delay = <1>;
regulator-allowed-modes = <0 1>;
};
mt6332_vpa_reg: buck-vpa {
regulator-name = "vpa";
regulator-min-microvolt = <500000>;
regulator-max-microvolt = <3400000>;
};
mt6332_vrf18a_reg: buck-vrf18a {
regulator-name = "vrf18a";
regulator-min-microvolt = <1050000>;
regulator-max-microvolt = <2240625>;
regulator-allowed-modes = <0 1>;
};
mt6332_vrf18b_reg: buck-vrf18b {
regulator-name = "vrf18b";
regulator-min-microvolt = <1050000>;
regulator-max-microvolt = <2240625>;
regulator-allowed-modes = <0 1>;
};
mt6332_vsbst_reg: buck-vsbst {
regulator-name = "vsbst";
regulator-min-microvolt = <3500000>;
regulator-max-microvolt = <7468750>;
};
mt6332_vauxb32_reg: ldo-vauxb32 {
regulator-name = "vauxb32";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <3200000>;
};
mt6332_vbif28_reg: ldo-vbif28 {
regulator-name = "vbif28";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
};
mt6332_vdig18_reg: ldo-vdig18 {
regulator-name = "vdig18";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
mt6332_vsram_reg: ldo-vsram {
regulator-name = "vauxa32";
regulator-min-microvolt = <700000>;
regulator-max-microvolt = <1493750>;
regulator-always-on;
};
mt6332_vusb33_reg: ldo-vusb33 {
regulator-name = "vusb33";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
};
};
...
......@@ -29,6 +29,7 @@ properties:
"^vbuck[1-4]$":
type: object
$ref: "regulator.yaml#"
unevaluatedProperties: false
properties:
regulator-compatible:
......
......@@ -37,6 +37,8 @@ description: |
For PM6150, smps1 - smps5, ldo1 - ldo19
For PM6150L, smps1 - smps8, ldo1 - ldo11, bob
For PM6350, smps1 - smps5, ldo1 - ldo22
For PM660, smps1 - smps6, ldo1 - ldo3, ldo5 - ldo19
For PM660L, smps1 - smps3, smps5, ldo1 - ldo8, bob
For PM7325, smps1 - smps8, ldo1 - ldo19
For PM8005, smps1 - smps4
For PM8009, smps1 - smps2, ldo1 - ldo7
......@@ -57,6 +59,8 @@ properties:
- qcom,pm6150-rpmh-regulators
- qcom,pm6150l-rpmh-regulators
- qcom,pm6350-rpmh-regulators
- qcom,pm660-rpmh-regulators
- qcom,pm660l-rpmh-regulators
- qcom,pm7325-rpmh-regulators
- qcom,pm8005-rpmh-regulators
- qcom,pm8009-rpmh-regulators
......@@ -99,12 +103,16 @@ properties:
type: object
$ref: "regulator.yaml#"
description: BOB regulator node.
dependencies:
regulator-allow-set-load: ["regulator-allowed-modes"]
patternProperties:
"^(smps|ldo|lvs)[0-9]+$":
type: object
$ref: "regulator.yaml#"
description: smps/ldo regulator nodes(s).
dependencies:
regulator-allow-set-load: ["regulator-allowed-modes"]
required:
- compatible
......@@ -144,6 +152,38 @@ allOf:
patternProperties:
"^vdd-s[1-8]-supply$": true
- if:
properties:
compatible:
enum:
- qcom,pm660-rpmh-regulators
then:
properties:
vdd-l1-l6-l7-supply: true
vdd-l2-l3-supply: true
vdd-l5-supply: true
vdd-l8-l9-l10-l11-l12-l13-l14-supply: true
vdd-l15-l16-l17-l18-l19-supply: true
patternProperties:
"^vdd-s[1-6]-supply$": true
- if:
properties:
compatible:
enum:
- qcom,pm660l-rpmh-regulators
then:
properties:
vdd-bob-supply:
description: BOB regulator parent supply phandle.
vdd-l1-l9-l10-supply: true
vdd-l2-supply: true
vdd-l3-l5-l7-l8-supply: true
vdd-l4-l6-supply: true
vdd-s3-s4-supply: true
patternProperties:
"^vdd-s[125]-supply$": true
- if:
properties:
compatible:
......
......@@ -24,6 +24,17 @@ description:
For mp5496, s2
For pm2250, s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22
For pm6125 s1, s2, s3, s4, s5, s6, s7, s8, l1, l2, l3, l5, l6, l7, l8, l9,
l10, l22, l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24
For pm660, s1, s2, s3, s4, s5, s6, l1, l2, l3, l5, l6, l7, l8, l9, l10, l22,
l12, l13, l14, l15, l16, l17, l18, l19
For pm660l s1, s2, s3, s5, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, bob
For pm8226, s1, s2, s3, s4, s5, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10,
l11, l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22, l23, l24, l25,
l26, l27, l28, lvs1
......@@ -52,11 +63,6 @@ description:
l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19,
l20, l21, l22, l23, l24, l25, l26, l27, l28, lvs1, lvs2
For pm660, s1, s2, s3, s4, s5, s6, l1, l2, l3, l5, l6, l7, l8, l9, l10, l22,
l12, l13, l14, l15, l16, l17, l18, l19
For pm660l s1, s2, s3, s5, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, bob
For pma8084, s1, s2, s3, s4, s5, s6, s7, s8, s9, s10, s11, s12, l1, l2, l3,
l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15, l16, l17, l18, l19,
l20, l21, l22, l23, l24, l25, l26, l27, lvs1, lvs2, lvs3, lvs4, 5vs1
......@@ -68,9 +74,6 @@ description:
For pms405, s1, s2, s3, s4, s5, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
l12, l13
For pm2250, s1, s2, s3, s4, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
l12, l13, l14, l15, l16, l17, l18, l19, l20, l21, l22
maintainers:
- Andy Gross <agross@kernel.org>
- Bjorn Andersson <bjorn.andersson@linaro.org>
......@@ -79,6 +82,10 @@ properties:
compatible:
enum:
- qcom,rpm-mp5496-regulators
- qcom,rpm-pm2250-regulators
- qcom,rpm-pm6125-regulators
- qcom,rpm-pm660-regulators
- qcom,rpm-pm660l-regulators
- qcom,rpm-pm8226-regulators
- qcom,rpm-pm8841-regulators
- qcom,rpm-pm8909-regulators
......@@ -88,13 +95,10 @@ properties:
- qcom,rpm-pm8953-regulators
- qcom,rpm-pm8994-regulators
- qcom,rpm-pm8998-regulators
- qcom,rpm-pm660-regulators
- qcom,rpm-pm660l-regulators
- qcom,rpm-pma8084-regulators
- qcom,rpm-pmi8994-regulators
- qcom,rpm-pmi8998-regulators
- qcom,rpm-pms405-regulators
- qcom,rpm-pm2250-regulators
patternProperties:
".*-supply$":
......
......@@ -12,6 +12,7 @@ maintainers:
properties:
compatible:
enum:
- qcom,pm6125-regulators
- qcom,pm660-regulators
- qcom,pm660l-regulators
- qcom,pm8004-regulators
......@@ -105,6 +106,25 @@ required:
- compatible
allOf:
- if:
properties:
compatible:
contains:
enum:
- qcom,pm6125-regulators
then:
properties:
vdd_l1_l7_l17_l18-supply: true
vdd_l2_l3_l4-supply: true
vdd_l5_l15_l19_l20_l21_l22-supply: true
vdd_l6_l8-supply: true
vdd_l9_l11-supply: true
vdd_l10_l13_l14-supply: true
vdd_l12_l16-supply: true
vdd_l23_l24-supply: true
patternProperties:
"^vdd_s[1-8]-supply$": true
- if:
properties:
compatible:
......@@ -120,6 +140,7 @@ allOf:
vdd_l8_l9_l10_l11_l12_l13_l14-supply: true
patternProperties:
"^vdd_s[1-6]-supply$": true
- if:
properties:
compatible:
......@@ -134,6 +155,7 @@ allOf:
vdd_l4_l6-supply: true
patternProperties:
"^vdd_s[1-5]-supply$": true
- if:
properties:
compatible:
......@@ -143,6 +165,7 @@ allOf:
then:
patternProperties:
"^vdd_s[25]-supply$": true
- if:
properties:
compatible:
......@@ -152,6 +175,7 @@ allOf:
then:
patternProperties:
"^vdd_s[1-4]-supply$": true
- if:
properties:
compatible:
......@@ -171,6 +195,7 @@ allOf:
vdd_lvs1-supply: true
patternProperties:
"^vdd_s[1-5]-supply$": true
- if:
properties:
compatible:
......@@ -180,6 +205,7 @@ allOf:
then:
patternProperties:
"^vdd_s[1-8]-supply$": true
- if:
properties:
compatible:
......@@ -195,6 +221,7 @@ allOf:
patternProperties:
"^vdd_l[27]-supply$": true
"^vdd_s[1-4]-supply$": true
- if:
properties:
compatible:
......@@ -223,6 +250,7 @@ allOf:
vin_5vs-supply: true
patternProperties:
"^vdd_s[1-3]-supply$": true
- if:
properties:
compatible:
......@@ -241,6 +269,7 @@ allOf:
vdd_l9_l10_l13_l14_l15_l18-supply: true
patternProperties:
"^vdd_s[1-6]-supply$": true
- if:
properties:
compatible:
......@@ -265,6 +294,7 @@ allOf:
vdd_lvs_1_2-supply: true
patternProperties:
"^vdd_s[1-9][0-2]?-supply$": true
- if:
properties:
compatible:
......@@ -276,6 +306,7 @@ allOf:
vdd_l1-supply: true
patternProperties:
"^vdd_s[1-3]-supply$": true
- if:
properties:
compatible:
......@@ -291,6 +322,7 @@ allOf:
patternProperties:
"^vdd_l[479]-supply$": true
"^vdd_s[1-5]-supply$": true
- if:
properties:
compatible:
......
......@@ -20,6 +20,7 @@ properties:
lab:
type: object
additionalProperties: false
properties:
qcom,soft-start-us:
......@@ -33,11 +34,19 @@ properties:
description:
Short-circuit and over-current interrupts for lab.
interrupt-names:
minItems: 1
items:
- const: sc-err
- const: ocp
required:
- interrupts
- interrupt-names
ibb:
type: object
additionalProperties: false
properties:
qcom,discharge-resistor-kohms:
......@@ -52,8 +61,15 @@ properties:
description:
Short-circuit and over-current interrupts for ibb.
interrupt-names:
minItems: 1
items:
- const: sc-err
- const: ocp
required:
- interrupts
- interrupt-names
required:
- compatible
......
......@@ -42,6 +42,7 @@ patternProperties:
"^DSV(P|N)$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single display bias regulator.
......
......@@ -27,6 +27,7 @@ properties:
description:
properties for wled regulator
$ref: regulator.yaml#
unevaluatedProperties: false
properties:
regulator-name:
......
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/ti,tps65219.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: TI tps65219 Power Management Integrated Circuit regulators
maintainers:
- Jerome Neanne <jerome.neanne@baylibre.com>
description: |
Regulator nodes should be named to buck<number> and ldo<number>.
properties:
compatible:
enum:
- ti,tps65219
reg:
maxItems: 1
system-power-controller:
type: boolean
description: Optional property that indicates that this device is
controlling system power.
interrupts:
description: Short-circuit, over-current, under-voltage for regulators, PB interrupts.
maxItems: 1
interrupt-controller: true
'#interrupt-cells':
description: Specifies the PIN numbers and Flags, as defined in
include/dt-bindings/interrupt-controller/irq.h
const: 1
ti,power-button:
type: boolean
description: |
Optional property that sets the EN/PB/VSENSE pin to be a
power-button.
TPS65219 has a multipurpose pin called EN/PB/VSENSE that can be either
1. EN in which case it functions as an enable pin.
2. VSENSE which compares the voltages and triggers an automatic
on/off request.
3. PB in which case it can be configured to trigger an interrupt
to the SoC.
ti,power-button reflects the last one of those options
where the board has a button wired to the pin and triggers
an interrupt on pressing it.
patternProperties:
"^buck[1-3]-supply$":
description: Input supply phandle of one regulator.
"^ldo[1-4]-supply$":
description: Input supply phandle of one regulator.
regulators:
type: object
description: |
list of regulators provided by this controller
patternProperties:
"^ldo[1-4]$":
type: object
$ref: regulator.yaml#
description:
Properties for single LDO regulator.
unevaluatedProperties: false
"^buck[1-3]$":
type: object
$ref: regulator.yaml#
description:
Properties for single BUCK regulator.
unevaluatedProperties: false
additionalProperties: false
required:
- compatible
- reg
- interrupts
- regulators
additionalProperties: false
examples:
- |
#include <dt-bindings/interrupt-controller/arm-gic.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
tps65219: pmic@30 {
compatible = "ti,tps65219";
reg = <0x30>;
buck1-supply = <&vcc_3v3_sys>;
buck2-supply = <&vcc_3v3_sys>;
buck3-supply = <&vcc_3v3_sys>;
ldo1-supply = <&vcc_3v3_sys>;
ldo2-supply = <&buck2_reg>;
ldo3-supply = <&vcc_3v3_sys>;
ldo4-supply = <&vcc_3v3_sys>;
pinctrl-0 = <&pmic_irq_pins_default>;
interrupt-parent = <&gic500>;
interrupts = <GIC_SPI 224 IRQ_TYPE_LEVEL_HIGH>;
ti,power-button;
regulators {
buck1_reg: buck1 {
regulator-name = "VDD_CORE";
regulator-min-microvolt = <750000>;
regulator-max-microvolt = <750000>;
regulator-boot-on;
regulator-always-on;
};
buck2_reg: buck2 {
regulator-name = "VCC1V8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-boot-on;
regulator-always-on;
};
buck3_reg: buck3 {
regulator-name = "VDD_LPDDR4";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1100000>;
regulator-boot-on;
regulator-always-on;
};
ldo1_reg: ldo1 {
regulator-name = "VDDSHV_SD_IO_PMIC";
regulator-min-microvolt = <33000000>;
regulator-max-microvolt = <33000000>;
};
ldo2_reg: ldo2 {
regulator-name = "VDDAR_CORE";
regulator-min-microvolt = <850000>;
regulator-max-microvolt = <850000>;
regulator-boot-on;
regulator-always-on;
};
ldo3_reg: ldo3 {
regulator-name = "VDDA_1V8";
regulator-min-microvolt = <18000000>;
regulator-max-microvolt = <18000000>;
regulator-boot-on;
regulator-always-on;
};
ldo4_reg: ldo4 {
regulator-name = "VDD_PHY_2V5";
regulator-min-microvolt = <25000000>;
regulator-max-microvolt = <25000000>;
regulator-boot-on;
regulator-always-on;
};
};
};
};
......@@ -407,10 +407,21 @@ PWM
devm_fwnode_pwm_get()
REGULATOR
devm_regulator_bulk_register_supply_alias()
devm_regulator_bulk_get()
devm_regulator_bulk_get_enable()
devm_regulator_bulk_put()
devm_regulator_get()
devm_regulator_get_enable()
devm_regulator_get_enable_optional()
devm_regulator_get_exclusive()
devm_regulator_get_optional()
devm_regulator_irq_helper()
devm_regulator_put()
devm_regulator_register()
devm_regulator_register_notifier()
devm_regulator_register_supply_alias()
devm_regulator_unregister_notifier()
RESET
devm_reset_control_get()
......
......@@ -14957,6 +14957,7 @@ F: drivers/regulator/palmas-regulator*.c
F: drivers/regulator/pbias-regulator.c
F: drivers/regulator/tps65217-regulator.c
F: drivers/regulator/tps65218-regulator.c
F: drivers/regulator/tps65219-regulator.c
F: drivers/regulator/tps65910-regulator.c
F: drivers/regulator/twl-regulator.c
F: drivers/regulator/twl6030-regulator.c
......
......@@ -787,6 +787,24 @@ config REGULATOR_MT6323
This driver supports the control of different power rails of device
through regulator interface.
config REGULATOR_MT6331
tristate "MediaTek MT6331 PMIC"
depends on MFD_MT6397
help
Say y here to select this option to enable the power regulator of
MediaTek MT6331 PMIC.
This driver supports the control of different power rails of device
through regulator interface
config REGULATOR_MT6332
tristate "MediaTek MT6332 PMIC"
depends on MFD_MT6397
help
Say y here to select this option to enable the power regulator of
MediaTek MT6332 PMIC.
This driver supports the control of different power rails of device
through regulator interface
config REGULATOR_MT6358
tristate "MediaTek MT6358 PMIC"
depends on MFD_MT6397
......@@ -1384,6 +1402,15 @@ config REGULATOR_TPS65218
voltage regulators. It supports software based voltage control
for different voltage domains
config REGULATOR_TPS65219
tristate "TI TPS65219 Power regulators"
depends on MFD_TPS65219 && OF
help
This driver supports TPS65219 voltage regulator chips.
TPS65219 series of PMICs have 3 single phase BUCKs & 4 LDOs
voltage regulators. It supports software based voltage control
for different voltage domains.
config REGULATOR_TPS6524X
tristate "TI TPS6524X Power regulators"
depends on SPI
......
......@@ -95,6 +95,8 @@ obj-$(CONFIG_REGULATOR_MPQ7920) += mpq7920.o
obj-$(CONFIG_REGULATOR_MT6311) += mt6311-regulator.o
obj-$(CONFIG_REGULATOR_MT6315) += mt6315-regulator.o
obj-$(CONFIG_REGULATOR_MT6323) += mt6323-regulator.o
obj-$(CONFIG_REGULATOR_MT6331) += mt6331-regulator.o
obj-$(CONFIG_REGULATOR_MT6332) += mt6332-regulator.o
obj-$(CONFIG_REGULATOR_MT6358) += mt6358-regulator.o
obj-$(CONFIG_REGULATOR_MT6359) += mt6359-regulator.o
obj-$(CONFIG_REGULATOR_MT6360) += mt6360-regulator.o
......@@ -162,6 +164,7 @@ obj-$(CONFIG_REGULATOR_TPS65086) += tps65086-regulator.o
obj-$(CONFIG_REGULATOR_TPS65090) += tps65090-regulator.o
obj-$(CONFIG_REGULATOR_TPS65217) += tps65217-regulator.o
obj-$(CONFIG_REGULATOR_TPS65218) += tps65218-regulator.o
obj-$(CONFIG_REGULATOR_TPS65219) += tps65219-regulator.o
obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o
obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
......
......@@ -571,11 +571,10 @@ static int bd7181x_probe(struct platform_device *pdev)
dev_err(&pdev->dev, "No parent regmap\n");
return -ENODEV;
}
ldo4_en = devm_gpiod_get_from_of_node(&pdev->dev,
pdev->dev.parent->of_node,
"rohm,vsel-gpios", 0,
GPIOD_ASIS, "ldo4-en");
ldo4_en = devm_fwnode_gpiod_get(&pdev->dev,
dev_fwnode(pdev->dev.parent),
"rohm,vsel", GPIOD_ASIS, "ldo4-en");
if (IS_ERR(ldo4_en)) {
ret = PTR_ERR(ldo4_en);
if (ret != -ENOENT)
......
......@@ -12,6 +12,7 @@
#include <linux/module.h>
#include <linux/of.h>
#include <linux/platform_device.h>
#include <linux/property.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
......@@ -939,8 +940,8 @@ static int bd957x_probe(struct platform_device *pdev)
}
ic_data->regmap = regmap;
vout_mode = of_property_read_bool(pdev->dev.parent->of_node,
"rohm,vout1-en-low");
vout_mode = device_property_read_bool(pdev->dev.parent,
"rohm,vout1-en-low");
if (vout_mode) {
struct gpio_desc *en;
......@@ -948,10 +949,10 @@ static int bd957x_probe(struct platform_device *pdev)
/* VOUT1 enable state judged by VOUT1_EN pin */
/* See if we have GPIO defined */
en = devm_gpiod_get_from_of_node(&pdev->dev,
pdev->dev.parent->of_node,
"rohm,vout1-en-gpios", 0,
GPIOD_OUT_LOW, "vout1-en");
en = devm_fwnode_gpiod_get(&pdev->dev,
dev_fwnode(pdev->dev.parent),
"rohm,vout1-en", GPIOD_OUT_LOW,
"vout1-en");
if (!IS_ERR(en)) {
/* VOUT1_OPS gpio ctrl */
/*
......@@ -986,8 +987,8 @@ static int bd957x_probe(struct platform_device *pdev)
* like DDR voltage selection.
*/
platform_set_drvdata(pdev, ic_data);
ddr_sel = of_property_read_bool(pdev->dev.parent->of_node,
"rohm,ddr-sel-low");
ddr_sel = device_property_read_bool(pdev->dev.parent,
"rohm,ddr-sel-low");
if (ddr_sel)
ic_data->regulator_data[2].desc.fixed_uV = 1350000;
else
......
......@@ -977,12 +977,27 @@ static int drms_uA_update(struct regulator_dev *rdev)
rdev_err(rdev, "failed to set load %d: %pe\n",
current_uA, ERR_PTR(err));
} else {
/*
* Unfortunately in some cases the constraints->valid_ops has
* REGULATOR_CHANGE_DRMS but there are no valid modes listed.
* That's not really legit but we won't consider it a fatal
* error here. We'll treat it as if REGULATOR_CHANGE_DRMS
* wasn't set.
*/
if (!rdev->constraints->valid_modes_mask) {
rdev_dbg(rdev, "Can change modes; but no valid mode\n");
return 0;
}
/* get output voltage */
output_uV = regulator_get_voltage_rdev(rdev);
if (output_uV <= 0) {
rdev_err(rdev, "invalid output voltage found\n");
return -EINVAL;
}
/*
* Don't return an error; if regulator driver cares about
* output_uV then it's up to the driver to validate.
*/
if (output_uV <= 0)
rdev_dbg(rdev, "invalid output voltage found\n");
/* get input voltage */
input_uV = 0;
......@@ -990,10 +1005,13 @@ static int drms_uA_update(struct regulator_dev *rdev)
input_uV = regulator_get_voltage(rdev->supply);
if (input_uV <= 0)
input_uV = rdev->constraints->input_uV;
if (input_uV <= 0) {
rdev_err(rdev, "invalid input voltage found\n");
return -EINVAL;
}
/*
* Don't return an error; if regulator driver cares about
* input_uV then it's up to the driver to validate.
*/
if (input_uV <= 0)
rdev_dbg(rdev, "invalid input voltage found\n");
/* now get the optimum mode for our new total regulator load */
mode = rdev->desc->ops->get_optimum_mode(rdev, input_uV,
......@@ -2681,7 +2699,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
* return -ETIMEDOUT.
*/
if (rdev->desc->poll_enabled_time) {
unsigned int time_remaining = delay;
int time_remaining = delay;
while (time_remaining > 0) {
_regulator_delay_helper(rdev->desc->poll_enabled_time);
......@@ -3502,10 +3520,8 @@ static int _regulator_set_voltage_time(struct regulator_dev *rdev,
(new_uV < old_uV))
return rdev->constraints->settling_time_down;
if (ramp_delay == 0) {
rdev_dbg(rdev, "ramp_delay not set\n");
if (ramp_delay == 0)
return 0;
}
return DIV_ROUND_UP(abs(new_uV - old_uV), ramp_delay);
}
......@@ -5398,6 +5414,7 @@ regulator_register(const struct regulator_desc *regulator_desc,
bool dangling_of_gpiod = false;
struct device *dev;
int ret, i;
bool resolved_early = false;
if (cfg == NULL)
return ERR_PTR(-EINVAL);
......@@ -5501,24 +5518,10 @@ regulator_register(const struct regulator_desc *regulator_desc,
BLOCKING_INIT_NOTIFIER_HEAD(&rdev->notifier);
INIT_DELAYED_WORK(&rdev->disable_work, regulator_disable_work);
/* preform any regulator specific init */
if (init_data && init_data->regulator_init) {
ret = init_data->regulator_init(rdev->reg_data);
if (ret < 0)
goto clean;
}
if (config->ena_gpiod) {
ret = regulator_ena_gpio_request(rdev, config);
if (ret != 0) {
rdev_err(rdev, "Failed to request enable GPIO: %pe\n",
ERR_PTR(ret));
goto clean;
}
/* The regulator core took over the GPIO descriptor */
dangling_cfg_gpiod = false;
dangling_of_gpiod = false;
}
if (init_data && init_data->supply_regulator)
rdev->supply_name = init_data->supply_regulator;
else if (regulator_desc->supply_name)
rdev->supply_name = regulator_desc->supply_name;
/* register with sysfs */
rdev->dev.class = &regulator_class;
......@@ -5540,13 +5543,38 @@ regulator_register(const struct regulator_desc *regulator_desc,
goto wash;
}
if (init_data && init_data->supply_regulator)
rdev->supply_name = init_data->supply_regulator;
else if (regulator_desc->supply_name)
rdev->supply_name = regulator_desc->supply_name;
if ((rdev->supply_name && !rdev->supply) &&
(rdev->constraints->always_on ||
rdev->constraints->boot_on)) {
ret = regulator_resolve_supply(rdev);
if (ret)
rdev_dbg(rdev, "unable to resolve supply early: %pe\n",
ERR_PTR(ret));
resolved_early = true;
}
/* perform any regulator specific init */
if (init_data && init_data->regulator_init) {
ret = init_data->regulator_init(rdev->reg_data);
if (ret < 0)
goto wash;
}
if (config->ena_gpiod) {
ret = regulator_ena_gpio_request(rdev, config);
if (ret != 0) {
rdev_err(rdev, "Failed to request enable GPIO: %pe\n",
ERR_PTR(ret));
goto wash;
}
/* The regulator core took over the GPIO descriptor */
dangling_cfg_gpiod = false;
dangling_of_gpiod = false;
}
ret = set_machine_constraints(rdev);
if (ret == -EPROBE_DEFER) {
if (ret == -EPROBE_DEFER && !resolved_early) {
/* Regulator might be in bypass mode and so needs its supply
* to set the constraints
*/
......
......@@ -70,6 +70,65 @@ struct regulator *devm_regulator_get_exclusive(struct device *dev,
}
EXPORT_SYMBOL_GPL(devm_regulator_get_exclusive);
static void regulator_action_disable(void *d)
{
struct regulator *r = (struct regulator *)d;
regulator_disable(r);
}
static int _devm_regulator_get_enable(struct device *dev, const char *id,
int get_type)
{
struct regulator *r;
int ret;
r = _devm_regulator_get(dev, id, get_type);
if (IS_ERR(r))
return PTR_ERR(r);
ret = regulator_enable(r);
if (!ret)
ret = devm_add_action_or_reset(dev, &regulator_action_disable, r);
if (ret)
devm_regulator_put(r);
return ret;
}
/**
* devm_regulator_get_enable_optional - Resource managed regulator get and enable
* @dev: device to supply
* @id: supply name or regulator ID.
*
* Get and enable regulator for duration of the device life-time.
* regulator_disable() and regulator_put() are automatically called on driver
* detach. See regulator_get_optional() and regulator_enable() for more
* information.
*/
int devm_regulator_get_enable_optional(struct device *dev, const char *id)
{
return _devm_regulator_get_enable(dev, id, OPTIONAL_GET);
}
EXPORT_SYMBOL_GPL(devm_regulator_get_enable_optional);
/**
* devm_regulator_get_enable - Resource managed regulator get and enable
* @dev: device to supply
* @id: supply name or regulator ID.
*
* Get and enable regulator for duration of the device life-time.
* regulator_disable() and regulator_put() are automatically called on driver
* detach. See regulator_get() and regulator_enable() for more
* information.
*/
int devm_regulator_get_enable(struct device *dev, const char *id)
{
return _devm_regulator_get_enable(dev, id, NORMAL_GET);
}
EXPORT_SYMBOL_GPL(devm_regulator_get_enable);
/**
* devm_regulator_get_optional - Resource managed regulator_get_optional()
* @dev: device to supply
......@@ -194,6 +253,111 @@ int devm_regulator_bulk_get_const(struct device *dev, int num_consumers,
}
EXPORT_SYMBOL_GPL(devm_regulator_bulk_get_const);
static int devm_regulator_bulk_match(struct device *dev, void *res,
void *data)
{
struct regulator_bulk_devres *match = res;
struct regulator_bulk_data *target = data;
/*
* We check the put uses same consumer list as the get did.
* We _could_ scan all entries in consumer array and check the
* regulators match but ATM I don't see the need. We can change this
* later if needed.
*/
return match->consumers == target;
}
/**
* devm_regulator_bulk_put - Resource managed regulator_bulk_put()
* @consumers: consumers to free
*
* Deallocate regulators allocated with devm_regulator_bulk_get(). Normally
* this function will not need to be called and the resource management
* code will ensure that the resource is freed.
*/
void devm_regulator_bulk_put(struct regulator_bulk_data *consumers)
{
int rc;
struct regulator *regulator = consumers[0].consumer;
rc = devres_release(regulator->dev, devm_regulator_bulk_release,
devm_regulator_bulk_match, consumers);
if (rc != 0)
WARN_ON(rc);
}
EXPORT_SYMBOL_GPL(devm_regulator_bulk_put);
static void devm_regulator_bulk_disable(void *res)
{
struct regulator_bulk_devres *devres = res;
int i;
for (i = 0; i < devres->num_consumers; i++)
regulator_disable(devres->consumers[i].consumer);
}
/**
* devm_regulator_bulk_get_enable - managed get'n enable multiple regulators
*
* @dev: device to supply
* @num_consumers: number of consumers to register
* @id: list of supply names or regulator IDs
*
* @return 0 on success, an errno on failure.
*
* This helper function allows drivers to get several regulator
* consumers in one operation with management, the regulators will
* automatically be freed when the device is unbound. If any of the
* regulators cannot be acquired then any regulators that were
* allocated will be freed before returning to the caller.
*/
int devm_regulator_bulk_get_enable(struct device *dev, int num_consumers,
const char * const *id)
{
struct regulator_bulk_devres *devres;
struct regulator_bulk_data *consumers;
int i, ret;
devres = devm_kmalloc(dev, sizeof(*devres), GFP_KERNEL);
if (!devres)
return -ENOMEM;
devres->consumers = devm_kcalloc(dev, num_consumers, sizeof(*consumers),
GFP_KERNEL);
consumers = devres->consumers;
if (!consumers)
return -ENOMEM;
devres->num_consumers = num_consumers;
for (i = 0; i < num_consumers; i++)
consumers[i].supply = id[i];
ret = devm_regulator_bulk_get(dev, num_consumers, consumers);
if (ret)
return ret;
for (i = 0; i < num_consumers; i++) {
ret = regulator_enable(consumers[i].consumer);
if (ret)
goto unwind;
}
ret = devm_add_action(dev, devm_regulator_bulk_disable, devres);
if (!ret)
return 0;
unwind:
while (--i >= 0)
regulator_disable(consumers[i].consumer);
devm_regulator_bulk_put(consumers);
return ret;
}
EXPORT_SYMBOL_GPL(devm_regulator_bulk_get_enable);
static void devm_rdev_release(struct device *dev, void *res)
{
regulator_unregister(*(struct regulator_dev **)res);
......
......@@ -220,6 +220,9 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
regtype);
}
if (of_find_property(np, "vin-supply", NULL))
config->input_supply = "vin";
return config;
}
......@@ -259,6 +262,18 @@ static int gpio_regulator_probe(struct platform_device *pdev)
drvdata->gpiods = devm_kzalloc(dev, sizeof(struct gpio_desc *),
GFP_KERNEL);
if (config->input_supply) {
drvdata->desc.supply_name = devm_kstrdup(&pdev->dev,
config->input_supply,
GFP_KERNEL);
if (!drvdata->desc.supply_name) {
dev_err(&pdev->dev,
"Failed to allocate input supply\n");
return -ENOMEM;
}
}
if (!drvdata->gpiods)
return -ENOMEM;
for (i = 0; i < config->ngpios; i++) {
......
......@@ -137,7 +137,7 @@ static int max597x_set_ovp(struct regulator_dev *rdev, int lim_uV, int severity,
static int max597x_set_ocp(struct regulator_dev *rdev, int lim_uA,
int severity, bool enable)
{
int ret, val, reg;
int val, reg;
unsigned int vthst, vthfst;
struct max597x_regulator *data = rdev_get_drvdata(rdev);
......@@ -183,9 +183,8 @@ static int max597x_set_ocp(struct regulator_dev *rdev, int lim_uA,
val = 0xFF;
reg = MAX5970_REG_DAC_FAST(rdev_id);
ret = regmap_write(rdev->regmap, reg, val);
return ret;
return regmap_write(rdev->regmap, reg, val);
}
static int max597x_get_status(struct regulator_dev *rdev)
......
This diff is collapsed.
This diff is collapsed.
......@@ -676,7 +676,7 @@ bool of_check_coupling_data(struct regulator_dev *rdev)
}
/**
* of_parse_coupled regulator - Get regulator_dev pointer from rdev's property
* of_parse_coupled_regulator() - Get regulator_dev pointer from rdev's property
* @rdev: Pointer to regulator_dev, whose DTS is used as a source to parse
* "regulator-coupled-with" property
* @index: Index in phandles array
......
......@@ -306,9 +306,10 @@ static unsigned int rpmh_regulator_vrm_get_mode(struct regulator_dev *rdev)
}
/**
* rpmh_regulator_vrm_set_load() - set the regulator mode based upon the load
* current requested
* rpmh_regulator_vrm_get_optimum_mode() - get the mode based on the load
* @rdev: Regulator device pointer for the rpmh-regulator
* @input_uV: Input voltage
* @output_uV: Output voltage
* @load_uA: Aggregated load current in microamps
*
* This function is used in the regulator_ops for VRM type RPMh regulator
......@@ -316,17 +317,15 @@ static unsigned int rpmh_regulator_vrm_get_mode(struct regulator_dev *rdev)
*
* Return: 0 on success, errno on failure
*/
static int rpmh_regulator_vrm_set_load(struct regulator_dev *rdev, int load_uA)
static unsigned int rpmh_regulator_vrm_get_optimum_mode(
struct regulator_dev *rdev, int input_uV, int output_uV, int load_uA)
{
struct rpmh_vreg *vreg = rdev_get_drvdata(rdev);
unsigned int mode;
if (load_uA >= vreg->hw_data->hpm_min_load_uA)
mode = REGULATOR_MODE_NORMAL;
return REGULATOR_MODE_NORMAL;
else
mode = REGULATOR_MODE_IDLE;
return rpmh_regulator_vrm_set_mode(rdev, mode);
return REGULATOR_MODE_IDLE;
}
static int rpmh_regulator_vrm_set_bypass(struct regulator_dev *rdev,
......@@ -375,7 +374,7 @@ static const struct regulator_ops rpmh_regulator_vrm_drms_ops = {
.list_voltage = regulator_list_voltage_linear_range,
.set_mode = rpmh_regulator_vrm_set_mode,
.get_mode = rpmh_regulator_vrm_get_mode,
.set_load = rpmh_regulator_vrm_set_load,
.get_optimum_mode = rpmh_regulator_vrm_get_optimum_mode,
};
static const struct regulator_ops rpmh_regulator_vrm_bypass_ops = {
......@@ -1199,6 +1198,52 @@ static const struct rpmh_vreg_init_data pmr735a_vreg_data[] = {
{}
};
static const struct rpmh_vreg_init_data pm660_vreg_data[] = {
RPMH_VREG("smps1", "smp%s1", &pmic4_ftsmps426, "vdd-s1"),
RPMH_VREG("smps2", "smp%s2", &pmic4_ftsmps426, "vdd-s2"),
RPMH_VREG("smps3", "smp%s3", &pmic4_ftsmps426, "vdd-s3"),
RPMH_VREG("smps4", "smp%s4", &pmic4_hfsmps3, "vdd-s4"),
RPMH_VREG("smps5", "smp%s5", &pmic4_hfsmps3, "vdd-s5"),
RPMH_VREG("smps6", "smp%s6", &pmic4_hfsmps3, "vdd-s6"),
RPMH_VREG("ldo1", "ldo%s1", &pmic4_nldo, "vdd-l1-l6-l7"),
RPMH_VREG("ldo2", "ldo%s2", &pmic4_nldo, "vdd-l2-l3"),
RPMH_VREG("ldo3", "ldo%s3", &pmic4_nldo, "vdd-l2-l3"),
/* ldo4 is inaccessible on PM660 */
RPMH_VREG("ldo5", "ldo%s5", &pmic4_nldo, "vdd-l5"),
RPMH_VREG("ldo6", "ldo%s6", &pmic4_nldo, "vdd-l1-l6-l7"),
RPMH_VREG("ldo7", "ldo%s7", &pmic4_nldo, "vdd-l1-l6-l7"),
RPMH_VREG("ldo8", "ldo%s8", &pmic4_pldo_lv, "vdd-l8-l9-l10-l11-l12-l13-l14"),
RPMH_VREG("ldo9", "ldo%s9", &pmic4_pldo_lv, "vdd-l8-l9-l10-l11-l12-l13-l14"),
RPMH_VREG("ldo10", "ldo%s10", &pmic4_pldo_lv, "vdd-l8-l9-l10-l11-l12-l13-l14"),
RPMH_VREG("ldo11", "ldo%s11", &pmic4_pldo_lv, "vdd-l8-l9-l10-l11-l12-l13-l14"),
RPMH_VREG("ldo12", "ldo%s12", &pmic4_pldo_lv, "vdd-l8-l9-l10-l11-l12-l13-l14"),
RPMH_VREG("ldo13", "ldo%s13", &pmic4_pldo_lv, "vdd-l8-l9-l10-l11-l12-l13-l14"),
RPMH_VREG("ldo14", "ldo%s14", &pmic4_pldo_lv, "vdd-l8-l9-l10-l11-l12-l13-l14"),
RPMH_VREG("ldo15", "ldo%s15", &pmic4_pldo, "vdd-l15-l16-l17-l18-l19"),
RPMH_VREG("ldo16", "ldo%s16", &pmic4_pldo, "vdd-l15-l16-l17-l18-l19"),
RPMH_VREG("ldo17", "ldo%s17", &pmic4_pldo, "vdd-l15-l16-l17-l18-l19"),
RPMH_VREG("ldo18", "ldo%s18", &pmic4_pldo, "vdd-l15-l16-l17-l18-l19"),
RPMH_VREG("ldo19", "ldo%s19", &pmic4_pldo, "vdd-l15-l16-l17-l18-l19"),
{}
};
static const struct rpmh_vreg_init_data pm660l_vreg_data[] = {
RPMH_VREG("smps1", "smp%s1", &pmic4_ftsmps426, "vdd-s1"),
RPMH_VREG("smps2", "smp%s2", &pmic4_ftsmps426, "vdd-s2"),
RPMH_VREG("smps3", "smp%s3", &pmic4_ftsmps426, "vdd-s3-s4"),
RPMH_VREG("smps5", "smp%s5", &pmic4_ftsmps426, "vdd-s5"),
RPMH_VREG("ldo1", "ldo%s1", &pmic4_nldo, "vdd-l1-l9-l10"),
RPMH_VREG("ldo2", "ldo%s2", &pmic4_pldo, "vdd-l2"),
RPMH_VREG("ldo3", "ldo%s3", &pmic4_pldo, "vdd-l3-l5-l7-l8"),
RPMH_VREG("ldo4", "ldo%s4", &pmic4_pldo, "vdd-l4-l6"),
RPMH_VREG("ldo5", "ldo%s5", &pmic4_pldo, "vdd-l3-l5-l7-l8"),
RPMH_VREG("ldo6", "ldo%s6", &pmic4_pldo, "vdd-l4-l6"),
RPMH_VREG("ldo7", "ldo%s7", &pmic4_pldo, "vdd-l3-l5-l7-l8"),
RPMH_VREG("ldo8", "ldo%s8", &pmic4_pldo, "vdd-l3-l5-l7-l8"),
RPMH_VREG("bob", "bob%s1", &pmic4_bob, "vdd-bob"),
{}
};
static int rpmh_regulator_probe(struct platform_device *pdev)
{
struct device *dev = &pdev->dev;
......@@ -1321,6 +1366,14 @@ static const struct of_device_id __maybe_unused rpmh_regulator_match_table[] = {
.compatible = "qcom,pmr735a-rpmh-regulators",
.data = pmr735a_vreg_data,
},
{
.compatible = "qcom,pm660-rpmh-regulators",
.data = pm660_vreg_data,
},
{
.compatible = "qcom,pm660l-rpmh-regulators",
.data = pm660l_vreg_data,
},
{}
};
MODULE_DEVICE_TABLE(of, rpmh_regulator_match_table);
......
......@@ -802,6 +802,12 @@ static const struct rpm_regulator_data rpm_pm8018_regulators[] = {
};
static const struct rpm_regulator_data rpm_pm8058_regulators[] = {
{ "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" },
{ "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" },
{ "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" },
{ "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" },
{ "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" },
{ "l0", QCOM_RPM_PM8058_LDO0, &pm8058_nldo, "vdd_l0_l1_lvs" },
{ "l1", QCOM_RPM_PM8058_LDO1, &pm8058_nldo, "vdd_l0_l1_lvs" },
{ "l2", QCOM_RPM_PM8058_LDO2, &pm8058_pldo, "vdd_l2_l11_l12" },
......@@ -829,12 +835,6 @@ static const struct rpm_regulator_data rpm_pm8058_regulators[] = {
{ "l24", QCOM_RPM_PM8058_LDO24, &pm8058_nldo, "vdd_l23_l24_l25" },
{ "l25", QCOM_RPM_PM8058_LDO25, &pm8058_nldo, "vdd_l23_l24_l25" },
{ "s0", QCOM_RPM_PM8058_SMPS0, &pm8058_smps, "vdd_s0" },
{ "s1", QCOM_RPM_PM8058_SMPS1, &pm8058_smps, "vdd_s1" },
{ "s2", QCOM_RPM_PM8058_SMPS2, &pm8058_smps, "vdd_s2" },
{ "s3", QCOM_RPM_PM8058_SMPS3, &pm8058_smps, "vdd_s3" },
{ "s4", QCOM_RPM_PM8058_SMPS4, &pm8058_smps, "vdd_s4" },
{ "lvs0", QCOM_RPM_PM8058_LVS0, &pm8058_switch, "vdd_l0_l1_lvs" },
{ "lvs1", QCOM_RPM_PM8058_LVS1, &pm8058_switch, "vdd_l0_l1_lvs" },
......@@ -843,6 +843,12 @@ static const struct rpm_regulator_data rpm_pm8058_regulators[] = {
};
static const struct rpm_regulator_data rpm_pm8901_regulators[] = {
{ "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" },
{ "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" },
{ "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" },
{ "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" },
{ "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" },
{ "l0", QCOM_RPM_PM8901_LDO0, &pm8901_nldo, "vdd_l0" },
{ "l1", QCOM_RPM_PM8901_LDO1, &pm8901_pldo, "vdd_l1" },
{ "l2", QCOM_RPM_PM8901_LDO2, &pm8901_pldo, "vdd_l2" },
......@@ -851,12 +857,6 @@ static const struct rpm_regulator_data rpm_pm8901_regulators[] = {
{ "l5", QCOM_RPM_PM8901_LDO5, &pm8901_pldo, "vdd_l5" },
{ "l6", QCOM_RPM_PM8901_LDO6, &pm8901_pldo, "vdd_l6" },
{ "s0", QCOM_RPM_PM8901_SMPS0, &pm8901_ftsmps, "vdd_s0" },
{ "s1", QCOM_RPM_PM8901_SMPS1, &pm8901_ftsmps, "vdd_s1" },
{ "s2", QCOM_RPM_PM8901_SMPS2, &pm8901_ftsmps, "vdd_s2" },
{ "s3", QCOM_RPM_PM8901_SMPS3, &pm8901_ftsmps, "vdd_s3" },
{ "s4", QCOM_RPM_PM8901_SMPS4, &pm8901_ftsmps, "vdd_s4" },
{ "lvs0", QCOM_RPM_PM8901_LVS0, &pm8901_switch, "lvs0_in" },
{ "lvs1", QCOM_RPM_PM8901_LVS1, &pm8901_switch, "lvs1_in" },
{ "lvs2", QCOM_RPM_PM8901_LVS2, &pm8901_switch, "lvs2_in" },
......
This diff is collapsed.
This diff is collapsed.
......@@ -151,7 +151,7 @@ static inline void ti_abb_clear_txdone(const struct ti_abb *abb)
};
/**
* ti_abb_wait_tranx() - waits for ABB tranxdone event
* ti_abb_wait_txdone() - waits for ABB tranxdone event
* @dev: device
* @abb: pointer to the abb instance
*
......
This diff is collapsed.
......@@ -207,6 +207,8 @@ struct regulator *__must_check regulator_get_optional(struct device *dev,
const char *id);
struct regulator *__must_check devm_regulator_get_optional(struct device *dev,
const char *id);
int devm_regulator_get_enable(struct device *dev, const char *id);
int devm_regulator_get_enable_optional(struct device *dev, const char *id);
void regulator_put(struct regulator *regulator);
void devm_regulator_put(struct regulator *regulator);
......@@ -244,12 +246,15 @@ int __must_check regulator_bulk_get(struct device *dev, int num_consumers,
struct regulator_bulk_data *consumers);
int __must_check devm_regulator_bulk_get(struct device *dev, int num_consumers,
struct regulator_bulk_data *consumers);
void devm_regulator_bulk_put(struct regulator_bulk_data *consumers);
int __must_check devm_regulator_bulk_get_const(
struct device *dev, int num_consumers,
const struct regulator_bulk_data *in_consumers,
struct regulator_bulk_data **out_consumers);
int __must_check regulator_bulk_enable(int num_consumers,
struct regulator_bulk_data *consumers);
int devm_regulator_bulk_get_enable(struct device *dev, int num_consumers,
const char * const *id);
int regulator_bulk_disable(int num_consumers,
struct regulator_bulk_data *consumers);
int regulator_bulk_force_disable(int num_consumers,
......@@ -354,6 +359,17 @@ devm_regulator_get_exclusive(struct device *dev, const char *id)
return ERR_PTR(-ENODEV);
}
static inline int devm_regulator_get_enable(struct device *dev, const char *id)
{
return -ENODEV;
}
static inline int devm_regulator_get_enable_optional(struct device *dev,
const char *id)
{
return -ENODEV;
}
static inline struct regulator *__must_check
regulator_get_optional(struct device *dev, const char *id)
{
......@@ -375,6 +391,10 @@ static inline void devm_regulator_put(struct regulator *regulator)
{
}
static inline void devm_regulator_bulk_put(struct regulator_bulk_data *consumers)
{
}
static inline int regulator_register_supply_alias(struct device *dev,
const char *id,
struct device *alias_dev,
......@@ -465,6 +485,13 @@ static inline int regulator_bulk_enable(int num_consumers,
return 0;
}
static inline int devm_regulator_bulk_get_enable(struct device *dev,
int num_consumers,
const char * const *id)
{
return 0;
}
static inline int regulator_bulk_disable(int num_consumers,
struct regulator_bulk_data *consumers)
{
......
......@@ -42,6 +42,7 @@ struct gpio_regulator_state {
/**
* struct gpio_regulator_config - config structure
* @supply_name: Name of the regulator supply
* @input_supply: Name of the input regulator supply
* @enabled_at_boot: Whether regulator has been enabled at
* boot or not. 1 = Yes, 0 = No
* This is used to keep the regulator at
......@@ -62,6 +63,7 @@ struct gpio_regulator_state {
*/
struct gpio_regulator_config {
const char *supply_name;
const char *input_supply;
unsigned enabled_at_boot:1;
unsigned startup_delay;
......
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#ifndef __LINUX_REGULATOR_MT6331_H
#define __LINUX_REGULATOR_MT6331_H
enum {
/* BUCK */
MT6331_ID_VDVFS11 = 0,
MT6331_ID_VDVFS12,
MT6331_ID_VDVFS13,
MT6331_ID_VDVFS14,
MT6331_ID_VCORE2,
MT6331_ID_VIO18,
/* LDO */
MT6331_ID_VTCXO1,
MT6331_ID_VTCXO2,
MT6331_ID_AVDD32_AUD,
MT6331_ID_VAUXA32,
MT6331_ID_VCAMA,
MT6331_ID_VIO28,
MT6331_ID_VCAM_AF,
MT6331_ID_VMC,
MT6331_ID_VMCH,
MT6331_ID_VEMC33,
MT6331_ID_VGP1,
MT6331_ID_VSIM1,
MT6331_ID_VSIM2,
MT6331_ID_VMIPI,
MT6331_ID_VIBR,
MT6331_ID_VGP4,
MT6331_ID_VCAMD,
MT6331_ID_VUSB10,
MT6331_ID_VCAM_IO,
MT6331_ID_VSRAM_DVFS1,
MT6331_ID_VGP2,
MT6331_ID_VGP3,
MT6331_ID_VRTC,
MT6331_ID_VDIG18,
MT6331_ID_VREG_MAX
};
#endif /* __LINUX_REGULATOR_MT6331_H */
/* SPDX-License-Identifier: GPL-2.0-only */
/*
* Copyright (c) 2022 Collabora Ltd.
* Author: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com>
*/
#ifndef __LINUX_REGULATOR_MT6332_H
#define __LINUX_REGULATOR_MT6332_H
enum {
/* BUCK */
MT6332_ID_VDRAM = 0,
MT6332_ID_VDVFS2,
MT6332_ID_VPA,
MT6332_ID_VRF1,
MT6332_ID_VRF2,
MT6332_ID_VSBST,
/* LDO */
MT6332_ID_VAUXB32,
MT6332_ID_VBIF28,
MT6332_ID_VDIG18,
MT6332_ID_VSRAM_DVFS2,
MT6332_ID_VUSB33,
MT6332_ID_VREG_MAX
};
#endif /* __LINUX_REGULATOR_MT6332_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment