public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH 1/4] regulator: wm831x-dcdc: Fix the logic to choose best current limit setting
@ 2012-03-27  7:17 Axel Lin
  2012-03-27  7:18 ` [PATCH 2/4] regulator: wm831x-isink: " Axel Lin
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Axel Lin @ 2012-03-27  7:17 UTC (permalink / raw)
  To: linux-kernel; +Cc: Liam Girdwood, Mark Brown

Current code in wm831x_buckv_set_current_limit actually set the current limit
setting greater than specified range.

Fix the logic in wm831x_buckv_set_current_limit to choose the
smallest current limit setting falls within the specified range.

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

diff --git a/drivers/regulator/wm831x-dcdc.c b/drivers/regulator/wm831x-dcdc.c
index 3044001..ff810e7 100644
--- a/drivers/regulator/wm831x-dcdc.c
+++ b/drivers/regulator/wm831x-dcdc.c
@@ -380,7 +380,8 @@ static int wm831x_buckv_set_current_limit(struct regulator_dev *rdev,
 	int i;
 
 	for (i = 0; i < ARRAY_SIZE(wm831x_dcdc_ilim); i++) {
-		if (max_uA <= wm831x_dcdc_ilim[i])
+		if ((min_uA <= wm831x_dcdc_ilim[i]) &&
+		    (wm831x_dcdc_ilim[i] <= max_uA))
 			break;
 	}
 	if (i == ARRAY_SIZE(wm831x_dcdc_ilim))
-- 
1.7.5.4




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

end of thread, other threads:[~2012-03-28 11:45 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-03-27  7:17 [PATCH 1/4] regulator: wm831x-dcdc: Fix the logic to choose best current limit setting Axel Lin
2012-03-27  7:18 ` [PATCH 2/4] regulator: wm831x-isink: " Axel Lin
2012-03-27  7:20 ` [PATCH 3/4] regulator: wm8350: " Axel Lin
2012-03-27  7:21 ` [PATCH 4/4] regulator: Return microamps in wm8350_isink_get_current Axel Lin
2012-03-28 11:44 ` [PATCH 1/4] regulator: wm831x-dcdc: Fix the logic to choose best current limit setting Mark Brown

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