regulator: palmas: configure enable time for LDOs
PATCH 1/2 regulator: palmas: configure enable time for LDOs
As per datasheet (Referred TPS65913), the on-time for LDO is 500micro second. If LDO6 is in vibrator mode then the on-time is 2000us.
Set the enable_time on regulator descriptor accordingly.
--- drivers/regulator/palmas-regulator.c | 6 ++++++ 1 files changed, 6 insertions(+), 0 deletions(-)
drivers/regulator/palmas-regulator.c +6 -0
@@ -979,6 +979,7 @@ static int palmas_regulators_probe(struct platform_device *pdev) pmic->desc[id].min_uV =900000 ; pmic->desc[id].uV_step =50000 ; pmic->desc[id].linear_min_sel =1 ; + pmic->desc[id].enable_time =500 ; pmic->desc[id].vsel_reg =PALMAS_BASE_TO_REG (PALMAS_LDO_BASE , palmas_regs_info[id].vsel_addr);
@@ -997,6 +998,11 @@ static int palmas_regulators_probe(struct platform_device *pdev) pmic->desc[id].min_uV =450000 ; pmic->desc[id].uV_step =25000 ; } + +/* LOD6 in vibrator mode will have enable time 2000us */ +if (pdata && pdata->ldo6_vibrator && + (id ==PALMAS_REG_LDO6 )) + pmic->desc[id].enable_time =2000 ; }else { pmic->desc[id].n_voltages =1 ; pmic->desc[id].ops = &palmas_ops_extreg;
Signature · 1 line
1.7.1.1
PATCH 2/2 regulator: core: add support for configuring turn-on time through constraints
The Turn-ON time of the regulator depends on the regulator device's electrical characteristics. Sometimes regulator turn-on time also depends on the capacitive load on the given platform and it can be more than the datasheet value.
The driver provides the enable-time as per datasheet.
Add support for configure the enable time through regulator constraints so that regulator core can take this value for enable time for that regulator.
--- .../devicetree/bindings/regulator/regulator.txt | 1 + drivers/regulator/core.c | 2 ++ drivers/regulator/of_regulator.c | 6 ++++++ include/linux/regulator/machine.h | 2 ++ 4 files changed, 11 insertions(+), 0 deletions(-)
Documentation/devicetree/bindings/regulator/regulator.txt +1 -0
@@ -14,6 +14,7 @@ Optional properties: - regulator-ramp-delay: ramp delay for regulator(in uV/uS) For hardwares which support disabling ramp rate, it should be explicitly intialised to zero (regulator-ramp-delay = <0>) for disabling ramp delay. +- regulator-enable-time: Turn ON time for regulator(in uS) Deprecated properties: - regulator-compatible: If a regulator chip contains multiple
drivers/regulator/core.c +2 -0
@@ -1186,6 +1186,8 @@ overflow_err:static int _regulator_get_enable_time (struct regulator_dev *rdev) { +if (rdev->constraints->enable_time) +return rdev->constraints->enable_time;if (!rdev->desc->ops->enable_time)return rdev->desc->enable_time;return rdev->desc->ops->enable_time (rdev);
drivers/regulator/of_regulator.c +6 -0
@@ -23,6 +23,8 @@ static void of_get_regulation_constraints(struct device_node *np,const __be32 *min_uA, *max_uA, *ramp_delay;struct property *prop;struct regulation_constraints *constraints = &(*init_data)->constraints; +int ret; +u32 pval; constraints->name =of_get_property (np,"regulator-name" ,NULL );
@@ -73,6 +75,10 @@ static void of_get_regulation_constraints(struct device_node *np,else constraints->ramp_disable = true; } + + ret =of_property_read_u32 (np,"regulator-enable-time" , &pval); +if (!ret) + constraints->enable_time = pval; }/**
include/linux/regulator/machine.h +2 -0
@@ -95,6 +95,7 @@ struct regulator_state {* @initial_state: Suspend state to set by default. * @initial_mode: Mode to set at startup. * @ramp_delay: Time to settle down after voltage change (unit: uV/us) +* @enable_time: Turn ON time of the rails (unit: us) */ struct regulation_constraints {
@@ -129,6 +130,7 @@ struct regulation_constraints {unsigned int initial_mode;unsigned int ramp_delay; +unsigned int enable_time;/* constraint flags */ unsigned always_on:1; /* regulator never off when system is on */
Signature · 1 line
1.7.1.1
Mark Brown
maintainerRe: [PATCH 2/2] regulator: core: add support for configuring turn-on time through constraints
Quoted 1 line · Laxman Dewangan
+- regulator-enable-time: Turn ON time for regulator(in uS)
This is unclear - what is a "turn on time" and is this in addition to or separate from the underlying enable time of the device? It needs to be clear that this is the time taken for the voltage to ramp to spec. I'd also expect it to be clear that this is not something that should need to be provided normally.
Please ALSO avoid capitalising words FOR no reason.
Re: [PATCH 2/2] regulator: core: add support for configuring turn-on time through constraints
Quoted 10 lines · Mark Brown
* PGP Signed by an unknown key
Quoted 1 line · Laxman Dewangan
+- regulator-enable-time: Turn ON time for regulator(in uS)
This is unclear - what is a "turn on time" and is this in addition to or separate from the underlying enable time of the device? It needs to be clear that this is the time taken for the voltage to ramp to spec. I'd also expect it to be clear that this is not something that should need to be provided normally.
Here my intention for turn-on time is the time from OFF state to ON state and the ON voltage settled on this time.
This time is separate from underlying enable time of the device i.e. will not get added.
We observe in some of platform that some of regulator is taking more time than time given as per datasheet.
Yes, completely agree that this is not the data provided normally, just we observe on scope that some of platform shows more than the datasheet value and hence this patch.
The same rail on other design does not show the enable time more than datasheet and on that case, we will not provide this value.
Quoted 3 lines
Please ALSO avoid capitalising words FOR no reason.
My bad, will take care.
Mark Brown
maintainerRe: [PATCH 2/2] regulator: core: add support for configuring turn-on time through constraints
Quoted 9 lines · Laxman Dewangan
Here my intention for turn-on time is the time from OFF state to ON state and the ON voltage settled on this time.
This time is separate from underlying enable time of the device i.e. will not get added.
We observe in some of platform that some of regulator is taking more time than time given as per datasheet.
Yes, completely agree that this is not the data provided normally, just we observe on scope that some of platform shows more than the datasheet value and hence this patch.
So, put this in the binding document then! :P This was more a request to improve the detail in the binding than anything else.
Re: [PATCH 2/2] regulator: core: add support for configuring turn-on time through constraints
In reply to Laxman DewanganQuoted 12 lines · Laxman Dewangan
The Turn-ON time of the regulator depends on the regulator device's electrical characteristics. Sometimes regulator turn-on time also depends on the capacitive load on the given platform and it can be more than the datasheet value.
The driver provides the enable-time as per datasheet.
Add support for configure the enable time through regulator constraints so that regulator core can take this value for enable time for that regulator.
Documentation/devicetree/bindings/regulator/regulator.txt
Quoted 2 lines
Documentation/devicetree/bindings/regulator/regulator.txt +1
-0+- regulator-enable-time: Turn ON time for regulator(in uS)
Bike-shedding slightly: This isn't really the time it takes to enable a regulator, but the time the voltage takes to become stable, or settle. Perhaps name the property regulator-settle-time/regulator-settle-delay?
Mark Brown
maintainerRe: [PATCH 2/2] regulator: core: add support for configuring turn-on time through constraints
Quoted 5 lines · Stephen Warren
Quoted 1 line
+- regulator-enable-time: Turn ON time for regulator(in uS)
Bike-shedding slightly: This isn't really the time it takes to enable a regulator, but the time the voltage takes to become stable, or settle. Perhaps name the property regulator-settle-time/regulator-settle-delay?
The normal term would be ramp delay. It's not usually the time taken to completely settle, it's usually quoted as the time taken to reach within some proportion of the target voltage.
Re: [PATCH 2/2] regulator: core: add support for configuring turn-on time through constraints
Quoted 4 lines · Mark Brown
Quoted 1 line · Stephen Warren
Quoted 1 line
+- regulator-enable-time: Turn ON time for regulator(in uS)
Quoted 8 lines
Quoted 4 lines
Bike-shedding slightly: This isn't really the time it takes to enable a regulator, but the time the voltage takes to become stable, or settle. Perhaps name the property regulator-settle-time/regulator-settle-delay?
The normal term would be ramp delay. It's not usually the time taken to completely settle, it's usually quoted as the time taken to reach within some proportion of the target voltage.
I notice there's a regulator-ramp-delay property, already documented right above this new property. Is this a conflicting usage of the same term, or should that existing property just be used in this case too?
Mark Brown
maintainerRe: [PATCH 2/2] regulator: core: add support for configuring turn-on time through constraints
Quoted 3 lines · Stephen Warren
I notice there's a regulator-ramp-delay property, already documented right above this new property. Is this a conflicting usage of the same term, or should that existing property just be used in this case too?
That's for a ramp between two voltages rather than the on/off voltage, though I had forgotten about it. Hrm. enable-ramp-delay?
Re: [PATCH 2/2] regulator: core: add support for configuring turn-on time through constraints
Quoted 8 lines · Mark Brown
Quoted 3 lines · Stephen Warren
I notice there's a regulator-ramp-delay property, already documented right above this new property. Is this a conflicting usage of the same term, or should that existing property just be used in this case too?
That's for a ramp between two voltages rather than the on/off voltage, though I had forgotten about it. Hrm. enable-ramp-delay?
Sounds reasonable. It's a little long but regulator-enable-ramp-delay might be better since all the common regulator properties to date are named regulator-xxx.
Mark Brown
maintainerRe: [PATCH 2/2] regulator: core: add support for configuring turn-on time through constraints
Quoted 3 lines · Stephen Warren
Sounds reasonable. It's a little long but regulator-enable-ramp-delay might be better since all the common regulator properties to date are named regulator-xxx.
Yes, I just didn't bother typing the whole thing out.
Quoted 3 lines · Laxman Dewangan
As per datasheet (Referred TPS65913), the on-time for LDO is 500micro second. If LDO6 is in vibrator mode then the on-time is 2000us.
Applied, thanks.