regulator: Updates for v6.4

A fairly quiet release, there were some cleanup and a couple of new
 devices but the biggest change was converting most of the drivers to use
 asynchronous probe.  This allows us to ramp up multiple regulators in
 parallel during boot which can have a noticable impact on modern
 systems.
 
  - Update of drivers to PROBE_PREFER_ASYNCHRONOUS to mitigate issues
    with ramp times slowing down boots.
  - Convert to void remove callbacks.
  - Support for voltage monitoring on DA9063
  - Support for Qualcomm PMC8180 and PMM8654au, Richtek RT4803 and
    RT5739, Rockchip RK860x,
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmRGfzcACgkQJNaLcl1U
 h9B5oAgAgNkRTmrHDzuyFZD0JUt6Wy0jewxNH7Ie5ucYEPNPaWGfPDvJkpjDZ/iB
 UTPrhFAvNfVX2Z2E3Pdx4jhvbq3chlavpDaMWEqnimdfIqqqHLPEiRtVG2DiXAub
 2AKS8piy136EDtWf4/HCoKiLf5Osr4i6bpOUoaHoNIqTtjhu2p7FXC9rjuRsmQgC
 8kiA/fsLRcdzyhQb86myl4QktYiWTCrHzP7jpKlHAHRf5OBozapGgPR2Ih/cNoTR
 0lbdvst1arkUr1wMGqvYAg1UjlAmA9TA/1kkm6j98G6ruuUzeay9bGN9tCk4SMjf
 kAXks6ohTS9VvqN5ykrjm/2WF/Y9yA==
 =AJNv
 -----END PGP SIGNATURE-----

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

Pull regulator updates from Mark Brown:
 "A fairly quiet release, there were some cleanup and a couple of new
  devices but the biggest change was converting most of the drivers to
  use asynchronous probe. This allows us to ramp up multiple regulators
  in parallel during boot which can have a noticable impact on modern
  systems.

  Summary:

   - Update of drivers to PROBE_PREFER_ASYNCHRONOUS to mitigate issues
     with ramp times slowing down boots.

   - Convert to void remove callbacks.

   - Support for voltage monitoring on DA9063

   - Support for Qualcomm PMC8180 and PMM8654au, Richtek RT4803 and
     RT5739, Rockchip RK860x"

* tag 'regulator-v6.4' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (46 commits)
  regulator: dt-bindings: qcom,rpmh: Combine PM6150L and PM8150L if-then
  regulator: core: Make regulator_lock_two() logic easier to follow
  regulator: dt-bindings: qcom,rpmh: Correct PM8550 family supplies
  regulator: stm32-pwr: fix of_iomap leak
  dt-bindings: mfd: dlg,da9063: document voltage monitoring
  regulator: da9063: implement setter for voltage monitoring
  regulator: da9063: add voltage monitoring registers
  regulator: fan53555: Add support for RK860X
  regulator: fan53555: Use dev_err_probe
  regulator: fan53555: Improve vsel_mask computation
  regulator: fan53555: Make use of the bit macros
  regulator: fan53555: Remove unused *_SLEW_SHIFT definitions
  regulator: dt-bindings: fcs,fan53555: Add support for RK860X
  regulator: qcom_smd: Add MP5496 S1 regulator
  regulator: qcom_smd: Add s1 sub-node to mp5496 regulator
  regulator: qcom,rpmh: add compatible for pmm8654au RPMH
  regulator: qcom-rpmh: add support for pmm8654au regulators
  regulator: core: Avoid lockdep reports when resolving supplies
  regulator: core: Consistently set mutex_owner when using ww_mutex_lock_slow()
  regulator: dt-bindings: qcom,rpmh: Add compatible for PMC8180
  ...
This commit is contained in:
Linus Torvalds 2023-04-25 17:13:47 -07:00
commit d84955790e
224 changed files with 1475 additions and 271 deletions

View File

@ -12,6 +12,11 @@ maintainers:
description: |
For device-tree bindings of other sub-modules refer to the binding documents
under the respective sub-system directories.
Using regulator-{uv,ov}-{warn,error,protection}-microvolt requires special
handling: First, when GP_FB2 is used, it must be ensured that there is no
moment where all voltage monitors are disabled. Next, as da9063 only supports
UV *and* OV monitoring, both must be set to the same severity and value
(0: disable, 1: enable).
properties:
compatible:
@ -121,11 +126,19 @@ examples:
regulator-max-microamp = <2000000>;
regulator-boot-on;
};
ldo6 {
/* UNUSED */
regulator-name = "LDO_6";
regulator-uv-protection-microvolt = <0>;
regulator-ov-protection-microvolt = <0>;
};
ldo11 {
regulator-name = "LDO_11";
regulator-min-microvolt = <900000>;
regulator-max-microvolt = <3600000>;
regulator-boot-on;
regulator-max-microvolt = <900000>;
regulator-uv-protection-microvolt = <1>;
regulator-ov-protection-microvolt = <1>;
regulator-always-on;
};
};
};

View File

@ -10,7 +10,7 @@ maintainers:
- Ying-Chun Liu (PaulLiu) <paul.liu@linaro.org>
allOf:
- $ref: "regulator.yaml#"
- $ref: regulator.yaml#
properties:
compatible:
@ -19,43 +19,43 @@ properties:
regulator-name: true
anatop-reg-offset:
$ref: '/schemas/types.yaml#/definitions/uint32'
$ref: /schemas/types.yaml#/definitions/uint32
description: u32 value representing the anatop MFD register offset.
anatop-vol-bit-shift:
$ref: '/schemas/types.yaml#/definitions/uint32'
$ref: /schemas/types.yaml#/definitions/uint32
description: u32 value representing the bit shift for the register.
anatop-vol-bit-width:
$ref: '/schemas/types.yaml#/definitions/uint32'
$ref: /schemas/types.yaml#/definitions/uint32
description: u32 value representing the number of bits used in the register.
anatop-min-bit-val:
$ref: '/schemas/types.yaml#/definitions/uint32'
$ref: /schemas/types.yaml#/definitions/uint32
description: u32 value representing the minimum value of this register.
anatop-min-voltage:
$ref: '/schemas/types.yaml#/definitions/uint32'
$ref: /schemas/types.yaml#/definitions/uint32
description: u32 value representing the minimum voltage of this regulator.
anatop-max-voltage:
$ref: '/schemas/types.yaml#/definitions/uint32'
$ref: /schemas/types.yaml#/definitions/uint32
description: u32 value representing the maximum voltage of this regulator.
anatop-delay-reg-offset:
$ref: '/schemas/types.yaml#/definitions/uint32'
$ref: /schemas/types.yaml#/definitions/uint32
description: u32 value representing the anatop MFD step time register offset.
anatop-delay-bit-shift:
$ref: '/schemas/types.yaml#/definitions/uint32'
$ref: /schemas/types.yaml#/definitions/uint32
description: u32 value representing the bit shift for the step time register.
anatop-delay-bit-width:
$ref: '/schemas/types.yaml#/definitions/uint32'
$ref: /schemas/types.yaml#/definitions/uint32
description: u32 value representing the number of bits used in the step time register.
anatop-enable-bit:
$ref: '/schemas/types.yaml#/definitions/uint32'
$ref: /schemas/types.yaml#/definitions/uint32
description: u32 value representing regulator enable bit offset.
vin-supply:

View File

@ -109,7 +109,7 @@ properties:
description: Specify a valid GPIO for platform control of the regulator
dlg,ripple-cancel:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
enum: [ 0, 1, 2, 3 ]
description: |
Defined in include/dt-bindings/regulator/dlg,da9121-regulator.h

View File

@ -14,12 +14,21 @@ allOf:
properties:
compatible:
enum:
- fcs,fan53555
- fcs,fan53526
- silergy,syr827
- silergy,syr828
- tcs,tcs4525
oneOf:
- enum:
- fcs,fan53555
- fcs,fan53526
- rockchip,rk8600
- rockchip,rk8602
- silergy,syr827
- silergy,syr828
- tcs,tcs4525
- items:
- const: rockchip,rk8601
- const: rockchip,rk8600
- items:
- const: rockchip,rk8603
- const: rockchip,rk8602
reg:
maxItems: 1

View File

@ -17,7 +17,7 @@ description:
to be the same.
allOf:
- $ref: "regulator.yaml#"
- $ref: regulator.yaml#
- if:
properties:
compatible:

View File

@ -14,7 +14,7 @@ description:
regulator.yaml, can also be used.
allOf:
- $ref: "regulator.yaml#"
- $ref: regulator.yaml#
properties:
compatible:

View File

@ -15,7 +15,7 @@ description:
regulator.txt, can also be used.
allOf:
- $ref: "regulator.yaml#"
- $ref: regulator.yaml#
properties:
compatible:

View File

@ -25,7 +25,7 @@ properties:
patternProperties:
"^regulator-(ldo|sbb[0-2])$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
unevaluatedProperties: false
required:

View File

@ -25,7 +25,7 @@ properties:
patternProperties:
"^regulator-.+$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
unevaluatedProperties: false
additionalProperties: false

View File

@ -25,7 +25,7 @@ properties:
patternProperties:
"^(ldo[1-5]|buck)$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
additionalProperties: false

View File

@ -18,7 +18,7 @@ description: |
patternProperties:
"^buck-v(core2|io18|dvfs11|dvfs12|dvfs13|dvfs14)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -28,7 +28,7 @@ patternProperties:
"^ldo-v(avdd32aud|auxa32)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -38,7 +38,7 @@ patternProperties:
"^ldo-v(dig18|emc33|ibr|mc|mch|mipi|rtc|sram|usb10)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -48,7 +48,7 @@ patternProperties:
"^ldo-vcam(a|af|d|io)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -58,7 +58,7 @@ patternProperties:
"^ldo-vtcxo[12]$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -71,7 +71,7 @@ patternProperties:
"^ldo-vgp[1234]$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:

View File

@ -18,7 +18,7 @@ description: |
patternProperties:
"^buck-v(dram|dvfs2|pa|rf18a|rf18b|sbst)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -28,7 +28,7 @@ patternProperties:
"^ldo-v(bif28|dig18|sram|usb33)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:

View File

@ -28,11 +28,11 @@ properties:
patternProperties:
"^buck[1-4]$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
type: object
"^ldo[1-4]$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
type: object
additionalProperties: false

View File

@ -28,7 +28,7 @@ properties:
mps,fb-voltage-divider:
description: An array of two integers containing the resistor
values R1 and R2 of the feedback voltage divider in kilo ohms.
$ref: "/schemas/types.yaml#/definitions/uint32-array"
$ref: /schemas/types.yaml#/definitions/uint32-array
maxItems: 2
mps,switch-frequency-hz:

View File

@ -29,7 +29,7 @@ properties:
properties:
mps,switch-freq:
$ref: "/schemas/types.yaml#/definitions/uint8"
$ref: /schemas/types.yaml#/definitions/uint8
enum: [0, 1, 2, 3]
default: 2
description: |
@ -51,14 +51,14 @@ properties:
properties:
mps,buck-softstart:
$ref: "/schemas/types.yaml#/definitions/uint8"
$ref: /schemas/types.yaml#/definitions/uint8
enum: [0, 1, 2, 3]
description: |
defines the soft start time of this buck, must be one of the following
corresponding values 150us, 300us, 610us, 920us
mps,buck-phase-delay:
$ref: "/schemas/types.yaml#/definitions/uint8"
$ref: /schemas/types.yaml#/definitions/uint8
enum: [0, 1, 2, 3]
description: |
defines the phase delay of this buck, must be one of the following

View File

@ -28,7 +28,7 @@ properties:
patternProperties:
"^vbuck[1-4]$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
unevaluatedProperties: false
properties:

View File

@ -17,7 +17,7 @@ description: |
patternProperties:
"^buck_v(s1|gpu11|modem|pu|core|s2|pa|proc2|proc1|core_sshub)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -27,7 +27,7 @@ patternProperties:
"^ldo_v(ibr|rf12|usb|camio|efuse|xo22)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -37,7 +37,7 @@ patternProperties:
"^ldo_v(rfck|emc|a12|a09|ufs|bbck)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -47,7 +47,7 @@ patternProperties:
"^ldo_vcn(18|13|33_1_bt|13_1_wifi|33_2_bt|33_2_wifi)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -57,7 +57,7 @@ patternProperties:
"^ldo_vsram_(proc2|others|md|proc1|others_sshub)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -67,7 +67,7 @@ patternProperties:
"^ldo_v(fe|bif|io)28$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -77,7 +77,7 @@ patternProperties:
"^ldo_v(aud|io|aux|rf|m)18$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:
@ -87,7 +87,7 @@ patternProperties:
"^ldo_vsim[12]$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
regulator-name:

View File

@ -26,11 +26,11 @@ properties:
patternProperties:
"^buck[12]$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
unevaluatedProperties: false
"^ldo[123567]$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
unevaluatedProperties: false
required:

View File

@ -57,7 +57,7 @@ properties:
properties:
nxp,dvs-run-voltage:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 600000
maximum: 2187500
description:
@ -65,7 +65,7 @@ properties:
dvs(dynamic voltage scaling) property.
nxp,dvs-standby-voltage:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 600000
maximum: 2187500
description:

View File

@ -38,12 +38,6 @@ properties:
description:
Properties for single LDO regulator.
properties:
regulator-name:
pattern: "^ldo[1-4]$"
description:
should be "ldo1", ..., "ldo4"
unevaluatedProperties: false
"^buck[1-7]$":
@ -53,13 +47,8 @@ properties:
Properties for single BUCK regulator.
properties:
regulator-name:
pattern: "^buck[1-7]$"
description:
should be "buck1", ..., "buck7"
nxp,ilim-ma:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 2100
maximum: 4500
deprecated: true
@ -75,7 +64,7 @@ properties:
4500
nxp,phase-shift:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
default: 0
enum: [ 0, 45, 90, 135, 180, 225, 270, 315 ]
description:
@ -90,12 +79,6 @@ properties:
description:
Properties for single VSNVS regulator.
properties:
regulator-name:
pattern: "^vsnvs$"
description:
should be "vsnvs"
unevaluatedProperties: false
additionalProperties: false

View File

@ -63,19 +63,19 @@ properties:
patternProperties:
"^sw([1-4]|[1-4][a-c]|[1-4][a-c][a-c])$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
type: object
"^vgen[1-6]$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
type: object
"^vldo[1-4]$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
type: object
"^(vsnvs|vref|vrefddr|swbst|coin|v33|vccsd)$":
$ref: "regulator.yaml#"
$ref: regulator.yaml#
type: object
additionalProperties: false

View File

@ -75,9 +75,12 @@ properties:
- qcom,pm8550ve-rpmh-regulators
- qcom,pm8550vs-rpmh-regulators
- qcom,pm8998-rpmh-regulators
- qcom,pmc8180-rpmh-regulators
- qcom,pmc8180c-rpmh-regulators
- qcom,pmg1110-rpmh-regulators
- qcom,pmi8998-rpmh-regulators
- qcom,pmm8155au-rpmh-regulators
- qcom,pmm8654au-rpmh-regulators
- qcom,pmr735a-rpmh-regulators
- qcom,pmx55-rpmh-regulators
- qcom,pmx65-rpmh-regulators
@ -105,18 +108,18 @@ properties:
bob:
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
description: BOB regulator node.
dependencies:
regulator-allow-set-load: ["regulator-allowed-modes"]
regulator-allow-set-load: [ regulator-allowed-modes ]
patternProperties:
"^(smps|ldo|lvs|bob)[0-9]+$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
description: smps/ldo regulator nodes(s).
dependencies:
regulator-allow-set-load: ["regulator-allowed-modes"]
regulator-allow-set-load: [ regulator-allowed-modes ]
required:
- compatible
@ -144,6 +147,8 @@ allOf:
compatible:
enum:
- qcom,pm6150l-rpmh-regulators
- qcom,pm8150l-rpmh-regulators
- qcom,pmc8180c-rpmh-regulators
then:
properties:
vdd-bob-supply:
@ -232,6 +237,7 @@ allOf:
compatible:
enum:
- qcom,pm8150-rpmh-regulators
- qcom,pmc8180-rpmh-regulators
- qcom,pmm8155au-rpmh-regulators
then:
properties:
@ -248,18 +254,17 @@ allOf:
properties:
compatible:
enum:
- qcom,pm8150l-rpmh-regulators
- qcom,pmm8654au-rpmh-regulators
then:
properties:
vdd-bob-supply:
description: BOB regulator parent supply phandle.
vdd-l1-l8-supply: true
vdd-l1-supply: true
vdd-l2-l3-supply: true
vdd-l4-l5-l6-supply: true
vdd-l7-l11-supply: true
vdd-l9-l10-supply: true
vdd-l4-supply: true
vdd-l5-supply: true
vdd-l6-l7-supply: true
vdd-l8-l9-supply: true
patternProperties:
"^vdd-s[1-8]-supply$": true
"^vdd-s[1-9]-supply$": true
- if:
properties:
@ -308,19 +313,29 @@ allOf:
compatible:
enum:
- qcom,pm8550-rpmh-regulators
- qcom,pm8550ve-rpmh-regulators
- qcom,pm8550vs-rpmh-regulators
then:
properties:
vdd-l1-l4-l10-supply: true
vdd-l2-l13-l14-supply: true
vdd-l5-l16-supply: true
vdd-l6-l7-supply: true
vdd-l8-l9-supply: true
patternProperties:
"^vdd-l([1-4]|1[0-7])-supply$": true
"^vdd-l(3|1[1-7])-supply$": true
"^vdd-s[1-6]-supply$": true
"^vdd-bob[1-2]-supply$": true
- if:
properties:
compatible:
enum:
- qcom,pm8550ve-rpmh-regulators
- qcom,pm8550vs-rpmh-regulators
then:
patternProperties:
"^vdd-l[1-3]-supply$": true
"^vdd-s[1-6]-supply$": true
- if:
properties:
compatible:

View File

@ -22,7 +22,7 @@ description:
Each sub-node is identified using the node's name, with valid values listed
for each of the pmics below.
For mp5496, s2
For mp5496, s1, 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

View File

@ -15,7 +15,7 @@ description: |
and control the backlight.
allOf:
- $ref: "regulator.yaml#"
- $ref: regulator.yaml#
properties:
compatible:

View File

@ -13,7 +13,7 @@ maintainers:
properties:
regulator-name:
description: A string used as a descriptive name for regulator outputs
$ref: "/schemas/types.yaml#/definitions/string"
$ref: /schemas/types.yaml#/definitions/string
regulator-min-microvolt:
description: smallest voltage consumers may set
@ -23,7 +23,7 @@ properties:
regulator-microvolt-offset:
description: Offset applied to voltages to compensate for voltage drops
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
regulator-min-microamp:
description: smallest current consumers may set
@ -59,7 +59,7 @@ properties:
description: ramp delay for regulator(in uV/us) For hardware which supports
disabling ramp rate, it should be explicitly initialised to zero (regulator-ramp-delay
= <0>) for disabling ramp delay.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
regulator-enable-ramp-delay:
description: The time taken, in microseconds, for the supply rail to
@ -68,7 +68,7 @@ properties:
required due to the combination of internal ramping of the regulator
itself, and board design issues such as trace capacitance and load
on the supply.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
regulator-settling-time-us:
description: Settling time, in microseconds, for voltage change if regulator
@ -95,7 +95,7 @@ properties:
description: initial operating mode. The set of possible operating modes
depends on the capabilities of every hardware so each device binding
documentation explains which values the regulator supports.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
regulator-allowed-modes:
description: list of operating modes that software is allowed to configure
@ -103,12 +103,12 @@ properties:
The set of possible operating modes depends on the capabilities of
every hardware so each device binding document explains which values
the regulator supports.
$ref: "/schemas/types.yaml#/definitions/uint32-array"
$ref: /schemas/types.yaml#/definitions/uint32-array
regulator-system-load:
description: Load in uA present on regulator that is not captured by
any consumer request.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
regulator-pull-down:
description: Enable pull down resistor when the regulator is disabled.
@ -206,14 +206,14 @@ properties:
0: Disable active discharge.
1: Enable active discharge.
Absence of this property will leave configuration to default.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1]
regulator-coupled-with:
description: Regulators with which the regulator is coupled. The linkage
is 2-way - all coupled regulators should be linked with each other.
A regulator should not be coupled with its supplier.
$ref: "/schemas/types.yaml#/definitions/phandle-array"
$ref: /schemas/types.yaml#/definitions/phandle-array
items:
maxItems: 1
@ -221,7 +221,7 @@ properties:
description: Array of maximum spread between voltages of coupled regulators
in microvolts, each value in the array relates to the corresponding
couple specified by the regulator-coupled-with property.
$ref: "/schemas/types.yaml#/definitions/uint32-array"
$ref: /schemas/types.yaml#/definitions/uint32-array
regulator-max-step-microvolt:
description: Maximum difference between current and target voltages
@ -269,7 +269,7 @@ patternProperties:
of possible operating modes depends on the capabilities of every
hardware so the valid modes are documented on each regulator device
tree binding document.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
additionalProperties: false

View File

@ -0,0 +1,68 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/richtek,rt4803.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Richtek RT4803 Boost Regulator
maintainers:
- ChiYuan Huang <cy_huang@richtek.com>
description: |
RT4803 is a boost regulator that's designed to provide the minimum output
voltage, even if the input voltage is lower than the required voltage. It
supports boost and auto bypass mode that depends on the difference between the
input and output voltage. If the input is lower than the output, mode will
transform to boost mode. Otherwise, turn on bypass switch to enter bypass mode.
Datasheet is available at
https://www.richtek.com/assets/product_file/RT4803/DS4803-03.pdf
https://www.richtek.com/assets/product_file/RT4803A/DS4803A-06.pdf
allOf:
- $ref: regulator.yaml#
properties:
compatible:
enum:
- richtek,rt4803
reg:
maxItems: 1
richtek,vsel-active-high:
type: boolean
description: Specify the VSEL register group is using when system is active
regulator-allowed-modes:
description: |
Available operating mode
1: Auto PFM/PWM
2: Force PWM
items:
enum: [1, 2]
required:
- compatible
- reg
unevaluatedProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
regulator@75 {
compatible = "richtek,rt4803";
reg = <0x75>;
richtek,vsel-active-high;
regulator-name = "rt4803-regulator";
regulator-min-microvolt = <2850000>;
regulator-max-microvolt = <4400000>;
regulator-allowed-modes = <1 2>;
regulator-always-on;
};
};

View File

@ -0,0 +1,72 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/richtek,rt5739.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Richtek RT5739 Step-Down Buck Converter
maintainers:
- ChiYuan Huang <cy_huang@richtek.com>
description: |
The RT5739 is a step-down switching buck converter that can deliver the
programmable output voltage from 300mV to 1300mV with wide input voltage
supply of 2.5V to 5.5V. It can provide up to 3.5A continuous current
capability at over 80% high efficiency.
allOf:
- $ref: regulator.yaml#
properties:
compatible:
enum:
- richtek,rt5739
reg:
maxItems: 1
enable-gpios:
maxItems: 1
richtek,vsel-active-high:
description: |
If property is present, use the 'VSEL1' register group for buck control.
Else, use the 'VSEL0' register group. This depends on external hardware
'VSEL' pin connection.
type: boolean
regulator-allowed-modes:
description: |
buck allowed operating mode
0: Auto PFM/PWM mode
1: Forced PWM mode
items:
enum: [0, 1]
required:
- compatible
- reg
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
regulator@50 {
compatible = "richtek,rt5739";
reg = <0x50>;
enable-gpios = <&gpio26 1 GPIO_ACTIVE_HIGH>;
richtek,vsel-active-high;
regulator-name = "richtek,rt5739-buck";
regulator-min-microvolt = <300000>;
regulator-max-microvolt = <1300000>;
regulator-allowed-modes = <0 1>;
regulator-boot-on;
};
};

View File

@ -32,7 +32,7 @@ properties:
maxItems: 1
richtek,oc-level-select:
$ref: "/schemas/types.yaml#/definitions/uint8"
$ref: /schemas/types.yaml#/definitions/uint8
enum: [0, 1, 2, 3]
description: |
Over current level selection. Each respective value means the current
@ -40,7 +40,7 @@ properties:
in chip default.
richtek,ot-level-select:
$ref: "/schemas/types.yaml#/definitions/uint8"
$ref: /schemas/types.yaml#/definitions/uint8
enum: [0, 1, 2]
description: |
Over temperature level selection. Each respective value means the degree
@ -48,7 +48,7 @@ properties:
default.
richtek,pgdly-time-select:
$ref: "/schemas/types.yaml#/definitions/uint8"
$ref: /schemas/types.yaml#/definitions/uint8
enum: [0, 1, 2, 3]
description: |
Power good signal delay time selection. Each respective value means the
@ -57,7 +57,7 @@ properties:
richtek,switch-freq-select:
$ref: "/schemas/types.yaml#/definitions/uint8"
$ref: /schemas/types.yaml#/definitions/uint8
enum: [0, 1, 2]
description: |
Buck switch frequency selection. Each respective value means 400KHz,

View File

@ -120,7 +120,7 @@ properties:
lsw:
description: load switch current regulator description.
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
required:
- compatible

View File

@ -56,7 +56,7 @@ patternProperties:
PMIC "RUN" state voltage in uV when PMIC HW states are used. See
comments below for bucks/LDOs which support this. 0 means
regulator should be disabled at RUN state.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3300000
@ -67,7 +67,7 @@ patternProperties:
keeps regulator enabled. BD71815 does not change voltage level
when PMIC transitions to SNVS.SNVS voltage depends on the previous
state (from which the PMIC transitioned to SNVS).
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3300000
@ -76,7 +76,7 @@ patternProperties:
PMIC "SUSPEND" state voltage in uV when PMIC HW states are used. See
comments below for bucks/LDOs which support this. 0 means
regulator should be disabled at SUSPEND state.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3300000
@ -85,7 +85,7 @@ patternProperties:
PMIC "LPSR" state voltage in uV when PMIC HW states are used. See
comments below for bucks/LDOs which support this. 0 means
regulator should be disabled at LPSR state.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3300000

View File

@ -52,7 +52,7 @@ patternProperties:
description:
PMIC default "RUN" state voltage in uV. See below table for
bucks which support this. 0 means disabled.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3300000
@ -60,7 +60,7 @@ patternProperties:
description:
PMIC default "IDLE" state voltage in uV. See below table for
bucks which support this. 0 means disabled.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3300000
@ -68,7 +68,7 @@ patternProperties:
description:
PMIC default "SUSPEND" state voltage in uV. See below table for
bucks which support this. 0 means disabled.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3300000
@ -76,7 +76,7 @@ patternProperties:
description:
PMIC default "LPSR" state voltage in uV. See below table for
bucks which support this. 0 means disabled.
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 3300000

View File

@ -55,7 +55,7 @@ patternProperties:
should be "buck1", ..., "buck8"
rohm,dvs-run-voltage:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 1300000
description:
@ -63,7 +63,7 @@ patternProperties:
bucks which support this. 0 means disabled.
rohm,dvs-idle-voltage:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 1300000
description:
@ -71,7 +71,7 @@ patternProperties:
bucks which support this. 0 means disabled.
rohm,dvs-suspend-voltage:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 1300000
description:

View File

@ -54,7 +54,7 @@ patternProperties:
should be "buck1", ..., "buck6"
rohm,dvs-run-voltage:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 1300000
description:
@ -62,7 +62,7 @@ patternProperties:
bucks which support this. 0 means disabled.
rohm,dvs-idle-voltage:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 1300000
description:
@ -70,7 +70,7 @@ patternProperties:
bucks which support this. 0 means disabled.
rohm,dvs-suspend-voltage:
$ref: "/schemas/types.yaml#/definitions/uint32"
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 1300000
description:

View File

@ -25,7 +25,7 @@ patternProperties:
type: object
description:
Properties for single regulator.
$ref: "regulator.yaml#"
$ref: regulator.yaml#
properties:
rohm,ocw-fet-ron-micro-ohms:

View File

@ -42,7 +42,7 @@ properties:
reset-names: true
allOf:
- $ref: "regulator.yaml#"
- $ref: regulator.yaml#
- if:
properties:
compatible:

View File

@ -14,7 +14,7 @@ description: |
to supply ADC analog input switches.
allOf:
- $ref: "regulator.yaml#"
- $ref: regulator.yaml#
properties:
compatible:
@ -23,7 +23,7 @@ properties:
- st,stm32mp1-booster
st,syscfg:
$ref: "/schemas/types.yaml#/definitions/phandle"
$ref: /schemas/types.yaml#/definitions/phandle
description: phandle to system configuration controller.
vdda-supply:

View File

@ -15,7 +15,7 @@ maintainers:
- Fabrice Gasnier <fabrice.gasnier@foss.st.com>
allOf:
- $ref: "regulator.yaml#"
- $ref: regulator.yaml#
properties:
compatible:

View File

@ -26,7 +26,7 @@ patternProperties:
"^(reg11|reg18|usb33)$":
type: object
$ref: "regulator.yaml#"
$ref: regulator.yaml#
required:
- compatible

View File

@ -19,7 +19,7 @@ description: |
https://www.ti.com/lit/gpn/tps62360
allOf:
- $ref: "regulator.yaml#"
- $ref: regulator.yaml#
properties:
compatible:

View File

@ -15,7 +15,7 @@ description: |
controller is also embedded.
allOf:
- $ref: "regulator.yaml#"
- $ref: regulator.yaml#
properties:
compatible:

View File

@ -21,19 +21,19 @@ properties:
wlf,ldoena:
description:
GPIO specifier for the GPIO controlling LDOENA.
$ref: "/schemas/types.yaml#/definitions/phandle-array"
$ref: /schemas/types.yaml#/definitions/phandle-array
maxItems: 1
ldo1:
description:
Initial data for the LDO1 regulator.
$ref: "regulator.yaml#"
$ref: regulator.yaml#
type: object
micvdd:
description:
Initial data for the MICVDD regulator.
$ref: "regulator.yaml#"
$ref: regulator.yaml#
type: object
additionalProperties: true

View File

@ -101,6 +101,7 @@ MODULE_DEVICE_TABLE(i2c, pg86x_i2c_id);
static struct i2c_driver pg86x_regulator_driver = {
.driver = {
.name = "88pg86x",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(pg86x_dt_ids),
},
.probe_new = pg86x_i2c_probe,

View File

@ -274,6 +274,7 @@ static int pm800_regulator_probe(struct platform_device *pdev)
static struct platform_driver pm800_regulator_driver = {
.driver = {
.name = "88pm80x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = pm800_regulator_probe,
};

View File

@ -383,6 +383,7 @@ MODULE_DEVICE_TABLE(platform, pm8607_regulator_driver_ids);
static struct platform_driver pm8607_regulator_driver = {
.driver = {
.name = "88pm860x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = pm8607_regulator_probe,
.id_table = pm8607_regulator_driver_ids,

View File

@ -1082,6 +1082,16 @@ config REGULATOR_RT4801
This adds support for voltage regulators in Richtek RT4801 Display Bias IC.
The device supports two regulators (DSVP/DSVN).
config REGULATOR_RT4803
tristate "Richtek RT4803 boost regualtor"
depends on I2C
select REGMAP_I2C
help
This adds support for RT4803 boost converter that integrates the
bypass switch. If the input voltage is low than the required voltage,
RT4803 will enter boost mode. Otherwise, enable internal bypass
switch to enter bypass mode.
config REGULATOR_RT4831
tristate "Richtek RT4831 DSV Regulators"
depends on MFD_RT4831
@ -1120,6 +1130,19 @@ config REGULATOR_RT5190A
buck converters, 1 LDO, mute AC OFF depop function, with the general
I2C control interface.
config REGULATOR_RT5739
tristate "Richtek RT5739 Regulator"
depends on I2C
select REGMAP_I2C
help
This adds support for voltage regulator in Richtek RT5739.
It's a step-down switching voltage regulator. Using a proprietary
architecture with synchronous rectification, it is capable of
delivering 3.5A continuously at over 80% efficiency.
This driver can also be built as a module. If so, the module
will be called rt5739.
config REGULATOR_RT5759
tristate "Richtek RT5759 Regulator"
depends on I2C

View File

@ -130,10 +130,12 @@ obj-$(CONFIG_REGULATOR_RK808) += rk808-regulator.o
obj-$(CONFIG_REGULATOR_RN5T618) += rn5t618-regulator.o
obj-$(CONFIG_REGULATOR_ROHM) += rohm-regulator.o
obj-$(CONFIG_REGULATOR_RT4801) += rt4801-regulator.o
obj-$(CONFIG_REGULATOR_RT4803) += rt4803.o
obj-$(CONFIG_REGULATOR_RT4831) += rt4831-regulator.o
obj-$(CONFIG_REGULATOR_RT5033) += rt5033-regulator.o
obj-$(CONFIG_REGULATOR_RT5120) += rt5120-regulator.o
obj-$(CONFIG_REGULATOR_RT5190A) += rt5190a-regulator.o
obj-$(CONFIG_REGULATOR_RT5739) += rt5739.o
obj-$(CONFIG_REGULATOR_RT5759) += rt5759-regulator.o
obj-$(CONFIG_REGULATOR_RT6160) += rt6160-regulator.o
obj-$(CONFIG_REGULATOR_RT6190) += rt6190-regulator.o

View File

@ -178,6 +178,7 @@ static int aat2870_regulator_probe(struct platform_device *pdev)
static struct platform_driver aat2870_regulator_driver = {
.driver = {
.name = "aat2870-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = aat2870_regulator_probe,
};

View File

@ -446,6 +446,7 @@ static struct platform_driver ab8500_ext_regulator_driver = {
.probe = ab8500_ext_regulator_probe,
.driver = {
.name = "ab8500-ext-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@ -1737,6 +1737,7 @@ static struct platform_driver ab8500_regulator_driver = {
.probe = ab8500_regulator_probe,
.driver = {
.name = "ab8500-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@ -789,6 +789,7 @@ MODULE_DEVICE_TABLE(i2c, act8865_ids);
static struct i2c_driver act8865_pmic_driver = {
.driver = {
.name = "act8865",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe_new = act8865_pmic_probe,
.id_table = act8865_ids,

View File

@ -348,6 +348,7 @@ static void act8945a_pmic_shutdown(struct platform_device *pdev)
static struct platform_driver act8945a_pmic_driver = {
.driver = {
.name = "act8945a-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.pm = &act8945a_pm,
},
.probe = act8945a_pmic_probe,

View File

@ -257,6 +257,7 @@ static struct i2c_driver ad5398_driver = {
.probe_new = ad5398_probe,
.driver = {
.name = "ad5398",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.id_table = ad5398_id,
};

View File

@ -328,6 +328,7 @@ MODULE_DEVICE_TABLE(of, of_anatop_regulator_match_tbl);
static struct platform_driver anatop_regulator_driver = {
.driver = {
.name = "anatop_regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_anatop_regulator_match_tbl,
},
.probe = anatop_regulator_probe,

View File

@ -380,6 +380,7 @@ static struct platform_driver arizona_ldo1_driver = {
.remove = arizona_ldo1_remove,
.driver = {
.name = "arizona-ldo1",
.probe_type = PROBE_FORCE_SYNCHRONOUS,
},
};
@ -388,6 +389,7 @@ static struct platform_driver madera_ldo1_driver = {
.remove = arizona_ldo1_remove,
.driver = {
.name = "madera-ldo1",
.probe_type = PROBE_FORCE_SYNCHRONOUS,
},
};

View File

@ -365,6 +365,7 @@ static struct platform_driver arizona_micsupp_driver = {
.probe = arizona_micsupp_probe,
.driver = {
.name = "arizona-micsupp",
.probe_type = PROBE_FORCE_SYNCHRONOUS,
},
};
@ -372,6 +373,7 @@ static struct platform_driver madera_micsupp_driver = {
.probe = madera_micsupp_probe,
.driver = {
.name = "madera-micsupp",
.probe_type = PROBE_FORCE_SYNCHRONOUS,
},
};

View File

@ -243,6 +243,7 @@ static int as3711_regulator_probe(struct platform_device *pdev)
static struct platform_driver as3711_regulator_driver = {
.driver = {
.name = "as3711-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = as3711_regulator_probe,
};

View File

@ -831,6 +831,7 @@ MODULE_DEVICE_TABLE(of, of_as3722_regulator_match);
static struct platform_driver as3722_regulator_driver = {
.driver = {
.name = "as3722-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_as3722_regulator_match,
},
.probe = as3722_regulator_probe,

View File

@ -530,6 +530,7 @@ static struct platform_driver atc260x_regulator_driver = {
.probe = atc260x_regulator_probe,
.driver = {
.name = "atc260x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@ -1364,6 +1364,7 @@ static struct platform_driver axp20x_regulator_driver = {
.probe = axp20x_regulator_probe,
.driver = {
.name = "axp20x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@ -354,6 +354,7 @@ static int bcm590xx_probe(struct platform_device *pdev)
static struct platform_driver bcm590xx_regulator_driver = {
.driver = {
.name = "bcm590xx-vregs",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = bcm590xx_probe,
};

View File

@ -201,10 +201,10 @@ static int buck12_set_hw_dvs_levels(struct device_node *np,
data = container_of(desc, struct bd71815_regulator, desc);
if (of_find_property(np, "rohm,dvs-run-voltage", NULL) ||
of_find_property(np, "rohm,dvs-suspend-voltage", NULL) ||
of_find_property(np, "rohm,dvs-lpsr-voltage", NULL) ||
of_find_property(np, "rohm,dvs-snvs-voltage", NULL)) {
if (of_property_present(np, "rohm,dvs-run-voltage") ||
of_property_present(np, "rohm,dvs-suspend-voltage") ||
of_property_present(np, "rohm,dvs-lpsr-voltage") ||
of_property_present(np, "rohm,dvs-snvs-voltage")) {
ret = regmap_read(cfg->regmap, desc->vsel_reg, &val);
if (ret)
return ret;
@ -619,6 +619,7 @@ MODULE_DEVICE_TABLE(platform, bd7181x_pmic_id);
static struct platform_driver bd7181x_regulator = {
.driver = {
.name = "bd7181x-pmic",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = bd7181x_probe,
.id_table = bd7181x_pmic_id,

View File

@ -771,7 +771,8 @@ static int bd71828_probe(struct platform_device *pdev)
static struct platform_driver bd71828_regulator = {
.driver = {
.name = "bd71828-pmic"
.name = "bd71828-pmic",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = bd71828_probe,
};

View File

@ -1829,6 +1829,7 @@ MODULE_DEVICE_TABLE(platform, bd718x7_pmic_id);
static struct platform_driver bd718xx_regulator = {
.driver = {
.name = "bd718xx-pmic",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = bd718xx_probe,
.id_table = bd718x7_pmic_id,

View File

@ -353,6 +353,7 @@ MODULE_DEVICE_TABLE(platform, bd9571mwv_regulator_id_table);
static struct platform_driver bd9571mwv_regulator_driver = {
.driver = {
.name = "bd9571mwv-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.pm = DEV_PM_OPS,
},
.probe = bd9571mwv_regulator_probe,

View File

@ -1126,6 +1126,7 @@ MODULE_DEVICE_TABLE(platform, bd957x_pmic_id);
static struct platform_driver bd957x_regulator = {
.driver = {
.name = "bd957x-pmic",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = bd957x_probe,
.id_table = bd957x_pmic_id,

View File

@ -207,6 +207,71 @@ static void regulator_unlock(struct regulator_dev *rdev)
mutex_unlock(&regulator_nesting_mutex);
}
/**
* regulator_lock_two - lock two regulators
* @rdev1: first regulator
* @rdev2: second regulator
* @ww_ctx: w/w mutex acquire context
*
* Locks both rdevs using the regulator_ww_class.
*/
static void regulator_lock_two(struct regulator_dev *rdev1,
struct regulator_dev *rdev2,
struct ww_acquire_ctx *ww_ctx)
{
struct regulator_dev *held, *contended;
int ret;
ww_acquire_init(ww_ctx, &regulator_ww_class);
/* Try to just grab both of them */
ret = regulator_lock_nested(rdev1, ww_ctx);
WARN_ON(ret);
ret = regulator_lock_nested(rdev2, ww_ctx);
if (ret != -EDEADLOCK) {
WARN_ON(ret);
goto exit;
}
held = rdev1;
contended = rdev2;
while (true) {
regulator_unlock(held);
ww_mutex_lock_slow(&contended->mutex, ww_ctx);
contended->ref_cnt++;
contended->mutex_owner = current;
swap(held, contended);
ret = regulator_lock_nested(contended, ww_ctx);
if (ret != -EDEADLOCK) {
WARN_ON(ret);
break;
}
}
exit:
ww_acquire_done(ww_ctx);
}
/**
* regulator_unlock_two - unlock two regulators
* @rdev1: first regulator
* @rdev2: second regulator
* @ww_ctx: w/w mutex acquire context
*
* The inverse of regulator_lock_two().
*/
static void regulator_unlock_two(struct regulator_dev *rdev1,
struct regulator_dev *rdev2,
struct ww_acquire_ctx *ww_ctx)
{
regulator_unlock(rdev2);
regulator_unlock(rdev1);
ww_acquire_fini(ww_ctx);
}
static bool regulator_supply_is_couple(struct regulator_dev *rdev)
{
struct regulator_dev *c_rdev;
@ -334,6 +399,7 @@ static void regulator_lock_dependent(struct regulator_dev *rdev,
ww_mutex_lock_slow(&new_contended_rdev->mutex, ww_ctx);
old_contended_rdev = new_contended_rdev;
old_contended_rdev->ref_cnt++;
old_contended_rdev->mutex_owner = current;
}
err = regulator_lock_recursive(rdev,
@ -1583,9 +1649,6 @@ static int set_machine_constraints(struct regulator_dev *rdev)
rdev->constraints->always_on = true;
}
if (rdev->desc->off_on_delay)
rdev->last_off = ktime_get_boottime();
/* If the constraints say the regulator should be on at this point
* and we have control then make sure it is enabled.
*/
@ -1619,6 +1682,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)
if (rdev->constraints->always_on)
rdev->use_count++;
} else if (rdev->desc->off_on_delay) {
rdev->last_off = ktime_get();
}
print_constraints(rdev);
@ -1627,8 +1692,8 @@ static int set_machine_constraints(struct regulator_dev *rdev)
/**
* set_supply - set regulator supply regulator
* @rdev: regulator name
* @supply_rdev: supply regulator name
* @rdev: regulator (locked)
* @supply_rdev: supply regulator (locked))
*
* Called by platform initialisation code to set the supply regulator for this
* regulator. This ensures that a regulators supply will also be enabled by the
@ -1800,6 +1865,8 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
struct regulator *regulator;
int err = 0;
lockdep_assert_held_once(&rdev->mutex.base);
if (dev) {
char buf[REG_STR_SIZE];
int size;
@ -1827,9 +1894,7 @@ static struct regulator *create_regulator(struct regulator_dev *rdev,
regulator->rdev = rdev;
regulator->supply_name = supply_name;
regulator_lock(rdev);
list_add(&regulator->list, &rdev->consumer_list);
regulator_unlock(rdev);
if (dev) {
regulator->dev = dev;
@ -1995,6 +2060,7 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
{
struct regulator_dev *r;
struct device *dev = rdev->dev.parent;
struct ww_acquire_ctx ww_ctx;
int ret = 0;
/* No supply to resolve? */
@ -2061,23 +2127,23 @@ static int regulator_resolve_supply(struct regulator_dev *rdev)
* between rdev->supply null check and setting rdev->supply in
* set_supply() from concurrent tasks.
*/
regulator_lock(rdev);
regulator_lock_two(rdev, r, &ww_ctx);
/* Supply just resolved by a concurrent task? */
if (rdev->supply) {
regulator_unlock(rdev);
regulator_unlock_two(rdev, r, &ww_ctx);
put_device(&r->dev);
goto out;
}
ret = set_supply(rdev, r);
if (ret < 0) {
regulator_unlock(rdev);
regulator_unlock_two(rdev, r, &ww_ctx);
put_device(&r->dev);
goto out;
}
regulator_unlock(rdev);
regulator_unlock_two(rdev, r, &ww_ctx);
/*
* In set_machine_constraints() we may have turned this regulator on
@ -2190,7 +2256,9 @@ struct regulator *_regulator_get(struct device *dev, const char *id,
return regulator;
}
regulator_lock(rdev);
regulator = create_regulator(rdev, dev, id);
regulator_unlock(rdev);
if (regulator == NULL) {
regulator = ERR_PTR(-ENOMEM);
module_put(rdev->owner);
@ -2668,7 +2736,7 @@ static int _regulator_do_enable(struct regulator_dev *rdev)
trace_regulator_enable(rdev_get_name(rdev));
if (rdev->desc->off_on_delay && rdev->last_off) {
if (rdev->desc->off_on_delay) {
/* if needed, keep a distance of off_on_delay from last time
* this regulator was disabled.
*/
@ -6049,6 +6117,7 @@ static void regulator_summary_lock(struct ww_acquire_ctx *ww_ctx)
ww_mutex_lock_slow(&new_contended_rdev->mutex, ww_ctx);
old_contended_rdev = new_contended_rdev;
old_contended_rdev->ref_cnt++;
old_contended_rdev->mutex_owner = current;
}
err = regulator_summary_lock_all(ww_ctx,

View File

@ -553,6 +553,7 @@ static struct platform_driver cpcap_regulator_driver = {
.probe = cpcap_regulator_probe,
.driver = {
.name = "cpcap-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(cpcap_regulator_id_table),
},
};

View File

@ -215,6 +215,7 @@ static struct platform_driver cros_ec_regulator_driver = {
.probe = cros_ec_regulator_probe,
.driver = {
.name = "cros-ec-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = regulator_cros_ec_of_match,
},
};

View File

@ -471,6 +471,7 @@ static int da903x_regulator_probe(struct platform_device *pdev)
static struct platform_driver da903x_regulator_driver = {
.driver = {
.name = "da903x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = da903x_regulator_probe,
};

View File

@ -438,6 +438,7 @@ static struct platform_driver da9052_regulator_driver = {
.probe = da9052_regulator_probe,
.driver = {
.name = "da9052-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@ -576,6 +576,7 @@ static struct platform_driver da9055_regulator_driver = {
.probe = da9055_regulator_probe,
.driver = {
.name = "da9055-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@ -1033,6 +1033,7 @@ static int da9062_regulator_probe(struct platform_device *pdev)
static struct platform_driver da9062_regulator_driver = {
.driver = {
.name = "da9062-regulators",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = da9062_regulator_probe,
};

View File

@ -83,6 +83,9 @@ struct da9063_regulator_info {
/* DA9063 event detection bit */
struct reg_field oc_event;
/* DA9063 voltage monitor bit */
struct reg_field vmon;
};
/* Macros for LDO */
@ -148,6 +151,7 @@ struct da9063_regulator {
struct regmap_field *suspend;
struct regmap_field *sleep;
struct regmap_field *suspend_sleep;
struct regmap_field *vmon;
};
/* Encapsulates all information for the regulators driver */
@ -203,6 +207,24 @@ static const unsigned int da9063_bmem_bio_merged_limits[] = {
4600000, 4800000, 5000000, 5200000, 5400000, 5600000, 5800000, 6000000
};
static int da9063_set_xvp(struct regulator_dev *rdev, int lim_uV, int severity, bool enable)
{
struct da9063_regulator *regl = rdev_get_drvdata(rdev);
struct device *dev = regl->hw->dev;
dev_dbg(dev, "%s: lim: %d, sev: %d, en: %d\n", regl->desc.name, lim_uV, severity, enable);
/*
* only support enable and disable.
* the da9063 offers a GPIO (GP_FB2) which is unasserted if an XV happens.
* therefore ignore severity here, as there might be handlers in hardware.
*/
if (lim_uV)
return -EINVAL;
return regmap_field_write(regl->vmon, enable ? 1 : 0);
}
static int da9063_buck_set_mode(struct regulator_dev *rdev, unsigned int mode)
{
struct da9063_regulator *regl = rdev_get_drvdata(rdev);
@ -541,37 +563,41 @@ static int da9063_buck_get_current_limit(struct regulator_dev *rdev)
}
static const struct regulator_ops da9063_buck_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
.set_current_limit = da9063_buck_set_current_limit,
.get_current_limit = da9063_buck_get_current_limit,
.set_mode = da9063_buck_set_mode,
.get_mode = da9063_buck_get_mode,
.get_status = da9063_buck_get_status,
.set_suspend_voltage = da9063_set_suspend_voltage,
.set_suspend_enable = da9063_suspend_enable,
.set_suspend_disable = da9063_suspend_disable,
.set_suspend_mode = da9063_buck_set_suspend_mode,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
.set_current_limit = da9063_buck_set_current_limit,
.get_current_limit = da9063_buck_get_current_limit,
.set_mode = da9063_buck_set_mode,
.get_mode = da9063_buck_get_mode,
.get_status = da9063_buck_get_status,
.set_suspend_voltage = da9063_set_suspend_voltage,
.set_suspend_enable = da9063_suspend_enable,
.set_suspend_disable = da9063_suspend_disable,
.set_suspend_mode = da9063_buck_set_suspend_mode,
.set_over_voltage_protection = da9063_set_xvp,
.set_under_voltage_protection = da9063_set_xvp,
};
static const struct regulator_ops da9063_ldo_ops = {
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
.set_mode = da9063_ldo_set_mode,
.get_mode = da9063_ldo_get_mode,
.get_status = da9063_ldo_get_status,
.set_suspend_voltage = da9063_set_suspend_voltage,
.set_suspend_enable = da9063_suspend_enable,
.set_suspend_disable = da9063_suspend_disable,
.set_suspend_mode = da9063_ldo_set_suspend_mode,
.enable = regulator_enable_regmap,
.disable = regulator_disable_regmap,
.is_enabled = regulator_is_enabled_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
.set_mode = da9063_ldo_set_mode,
.get_mode = da9063_ldo_get_mode,
.get_status = da9063_ldo_get_status,
.set_suspend_voltage = da9063_set_suspend_voltage,
.set_suspend_enable = da9063_suspend_enable,
.set_suspend_disable = da9063_suspend_disable,
.set_suspend_mode = da9063_ldo_set_suspend_mode,
.set_over_voltage_protection = da9063_set_xvp,
.set_under_voltage_protection = da9063_set_xvp,
};
/* Info of regulators for DA9063 */
@ -581,36 +607,42 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
da9063_buck_a_limits,
DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK),
DA9063_BUCK_COMMON_FIELDS(BCORE1),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BCORE1_MON_EN),
},
{
DA9063_BUCK(DA9063, BCORE2, 300, 10, 1570,
da9063_buck_a_limits,
DA9063_REG_BUCK_ILIM_C, DA9063_BCORE2_ILIM_MASK),
DA9063_BUCK_COMMON_FIELDS(BCORE2),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BCORE2_MON_EN),
},
{
DA9063_BUCK(DA9063, BPRO, 530, 10, 1800,
da9063_buck_a_limits,
DA9063_REG_BUCK_ILIM_B, DA9063_BPRO_ILIM_MASK),
DA9063_BUCK_COMMON_FIELDS(BPRO),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BPRO_MON_EN),
},
{
DA9063_BUCK(DA9063, BMEM, 800, 20, 3340,
da9063_buck_b_limits,
DA9063_REG_BUCK_ILIM_A, DA9063_BMEM_ILIM_MASK),
DA9063_BUCK_COMMON_FIELDS(BMEM),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BMEM_MON_EN),
},
{
DA9063_BUCK(DA9063, BIO, 800, 20, 3340,
da9063_buck_b_limits,
DA9063_REG_BUCK_ILIM_A, DA9063_BIO_ILIM_MASK),
DA9063_BUCK_COMMON_FIELDS(BIO),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BIO_MON_EN),
},
{
DA9063_BUCK(DA9063, BPERI, 800, 20, 3340,
da9063_buck_b_limits,
DA9063_REG_BUCK_ILIM_B, DA9063_BPERI_ILIM_MASK),
DA9063_BUCK_COMMON_FIELDS(BPERI),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BPERI_MON_EN),
},
{
DA9063_BUCK(DA9063, BCORES_MERGED, 300, 10, 1570,
@ -618,6 +650,7 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
DA9063_REG_BUCK_ILIM_C, DA9063_BCORE1_ILIM_MASK),
/* BCORES_MERGED uses the same register fields as BCORE1 */
DA9063_BUCK_COMMON_FIELDS(BCORE1),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BCORE1_MON_EN),
},
{
DA9063_BUCK(DA9063, BMEM_BIO_MERGED, 800, 20, 3340,
@ -625,47 +658,59 @@ static const struct da9063_regulator_info da9063_regulator_info[] = {
DA9063_REG_BUCK_ILIM_A, DA9063_BMEM_ILIM_MASK),
/* BMEM_BIO_MERGED uses the same register fields as BMEM */
DA9063_BUCK_COMMON_FIELDS(BMEM),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_4, DA9063_BMEM_MON_EN),
},
{
DA9063_LDO(DA9063, LDO3, 900, 20, 3440),
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO3_LIM),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO3_MON_EN),
},
{
DA9063_LDO(DA9063, LDO7, 900, 50, 3600),
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO7_LIM),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO7_MON_EN),
},
{
DA9063_LDO(DA9063, LDO8, 900, 50, 3600),
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO8_LIM),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO8_MON_EN),
},
{
DA9063_LDO(DA9063, LDO9, 950, 50, 3600),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_3, DA9063_LDO9_MON_EN),
},
{
DA9063_LDO(DA9063, LDO11, 900, 50, 3600),
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO11_LIM),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_3, DA9063_LDO11_MON_EN),
},
/* The following LDOs are present only on DA9063, not on DA9063L */
{
DA9063_LDO(DA9063, LDO1, 600, 20, 1860),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO1_MON_EN),
},
{
DA9063_LDO(DA9063, LDO2, 600, 20, 1860),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO2_MON_EN),
},
{
DA9063_LDO(DA9063, LDO4, 900, 20, 3440),
.oc_event = BFIELD(DA9063_REG_STATUS_D, DA9063_LDO4_LIM),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO4_MON_EN),
},
{
DA9063_LDO(DA9063, LDO5, 900, 50, 3600),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO5_MON_EN),
},
{
DA9063_LDO(DA9063, LDO6, 900, 50, 3600),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_2, DA9063_LDO6_MON_EN),
},
{
DA9063_LDO(DA9063, LDO10, 900, 50, 3600),
.vmon = BFIELD(DA9063_BB_REG_MON_REG_3, DA9063_LDO10_MON_EN),
},
};
@ -726,6 +771,41 @@ static const struct regulator_init_data *da9063_get_regulator_initdata(
return NULL;
}
static int da9063_check_xvp_constraints(struct regulator_config *config)
{
struct da9063_regulator *regl = config->driver_data;
const struct regulation_constraints *constr = &config->init_data->constraints;
const struct notification_limit *uv_l = &constr->under_voltage_limits;
const struct notification_limit *ov_l = &constr->over_voltage_limits;
/* make sure that only one severity is used to clarify if unchanged, enabled or disabled */
if ((!!uv_l->prot + !!uv_l->err + !!uv_l->warn) > 1) {
dev_err(config->dev, "%s: at most one voltage monitoring severity allowed!\n",
regl->desc.name);
return -EINVAL;
}
/* make sure that UV and OV monitoring is set to the same severity and value */
if (uv_l->prot != ov_l->prot) {
dev_err(config->dev,
"%s: protection-microvolt: value must be equal for uv and ov!\n",
regl->desc.name);
return -EINVAL;
}
if (uv_l->err != ov_l->err) {
dev_err(config->dev, "%s: error-microvolt: value must be equal for uv and ov!\n",
regl->desc.name);
return -EINVAL;
}
if (uv_l->warn != ov_l->warn) {
dev_err(config->dev, "%s: warn-microvolt: value must be equal for uv and ov!\n",
regl->desc.name);
return -EINVAL;
}
return 0;
}
static struct of_regulator_match da9063_matches[] = {
[DA9063_ID_BCORE1] = { .name = "bcore1" },
[DA9063_ID_BCORE2] = { .name = "bcore2" },
@ -932,6 +1012,12 @@ static int da9063_regulator_probe(struct platform_device *pdev)
if (IS_ERR(regl->suspend_sleep))
return PTR_ERR(regl->suspend_sleep);
}
if (regl->info->vmon.reg) {
regl->vmon = devm_regmap_field_alloc(&pdev->dev,
da9063->regmap, regl->info->vmon);
if (IS_ERR(regl->vmon))
return PTR_ERR(regl->vmon);
}
/* Register regulator */
memset(&config, 0, sizeof(config));
@ -941,6 +1027,11 @@ static int da9063_regulator_probe(struct platform_device *pdev)
if (da9063_reg_matches)
config.of_node = da9063_reg_matches[id].of_node;
config.regmap = da9063->regmap;
ret = da9063_check_xvp_constraints(&config);
if (ret)
return ret;
regl->rdev = devm_regulator_register(&pdev->dev, &regl->desc,
&config);
if (IS_ERR(regl->rdev)) {
@ -971,6 +1062,7 @@ static int da9063_regulator_probe(struct platform_device *pdev)
static struct platform_driver da9063_regulator_driver = {
.driver = {
.name = DA9063_DRVNAME_REGULATORS,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = da9063_regulator_probe,
};

View File

@ -1194,6 +1194,7 @@ MODULE_DEVICE_TABLE(i2c, da9121_i2c_id);
static struct i2c_driver da9121_regulator_driver = {
.driver = {
.name = "da9121",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(da9121_dt_ids),
},
.probe_new = da9121_i2c_probe,

View File

@ -221,6 +221,7 @@ MODULE_DEVICE_TABLE(i2c, da9210_i2c_id);
static struct i2c_driver da9210_regulator_driver = {
.driver = {
.name = "da9210",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(da9210_dt_ids),
},
.probe_new = da9210_i2c_probe,

View File

@ -552,6 +552,7 @@ MODULE_DEVICE_TABLE(of, da9211_dt_ids);
static struct i2c_driver da9211_regulator_driver = {
.driver = {
.name = "da9211",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(da9211_dt_ids),
},
.probe_new = da9211_i2c_probe,

View File

@ -479,6 +479,7 @@ static int db8500_regulator_remove(struct platform_device *pdev)
static struct platform_driver db8500_regulator_driver = {
.driver = {
.name = "db8500-prcmu-regulators",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = db8500_regulator_probe,
.remove = db8500_regulator_remove,

View File

@ -60,6 +60,7 @@ static struct platform_driver dummy_regulator_driver = {
.probe = dummy_regulator_probe,
.driver = {
.name = "reg-dummy",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@ -8,7 +8,7 @@
// Copyright (c) 2012 Marvell Technology Ltd.
// Yunfan Zhang <yfzhang@marvell.com>
#include <linux/bits.h>
#include <linux/bitops.h>
#include <linux/err.h>
#include <linux/i2c.h>
#include <linux/module.h>
@ -26,6 +26,9 @@
#define FAN53555_VSEL0 0x00
#define FAN53555_VSEL1 0x01
#define RK8602_VSEL0 0x06
#define RK8602_VSEL1 0x07
#define TCS4525_VSEL0 0x11
#define TCS4525_VSEL1 0x10
#define TCS4525_TIME 0x13
@ -41,31 +44,32 @@
#define FAN53555_MONITOR 0x05
/* VSEL bit definitions */
#define VSEL_BUCK_EN (1 << 7)
#define VSEL_MODE (1 << 6)
#define VSEL_BUCK_EN BIT(7)
#define VSEL_MODE BIT(6)
/* Chip ID and Verison */
#define DIE_ID 0x0F /* ID1 */
#define DIE_REV 0x0F /* ID2 */
#define DIE_ID 0x0F /* ID1 */
#define DIE_REV 0x0F /* ID2 */
/* Control bit definitions */
#define CTL_OUTPUT_DISCHG (1 << 7)
#define CTL_SLEW_MASK (0x7 << 4)
#define CTL_SLEW_SHIFT 4
#define CTL_RESET (1 << 2)
#define CTL_OUTPUT_DISCHG BIT(7)
#define CTL_SLEW_MASK GENMASK(6, 4)
#define CTL_RESET BIT(2)
#define CTL_MODE_VSEL0_MODE BIT(0)
#define CTL_MODE_VSEL1_MODE BIT(1)
#define FAN53555_NVOLTAGES 64 /* Numbers of voltages */
#define FAN53526_NVOLTAGES 128
#define RK8602_NVOLTAGES 160
#define TCS_VSEL0_MODE (1 << 7)
#define TCS_VSEL1_MODE (1 << 6)
#define TCS_VSEL0_MODE BIT(7)
#define TCS_VSEL1_MODE BIT(6)
#define TCS_SLEW_SHIFT 3
#define TCS_SLEW_MASK GENMASK(4, 3)
enum fan53555_vendor {
FAN53526_VENDOR_FAIRCHILD = 0,
FAN53555_VENDOR_FAIRCHILD,
FAN53555_VENDOR_ROCKCHIP, /* RK8600, RK8601 */
RK8602_VENDOR_ROCKCHIP, /* RK8602, RK8603 */
FAN53555_VENDOR_SILERGY,
FAN53526_VENDOR_TCS,
};
@ -89,6 +93,14 @@ enum {
FAN53555_CHIP_ID_08 = 8,
};
enum {
RK8600_CHIP_ID_08 = 8, /* RK8600, RK8601 */
};
enum {
RK8602_CHIP_ID_10 = 10, /* RK8602, RK8603 */
};
enum {
TCS4525_CHIP_ID_12 = 12,
};
@ -119,6 +131,8 @@ struct fan53555_device_info {
/* Voltage setting register */
unsigned int vol_reg;
unsigned int sleep_reg;
unsigned int en_reg;
unsigned int sleep_en_reg;
/* Voltage range and step(linear) */
unsigned int vsel_min;
unsigned int vsel_step;
@ -161,7 +175,7 @@ static int fan53555_set_suspend_enable(struct regulator_dev *rdev)
{
struct fan53555_device_info *di = rdev_get_drvdata(rdev);
return regmap_update_bits(rdev->regmap, di->sleep_reg,
return regmap_update_bits(rdev->regmap, di->sleep_en_reg,
VSEL_BUCK_EN, VSEL_BUCK_EN);
}
@ -169,7 +183,7 @@ static int fan53555_set_suspend_disable(struct regulator_dev *rdev)
{
struct fan53555_device_info *di = rdev_get_drvdata(rdev);
return regmap_update_bits(rdev->regmap, di->sleep_reg,
return regmap_update_bits(rdev->regmap, di->sleep_en_reg,
VSEL_BUCK_EN, 0);
}
@ -319,6 +333,50 @@ static int fan53555_voltages_setup_fairchild(struct fan53555_device_info *di)
return 0;
}
static int fan53555_voltages_setup_rockchip(struct fan53555_device_info *di)
{
/* Init voltage range and step */
switch (di->chip_id) {
case RK8600_CHIP_ID_08:
di->vsel_min = 712500;
di->vsel_step = 12500;
break;
default:
dev_err(di->dev,
"Chip ID %d not supported!\n", di->chip_id);
return -EINVAL;
}
di->slew_reg = FAN53555_CONTROL;
di->slew_mask = CTL_SLEW_MASK;
di->ramp_delay_table = slew_rates;
di->n_ramp_values = ARRAY_SIZE(slew_rates);
di->vsel_count = FAN53555_NVOLTAGES;
return 0;
}
static int rk8602_voltages_setup_rockchip(struct fan53555_device_info *di)
{
/* Init voltage range and step */
switch (di->chip_id) {
case RK8602_CHIP_ID_10:
di->vsel_min = 500000;
di->vsel_step = 6250;
break;
default:
dev_err(di->dev,
"Chip ID %d not supported!\n", di->chip_id);
return -EINVAL;
}
di->slew_reg = FAN53555_CONTROL;
di->slew_mask = CTL_SLEW_MASK;
di->ramp_delay_table = slew_rates;
di->n_ramp_values = ARRAY_SIZE(slew_rates);
di->vsel_count = RK8602_NVOLTAGES;
return 0;
}
static int fan53555_voltages_setup_silergy(struct fan53555_device_info *di)
{
/* Init voltage range and step */
@ -379,6 +437,7 @@ static int fan53555_device_setup(struct fan53555_device_info *di,
switch (di->vendor) {
case FAN53526_VENDOR_FAIRCHILD:
case FAN53555_VENDOR_FAIRCHILD:
case FAN53555_VENDOR_ROCKCHIP:
case FAN53555_VENDOR_SILERGY:
switch (pdata->sleep_vsel_id) {
case FAN53555_VSEL_ID_0:
@ -393,6 +452,27 @@ static int fan53555_device_setup(struct fan53555_device_info *di,
dev_err(di->dev, "Invalid VSEL ID!\n");
return -EINVAL;
}
di->sleep_en_reg = di->sleep_reg;
di->en_reg = di->vol_reg;
break;
case RK8602_VENDOR_ROCKCHIP:
switch (pdata->sleep_vsel_id) {
case FAN53555_VSEL_ID_0:
di->sleep_reg = RK8602_VSEL0;
di->vol_reg = RK8602_VSEL1;
di->sleep_en_reg = FAN53555_VSEL0;
di->en_reg = FAN53555_VSEL1;
break;
case FAN53555_VSEL_ID_1:
di->sleep_reg = RK8602_VSEL1;
di->vol_reg = RK8602_VSEL0;
di->sleep_en_reg = FAN53555_VSEL1;
di->en_reg = FAN53555_VSEL0;
break;
default:
dev_err(di->dev, "Invalid VSEL ID!\n");
return -EINVAL;
}
break;
case FAN53526_VENDOR_TCS:
switch (pdata->sleep_vsel_id) {
@ -408,6 +488,8 @@ static int fan53555_device_setup(struct fan53555_device_info *di,
dev_err(di->dev, "Invalid VSEL ID!\n");
return -EINVAL;
}
di->sleep_en_reg = di->sleep_reg;
di->en_reg = di->vol_reg;
break;
default:
dev_err(di->dev, "vendor %d not supported!\n", di->vendor);
@ -429,10 +511,23 @@ static int fan53555_device_setup(struct fan53555_device_info *di,
}
break;
case FAN53555_VENDOR_FAIRCHILD:
case FAN53555_VENDOR_ROCKCHIP:
case FAN53555_VENDOR_SILERGY:
di->mode_reg = di->vol_reg;
di->mode_mask = VSEL_MODE;
break;
case RK8602_VENDOR_ROCKCHIP:
di->mode_mask = VSEL_MODE;
switch (pdata->sleep_vsel_id) {
case FAN53555_VSEL_ID_0:
di->mode_reg = FAN53555_VSEL1;
break;
case FAN53555_VSEL_ID_1:
di->mode_reg = FAN53555_VSEL0;
break;
}
break;
case FAN53526_VENDOR_TCS:
di->mode_reg = TCS4525_COMMAND;
@ -458,6 +553,12 @@ static int fan53555_device_setup(struct fan53555_device_info *di,
case FAN53555_VENDOR_FAIRCHILD:
ret = fan53555_voltages_setup_fairchild(di);
break;
case FAN53555_VENDOR_ROCKCHIP:
ret = fan53555_voltages_setup_rockchip(di);
break;
case RK8602_VENDOR_ROCKCHIP:
ret = rk8602_voltages_setup_rockchip(di);
break;
case FAN53555_VENDOR_SILERGY:
ret = fan53555_voltages_setup_silergy(di);
break;
@ -483,12 +584,12 @@ static int fan53555_regulator_register(struct fan53555_device_info *di,
rdesc->ops = &fan53555_regulator_ops;
rdesc->type = REGULATOR_VOLTAGE;
rdesc->n_voltages = di->vsel_count;
rdesc->enable_reg = di->vol_reg;
rdesc->enable_reg = di->en_reg;
rdesc->enable_mask = VSEL_BUCK_EN;
rdesc->min_uV = di->vsel_min;
rdesc->uV_step = di->vsel_step;
rdesc->vsel_reg = di->vol_reg;
rdesc->vsel_mask = di->vsel_count - 1;
rdesc->vsel_mask = BIT(fls(di->vsel_count - 1)) - 1;
rdesc->ramp_reg = di->slew_reg;
rdesc->ramp_mask = di->slew_mask;
rdesc->ramp_delay_table = di->ramp_delay_table;
@ -533,6 +634,12 @@ static const struct of_device_id __maybe_unused fan53555_dt_ids[] = {
}, {
.compatible = "fcs,fan53555",
.data = (void *)FAN53555_VENDOR_FAIRCHILD
}, {
.compatible = "rockchip,rk8600",
.data = (void *)FAN53555_VENDOR_ROCKCHIP
}, {
.compatible = "rockchip,rk8602",
.data = (void *)RK8602_VENDOR_ROCKCHIP
}, {
.compatible = "silergy,syr827",
.data = (void *)FAN53555_VENDOR_SILERGY,
@ -570,10 +677,9 @@ static int fan53555_regulator_probe(struct i2c_client *client)
if (!pdata)
pdata = fan53555_parse_dt(&client->dev, np, &di->desc);
if (!pdata || !pdata->regulator) {
dev_err(&client->dev, "Platform data not found!\n");
return -ENODEV;
}
if (!pdata || !pdata->regulator)
return dev_err_probe(&client->dev, -ENODEV,
"Platform data not found!\n");
di->regulator = pdata->regulator;
if (client->dev.of_node) {
@ -582,10 +688,9 @@ static int fan53555_regulator_probe(struct i2c_client *client)
} else {
/* if no ramp constraint set, get the pdata ramp_delay */
if (!di->regulator->constraints.ramp_delay) {
if (pdata->slew_rate >= ARRAY_SIZE(slew_rates)) {
dev_err(&client->dev, "Invalid slew_rate\n");
return -EINVAL;
}
if (pdata->slew_rate >= ARRAY_SIZE(slew_rates))
return dev_err_probe(&client->dev, -EINVAL,
"Invalid slew_rate\n");
di->regulator->constraints.ramp_delay
= slew_rates[pdata->slew_rate];
@ -595,34 +700,31 @@ static int fan53555_regulator_probe(struct i2c_client *client)
}
regmap = devm_regmap_init_i2c(client, &fan53555_regmap_config);
if (IS_ERR(regmap)) {
dev_err(&client->dev, "Failed to allocate regmap!\n");
return PTR_ERR(regmap);
}
if (IS_ERR(regmap))
return dev_err_probe(&client->dev, PTR_ERR(regmap),
"Failed to allocate regmap!\n");
di->dev = &client->dev;
i2c_set_clientdata(client, di);
/* Get chip ID */
ret = regmap_read(regmap, FAN53555_ID1, &val);
if (ret < 0) {
dev_err(&client->dev, "Failed to get chip ID!\n");
return ret;
}
if (ret < 0)
return dev_err_probe(&client->dev, ret, "Failed to get chip ID!\n");
di->chip_id = val & DIE_ID;
/* Get chip revision */
ret = regmap_read(regmap, FAN53555_ID2, &val);
if (ret < 0) {
dev_err(&client->dev, "Failed to get chip Rev!\n");
return ret;
}
if (ret < 0)
return dev_err_probe(&client->dev, ret, "Failed to get chip Rev!\n");
di->chip_rev = val & DIE_REV;
dev_info(&client->dev, "FAN53555 Option[%d] Rev[%d] Detected!\n",
di->chip_id, di->chip_rev);
/* Device init */
ret = fan53555_device_setup(di, pdata);
if (ret < 0) {
dev_err(&client->dev, "Failed to setup device!\n");
return ret;
}
if (ret < 0)
return dev_err_probe(&client->dev, ret, "Failed to setup device!\n");
/* Register regulator */
config.dev = di->dev;
config.init_data = di->regulator;
@ -632,9 +734,9 @@ static int fan53555_regulator_probe(struct i2c_client *client)
ret = fan53555_regulator_register(di, &config);
if (ret < 0)
dev_err(&client->dev, "Failed to register regulator!\n");
return ret;
dev_err_probe(&client->dev, ret, "Failed to register regulator!\n");
return ret;
}
static const struct i2c_device_id fan53555_id[] = {
@ -644,6 +746,12 @@ static const struct i2c_device_id fan53555_id[] = {
}, {
.name = "fan53555",
.driver_data = FAN53555_VENDOR_FAIRCHILD
}, {
.name = "rk8600",
.driver_data = FAN53555_VENDOR_ROCKCHIP
}, {
.name = "rk8602",
.driver_data = RK8602_VENDOR_ROCKCHIP
}, {
.name = "syr827",
.driver_data = FAN53555_VENDOR_SILERGY
@ -664,6 +772,7 @@ MODULE_DEVICE_TABLE(i2c, fan53555_id);
static struct i2c_driver fan53555_regulator_driver = {
.driver = {
.name = "fan53555-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(fan53555_dt_ids),
},
.probe_new = fan53555_regulator_probe,

View File

@ -172,6 +172,7 @@ MODULE_DEVICE_TABLE(i2c, fan53880_i2c_id);
static struct i2c_driver fan53880_regulator_driver = {
.driver = {
.name = "fan53880",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = fan53880_dt_ids,
},
.probe_new = fan53880_i2c_probe,

View File

@ -151,7 +151,7 @@ of_get_fixed_voltage_config(struct device *dev,
of_property_read_u32(np, "startup-delay-us", &config->startup_delay);
of_property_read_u32(np, "off-on-delay-us", &config->off_on_delay);
if (of_find_property(np, "vin-supply", NULL))
if (of_property_present(np, "vin-supply"))
config->input_supply = "vin";
return config;
@ -334,6 +334,7 @@ static struct platform_driver regulator_fixed_voltage_driver = {
.probe = reg_fixed_voltage_probe,
.driver = {
.name = "reg-fixed-voltage",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(fixed_of_match),
},
};

View File

@ -220,7 +220,7 @@ of_get_gpio_regulator_config(struct device *dev, struct device_node *np,
regtype);
}
if (of_find_property(np, "vin-supply", NULL))
if (of_property_present(np, "vin-supply"))
config->input_supply = "vin";
return config;
@ -368,6 +368,7 @@ static struct platform_driver gpio_regulator_driver = {
.probe = gpio_regulator_probe,
.driver = {
.name = "gpio-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(regulator_gpio_of_match),
},
};

View File

@ -579,6 +579,7 @@ static struct platform_driver hi6421_regulator_driver = {
.id_table = hi6421_regulator_table,
.driver = {
.name = "hi6421-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = hi6421_regulator_probe,
};

View File

@ -200,6 +200,7 @@ static struct platform_driver hi6421v530_regulator_driver = {
.id_table = hi6421v530_regulator_table,
.driver = {
.name = "hi6421v530-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = hi6421v530_regulator_probe,
};

View File

@ -284,6 +284,7 @@ static struct platform_driver hi6421_spmi_regulator_driver = {
.id_table = hi6421_spmi_regulator_table,
.driver = {
.name = "hi6421v600-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = hi6421_spmi_regulator_probe,
};

View File

@ -206,6 +206,7 @@ static struct platform_driver hi655x_regulator_driver = {
.id_table = hi655x_regulator_table,
.driver = {
.name = "hi655x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = hi655x_regulator_probe,
};

View File

@ -147,6 +147,7 @@ MODULE_DEVICE_TABLE(i2c, isl6271a_id);
static struct i2c_driver isl6271a_i2c_driver = {
.driver = {
.name = "isl6271a",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe_new = isl6271a_probe,
.id_table = isl6271a_id,

View File

@ -195,6 +195,7 @@ MODULE_DEVICE_TABLE(i2c, isl9305_i2c_id);
static struct i2c_driver isl9305_regulator_driver = {
.driver = {
.name = "isl9305",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(isl9305_dt_ids),
},
.probe_new = isl9305_i2c_probe,

View File

@ -355,6 +355,7 @@ static struct platform_driver lm363x_regulator_driver = {
.probe = lm363x_regulator_probe,
.driver = {
.name = "lm363x-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@ -272,6 +272,7 @@ static int lochnagar_regulator_probe(struct platform_device *pdev)
static struct platform_driver lochnagar_regulator_driver = {
.driver = {
.name = "lochnagar-regulator",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(lochnagar_of_match),
},

View File

@ -447,6 +447,7 @@ MODULE_DEVICE_TABLE(i2c, lp3971_i2c_id);
static struct i2c_driver lp3971_i2c_driver = {
.driver = {
.name = "LP3971",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe_new = lp3971_i2c_probe,
.id_table = lp3971_i2c_id,

View File

@ -545,6 +545,7 @@ MODULE_DEVICE_TABLE(i2c, lp3972_i2c_id);
static struct i2c_driver lp3972_i2c_driver = {
.driver = {
.name = "lp3972",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe_new = lp3972_i2c_probe,
.id_table = lp3972_i2c_id,

View File

@ -832,8 +832,7 @@ static struct lp872x_platform_data
return ERR_PTR(-ENOMEM);
of_property_read_u8(np, "ti,general-config", &pdata->general_config);
if (of_find_property(np, "ti,update-config", NULL))
pdata->update_config = true;
pdata->update_config = of_property_read_bool(np, "ti,update-config");
pdata->dvs = devm_kzalloc(dev, sizeof(struct lp872x_dvs), GFP_KERNEL);
if (!pdata->dvs)
@ -928,7 +927,7 @@ static int lp872x_probe(struct i2c_client *cl)
return lp872x_regulator_register(lp);
}
static const struct of_device_id lp872x_dt_ids[] = {
static const struct of_device_id lp872x_dt_ids[] __maybe_unused = {
{ .compatible = "ti,lp8720", },
{ .compatible = "ti,lp8725", },
{ }
@ -945,6 +944,7 @@ MODULE_DEVICE_TABLE(i2c, lp872x_ids);
static struct i2c_driver lp872x_driver = {
.driver = {
.name = "lp872x",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(lp872x_dt_ids),
},
.probe_new = lp872x_probe,

View File

@ -187,6 +187,7 @@ MODULE_DEVICE_TABLE(platform, lp873x_regulator_id_table);
static struct platform_driver lp873x_regulator_driver = {
.driver = {
.name = "lp873x-pmic",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = lp873x_regulator_probe,
.id_table = lp873x_regulator_id_table,

View File

@ -440,6 +440,7 @@ MODULE_DEVICE_TABLE(i2c, lp8755_id);
static struct i2c_driver lp8755_i2c_driver = {
.driver = {
.name = LP8755_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe_new = lp8755_probe,
.remove = lp8755_remove,

View File

@ -237,6 +237,7 @@ MODULE_DEVICE_TABLE(platform, lp87565_regulator_id_table);
static struct platform_driver lp87565_regulator_driver = {
.driver = {
.name = "lp87565-pmic",
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
.probe = lp87565_regulator_probe,
.id_table = lp87565_regulator_id_table,

View File

@ -531,6 +531,7 @@ static struct platform_driver lp8788_buck_driver = {
.probe = lp8788_buck_probe,
.driver = {
.name = LP8788_DEV_BUCK,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@ -564,6 +564,7 @@ static struct platform_driver lp8788_dldo_driver = {
.probe = lp8788_dldo_probe,
.driver = {
.name = LP8788_DEV_DLDO,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};
@ -611,6 +612,7 @@ static struct platform_driver lp8788_aldo_driver = {
.probe = lp8788_aldo_probe,
.driver = {
.name = LP8788_DEV_ALDO,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
},
};

View File

@ -474,6 +474,7 @@ MODULE_DEVICE_TABLE(of, ltc3589_of_match);
static struct i2c_driver ltc3589_driver = {
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(ltc3589_of_match),
},
.probe_new = ltc3589_probe,

View File

@ -371,6 +371,7 @@ MODULE_DEVICE_TABLE(of, ltc3676_of_match);
static struct i2c_driver ltc3676_driver = {
.driver = {
.name = DRIVER_NAME,
.probe_type = PROBE_PREFER_ASYNCHRONOUS,
.of_match_table = of_match_ptr(ltc3676_of_match),
},
.probe_new = ltc3676_regulator_probe,

Some files were not shown because too many files have changed in this diff Show More