2016-11-04 17:54:31

by Laxman Dewangan

[permalink] [raw]
Subject: [PATCH 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition

Some PWM regulator has the exponential transition in voltage change as
opposite to fixed slew-rate linear transition on other regulators.
For such PWM regulators, add the property for providing the delay
from DT node.

Add DT binding details of the new property
"pwm-regulator-voltage-ramp-time-us" added for providing voltage
transition delay.

Signed-off-by: Laxman Dewangan <[email protected]>
CC: Douglas Anderson <[email protected]>
CC: Aleksandr Frid <[email protected]>

---
This patch is continuation of discussion on patch
regulator: pwm: Fix regulator ramp delay for continuous mode
https://patchwork.kernel.org/patch/9216857/
where is it discussed to have separate property for PWM which has
exponential voltage transition.
---
Documentation/devicetree/bindings/regulator/pwm-regulator.txt | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
index 3aeba9f..a163f42 100644
--- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
+++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
@@ -54,6 +54,16 @@ Optional properties:
--------------------
- enable-gpios: GPIO to use to enable/disable the regulator

+- pwm-regulator-voltage-ramp-time-us: Integer, voltage ramp time in
+ microseconds. Some PWM regulator has the exponential
+ transition in voltage change as opposite to fixed
+ slew-rate linear transition on other regulators.
+ For such regulator, this property is used to provide
+ the settling time for voltage change which is same
+ for any voltage change.
+ If PWM regulator supports the fixed slew rate then
+ property "regulator-ramp-delay" should be used.
+
Any property defined as part of the core regulator binding can also be used.
(See: ../regulator/regulator.txt)

--
2.1.4


2016-11-04 17:54:04

by Laxman Dewangan

[permalink] [raw]
Subject: [PATCH 2/2] regulator: pwm: Add ramp delay for exponential voltage transition

Some PWM regulator has the exponential transition in voltage change as
opposite to fixed slew-rate linear transition on other regulators.
For such PWM regulators, voltage transition is same for all voltage
change.

Add support for handling the voltage transition ramp time when voltage
transition is exponential.

Signed-off-by: Laxman Dewangan <[email protected]>
CC: Douglas Anderson <[email protected]>
CC: Aleksandr Frid <[email protected]>

---
This patch is continuation of discussion on patch
regulator: pwm: Fix regulator ramp delay for continuous mode
https://patchwork.kernel.org/patch/9216857/
where is it discussed to have separate property for PWM which has
exponential voltage transition.
---
drivers/regulator/pwm-regulator.c | 18 ++++++++++++++++++
1 file changed, 18 insertions(+)

diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c
index 1b88e0e1..f990b86 100644
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -47,6 +47,9 @@ struct pwm_regulator_data {

/* Enable GPIO */
struct gpio_desc *enb_gpio;
+
+ /* Voltage ramp time */
+ u32 voltage_ramp_time;
};

struct pwm_voltages {
@@ -233,6 +236,14 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev,
return 0;
}

+static int pwm_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
+ int old_uV, int new_uV)
+{
+ struct pwm_regulator_data *drvdata = rdev_get_drvdata(rdev);
+
+ return drvdata->voltage_ramp_time;
+}
+
static struct regulator_ops pwm_regulator_voltage_table_ops = {
.set_voltage_sel = pwm_regulator_set_voltage_sel,
.get_voltage_sel = pwm_regulator_get_voltage_sel,
@@ -305,6 +316,13 @@ static int pwm_regulator_init_continuous(struct platform_device *pdev,

memcpy(&drvdata->ops, &pwm_regulator_voltage_continuous_ops,
sizeof(drvdata->ops));
+
+ if (!of_property_read_u32(pdev->dev.of_node,
+ "pwm-regulator-voltage-ramp-time-us",
+ &drvdata->voltage_ramp_time))
+ drvdata->ops.set_voltage_time =
+ pwm_regulator_set_voltage_time_sel;
+
drvdata->desc.ops = &drvdata->ops;
drvdata->desc.continuous_voltage_range = true;

--
2.1.4

2016-11-14 15:48:14

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition

On Fri, Nov 04, 2016 at 11:07:54PM +0530, Laxman Dewangan wrote:
> Some PWM regulator has the exponential transition in voltage change as
> opposite to fixed slew-rate linear transition on other regulators.
> For such PWM regulators, add the property for providing the delay
> from DT node.
>
> Add DT binding details of the new property
> "pwm-regulator-voltage-ramp-time-us" added for providing voltage
> transition delay.
>
> Signed-off-by: Laxman Dewangan <[email protected]>
> CC: Douglas Anderson <[email protected]>
> CC: Aleksandr Frid <[email protected]>
>
> ---
> This patch is continuation of discussion on patch
> regulator: pwm: Fix regulator ramp delay for continuous mode
> https://patchwork.kernel.org/patch/9216857/
> where is it discussed to have separate property for PWM which has
> exponential voltage transition.
> ---
> Documentation/devicetree/bindings/regulator/pwm-regulator.txt | 10 ++++++++++
> 1 file changed, 10 insertions(+)
>
> diff --git a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
> index 3aeba9f..a163f42 100644
> --- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
> +++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
> @@ -54,6 +54,16 @@ Optional properties:
> --------------------
> - enable-gpios: GPIO to use to enable/disable the regulator
>
> +- pwm-regulator-voltage-ramp-time-us: Integer, voltage ramp time in

This is a really long name. Drop the 'pwm-regulator-' part as it is
redundant. The fact that it is PWM reg specific is captured as it is
documented that way.

Rob

2016-11-15 11:59:19

by Laxman Dewangan

[permalink] [raw]
Subject: Re: [PATCH 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition


On Monday 14 November 2016 09:18 PM, Rob Herring wrote:
> On Fri, Nov 04, 2016 at 11:07:54PM +0530, Laxman Dewangan wrote:
>> Some PWM regulator has the exponential transition in voltage change as
>> opposite to fixed slew-rate linear transition on other regulators.
>> For such PWM regulators, add the property for providing the delay
>> from DT node.
>>
>> Add DT binding details of the new property
>> "pwm-regulator-voltage-ramp-time-us" added for providing voltage
>> transition delay.
>>
>> Signed-off-by: Laxman Dewangan <[email protected]>
>> CC: Douglas Anderson <[email protected]>
>> CC: Aleksandr Frid <[email protected]>
>>
>> ---
>> This patch is continuation of discussion on patch
>> regulator: pwm: Fix regulator ramp delay for continuous mode
>> https://patchwork.kernel.org/patch/9216857/
>> where is it discussed to have separate property for PWM which has
>> exponential voltage transition.
>> ---
>> Documentation/devicetree/bindings/regulator/pwm-regulator.txt | 10 ++++++++++
>> 1 file changed, 10 insertions(+)
>>
>> diff --git a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
>> index 3aeba9f..a163f42 100644
>> --- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
>> +++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
>> @@ -54,6 +54,16 @@ Optional properties:
>> --------------------
>> - enable-gpios: GPIO to use to enable/disable the regulator
>>
>> +- pwm-regulator-voltage-ramp-time-us: Integer, voltage ramp time in
> This is a really long name. Drop the 'pwm-regulator-' part as it is
> redundant. The fact that it is PWM reg specific is captured as it is
> documented that way.
>

We already have the regulator-ramp-delay from the regulator core.
Just wanted to make this (pwm-regulator-voltage-ramp-time-us) for pwm
specific.

Can we have "pwm-regulator-ramp-delay" or "pwm-regulator-settling-time-us"?


2016-11-15 14:28:26

by Rob Herring

[permalink] [raw]
Subject: Re: [PATCH 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition

On Tue, Nov 15, 2016 at 5:42 AM, Laxman Dewangan <[email protected]> wrote:
>
> On Monday 14 November 2016 09:18 PM, Rob Herring wrote:
>>
>> On Fri, Nov 04, 2016 at 11:07:54PM +0530, Laxman Dewangan wrote:
>>>
>>> Some PWM regulator has the exponential transition in voltage change as
>>> opposite to fixed slew-rate linear transition on other regulators.
>>> For such PWM regulators, add the property for providing the delay
>>> from DT node.
>>>
>>> Add DT binding details of the new property
>>> "pwm-regulator-voltage-ramp-time-us" added for providing voltage
>>> transition delay.
>>>
>>> Signed-off-by: Laxman Dewangan <[email protected]>
>>> CC: Douglas Anderson <[email protected]>
>>> CC: Aleksandr Frid <[email protected]>
>>>
>>> ---
>>> This patch is continuation of discussion on patch
>>> regulator: pwm: Fix regulator ramp delay for continuous mode
>>> https://patchwork.kernel.org/patch/9216857/
>>> where is it discussed to have separate property for PWM which has
>>> exponential voltage transition.
>>> ---
>>> Documentation/devicetree/bindings/regulator/pwm-regulator.txt | 10
>>> ++++++++++
>>> 1 file changed, 10 insertions(+)
>>>
>>> diff --git
>>> a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
>>> b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
>>> index 3aeba9f..a163f42 100644
>>> --- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
>>> +++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt
>>> @@ -54,6 +54,16 @@ Optional properties:
>>> --------------------
>>> - enable-gpios: GPIO to use to enable/disable the
>>> regulator
>>> +- pwm-regulator-voltage-ramp-time-us: Integer, voltage ramp time in
>>
>> This is a really long name. Drop the 'pwm-regulator-' part as it is
>> redundant. The fact that it is PWM reg specific is captured as it is
>> documented that way.
>>
>
> We already have the regulator-ramp-delay from the regulator core.
> Just wanted to make this (pwm-regulator-voltage-ramp-time-us) for pwm
> specific.

Neither of these are very clear that one is linear and one is
exponential. Maybe you should use the existing property to express the
time and just add a boolean property like "voltage-ramp-exponential"?

> Can we have "pwm-regulator-ramp-delay" or "pwm-regulator-settling-time-us"?

How are those better? Same comment applies.

Rob

2016-11-15 17:32:16

by Laxman Dewangan

[permalink] [raw]
Subject: Re: [PATCH 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition


On Tuesday 15 November 2016 07:57 PM, Rob Herring wrote:
> On Tue, Nov 15, 2016 at 5:42 AM, Laxman Dewangan <[email protected]> wrote:
>> On Monday 14 November 2016 09:18 PM, Rob Herring wrote:
>>> On Fri, Nov 04, 2016 at 11:07:54PM +0530, Laxman Dewangan wrote:
>>>>
>>>> regulator
>>>> +- pwm-regulator-voltage-ramp-time-us: Integer, voltage ramp time in
>>> This is a really long name. Drop the 'pwm-regulator-' part as it is
>>> redundant. The fact that it is PWM reg specific is captured as it is
>>> documented that way.
>>>
>> We already have the regulator-ramp-delay from the regulator core.
>> Just wanted to make this (pwm-regulator-voltage-ramp-time-us) for pwm
>> specific.
> Neither of these are very clear that one is linear and one is
> exponential. Maybe you should use the existing property to express the
> time and just add a boolean property like "voltage-ramp-exponential"?

OK, this can work.