Re: [PATCH v5 6/6] regulator: core: Prevent falling too fast

From: Rob Herring
Date: Fri Sep 23 2016 - 11:16:45 EST


On Wed, Sep 14, 2016 at 09:52:10AM -0700, Matthias Kaehlcke wrote:
> From: Douglas Anderson <dianders@xxxxxxxxxxxx>
>
> On some boards it is possible that transitioning the regulator downwards
> too fast will trigger the over voltage protection (OVP) on the
> regulator. This is because until the voltage actually falls there is
> time when the requested voltage is much lower than the actual voltage.
>
> We'll fix this OVP problem by allowing users to specify the maximum
> voltage that we can safely fall. The maximum safe voltage decrease
> is specified as a percentage of the current voltage. The driver will
> then break things into separate steps with a delay in between.
>
> In order to figure out what the delay should be we need to figure out
> how slowly the voltage rail might fall in the worst (slowest) case.
> We'll assume this worst case is present and delay so we know for sure
> that we've finished each step.
>
> In this patch we actually block returning from the set_voltage() call
> until we've finished delaying. A future patch atop this one might
> choose to return more immediately and let the voltages fall in the
> background. That would possibly allow us to cancel a slow downward
> decay if there was a request to go back up.
>
> Signed-off-by: Douglas Anderson <dianders@xxxxxxxxxxxx>
> Signed-off-by: Matthias Kaehlcke <mka@xxxxxxxxxxxx>
> ---
> Changes in v5:
> - Leave set_voltage tracepoints where they were
> - Fixed error handling in code dealing with the device tree, return an error if configuration is invalid
> - Fixed coding style and formatting issues
> - Updated commit message
>
> .../devicetree/bindings/regulator/regulator.txt | 7 ++++

For the binding:

Acked-by: Rob Herring <robh@xxxxxxxxxx>

> drivers/regulator/core.c | 49 +++++++++++++++++++---
> drivers/regulator/of_regulator.c | 42 ++++++++++++++++++-
> include/linux/regulator/machine.h | 2 +
> 4 files changed, 93 insertions(+), 7 deletions(-)