public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] regulator: If we can't configure optimum mode we're always in the best one
@ 2011-05-14 18:19 Mark Brown
  2011-05-16 12:18 ` Liam Girdwood
  0 siblings, 1 reply; 2+ messages in thread
From: Mark Brown @ 2011-05-14 18:19 UTC (permalink / raw)
  To: Liam Girdwood; +Cc: linux-kernel, patches, David Collins, Mark Brown

If either a regulator driver can't tell us what the optimum mode is (or
doesn't have modes in the first place) or the system doesn't allow DRMS
changes then it's more helpful for users to just say that we're in the
optimal mode, even if it's from a selection of one.

Still report errors if the process of picking and setting a mode changes as
this may indicate that we're stuck in a low power mode and unable to deliver
a higher current that the consumer just asked for.

Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
---
 drivers/regulator/core.c |   16 +++++++++++++---
 1 files changed, 13 insertions(+), 3 deletions(-)

diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c
index 9f18131..051a45d 100644
--- a/drivers/regulator/core.c
+++ b/drivers/regulator/core.c
@@ -2078,16 +2078,26 @@ int regulator_set_optimum_mode(struct regulator *regulator, int uA_load)
 
 	mutex_lock(&rdev->mutex);
 
+	/*
+	 * first check to see if we can set modes at all, otherwise just
+	 * tell the consumer everything is OK.
+	 */
 	regulator->uA_load = uA_load;
 	ret = regulator_check_drms(rdev);
-	if (ret < 0)
+	if (ret < 0) {
+		ret = 0;
 		goto out;
-	ret = -EINVAL;
+	}
 
-	/* sanity check */
 	if (!rdev->desc->ops->get_optimum_mode)
 		goto out;
 
+	/*
+	 * we can actually do this so any errors are indicators of
+	 * potential real failure.
+	 */
+	ret = -EINVAL;
+
 	/* get output voltage */
 	output_uV = _regulator_get_voltage(rdev);
 	if (output_uV <= 0) {
-- 
1.7.5.1


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

* Re: [PATCH] regulator: If we can't configure optimum mode we're always in the best one
  2011-05-14 18:19 [PATCH] regulator: If we can't configure optimum mode we're always in the best one Mark Brown
@ 2011-05-16 12:18 ` Liam Girdwood
  0 siblings, 0 replies; 2+ messages in thread
From: Liam Girdwood @ 2011-05-16 12:18 UTC (permalink / raw)
  To: Mark Brown
  Cc: linux-kernel@vger.kernel.org, patches@opensource.wolfsonmicro.com,
	David Collins

On 14/05/11 19:19, Mark Brown wrote:
> If either a regulator driver can't tell us what the optimum mode is (or
> doesn't have modes in the first place) or the system doesn't allow DRMS
> changes then it's more helpful for users to just say that we're in the
> optimal mode, even if it's from a selection of one.
> 
> Still report errors if the process of picking and setting a mode changes as
> this may indicate that we're stuck in a low power mode and unable to deliver
> a higher current that the consumer just asked for.
> 
> Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com>
> ---
>  drivers/regulator/core.c |   16 +++++++++++++---
>  1 files changed, 13 insertions(+), 3 deletions(-)
> 

Applied.

Thanks

Liam

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

end of thread, other threads:[~2011-05-16 12:19 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-05-14 18:19 [PATCH] regulator: If we can't configure optimum mode we're always in the best one Mark Brown
2011-05-16 12:18 ` Liam Girdwood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox