regulator: Updates for v5.16

Thanks to the removal of the unused TPS80021 driver the regulator
 updates for this cycle actually have a negative diffstat.  Otherwise
 it's been quite a quiet release, lots of fixes and small improvements
 with the biggest individual changes being several conversions of DT
 bindings to YAML format.
 -----BEGIN PGP SIGNATURE-----
 
 iQEzBAABCgAdFiEEreZoqmdXGLWf4p/qJNaLcl1Uh9AFAmF//M0ACgkQJNaLcl1U
 h9ByVQf/QapSey1s8ifh7Or3oiG7Ak6BdPYxiPIzhZIqjz4gXV8ySn8EedbH7moW
 NcKpqokZ4qPD32fcET2WFQLb9tA8BNEQS1VwRKG+uhzPi3xBnIVj0gt8lNOAW57g
 cUWeJhIbafaym33zB0xdDAukLHqjnx24C33Fz8QWaaQv/xRhaCrbzhala4WfXXyP
 ucyOqSNnHZ+KX0tQsIG05b9jqca+VrNAyefY5jum2l2r2LFfGjQDv6g0HJEKfcF3
 PSu+1RBFsYA3sPvzqzdtcuEs7hqalXVNGBfogCzNQ1HhK9z48R4J9lHtswDDk4EA
 9aLYiid02UYRpRpT34z2TexpufW9kQ==
 =5lYk
 -----END PGP SIGNATURE-----

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

Pull regulator updates from Mark Brown:
 "Thanks to the removal of the unused TPS80021 driver the regulator
  updates for this cycle actually have a negative diffstat.

  Otherwise it's been quite a quiet release, lots of fixes and small
  improvements with the biggest individual changes being several
  conversions of DT bindings to YAML format"

* tag 'regulator-v5.16' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (34 commits)
  regulator: Don't error out fixed regulator in regulator_sync_voltage()
  regulator: tps80031: Remove driver
  regulator: Fix SY7636A breakage
  regulator: uniphier: Add binding for NX1 SoC
  regulator: uniphier: Add USB-VBUS compatible string for NX1 SoC
  regulator: qcom,rpmh: Add compatible for PM6350
  regulator: qcom-rpmh: Add PM6350 regulators
  regulator: sy7636a: Remove requirement on sy7636a mfd
  regulator: tps62360: replacing legacy gpio interface for gpiod
  regulator: lp872x: Remove lp872x_dvs_state
  regulator: lp872x: replacing legacy gpio interface for gpiod
  regulator: dt-bindings: samsung,s5m8767: convert to dtschema
  regulator: dt-bindings: samsung,s2mpa01: convert to dtschema
  regulator: dt-bindings: samsung,s2m: convert to dtschema
  dt-bindings: clock: samsung,s2mps11: convert to dtschema
  regulator: dt-bindings: samsung,s5m8767: correct s5m8767,pmic-buck-default-dvs-idx property
  regulator: s5m8767: do not use reset value as DVS voltage if GPIO DVS is disabled
  regulator: dt-bindings: maxim,max8973: convert to dtschema
  regulator: dt-bindings: maxim,max8997: convert to dtschema
  regulator: dt-bindings: maxim,max8952: convert to dtschema
  ...
This commit is contained in:
Linus Torvalds 2021-11-01 19:04:47 -07:00
commit 1260d242d9
45 changed files with 1384 additions and 1566 deletions

View File

@ -1,49 +0,0 @@
Binding for Samsung S2M and S5M family clock generator block
============================================================
This is a part of device tree bindings for S2M and S5M family multi-function
devices.
More information can be found in bindings/mfd/sec-core.txt file.
The S2MPS11/13/15 and S5M8767 provide three(AP/CP/BT) buffered 32.768 kHz
outputs. The S2MPS14 provides two (AP/BT) buffered 32.768 KHz outputs.
To register these as clocks with common clock framework instantiate under
main device node a sub-node named "clocks".
It uses the common clock binding documented in:
- Documentation/devicetree/bindings/clock/clock-bindings.txt
Required properties of the "clocks" sub-node:
- #clock-cells: should be 1.
- compatible: Should be one of: "samsung,s2mps11-clk", "samsung,s2mps13-clk",
"samsung,s2mps14-clk", "samsung,s5m8767-clk"
The S2MPS15 uses the same compatible as S2MPS13, as both provides similar
clocks.
Each clock is assigned an identifier and client nodes use this identifier
to specify the clock which they consume.
Clock ID Devices
----------------------------------------------------------
32KhzAP 0 S2MPS11/13/14/15, S5M8767
32KhzCP 1 S2MPS11/13/15, S5M8767
32KhzBT 2 S2MPS11/13/14/15, S5M8767
Include dt-bindings/clock/samsung,s2mps11.h file to use preprocessor defines
in device tree sources.
Example:
s2mps11_pmic@66 {
compatible = "samsung,s2mps11-pmic";
reg = <0x66>;
s2m_osc: clocks {
compatible = "samsung,s2mps11-clk";
#clock-cells = <1>;
clock-output-names = "xx", "yy", "zz";
};
};

View File

@ -0,0 +1,45 @@
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/clock/samsung,s2mps11.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung S2M and S5M family clock generator block
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
description: |
This is a part of device tree bindings for S2M and S5M family of Power
Management IC (PMIC).
The S2MPS11/13/15 and S5M8767 provide three(AP/CP/BT) buffered 32.768 kHz
outputs. The S2MPS14 provides two (AP/BT) buffered 32.768 KHz outputs.
All available clocks are defined as preprocessor macros in
dt-bindings/clock/samsung,s2mps11.h header.
See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
additional information and example.
properties:
compatible:
enum:
- samsung,s2mps11-clk
- samsung,s2mps13-clk # S2MPS13 and S2MPS15
- samsung,s2mps14-clk
- samsung,s5m8767-clk
"#clock-cells":
const: 1
clock-output-names:
minItems: 3
maxItems: 3
description: Names for AP, CP and BT clocks.
required:
- compatible
- "#clock-cells"
additionalProperties: false

View File

@ -1,52 +0,0 @@
Maxim MAX8952 voltage regulator
Required properties:
- compatible: must be equal to "maxim,max8952"
- reg: I2C slave address, usually 0x60
- max8952,dvs-mode-microvolt: array of 4 integer values defining DVS voltages
in microvolts. All values must be from range <770000, 1400000>
- any required generic properties defined in regulator.txt
Optional properties:
- max8952,vid-gpios: array of two GPIO pins used for DVS voltage selection
- max8952,en-gpio: GPIO used to control enable status of regulator
- max8952,default-mode: index of default DVS voltage, from <0, 3> range
- max8952,sync-freq: sync frequency, must be one of following values:
- 0: 26 MHz
- 1: 13 MHz
- 2: 19.2 MHz
Defaults to 26 MHz if not specified.
- max8952,ramp-speed: voltage ramp speed, must be one of following values:
- 0: 32mV/us
- 1: 16mV/us
- 2: 8mV/us
- 3: 4mV/us
- 4: 2mV/us
- 5: 1mV/us
- 6: 0.5mV/us
- 7: 0.25mV/us
Defaults to 32mV/us if not specified.
- any available generic properties defined in regulator.txt
Example:
vdd_arm_reg: pmic@60 {
compatible = "maxim,max8952";
reg = <0x60>;
/* max8952-specific properties */
max8952,vid-gpios = <&gpx0 3 0>, <&gpx0 4 0>;
max8952,en-gpio = <&gpx0 1 0>;
max8952,default-mode = <0>;
max8952,dvs-mode-microvolt = <1250000>, <1200000>,
<1050000>, <950000>;
max8952,sync-freq = <0>;
max8952,ramp-speed = <0>;
/* generic regulator properties */
regulator-name = "vdd_arm";
regulator-min-microvolt = <770000>;
regulator-max-microvolt = <1400000>;
regulator-always-on;
regulator-boot-on;
};

View File

@ -1,52 +0,0 @@
* Maxim MAX8973 Voltage Regulator
Required properties:
- compatible: must be one of following:
"maxim,max8973"
"maxim,max77621".
- reg: the i2c slave address of the regulator. It should be 0x1b.
Any standard regulator properties can be used to configure the single max8973
DCDC.
Optional properties:
-maxim,externally-enable: boolean, externally control the regulator output
enable/disable.
-maxim,enable-gpio: GPIO for enable control. If the valid GPIO is provided
then externally enable control will be considered.
-maxim,dvs-gpio: GPIO which is connected to DVS pin of device.
-maxim,dvs-default-state: Default state of GPIO during initialisation.
1 for HIGH and 0 for LOW.
-maxim,enable-remote-sense: boolean, enable reote sense.
-maxim,enable-falling-slew-rate: boolean, enable falling slew rate.
-maxim,enable-active-discharge: boolean: enable active discharge.
-maxim,enable-frequency-shift: boolean, enable 9% frequency shift.
-maxim,enable-bias-control: boolean, enable bias control. By enabling this
startup delay can be reduce to 20us from 220us.
-maxim,enable-etr: boolean, enable Enhanced Transient Response.
-maxim,enable-high-etr-sensitivity: boolean, Enhanced transient response
circuit is enabled and set for high sensitivity. If this
property is available then etr will be enable default.
Enhanced transient response (ETR) will affect the configuration of CKADV.
-junction-warn-millicelsius: u32, junction warning temperature threshold
in millicelsius. If die temperature crosses this level then
device generates the warning interrupts.
Please note that thermal functionality is only supported on MAX77621. The
supported threshold warning temperature for MAX77621 are 120 degC and 140 degC.
Example:
max8973@1b {
compatible = "maxim,max8973";
reg = <0x1b>;
regulator-min-microvolt = <935000>;
regulator-max-microvolt = <1200000>;
regulator-boot-on;
regulator-always-on;
};

View File

@ -1,145 +0,0 @@
* Maxim MAX8997 Voltage and Current Regulator
The Maxim MAX8997 is a multi-function device which includes voltage and
current regulators, rtc, charger controller and other sub-blocks. It is
interfaced to the host controller using a i2c interface. Each sub-block is
addressed by the host system using different i2c slave address. This document
describes the bindings for 'pmic' sub-block of max8997.
Required properties:
- compatible: Should be "maxim,max8997-pmic".
- reg: Specifies the i2c slave address of the pmic block. It should be 0x66.
- max8997,pmic-buck1-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
units for buck1 when changing voltage using gpio dvs. Refer to [1] below
for additional information.
- max8997,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
units for buck2 when changing voltage using gpio dvs. Refer to [1] below
for additional information.
- max8997,pmic-buck5-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
units for buck5 when changing voltage using gpio dvs. Refer to [1] below
for additional information.
[1] If none of the 'max8997,pmic-buck[1/2/5]-uses-gpio-dvs' optional
property is specified, the 'max8997,pmic-buck[1/2/5]-dvs-voltage'
property should specify atleast one voltage level (which would be a
safe operating voltage).
If either of the 'max8997,pmic-buck[1/2/5]-uses-gpio-dvs' optional
property is specified, then all the eight voltage values for the
'max8997,pmic-buck[1/2/5]-dvs-voltage' should be specified.
Optional properties:
- interrupts: Interrupt specifiers for two interrupt sources.
- First interrupt specifier is for 'irq1' interrupt.
- Second interrupt specifier is for 'alert' interrupt.
- charger-supply: regulator node for charging current.
- max8997,pmic-buck1-uses-gpio-dvs: 'buck1' can be controlled by gpio dvs.
- max8997,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs.
- max8997,pmic-buck5-uses-gpio-dvs: 'buck5' can be controlled by gpio dvs.
Additional properties required if either of the optional properties are used:
- max8997,pmic-ignore-gpiodvs-side-effect: When GPIO-DVS mode is used for
multiple bucks, changing the voltage value of one of the bucks may affect
that of another buck, which is the side effect of the change (set_voltage).
Use this property to ignore such side effects and change the voltage.
- max8997,pmic-buck125-default-dvs-idx: Default voltage setting selected from
the possible 8 options selectable by the dvs gpios. The value of this
property should be between 0 and 7. If not specified or if out of range, the
default value of this property is set to 0.
- max8997,pmic-buck125-dvs-gpios: GPIO specifiers for three host gpio's used
for dvs. The format of the gpio specifier depends in the gpio controller.
Regulators: The regulators of max8997 that have to be instantiated should be
included in a sub-node named 'regulators'. Regulator nodes included in this
sub-node should be of the format as listed below.
regulator_name {
standard regulator bindings here
};
The following are the names of the regulators that the max8997 pmic block
supports. Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
as per the datasheet of max8997.
- LDOn
- valid values for n are 1 to 18 and 21
- Example: LDO0, LD01, LDO2, LDO21
- BUCKn
- valid values for n are 1 to 7.
- Example: BUCK1, BUCK2, BUCK3, BUCK7
- ENVICHG: Battery Charging Current Monitor Output. This is a fixed
voltage type regulator
- ESAFEOUT1: (ldo19)
- ESAFEOUT2: (ld020)
- CHARGER_CV: main battery charger voltage control
- CHARGER: main battery charger current control
- CHARGER_TOPOFF: end of charge current threshold level
The bindings inside the regulator nodes use the standard regulator bindings
which are documented elsewhere.
Example:
max8997_pmic@66 {
compatible = "maxim,max8997-pmic";
interrupt-parent = <&wakeup_eint>;
reg = <0x66>;
interrupts = <4 0>, <3 0>;
max8997,pmic-buck1-uses-gpio-dvs;
max8997,pmic-buck2-uses-gpio-dvs;
max8997,pmic-buck5-uses-gpio-dvs;
max8997,pmic-ignore-gpiodvs-side-effect;
max8997,pmic-buck125-default-dvs-idx = <0>;
max8997,pmic-buck125-dvs-gpios = <&gpx0 0 1 0 0>, /* SET1 */
<&gpx0 1 1 0 0>, /* SET2 */
<&gpx0 2 1 0 0>; /* SET3 */
max8997,pmic-buck1-dvs-voltage = <1350000>, <1300000>,
<1250000>, <1200000>,
<1150000>, <1100000>,
<1000000>, <950000>;
max8997,pmic-buck2-dvs-voltage = <1100000>, <1100000>,
<1100000>, <1100000>,
<1000000>, <1000000>,
<1000000>, <1000000>;
max8997,pmic-buck5-dvs-voltage = <1200000>, <1200000>,
<1200000>, <1200000>,
<1200000>, <1200000>,
<1200000>, <1200000>;
regulators {
ldo1_reg: LDO1 {
regulator-name = "VDD_ABB_3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
ldo2_reg: LDO2 {
regulator-name = "VDD_ALIVE_1.1V";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1100000>;
regulator-always-on;
};
buck1_reg: BUCK1 {
regulator-name = "VDD_ARM_1.2V";
regulator-min-microvolt = <950000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-boot-on;
};
};
};

View File

@ -0,0 +1,109 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/maxim,max8952.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Maxim MAX8952 voltage regulator
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
allOf:
- $ref: regulator.yaml#
properties:
compatible:
const: maxim,max8952
max8952,default-mode:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1, 2, 3]
description: |
index of default DVS voltage
max8952,dvs-mode-microvolt:
minItems: 4
maxItems: 4
items:
minimum: 770000
maximum: 1400000
description: |
Array of 4 integer values defining DVS voltages in microvolts. All values
must be from range <770000, 1400000>.
max8952,en-gpio:
maxItems: 1
description: |
GPIO used to control enable status of regulator
max8952,ramp-speed:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1, 2, 3, 4, 5, 6, 7]
default: 0
description: |
Voltage ramp speed, values map to:
- 0: 32mV/us
- 1: 16mV/us
- 2: 8mV/us
- 3: 4mV/us
- 4: 2mV/us
- 5: 1mV/us
- 6: 0.5mV/us
- 7: 0.25mV/us
Defaults to 32mV/us if not specified.
max8952,sync-freq:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1, 2]
default: 0
description: |
Sync frequency, values map to:
- 0: 26 MHz
- 1: 13 MHz
- 2: 19.2 MHz
Defaults to 26 MHz if not specified.
max8952,vid-gpios:
minItems: 2
maxItems: 2
description: |
Array of two GPIO pins used for DVS voltage selection
reg:
maxItems: 1
required:
- compatible
- max8952,dvs-mode-microvolt
- reg
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
pmic@60 {
compatible = "maxim,max8952";
reg = <0x60>;
max8952,vid-gpios = <&gpx0 3 GPIO_ACTIVE_HIGH>,
<&gpx0 4 GPIO_ACTIVE_HIGH>;
max8952,default-mode = <0>;
max8952,dvs-mode-microvolt = <1250000>, <1200000>,
<1050000>, <950000>;
max8952,sync-freq = <0>;
max8952,ramp-speed = <0>;
regulator-name = "VARM_1.2V_C210";
regulator-min-microvolt = <770000>;
regulator-max-microvolt = <1400000>;
regulator-always-on;
regulator-boot-on;
};
};

View File

@ -0,0 +1,139 @@
# SPDX-License-Identifier: GPL-2.0-only
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/maxim,max8973.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Maxim MAX8973/MAX77621 voltage regulator
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
allOf:
- $ref: regulator.yaml#
properties:
compatible:
enum:
- maxim,max8973
- maxim,max77621
junction-warn-millicelsius:
description: |
Junction warning temperature threshold in millicelsius. If die
temperature crosses this level then device generates the warning
interrupts.
Please note that thermal functionality is only supported on MAX77621. The
supported threshold warning temperature for MAX77621 are 120 degC and 140
degC.
maxim,dvs-gpio:
maxItems: 1
description: |
GPIO which is connected to DVS pin of device.
maxim,dvs-default-state:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1]
description: |
Default state of GPIO during initialisation.
1 for HIGH and 0 for LOW.
maxim,externally-enable:
type: boolean
description: |
Externally control the regulator output enable/disable.
maxim,enable-gpio:
maxItems: 1
description: |
GPIO for enable control. If the valid GPIO is provided then externally
enable control will be considered.
maxim,enable-remote-sense:
type: boolean
description: Enable remote sense.
maxim,enable-falling-slew-rate:
type: boolean
description: Enable falling slew rate.
maxim,enable-active-discharge:
type: boolean
description: Eable active discharge.
maxim,enable-frequency-shift:
type: boolean
description: Enable 9% frequency shift.
maxim,enable-bias-control:
type: boolean
description: |
Enable bias control which can reduce the startup delay to 20us from 220us.
maxim,enable-etr:
type: boolean
description: Enable Enhanced Transient Response.
maxim,enable-high-etr-sensitivity:
type: boolean
description: |
Enhanced transient response circuit is enabled and set for high
sensitivity. If this property is available then etr will be enable
default.
Enhanced transient response (ETR) will affect the configuration of CKADV.
reg:
maxItems: 1
required:
- compatible
- reg
unevaluatedProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
regulator@1b {
compatible = "maxim,max8973";
reg = <0x1b>;
regulator-min-microvolt = <935000>;
regulator-max-microvolt = <1200000>;
regulator-boot-on;
regulator-always-on;
};
};
- |
#include <dt-bindings/gpio/tegra-gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
regulator@1b {
compatible = "maxim,max77621";
reg = <0x1b>;
interrupt-parent = <&gpio>;
interrupts = <TEGRA_GPIO(Y, 1) IRQ_TYPE_LEVEL_LOW>;
regulator-always-on;
regulator-boot-on;
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <1231250>;
regulator-name = "PPVAR_CPU";
regulator-ramp-delay = <12500>;
maxim,dvs-default-state = <1>;
maxim,enable-active-discharge;
maxim,enable-bias-control;
maxim,enable-etr;
maxim,enable-gpio = <&pmic 5 GPIO_ACTIVE_HIGH>;
maxim,externally-enable;
};
};

View File

@ -0,0 +1,445 @@
# SPDX-License-Identifier: GPL-2.0-only
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/maxim,max8997.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Maxim MAX8997 Power Management IC
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
description: |
The Maxim MAX8997 is a Power Management IC which includes voltage and current
regulators, charger controller with fuel gauge, RTC, clock outputs, haptic
motor driver, flash LED driver and Micro-USB Interface Controller.
The binding here is not complete and describes only regulator and charger
controller parts.
properties:
compatible:
const: maxim,max8997-pmic
charger-supply:
description: |
Regulator node for charging current.
interrupts:
items:
- description: irq1 interrupt
- description: alert interrupt
max8997,pmic-buck1-dvs-voltage:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 8
description: |
A set of 8 voltage values in micro-volt (uV) units for buck1 when
changing voltage using GPIO DVS.
If none of max8997,pmic-buck[1/2/5]-uses-gpio-dvs optional property is
specified, the max8997,pmic-buck[1/2/5]-dvs-voltage property should
specify at least one voltage level (which would be a safe operating
voltage).
max8997,pmic-buck2-dvs-voltage:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 8
description: |
A set of 8 voltage values in micro-volt (uV) units for buck2 when
changing voltage using GPIO DVS.
If none of max8997,pmic-buck[1/2/5]-uses-gpio-dvs optional property is
specified, the max8997,pmic-buck[1/2/5]-dvs-voltage property should
specify at least one voltage level (which would be a safe operating
voltage).
max8997,pmic-buck5-dvs-voltage:
$ref: /schemas/types.yaml#/definitions/uint32-array
minItems: 1
maxItems: 8
description: |
A set of 8 voltage values in micro-volt (uV) units for buck5 when
changing voltage using GPIO DVS.
If none of max8997,pmic-buck[1/2/5]-uses-gpio-dvs optional property is
specified, the max8997,pmic-buck[1/2/5]-dvs-voltage property should
specify at least one voltage level (which would be a safe operating
voltage).
max8997,pmic-buck1-uses-gpio-dvs:
type: boolean
description: |
buck1 can be controlled by GPIO DVS.
max8997,pmic-buck2-uses-gpio-dvs:
type: boolean
description: |
buck2 can be controlled by GPIO DVS.
max8997,pmic-buck5-uses-gpio-dvs:
type: boolean
description: |
buck5 can be controlled by GPIO DVS.
max8997,pmic-buck125-default-dvs-idx:
$ref: /schemas/types.yaml#/definitions/uint32
minimum: 0
maximum: 7
default: 0
description: |
Default voltage setting selected from the possible 8 options selectable
by the dvs gpios. The value of this property should be between 0 and 7.
If not specified or if out of range, the default value of this property
is set to 0.
max8997,pmic-buck125-dvs-gpios:
minItems: 3
maxItems: 3
description: |
GPIO specifiers for three host gpio's used for DVS.
max8997,pmic-ignore-gpiodvs-side-effect:
type: boolean
description: |
When GPIO-DVS mode is used for multiple bucks, changing the voltage value
of one of the bucks may affect that of another buck, which is the side
effect of the change (set_voltage). Use this property to ignore such
side effects and change the voltage.
reg:
maxItems: 1
regulators:
type: object
description:
List of child nodes that specify the regulators.
patternProperties:
# 1-18 and 21 LDOs
"^LDO([1-9]|1[0-8]|21)$":
type: object
$ref: regulator.yaml#
description:
Properties for single LDO regulator.
properties:
regulator-name: true
required:
- regulator-name
unevaluatedProperties: false
# 7 bucks
"^BUCK[1-7]$":
type: object
$ref: regulator.yaml#
description:
Properties for single BUCK regulator.
properties:
regulator-name: true
required:
- regulator-name
unevaluatedProperties: false
"^EN32KHZ_[AC]P$":
type: object
$ref: regulator.yaml#
description:
32768 Hz clock output (modelled as regulator)
properties:
regulator-name: true
regulator-always-on: true
regulator-boot-on: true
required:
- regulator-name
additionalProperties: false
properties:
CHARGER:
type: object
$ref: regulator.yaml#
description: main battery charger current control
properties:
regulator-name: true
required:
- regulator-name
unevaluatedProperties: false
CHARGER_CV:
type: object
$ref: regulator.yaml#
description: main battery charger voltage control
properties:
regulator-name: true
required:
- regulator-name
unevaluatedProperties: false
CHARGER_TOPOFF:
type: object
$ref: regulator.yaml#
description: end of charge current threshold level
properties:
regulator-name: true
required:
- regulator-name
unevaluatedProperties: false
ENVICHG:
type: object
$ref: regulator.yaml#
description: |
Battery Charging Current Monitor Output. This is a fixed voltage type
regulator
properties:
regulator-name: true
required:
- regulator-name
unevaluatedProperties: false
ESAFEOUT1:
type: object
$ref: regulator.yaml#
description: LDO19
properties:
regulator-name: true
required:
- regulator-name
unevaluatedProperties: false
ESAFEOUT2:
type: object
$ref: regulator.yaml#
description: LDO20
properties:
regulator-name: true
required:
- regulator-name
unevaluatedProperties: false
required:
- compatible
- max8997,pmic-buck1-dvs-voltage
- max8997,pmic-buck2-dvs-voltage
- max8997,pmic-buck5-dvs-voltage
- reg
- regulators
dependencies:
max8997,pmic-buck1-uses-gpio-dvs: [ 'max8997,pmic-buck125-dvs-gpios' ]
max8997,pmic-buck2-uses-gpio-dvs: [ 'max8997,pmic-buck125-dvs-gpios' ]
max8997,pmic-buck5-uses-gpio-dvs: [ 'max8997,pmic-buck125-dvs-gpios' ]
additionalProperties: false
if:
anyOf:
- required:
- max8997,pmic-buck1-uses-gpio-dvs
- required:
- max8997,pmic-buck2-uses-gpio-dvs
- required:
- max8997,pmic-buck5-uses-gpio-dvs
then:
properties:
max8997,pmic-buck1-dvs-voltage:
minItems: 8
maxItems: 8
max8997,pmic-buck2-dvs-voltage:
minItems: 8
maxItems: 8
max8997,pmic-buck5-dvs-voltage:
minItems: 8
maxItems: 8
examples:
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
pmic@66 {
compatible = "maxim,max8997-pmic";
reg = <0x66>;
interrupts-extended = <&gpx0 7 IRQ_TYPE_LEVEL_LOW>,
<&gpx2 3 IRQ_TYPE_EDGE_FALLING>;
max8997,pmic-buck1-uses-gpio-dvs;
max8997,pmic-buck2-uses-gpio-dvs;
max8997,pmic-buck5-uses-gpio-dvs;
max8997,pmic-ignore-gpiodvs-side-effect;
max8997,pmic-buck125-default-dvs-idx = <0>;
max8997,pmic-buck125-dvs-gpios = <&gpx0 5 GPIO_ACTIVE_HIGH>,
<&gpx0 6 GPIO_ACTIVE_HIGH>,
<&gpl0 0 GPIO_ACTIVE_HIGH>;
max8997,pmic-buck1-dvs-voltage = <1350000>, <1300000>,
<1250000>, <1200000>,
<1150000>, <1100000>,
<1000000>, <950000>;
max8997,pmic-buck2-dvs-voltage = <1100000>, <1000000>,
<950000>, <900000>,
<1100000>, <1000000>,
<950000>, <900000>;
max8997,pmic-buck5-dvs-voltage = <1200000>, <1200000>,
<1200000>, <1200000>,
<1200000>, <1200000>,
<1200000>, <1200000>;
pinctrl-0 = <&max8997_irq>, <&otg_gp>, <&usb_sel>;
pinctrl-names = "default";
charger-supply = <&charger_reg>;
regulators {
LDO1 {
regulator-name = "VADC_3.3V_C210";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
LDO2 {
regulator-name = "VALIVE_1.1V_C210";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1100000>;
regulator-always-on;
};
BUCK1 {
regulator-name = "VARM_1.2V_C210";
regulator-min-microvolt = <65000>;
regulator-max-microvolt = <2225000>;
regulator-always-on;
};
// ...
BUCK7 {
regulator-name = "VCC_SUB_2.0V";
regulator-min-microvolt = <2000000>;
regulator-max-microvolt = <2000000>;
regulator-always-on;
};
ESAFEOUT1 {
regulator-name = "SAFEOUT1";
};
ESAFEOUT2 {
regulator-name = "SAFEOUT2";
regulator-boot-on;
};
EN32KHZ_AP {
regulator-name = "EN32KHZ_AP";
regulator-always-on;
};
EN32KHZ_CP {
regulator-name = "EN32KHZ_CP";
regulator-always-on;
};
CHARGER {
regulator-name = "CHARGER";
regulator-min-microamp = <200000>;
regulator-max-microamp = <950000>;
};
CHARGER_CV {
regulator-name = "CHARGER_CV";
regulator-min-microvolt = <4200000>;
regulator-max-microvolt = <4200000>;
regulator-always-on;
};
CHARGER_TOPOFF {
regulator-name = "CHARGER_TOPOFF";
regulator-min-microamp = <200000>;
regulator-max-microamp = <200000>;
regulator-always-on;
};
};
};
};
- |
#include <dt-bindings/interrupt-controller/irq.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
pmic@66 {
compatible = "maxim,max8997-pmic";
reg = <0x66>;
interrupt-parent = <&gpx0>;
interrupts = <4 IRQ_TYPE_LEVEL_LOW>,
<3 IRQ_TYPE_EDGE_FALLING>;
pinctrl-names = "default";
pinctrl-0 = <&max8997_irq>;
max8997,pmic-buck1-dvs-voltage = <1350000>;
max8997,pmic-buck2-dvs-voltage = <1100000>;
max8997,pmic-buck5-dvs-voltage = <1200000>;
regulators {
LDO1 {
regulator-name = "VDD_ABB_3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
// ...
BUCK1 {
regulator-name = "VDD_ARM_1.2V";
regulator-min-microvolt = <950000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-boot-on;
};
// ...
EN32KHZ_AP {
regulator-name = "EN32KHZ_AP";
regulator-always-on;
};
};
};
};

View File

@ -35,6 +35,7 @@ description: |
PMIC. Supported regulator node names are
For PM6150, smps1 - smps5, ldo1 - ldo19
For PM6150L, smps1 - smps8, ldo1 - ldo11, bob
For PM6350, smps1 - smps5, ldo1 - ldo22
For PM7325, smps1 - smps8, ldo1 - ldo19
For PM8005, smps1 - smps4
For PM8009, smps1 - smps2, ldo1 - ldo7
@ -52,6 +53,7 @@ properties:
enum:
- qcom,pm6150-rpmh-regulators
- qcom,pm6150l-rpmh-regulators
- qcom,pm6350-rpmh-regulators
- qcom,pm7325-rpmh-regulators
- qcom,pm8005-rpmh-regulators
- qcom,pm8009-rpmh-regulators

View File

@ -65,6 +65,9 @@ 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:
- Kathiravan T <kathirav@codeaurora.org>
@ -86,6 +89,7 @@ properties:
- qcom,rpm-pmi8994-regulators
- qcom,rpm-pmi8998-regulators
- qcom,rpm-pms405-regulators
- qcom,rpm-pm2250-regulators
patternProperties:
".*-supply$":

View File

@ -1,79 +0,0 @@
Binding for Samsung S2MPA01 regulator block
===========================================
This is a part of device tree bindings for S2M family multi-function devices.
More information can be found in bindings/mfd/sec-core.txt file.
The S2MPA01 device provide buck and LDO regulators.
To register these with regulator framework instantiate under main device node
a sub-node named "regulators" with more sub-nodes for each regulator using the
common regulator binding documented in:
- Documentation/devicetree/bindings/regulator/regulator.txt
Names of regulators supported by S2MPA01 device:
- LDOn
- valid values for n are 1 to 26
- Example: LDO1, LD02, LDO26
- BUCKn
- valid values for n are 1 to 10.
- Example: BUCK1, BUCK2, BUCK9
Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
as per the datasheet of device.
Optional properties of buck regulator nodes under "regulators" sub-node:
- regulator-ramp-delay: ramp delay in uV/us. May be 6250, 12500
(default), 25000, or 50000. May be 0 for disabling the ramp delay on
BUCK{1,2,3,4}.
In the absence of the regulator-ramp-delay property, the default ramp
delay will be used.
Note: Some bucks share the ramp rate setting i.e. same ramp value
will be set for a particular group of bucks so provide the same
regulator-ramp-delay value for them.
Groups sharing ramp rate:
- buck{1,6},
- buck{2,4},
- buck{8,9,10}.
Example:
s2mpa01_pmic@66 {
compatible = "samsung,s2mpa01-pmic";
reg = <0x66>;
regulators {
ldo1_reg: LDO1 {
regulator-name = "VDD_ALIVE";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
};
ldo2_reg: LDO2 {
regulator-name = "VDDQ_MMC2";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
regulator-always-on;
};
buck1_reg: BUCK1 {
regulator-name = "vdd_mif";
regulator-min-microvolt = <950000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-boot-on;
};
buck2_reg: BUCK2 {
regulator-name = "vdd_arm";
regulator-min-microvolt = <950000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-boot-on;
regulator-ramp-delay = <50000>;
};
};
};

View File

@ -0,0 +1,62 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/samsung,s2mpa01.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung S2MPA01 Power Management IC regulators
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
description: |
This is a part of device tree bindings for S2M and S5M family of Power
Management IC (PMIC).
The S2MPA01 provides buck and LDO regulators.
See also Documentation/devicetree/bindings/mfd/samsung,s2mpa01.yaml for
additional information and example.
patternProperties:
# 26 LDOs
"^LDO([1-9]|1[0-9]|2[0-6])$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single LDO regulator.
required:
- regulator-name
# 10 bucks
"^BUCK([1-9]|10)$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single BUCK regulator.
properties:
regulator-ramp-delay:
enum: [0, 6250, 12500, 25000, 50000]
default: 12500
description: |
May be 0 for disabling the ramp delay on BUCK{1,2,3,4}.
In the absence of the regulator-ramp-delay property, the default ramp
delay will be used.
Note: Some bucks share the ramp rate setting i.e. same ramp value
will be set for a particular group of bucks so provide the same
regulator-ramp-delay value for them.
Groups sharing ramp rate:
* buck{1,6},
* buck{2,4},
* buck{8,9,10}.
required:
- regulator-name
additionalProperties: false

View File

@ -1,102 +0,0 @@
Binding for Samsung S2M family regulator block
==============================================
This is a part of device tree bindings for S2M family multi-function devices.
More information can be found in bindings/mfd/sec-core.txt file.
The S2MPS11/13/14/15 and S2MPU02 devices provide buck and LDO regulators.
To register these with regulator framework instantiate under main device node
a sub-node named "regulators" with more sub-nodes for each regulator using the
common regulator binding documented in:
- Documentation/devicetree/bindings/regulator/regulator.txt
Names of regulators supported by different devices:
- LDOn
- valid values for n are:
- S2MPS11: 1 to 38
- S2MPS13: 1 to 40
- S2MPS14: 1 to 25
- S2MPS15: 1 to 27
- S2MPU02: 1 to 28
- Example: LDO1, LDO2, LDO28
- BUCKn
- valid values for n are:
- S2MPS11: 1 to 10
- S2MPS13: 1 to 10
- S2MPS14: 1 to 5
- S2MPS15: 1 to 10
- S2MPU02: 1 to 7
- Example: BUCK1, BUCK2, BUCK9
Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
as per the datasheet of device.
Optional properties of the nodes under "regulators" sub-node:
- regulator-ramp-delay: ramp delay in uV/us. May be 6250, 12500,
25000 (default) or 50000.
Additionally S2MPS11 supports disabling ramp delay for BUCK{2,3,4,6}
by setting it to <0>.
Note: On S2MPS11 some bucks share the ramp rate setting i.e. same ramp value
will be set for a particular group of bucks so provide the same
regulator-ramp-delay value for them.
Groups sharing ramp rate:
- buck{1,6},
- buck{3,4},
- buck{7,8,10}.
- samsung,ext-control-gpios: On S2MPS14 the LDO10, LDO11 and LDO12 can be
configured to external control over GPIO. To turn this feature on this
property must be added to the regulator sub-node:
- samsung,ext-control-gpios: GPIO specifier for one GPIO
controlling this regulator (enable/disable)
Example:
LDO12 {
regulator-name = "V_EMMC_2.8V";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
samsung,ext-control-gpios = <&gpk0 2 0>;
};
Example:
s2mps11_pmic@66 {
compatible = "samsung,s2mps11-pmic";
reg = <0x66>;
regulators {
ldo1_reg: LDO1 {
regulator-name = "VDD_ABB_3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
};
ldo2_reg: LDO2 {
regulator-name = "VDD_ALIVE_1.1V";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1100000>;
regulator-always-on;
};
buck1_reg: BUCK1 {
regulator-name = "vdd_mif";
regulator-min-microvolt = <950000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-boot-on;
};
buck2_reg: BUCK2 {
regulator-name = "vdd_arm";
regulator-min-microvolt = <950000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-boot-on;
regulator-ramp-delay = <50000>;
};
};
};

View File

@ -0,0 +1,44 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/samsung,s2mps11.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung S2MPS11 Power Management IC regulators
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
description: |
This is a part of device tree bindings for S2M and S5M family of Power
Management IC (PMIC).
The S2MPS11 provides buck and LDO regulators.
See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
additional information and example.
patternProperties:
# 38 LDOs
"^LDO([1-9]|[1-2][0-9]|3[0-8])$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single LDO regulator.
required:
- regulator-name
# 10 bucks
"^BUCK([1-9]|10)$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single BUCK regulator.
required:
- regulator-name
additionalProperties: false

View File

@ -0,0 +1,44 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/samsung,s2mps13.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung S2MPS13 Power Management IC regulators
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
description: |
This is a part of device tree bindings for S2M and S5M family of Power
Management IC (PMIC).
The S2MPS13 provides buck and LDO regulators.
See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
additional information and example.
patternProperties:
# 40 LDOs
"^LDO([1-9]|[1-3][0-9]|40)$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single LDO regulator.
required:
- regulator-name
# 10 bucks
"^BUCK([1-9]|10)$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single BUCK regulator.
required:
- regulator-name
additionalProperties: false

View File

@ -0,0 +1,44 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/samsung,s2mps14.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung S2MPS14 Power Management IC regulators
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
description: |
This is a part of device tree bindings for S2M and S5M family of Power
Management IC (PMIC).
The S2MPS14 provides buck and LDO regulators.
See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
additional information and example.
patternProperties:
# 25 LDOs
"^LDO([1-9]|[1][0-9]|2[0-5])$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single LDO regulator.
required:
- regulator-name
# 5 bucks
"^BUCK[1-5]$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single BUCK regulator.
required:
- regulator-name
additionalProperties: false

View File

@ -0,0 +1,44 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/samsung,s2mps15.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung S2MPS15 Power Management IC regulators
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
description: |
This is a part of device tree bindings for S2M and S5M family of Power
Management IC (PMIC).
The S2MPS15 provides buck and LDO regulators.
See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
additional information and example.
patternProperties:
# 27 LDOs
"^LDO([1-9]|[1][0-9]|2[0-7])$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single LDO regulator.
required:
- regulator-name
# 10 bucks
"^BUCK([1-9]|10)$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single BUCK regulator.
required:
- regulator-name
additionalProperties: false

View File

@ -0,0 +1,44 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/samsung,s2mpu02.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung S2MPU02 Power Management IC regulators
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
description: |
This is a part of device tree bindings for S2M and S5M family of Power
Management IC (PMIC).
The S2MPU02 provides buck and LDO regulators.
See also Documentation/devicetree/bindings/mfd/samsung,s2mps11.yaml for
additional information and example.
patternProperties:
# 28 LDOs
"^LDO([1-9]|1[0-9]|2[0-8])$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single LDO regulator.
required:
- regulator-name
# 7 bucks
"^BUCK[1-7]$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single BUCK regulator.
required:
- regulator-name
additionalProperties: false

View File

@ -1,145 +0,0 @@
Binding for Samsung S5M8767 regulator block
===========================================
This is a part of device tree bindings for S5M family multi-function devices.
More information can be found in bindings/mfd/sec-core.txt file.
The S5M8767 device provide buck and LDO regulators.
To register these with regulator framework instantiate under main device node
a sub-node named "regulators" with more sub-nodes for each regulator using the
common regulator binding documented in:
- Documentation/devicetree/bindings/regulator/regulator.txt
Required properties of the main device node (the parent!):
- s5m8767,pmic-buck2-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
units for buck2 when changing voltage using gpio dvs. Refer to [1] below
for additional information.
- s5m8767,pmic-buck3-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
units for buck3 when changing voltage using gpio dvs. Refer to [1] below
for additional information.
- s5m8767,pmic-buck4-dvs-voltage: A set of 8 voltage values in micro-volt (uV)
units for buck4 when changing voltage using gpio dvs. Refer to [1] below
for additional information.
- s5m8767,pmic-buck-ds-gpios: GPIO specifiers for three host gpio's used
for selecting GPIO DVS lines. It is one-to-one mapped to dvs gpio lines.
[1] If none of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
property is specified, the 's5m8767,pmic-buck[2/3/4]-dvs-voltage'
property should specify atleast one voltage level (which would be a
safe operating voltage).
If either of the 's5m8767,pmic-buck[2/3/4]-uses-gpio-dvs' optional
property is specified, then all the eight voltage values for the
's5m8767,pmic-buck[2/3/4]-dvs-voltage' should be specified.
Optional properties of the main device node (the parent!):
- s5m8767,pmic-buck2-uses-gpio-dvs: 'buck2' can be controlled by gpio dvs.
- s5m8767,pmic-buck3-uses-gpio-dvs: 'buck3' can be controlled by gpio dvs.
- s5m8767,pmic-buck4-uses-gpio-dvs: 'buck4' can be controlled by gpio dvs.
Additional properties required if either of the optional properties are used:
- s5m8767,pmic-buck234-default-dvs-idx: Default voltage setting selected from
the possible 8 options selectable by the dvs gpios. The value of this
property should be between 0 and 7. If not specified or if out of range, the
default value of this property is set to 0.
- s5m8767,pmic-buck-dvs-gpios: GPIO specifiers for three host gpio's used
for dvs. The format of the gpio specifier depends in the gpio controller.
Names of regulators supported by S5M8767 device:
- LDOn
- valid values for n are 1 to 28
- Example: LDO1, LDO2, LDO28
- BUCKn
- valid values for n are 1 to 9.
- Example: BUCK1, BUCK2, BUCK9
Note: The 'n' in LDOn and BUCKn represents the LDO or BUCK number
as per the datasheet of device.
Optional properties of the nodes under "regulators" sub-node:
- op_mode: describes the different operating modes of the LDO's with
power mode change in SOC. The different possible values are,
0 - always off mode
1 - on in normal mode
2 - low power mode
3 - suspend mode
- s5m8767,pmic-ext-control-gpios: (optional) GPIO specifier for one
GPIO controlling this regulator
(enable/disable); This is valid only
for buck9.
Example:
s5m8767_pmic@66 {
compatible = "samsung,s5m8767-pmic";
reg = <0x66>;
s5m8767,pmic-buck2-uses-gpio-dvs;
s5m8767,pmic-buck3-uses-gpio-dvs;
s5m8767,pmic-buck4-uses-gpio-dvs;
s5m8767,pmic-buck-default-dvs-idx = <0>;
s5m8767,pmic-buck-dvs-gpios = <&gpx0 0 0>, /* DVS1 */
<&gpx0 1 0>, /* DVS2 */
<&gpx0 2 0>; /* DVS3 */
s5m8767,pmic-buck-ds-gpios = <&gpx2 3 0>, /* SET1 */
<&gpx2 4 0>, /* SET2 */
<&gpx2 5 0>; /* SET3 */
s5m8767,pmic-buck2-dvs-voltage = <1350000>, <1300000>,
<1250000>, <1200000>,
<1150000>, <1100000>,
<1000000>, <950000>;
s5m8767,pmic-buck3-dvs-voltage = <1100000>, <1100000>,
<1100000>, <1100000>,
<1000000>, <1000000>,
<1000000>, <1000000>;
s5m8767,pmic-buck4-dvs-voltage = <1200000>, <1200000>,
<1200000>, <1200000>,
<1200000>, <1200000>,
<1200000>, <1200000>;
regulators {
ldo1_reg: LDO1 {
regulator-name = "VDD_ABB_3.3V";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
op_mode = <1>; /* Normal Mode */
};
ldo2_reg: LDO2 {
regulator-name = "VDD_ALIVE_1.1V";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1100000>;
regulator-always-on;
};
buck1_reg: BUCK1 {
regulator-name = "VDD_MIF_1.2V";
regulator-min-microvolt = <950000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-boot-on;
};
vemmc_reg: BUCK9 {
regulator-name = "VMEM_VDD_2.8V";
regulator-min-microvolt = <2800000>;
regulator-max-microvolt = <2800000>;
op_mode = <3>; /* Standby Mode */
s5m8767,pmic-ext-control-gpios = <&gpk0 2 0>;
};
};
};

View File

@ -0,0 +1,74 @@
# SPDX-License-Identifier: GPL-2.0-only OR BSD-2-Clause
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/samsung,s5m8767.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Samsung S5M8767 Power Management IC regulators
maintainers:
- Krzysztof Kozlowski <krzysztof.kozlowski@canonical.com>
description: |
This is a part of device tree bindings for S2M and S5M family of Power
Management IC (PMIC).
The S5M8767 provides buck and LDO regulators.
See also Documentation/devicetree/bindings/mfd/samsung,s5m8767.yaml for
additional information and example.
patternProperties:
# 28 LDOs
"^LDO([1-9]|1[0-9]|2[0-8])$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single LDO regulator.
properties:
op_mode:
$ref: /schemas/types.yaml#/definitions/uint32
enum: [0, 1, 2, 3]
default: 1
description: |
Describes the different operating modes of the LDO's with power mode
change in SOC. The different possible values are:
0 - always off mode
1 - on in normal mode
2 - low power mode
3 - suspend mode
required:
- regulator-name
# 8 bucks
"^BUCK[1-8]$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single BUCK regulator.
required:
- regulator-name
# 9 buck
"^BUCK9$":
type: object
$ref: regulator.yaml#
unevaluatedProperties: false
description:
Properties for single BUCK regulator.
properties:
s5m8767,pmic-ext-control-gpios:
maxItems: 1
description: |
GPIO specifier for one GPIO controlling this regulator on/off.
required:
- regulator-name
additionalProperties: false

View File

@ -0,0 +1,52 @@
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/silergy,sy8106a.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Silergy SY8106A Voltage Regulator Device Tree Bindings
maintainers:
- Ondrej Jirman <megous@megous.com>
allOf:
- $ref: regulator.yaml#
properties:
compatible:
const: silergy,sy8106a
reg:
maxItems: 1
silergy,fixed-microvolt:
description: >
The voltage when I2C regulating is disabled (set by external resistor
like a fixed voltage)
required:
- compatible
- reg
- silergy,fixed-microvolt
unevaluatedProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
regulator@65 {
compatible = "silergy,sy8106a";
reg = <0x65>;
regulator-name = "sy8106a-vdd";
silergy,fixed-microvolt = <1200000>;
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1400000>;
regulator-boot-on;
regulator-always-on;
};
};
...

View File

@ -27,6 +27,7 @@ properties:
- socionext,uniphier-pxs2-usb3-regulator
- socionext,uniphier-ld20-usb3-regulator
- socionext,uniphier-pxs3-usb3-regulator
- socionext,uniphier-nx1-usb3-regulator
reg:
maxItems: 1

View File

@ -1,23 +0,0 @@
SY8106A Voltage regulator
Required properties:
- compatible: Must be "silergy,sy8106a"
- reg: I2C slave address - must be <0x65>
- silergy,fixed-microvolt - the voltage when I2C regulating is disabled (set
by external resistor like a fixed voltage)
Any property defined as part of the core regulator binding, defined in
./regulator.txt, can also be used.
Example:
sy8106a {
compatible = "silergy,sy8106a";
reg = <0x65>;
regulator-name = "sy8106a-vdd";
silergy,fixed-microvolt = <1200000>;
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1400000>;
regulator-boot-on;
regulator-always-on;
};

View File

@ -16561,10 +16561,10 @@ M: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
L: linux-kernel@vger.kernel.org
L: linux-samsung-soc@vger.kernel.org
S: Supported
F: Documentation/devicetree/bindings/clock/samsung,s2mps11.txt
F: Documentation/devicetree/bindings/clock/samsung,s2mps11.yaml
F: Documentation/devicetree/bindings/mfd/samsung,sec-core.txt
F: Documentation/devicetree/bindings/regulator/samsung,s2m*.txt
F: Documentation/devicetree/bindings/regulator/samsung,s5m*.txt
F: Documentation/devicetree/bindings/regulator/samsung,s2m*.yaml
F: Documentation/devicetree/bindings/regulator/samsung,s5m*.yaml
F: drivers/clk/clk-s2mps11.c
F: drivers/mfd/sec*.c
F: drivers/regulator/s2m*.c

View File

@ -609,12 +609,12 @@ config REGULATOR_MAX8952
modes ranging from 0.77V to 1.40V by 0.01V steps.
config REGULATOR_MAX8973
tristate "Maxim MAX8973 voltage regulator "
tristate "Maxim MAX8973A voltage regulator"
depends on I2C
depends on THERMAL && THERMAL_OF
select REGMAP_I2C
help
The MAXIM MAX8973 high-efficiency. three phase, DC-DC step-down
The MAXIM MAX8973A high-efficiency. three phase, DC-DC step-down
switching regulator delivers up to 9A of output current. Each
phase operates at a 2MHz fixed frequency with a 120 deg shift
from the adjacent phase, allowing the use of small magnetic component.
@ -1181,7 +1181,7 @@ config REGULATOR_STPMIC1
config REGULATOR_TI_ABB
tristate "TI Adaptive Body Bias on-chip LDO"
depends on ARCH_OMAP
depends on ARCH_OMAP || COMPILE_TEST
help
Select this option to support Texas Instruments' on-chip Adaptive Body
Bias (ABB) LDO regulators. It is recommended that this option be
@ -1339,15 +1339,6 @@ config REGULATOR_TPS65912
help
This driver supports TPS65912 voltage regulator chip.
config REGULATOR_TPS80031
tristate "TI TPS80031/TPS80032 power regulator driver"
depends on MFD_TPS80031
help
TPS80031/ TPS80032 Fully Integrated Power Management with Power
Path and Battery Charger. It has 5 configurable step-down
converters, 11 general purpose LDOs, VBUS generator and digital
output to control regulators.
config REGULATOR_TWL4030
tristate "TI TWL4030/TWL5030/TWL6030/TPS659x0 PMIC"
depends on TWL4030_CORE

View File

@ -158,7 +158,6 @@ obj-$(CONFIG_REGULATOR_TPS6524X) += tps6524x-regulator.o
obj-$(CONFIG_REGULATOR_TPS6586X) += tps6586x-regulator.o
obj-$(CONFIG_REGULATOR_TPS65910) += tps65910-regulator.o
obj-$(CONFIG_REGULATOR_TPS65912) += tps65912-regulator.o
obj-$(CONFIG_REGULATOR_TPS80031) += tps80031-regulator.o
obj-$(CONFIG_REGULATOR_TPS65132) += tps65132-regulator.o
obj-$(CONFIG_REGULATOR_TWL4030) += twl-regulator.o twl6030-regulator.o
obj-$(CONFIG_REGULATOR_UNIPHIER) += uniphier-regulator.o

View File

@ -461,9 +461,9 @@ static const struct regulator_ops bd7181x_led_regulator_ops = {
.min_uV = (min), \
.uV_step = (step), \
.vsel_reg = (vsel), \
.vsel_mask = 0x3f, \
.vsel_mask = BD71815_VOLT_MASK, \
.enable_reg = (ereg), \
.enable_mask = 0x04, \
.enable_mask = BD71815_BUCK_RUN_ON, \
.ramp_reg = (ereg), \
.ramp_mask = BD71815_BUCK_RAMPRATE_MASK, \
.ramp_delay_table = bd7181x_ramp_table, \

View File

@ -1151,9 +1151,10 @@ static int machine_constraints_voltage(struct regulator_dev *rdev,
}
if (current_uV < 0) {
rdev_err(rdev,
"failed to get the current voltage: %pe\n",
ERR_PTR(current_uV));
if (current_uV != -EPROBE_DEFER)
rdev_err(rdev,
"failed to get the current voltage: %pe\n",
ERR_PTR(current_uV));
return current_uV;
}
@ -1570,7 +1571,7 @@ static int set_supply(struct regulator_dev *rdev,
{
int err;
rdev_info(rdev, "supplied by %s\n", rdev_get_name(supply_rdev));
rdev_dbg(rdev, "supplied by %s\n", rdev_get_name(supply_rdev));
if (!try_module_get(supply_rdev->owner))
return -ENODEV;
@ -4248,6 +4249,9 @@ int regulator_sync_voltage(struct regulator *regulator)
struct regulator_voltage *voltage = &regulator->voltage[PM_SUSPEND_ON];
int ret, min_uV, max_uV;
if (!regulator_ops_is_valid(rdev, REGULATOR_CHANGE_VOLTAGE))
return 0;
regulator_lock(rdev);
if (!rdev->desc->ops->set_voltage &&

View File

@ -45,7 +45,8 @@ static int dummy_regulator_probe(struct platform_device *pdev)
config.dev = &pdev->dev;
config.init_data = &dummy_initdata;
dummy_regulator_rdev = regulator_register(&dummy_desc, &config);
dummy_regulator_rdev = devm_regulator_register(&pdev->dev, &dummy_desc,
&config);
if (IS_ERR(dummy_regulator_rdev)) {
ret = PTR_ERR(dummy_regulator_rdev);
pr_err("Failed to register regulator: %d\n", ret);

View File

@ -10,13 +10,12 @@
#include <linux/i2c.h>
#include <linux/regmap.h>
#include <linux/err.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/delay.h>
#include <linux/regulator/lp872x.h>
#include <linux/regulator/driver.h>
#include <linux/platform_device.h>
#include <linux/of.h>
#include <linux/of_gpio.h>
#include <linux/regulator/of_regulator.h>
/* Registers : LP8720/8725 shared */
@ -104,7 +103,7 @@ struct lp872x {
enum lp872x_id chipid;
struct lp872x_platform_data *pdata;
int num_regulators;
enum lp872x_dvs_state dvs_pin;
enum gpiod_flags dvs_pin;
};
/* LP8720/LP8725 shared voltage table for LDOs */
@ -250,12 +249,12 @@ static int lp872x_regulator_enable_time(struct regulator_dev *rdev)
}
static void lp872x_set_dvs(struct lp872x *lp, enum lp872x_dvs_sel dvs_sel,
int gpio)
struct gpio_desc *gpio)
{
enum lp872x_dvs_state state;
enum gpiod_flags state;
state = dvs_sel == SEL_V1 ? DVS_HIGH : DVS_LOW;
gpio_set_value(gpio, state);
state = dvs_sel == SEL_V1 ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
gpiod_set_value(gpio, state);
lp->dvs_pin = state;
}
@ -270,7 +269,7 @@ static u8 lp872x_select_buck_vout_addr(struct lp872x *lp,
switch (buck) {
case LP8720_ID_BUCK:
if (val & LP8720_EXT_DVS_M) {
addr = (lp->dvs_pin == DVS_HIGH) ?
addr = (lp->dvs_pin == GPIOD_OUT_HIGH) ?
LP8720_BUCK_VOUT1 : LP8720_BUCK_VOUT2;
} else {
if (lp872x_read_byte(lp, LP8720_ENABLE, &val))
@ -284,7 +283,7 @@ static u8 lp872x_select_buck_vout_addr(struct lp872x *lp,
if (val & LP8725_DVS1_M)
addr = LP8725_BUCK1_VOUT1;
else
addr = (lp->dvs_pin == DVS_HIGH) ?
addr = (lp->dvs_pin == GPIOD_OUT_HIGH) ?
LP8725_BUCK1_VOUT1 : LP8725_BUCK1_VOUT2;
break;
case LP8725_ID_BUCK2:
@ -321,7 +320,7 @@ static int lp872x_buck_set_voltage_sel(struct regulator_dev *rdev,
u8 addr, mask = LP872X_VOUT_M;
struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs : NULL;
if (dvs && gpio_is_valid(dvs->gpio))
if (dvs && dvs->gpio)
lp872x_set_dvs(lp, dvs->vsel, dvs->gpio);
addr = lp872x_select_buck_vout_addr(lp, buck);
@ -675,24 +674,23 @@ static const struct regulator_desc lp8725_regulator_desc[] = {
static int lp872x_init_dvs(struct lp872x *lp)
{
int ret, gpio;
struct lp872x_dvs *dvs = lp->pdata ? lp->pdata->dvs : NULL;
enum lp872x_dvs_state pinstate;
enum gpiod_flags pinstate;
u8 mask[] = { LP8720_EXT_DVS_M, LP8725_DVS1_M | LP8725_DVS2_M };
u8 default_dvs_mode[] = { LP8720_DEFAULT_DVS, LP8725_DEFAULT_DVS };
if (!dvs)
goto set_default_dvs_mode;
gpio = dvs->gpio;
if (!gpio_is_valid(gpio))
if (!dvs->gpio)
goto set_default_dvs_mode;
pinstate = dvs->init_state;
ret = devm_gpio_request_one(lp->dev, gpio, pinstate, "LP872X DVS");
if (ret) {
dev_err(lp->dev, "gpio request err: %d\n", ret);
return ret;
dvs->gpio = devm_gpiod_get_optional(lp->dev, "ti,dvs", pinstate);
if (IS_ERR(dvs->gpio)) {
dev_err(lp->dev, "gpio request err: %ld\n", PTR_ERR(dvs->gpio));
return PTR_ERR(dvs->gpio);
}
lp->dvs_pin = pinstate;
@ -706,20 +704,17 @@ set_default_dvs_mode:
static int lp872x_hw_enable(struct lp872x *lp)
{
int ret, gpio;
if (!lp->pdata)
return -EINVAL;
gpio = lp->pdata->enable_gpio;
if (!gpio_is_valid(gpio))
if (!lp->pdata->enable_gpio)
return 0;
/* Always set enable GPIO high. */
ret = devm_gpio_request_one(lp->dev, gpio, GPIOF_OUT_INIT_HIGH, "LP872X EN");
if (ret) {
dev_err(lp->dev, "gpio request err: %d\n", ret);
return ret;
lp->pdata->enable_gpio = devm_gpiod_get_optional(lp->dev, "enable", GPIOD_OUT_HIGH);
if (IS_ERR(lp->pdata->enable_gpio)) {
dev_err(lp->dev, "gpio request err: %ld\n", PTR_ERR(lp->pdata->enable_gpio));
return PTR_ERR(lp->pdata->enable_gpio);
}
/* Each chip has a different enable delay. */
@ -844,12 +839,9 @@ static struct lp872x_platform_data
if (!pdata->dvs)
return ERR_PTR(-ENOMEM);
pdata->dvs->gpio = of_get_named_gpio(np, "ti,dvs-gpio", 0);
of_property_read_u8(np, "ti,dvs-vsel", (u8 *)&pdata->dvs->vsel);
of_property_read_u8(np, "ti,dvs-state", &dvs_state);
pdata->dvs->init_state = dvs_state ? DVS_HIGH : DVS_LOW;
pdata->enable_gpio = of_get_named_gpio(np, "enable-gpios", 0);
pdata->dvs->init_state = dvs_state ? GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
if (of_get_child_count(np) == 0)
goto out;

View File

@ -1,7 +1,7 @@
/*
* max8973-regulator.c -- Maxim max8973
* max8973-regulator.c -- Maxim max8973A
*
* Regulator driver for MAXIM 8973 DC-DC step-down switching regulator.
* Regulator driver for MAXIM 8973A DC-DC step-down switching regulator.
*
* Copyright (c) 2012, NVIDIA Corporation.
*

View File

@ -352,15 +352,9 @@ static int pwm_regulator_probe(struct platform_device *pdev)
config.init_data = init_data;
drvdata->pwm = devm_pwm_get(&pdev->dev, NULL);
if (IS_ERR(drvdata->pwm)) {
ret = PTR_ERR(drvdata->pwm);
if (ret == -EPROBE_DEFER)
dev_dbg(&pdev->dev,
"Failed to get PWM, deferring probe\n");
else
dev_err(&pdev->dev, "Failed to get PWM: %d\n", ret);
return ret;
}
if (IS_ERR(drvdata->pwm))
return dev_err_probe(&pdev->dev, PTR_ERR(drvdata->pwm),
"Failed to get PWM\n");
if (init_data->constraints.boot_on || init_data->constraints.always_on)
gpio_flags = GPIOD_OUT_HIGH;

View File

@ -1047,6 +1047,34 @@ static const struct rpmh_vreg_init_data pm6150l_vreg_data[] = {
{}
};
static const struct rpmh_vreg_init_data pm6350_vreg_data[] = {
RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps510, NULL),
RPMH_VREG("smps2", "smp%s2", &pmic5_hfsmps510, NULL),
/* smps3 - smps5 not configured */
RPMH_VREG("ldo1", "ldo%s1", &pmic5_nldo, NULL),
RPMH_VREG("ldo2", "ldo%s2", &pmic5_pldo, NULL),
RPMH_VREG("ldo3", "ldo%s3", &pmic5_pldo, NULL),
RPMH_VREG("ldo4", "ldo%s4", &pmic5_nldo, NULL),
RPMH_VREG("ldo5", "ldo%s5", &pmic5_pldo, NULL),
RPMH_VREG("ldo6", "ldo%s6", &pmic5_pldo, NULL),
RPMH_VREG("ldo7", "ldo%s7", &pmic5_pldo, NULL),
RPMH_VREG("ldo8", "ldo%s8", &pmic5_pldo, NULL),
RPMH_VREG("ldo9", "ldo%s9", &pmic5_pldo, NULL),
RPMH_VREG("ldo10", "ldo%s10", &pmic5_pldo, NULL),
RPMH_VREG("ldo11", "ldo%s11", &pmic5_pldo, NULL),
RPMH_VREG("ldo12", "ldo%s12", &pmic5_pldo, NULL),
RPMH_VREG("ldo13", "ldo%s13", &pmic5_nldo, NULL),
RPMH_VREG("ldo14", "ldo%s14", &pmic5_pldo, NULL),
RPMH_VREG("ldo15", "ldo%s15", &pmic5_nldo, NULL),
RPMH_VREG("ldo16", "ldo%s16", &pmic5_nldo, NULL),
/* ldo17 not configured */
RPMH_VREG("ldo18", "ldo%s18", &pmic5_nldo, NULL),
RPMH_VREG("ldo19", "ldo%s19", &pmic5_nldo, NULL),
RPMH_VREG("ldo20", "ldo%s20", &pmic5_nldo, NULL),
RPMH_VREG("ldo21", "ldo%s21", &pmic5_nldo, NULL),
RPMH_VREG("ldo22", "ldo%s22", &pmic5_nldo, NULL),
};
static const struct rpmh_vreg_init_data pmx55_vreg_data[] = {
RPMH_VREG("smps1", "smp%s1", &pmic5_ftsmps510, "vdd-s1"),
RPMH_VREG("smps2", "smp%s2", &pmic5_hfsmps510, "vdd-s2"),
@ -1201,6 +1229,10 @@ static const struct of_device_id __maybe_unused rpmh_regulator_match_table[] = {
.compatible = "qcom,pm6150l-rpmh-regulators",
.data = pm6150l_vreg_data,
},
{
.compatible = "qcom,pm6350-rpmh-regulators",
.data = pm6350_vreg_data,
},
{
.compatible = "qcom,pmc8180-rpmh-regulators",
.data = pm8150_vreg_data,

View File

@ -738,6 +738,24 @@ static const struct regulator_desc mp5496_ldoa2 = {
.ops = &rpm_mp5496_ops,
};
static const struct regulator_desc pm2250_lvftsmps = {
.linear_ranges = (struct linear_range[]) {
REGULATOR_LINEAR_RANGE(320000, 0, 269, 4000),
},
.n_linear_ranges = 1,
.n_voltages = 270,
.ops = &rpm_smps_ldo_ops,
};
static const struct regulator_desc pm2250_ftsmps = {
.linear_ranges = (struct linear_range[]) {
REGULATOR_LINEAR_RANGE(640000, 0, 269, 8000),
},
.n_linear_ranges = 1,
.n_voltages = 270,
.ops = &rpm_smps_ldo_ops,
};
struct rpm_regulator_data {
const char *name;
u32 type;
@ -1170,6 +1188,36 @@ static const struct rpm_regulator_data rpm_pms405_regulators[] = {
{}
};
static const struct rpm_regulator_data rpm_pm2250_regulators[] = {
{ "s1", QCOM_SMD_RPM_SMPA, 1, &pm2250_lvftsmps, "vdd_s1" },
{ "s2", QCOM_SMD_RPM_SMPA, 2, &pm2250_lvftsmps, "vdd_s2" },
{ "s3", QCOM_SMD_RPM_SMPA, 3, &pm2250_lvftsmps, "vdd_s3" },
{ "s4", QCOM_SMD_RPM_SMPA, 4, &pm2250_ftsmps, "vdd_s4" },
{ "l1", QCOM_SMD_RPM_LDOA, 1, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l2", QCOM_SMD_RPM_LDOA, 2, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l3", QCOM_SMD_RPM_LDOA, 3, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l4", QCOM_SMD_RPM_LDOA, 4, &pm660_pldo660, "vdd_l4_l17_l18_l19_l20_l21_l22" },
{ "l5", QCOM_SMD_RPM_LDOA, 5, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l6", QCOM_SMD_RPM_LDOA, 6, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l7", QCOM_SMD_RPM_LDOA, 7, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l8", QCOM_SMD_RPM_LDOA, 8, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l9", QCOM_SMD_RPM_LDOA, 9, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l10", QCOM_SMD_RPM_LDOA, 10, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l11", QCOM_SMD_RPM_LDOA, 11, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l12", QCOM_SMD_RPM_LDOA, 12, &pm660_nldo660, "vdd_l1_l2_l3_l5_l6_l7_l8_l9_l10_l11_l12" },
{ "l13", QCOM_SMD_RPM_LDOA, 13, &pm660_ht_lvpldo, "vdd_l13_l14_l15_l16" },
{ "l14", QCOM_SMD_RPM_LDOA, 14, &pm660_ht_lvpldo, "vdd_l13_l14_l15_l16" },
{ "l15", QCOM_SMD_RPM_LDOA, 15, &pm660_ht_lvpldo, "vdd_l13_l14_l15_l16" },
{ "l16", QCOM_SMD_RPM_LDOA, 16, &pm660_ht_lvpldo, "vdd_l13_l14_l15_l16" },
{ "l17", QCOM_SMD_RPM_LDOA, 17, &pm660_pldo660, "vdd_l4_l17_l18_l19_l20_l21_l22" },
{ "l18", QCOM_SMD_RPM_LDOA, 18, &pm660_pldo660, "vdd_l4_l17_l18_l19_l20_l21_l22" },
{ "l19", QCOM_SMD_RPM_LDOA, 19, &pm660_pldo660, "vdd_l4_l17_l18_l19_l20_l21_l22" },
{ "l20", QCOM_SMD_RPM_LDOA, 20, &pm660_pldo660, "vdd_l4_l17_l18_l19_l20_l21_l22" },
{ "l21", QCOM_SMD_RPM_LDOA, 21, &pm660_pldo660, "vdd_l4_l17_l18_l19_l20_l21_l22" },
{ "l22", QCOM_SMD_RPM_LDOA, 22, &pm660_pldo660, "vdd_l4_l17_l18_l19_l20_l21_l22" },
{}
};
static const struct of_device_id rpm_of_match[] = {
{ .compatible = "qcom,rpm-mp5496-regulators", .data = &rpm_mp5496_regulators },
{ .compatible = "qcom,rpm-pm8841-regulators", .data = &rpm_pm8841_regulators },
@ -1186,6 +1234,7 @@ static const struct of_device_id rpm_of_match[] = {
{ .compatible = "qcom,rpm-pmi8994-regulators", .data = &rpm_pmi8994_regulators },
{ .compatible = "qcom,rpm-pmi8998-regulators", .data = &rpm_pmi8998_regulators },
{ .compatible = "qcom,rpm-pms405-regulators", .data = &rpm_pms405_regulators },
{ .compatible = "qcom,rpm-pm2250-regulators", .data = &rpm_pm2250_regulators },
{}
};
MODULE_DEVICE_TABLE(of, rpm_of_match);

View File

@ -54,14 +54,14 @@ static int rtq6752_set_vdd_enable(struct regulator_dev *rdev)
int rid = rdev_get_id(rdev), ret;
mutex_lock(&priv->lock);
if (priv->enable_gpio) {
gpiod_set_value(priv->enable_gpio, 1);
usleep_range(RTQ6752_I2CRDY_TIMEUS,
RTQ6752_I2CRDY_TIMEUS + 100);
}
if (!priv->enable_flag) {
if (priv->enable_gpio) {
gpiod_set_value(priv->enable_gpio, 1);
usleep_range(RTQ6752_I2CRDY_TIMEUS,
RTQ6752_I2CRDY_TIMEUS + 100);
}
regcache_cache_only(priv->regmap, false);
ret = regcache_sync(priv->regmap);
if (ret) {
@ -91,11 +91,11 @@ static int rtq6752_set_vdd_disable(struct regulator_dev *rdev)
if (!priv->enable_flag) {
regcache_cache_only(priv->regmap, true);
regcache_mark_dirty(priv->regmap);
if (priv->enable_gpio)
gpiod_set_value(priv->enable_gpio, 0);
}
if (priv->enable_gpio)
gpiod_set_value(priv->enable_gpio, 0);
mutex_unlock(&priv->lock);
return 0;

View File

@ -850,18 +850,15 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
/* DS4 GPIO */
gpio_direction_output(pdata->buck_ds[2], 0x0);
if (pdata->buck2_gpiodvs || pdata->buck3_gpiodvs ||
pdata->buck4_gpiodvs) {
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK2CTRL, 1 << 1,
(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1));
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK3CTRL, 1 << 1,
(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1));
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK4CTRL, 1 << 1,
(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1));
}
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK2CTRL, 1 << 1,
(pdata->buck2_gpiodvs) ? (1 << 1) : (0 << 1));
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK3CTRL, 1 << 1,
(pdata->buck3_gpiodvs) ? (1 << 1) : (0 << 1));
regmap_update_bits(s5m8767->iodev->regmap_pmic,
S5M8767_REG_BUCK4CTRL, 1 << 1,
(pdata->buck4_gpiodvs) ? (1 << 1) : (0 << 1));
/* Initialize GPIO DVS registers */
for (i = 0; i < 8; i++) {

View File

@ -70,7 +70,7 @@ static const struct regulator_desc desc = {
static int sy7636a_regulator_probe(struct platform_device *pdev)
{
struct regmap *regmap = dev_get_drvdata(pdev->dev.parent);
struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL);
struct regulator_config config = { };
struct regulator_dev *rdev;
struct gpio_desc *gdp;

View File

@ -725,9 +725,7 @@ static int ti_abb_probe(struct platform_device *pdev)
/* Map ABB resources */
if (abb->regs->setup_off || abb->regs->control_off) {
pname = "base-address";
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname);
abb->base = devm_ioremap_resource(dev, res);
abb->base = devm_platform_ioremap_resource_byname(pdev, "base-address");
if (IS_ERR(abb->base))
return PTR_ERR(abb->base);
@ -735,35 +733,18 @@ static int ti_abb_probe(struct platform_device *pdev)
abb->control_reg = abb->base + abb->regs->control_off;
} else {
pname = "control-address";
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname);
abb->control_reg = devm_ioremap_resource(dev, res);
abb->control_reg = devm_platform_ioremap_resource_byname(pdev, "control-address");
if (IS_ERR(abb->control_reg))
return PTR_ERR(abb->control_reg);
pname = "setup-address";
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname);
abb->setup_reg = devm_ioremap_resource(dev, res);
abb->setup_reg = devm_platform_ioremap_resource_byname(pdev, "setup-address");
if (IS_ERR(abb->setup_reg))
return PTR_ERR(abb->setup_reg);
}
pname = "int-address";
res = platform_get_resource_byname(pdev, IORESOURCE_MEM, pname);
if (!res) {
dev_err(dev, "Missing '%s' IO resource\n", pname);
return -ENODEV;
}
/*
* We may have shared interrupt register offsets which are
* write-1-to-clear between domains ensuring exclusivity.
*/
abb->int_base = devm_ioremap(dev, res->start,
resource_size(res));
if (!abb->int_base) {
dev_err(dev, "Unable to map '%s'\n", pname);
return -ENOMEM;
}
abb->int_base = devm_platform_ioremap_resource_byname(pdev, "int-address");
if (IS_ERR(abb->int_base))
return PTR_ERR(abb->int_base);
/* Map Optional resources */
pname = "efuse-address";

View File

@ -28,13 +28,12 @@
#include <linux/err.h>
#include <linux/of.h>
#include <linux/of_device.h>
#include <linux/of_gpio.h>
#include <linux/regulator/of_regulator.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/tps62360.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/slab.h>
#include <linux/regmap.h>
@ -65,8 +64,8 @@ struct tps62360_chip {
struct regulator_desc desc;
struct regulator_dev *rdev;
struct regmap *regmap;
int vsel0_gpio;
int vsel1_gpio;
struct gpio_desc *vsel0_gpio;
struct gpio_desc *vsel1_gpio;
u8 voltage_reg_mask;
bool en_internal_pulldn;
bool en_discharge;
@ -165,8 +164,8 @@ static int tps62360_dcdc_set_voltage_sel(struct regulator_dev *dev,
/* Select proper VSET register vio gpios */
if (tps->valid_gpios) {
gpio_set_value_cansleep(tps->vsel0_gpio, new_vset_id & 0x1);
gpio_set_value_cansleep(tps->vsel1_gpio,
gpiod_set_value_cansleep(tps->vsel0_gpio, new_vset_id & 0x1);
gpiod_set_value_cansleep(tps->vsel1_gpio,
(new_vset_id >> 1) & 0x1);
}
return 0;
@ -310,9 +309,6 @@ static struct tps62360_regulator_platform_data *
return NULL;
}
pdata->vsel0_gpio = of_get_named_gpio(np, "vsel0-gpio", 0);
pdata->vsel1_gpio = of_get_named_gpio(np, "vsel1-gpio", 0);
if (of_find_property(np, "ti,vsel0-state-high", NULL))
pdata->vsel0_def_state = 1;
@ -349,6 +345,7 @@ static int tps62360_probe(struct i2c_client *client,
int ret;
int i;
int chip_id;
int gpio_flags;
pdata = dev_get_platdata(&client->dev);
@ -390,8 +387,6 @@ static int tps62360_probe(struct i2c_client *client,
tps->en_discharge = pdata->en_discharge;
tps->en_internal_pulldn = pdata->en_internal_pulldn;
tps->vsel0_gpio = pdata->vsel0_gpio;
tps->vsel1_gpio = pdata->vsel1_gpio;
tps->dev = &client->dev;
switch (chip_id) {
@ -426,29 +421,27 @@ static int tps62360_probe(struct i2c_client *client,
tps->lru_index[0] = tps->curr_vset_id;
tps->valid_gpios = false;
if (gpio_is_valid(tps->vsel0_gpio) && gpio_is_valid(tps->vsel1_gpio)) {
int gpio_flags;
gpio_flags = (pdata->vsel0_def_state) ?
GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
ret = devm_gpio_request_one(&client->dev, tps->vsel0_gpio,
gpio_flags, "tps62360-vsel0");
if (ret) {
dev_err(&client->dev,
"%s(): Could not obtain vsel0 GPIO %d: %d\n",
__func__, tps->vsel0_gpio, ret);
return ret;
}
gpio_flags = (pdata->vsel0_def_state) ?
GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
tps->vsel0_gpio = devm_gpiod_get_optional(&client->dev, "vsel0", gpio_flags);
if (IS_ERR(tps->vsel0_gpio)) {
dev_err(&client->dev,
"%s(): Could not obtain vsel0 GPIO: %ld\n",
__func__, PTR_ERR(tps->vsel0_gpio));
return PTR_ERR(tps->vsel0_gpio);
}
gpio_flags = (pdata->vsel1_def_state) ?
GPIOF_OUT_INIT_HIGH : GPIOF_OUT_INIT_LOW;
ret = devm_gpio_request_one(&client->dev, tps->vsel1_gpio,
gpio_flags, "tps62360-vsel1");
if (ret) {
dev_err(&client->dev,
"%s(): Could not obtain vsel1 GPIO %d: %d\n",
__func__, tps->vsel1_gpio, ret);
return ret;
}
gpio_flags = (pdata->vsel1_def_state) ?
GPIOD_OUT_HIGH : GPIOD_OUT_LOW;
tps->vsel1_gpio = devm_gpiod_get_optional(&client->dev, "vsel1", gpio_flags);
if (IS_ERR(tps->vsel1_gpio)) {
dev_err(&client->dev,
"%s(): Could not obtain vsel1 GPIO: %ld\n",
__func__, PTR_ERR(tps->vsel1_gpio));
return PTR_ERR(tps->vsel1_gpio);
}
if (tps->vsel0_gpio != NULL && tps->vsel1_gpio != NULL) {
tps->valid_gpios = true;
/*

View File

@ -1,753 +0,0 @@
// SPDX-License-Identifier: GPL-2.0
//
// tps80031-regulator.c -- TI TPS80031 regulator driver.
//
// Regulator driver for TI TPS80031/TPS80032 Fully Integrated Power
// Management with Power Path and Battery Charger.
//
// Copyright (c) 2012, NVIDIA Corporation.
//
// Author: Laxman Dewangan <ldewangan@nvidia.com>
#include <linux/delay.h>
#include <linux/err.h>
#include <linux/init.h>
#include <linux/kernel.h>
#include <linux/mfd/tps80031.h>
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/slab.h>
/* Flags for DCDC Voltage reading */
#define DCDC_OFFSET_EN BIT(0)
#define DCDC_EXTENDED_EN BIT(1)
#define TRACK_MODE_ENABLE BIT(2)
#define SMPS_MULTOFFSET_VIO BIT(1)
#define SMPS_MULTOFFSET_SMPS1 BIT(3)
#define SMPS_MULTOFFSET_SMPS2 BIT(4)
#define SMPS_MULTOFFSET_SMPS3 BIT(6)
#define SMPS_MULTOFFSET_SMPS4 BIT(0)
#define SMPS_CMD_MASK 0xC0
#define SMPS_VSEL_MASK 0x3F
#define LDO_VSEL_MASK 0x1F
#define LDO_TRACK_VSEL_MASK 0x3F
#define MISC2_LDOUSB_IN_VSYS BIT(4)
#define MISC2_LDOUSB_IN_PMID BIT(3)
#define MISC2_LDOUSB_IN_MASK 0x18
#define MISC2_LDO3_SEL_VIB_VAL BIT(0)
#define MISC2_LDO3_SEL_VIB_MASK 0x1
#define BOOST_HW_PWR_EN BIT(5)
#define BOOST_HW_PWR_EN_MASK BIT(5)
#define OPA_MODE_EN BIT(6)
#define OPA_MODE_EN_MASK BIT(6)
#define USB_VBUS_CTRL_SET 0x04
#define USB_VBUS_CTRL_CLR 0x05
#define VBUS_DISCHRG 0x20
struct tps80031_regulator_info {
/* Regulator register address.*/
u8 trans_reg;
u8 state_reg;
u8 force_reg;
u8 volt_reg;
u8 volt_id;
/*Power request bits */
int preq_bit;
/* used by regulator core */
struct regulator_desc desc;
};
struct tps80031_regulator {
struct device *dev;
struct tps80031_regulator_info *rinfo;
u8 device_flags;
unsigned int config_flags;
unsigned int ext_ctrl_flag;
};
static inline struct device *to_tps80031_dev(struct regulator_dev *rdev)
{
return rdev_get_dev(rdev)->parent->parent;
}
static int tps80031_reg_is_enabled(struct regulator_dev *rdev)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps80031_dev(rdev);
u8 reg_val;
int ret;
if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ)
return true;
ret = tps80031_read(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg,
&reg_val);
if (ret < 0) {
dev_err(&rdev->dev, "Reg 0x%02x read failed, err = %d\n",
ri->rinfo->state_reg, ret);
return ret;
}
return (reg_val & TPS80031_STATE_MASK) == TPS80031_STATE_ON;
}
static int tps80031_reg_enable(struct regulator_dev *rdev)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps80031_dev(rdev);
int ret;
if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ)
return 0;
ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg,
TPS80031_STATE_ON, TPS80031_STATE_MASK);
if (ret < 0) {
dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n",
ri->rinfo->state_reg, ret);
return ret;
}
return ret;
}
static int tps80031_reg_disable(struct regulator_dev *rdev)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps80031_dev(rdev);
int ret;
if (ri->ext_ctrl_flag & TPS80031_EXT_PWR_REQ)
return 0;
ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->state_reg,
TPS80031_STATE_OFF, TPS80031_STATE_MASK);
if (ret < 0)
dev_err(&rdev->dev, "Reg 0x%02x update failed, err = %d\n",
ri->rinfo->state_reg, ret);
return ret;
}
/* DCDC voltages for the selector of 58 to 63 */
static const int tps80031_dcdc_voltages[4][5] = {
{ 1350, 1500, 1800, 1900, 2100},
{ 1350, 1500, 1800, 1900, 2100},
{ 2084, 2315, 2778, 2932, 3241},
{ 4167, 2315, 2778, 2932, 3241},
};
static int tps80031_dcdc_list_voltage(struct regulator_dev *rdev, unsigned sel)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
int volt_index = ri->device_flags & 0x3;
if (sel == 0)
return 0;
else if (sel < 58)
return regulator_list_voltage_linear(rdev, sel - 1);
else
return tps80031_dcdc_voltages[volt_index][sel - 58] * 1000;
}
static int tps80031_dcdc_set_voltage_sel(struct regulator_dev *rdev,
unsigned vsel)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps80031_dev(rdev);
int ret;
u8 reg_val;
if (ri->rinfo->force_reg) {
ret = tps80031_read(parent, ri->rinfo->volt_id,
ri->rinfo->force_reg, &reg_val);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
ri->rinfo->force_reg, ret);
return ret;
}
if (!(reg_val & SMPS_CMD_MASK)) {
ret = tps80031_update(parent, ri->rinfo->volt_id,
ri->rinfo->force_reg, vsel, SMPS_VSEL_MASK);
if (ret < 0)
dev_err(ri->dev,
"reg 0x%02x update failed, e = %d\n",
ri->rinfo->force_reg, ret);
return ret;
}
}
ret = tps80031_update(parent, ri->rinfo->volt_id,
ri->rinfo->volt_reg, vsel, SMPS_VSEL_MASK);
if (ret < 0)
dev_err(ri->dev, "reg 0x%02x update failed, e = %d\n",
ri->rinfo->volt_reg, ret);
return ret;
}
static int tps80031_dcdc_get_voltage_sel(struct regulator_dev *rdev)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps80031_dev(rdev);
uint8_t vsel = 0;
int ret;
if (ri->rinfo->force_reg) {
ret = tps80031_read(parent, ri->rinfo->volt_id,
ri->rinfo->force_reg, &vsel);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
ri->rinfo->force_reg, ret);
return ret;
}
if (!(vsel & SMPS_CMD_MASK))
return vsel & SMPS_VSEL_MASK;
}
ret = tps80031_read(parent, ri->rinfo->volt_id,
ri->rinfo->volt_reg, &vsel);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
ri->rinfo->volt_reg, ret);
return ret;
}
return vsel & SMPS_VSEL_MASK;
}
static int tps80031_ldo_list_voltage(struct regulator_dev *rdev,
unsigned int sel)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps80031_dev(rdev);
/* Check for valid setting for TPS80031 or TPS80032-ES1.0 */
if ((ri->rinfo->desc.id == TPS80031_REGULATOR_LDO2) &&
(ri->device_flags & TRACK_MODE_ENABLE)) {
unsigned nvsel = (sel) & 0x1F;
if (((tps80031_get_chip_info(parent) == TPS80031) ||
((tps80031_get_chip_info(parent) == TPS80032) &&
(tps80031_get_pmu_version(parent) == 0x0))) &&
((nvsel == 0x0) || (nvsel >= 0x19 && nvsel <= 0x1F))) {
dev_err(ri->dev,
"Invalid sel %d in track mode LDO2\n",
nvsel);
return -EINVAL;
}
}
return regulator_list_voltage_linear(rdev, sel);
}
static int tps80031_ldo_map_voltage(struct regulator_dev *rdev,
int min_uV, int max_uV)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps80031_dev(rdev);
/* Check for valid setting for TPS80031 or TPS80032-ES1.0 */
if ((ri->rinfo->desc.id == TPS80031_REGULATOR_LDO2) &&
(ri->device_flags & TRACK_MODE_ENABLE)) {
if (((tps80031_get_chip_info(parent) == TPS80031) ||
((tps80031_get_chip_info(parent) == TPS80032) &&
(tps80031_get_pmu_version(parent) == 0x0)))) {
return regulator_map_voltage_iterate(rdev, min_uV,
max_uV);
}
}
return regulator_map_voltage_linear(rdev, min_uV, max_uV);
}
static int tps80031_vbus_is_enabled(struct regulator_dev *rdev)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps80031_dev(rdev);
int ret;
uint8_t ctrl1 = 0;
uint8_t ctrl3 = 0;
ret = tps80031_read(parent, TPS80031_SLAVE_ID2,
TPS80031_CHARGERUSB_CTRL1, &ctrl1);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
TPS80031_CHARGERUSB_CTRL1, ret);
return ret;
}
ret = tps80031_read(parent, TPS80031_SLAVE_ID2,
TPS80031_CHARGERUSB_CTRL3, &ctrl3);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
TPS80031_CHARGERUSB_CTRL3, ret);
return ret;
}
if ((ctrl1 & OPA_MODE_EN) && (ctrl3 & BOOST_HW_PWR_EN))
return 1;
return ret;
}
static int tps80031_vbus_enable(struct regulator_dev *rdev)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps80031_dev(rdev);
int ret;
ret = tps80031_set_bits(parent, TPS80031_SLAVE_ID2,
TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
TPS80031_CHARGERUSB_CTRL1, ret);
return ret;
}
ret = tps80031_set_bits(parent, TPS80031_SLAVE_ID2,
TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x read failed, e = %d\n",
TPS80031_CHARGERUSB_CTRL3, ret);
return ret;
}
return ret;
}
static int tps80031_vbus_disable(struct regulator_dev *rdev)
{
struct tps80031_regulator *ri = rdev_get_drvdata(rdev);
struct device *parent = to_tps80031_dev(rdev);
int ret;
if (ri->config_flags & TPS80031_VBUS_DISCHRG_EN_PDN) {
ret = tps80031_write(parent, TPS80031_SLAVE_ID2,
USB_VBUS_CTRL_SET, VBUS_DISCHRG);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n",
USB_VBUS_CTRL_SET, ret);
return ret;
}
}
ret = tps80031_clr_bits(parent, TPS80031_SLAVE_ID2,
TPS80031_CHARGERUSB_CTRL1, OPA_MODE_EN);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n",
TPS80031_CHARGERUSB_CTRL1, ret);
return ret;
}
ret = tps80031_clr_bits(parent, TPS80031_SLAVE_ID2,
TPS80031_CHARGERUSB_CTRL3, BOOST_HW_PWR_EN);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x clearbit failed, e = %d\n",
TPS80031_CHARGERUSB_CTRL3, ret);
return ret;
}
mdelay(DIV_ROUND_UP(ri->rinfo->desc.enable_time, 1000));
if (ri->config_flags & TPS80031_VBUS_DISCHRG_EN_PDN) {
ret = tps80031_write(parent, TPS80031_SLAVE_ID2,
USB_VBUS_CTRL_CLR, VBUS_DISCHRG);
if (ret < 0) {
dev_err(ri->dev, "reg 0x%02x write failed, e = %d\n",
USB_VBUS_CTRL_CLR, ret);
return ret;
}
}
return ret;
}
static const struct regulator_ops tps80031_dcdc_ops = {
.list_voltage = tps80031_dcdc_list_voltage,
.set_voltage_sel = tps80031_dcdc_set_voltage_sel,
.get_voltage_sel = tps80031_dcdc_get_voltage_sel,
.enable = tps80031_reg_enable,
.disable = tps80031_reg_disable,
.is_enabled = tps80031_reg_is_enabled,
};
static const struct regulator_ops tps80031_ldo_ops = {
.list_voltage = tps80031_ldo_list_voltage,
.map_voltage = tps80031_ldo_map_voltage,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.enable = tps80031_reg_enable,
.disable = tps80031_reg_disable,
.is_enabled = tps80031_reg_is_enabled,
};
static const struct regulator_ops tps80031_vbus_sw_ops = {
.list_voltage = regulator_list_voltage_linear,
.enable = tps80031_vbus_enable,
.disable = tps80031_vbus_disable,
.is_enabled = tps80031_vbus_is_enabled,
};
static const struct regulator_ops tps80031_vbus_hw_ops = {
.list_voltage = regulator_list_voltage_linear,
};
static const struct regulator_ops tps80031_ext_reg_ops = {
.list_voltage = regulator_list_voltage_linear,
.enable = tps80031_reg_enable,
.disable = tps80031_reg_disable,
.is_enabled = tps80031_reg_is_enabled,
};
/* Non-exiting default definition for some register */
#define TPS80031_SMPS3_CFG_FORCE 0
#define TPS80031_SMPS4_CFG_FORCE 0
#define TPS80031_VBUS_CFG_TRANS 0
#define TPS80031_VBUS_CFG_STATE 0
#define TPS80031_REG_SMPS(_id, _volt_id, _pbit) \
{ \
.trans_reg = TPS80031_##_id##_CFG_TRANS, \
.state_reg = TPS80031_##_id##_CFG_STATE, \
.force_reg = TPS80031_##_id##_CFG_FORCE, \
.volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \
.volt_id = TPS80031_SLAVE_##_volt_id, \
.preq_bit = _pbit, \
.desc = { \
.name = "tps80031_"#_id, \
.id = TPS80031_REGULATOR_##_id, \
.n_voltages = 63, \
.ops = &tps80031_dcdc_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.enable_time = 500, \
}, \
}
#define TPS80031_REG_LDO(_id, _preq_bit) \
{ \
.trans_reg = TPS80031_##_id##_CFG_TRANS, \
.state_reg = TPS80031_##_id##_CFG_STATE, \
.volt_reg = TPS80031_##_id##_CFG_VOLTAGE, \
.volt_id = TPS80031_SLAVE_ID1, \
.preq_bit = _preq_bit, \
.desc = { \
.owner = THIS_MODULE, \
.name = "tps80031_"#_id, \
.id = TPS80031_REGULATOR_##_id, \
.ops = &tps80031_ldo_ops, \
.type = REGULATOR_VOLTAGE, \
.min_uV = 1000000, \
.uV_step = 100000, \
.linear_min_sel = 1, \
.n_voltages = 25, \
.vsel_reg = TPS80031_##_id##_CFG_VOLTAGE, \
.vsel_mask = LDO_VSEL_MASK, \
.enable_time = 500, \
}, \
}
#define TPS80031_REG_FIXED(_id, max_mV, _ops, _delay, _pbit) \
{ \
.trans_reg = TPS80031_##_id##_CFG_TRANS, \
.state_reg = TPS80031_##_id##_CFG_STATE, \
.volt_id = TPS80031_SLAVE_ID1, \
.preq_bit = _pbit, \
.desc = { \
.name = "tps80031_"#_id, \
.id = TPS80031_REGULATOR_##_id, \
.min_uV = max_mV * 1000, \
.n_voltages = 1, \
.ops = &_ops, \
.type = REGULATOR_VOLTAGE, \
.owner = THIS_MODULE, \
.enable_time = _delay, \
}, \
}
static struct tps80031_regulator_info tps80031_rinfo[TPS80031_REGULATOR_MAX] = {
TPS80031_REG_SMPS(VIO, ID0, 4),
TPS80031_REG_SMPS(SMPS1, ID0, 0),
TPS80031_REG_SMPS(SMPS2, ID0, 1),
TPS80031_REG_SMPS(SMPS3, ID1, 2),
TPS80031_REG_SMPS(SMPS4, ID1, 3),
TPS80031_REG_LDO(VANA, -1),
TPS80031_REG_LDO(LDO1, 8),
TPS80031_REG_LDO(LDO2, 9),
TPS80031_REG_LDO(LDO3, 10),
TPS80031_REG_LDO(LDO4, 11),
TPS80031_REG_LDO(LDO5, 12),
TPS80031_REG_LDO(LDO6, 13),
TPS80031_REG_LDO(LDO7, 14),
TPS80031_REG_LDO(LDOLN, 15),
TPS80031_REG_LDO(LDOUSB, 5),
TPS80031_REG_FIXED(VBUS, 5000, tps80031_vbus_hw_ops, 100000, -1),
TPS80031_REG_FIXED(REGEN1, 3300, tps80031_ext_reg_ops, 0, 16),
TPS80031_REG_FIXED(REGEN2, 3300, tps80031_ext_reg_ops, 0, 17),
TPS80031_REG_FIXED(SYSEN, 3300, tps80031_ext_reg_ops, 0, 18),
};
static int tps80031_power_req_config(struct device *parent,
struct tps80031_regulator *ri,
struct tps80031_regulator_platform_data *tps80031_pdata)
{
int ret = 0;
if (ri->rinfo->preq_bit < 0)
goto skip_pwr_req_config;
ret = tps80031_ext_power_req_config(parent, ri->ext_ctrl_flag,
ri->rinfo->preq_bit, ri->rinfo->state_reg,
ri->rinfo->trans_reg);
if (ret < 0) {
dev_err(ri->dev, "ext powerreq config failed, err = %d\n", ret);
return ret;
}
skip_pwr_req_config:
if (tps80031_pdata->ext_ctrl_flag & TPS80031_PWR_ON_ON_SLEEP) {
ret = tps80031_update(parent, TPS80031_SLAVE_ID1,
ri->rinfo->trans_reg, TPS80031_TRANS_SLEEP_ON,
TPS80031_TRANS_SLEEP_MASK);
if (ret < 0) {
dev_err(ri->dev, "Reg 0x%02x update failed, e %d\n",
ri->rinfo->trans_reg, ret);
return ret;
}
}
return ret;
}
static int tps80031_regulator_config(struct device *parent,
struct tps80031_regulator *ri,
struct tps80031_regulator_platform_data *tps80031_pdata)
{
int ret = 0;
switch (ri->rinfo->desc.id) {
case TPS80031_REGULATOR_LDOUSB:
if (ri->config_flags & (TPS80031_USBLDO_INPUT_VSYS |
TPS80031_USBLDO_INPUT_PMID)) {
unsigned val;
if (ri->config_flags & TPS80031_USBLDO_INPUT_VSYS)
val = MISC2_LDOUSB_IN_VSYS;
else
val = MISC2_LDOUSB_IN_PMID;
ret = tps80031_update(parent, TPS80031_SLAVE_ID1,
TPS80031_MISC2, val,
MISC2_LDOUSB_IN_MASK);
if (ret < 0) {
dev_err(ri->dev,
"LDOUSB config failed, e= %d\n", ret);
return ret;
}
}
break;
case TPS80031_REGULATOR_LDO3:
if (ri->config_flags & TPS80031_LDO3_OUTPUT_VIB) {
ret = tps80031_update(parent, TPS80031_SLAVE_ID1,
TPS80031_MISC2, MISC2_LDO3_SEL_VIB_VAL,
MISC2_LDO3_SEL_VIB_MASK);
if (ret < 0) {
dev_err(ri->dev,
"LDO3 config failed, e = %d\n", ret);
return ret;
}
}
break;
case TPS80031_REGULATOR_VBUS:
/* Provide SW control Ops if VBUS is SW control */
if (!(ri->config_flags & TPS80031_VBUS_SW_ONLY))
ri->rinfo->desc.ops = &tps80031_vbus_sw_ops;
break;
default:
break;
}
/* Configure Active state to ON, SLEEP to OFF and OFF_state to OFF */
ret = tps80031_update(parent, TPS80031_SLAVE_ID1, ri->rinfo->trans_reg,
TPS80031_TRANS_ACTIVE_ON | TPS80031_TRANS_SLEEP_OFF |
TPS80031_TRANS_OFF_OFF, TPS80031_TRANS_ACTIVE_MASK |
TPS80031_TRANS_SLEEP_MASK | TPS80031_TRANS_OFF_MASK);
if (ret < 0) {
dev_err(ri->dev, "trans reg update failed, e %d\n", ret);
return ret;
}
return ret;
}
static int check_smps_mode_mult(struct device *parent,
struct tps80031_regulator *ri)
{
int mult_offset;
int ret;
u8 smps_offset;
u8 smps_mult;
ret = tps80031_read(parent, TPS80031_SLAVE_ID1,
TPS80031_SMPS_OFFSET, &smps_offset);
if (ret < 0) {
dev_err(parent, "Error in reading smps offset register\n");
return ret;
}
ret = tps80031_read(parent, TPS80031_SLAVE_ID1,
TPS80031_SMPS_MULT, &smps_mult);
if (ret < 0) {
dev_err(parent, "Error in reading smps mult register\n");
return ret;
}
switch (ri->rinfo->desc.id) {
case TPS80031_REGULATOR_VIO:
mult_offset = SMPS_MULTOFFSET_VIO;
break;
case TPS80031_REGULATOR_SMPS1:
mult_offset = SMPS_MULTOFFSET_SMPS1;
break;
case TPS80031_REGULATOR_SMPS2:
mult_offset = SMPS_MULTOFFSET_SMPS2;
break;
case TPS80031_REGULATOR_SMPS3:
mult_offset = SMPS_MULTOFFSET_SMPS3;
break;
case TPS80031_REGULATOR_SMPS4:
mult_offset = SMPS_MULTOFFSET_SMPS4;
break;
case TPS80031_REGULATOR_LDO2:
ri->device_flags = smps_mult & BIT(5) ? TRACK_MODE_ENABLE : 0;
/* TRACK mode the ldo2 varies from 600mV to 1300mV */
if (ri->device_flags & TRACK_MODE_ENABLE) {
ri->rinfo->desc.min_uV = 600000;
ri->rinfo->desc.uV_step = 12500;
ri->rinfo->desc.n_voltages = 57;
ri->rinfo->desc.vsel_mask = LDO_TRACK_VSEL_MASK;
}
return 0;
default:
return 0;
}
ri->device_flags = (smps_offset & mult_offset) ? DCDC_OFFSET_EN : 0;
ri->device_flags |= (smps_mult & mult_offset) ? DCDC_EXTENDED_EN : 0;
switch (ri->device_flags) {
case 0:
ri->rinfo->desc.min_uV = 607700;
ri->rinfo->desc.uV_step = 12660;
break;
case DCDC_OFFSET_EN:
ri->rinfo->desc.min_uV = 700000;
ri->rinfo->desc.uV_step = 12500;
break;
case DCDC_EXTENDED_EN:
ri->rinfo->desc.min_uV = 1852000;
ri->rinfo->desc.uV_step = 38600;
break;
case DCDC_OFFSET_EN | DCDC_EXTENDED_EN:
ri->rinfo->desc.min_uV = 2161000;
ri->rinfo->desc.uV_step = 38600;
break;
}
return 0;
}
static int tps80031_regulator_probe(struct platform_device *pdev)
{
struct tps80031_platform_data *pdata;
struct tps80031_regulator_platform_data *tps_pdata;
struct tps80031_regulator *ri;
struct tps80031_regulator *pmic;
struct regulator_dev *rdev;
struct regulator_config config = { };
struct tps80031 *tps80031_mfd = dev_get_drvdata(pdev->dev.parent);
int ret;
int num;
pdata = dev_get_platdata(pdev->dev.parent);
if (!pdata) {
dev_err(&pdev->dev, "No platform data\n");
return -EINVAL;
}
pmic = devm_kcalloc(&pdev->dev,
TPS80031_REGULATOR_MAX, sizeof(*pmic), GFP_KERNEL);
if (!pmic)
return -ENOMEM;
for (num = 0; num < TPS80031_REGULATOR_MAX; ++num) {
tps_pdata = pdata->regulator_pdata[num];
ri = &pmic[num];
ri->rinfo = &tps80031_rinfo[num];
ri->dev = &pdev->dev;
check_smps_mode_mult(pdev->dev.parent, ri);
config.dev = &pdev->dev;
config.init_data = NULL;
config.driver_data = ri;
config.regmap = tps80031_mfd->regmap[ri->rinfo->volt_id];
if (tps_pdata) {
config.init_data = tps_pdata->reg_init_data;
ri->config_flags = tps_pdata->config_flags;
ri->ext_ctrl_flag = tps_pdata->ext_ctrl_flag;
ret = tps80031_regulator_config(pdev->dev.parent,
ri, tps_pdata);
if (ret < 0) {
dev_err(&pdev->dev,
"regulator config failed, e %d\n", ret);
return ret;
}
ret = tps80031_power_req_config(pdev->dev.parent,
ri, tps_pdata);
if (ret < 0) {
dev_err(&pdev->dev,
"pwr_req config failed, err %d\n", ret);
return ret;
}
}
rdev = devm_regulator_register(&pdev->dev, &ri->rinfo->desc,
&config);
if (IS_ERR(rdev)) {
dev_err(&pdev->dev,
"register regulator failed %s\n",
ri->rinfo->desc.name);
return PTR_ERR(rdev);
}
}
platform_set_drvdata(pdev, pmic);
return 0;
}
static struct platform_driver tps80031_regulator_driver = {
.driver = {
.name = "tps80031-pmic",
},
.probe = tps80031_regulator_probe,
};
static int __init tps80031_regulator_init(void)
{
return platform_driver_register(&tps80031_regulator_driver);
}
subsys_initcall(tps80031_regulator_init);
static void __exit tps80031_regulator_exit(void)
{
platform_driver_unregister(&tps80031_regulator_driver);
}
module_exit(tps80031_regulator_exit);
MODULE_ALIAS("platform:tps80031-regulator");
MODULE_DESCRIPTION("Regulator Driver for TI TPS80031/TPS80032 PMIC");
MODULE_AUTHOR("Laxman Dewangan <ldewangan@nvidia.com>");
MODULE_LICENSE("GPL v2");

View File

@ -199,6 +199,10 @@ static const struct of_device_id uniphier_regulator_match[] = {
.compatible = "socionext,uniphier-pxs3-usb3-regulator",
.data = &uniphier_pxs2_usb3_data,
},
{
.compatible = "socionext,uniphier-nx1-usb3-regulator",
.data = &uniphier_pxs2_usb3_data,
},
{ /* Sentinel */ },
};
MODULE_DEVICE_TABLE(of, uniphier_regulator_match);

View File

@ -48,7 +48,6 @@ static int ipq4019_regulator_probe(struct platform_device *pdev)
struct regulator_init_data *init_data;
struct regulator_config cfg = {};
struct regulator_dev *rdev;
struct resource *res;
struct regmap *rmap;
void __iomem *base;
@ -57,8 +56,7 @@ static int ipq4019_regulator_probe(struct platform_device *pdev)
if (!init_data)
return -EINVAL;
res = platform_get_resource(pdev, IORESOURCE_MEM, 0);
base = devm_ioremap_resource(dev, res);
base = devm_platform_ioremap_resource(pdev, 0);
if (IS_ERR(base))
return PTR_ERR(base);

View File

@ -451,6 +451,47 @@ int __spi_register_driver(struct module *owner, struct spi_driver *sdrv)
{
sdrv->driver.owner = owner;
sdrv->driver.bus = &spi_bus_type;
/*
* For Really Good Reasons we use spi: modaliases not of:
* modaliases for DT so module autoloading won't work if we
* don't have a spi_device_id as well as a compatible string.
*/
if (sdrv->driver.of_match_table) {
const struct of_device_id *of_id;
for (of_id = sdrv->driver.of_match_table; of_id->compatible[0];
of_id++) {
const char *of_name;
/* Strip off any vendor prefix */
of_name = strnchr(of_id->compatible,
sizeof(of_id->compatible), ',');
if (of_name)
of_name++;
else
of_name = of_id->compatible;
if (sdrv->id_table) {
const struct spi_device_id *spi_id;
for (spi_id = sdrv->id_table; spi_id->name[0];
spi_id++)
if (strcmp(spi_id->name, of_name) == 0)
break;
if (spi_id->name[0])
continue;
} else {
if (strcmp(sdrv->driver.name, of_name) == 0)
continue;
}
pr_warn("SPI driver %s has no spi_device_id for %s\n",
sdrv->driver.name, of_id->compatible);
}
}
return driver_register(&sdrv->driver);
}
EXPORT_SYMBOL_GPL(__spi_register_driver);

View File

@ -10,7 +10,7 @@
#include <linux/regulator/machine.h>
#include <linux/platform_device.h>
#include <linux/gpio.h>
#include <linux/gpio/consumer.h>
#define LP872X_MAX_REGULATORS 9
@ -40,11 +40,6 @@ enum lp872x_regulator_id {
LP872X_ID_MAX,
};
enum lp872x_dvs_state {
DVS_LOW = GPIOF_OUT_INIT_LOW,
DVS_HIGH = GPIOF_OUT_INIT_HIGH,
};
enum lp872x_dvs_sel {
SEL_V1,
SEL_V2,
@ -52,14 +47,14 @@ enum lp872x_dvs_sel {
/**
* lp872x_dvs
* @gpio : gpio pin number for dvs control
* @gpio : gpio descriptor for dvs control
* @vsel : dvs selector for buck v1 or buck v2 register
* @init_state : initial dvs pin state
*/
struct lp872x_dvs {
int gpio;
struct gpio_desc *gpio;
enum lp872x_dvs_sel vsel;
enum lp872x_dvs_state init_state;
enum gpiod_flags init_state;
};
/**
@ -78,14 +73,14 @@ struct lp872x_regulator_data {
* @update_config : if LP872X_GENERAL_CFG register is updated, set true
* @regulator_data : platform regulator id and init data
* @dvs : dvs data for buck voltage control
* @enable_gpio : gpio pin number for enable control
* @enable_gpio : gpio descriptor for enable control
*/
struct lp872x_platform_data {
u8 general_config;
bool update_config;
struct lp872x_regulator_data regulator_data[LP872X_MAX_REGULATORS];
struct lp872x_dvs *dvs;
int enable_gpio;
struct gpio_desc *enable_gpio;
};
#endif

View File

@ -19,10 +19,6 @@
* @en_discharge: Enable discharge the output capacitor via internal
* register.
* @en_internal_pulldn: internal pull down enable or not.
* @vsel0_gpio: Gpio number for vsel0. It should be -1 if this is tied with
* fixed logic.
* @vsel1_gpio: Gpio number for vsel1. It should be -1 if this is tied with
* fixed logic.
* @vsel0_def_state: Default state of vsel0. 1 if it is high else 0.
* @vsel1_def_state: Default state of vsel1. 1 if it is high else 0.
*/
@ -30,8 +26,6 @@ struct tps62360_regulator_platform_data {
struct regulator_init_data *reg_init_data;
bool en_discharge;
bool en_internal_pulldn;
int vsel0_gpio;
int vsel1_gpio;
int vsel0_def_state;
int vsel1_def_state;
};