linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Axel Lin <axel.lin@ingics.com>
To: Mark Brown <broonie@kernel.org>
Cc: Charles Keepax <ckeepax@opensource.cirrus.com>,
	patches@opensource.cirrus.com,
	Liam Girdwood <lgirdwood@gmail.com>,
	linux-kernel@vger.kernel.org, Axel Lin <axel.lin@ingics.com>
Subject: [PATCH 2/4] regulator: wm8350: Select maximum current in specific range
Date: Wed, 13 Mar 2019 00:33:55 +0800	[thread overview]
Message-ID: <20190312163357.27785-2-axel.lin@ingics.com> (raw)
In-Reply-To: <20190312163357.27785-1-axel.lin@ingics.com>

.set_current_limit callback should select the current closest to max_uA.

Signed-off-by: Axel Lin <axel.lin@ingics.com>
---
 drivers/regulator/wm8350-regulator.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/regulator/wm8350-regulator.c b/drivers/regulator/wm8350-regulator.c
index a1c7dfee5c37..d1758a2bc769 100644
--- a/drivers/regulator/wm8350-regulator.c
+++ b/drivers/regulator/wm8350-regulator.c
@@ -99,7 +99,7 @@ static int get_isink_val(int min_uA, int max_uA, u16 *setting)
 {
 	int i;
 
-	for (i = 0; i < ARRAY_SIZE(isink_cur); i++) {
+	for (i = ARRAY_SIZE(isink_cur) - 1; i >= 0; i--) {
 		if (min_uA <= isink_cur[i] && max_uA >= isink_cur[i]) {
 			*setting = i;
 			return 0;
-- 
2.17.1


  reply	other threads:[~2019-03-12 16:34 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-03-12 16:33 [PATCH 1/4] regulator: wm831x-isink: Select maximum current in specific range Axel Lin
2019-03-12 16:33 ` Axel Lin [this message]
2019-03-13 14:04   ` [PATCH 2/4] regulator: wm8350: " Charles Keepax
2019-03-12 16:33 ` [PATCH 3/4] regulator: wm831x-isink: Convert to use regulator_set/get_current_limit_regmap Axel Lin
2019-03-13 14:04   ` Charles Keepax
2019-03-12 16:33 ` [PATCH 4/4] regulator: wm8350: " Axel Lin
2019-03-13 14:05   ` Charles Keepax
2019-03-13 14:04 ` [PATCH 1/4] regulator: wm831x-isink: Select maximum current in specific range Charles Keepax

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=20190312163357.27785-2-axel.lin@ingics.com \
    --to=axel.lin@ingics.com \
    --cc=broonie@kernel.org \
    --cc=ckeepax@opensource.cirrus.com \
    --cc=lgirdwood@gmail.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=patches@opensource.cirrus.com \
    /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 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).