Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2235519imc; Tue, 12 Mar 2019 09:35:01 -0700 (PDT) X-Google-Smtp-Source: APXvYqy9ccNEJlQCWxOT6jBFrxP6N63lRvPuA4TKiPkQ7Ebt4ZEyZx1fNdnUY0CUFgmCkfrrd7Sj X-Received: by 2002:a65:4104:: with SMTP id w4mr22036938pgp.415.1552408501601; Tue, 12 Mar 2019 09:35:01 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552408501; cv=none; d=google.com; s=arc-20160816; b=GAycI/FBLLRp7fayis5U3JHyZ1rKibtqbMb9VU0UIru51ncbfny0maqoDyMJ2yHp9E 3Jizhyx+5rxWfAxX/kxjX25l36kwPR0VyjIKjdUETXXiK91Wh41oMttvOh8b9Fm9ivSv 5G9TFaElWsYoTvtbBn9jCK5xzYIFg/TzSNKTmd42rydFkLDK3iEUxI0y5zq87B9gxqRC 2yOksq8x0Rn3NaTS64BjZcTTcbRR4KEv9In5NH/npnSdKD6AwtHXMyJgJAD1qwqWwIOA uV9iUWCe0RnCpqYdpBWYiYNRRIVR7helq825GFfEMqGpKtQDleX0H+UbgmyFPOezxcXM jz8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature; bh=OHhJGOJIp4ugcDk8oMNZ0HOX5my0KraGmxIfjYsnEP8=; b=y6oZx9VrXUyv7sAfA22zHuq6PMsR1n32m8/xjzRdKubmDDQzfRmayvdGxWhIG5iLA+ sLA34aVbUARaJqZEA/bp0WhMjbGJ1Cg/IBN1FrPuBIzVVvYteR/pbPFQTrEtb0utnB2O VtocbIM3eOcr1ajuOhFS2fCybwnm84Y1piwLh3UHZfupz14TJfhUalYfOeCT9uo4y5/q rAdt7j8rIYaKtntXakL7A99BuLXuPQLsUjXt8Lf8P2DThbDN/P4sXMU9YMJSbdQyXzns hDltnXatKxKqk13itdrtgCXaUfKykPJufqdW3oYuF/mw0zxj/NS7iSJu2bs6wKIFQVn7 C6pw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ingics-com.20150623.gappssmtp.com header.s=20150623 header.b="fO/4c98e"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 66si7282024plc.88.2019.03.12.09.34.45; Tue, 12 Mar 2019 09:35:01 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@ingics-com.20150623.gappssmtp.com header.s=20150623 header.b="fO/4c98e"; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726809AbfCLQeQ (ORCPT + 99 others); Tue, 12 Mar 2019 12:34:16 -0400 Received: from mail-pf1-f195.google.com ([209.85.210.195]:35037 "EHLO mail-pf1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbfCLQeO (ORCPT ); Tue, 12 Mar 2019 12:34:14 -0400 Received: by mail-pf1-f195.google.com with SMTP id j5so2220835pfa.2 for ; Tue, 12 Mar 2019 09:34:14 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=ingics-com.20150623.gappssmtp.com; s=20150623; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=OHhJGOJIp4ugcDk8oMNZ0HOX5my0KraGmxIfjYsnEP8=; b=fO/4c98e5oE8erxRI0xIAw1G96Rw5qTj/smgPLIVYtEvcFt8TFgti45+CPmkJh/1OK u3ummGvFm1Kof8TnZG5OnMZ8AJWFk151IEPlJeuhrs4Q9Y8S1x5fJypdrnFEi0Ng+2Zw Vq/hdYxEJtqk4VWdpLDLm8GAq/r9UvRTJhG4C7oRcStIGkMhI9CNfBE7qbJQW3q+q71I qySjMIyd0LfWE7D8qt06pSBjp7TIggSb4tj72UNobVmV+s6M5jXEtjJ0Dyt8AiO8viLm VbqRrNxEsobc8IHtaYVVuNRrhqvNIunxqY+7Y9KgoVrUnOLkqVJdvtRQ36jIHiHukXBI PKHw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=OHhJGOJIp4ugcDk8oMNZ0HOX5my0KraGmxIfjYsnEP8=; b=EPM0raz89cFmq4mlA/mFtExeO/FKBBY8enGaJCe+SvLqbM0CCF50HMyXvzj3Lv5ULn 9esma+HPIyYFU59XF+EsQFfar9YSMU1J1kQaI3tBujfj9iSmEUbChqayBQVqhedfiwcy EOAyaWQcS955frgoA8JUjwzLV3uOHk8kVvARI6CHmNWS2ab+KJUMtdzTh4I3lYMRDf4f HbQQcJVwuA1L85G132RZiMCMbo/4A+crMH+CzSbAYKsOW9NJHVppeqjAxnJxp5YW7dQj 7avek8k9uOVjO0iNVh9wLeta+BBH1yqu32Gac65qk2ZyKvDG01QO4CY1RQPp7x+nt33z dbQg== X-Gm-Message-State: APjAAAWqiiaOAs65XBIzWr8PphVf9G6VS5yghim3PR4QNVyO4KfPhGKt 1sBM/SeA1XexSn1nh94R2ZvN/Q== X-Received: by 2002:a65:5108:: with SMTP id f8mr851500pgq.441.1552408453940; Tue, 12 Mar 2019 09:34:13 -0700 (PDT) Received: from localhost.localdomain (220-133-186-239.HINET-IP.hinet.net. [220.133.186.239]) by smtp.gmail.com with ESMTPSA id s79sm17447467pfa.61.2019.03.12.09.34.11 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 09:34:13 -0700 (PDT) From: Axel Lin To: Mark Brown Cc: Charles Keepax , patches@opensource.cirrus.com, Liam Girdwood , linux-kernel@vger.kernel.org, Axel Lin Subject: [PATCH 2/4] regulator: wm8350: Select maximum current in specific range Date: Wed, 13 Mar 2019 00:33:55 +0800 Message-Id: <20190312163357.27785-2-axel.lin@ingics.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20190312163357.27785-1-axel.lin@ingics.com> References: <20190312163357.27785-1-axel.lin@ingics.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org .set_current_limit callback should select the current closest to max_uA. Signed-off-by: Axel Lin --- 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