Skip to content

Commit

Permalink
regulator: onsemi-ncp6335d: add support for device tree
Browse files Browse the repository at this point in the history
Port from kernel 3.10

Signed-off-by: Jun Nie <[email protected]>
  • Loading branch information
niej authored and vknecht committed Sep 14, 2020
1 parent 42b6a1a commit a88cecf
Show file tree
Hide file tree
Showing 4 changed files with 1,027 additions and 0 deletions.
72 changes: 72 additions & 0 deletions Documentation/devicetree/bindings/regulator/onsemi-ncp6335d.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
ON Semiconductor NCP6335d regulator

NCP6335d is able to deliver up to 5.0 A, with programmable output voltage from
0.6 V to 1.87 V in 10mV steps, with synchronous rectification and automatic PWM/
PFM transitions, enable pins and power good/fail signaling.

The NCP6335d interface is via I2C bus.

Required Properties:
- compatible: Must be "onnn,ncp6335d-regulator".
- reg: The device 8-bit I2C address.
- regulator-min-microvolt: Minimum voltage in microvolts supported by this
regulator.
- regulator-max-microvolt: Maximum voltage in microvolts supported by this
regulator.
- onnn,min-setpoint: Minimum setpoint voltage in microvolts supported
by this regulator.
- onnn,step-size: The step size of the regulator, in uV.
- onnn,min-slew-ns: Minimum time in ns needed to change voltage by
one step size. This value corresponds to DVS
mode bit of 00b in command register.
- onnn,max-slew-ns: Maximum time in ns needed to change voltage by
one step size. This value corresponds to DVS
mode bit of 11b in command register.
- onnn,vsel: Working vsel register. Supported value are 0
or 1.
- onnn,slew-ns: Time in ns needed to change voltage by one step
size. Supported value are 333, 666, 1333, 2666.

Optional Properties:
- onnn,discharge-enable: Present: discharge enabled.
Not Present: discharge disabled.
- onnn,restore-reg: Present: Restore vsel register from backup register.
Not Present: No restore.
- onnn,vsel-gpio: Present: GPIO connects to the VSEL pin and set the
VSEL pin according to device tree flag.
Not Present: No GPIO is connected to vsel pin.
- pinctrl-names: The state name of the VSEL pin configuration.
Only support: "default"
- pinctrl-0: The phandles of the pin configuration node in
pinctrl for VSEL pin.
For details of pinctrl properties, please refer to:
"Documentation/devicetree/bindings/pinctrl/pinctrl-bindings.txt"
- onnn,sleep-enable: Present: Forced in sleep mode when EN and VSEL
pins are low.
Not Present: Low quiescent current mode when EN and VSEL
pins are low.
- onnn,mode: A string which specifies the initial mode to use for the regulator.
Supported values are "pwm" and "auto". PWM mode is more
robust, but draws more current than auto mode. If this propery
is not specified, then the regulator will be in the hardware default mode.

Example:
i2c_0 {
ncp6335d-regulator@1c {
compatible = "onnn,ncp6335d-regulator";
reg = <0x1c>;
onnn,vsel = <0>;
onnn,slew-rate-ns = <2666>;
onnn,discharge-enable;
onnn,step-size = <10000>;
onnn,min-slew-ns = <333>;
onnn,max-slew-ns = <2666>;
pintrl-names = "default";
pinctrl-0 = <&ext_buck_vsel_default>;

regulator-min-microvolt = <1050000>;
regulator-max-microvolt = <1350000>;
onnn,min-setpoint = <600000>;
onnn,vsel-gpio = <&msmgpio 2 1>;
};
};
9 changes: 9 additions & 0 deletions drivers/regulator/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -1233,5 +1233,14 @@ config REGULATOR_QCOM_LABIBB
boost regulator and IBB can be used as a negative boost regulator
for LCD display panel.

config REGULATOR_ONSEMI_NCP6335D
tristate "OnSemi NCP6335D regulator support"
depends on I2C
help
This driver supports the OnSemi NCP6335D switching voltage regulator
(buck convertor). The regulator is controlled using an I2C interface
and supports a programmable voltage range from 0.6V to 1.4V in steps
of 6.25mV.

endif

1 change: 1 addition & 0 deletions drivers/regulator/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -152,5 +152,6 @@ obj-$(CONFIG_REGULATOR_WM831X) += wm831x-ldo.o
obj-$(CONFIG_REGULATOR_WM8350) += wm8350-regulator.o
obj-$(CONFIG_REGULATOR_WM8400) += wm8400-regulator.o
obj-$(CONFIG_REGULATOR_WM8994) += wm8994-regulator.o
obj-$(CONFIG_REGULATOR_ONSEMI_NCP6335D) += onsemi-ncp6335d.o

ccflags-$(CONFIG_REGULATOR_DEBUG) += -DDEBUG
Loading

0 comments on commit a88cecf

Please sign in to comment.