Received: by 2002:ac0:950c:0:0:0:0:0 with SMTP id f12csp2235395imc; Tue, 12 Mar 2019 09:34:53 -0700 (PDT) X-Google-Smtp-Source: APXvYqy5qt0j+i2RULOCtqaU3THriSzfmBzQTjlgBhW05XS0clYIIB3pPBhJSw2DYsKcvc9tvdv0 X-Received: by 2002:a63:1354:: with SMTP id 20mr10120724pgt.198.1552408493008; Tue, 12 Mar 2019 09:34:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1552408493; cv=none; d=google.com; s=arc-20160816; b=nmL961gzEL+XTcRqis1pJGj77brgOy49E7w84jlvdx1XLUKCwWwOqQVv/GcP5TKmik BETJqtqwiKCsFOLg7WEh0iTNN0ERwT9O27hqa87zCmwuCxBg4oJ4aQ1Quuu29nEfGHXW 39/FXUUavkO0iVBFc/DvKgbPAnrFjFCFOWR7OEgQbmY1lMNFklSeweH/t5VZTtk94BFh ByDUSFNYtCIpNDbtCRrSRFdnCFE4G8PNXBk5yLPzCN2ZfshkxxeYnHmJ1JGwqCZ8YElo vY6kAAWAytROW42prbEcCcuxqxmWzsekNFwy1nw3BblpfjvhgWVYtc+Y9qjkv5S6WtiU O7RA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature; bh=AU7FJCFZhMzWP3kHeCNtolB/QqYfsLbqkkIzrMqN9K4=; b=zFKb6OC+1h9OKBXIKlAlruoClXHL/WNM2FVGdZk8zclOvfx+d+2i87m0bL3jpJYpEK gb0lPMr8Uu2SsANyS/i3mErxnirGDlAJNue8gGFvVyD3s+TOP0VJ9ElKzihzxjxro83i Z4HrdIzJnILKKXEXYpiNijuWl3o+0QjhPY6rdnr+FebgfLD8Co1x00j+2c2J61dxgYhF eYrnw8xRx7IFpwvThqzuokc/k8A6+xvCEWSl34vfHVnLhGnq/5Nn4vdJ3H97H4/cqG1o kIlnQz401rx3yWZ1QQJl4T6biA8RG3hsUx9xc3YbJzzpE0Sft7QKFFc/6n2RmC5mqH2I prEA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@ingics-com.20150623.gappssmtp.com header.s=20150623 header.b=xpQd86sw; 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 h22si7701209pgv.533.2019.03.12.09.34.36; Tue, 12 Mar 2019 09:34:52 -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=xpQd86sw; 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 S1726692AbfCLQeM (ORCPT + 99 others); Tue, 12 Mar 2019 12:34:12 -0400 Received: from mail-pg1-f195.google.com ([209.85.215.195]:40963 "EHLO mail-pg1-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725894AbfCLQeM (ORCPT ); Tue, 12 Mar 2019 12:34:12 -0400 Received: by mail-pg1-f195.google.com with SMTP id k11so2215563pgb.8 for ; Tue, 12 Mar 2019 09:34:12 -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; bh=AU7FJCFZhMzWP3kHeCNtolB/QqYfsLbqkkIzrMqN9K4=; b=xpQd86swoP6wEGLCClTmPd2b4UBityL96qAwwMgbmBtcaRN0NKGX248v45t9HWEewn A3wqcImQLN3Bhwgj/VXv4wKZKeRZYWQkpUf/hbexQU2DrGbbjwyLdf6vhkxCF1HThqSA p3xa0TbsLZmLkV14n5jo1wbivJRHYrb9Swm+tYTyMtxWbA0Qr3N3S9Cq7PIusfGl2VIM 0/88Y6wINLv/6VzwlLbCAHtrL8SV2wCE34gBMYXQpk1NF6NsaovBFOAJV7u02yZFuhx3 PZLtITDInK0iHeNZEpyzXOx00Wi+nSI5CML4KbNjGC1Sjey+h2uOnpL2poOhOXuKrv65 9qcw== 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; bh=AU7FJCFZhMzWP3kHeCNtolB/QqYfsLbqkkIzrMqN9K4=; b=JaZJYpPi66LNpTdG/AEIHRT9W4MpY1Is4ykqD5MdD6JaVdJcnfyhWwWNBQnYQ81q9m LnMAtGrOnuwlkh5HAG2xEIiZ/y48yP0Ng48XT2bDOAS6Jr70ixHXPHCCxJ9dW0pAt7Es 9vlnh/zgKV+q9UrUG5Z8ZRIwZztTW7OhzxoBSum3hVv180VtxjqthSIvCd93PGx5/a4X jKIc3RyUGV/io6A7VN05iZ9k5zjujp5kRlRMJoia6+A3HWnN8DFMlKvJHeKF7X956zu8 oGc/alygqFlbONv7FZsraEfbTcbLza65jV/hr61IgoPB1JX8BH+tAG0KF09icUNKkPq2 s9hA== X-Gm-Message-State: APjAAAW/A4jbj+KXkdcb0u3iDjQJktleba+xraEegsYsfHFQ23pz0gK/ /iYvnhh5jwFckcReVCIkPNUj7g== X-Received: by 2002:a65:44cb:: with SMTP id g11mr36264129pgs.29.1552408451550; Tue, 12 Mar 2019 09:34:11 -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.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 12 Mar 2019 09:34:10 -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 1/4] regulator: wm831x-isink: Select maximum current in specific range Date: Wed, 13 Mar 2019 00:33:54 +0800 Message-Id: <20190312163357.27785-1-axel.lin@ingics.com> X-Mailer: git-send-email 2.17.1 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/wm831x-isink.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/regulator/wm831x-isink.c b/drivers/regulator/wm831x-isink.c index 6dd891d7eee3..676a4701c986 100644 --- a/drivers/regulator/wm831x-isink.c +++ b/drivers/regulator/wm831x-isink.c @@ -99,7 +99,7 @@ static int wm831x_isink_set_current(struct regulator_dev *rdev, struct wm831x *wm831x = isink->wm831x; int ret, i; - for (i = 0; i < ARRAY_SIZE(wm831x_isinkv_values); i++) { + for (i = ARRAY_SIZE(wm831x_isinkv_values) - 1; i >= 0; i--) { int val = wm831x_isinkv_values[i]; if (min_uA <= val && val <= max_uA) { ret = wm831x_set_bits(wm831x, isink->reg, -- 2.17.1