regulator: tps62360: support dts and enable for tegra-cardhu
Subsystems (4)
v3 cover regulator: tps62360: support dts and enable for tegra-cardhu
Add support for dt on regulator device tps62360. Also enable this regulator for Nvidia's Tegra platform - cardhu.
This series:
- Make the regulator_init_data as pointer type from platform data.
- enable config variable in tegra defconfig
- add entry for tps62360 in dts file of tegra-cardhu.
Changes from V1:
Patch 1 did not compile when not defining CONFIG_OF. Fixed it.
Changes from V2:
Taken care of Grant's review comments.
Laxman Dewangan (4):
regulator: tps62360: make init_data of platform data to pointer.
Make the regulator init data as pointer type in platform.
regulator: tps62360: add dt support
Ad dt support.
ARM: tegra: config: enable REGULATOR_TPS62360
ARM: dt: tegra: cardhu: register core regulator tps62360
.../bindings/regulator/tps62360-regulator.txt | 45 ++++++++++++ arch/arm/boot/dts/tegra-cardhu.dts | 14 ++++ arch/arm/configs/tegra_defconfig | 1 + drivers/regulator/tps62360-regulator.c | 74 +++++++++++++++++++- include/linux/regulator/tps62360.h | 4 +- 5 files changed, 133 insertions(+), 5 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/tps62360-regulator.txt
PATCH v3 1/4 regulator: tps62360: make init_data of platform data to pointer.
Convert platform data member regulator_init_data to pointer type. This will avoid the copy of entire regualator init data into platform data member when adding dt support and it can be achieve by simple assignment:pdata->init_data = of_get_regulator_init_data(dev, dev->of_node);
---
No Changes from V1 and V2.
drivers/regulator/tps62360-regulator.c | 2 +- include/linux/regulator/tps62360.h | 4 +--- 2 files changed, 2 insertions(+), 4 deletions(-)
drivers/regulator/tps62360-regulator.c +1 -1
@@ -408,7 +408,7 @@ static int __devinit tps62360_probe(struct i2c_client *client, } config.dev = &client->dev; - config.init_data = &pdata->reg_init_data; + config.init_data = pdata->reg_init_data; config.driver_data = tps;/* Register the regulators */
include/linux/regulator/tps62360.h +1 -3
@@ -26,8 +26,6 @@#ifndef __LINUX_REGULATOR_TPS62360_H#define __LINUX_REGULATOR_TPS62360_H -#include <linux/regulator/machine.h> -/* * struct tps62360_regulator_platform_data - tps62360 regulator platform data. *
@@ -44,7 +42,7 @@* @vsel1_def_state: Default state of vsel1. 1 if it is high else 0. */ struct tps62360_regulator_platform_data { -struct regulator_init_data reg_init_data; +struct regulator_init_data *reg_init_data;bool en_force_pwm;bool en_discharge;bool en_internal_pulldn;
Signature · 1 line
1.7.1.1
PATCH v3 2/4 regulator: tps62360: add dt support
In reply to Laxman DewanganAdd dt support for the pmu device tps62360 and Add binding documentation with example.
With this patch driver will support both device-tree and non-device tree registration.
---
Changes from V1:
Fixed compilation error in non-devicetree configuration.
Changes from V2:
Taken care of Grant's review comments.
.../bindings/regulator/tps62360-regulator.txt | 45 ++++++++++++ drivers/regulator/tps62360-regulator.c | 73 +++++++++++++++++++- 2 files changed, 117 insertions(+), 1 deletions(-) create mode 100644 Documentation/devicetree/bindings/regulator/tps62360-regulator.txt
Documentation/devicetree/bindings/regulator/tps62360-regulator.txt new file +45 -0
@@ -0,0 +1,45 @@ +TPS62360 Voltage regulators + +Required properties: +- compatible: Must be one of the following. + "ti,tps62360" + "ti,tps62361", + "ti,tps62362", + "ti,tps62363", +- reg: I2C slave address + +Optional properties: +- ti,enable-force-pwm: Enable force PWM mode. This is boolean value. +- ti,enable-vout-discharge: Enable output discharge. This is boolean value. +- ti,enable-pull-down: Enable pull down. This is boolean value. +- ti,vsel0-gpio: GPIO for controlling VSEL0 line. + If this property is missing, then assume that there is no GPIO + for vsel0 control. +- ti,vsel1-gpio: Gpio for controlling VSEL1 line. + If this property is missing, then assume that there is no GPIO + for vsel1 control. +- ti,vsel0-state-high: Inital state of vsel0 input is high. + If this property is missing, then assume the state as low (0). +- ti,vsel1-state-high: Inital state of vsel1 input is high. + If this property is missing, then assume the state as low (0). + +Any property defined as part of the core regulator binding, defined in +regulator.txt, can also be used. + +Example: + + abc: tps62360 { + compatible = "ti,tps62361"; + reg = <0x60>; + regulator-name = "tps62361-vout"; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1500000>; + regulator-boot-on + ti,vsel0-gpio = <&gpio1 16 0>; + ti,vsel1-gpio = <&gpio1 17 0>; + ti,vsel0-state-high; + ti,vsel1-state-high; + ti,enable-pull-down; + ti,enable-force-pwm; + ti,enable-vout-discharge; + };
drivers/regulator/tps62360-regulator.c +72 -1
105 lines not on this page · raw message
Signature · 1 line
1.7.1.1
PATCH v3 3/4 ARM: tegra: config: enable REGULATOR_TPS62360
In reply to Laxman DewanganEnable regulator REGULATOR_TPS62360 for the core power of cardhu.
---
No changes from V1 and V2.
arch/arm/configs/tegra_defconfig | 1 + 1 files changed, 1 insertions(+), 0 deletions(-)
arch/arm/configs/tegra_defconfig +1 -0
@@ -114,6 +114,7 @@ CONFIG_REGULATOR=y CONFIG_REGULATOR_FIXED_VOLTAGE=y CONFIG_REGULATOR_VIRTUAL_CONSUMER=y CONFIG_REGULATOR_GPIO=y +CONFIG_REGULATOR_TPS62360=y CONFIG_REGULATOR_TPS6586X=y CONFIG_SOUND=y CONFIG_SND=y
Signature · 1 line
1.7.1.1
PATCH v3 4/4 ARM: dt: tegra: cardhu: register core regulator tps62360
In reply to Laxman DewanganAdd device info for the core regulator tps62360 in tegra-cardhu dts file.
---
No changes from V1 and V2.
arch/arm/boot/dts/tegra-cardhu.dts | 14 ++++++++++++++ 1 files changed, 14 insertions(+), 0 deletions(-)
arch/arm/boot/dts/tegra-cardhu.dts +14 -0
@@ -123,6 +123,20 @@ micdet-delay = <100>; gpio-cfg = <0xffffffff 0xffffffff 0 0xffffffff 0xffffffff>; }; + + tps62360 { + compatible = "ti,tps62361"; + reg = <0x60>; + + regulator-name = "tps62361-vout"; + regulator-min-microvolt = <500000>; + regulator-max-microvolt = <1500000>; + regulator-boot-on; + regulator-always-on; + ti,vsel0-state-high; + ti,vsel1-state-high; + }; + }; sdhci@78000000 {
Signature · 1 line
1.7.1.1
Re: [PATCH V3 2/4] regulator: tps62360: add dt support
In reply to Laxman DewanganOn Fri, May 11, 2012 at 12:08:43PM +0530, Laxman Dewangan wrote:
This looks good overall but I do have a few things with the binding.
Quoted 2 lines
+Optional properties:
+- ti,enable-force-pwm: Enable force PWM mode. This is boolean value.
Hrm, this is fairly generic - it's REGULATOR_MODE_ACTIVE. But I'm a bit unsure about how generic exposing it is in bindings since it's often dynamic in the running system, we've really not got any mainline examples of something setting a mode. With modern regulators the mode detection stuff in the hardware is generally good enough that there's no benefit from doing this, it's suprising to actually see systems that benefit.
Quoted 1 line
+- ti,enable-vout-discharge: Enable output discharge. This is boolean value.
This I think we should definitely add a framework feature for this and make into a generic property, it's a very standard feature and more normally set unconditionally.
Mark Brown
AppliedRe: [PATCH V3 1/4] regulator: tps62360: make init_data of platform data to pointer.
In reply to Laxman DewanganQuoted 5 lines · Laxman Dewangan
Convert platform data member
regulator_init_datato pointer type. This will avoid the copy of entire regualator init data into platform data member when adding dt support and it can be achieve by simple assignment:pdata->init_data=of_get_regulator_init_data(dev, dev->of_node);
Applied, thanks.
Re: [PATCH V3 2/4] regulator: tps62360: add dt support
In reply to Mark BrownQuoted 8 lines · Mark Brown
* PGP Signed by an unknown key
On Fri, May 11, 2012 at 12:08:43PM +0530, Laxman Dewangan wrote:
This looks good overall but I do have a few things with the binding.
Quoted 2 lines
+Optional properties:
+- ti,enable-force-pwm: Enable force PWM mode. This is boolean value.
Quoted 8 lines
Hrm, this is fairly generic - it's
REGULATOR_MODE_ACTIVE. But I'm a bit unsure about how generic exposing it is in bindings since it's often dynamic in the running system, we've really not got any mainline examples of something setting a mode. With modern regulators the mode detection stuff in the hardware is generally good enough that there's no benefit from doing this, it's suprising to actually see systems that benefit.
Yaah, I think this flag can map directly to REGULATOR_MODE_FAST. If I understand PWM mode properly then this is used when high current load is require or fast switching on load current is require. By enabling force PWM enable, hw will not switch to PFM mode based on load current.
I think if we map the regulator mode to FAST as the force PWM enable and NORMAL as force PWM =0 then it will be generic.
Client can pass the initial mode when they fill constraint at the time of registration and it can also give the opportunity to change mode by calling regulator_set_mode(). If this is fine then I can create patch for removing this flag from platform data and add set_mode/get_mode function.
Quoted 5 lines
Quoted 1 line
+- ti,enable-vout-discharge: Enable output discharge. This is boolean value.
This I think we should definitely add a framework feature for this and make into a generic property, it's a very standard feature and more normally set unconditionally.
I think this is not require to enable always otherwise there may be power dissipation from this path always, just when we off the rail (disable rail or when go to shutdown so that the voltage output can go down faster). Should we add "unsigned en_discharge:1" in regulator init data but did not get how core driver can use this flag specially when shutdown?
Re: [PATCH V3 2/4] regulator: tps62360: add dt support
In reply to Laxman DewanganQuoted 4 lines · Laxman Dewangan
Add dt support for the pmu device tps62360 and Add binding documentation with example.
With this patch driver will support both device-tree and non-device tree registration.
Oh, sorry - I meant to say that I went ahead and applied this. Ideally the active discharge thing will get factored out quickly though.
Re: [PATCH V3 2/4] regulator: tps62360: add dt support
In reply to Laxman DewanganQuoted 8 lines · Laxman Dewangan
Yaah, I think this flag can map directly to
REGULATOR_MODE_FAST. If I understand PWM mode properly then this is used when high current load is require or fast switching on load current is require. By enabling force PWM enable, hw will not switch to PFM mode based on load current.I think if we map the regulator mode to FAST as the force PWM enable and NORMAL as force PWM =0 then it will be generic.
Yes, this is pretty much exactly what _FAST means. With modern hardware the forced PWM mode just isn't needed, a modern regulator is able to respond sufficiently quickly to changes in the output load. Mode switching from software was generally found to be impractical for DCDC convertors as the load requirements change so quickly and without software control that by the time you respond from software you can't switch out of a lower power mode into a higher current one it's too late.
Quoted 5 lines
Quoted 4 lines
Quoted 1 line
+- ti,enable-vout-discharge: Enable output discharge. This is boolean value.
This I think we should definitely add a framework feature for this and make into a generic property, it's a very standard feature and more normally set unconditionally.
Quoted 7 lines
I think this is not require to enable always otherwise there may be power dissipation from this path always, just when we off the rail (disable rail or when go to shutdown so that the voltage output can go down faster).
Should we add "unsigned en_discharge:1" in regulator init data but did not get how core driver can use this flag specially when shutdown?
Oh, now you say this I think I remember discussing this with you before! This is pretty unusual for such hardware. Normally there's something in the digital block so that the discharge is only enabled if the regulator is disabled, if it's enabled then the discharge would automatically be taken off since actively discharging while enabled doesn't make sense and may in fact be actively harmful.
If the hardware doesn't do that then I'd expect the driver to take care of this if it implements the framework feature (once the framework feature is added).
Re: [PATCH V3 2/4] regulator: tps62360: add dt support
Quoted 11 lines · Mark Brown
* PGP Signed by an unknown key
Quoted 7 lines · Laxman Dewangan
I think this is not require to enable always otherwise there may be power dissipation from this path always, just when we off the rail (disable rail or when go to shutdown so that the voltage output can go down faster).
Should we add "unsigned en_discharge:1" in regulator init data but did not get how core driver can use this flag specially when shutdown?
Quoted 7 lines
Oh, now you say this I think I remember discussing this with you before! This is pretty unusual for such hardware. Normally there's something in the digital block so that the discharge is only enabled if the regulator is disabled, if it's enabled then the discharge would automatically be taken off since actively discharging while enabled doesn't make sense and may in fact be actively harmful.
Just to share here with our new pmu which we got recently, the discharge path behavior is exactly same as what Mark mentioned
It need to be enable always. The pmu auto disable the DISC path in normal operation so there is no power dissipation but when it detects the en_bit is written 0 or any external control is making the rail to be off, it automatically turn on the path so that ramp-down can happen faster. Just we need to enable this always.
Quoted 3 lines
If the hardware doesn't do that then I'd expect the driver to take care of this if it implements the framework feature (once the framework feature is added).