Add AMS AS3722 mfd, GPIO, regulator and RTC driver
Subsystems (6)
v2 cover Add AMS AS3722 mfd, GPIO, regulator and RTC driver
This series add the driver support for AMS AS3722 PMIC. The driver includes MFD, GPIO, regulator and RTC.
Changes from V1:
- Remove compatible string from DT for subnode.
- Add macro in regmap.h for definign range.
- Nit cleanups in driver and use module_i2c_driver/module_platform_driver.
- Use linear_range and added regulator_map_* on regulators.
- Move OC configuration to regulator_current limit setting.
- Get rid of clk32k out configuration from RTC. Will add clock driver.
Laxman Dewangan (5):
regmap: add helper macro to set min/max range of register
mfd: add support for AMS AS3722 PMIC
gpio: add support for AMS AS3722 gpio driver
regulator: as3722: add regulator driver for AMS AS3722 drivers/rtc/rtc-as3722: add RTC driver
.../devicetree/bindings/gpio/gpio-as3722.txt | 62 ++ Documentation/devicetree/bindings/mfd/as3722.txt | 47 + .../bindings/regulator/as3722-regulator.txt | 91 ++ drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-as3722.c | 435 ++++++++++ drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile | 1 + drivers/mfd/as3722.c | 448 ++++++++++ drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/as3722-regulator.c | 917 ++++++++++++++++++++ drivers/rtc/Kconfig | 10 + drivers/rtc/Makefile | 1 + drivers/rtc/rtc-as3722.c | 296 +++++++ include/linux/mfd/as3722.h | 423 +++++++++ include/linux/regmap.h | 2 + 17 files changed, 2761 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-as3722.txt create mode 100644 Documentation/devicetree/bindings/mfd/as3722.txt create mode 100644 Documentation/devicetree/bindings/regulator/as3722-regulator.txt create mode 100644 drivers/gpio/gpio-as3722.c create mode 100644 drivers/mfd/as3722.c create mode 100644 drivers/regulator/as3722-regulator.c create mode 100644 drivers/rtc/rtc-as3722.c create mode 100644 include/linux/mfd/as3722.h
PATCH v2 1/5 regmap: add helper macro to set min/max range of register
Add helper macro to set the min and max value of the register range.
This is useful when initialising the register ranges of the device like
static const struct regmap_range readable_ranges[] = {
regmap_reg_range(DEVICE_REG0, DEVICE_REG10),
};
---
As per Mark's comment on V1 series, adding the macro in header in place of defining in driver.
This should go on same tree as 2/5.
include/linux/regmap.h | 2 ++ 1 files changed, 2 insertions(+), 0 deletions(-)
include/linux/regmap.h +2 -0
@@ -70,6 +70,8 @@ struct regmap_range {unsigned int range_max; }; +#define regmap_reg_range (low, high) { .range_min = low, .range_max = high, } +/* * A table of ranges including some yes ranges and some no ranges. * If a register belongs to a no_range, the corresponding check function
Signature · 1 line
1.7.1.1
Mark Brown
maintainerRe: [PATCH V2 1/5] regmap: add helper macro to set min/max range of register
Quoted 3 lines · Laxman Dewangan
Add helper macro to set the min and max value of the register range.
This is useful when initialising the register ranges of the device like
Applied on a branch, thanks - please feel free to pull
git://git.kernel.org/pub/scm/linux/kernel/git/broonie/regmap.git regmap-range-macro
in for anything that depends on it.
PATCH v2 2/5 mfd: add support for AMS AS3722 PMIC
In reply to Laxman DewanganThe AMS AS3722 is a compact system PMU suitable for mobile phones, tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down controller, 11 LDOs, RTC, automatic battery, temperature and over-current monitoring, 8 GPIOs, ADC and wathdog.
Add mfd core driver for the AS3722 to support core functionality.
---
Changes from V1:
- Remove compatible string from DT for subnode.
- Nit cleanups in driver and use module_i2c_driver
Documentation/devicetree/bindings/mfd/as3722.txt | 47 +++ drivers/mfd/Kconfig | 12 + drivers/mfd/Makefile | 1 + drivers/mfd/as3722.c | 448 ++++++++++++++++++++++ include/linux/mfd/as3722.h | 423 ++++++++++++++++++++ 5 files changed, 931 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/mfd/as3722.txt create mode 100644 drivers/mfd/as3722.c create mode 100644 include/linux/mfd/as3722.h
Documentation/devicetree/bindings/mfd/as3722.txt new file +47 -0
@@ -0,0 +1,47 @@ +* AMS AS3722 Power management IC. + +Required properties: +------------------- +- compatible : Must be "ams,as3722". +- reg: I2C device address. +- interrupt-controller : AS3722 has its own internal IRQs +- #interrupt-cells : should be set to 2 for IRQ number and flags + The first cell is the IRQ number. + The second cell is the flags, encoded as the trigger masks from + Documentation/devicetree/bindings/interrupts.txt, using + the #defines found in dt-bindings/irq. +- interrupt-parent : The parent interrupt controller. + +Optional properties: +------------------- +- gpio-controller: Marks the device node as a GPIO controller. +- #gpio-cells: Number of GPIO cells. Refer + Documentation/devicetree/bindings/gpio/gpio.txt + +Example: +-------- +ams3722 { + compatible = "ams,as3722"; + reg = <0x48> + + interrupt-parent = <&intc>; + interrupt-controller; + #interrupt-cells = <2>; + + gpio-controller; + #gpio-cells = <2>; + + gpio { + /* + * GPIO related properties + * Refer document bindings/gpio/gpio-as3722.txt + */ + }; + + regulators { + /* + * Regulator related properties + * Refer document bindings/regulator/as3722-regulator.txt + */ + }; +};
drivers/mfd/Kconfig +12 -0
@@ -27,6 +27,18 @@ config MFD_AS3711 help Support for the AS3711 PMIC from AMS +config MFD_AS3722 + bool "AMS AS3722 Power Management IC" + select MFD_CORE + select REGMAP_I2C + select REGMAP_IRQ + depends on I2C && OF + help + The AMS AS3722 is a compact system PMU suitable for mobile phones, + tablet etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down + controller, 11 LDOs, RTC, automatic battery, temperature and + over current monitoring, GPIOs, ADC, watchdog. + config PMIC_ADP5520 bool "Analog Devices ADP5520/01 MFD PMIC Core Support" depends on I2C=y
drivers/mfd/Makefile +1 -0
@@ -162,3 +162,4 @@ obj-$(CONFIG_MFD_LM3533) += lm3533-core.o lm3533-ctrlbank.o obj-$(CONFIG_VEXPRESS_CONFIG) += vexpress-config.o vexpress-sysreg.o obj-$(CONFIG_MFD_RETU) += retu-mfd.o obj-$(CONFIG_MFD_AS3711) += as3711.o +obj-$(CONFIG_MFD_AS3722) += as3722.o
drivers/mfd/as3722.c new file +448 -0
448 lines not on this page · raw message
include/linux/mfd/as3722.h new file +423 -0
423 lines not on this page · raw message
Signature · 1 line
1.7.1.1
Re: [PATCH V2 2/5] mfd: add support for AMS AS3722 PMIC
Quoted 6 lines
The AMS AS3722 is a compact system PMU suitable for mobile phones, tablets etc. It has 4 DC/DC step-down regulators, 3 DC/DC step-down controller, 11 LDOs, RTC, automatic battery, temperature and over-current monitoring, 8 GPIOs, ADC and wathdog.
Add mfd core driver for the AS3722 to support core functionality.
<snip>
Quoted 17 lines
Documentation/devicetree/bindings/mfd/as3722.txt new file +17
-0+Example: +-------- +ams3722 { + compatible = "ams,as3722"; + reg = <0x48> + + interrupt-parent = <&intc>; + interrupt-controller; + #interrupt-cells = <2>; + + gpio-controller; + #gpio-cells = <2>; + + gpio { + /* + * GPIO related properties + * Refer document bindings/gpio/gpio-as3722.txt
Documentation/devicetree/bindings/mfd/as3722.txt line 47
Quoted 10 lines
Documentation/devicetree/bindings/mfd/as3722.txt new file +10
-0+ */ + }; + + regulators { + /* + * Regulator related properties + * Refer document bindings/regulator/as3722-regulator.txt + */ + }; +};
I still don't think this is the way to go. If you can justify that these sub-devices require their own node, then they should have a compatible string. The MFD sub-system will then populate the of_node for you and you can use/request them in the normal way.
To reiterate, Mark's issue was not the existence of the compatible string, it was with the existence of the child nodes in general.
Personally I think the device should have sub-nodes. It's how we dealt with our DB8500 and AB8500 and it works very well. At the end of the day these all-in-one chips do house very different devices. I see no harm in describing them that way. I'm sure other OSes can make use of the sub-devices in similar ways.
Signature · 4 lines
Lee Jones Linaro STMicroelectronics Landing Team Lead Linaro.org │ Open source software for ARM SoCs Follow Linaro: Facebook | Twitter | Blog
Mark Brown
maintainerRe: [PATCH V2 2/5] mfd: add support for AMS AS3722 PMIC
Quoted 5 lines · Lee Jones
Personally I think the device should have sub-nodes. It's how we dealt with our DB8500 and AB8500 and it works very well. At the end of the day these all-in-one chips do house very different devices. I see no harm in describing them that way. I'm sure other OSes can make use of the sub-devices in similar ways.
For some bits of the device it makes sense - the regulators are a good example with this device - but for others it's more questionable if the Linux division of the device into subsystems is general enough (or even static for Linux - like this one where there's the 32kHz clock being handled by the RTC driver binding in the last patch posted).
PATCH v2 3/5 gpio: add support for AMS AS3722 gpio driver
In reply to Laxman DewanganThe AS3722 is a compact system PMU suitable for mobile phones, tablets etc.
Add a driver to support accessing the 8 GPIOs found on the AMS AS3722 PMIC using gpiolib.
---
Changes from V1:
- Nit cleanups in driver and use module_platform_driver.
.../devicetree/bindings/gpio/gpio-as3722.txt | 62 +++ drivers/gpio/Kconfig | 6 + drivers/gpio/Makefile | 1 + drivers/gpio/gpio-as3722.c | 435 ++++++++++++++++++++ 4 files changed, 504 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/gpio/gpio-as3722.txt create mode 100644 drivers/gpio/gpio-as3722.c
Documentation/devicetree/bindings/gpio/gpio-as3722.txt new file +62 -0
@@ -0,0 +1,62 @@ +GPIO of AMS AS3722 PMIC. + +Name of GPIO subnode should be "gpio". +Required properties: +-------------------- +- #address-cells: Number of address of the sub node of this node. Must be 1. +- #size-cells: Size of addess cells. Must be 1. + +Sub node: +-------- +The sub nodes provides the configuration of each GPIO pins. The properties of the +nodes are as follows: + +Required subnode properties: +--------------------------- +reg: The GPIO number on which the properties need to be applied. + +Optional subnode properties: +--------------------------- +bias-pull-up: The Pull-up for the pin to be enable. +bias-pull-down: Pull down of the pins to be enable. +bias-high-impedance: High impedance of the pin to be enable. +open-drain: Pin is open drain type. +function: IO functionality of the pins. The valid options are: + gpio, intrrupt-output, vsup-vbat-low-undeb, interrupt-input, + pwm-input, voltage-stby, oc-powergood-sd0, powergood-output, + clk32k-output, watchdog-input, soft-reset-input, pwm-output, + vsup-vbat-low-deb, oc-powergood-sd6 + Missing the function property will set the pin in GPIO mode. + +ams,enable-gpio-invert: Enable invert of the signal on GPIO pin. + +Example: + ams3722:: ams3722 { + compatible = "ams,as3722"; + ... + gpio-controller; + #gpio-cells = <2>; + + gpio { + #address-cells = <1>; + #size-cells = <0>; + gpio@0 { + reg = <0>; + bias-pull-down; + }; + + gpio@1 { + reg = <1>; + bias-pull-up; + ams,enable-gpio-invert; + }; + + ... + gpio@5 { + reg = <5>; + unction = "clk32k-output"; + }; + ... + }; + ... + };
drivers/gpio/Kconfig +6 -0
@@ -368,6 +368,12 @@ config GPIO_ARIZONA help Support for GPIOs on Wolfson Arizona class devices. +config GPIO_AS3722 + bool "AMS AS3722 PMICs GPIO" + depends on MFD_AS3722 + help + Select this option to enable GPIO driver for the AMS AS3722 PMIC. + config GPIO_MAX7300 tristate "Maxim MAX7300 GPIO expander" depends on I2C
drivers/gpio/Makefile +1 -0
@@ -16,6 +16,7 @@ obj-$(CONFIG_GPIO_ADP5520) += gpio-adp5520.o obj-$(CONFIG_GPIO_ADP5588) += gpio-adp5588.o obj-$(CONFIG_GPIO_AMD8111) += gpio-amd8111.o obj-$(CONFIG_GPIO_ARIZONA) += gpio-arizona.o +obj-$(CONFIG_GPIO_AS3722) += gpio-as3722.o obj-$(CONFIG_GPIO_BT8XX) += gpio-bt8xx.o obj-$(CONFIG_GPIO_CLPS711X) += gpio-clps711x.o obj-$(CONFIG_GPIO_CS5535) += gpio-cs5535.o
drivers/gpio/gpio-as3722.c new file +435 -0
435 lines not on this page · raw message
Signature · 1 line
1.7.1.1
Re: [rtc-linux] [PATCH V2 3/5] gpio: add support for AMS AS3722 gpio driver
Quoted 7 lines · Laxman Dewangan
The AS3722 is a compact system PMU suitable for mobile phones, tablets etc.
Add a driver to support accessing the 8 GPIOs found on the AMS AS3722 PMIC using gpiolib.
Signed-off-by Laxman Dewangan <[email protected]>Signed-off-by Florian Lobmaier <[email protected]>
OK...
Quoted 6 lines
Documentation/devicetree/bindings/gpio/gpio-as3722.txt new file +6
-0+Required subnode properties: +--------------------------- +reg: The GPIO number on which the properties need to be applied. + +Optional subnode properties: +---------------------------
Documentation/devicetree/bindings/gpio/gpio-as3722.txt line 29
Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-as3722.txt new file +10
-0+bias-pull-up: The Pull-up for the pin to be enable. +bias-pull-down: Pull down of the pins to be enable. +bias-high-impedance: High impedance of the pin to be enable. +open-drain: Pin is open drain type. +function: IO functionality of the pins. The valid options are: + gpio, intrrupt-output, vsup-vbat-low-undeb, interrupt-input, + pwm-input, voltage-stby, oc-powergood-sd0, powergood-output, + clk32k-output, watchdog-input, soft-reset-input, pwm-output, + vsup-vbat-low-deb, oc-powergood-sd6 + Missing the function property will set the pin in GPIO mode.
This is pin control. Do not try to shoehorn pin control drivers into the GPIO subsystem. Take a good day off, read through Documentation/pinctrl.txt and come back with a thoroughly rewritten driver in drivers/pinctrl/pinctrl-as3722.c.
We already have generic device tree bindings for all of the above properties, and a library for generic pin config in the pin control subsystem to handle them. Look at recent drivers for inspiration.
drivers/gpio/Kconfig
Quoted 1 line
drivers/gpio/Kconfig +0
-0
Move this driver to the pinctrl subsystem.
drivers/gpio/Kconfig config GPIO_ARIZONA · line 375
Quoted 12 lines
index b6ed304..544a612 100644
drivers/gpio/Kconfig +5
-0@@ -368,6 +368,12 @@ config GPIO_ARIZONA help Support for GPIOs on Wolfson Arizona class devices. +config GPIO_AS3722 + bool "AMS AS3722 PMICs GPIO" + depends on MFD_AS3722 + help + Select this option to enable GPIO driver for the AMS AS3722 PMIC.
It should
select PINMUX
select GENERIC_PINCONF
drivers/gpio/Kconfig config GPIO_ARIZONA · line 378
Quoted 3 lines
drivers/gpio/Kconfig +3
-0+static char const *as3722_gpio_iosf[] = { + "gpio", + "intrrupt-output",
intrrupt?
Yours,
Linus Walleij
Re: [rtc-linux] [PATCH V2 3/5] gpio: add support for AMS AS3722 gpio driver
Quoted 23 lines · Linus Walleij
Quoted 6 lines · Laxman Dewangan
Documentation/devicetree/bindings/gpio/gpio-as3722.txt new file +6
-0+Required subnode properties: +--------------------------- +reg: The GPIO number on which the properties need to be applied. + +Optional subnode properties: +---------------------------Documentation/devicetree/bindings/gpio/gpio-as3722.txt line 29
Quoted 10 lines
Documentation/devicetree/bindings/gpio/gpio-as3722.txt new file +10
-0+bias-pull-up: The Pull-up for the pin to be enable. +bias-pull-down: Pull down of the pins to be enable. +bias-high-impedance: High impedance of the pin to be enable. +open-drain: Pin is open drain type. +function: IO functionality of the pins. The valid options are: + gpio, intrrupt-output, vsup-vbat-low-undeb, interrupt-input, + pwm-input, voltage-stby, oc-powergood-sd0, powergood-output, + clk32k-output, watchdog-input, soft-reset-input, pwm-output, + vsup-vbat-low-deb, oc-powergood-sd6 + Missing the function property will set the pin in GPIO mode.This is pin control. Do not try to shoehorn pin control drivers into the GPIO subsystem. Take a good day off, read through
Documentation/pinctrl.txtand come back with a thoroughly rewritten driver indrivers/pinctrl/pinctrl-as3722.c.
Quoted 5 lines
We already have generic device tree bindings for all of the above properties, and a library for generic pin config in the pin control subsystem to handle them. Look at recent drivers for inspiration.
Yes, the appropriate location is pin control for pull up/down etc configuration but with this device, the actual issue is with the way it is require to configure the pull up/down and input/output of the pin. There is no separate bits for pull up/down and direction and it is clubbed together. The register's bits are defined as:
Selects the GPIO mode (I, I/O, Tri, Pulls) (BIT 2:0)
0 : Input
1 : Output (push and pull) VSUP_GPIO
2 : Output/Input (open drain, only NMOS is active)
3 : ADC input (Tristate)
4 : Input with pull-up to VDD_GPIO_lv
5 : Input with pull-down
6 : Output/Input open drain (nmos) with pull-up to VDD_GPIO_lv, 7 : Output (push and pull) VDD_GPIO_lv
So I can not actually configure the pull up/down, open drain and direction independently until every thing is known. Direction come from gpio driver but pull up/down and open drain configuration come from the pin control. And this is only the reason to make all configuration in single driver.
Re: [rtc-linux] [PATCH V2 3/5] gpio: add support for AMS AS3722 gpio driver
Quoted 6 lines · Laxman Dewangan
Quoted 4 lines · Linus Walleij
This is pin control. Do not try to shoehorn pin control drivers into the GPIO subsystem. Take a good day off, read through
Documentation/pinctrl.txtand come back with a thoroughly rewritten driver indrivers/pinctrl/pinctrl-as3722.c.
(...)
Quoted 17 lines
Yes, the appropriate location is pin control for pull up/down etc configuration but with this device, the actual issue is with the way it is require to configure the pull up/down and input/output of the pin. There is no separate bits for pull up/down and direction and it is clubbed together. The register's bits are defined as:
Selects the GPIO mode (I, I/O, Tri, Pulls) (BIT 2:0)
0 : Input
1 : Output (push and pull)VSUP_GPIO
2 : Output/Input (open drain, only NMOS is active)
3 : ADC input (Tristate)
4 : Input with pull-up toVDD_GPIO_lv
5 : Input with pull-down
6 : Output/Input open drain (nmos) with pull-up toVDD_GPIO_lv, 7 : Output (push and pull)VDD_GPIO_lv
Quoted 5 lines
So I can not actually configure the pull up/down, open drain and direction independently until every thing is known.
Direction come from gpio driver but pull up/down and open drain configuration come from the pin control.
And this is only the reason to make all configuration in single driver.
This is nothing special. Create a single combined GPIO and pin control driver using the pin control framework and device tree bindings.
It is the responsibility of the driver to say "no" to things the hardware cannot handle, and it is the responsibility of the driver to track the state of the hardware.
The fact that hardware engineers have attempted to be "helpful" by supplying 8 predefined configuration states does not change anything.
Also it is obviously soon a pin control driver since your DT binding contains this:
+function: IO functionality of the pins. The valid options are:
+ gpio, intrrupt-output, vsup-vbat-low-undeb, interrupt-input, + pwm-input, voltage-stby, oc-powergood-sd0, powergood-output, + clk32k-output, watchdog-input, soft-reset-input, pwm-output, + vsup-vbat-low-deb, oc-powergood-sd6
+ Missing the function property will set the pin in GPIO mode.
Which shall be implemented using the pinmux portions of pin control.
Yours,
Linus Walleij
Re: [rtc-linux] [PATCH V2 3/5] gpio: add support for AMS AS3722 gpio driver
Quoted 23 lines · Linus Walleij
Quoted 5 lines · Laxman Dewangan
Quoted 4 lines · Linus Walleij
This is pin control. Do not try to shoehorn pin control drivers into the GPIO subsystem. Take a good day off, read through
Documentation/pinctrl.txtand come back with a thoroughly rewritten driver indrivers/pinctrl/pinctrl-as3722.c.(...)
Quoted 16 lines
Yes, the appropriate location is pin control for pull up/down etc configuration but with this device, the actual issue is with the way it is require to configure the pull up/down and input/output of the pin. There is no separate bits for pull up/down and direction and it is clubbed together. The register's bits are defined as:
Selects the GPIO mode (I, I/O, Tri, Pulls) (BIT 2:0)
0 : Input
1 : Output (push and pull)VSUP_GPIO
2 : Output/Input (open drain, only NMOS is active)
3 : ADC input (Tristate)
4 : Input with pull-up toVDD_GPIO_lv
5 : Input with pull-down
6 : Output/Input open drain (nmos) with pull-up toVDD_GPIO_lv, 7 : Output (push and pull)VDD_GPIO_lv
Quoted 9 lines
Quoted 5 lines
So I can not actually configure the pull up/down, open drain and direction independently until every thing is known.
Direction come from gpio driver but pull up/down and open drain configuration come from the pin control.
And this is only the reason to make all configuration in single driver.This is nothing special. Create a single combined GPIO and pin control driver using the pin control framework and device tree bindings.
Ok, I was thinking that we should not call gpiochip_add() from the pin control driver in any new driver and that's why I developed gpio driver but it seems it is allowed. I saw some of driver in pinctrl are doing pin control and gpio functionality in single driver i.e. pincntrl-nomadik, pinctrl-samsung, pincntrl-st etc. So this gpio driver can be moved now to the pincntrl folder and can use pincontrol and gpio framework.
I will respin the change.
Re: [rtc-linux] [PATCH V2 3/5] gpio: add support for AMS AS3722 gpio driver
Quoted 2 lines · Laxman Dewangan
Ok, I was thinking that we should not call
gpiochip_add()from the pin control driver in any new driver
No that is not the case.
There are many combined pinctrl+GPIO drivers that register both pinctrl devices and gpio_chip and also irq_chip.
When the driver and hardware does multiple things like that in the same register range it is usually best to put the combined driver in drivers/pinctrl.
Quoted 2 lines
So this gpio driver can be moved now to the pincntrl folder and can use pincontrol and gpio framework.
Thanks!
Yours,
Linus Walleij
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html
PATCH v2 4/5 regulator: as3722: add regulator driver for AMS AS3722
In reply to Laxman DewanganThe AMS AS3722 is a compact system PMU suitable for mobile phones, tablets etc. It has 4 DCDC step down regulators, 3 DCDC step down controller, 11 LDOs.
Add a driver to support accessing the DCDC/LDOs found on the AMS AS3722 PMIC using regulators.
---
Changes from V1:
- Add code to get regulator node handle.
- Nit cleanups in driver and use module_platform_driver.
- Use linear_range and added regulator_map_* on regulators.
- Move OC configuration to regulator_current limit setting.
.../bindings/regulator/as3722-regulator.txt | 91 ++ drivers/regulator/Kconfig | 8 + drivers/regulator/Makefile | 1 + drivers/regulator/as3722-regulator.c | 917 ++++++++++++++++++++ 4 files changed, 1017 insertions(+), 0 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/as3722-regulator.txt create mode 100644 drivers/regulator/as3722-regulator.c
Documentation/devicetree/bindings/regulator/as3722-regulator.txt new file +91 -0
@@ -0,0 +1,91 @@ +Regulator of AMS AS3722 PMIC. +Name of the regulator subnode must be "regulators". + +Optional properties: +-------------------- +The input supply of regulators are the optional properties on the +regulator node. The AS3722 is having 7 DCDC step-down regulators as +sd[0-6], 10 LDOs as ldo[0-7], ldo[9-11]. The input supply of these +regulators are provided through following properties: +vsup-sd2-supply: Input supply for SD2. +vsup-sd3-supply: Input supply for SD3. +vsup-sd4-supply: Input supply for SD4. +vsup-sd5-supply: Input supply for SD5. +vin-ldo0-supply: Input supply for LDO0. +vin-ldo1-6-supply: Input supply for LDO1 and LDO6. +vin-ldo2-5-7-supply: Input supply for LDO2, LDO5 and LDO7. +vin-ldo3-4-supply: Input supply for LDO3 and LDO4. +vin-ldo9-10-supply: Input supply for LDO9 and LDO10. +vin-ldo11-supply: Input supply for LDO11. + +Optional nodes: +-------------- +- regulators : Must contain a sub-node per regulator from the list below. + Each sub-node should contain the constraints and initialization + information for that regulator. See regulator.txt for a + description of standard properties for these sub-nodes. + Additional custom properties are listed below. + sd[0-6], ldo[0-7], ldo[9-11]. + + Optional sub-node properties: + ---------------------------- + ams,ext-control: External control of the rail. The option of + this properties will tell which external input is + controlling this rail. Valid values are 0, 1, 2 ad 3. + 0: There is no external control of this rail. + 1: Rail is controlled by ENABLE1 input pin. + 2: Rail is controlled by ENABLE2 input pin. + 3: Rail is controlled by ENABLE3 input pin. + ams,enable-tracking: Enable tracking with SD1, only supported + by LDO3. + +Example: +------- + ams3722: ams3722 { + compatible = "ams,as3722"; + reg = <0x40>; + ... + + regulators { + vsup-sd2-supply = <...>; + ... + + sd0 { + regulator-name = "vdd_cpu"; + regulator-min-microvolt = <700000>; + regulator-max-microvolt = <1400000>; + regulator-always-on; + ams,ext-control = <2>; + }; + + sd1 { + regulator-name = "vdd_core"; + regulator-min-microvolt = <700000>; + regulator-max-microvolt = <1400000>; + regulator-always-on; + ams,ext-control = <1>; + }; + + sd2 { + regulator-name = "vddio_ddr"; + regulator-min-microvolt = <1350000>; + regulator-max-microvolt = <1350000>; + regulator-always-on; + }; + + sd4 { + regulator-name = "avdd-hdmi-pex"; + regulator-min-microvolt = <1050000>; + regulator-max-microvolt = <1050000>; + regulator-always-on; + }; + + sd5 { + regulator-name = "vdd-1v8"; + regulator-min-microvolt = <1800000>; + regulator-max-microvolt = <1800000>; + regulator-always-on; + }; + .... + }; + };
drivers/regulator/Kconfig +8 -0
@@ -123,6 +123,14 @@ config REGULATOR_AS3711 This driver provides support for the voltage regulators on the AS3711 PMIC +config REGULATOR_AS3722 + tristate "AMS AS3722 PMIC Regulators" + depends on MFD_AS3722 + help + This driver provides support for the voltage regulators on the + AS3722 PMIC. This will enable support for all the software + controllable DCDC/LDO regulators. + config REGULATOR_DA903X tristate "Dialog Semiconductor DA9030/DA9034 regulators" depends on PMIC_DA903X
drivers/regulator/Makefile +1 -0
@@ -18,6 +18,7 @@ obj-$(CONFIG_REGULATOR_AD5398) += ad5398.o obj-$(CONFIG_REGULATOR_ANATOP) += anatop-regulator.o obj-$(CONFIG_REGULATOR_ARIZONA) += arizona-micsupp.o arizona-ldo1.o obj-$(CONFIG_REGULATOR_AS3711) += as3711-regulator.o +obj-$(CONFIG_REGULATOR_AS3722) += as3722-regulator.o obj-$(CONFIG_REGULATOR_DA903X) += da903x.o obj-$(CONFIG_REGULATOR_DA9052) += da9052-regulator.o obj-$(CONFIG_REGULATOR_DA9055) += da9055-regulator.o
drivers/regulator/as3722-regulator.c new file +917 -0
917 lines not on this page · raw message
Signature · 1 line
1.7.1.1
Re: [PATCH V2 4/5] regulator: as3722: add regulator driver for AMS AS3722
Quoted 3 lines · Laxman Dewangan
The AMS AS3722 is a compact system PMU suitable for mobile phones, tablets etc. It has 4 DCDC step down regulators, 3 DCDC step down controller, 11 LDOs.
Applied, thanks.
PATCH v2 5/5 drivers/rtc/rtc-as3722: add RTC driver
In reply to Laxman DewanganThe AMS AS3722 is a compact system PMU suitable for mobile phones, tablets etc.
Add a driver to support accessing the RTC found on the AMS AS3722 PMIC using RTC framework.
---
Changes from V1:
- Get rid of clk32k out configuration from RTC. Will add clock driver.
drivers/rtc/Kconfig | 10 ++ drivers/rtc/Makefile | 1 + drivers/rtc/rtc-as3722.c | 296 ++++++++++++++++++++++++++++++++++++++++++++++ 3 files changed, 307 insertions(+), 0 deletions(-) create mode 100644 drivers/rtc/rtc-as3722.c
drivers/rtc/Kconfig +10 -0
@@ -153,6 +153,16 @@ config RTC_DRV_88PM80X This driver can also be built as a module. If so, the module will be called rtc-88pm80x. +config RTC_DRV_AS3722 + tristate "AMS AS3722 RTC driver" + depends on MFD_AS3722 + help + If you say yes here you get support for the RTC of AMS AS3722 PMIC + chips. + + This driver can also be built as a module. If so, the module + will be called rtc-as3722. + config RTC_DRV_DS1307 tristate "Dallas/Maxim DS1307/37/38/39/40, ST M41T00, EPSON RX-8025" help
drivers/rtc/Makefile +1 -0
@@ -20,6 +20,7 @@ obj-$(CONFIG_RTC_DRV_88PM860X) += rtc-88pm860x.o obj-$(CONFIG_RTC_DRV_88PM80X) += rtc-88pm80x.o obj-$(CONFIG_RTC_DRV_AB3100) += rtc-ab3100.o obj-$(CONFIG_RTC_DRV_AB8500) += rtc-ab8500.o +obj-$(CONFIG_RTC_DRV_AS3722) += rtc-as3722.o obj-$(CONFIG_RTC_DRV_AT32AP700X)+= rtc-at32ap700x.o obj-$(CONFIG_RTC_DRV_AT91RM9200)+= rtc-at91rm9200.o obj-$(CONFIG_RTC_DRV_AT91SAM9) += rtc-at91sam9.o
drivers/rtc/rtc-as3722.c new file +296 -0
296 lines not on this page · raw message
Signature · 1 line
1.7.1.1