linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] regulator: core: Call set_voltage_time_sel() only when the regulator is on
@ 2012-05-21  1:37 Axel Lin
  2012-05-21  1:39 ` [PATCH 2/2] regulator: ab8500: Let regulator core handle the case no delay for setting new voltage if regulator is off Axel Lin
  2012-05-21 14:49 ` [PATCH 1/2] regulator: core: Call set_voltage_time_sel() only when the regulator is on Mark Brown
  0 siblings, 2 replies; 4+ messages in thread
From: Axel Lin @ 2012-05-21  1:37 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lee Jones, Linus Walleij, Mark Brown, Liam Girdwood

If the regulator is not on, it won't take time setting new voltage.
So only call set_voltage_time_sel() to get the necessary delay when
the regulator is on.

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/core.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 0b15587..8d19ece 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2103,7 +2103,8 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
 	 * If we can't obtain the old selector there is not enough
 	 * info to call set_voltage_time_sel().
 	 */
-	if (rdev->desc->ops->set_voltage_time_sel &&
+	if (_regulator_is_enabled(rdev) &&
+	    rdev->desc->ops->set_voltage_time_sel &&
 	    rdev->desc->ops->get_voltage_sel) {
 		old_selector = rdev->desc->ops->get_voltage_sel(rdev);
 		if (old_selector < 0)
@@ -2135,7 +2136,7 @@ static int _regulator_do_set_voltage(struct regulator_dev *rdev,
 		best_val = -1;
 
 	/* Call set_voltage_time_sel if successfully obtained old_selector */
-	if (ret == 0 && old_selector >= 0 &&
+	if (_regulator_is_enabled(rdev) && ret == 0 && old_selector >= 0 &&
 	    rdev->desc->ops->set_voltage_time_sel) {
 
 		delay = rdev->desc->ops->set_voltage_time_sel(rdev,
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH 2/2] regulator: ab8500: Let regulator core handle the case no delay for setting new voltage if regulator is off
  2012-05-21  1:37 [PATCH 1/2] regulator: core: Call set_voltage_time_sel() only when the regulator is on Axel Lin
@ 2012-05-21  1:39 ` Axel Lin
  2012-05-21  9:19   ` Linus Walleij
  2012-05-21 14:49 ` [PATCH 1/2] regulator: core: Call set_voltage_time_sel() only when the regulator is on Mark Brown
  1 sibling, 1 reply; 4+ messages in thread
From: Axel Lin @ 2012-05-21  1:39 UTC (permalink / raw)
  To: linux-kernel; +Cc: Lee Jones, Linus Walleij, Mark Brown, Liam Girdwood

Signed-off-by: Axel Lin <axel.lin@gmail.com>
---
 drivers/regulator/ab8500.c |    7 -------
 1 files changed, 0 insertions(+), 7 deletions(-)

diff --git a/drivers/regulator/ab8500.c b/drivers/regulator/ab8500.c
index da883e6..f158074 100644
--- a/drivers/regulator/ab8500.c
+++ b/drivers/regulator/ab8500.c
@@ -256,14 +256,7 @@ static int ab8500_regulator_set_voltage_time_sel(struct regulator_dev *rdev,
 					     unsigned int new_sel)
 {
 	struct ab8500_regulator_info *info = rdev_get_drvdata(rdev);
-	int ret;
 
-	/* If the regulator isn't on, it won't take time here */
-	ret = ab8500_regulator_is_enabled(rdev);
-	if (ret < 0)
-		return ret;
-	if (!ret)
-		return 0;
 	return info->delay;
 }
 
-- 
1.7.5.4




^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH 2/2] regulator: ab8500: Let regulator core handle the case no delay for setting new voltage if regulator is off
  2012-05-21  1:39 ` [PATCH 2/2] regulator: ab8500: Let regulator core handle the case no delay for setting new voltage if regulator is off Axel Lin
@ 2012-05-21  9:19   ` Linus Walleij
  0 siblings, 0 replies; 4+ messages in thread
From: Linus Walleij @ 2012-05-21  9:19 UTC (permalink / raw)
  To: Axel Lin
  Cc: linux-kernel, Lee Jones, Linus Walleij, Mark Brown, Liam Girdwood

On Mon, May 21, 2012 at 3:39 AM, Axel Lin <axel.lin@gmail.com> wrote:

> Signed-off-by: Axel Lin <axel.lin@gmail.com>
> ---
>  drivers/regulator/ab8500.c |    7 -------
>  1 files changed, 0 insertions(+), 7 deletions(-)

Looks correct following the other patch.
Acked-by: Linus Walleij <linus.walleij@linaro.org>

Linus Walleij

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH 1/2] regulator: core: Call set_voltage_time_sel() only when the regulator is on
  2012-05-21  1:37 [PATCH 1/2] regulator: core: Call set_voltage_time_sel() only when the regulator is on Axel Lin
  2012-05-21  1:39 ` [PATCH 2/2] regulator: ab8500: Let regulator core handle the case no delay for setting new voltage if regulator is off Axel Lin
@ 2012-05-21 14:49 ` Mark Brown
  1 sibling, 0 replies; 4+ messages in thread
From: Mark Brown @ 2012-05-21 14:49 UTC (permalink / raw)
  To: Axel Lin; +Cc: linux-kernel, Lee Jones, Linus Walleij, Liam Girdwood

[-- Attachment #1: Type: text/plain, Size: 244 bytes --]

On Mon, May 21, 2012 at 09:37:52AM +0800, Axel Lin wrote:
> If the regulator is not on, it won't take time setting new voltage.
> So only call set_voltage_time_sel() to get the necessary delay when
> the regulator is on.

Applied both, thanks.

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2012-05-21 14:49 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-05-21  1:37 [PATCH 1/2] regulator: core: Call set_voltage_time_sel() only when the regulator is on Axel Lin
2012-05-21  1:39 ` [PATCH 2/2] regulator: ab8500: Let regulator core handle the case no delay for setting new voltage if regulator is off Axel Lin
2012-05-21  9:19   ` Linus Walleij
2012-05-21 14:49 ` [PATCH 1/2] regulator: core: Call set_voltage_time_sel() only when the regulator is on Mark Brown

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).