Commit 0175ec3a authored by Linus Torvalds's avatar Linus Torvalds

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

Pull regulator updates from Mark Brown:
 "This has been a very quiet release for the regulator API: there's one
  new driver for the Maxim MAX20411, some DT schema conversions and some
  small tweaks and improvements but really nothing major at all"

* tag 'regulator-v6.3' of git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regulator: (22 commits)
  regulator: max597x: Align for simple_mfd_i2c driver
  regulator: max20411: Fix off-by-one for n_voltages setting
  regulator: max597x: Remove unused variable
  regulator: tps65219: use generic set_bypass()
  regulator: s5m8767: Bounds check id indexing into arrays
  regulator: max77802: Bounds check regulator id against opmode
  regulator: max20411: Convert to i2c's .probe_new()
  regulator: scmi: Allow for zero voltage domains
  regulator: max20411: Directly include bitfield.h
  regulator: Introduce Maxim MAX20411 Step-Down converter
  regulator: dt-bindings: Describe Maxim MAX20411
  regulator: dt-bindings: qcom-labibb: Allow regulator-common properties
  regulator: dt-bindings: fixed-regulator: allow gpios property
  regulator: tps65219: use IS_ERR() to detect an error pointer
  regulator: mcp16502: add enum MCP16502_REG_HPM description
  regulator: fixed-helper: use the correct function name in comment
  regulator: act8945a: fix non-kernel-doc comments
  dt-bindings: regulators: convert non-smd RPM Regulators bindings to dt-schema
  regulator: dt-bindings: Convert Fairchild FAN53555 to DT schema
  regulator: dt-bindings: qcom,usb-vbus-regulator: change node name
  ...
parents 603ac530 7f62cb88
ACT88xx regulators
-------------------
Required properties:
- compatible: "active-semi,act8846" or "active-semi,act8865" or "active-semi,act8600"
- reg: I2C slave address
Optional properties:
- system-power-controller: Telling whether or not this pmic is controlling
the system power. See Documentation/devicetree/bindings/power/power-controller.txt .
- active-semi,vsel-high: Indicates the VSEL pin is high.
If this property is missing, assume the VSEL pin is low(0).
Optional input supply properties:
- for act8600:
- vp1-supply: The input supply for DCDC_REG1
- vp2-supply: The input supply for DCDC_REG2
- vp3-supply: The input supply for DCDC_REG3
- inl-supply: The input supply for LDO_REG5, LDO_REG6, LDO_REG7 and LDO_REG8
SUDCDC_REG4, LDO_REG9 and LDO_REG10 do not have separate supplies.
- for act8846:
- vp1-supply: The input supply for REG1
- vp2-supply: The input supply for REG2
- vp3-supply: The input supply for REG3
- vp4-supply: The input supply for REG4
- inl1-supply: The input supply for REG5, REG6 and REG7
- inl2-supply: The input supply for REG8 and LDO_REG9
- inl3-supply: The input supply for REG10, REG11 and REG12
- for act8865:
- vp1-supply: The input supply for DCDC_REG1
- vp2-supply: The input supply for DCDC_REG2
- vp3-supply: The input supply for DCDC_REG3
- inl45-supply: The input supply for LDO_REG1 and LDO_REG2
- inl67-supply: The input supply for LDO_REG3 and LDO_REG4
Any standard regulator properties can be used to configure the single regulator.
regulator-initial-mode, regulator-allowed-modes and regulator-mode could be specified
for act8865 using mode values from dt-bindings/regulator/active-semi,8865-regulator.h
file.
The valid names for regulators are:
- for act8846:
REG1, REG2, REG3, REG4, REG5, REG6, REG7, REG8, REG9, REG10, REG11, REG12
- for act8865:
DCDC_REG1, DCDC_REG2, DCDC_REG3, LDO_REG1, LDO_REG2, LDO_REG3, LDO_REG4.
- for act8600:
DCDC_REG1, DCDC_REG2, DCDC_REG3, SUDCDC_REG4, LDO_REG5, LDO_REG6, LDO_REG7,
LDO_REG8, LDO_REG9, LDO_REG10,
Example:
--------
#include <dt-bindings/regulator/active-semi,8865-regulator.h>
i2c1: i2c@f0018000 {
pmic: act8865@5b {
compatible = "active-semi,act8865";
reg = <0x5b>;
active-semi,vsel-high;
regulators {
vcc_1v8_reg: DCDC_REG1 {
regulator-name = "VCC_1V8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
vcc_1v2_reg: DCDC_REG2 {
regulator-name = "VCC_1V2";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1300000>;
regulator-always-on;
regulator-allowed-modes = <ACT8865_REGULATOR_MODE_FIXED>,
<ACT8865_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8865_REGULATOR_MODE_FIXED>;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-min-microvolt = <1150000>;
regulator-suspend-max-microvolt = <1150000>;
regulator-changeable-in-suspend;
regulator-mode = <ACT8865_REGULATOR_MODE_LOWPOWER>;
};
};
vcc_3v3_reg: DCDC_REG3 {
regulator-name = "VCC_3V3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vddana_reg: LDO_REG1 {
regulator-name = "VDDANA";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-allowed-modes = <ACT8865_REGULATOR_MODE_NORMAL>,
<ACT8865_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8865_REGULATOR_MODE_NORMAL>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vddfuse_reg: LDO_REG2 {
regulator-name = "FUSE_2V5";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
};
};
};
};
Device-Tree bindings for regulators of Active-semi ACT8945A Multi-Function Device
Required properties:
- compatible: "active-semi,act8945a", please refer to ../mfd/act8945a.txt.
Optional properties:
- active-semi,vsel-high: Indicates if the VSEL pin is set to logic-high.
If this property is missing, assume the VSEL pin is set to logic-low.
Optional input supply properties:
- vp1-supply: The input supply for REG_DCDC1
- vp2-supply: The input supply for REG_DCDC2
- vp3-supply: The input supply for REG_DCDC3
- inl45-supply: The input supply for REG_LDO1 and REG_LDO2
- inl67-supply: The input supply for REG_LDO3 and REG_LDO4
Any standard regulator properties can be used to configure the single regulator.
regulator-initial-mode, regulator-allowed-modes and regulator-mode could be
specified using mode values from dt-bindings/regulator/active-semi,8945a-regulator.h
file.
The valid names for regulators are:
REG_DCDC1, REG_DCDC2, REG_DCDC3, REG_LDO1, REG_LDO2, REG_LDO3, REG_LDO4.
Example:
#include <dt-bindings/regulator/active-semi,8945a-regulator.h>
pmic@5b {
compatible = "active-semi,act8945a";
reg = <0x5b>;
active-semi,vsel-high;
regulators {
vdd_1v35_reg: REG_DCDC1 {
regulator-name = "VDD_1V35";
regulator-min-microvolt = <1350000>;
regulator-max-microvolt = <1350000>;
regulator-always-on;
regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
<ACT8945A_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-min-microvolt=<1400000>;
regulator-suspend-max-microvolt=<1400000>;
regulator-changeable-in-suspend;
regulator-mode=<ACT8945A_REGULATOR_MODE_LOWPOWER>;
};
};
vdd_1v2_reg: REG_DCDC2 {
regulator-name = "VDD_1V2";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1300000>;
regulator-always-on;
regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
<ACT8945A_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vdd_3v3_reg: REG_DCDC3 {
regulator-name = "VDD_3V3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vdd_fuse_reg: REG_LDO1 {
regulator-name = "VDD_FUSE";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
regulator-always-on;
regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
<ACT8945A_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
vdd_3v3_lp_reg: REG_LDO2 {
regulator-name = "VDD_3V3_LP";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vdd_led_reg: REG_LDO3 {
regulator-name = "VDD_LED";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
vdd_sdhc_1v8_reg: REG_LDO4 {
regulator-name = "VDD_SDHC_1V8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
};
};
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/active-semi,act8600.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Active-semi ACT8600 regulator
maintainers:
- Paul Cercueil <paul@crapouillou.net>
properties:
compatible:
const: active-semi,act8600
reg:
maxItems: 1
system-power-controller:
description:
Indicates that the ACT8600 is responsible for powering OFF
the system.
type: boolean
active-semi,vsel-high:
description:
Indicates the VSEL pin is high. If this property is missing,
the VSEL pin is assumed to be low.
type: boolean
regulators:
type: object
additionalProperties: false
properties:
DCDC1:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp1-supply:
description: Handle to the VP1 input supply
DCDC2:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp2-supply:
description: Handle to the VP2 input supply
DCDC3:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp3-supply:
description: Handle to the VP3 input supply
patternProperties:
"^(SUDCDC_REG4|LDO_REG9|LDO_REG10)$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
"^LDO[5-8]$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
inl-supply:
description: Handle to the INL input supply
additionalProperties: false
required:
- reg
- compatible
- regulators
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
pmic@5a {
compatible = "active-semi,act8600";
reg = <0x5a>;
regulators {
SUDCDC_REG4 {
regulator-min-microvolt = <5300000>;
regulator-max-microvolt = <5300000>;
inl-supply = <&vcc>;
};
LDO5 {
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
inl-supply = <&vcc>;
};
LDO6 {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
inl-supply = <&vcc>;
};
LDO7 {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
inl-supply = <&vcc>;
};
LDO8 {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
inl-supply = <&vcc>;
};
LDO_REG9 {
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
inl-supply = <&vcc>;
};
LDO_REG10 {
inl-supply = <&vcc>;
};
};
};
};
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/active-semi,act8846.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Active-semi ACT8846 regulator
maintainers:
- Paul Cercueil <paul@crapouillou.net>
properties:
compatible:
const: active-semi,act8846
reg:
maxItems: 1
system-power-controller:
description:
Indicates that the ACT8846 is responsible for powering OFF
the system.
type: boolean
active-semi,vsel-high:
description:
Indicates the VSEL pin is high. If this property is missing,
the VSEL pin is assumed to be low.
type: boolean
regulators:
type: object
additionalProperties: false
properties:
REG1:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp1-supply:
description: Handle to the VP1 input supply
REG2:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp2-supply:
description: Handle to the VP2 input supply
REG3:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp3-supply:
description: Handle to the VP3 input supply
REG4:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp4-supply:
description: Handle to the VP4 input supply
patternProperties:
"^REG[5-7]$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
inl1-supply:
description: Handle to the INL1 input supply
"^REG[8-9]$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
inl2-supply:
description: Handle to the INL2 input supply
"^REG1[0-2]$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
inl3-supply:
description: Handle to the INL3 input supply
additionalProperties: false
required:
- reg
- compatible
- regulators
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
pmic@5a {
compatible = "active-semi,act8846";
reg = <0x5a>;
system-power-controller;
regulators {
REG1 {
regulator-name = "VCC_DDR";
regulator-min-microvolt = <1200000>;
regulator-max-microvolt = <1200000>;
regulator-always-on;
};
REG2 {
regulator-name = "VCC_IO";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
REG3 {
regulator-name = "VDD_LOG";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
regulator-always-on;
};
REG4 {
regulator-name = "VCC_20";
regulator-min-microvolt = <2000000>;
regulator-max-microvolt = <2000000>;
regulator-always-on;
};
REG5 {
regulator-name = "VCCIO_SD";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
REG6 {
regulator-name = "VDD10_LCD";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
regulator-always-on;
};
REG7 {
regulator-name = "VCC_WL";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
REG8 {
regulator-name = "VCCA_33";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
REG9 {
regulator-name = "VCC_LAN";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
REG10 {
regulator-name = "VDD_10";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1000000>;
regulator-always-on;
};
REG11 {
regulator-name = "VCC_18";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
REG12 {
regulator-name = "VCC18_LCD";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
};
};
};
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/active-semi,act8865.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Active-semi ACT8865 regulator
maintainers:
- Paul Cercueil <paul@crapouillou.net>
properties:
compatible:
const: active-semi,act8865
reg:
maxItems: 1
system-power-controller:
description:
Indicates that the ACT8865 is responsible for powering OFF
the system.
type: boolean
active-semi,vsel-high:
description:
Indicates the VSEL pin is high. If this property is missing,
the VSEL pin is assumed to be low.
type: boolean
regulators:
type: object
additionalProperties: false
properties:
DCDC_REG1:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp1-supply:
description: Handle to the VP1 input supply
DCDC_REG2:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp2-supply:
description: Handle to the VP2 input supply
DCDC_REG3:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp3-supply:
description: Handle to the VP3 input supply
patternProperties:
"^LDO_REG[1-2]$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
inl45-supply:
description: Handle to the INL45 input supply
"^LDO_REG[3-4]$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
inl67-supply:
description: Handle to the INL67 input supply
additionalProperties: false
required:
- reg
- compatible
- regulators
examples:
- |
#include <dt-bindings/regulator/active-semi,8865-regulator.h>
i2c1 {
#address-cells = <1>;
#size-cells = <0>;
pmic@5b {
compatible = "active-semi,act8865";
reg = <0x5b>;
active-semi,vsel-high;
regulators {
DCDC_REG1 {
regulator-name = "VCC_1V8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-always-on;
};
DCDC_REG2 {
regulator-name = "VCC_1V2";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1300000>;
regulator-always-on;
regulator-allowed-modes = <ACT8865_REGULATOR_MODE_FIXED>,
<ACT8865_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8865_REGULATOR_MODE_FIXED>;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-min-microvolt = <1150000>;
regulator-suspend-max-microvolt = <1150000>;
regulator-changeable-in-suspend;
regulator-mode = <ACT8865_REGULATOR_MODE_LOWPOWER>;
};
};
DCDC_REG3 {
regulator-name = "VCC_3V3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
};
LDO_REG1 {
regulator-name = "VDDANA";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-always-on;
regulator-allowed-modes = <ACT8865_REGULATOR_MODE_NORMAL>,
<ACT8865_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8865_REGULATOR_MODE_NORMAL>;
regulator-state-mem {
regulator-off-in-suspend;
};
};
LDO_REG2 {
regulator-name = "FUSE_2V5";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
};
};
};
};
# SPDX-License-Identifier: (GPL-2.0-only OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/active-semi,act8945a.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Active-semi ACT8945a regulator
maintainers:
- Paul Cercueil <paul@crapouillou.net>
properties:
compatible:
const: active-semi,act8945a
reg:
maxItems: 1
system-power-controller:
description:
Indicates that the ACT8945a is responsible for powering OFF
the system.
type: boolean
active-semi,vsel-high:
description:
Indicates the VSEL pin is high. If this property is missing,
the VSEL pin is assumed to be low.
type: boolean
regulators:
type: object
additionalProperties: false
properties:
REG_DCDC1:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp1-supply:
description: Handle to the VP1 input supply
REG_DCDC2:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp2-supply:
description: Handle to the VP2 input supply
REG_DCDC3:
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
vp3-supply:
description: Handle to the VP3 input supply
patternProperties:
"^REG_LDO[1-2]$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
inl45-supply:
description: Handle to the INL45 input supply
"^REG_LDO[3-4]$":
type: object
$ref: /schemas/regulator/regulator.yaml#
unevaluatedProperties: false
properties:
inl67-supply:
description: Handle to the INL67 input supply
charger:
type: object
additionalProperties: false
properties:
compatible:
const: active-semi,act8945a-charger
interrupts:
maxItems: 1
active-semi,chglev-gpios:
description: CGHLEV GPIO
maxItems: 1
active-semi,lbo-gpios:
description: LBO GPIO
maxItems: 1
active-semi,input-voltage-threshold-microvolt:
description: Input voltage threshold
maxItems: 1
active-semi,precondition-timeout:
description: Precondition timeout
$ref: /schemas/types.yaml#/definitions/uint32
active-semi,total-timeout:
description: Total timeout
$ref: /schemas/types.yaml#/definitions/uint32
required:
- compatible
- interrupts
additionalProperties: false
required:
- reg
- compatible
- regulators
examples:
- |
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/interrupt-controller/irq.h>
#include <dt-bindings/mfd/atmel-flexcom.h>
#include <dt-bindings/regulator/active-semi,8945a-regulator.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
pmic@5b {
compatible = "active-semi,act8945a";
reg = <0x5b>;
active-semi,vsel-high;
regulators {
REG_DCDC1 {
regulator-name = "VDD_1V35";
regulator-min-microvolt = <1350000>;
regulator-max-microvolt = <1350000>;
regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
<ACT8945A_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
regulator-always-on;
regulator-state-mem {
regulator-on-in-suspend;
regulator-suspend-min-microvolt = <1400000>;
regulator-suspend-max-microvolt = <1400000>;
regulator-changeable-in-suspend;
regulator-mode = <ACT8945A_REGULATOR_MODE_LOWPOWER>;
};
};
REG_DCDC2 {
regulator-name = "VDD_1V2";
regulator-min-microvolt = <1100000>;
regulator-max-microvolt = <1300000>;
regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
<ACT8945A_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};
REG_DCDC3 {
regulator-name = "VDD_3V3";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_FIXED>,
<ACT8945A_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8945A_REGULATOR_MODE_FIXED>;
regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};
REG_LDO1 {
regulator-name = "VDD_FUSE";
regulator-min-microvolt = <2500000>;
regulator-max-microvolt = <2500000>;
regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
<ACT8945A_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};
REG_LDO2 {
regulator-name = "VDD_3V3_LP";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
<ACT8945A_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};
REG_LDO3 {
regulator-name = "VDD_LED";
regulator-min-microvolt = <3300000>;
regulator-max-microvolt = <3300000>;
regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
<ACT8945A_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};
REG_LDO4 {
regulator-name = "VDD_SDHC_1V8";
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
regulator-allowed-modes = <ACT8945A_REGULATOR_MODE_NORMAL>,
<ACT8945A_REGULATOR_MODE_LOWPOWER>;
regulator-initial-mode = <ACT8945A_REGULATOR_MODE_NORMAL>;
regulator-always-on;
regulator-state-mem {
regulator-off-in-suspend;
};
};
};
charger {
compatible = "active-semi,act8945a-charger";
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_charger_chglev &pinctrl_charger_lbo &pinctrl_charger_irq>;
interrupt-parent = <&pioA>;
interrupts = <45 IRQ_TYPE_EDGE_RISING>;
active-semi,chglev-gpios = <&pioA 12 GPIO_ACTIVE_HIGH>;
active-semi,lbo-gpios = <&pioA 72 GPIO_ACTIVE_LOW>;
active-semi,input-voltage-threshold-microvolt = <6600>;
active-semi,precondition-timeout = <40>;
active-semi,total-timeout = <3>;
};
};
};
Binding for Fairchild FAN53555 regulators
Required properties:
- compatible: one of "fcs,fan53555", "fcs,fan53526", "silergy,syr827",
"silergy,syr828" or "tcs,tcs4525".
- reg: I2C address
Optional properties:
- fcs,suspend-voltage-selector: declare which of the two available
voltage selector registers should be used for the suspend
voltage. The other one is used for the runtime voltage setting
Possible values are either <0> or <1>
- vin-supply: regulator supplying the vin pin
Example:
regulator@40 {
compatible = "fcs,fan53555";
regulator-name = "fan53555";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1800000>;
vin-supply = <&parent_reg>;
fcs,suspend-voltage-selector = <1>;
};
# SPDX-License-Identifier: GPL-2.0
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/fcs,fan53555.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Fairchild FAN53555 regulators
maintainers:
- Heiko Stuebner <heiko@sntech.de>
allOf:
- $ref: regulator.yaml#
properties:
compatible:
enum:
- fcs,fan53555
- fcs,fan53526
- silergy,syr827
- silergy,syr828
- tcs,tcs4525
reg:
maxItems: 1
fcs,suspend-voltage-selector:
description: Declares which of the two available voltage selector
registers should be used for the suspend voltage. The other one is used
for the runtime voltage setting.
$ref: /schemas/types.yaml#/definitions/uint32
enum: [ 0, 1 ]
vin-supply:
description: Supply for the vin pin
vsel-gpios:
description: Voltage Select. When this pin is LOW, VOUT is set by the
VSEL0 register. When this pin is HIGH, VOUT is set by the VSEL1 register.
maxItems: 1
required:
- compatible
- reg
unevaluatedProperties: false
examples:
- |
i2c {
#address-cells = <1>;
#size-cells = <0>;
regulator@40 {
compatible = "fcs,fan53555";
reg = <0x40>;
regulator-name = "fan53555";
regulator-min-microvolt = <1000000>;
regulator-max-microvolt = <1800000>;
vin-supply = <&parent_reg>;
fcs,suspend-voltage-selector = <1>;
};
};
...
......@@ -35,6 +35,10 @@ allOf:
required:
- power-domains
- required-opps
- not:
required:
- gpio
- gpios
properties:
compatible:
......@@ -49,6 +53,9 @@ properties:
description: gpio to use for enable control
maxItems: 1
gpios:
maxItems: 1
clocks:
description:
clock to use for enable control. This binding is only available if
......
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/maxim,max20411.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Maxim Integrated MAX20411 Step-Down DC-DC Converter
maintainers:
- Bjorn Andersson <andersson@kernel.org>
description:
The MAX20411 is a high-efficiency, DC-DC step-down converter. It provides
configurable output voltage in the range of 0.5V to 1.275V, configurable over
I2C.
allOf:
- $ref: regulator.yaml#
properties:
compatible:
const: maxim,max20411
reg:
maxItems: 1
enable-gpios:
description: GPIO connected to the EN pin, active high
vdd-supply:
description: Input supply for the device (VDD pin, 3.0V to 5.5V)
required:
- compatible
- reg
- enable-gpios
unevaluatedProperties: false
examples:
- |
#include <dt-bindings/gpio/gpio.h>
i2c {
#address-cells = <1>;
#size-cells = <0>;
regulator@39 {
compatible = "maxim,max20411";
reg = <0x39>;
enable-gpios = <&gpio 2 GPIO_ACTIVE_HIGH>;
regulator-min-microvolt = <800000>;
regulator-max-microvolt = <1000000>;
};
};
...
# SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause)
%YAML 1.2
---
$id: http://devicetree.org/schemas/regulator/qcom,rpm-regulator.yaml#
$schema: http://devicetree.org/meta-schemas/core.yaml#
title: Qualcomm RPM regulator
description:
The Qualcomm RPM regulator is modelled as a subdevice of the RPM.
Please refer to Documentation/devicetree/bindings/soc/qcom/qcom,rpm.yaml
for information regarding the RPM node.
The regulator node houses sub-nodes for each regulator within the device.
Each sub-node is identified using the node's name, with valid values listed
for each of the pmics below.
For pm8058 l0, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11, l12, l13, l14, l15,
l16, l17, l18, l19, l20, l21, l22, l23, l24, l25, s0, s1, s2, s3, s4,
lvs0, lvs1, ncp
For pm8901 l0, l1, l2, l3, l4, l5, l6, s0, s1, s2, s3, s4, lvs0, lvs1, lvs2, lvs3,
mvs
For pm8921 s1, s2, s3, s4, s7, s8, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
l12, l14, l15, l16, l17, l18, l21, l22, l23, l24, l25, l26, l27, l28,
l29, lvs1, lvs2, lvs3, lvs4, lvs5, lvs6, lvs7, usb-switch, hdmi-switch,
ncp
For pm8018 s1, s2, s3, s4, s5, l1, l2, l3, l4, l5, l6, l7, l8, l9, l10, l11,
l12, l14, lvs1
For smb208 s1a, s1b, s2a, s2b
maintainers:
- Bjorn Andersson <andersson@kernel.org>
properties:
compatible:
enum:
- qcom,rpm-pm8058-regulators
- qcom,rpm-pm8901-regulators
- qcom,rpm-pm8921-regulators
- qcom,rpm-pm8018-regulators
- qcom,rpm-smb208-regulators
patternProperties:
".*-supply$":
description: Input supply phandle(s) for this node
"^((s|l|lvs)[0-9]*)|(s[1-2][a-b])|(ncp)|(mvs)|(usb-switch)|(hdmi-switch)$":
description: List of regulators and its properties
$ref: regulator.yaml#
unevaluatedProperties: false
properties:
bias-pull-down:
description: enable pull down of the regulator when inactive
type: boolean
qcom,switch-mode-frequency:
description: Frequency (Hz) of the switch-mode power supply
$ref: /schemas/types.yaml#/definitions/uint32
enum:
- 19200000
- 9600000
- 6400000
- 4800000
- 3840000
- 3200000
- 2740000
- 2400000
- 2130000
- 1920000
- 1750000
- 1600000
- 1480000
- 1370000
- 1280000
- 1200000
qcom,force-mode:
description: Indicates that the regulator should be forced to a particular mode
$ref: /schemas/types.yaml#/definitions/uint32
enum:
- 0 # QCOM_RPM_FORCE_MODE_NONE do not force any mode
- 1 # QCOM_RPM_FORCE_MODE_LPM force into low power mode
- 2 # QCOM_RPM_FORCE_MODE_HPM force into high power mode
- 3 # QCOM_RPM_FORCE_MODE_AUTO allow regulator to automatically select its own mode
# based on realtime current draw, only for pm8921 smps and ftsmps
qcom,power-mode-hysteretic:
description: select that the power supply should operate in hysteretic mode,
instead of the default pwm mode
type: boolean
additionalProperties: false
required:
- compatible
examples:
- |
#include <dt-bindings/mfd/qcom-rpm.h>
regulators {
compatible = "qcom,rpm-pm8921-regulators";
vdd_l1_l2_l12_l18-supply = <&pm8921_s4>;
s1 {
regulator-min-microvolt = <1225000>;
regulator-max-microvolt = <1225000>;
bias-pull-down;
qcom,switch-mode-frequency = <3200000>;
};
pm8921_s4: s4 {
regulator-min-microvolt = <1800000>;
regulator-max-microvolt = <1800000>;
qcom,switch-mode-frequency = <1600000>;
bias-pull-down;
qcom,force-mode = <QCOM_RPM_FORCE_MODE_AUTO>;
};
};
...
......@@ -33,7 +33,7 @@ examples:
pm8150b {
#address-cells = <1>;
#size-cells = <0>;
pm8150b_vbus: dcdc@1100 {
pm8150b_vbus: usb-vbus-regulator@1100 {
compatible = "qcom,pm8150b-vbus-reg";
reg = <0x1100>;
};
......
......@@ -20,7 +20,8 @@ properties:
lab:
type: object
additionalProperties: false
$ref: regulator.yaml#
unevaluatedProperties: false
properties:
qcom,soft-start-us:
......@@ -46,7 +47,8 @@ properties:
ibb:
type: object
additionalProperties: false
$ref: regulator.yaml#
unevaluatedProperties: false
properties:
qcom,discharge-resistor-kohms:
......
......@@ -655,6 +655,14 @@ config REGULATOR_MAX20086
protectorvia I2C bus. The regulator has 2 or 4 outputs depending on
the device model. This driver is only capable to turn on/off them.
config REGULATOR_MAX20411
tristate "Maxim MAX20411 High-Efficiency Single Step-Down Converter"
depends on I2C
select REGMAP_I2C
help
This driver controls the Maxim MAX20411 family of high-efficiency,
syncrhonous step-down converters.
config REGULATOR_MAX77686
tristate "Maxim 77686 regulator"
depends on MFD_MAX77686 || COMPILE_TEST
......
......@@ -80,6 +80,7 @@ obj-$(CONFIG_REGULATOR_MAX8973) += max8973-regulator.o
obj-$(CONFIG_REGULATOR_MAX8997) += max8997-regulator.o
obj-$(CONFIG_REGULATOR_MAX8998) += max8998.o
obj-$(CONFIG_REGULATOR_MAX20086) += max20086-regulator.o
obj-$(CONFIG_REGULATOR_MAX20411) += max20411-regulator.o
obj-$(CONFIG_REGULATOR_MAX77686) += max77686-regulator.o
obj-$(CONFIG_REGULATOR_MAX77693) += max77693-regulator.o
obj-$(CONFIG_REGULATOR_MAX77802) += max77802-regulator.o
......
......@@ -15,7 +15,7 @@
#include <linux/regulator/machine.h>
#include <dt-bindings/regulator/active-semi,8945a-regulator.h>
/**
/*
* ACT8945A Global Register Map.
*/
#define ACT8945A_SYS_MODE 0x00
......@@ -46,13 +46,13 @@
#define ACT8945A_LDO4_CTRL 0x65
#define ACT8945A_LDO4_SUS 0x66
/**
/*
* Field Definitions.
*/
#define ACT8945A_ENA 0x80 /* ON - [7] */
#define ACT8945A_VSEL_MASK 0x3F /* VSET - [5:0] */
/**
/*
* ACT8945A Voltage Number
*/
#define ACT8945A_VOLTAGE_NUM 64
......
......@@ -20,7 +20,7 @@ static void regulator_fixed_release(struct device *dev)
}
/**
* regulator_register_fixed_name - register a no-op fixed regulator
* regulator_register_always_on - register an always-on regulator with a fixed name
* @id: platform device id
* @name: name to be used for the regulator
* @supplies: consumers for this regulator
......
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2021, The Linux Foundation. All rights reserved.
* Copyright (c) 2022, Linaro Ltd.
*/
#include <linux/bitfield.h>
#include <linux/gpio/consumer.h>
#include <linux/i2c.h>
#include <linux/module.h>
#include <linux/of_platform.h>
#include <linux/regmap.h>
#include <linux/regulator/driver.h>
#include <linux/regulator/machine.h>
#include <linux/regulator/of_regulator.h>
#define MAX20411_UV_STEP 6250
#define MAX20411_BASE_UV 243750
#define MAX20411_MIN_SEL 41 /* 0.5V */
#define MAX20411_MAX_SEL 165 /* 1.275V */
#define MAX20411_VID_OFFSET 0x7
#define MAX20411_VID_MASK 0xff
#define MAX20411_SLEW_OFFSET 0x6
#define MAX20411_SLEW_DVS_MASK 0xc
#define MAX20411_SLEW_SR_MASK 0x3
struct max20411 {
struct device *dev;
struct device_node *of_node;
struct regulator_desc desc;
struct regulator_dev *rdev;
struct regmap *regmap;
};
static const unsigned int max20411_slew_rates[] = { 13100, 6600, 3300, 1600 };
static int max20411_enable_time(struct regulator_dev *rdev)
{
int voltage, rate, ret;
unsigned int val;
/* get voltage */
ret = regmap_read(rdev->regmap, rdev->desc->vsel_reg, &val);
if (ret)
return ret;
val &= rdev->desc->vsel_mask;
voltage = regulator_list_voltage_linear(rdev, val);
/* get rate */
ret = regmap_read(rdev->regmap, MAX20411_SLEW_OFFSET, &val);
if (ret)
return ret;
val = FIELD_GET(MAX20411_SLEW_SR_MASK, val);
rate = max20411_slew_rates[val];
return DIV_ROUND_UP(voltage, rate);
}
static const struct regmap_config max20411_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = 0xe,
};
static const struct regulator_ops max20411_ops = {
.get_voltage_sel = regulator_get_voltage_sel_regmap,
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear,
.enable_time = max20411_enable_time,
};
static const struct regulator_desc max20411_desc = {
.ops = &max20411_ops,
.owner = THIS_MODULE,
.type = REGULATOR_VOLTAGE,
.supply_name = "vin",
.name = "max20411",
/*
* voltage = 0.24375V + selector * 6.25mV
* with valid selector between 41 to 165 (0.5V to 1.275V)
*/
.min_uV = MAX20411_BASE_UV,
.uV_step = MAX20411_UV_STEP,
.linear_min_sel = MAX20411_MIN_SEL,
.n_voltages = MAX20411_MAX_SEL + 1,
.vsel_reg = MAX20411_VID_OFFSET,
.vsel_mask = MAX20411_VID_MASK,
.ramp_reg = MAX20411_SLEW_OFFSET,
.ramp_mask = MAX20411_SLEW_DVS_MASK,
.ramp_delay_table = max20411_slew_rates,
.n_ramp_values = ARRAY_SIZE(max20411_slew_rates),
};
static int max20411_probe(struct i2c_client *client)
{
struct regulator_init_data *init_data;
struct device *dev = &client->dev;
struct regulator_config cfg = {};
struct max20411 *max20411;
max20411 = devm_kzalloc(dev, sizeof(*max20411), GFP_KERNEL);
if (!max20411)
return -ENOMEM;
max20411->regmap = devm_regmap_init_i2c(client, &max20411_regmap_config);
if (IS_ERR(max20411->regmap)) {
dev_err(dev, "Failed to allocate regmap!\n");
return PTR_ERR(max20411->regmap);
}
max20411->dev = dev;
max20411->of_node = dev->of_node;
max20411->desc = max20411_desc;
init_data = of_get_regulator_init_data(max20411->dev, max20411->of_node, &max20411->desc);
if (!init_data)
return -ENODATA;
cfg.dev = max20411->dev;
cfg.init_data = init_data;
cfg.of_node = max20411->of_node;
cfg.driver_data = max20411;
cfg.ena_gpiod = gpiod_get(max20411->dev, "enable", GPIOD_ASIS);
if (IS_ERR(cfg.ena_gpiod))
return dev_err_probe(dev, PTR_ERR(cfg.ena_gpiod),
"unable to acquire enable gpio\n");
max20411->rdev = devm_regulator_register(max20411->dev, &max20411->desc, &cfg);
if (IS_ERR(max20411->rdev))
dev_err(max20411->dev, "Failed to register regulator\n");
return PTR_ERR_OR_ZERO(max20411->rdev);
}
static const struct of_device_id of_max20411_match_tbl[] = {
{ .compatible = "maxim,max20411", },
{ },
};
MODULE_DEVICE_TABLE(of, of_max20411_match_tbl);
static const struct i2c_device_id max20411_id[] = {
{ "max20411", 0 },
{ },
};
MODULE_DEVICE_TABLE(i2c, max20411_id);
static struct i2c_driver max20411_i2c_driver = {
.driver = {
.name = "max20411",
.of_match_table = of_max20411_match_tbl,
},
.probe_new = max20411_probe,
.id_table = max20411_id,
};
module_i2c_driver(max20411_i2c_driver);
MODULE_LICENSE("GPL");
......@@ -357,12 +357,6 @@ static int max597x_irq_handler(int irq, struct regulator_irq_data *rid,
return 0;
}
static const struct regmap_config max597x_regmap_config = {
.reg_bits = 8,
.val_bits = 8,
.max_register = MAX_REGISTERS,
};
static int max597x_adc_range(struct regmap *regmap, const int ch,
u32 *irng, u32 *mon_rng)
{
......@@ -431,41 +425,59 @@ static int max597x_setup_irq(struct device *dev,
static int max597x_regulator_probe(struct platform_device *pdev)
{
struct max597x_data *max597x = dev_get_drvdata(pdev->dev.parent);
struct max597x_data *max597x;
struct regmap *regmap = dev_get_regmap(pdev->dev.parent, NULL);
struct max597x_regulator *data;
struct i2c_client *i2c = to_i2c_client(pdev->dev.parent);
struct regulator_config config = { };
struct regulator_dev *rdev;
struct regulator_dev *rdevs[MAX5970_NUM_SWITCHES];
int num_switches = max597x->num_switches;
int num_switches;
int ret, i;
if (!regmap)
return -EPROBE_DEFER;
max597x = devm_kzalloc(&i2c->dev, sizeof(struct max597x_data), GFP_KERNEL);
if (!max597x)
return -ENOMEM;
i2c_set_clientdata(i2c, max597x);
if (of_device_is_compatible(i2c->dev.of_node, "maxim,max5978"))
max597x->num_switches = MAX597x_TYPE_MAX5978;
else if (of_device_is_compatible(i2c->dev.of_node, "maxim,max5970"))
max597x->num_switches = MAX597x_TYPE_MAX5970;
else
return -ENODEV;
i2c_set_clientdata(i2c, max597x);
num_switches = max597x->num_switches;
for (i = 0; i < num_switches; i++) {
data =
devm_kzalloc(max597x->dev, sizeof(struct max597x_regulator),
devm_kzalloc(&i2c->dev, sizeof(struct max597x_regulator),
GFP_KERNEL);
if (!data)
return -ENOMEM;
data->num_switches = num_switches;
data->regmap = max597x->regmap;
data->regmap = regmap;
ret = max597x_adc_range(data->regmap, i, &max597x->irng[i], &max597x->mon_rng[i]);
ret = max597x_adc_range(regmap, i, &max597x->irng[i], &max597x->mon_rng[i]);
if (ret < 0)
return ret;
data->irng = max597x->irng[i];
data->mon_rng = max597x->mon_rng[i];
config.dev = max597x->dev;
config.dev = &i2c->dev;
config.driver_data = (void *)data;
config.regmap = data->regmap;
rdev = devm_regulator_register(max597x->dev,
rdev = devm_regulator_register(&i2c->dev,
&regulators[i], &config);
if (IS_ERR(rdev)) {
dev_err(max597x->dev, "failed to register regulator %s\n",
dev_err(&i2c->dev, "failed to register regulator %s\n",
regulators[i].name);
return PTR_ERR(rdev);
}
......@@ -473,12 +485,12 @@ static int max597x_regulator_probe(struct platform_device *pdev)
max597x->shunt_micro_ohms[i] = data->shunt_micro_ohms;
}
if (max597x->irq) {
if (i2c->irq) {
ret =
max597x_setup_irq(max597x->dev, max597x->irq, rdevs, num_switches,
max597x_setup_irq(&i2c->dev, i2c->irq, rdevs, num_switches,
data);
if (ret) {
dev_err(max597x->dev, "IRQ setup failed");
dev_err(&i2c->dev, "IRQ setup failed");
return ret;
}
}
......
......@@ -94,9 +94,11 @@ static int max77802_set_suspend_disable(struct regulator_dev *rdev)
{
unsigned int val = MAX77802_OFF_PWRREQ;
struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev);
int id = rdev_get_id(rdev);
unsigned int id = rdev_get_id(rdev);
int shift = max77802_get_opmode_shift(id);
if (WARN_ON_ONCE(id >= ARRAY_SIZE(max77802->opmode)))
return -EINVAL;
max77802->opmode[id] = val;
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask, val << shift);
......@@ -110,7 +112,7 @@ static int max77802_set_suspend_disable(struct regulator_dev *rdev)
static int max77802_set_mode(struct regulator_dev *rdev, unsigned int mode)
{
struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev);
int id = rdev_get_id(rdev);
unsigned int id = rdev_get_id(rdev);
unsigned int val;
int shift = max77802_get_opmode_shift(id);
......@@ -127,6 +129,9 @@ static int max77802_set_mode(struct regulator_dev *rdev, unsigned int mode)
return -EINVAL;
}
if (WARN_ON_ONCE(id >= ARRAY_SIZE(max77802->opmode)))
return -EINVAL;
max77802->opmode[id] = val;
return regmap_update_bits(rdev->regmap, rdev->desc->enable_reg,
rdev->desc->enable_mask, val << shift);
......@@ -135,8 +140,10 @@ static int max77802_set_mode(struct regulator_dev *rdev, unsigned int mode)
static unsigned max77802_get_mode(struct regulator_dev *rdev)
{
struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev);
int id = rdev_get_id(rdev);
unsigned int id = rdev_get_id(rdev);
if (WARN_ON_ONCE(id >= ARRAY_SIZE(max77802->opmode)))
return -EINVAL;
return max77802_map_mode(max77802->opmode[id]);
}
......@@ -160,10 +167,13 @@ static int max77802_set_suspend_mode(struct regulator_dev *rdev,
unsigned int mode)
{
struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev);
int id = rdev_get_id(rdev);
unsigned int id = rdev_get_id(rdev);
unsigned int val;
int shift = max77802_get_opmode_shift(id);
if (WARN_ON_ONCE(id >= ARRAY_SIZE(max77802->opmode)))
return -EINVAL;
/*
* If the regulator has been disabled for suspend
* then is invalid to try setting a suspend mode.
......@@ -209,9 +219,11 @@ static int max77802_set_suspend_mode(struct regulator_dev *rdev,
static int max77802_enable(struct regulator_dev *rdev)
{
struct max77802_regulator_prv *max77802 = rdev_get_drvdata(rdev);
int id = rdev_get_id(rdev);
unsigned int id = rdev_get_id(rdev);
int shift = max77802_get_opmode_shift(id);
if (WARN_ON_ONCE(id >= ARRAY_SIZE(max77802->opmode)))
return -EINVAL;
if (max77802->opmode[id] == MAX77802_OFF_PWRREQ)
max77802->opmode[id] = MAX77802_OPMODE_NORMAL;
......@@ -495,7 +507,7 @@ static int max77802_pmic_probe(struct platform_device *pdev)
for (i = 0; i < MAX77802_REG_MAX; i++) {
struct regulator_dev *rdev;
int id = regulators[i].id;
unsigned int id = regulators[i].id;
int shift = max77802_get_opmode_shift(id);
int ret;
......@@ -513,10 +525,12 @@ static int max77802_pmic_probe(struct platform_device *pdev)
* the hardware reports OFF as the regulator operating mode.
* Default to operating mode NORMAL in that case.
*/
if (val == MAX77802_STATUS_OFF)
max77802->opmode[id] = MAX77802_OPMODE_NORMAL;
else
max77802->opmode[id] = val;
if (id < ARRAY_SIZE(max77802->opmode)) {
if (val == MAX77802_STATUS_OFF)
max77802->opmode[id] = MAX77802_OPMODE_NORMAL;
else
max77802->opmode[id] = val;
}
rdev = devm_regulator_register(&pdev->dev,
&regulators[i], &config);
......
......@@ -77,6 +77,7 @@
* @MCP16502_REG_A: active state register
* @MCP16502_REG_LPM: low power mode state register
* @MCP16502_REG_HIB: hibernate state register
* @MCP16502_REG_HPM: high-performance mode register
* @MCP16502_REG_SEQ: startup sequence register
* @MCP16502_REG_CFG: configuration register
*/
......
......@@ -923,10 +923,14 @@ static int s5m8767_pmic_probe(struct platform_device *pdev)
for (i = 0; i < pdata->num_regulators; i++) {
const struct sec_voltage_desc *desc;
int id = pdata->regulators[i].id;
unsigned int id = pdata->regulators[i].id;
int enable_reg, enable_val;
struct regulator_dev *rdev;
BUILD_BUG_ON(ARRAY_SIZE(regulators) != ARRAY_SIZE(reg_voltage_map));
if (WARN_ON_ONCE(id >= ARRAY_SIZE(regulators)))
continue;
desc = reg_voltage_map[id];
if (desc) {
regulators[id].n_voltages =
......
......@@ -311,16 +311,12 @@ static int scmi_regulator_probe(struct scmi_device *sdev)
return PTR_ERR(voltage_ops);
num_doms = voltage_ops->num_domains_get(ph);
if (num_doms <= 0) {
if (!num_doms) {
dev_err(&sdev->dev,
"number of voltage domains invalid\n");
num_doms = -EINVAL;
} else {
dev_err(&sdev->dev,
"failed to get voltage domains - err:%d\n",
num_doms);
}
if (!num_doms)
return 0;
if (num_doms < 0) {
dev_err(&sdev->dev, "failed to get voltage domains - err:%d\n",
num_doms);
return num_doms;
}
......
......@@ -173,24 +173,6 @@ static unsigned int tps65219_get_mode(struct regulator_dev *dev)
return REGULATOR_MODE_NORMAL;
}
/*
* generic regulator_set_bypass_regmap does not fully match requirements
* TPS65219 Requires explicitly that regulator is disabled before switch
*/
static int tps65219_set_bypass(struct regulator_dev *dev, bool enable)
{
struct tps65219 *tps = rdev_get_drvdata(dev);
unsigned int rid = rdev_get_id(dev);
if (dev->desc->ops->is_enabled(dev)) {
dev_err(tps->dev,
"%s LDO%d enabled, must be shut down to set bypass ",
__func__, rid);
return -EBUSY;
}
return regulator_set_bypass_regmap(dev, enable);
}
/* Operations permitted on BUCK1/2/3 */
static const struct regulator_ops tps65219_bucks_ops = {
.is_enabled = regulator_is_enabled_regmap,
......@@ -217,7 +199,7 @@ static const struct regulator_ops tps65219_ldos_1_2_ops = {
.set_voltage_sel = regulator_set_voltage_sel_regmap,
.list_voltage = regulator_list_voltage_linear_range,
.map_voltage = regulator_map_voltage_linear_range,
.set_bypass = tps65219_set_bypass,
.set_bypass = regulator_set_bypass_regmap,
.get_bypass = regulator_get_bypass_regmap,
};
......@@ -342,7 +324,7 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
&config);
if (IS_ERR(rdev)) {
dev_err(tps->dev, "failed to register %s regulator\n",
pdev->name);
regulators[i].name);
return PTR_ERR(rdev);
}
rdevtbl[i] = rdev;
......@@ -367,7 +349,7 @@ static int tps65219_regulator_probe(struct platform_device *pdev)
irq_data[i].type = irq_type;
tps65219_get_rdev_by_name(irq_type->regulator_name, rdevtbl, rdev);
if (rdev < 0) {
if (IS_ERR(rdev)) {
dev_err(tps->dev, "Failed to get rdev for %s\n",
irq_type->regulator_name);
return -EINVAL;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment