From: <gregkh@linuxfoundation.org>
To: dianders@chromium.org, broonie@kernel.org,
gregkh@linuxfoundation.org, ldewangan@nvidia.com
Cc: <stable@vger.kernel.org>, <stable-commits@vger.kernel.org>
Subject: Patch "regulator: pwm: Fix regulator ramp delay for continuous mode" has been added to the 4.7-stable tree
Date: Wed, 05 Oct 2016 15:10:20 +0200 [thread overview]
Message-ID: <14756730206862@kroah.com> (raw)
This is a note to let you know that I've just added the patch titled
regulator: pwm: Fix regulator ramp delay for continuous mode
to the 4.7-stable tree which can be found at:
http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary
The filename of the patch is:
regulator-pwm-fix-regulator-ramp-delay-for-continuous-mode.patch
and it can be found in the queue-4.7 subdirectory.
If you, or anyone else, feels it should not be added to the stable tree,
please let <stable@vger.kernel.org> know about it.
>From c2588393e6315ab68207323d37d2a73713d6bc81 Mon Sep 17 00:00:00 2001
From: Douglas Anderson <dianders@chromium.org>
Date: Wed, 6 Jul 2016 11:42:01 -0700
Subject: regulator: pwm: Fix regulator ramp delay for continuous mode
From: Douglas Anderson <dianders@chromium.org>
commit c2588393e6315ab68207323d37d2a73713d6bc81 upstream.
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: 4773be185a0f ("regulator: pwm-regulator: Add support for continuous-voltage")
Signed-off-by: Douglas Anderson <dianders@chromium.org>
Acked-by: Laxman Dewangan <ldewangan@nvidia.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
---
drivers/regulator/pwm-regulator.c | 9 +++++++--
1 file changed, 7 insertions(+), 2 deletions(-)
--- a/drivers/regulator/pwm-regulator.c
+++ b/drivers/regulator/pwm-regulator.c
@@ -132,6 +132,7 @@ static int pwm_regulator_set_voltage(str
unsigned int duty_pulse;
u64 req_period;
u32 rem;
+ int old_uV = pwm_regulator_get_voltage(rdev);
int ret;
pwm_get_args(drvdata->pwm, &pargs);
@@ -166,8 +167,12 @@ static int pwm_regulator_set_voltage(str
}
drvdata->volt_uV = min_uV;
- /* Delay required by PWM regulator to settle to the new voltage */
- usleep_range(ramp_delay, ramp_delay + 1000);
+ if ((ramp_delay == 0) || !pwm_regulator_is_enabled(rdev))
+ return 0;
+
+ /* Ramp delay is in uV/uS. Adjust to uS and delay */
+ ramp_delay = DIV_ROUND_UP(abs(min_uV - old_uV), ramp_delay);
+ usleep_range(ramp_delay, ramp_delay + DIV_ROUND_UP(ramp_delay, 10));
return 0;
}
Patches currently in stable-queue which might be from dianders@chromium.org are
queue-4.7/regulator-pwm-fix-regulator-ramp-delay-for-continuous-mode.patch
reply other threads:[~2016-10-05 13:16 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=14756730206862@kroah.com \
--to=gregkh@linuxfoundation.org \
--cc=broonie@kernel.org \
--cc=dianders@chromium.org \
--cc=ldewangan@nvidia.com \
--cc=stable-commits@vger.kernel.org \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.