• Douglas Anderson's avatar
    regulator: pwm: Fix regulator ramp delay for continuous mode · c2588393
    Douglas Anderson authored
    The original commit adding support for continuous voltage mode didn't
    handle the regulator ramp delay properly.  It treated the delay as a
    fixed delay in uS despite the property being defined as uV / uS.  Let's
    adjust it.  Luckily there appear to be no users of this ramp delay for
    PWM regulators (as per grepping through device trees in linuxnext).
    
    Note also that the upper bound of usleep_range probably shouldn't be a
    full 1 ms longer than the lower bound since I've seen plenty of hardware
    with a ramp rate of ~5000 uS / uV and for small jumps the total delays
    are in the tens of uS.  1000 is way too much.  We'll try to be dynamic
    and use 10%.
    
    NOTE: This commit doesn't add support for regulator-enable-ramp-delay.
    That could be done in a future patch when someone has a user of that
    featre.
    
    Though this patch is shows as "fixing" a bug, there are no actual known
    users of continuous mode PWM regulator w/ ramp delay in mainline and so
    this likely won't have any effect on anyone unless they are working
    out-of-tree with private patches.  For anyone in this state, it is
    highly encouraged to also pick Boris Brezillon's WIP patches to get
    yourself a reliable and glitch-free regulator.
    
    Fixes: 4773be18 ("regulator: pwm-regulator: Add support for continuous-voltage")
    Signed-off-by: default avatarDouglas Anderson <dianders@chromium.org>
    Acked-by: default avatarLaxman Dewangan <ldewangan@nvidia.com>
    Signed-off-by: default avatarMark Brown <broonie@kernel.org>
    c2588393
pwm-regulator.c 9.01 KB