* [PATCH V2 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition @ 2016-11-18 14:35 Laxman Dewangan 2016-11-18 14:35 ` [PATCH V2 2/2] regulator: pwm: " Laxman Dewangan 2016-11-21 16:17 ` [PATCH V2 1/2] regulator: pwm: DT: " Rob Herring 0 siblings, 2 replies; 5+ messages in thread From: Laxman Dewangan @ 2016-11-18 14:35 UTC (permalink / raw) To: broonie, robh+dt Cc: mark.rutland, linux-kernel, devicetree, Laxman Dewangan, Douglas Anderson, Aleksandr Frid 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 to tell that voltage change is exponential and having fixed delay for any level of change. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> CC: Douglas Anderson <dianders@chromium.org> CC: Aleksandr Frid <afrid@nvidia.com> --- 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. Changes from V1: - Pass the flag to tell that voltage ramp is exponential instead of providing delay. --- .../devicetree/bindings/regulator/pwm-regulator.txt | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt index 3aeba9f..2d9ef3a 100644 --- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt +++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt @@ -54,6 +54,18 @@ Optional properties: -------------------- - enable-gpios: GPIO to use to enable/disable the regulator +- voltage-ramp-exponential: Boolean, Some of PWM regulator has the exponential + transition in voltage ramp as opposite to fixed + slew-rate linear transition on other regulators. + For such PWM regulator, presence of this property will + tell that value of the regulator ramp delay provided by + DT property "regulator-ramp-delay" is exponential and + fixed delay for any voltage level change. + If PWM regulator supports the fixed linear slew rate + then this property should be absent from DT node and + property "regulator-ramp-delay" is used as linear slew + rate. + Any property defined as part of the core regulator binding can also be used. (See: ../regulator/regulator.txt) -- 2.1.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* [PATCH V2 2/2] regulator: pwm: Add ramp delay for exponential voltage transition 2016-11-18 14:35 [PATCH V2 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition Laxman Dewangan @ 2016-11-18 14:35 ` Laxman Dewangan 2016-11-21 16:17 ` [PATCH V2 1/2] regulator: pwm: DT: " Rob Herring 1 sibling, 0 replies; 5+ messages in thread From: Laxman Dewangan @ 2016-11-18 14:35 UTC (permalink / raw) To: broonie, robh+dt Cc: mark.rutland, linux-kernel, devicetree, Laxman Dewangan, Douglas Anderson, Aleksandr Frid 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 support for handling the exponential voltage ramp delay. Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> CC: Douglas Anderson <dianders@chromium.org> CC: Aleksandr Frid <afrid@nvidia.com> --- 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. Changes from V1: - Use new DT property to finding that voltage ramp is exponential or not and use flag for having fixed delay for all voltage change. --- drivers/regulator/pwm-regulator.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/regulator/pwm-regulator.c b/drivers/regulator/pwm-regulator.c index 1b88e0e1..bcffeee 100644 --- a/drivers/regulator/pwm-regulator.c +++ b/drivers/regulator/pwm-regulator.c @@ -233,6 +233,24 @@ static int pwm_regulator_set_voltage(struct regulator_dev *rdev, return 0; } +/** + * Some of PWM regulators have exponential voltage ramp. On such PWM + * regulators, voltage settling time is same regardless of voltage + * level change. + */ +static int pwm_regulator_set_voltage_time(struct regulator_dev *rdev, + int old_uV, int new_uV) +{ + return rdev->constraints->ramp_delay; +} + +static int pwm_regulator_set_voltage_time_sel(struct regulator_dev *rdev, + unsigned int old_selector, + unsigned int new_selector) +{ + return rdev->constraints->ramp_delay; +} + 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, @@ -294,17 +312,25 @@ static int pwm_regulator_init_table(struct platform_device *pdev, drvdata->desc.ops = &drvdata->ops; drvdata->desc.n_voltages = length / sizeof(*duty_cycle_table); + if (of_property_read_bool(np, "voltage-ramp-exponential")) + drvdata->ops.set_voltage_time_sel = + pwm_regulator_set_voltage_time_sel; return 0; } static int pwm_regulator_init_continuous(struct platform_device *pdev, struct pwm_regulator_data *drvdata) { + struct device_node *np = pdev->dev.of_node; u32 dutycycle_range[2] = { 0, 100 }; u32 dutycycle_unit = 100; memcpy(&drvdata->ops, &pwm_regulator_voltage_continuous_ops, sizeof(drvdata->ops)); + + if (of_property_read_bool(np, "voltage-ramp-exponential")) + drvdata->ops.set_voltage_time = pwm_regulator_set_voltage_time; + drvdata->desc.ops = &drvdata->ops; drvdata->desc.continuous_voltage_range = true; -- 2.1.4 ^ permalink raw reply related [flat|nested] 5+ messages in thread
* Re: [PATCH V2 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition 2016-11-18 14:35 [PATCH V2 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition Laxman Dewangan 2016-11-18 14:35 ` [PATCH V2 2/2] regulator: pwm: " Laxman Dewangan @ 2016-11-21 16:17 ` Rob Herring 2016-11-22 8:50 ` Laxman Dewangan 1 sibling, 1 reply; 5+ messages in thread From: Rob Herring @ 2016-11-21 16:17 UTC (permalink / raw) To: Laxman Dewangan Cc: broonie, mark.rutland, linux-kernel, devicetree, Douglas Anderson, Aleksandr Frid On Fri, Nov 18, 2016 at 08:05:55PM +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 to tell that voltage change > is exponential and having fixed delay for any level of change. > > Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> > CC: Douglas Anderson <dianders@chromium.org> > CC: Aleksandr Frid <afrid@nvidia.com> > > --- > 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. > > Changes from V1: > - Pass the flag to tell that voltage ramp is exponential instead of > providing delay. > --- > .../devicetree/bindings/regulator/pwm-regulator.txt | 12 ++++++++++++ > 1 file changed, 12 insertions(+) > > diff --git a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt > index 3aeba9f..2d9ef3a 100644 > --- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt > +++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt > @@ -54,6 +54,18 @@ Optional properties: > -------------------- > - enable-gpios: GPIO to use to enable/disable the regulator > > +- voltage-ramp-exponential: Boolean, Some of PWM regulator has the exponential > + transition in voltage ramp as opposite to fixed > + slew-rate linear transition on other regulators. > + For such PWM regulator, presence of this property will > + tell that value of the regulator ramp delay provided by > + DT property "regulator-ramp-delay" is exponential and > + fixed delay for any voltage level change. > + If PWM regulator supports the fixed linear slew rate > + then this property should be absent from DT node and > + property "regulator-ramp-delay" is used as linear slew > + rate. Sorry, but on further thought, I don't think we should mix different units for the same property. Also, the fact that the ramp is exponential is irrelevant. You just want an absolute delay time rather than a rate, right? So instead, how about just "regulator-ramp-time-us". Roughly what you had in v1, but not PWM specific. Rob ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition 2016-11-21 16:17 ` [PATCH V2 1/2] regulator: pwm: DT: " Rob Herring @ 2016-11-22 8:50 ` Laxman Dewangan 2016-11-22 21:13 ` Rob Herring 0 siblings, 1 reply; 5+ messages in thread From: Laxman Dewangan @ 2016-11-22 8:50 UTC (permalink / raw) To: Rob Herring Cc: broonie, mark.rutland, linux-kernel, devicetree, Douglas Anderson, Aleksandr Frid On Monday 21 November 2016 09:47 PM, Rob Herring wrote: > On Fri, Nov 18, 2016 at 08:05:55PM +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 to tell that voltage change >> is exponential and having fixed delay for any level of change. >> >> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> >> CC: Douglas Anderson <dianders@chromium.org> >> CC: Aleksandr Frid <afrid@nvidia.com> >> >> --- >> 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. >> >> Changes from V1: >> - Pass the flag to tell that voltage ramp is exponential instead of >> providing delay. >> --- >> .../devicetree/bindings/regulator/pwm-regulator.txt | 12 ++++++++++++ >> 1 file changed, 12 insertions(+) >> >> diff --git a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt >> index 3aeba9f..2d9ef3a 100644 >> --- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt >> +++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt >> @@ -54,6 +54,18 @@ Optional properties: >> -------------------- >> - enable-gpios: GPIO to use to enable/disable the regulator >> >> +- voltage-ramp-exponential: Boolean, Some of PWM regulator has the exponential >> + transition in voltage ramp as opposite to fixed >> + slew-rate linear transition on other regulators. >> + For such PWM regulator, presence of this property will >> + tell that value of the regulator ramp delay provided by >> + DT property "regulator-ramp-delay" is exponential and >> + fixed delay for any voltage level change. >> + If PWM regulator supports the fixed linear slew rate >> + then this property should be absent from DT node and >> + property "regulator-ramp-delay" is used as linear slew >> + rate. > Sorry, but on further thought, I don't think we should mix different > units for the same property. Also, the fact that the ramp is exponential > is irrelevant. You just want an absolute delay time rather than a rate, > right? So instead, how about just "regulator-ramp-time-us". Roughly what > you had in v1, but not PWM specific. Can we say "regulator-settling-time-us" and make it generic i.e. part of the regulator core instead of PWM regulator specific? So no change for "regulator-ramp-delay". new property "regulator-settling-time-us" for fixed settling time in any voltage level change. ^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH V2 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition 2016-11-22 8:50 ` Laxman Dewangan @ 2016-11-22 21:13 ` Rob Herring 0 siblings, 0 replies; 5+ messages in thread From: Rob Herring @ 2016-11-22 21:13 UTC (permalink / raw) To: Laxman Dewangan Cc: Mark Brown, Mark Rutland, linux-kernel, devicetree, Douglas Anderson, Aleksandr Frid On Tue, Nov 22, 2016 at 2:50 AM, Laxman Dewangan <ldewangan@nvidia.com> wrote: > > On Monday 21 November 2016 09:47 PM, Rob Herring wrote: >> >> On Fri, Nov 18, 2016 at 08:05:55PM +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 to tell that voltage change >>> is exponential and having fixed delay for any level of change. >>> >>> Signed-off-by: Laxman Dewangan <ldewangan@nvidia.com> >>> CC: Douglas Anderson <dianders@chromium.org> >>> CC: Aleksandr Frid <afrid@nvidia.com> >>> >>> --- >>> 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. >>> >>> Changes from V1: >>> - Pass the flag to tell that voltage ramp is exponential instead of >>> providing delay. >>> --- >>> .../devicetree/bindings/regulator/pwm-regulator.txt | 12 >>> ++++++++++++ >>> 1 file changed, 12 insertions(+) >>> >>> diff --git >>> a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt >>> b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt >>> index 3aeba9f..2d9ef3a 100644 >>> --- a/Documentation/devicetree/bindings/regulator/pwm-regulator.txt >>> +++ b/Documentation/devicetree/bindings/regulator/pwm-regulator.txt >>> @@ -54,6 +54,18 @@ Optional properties: >>> -------------------- >>> - enable-gpios: GPIO to use to enable/disable the >>> regulator >>> +- voltage-ramp-exponential: Boolean, Some of PWM regulator has the >>> exponential >>> + transition in voltage ramp as opposite to fixed >>> + slew-rate linear transition on other regulators. >>> + For such PWM regulator, presence of this property >>> will >>> + tell that value of the regulator ramp delay >>> provided by >>> + DT property "regulator-ramp-delay" is exponential >>> and >>> + fixed delay for any voltage level change. >>> + If PWM regulator supports the fixed linear slew >>> rate >>> + then this property should be absent from DT node >>> and >>> + property "regulator-ramp-delay" is used as linear >>> slew >>> + rate. >> >> Sorry, but on further thought, I don't think we should mix different >> units for the same property. Also, the fact that the ramp is exponential >> is irrelevant. You just want an absolute delay time rather than a rate, >> right? So instead, how about just "regulator-ramp-time-us". Roughly what >> you had in v1, but not PWM specific. > > > Can we say "regulator-settling-time-us" and make it generic i.e. part of the > regulator core instead of PWM regulator specific? Sure. Rob ^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2016-11-22 21:14 UTC | newest] Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed) -- links below jump to the message on this page -- 2016-11-18 14:35 [PATCH V2 1/2] regulator: pwm: DT: Add ramp delay for exponential voltage transition Laxman Dewangan 2016-11-18 14:35 ` [PATCH V2 2/2] regulator: pwm: " Laxman Dewangan 2016-11-21 16:17 ` [PATCH V2 1/2] regulator: pwm: DT: " Rob Herring 2016-11-22 8:50 ` Laxman Dewangan 2016-11-22 21:13 ` Rob Herring
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).