Received: by 2002:a25:8b91:0:0:0:0:0 with SMTP id j17csp1304214ybl; Wed, 18 Dec 2019 16:19:58 -0800 (PST) X-Google-Smtp-Source: APXvYqzpesOaBrK9JKB3MqqWb/ZkoipEd7E5CQBsIkvvitfPQB2TfQvcxREEOgqTCBr5Z9pKNXH/ X-Received: by 2002:a9d:4692:: with SMTP id z18mr5447793ote.163.1576714798237; Wed, 18 Dec 2019 16:19:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1576714798; cv=none; d=google.com; s=arc-20160816; b=tOxBj2JzPaDbcv71m/gsKVx6FfFMwgicll5B53V5ASEOfHJ8JLNPeL6zpWpkkdZVaK nO0QUBwgMeA5TF8BUbxMT0yqCmUfjJPHUnxnew7t1C2BGffD/GBU0lNZ26Lf64F9+X3O Wf4ZolRyRoTYg1hA8SNWK3ALe+Jfzj1dDwFbaI9iG+LBCe4Zn0kQ9G99n65vE7ECZUS3 7gsWVIynYjgc/D4uBEb9LFXzenRNmNgIjD6sQlyNNKNt2Yrsc+66to5Ff2TzY48/WON/ s/7gC8IQUcvCv6PyndmmoPHMluk8mumqri2WQS18KcO7wN6RHXSZpzhGanUGmBRLHquq xnZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date; bh=edyY9Qo2teltnazwJhKwNO5XpsJMzdGERr3J0op/jvU=; b=08O3OJdWARtpbyf+GPg4PaW7YFmNcB46uKu3+k53YYQFJSLIRB321e/JOw2AkofwbD OQbnQQE6aAitNACvGy0lI1OWZ5uPuoOex3S9i0FtAUmxA54J6RFnlM4K9Z4cmqOABXQ5 T3UX4fBKM8fM32ywaW+w2QeHwPqaQKhk8UwqRpReMw37lJ2E9tlkiSKVvixmr+YZZx88 3734T00M0GlS11xBNfOueU72/eeMAuf5zCVuPpPiIussrB4tFDc117Nyq8tw+oCikHc5 Oqfx5TLokeEjkQLQt4oZ56iUbrJzcbnPAHff+qlR/It8VY0l7Rv7kuG4cvXgQtTdfTPt 7MPw== ARC-Authentication-Results: i=1; mx.google.com; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y23si2243485oti.65.2019.12.18.16.19.46; Wed, 18 Dec 2019 16:19:58 -0800 (PST) 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; 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; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=collabora.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726709AbfLSASA (ORCPT + 99 others); Wed, 18 Dec 2019 19:18:00 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:38946 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726463AbfLSASA (ORCPT ); Wed, 18 Dec 2019 19:18:00 -0500 Received: from [127.0.0.1] (localhost [127.0.0.1]) (Authenticated sender: sre) with ESMTPSA id D427A291E6E Received: by earth.universe (Postfix, from userid 1000) id 61A363C0C7B; Thu, 19 Dec 2019 01:17:56 +0100 (CET) Date: Thu, 19 Dec 2019 01:17:56 +0100 From: Sebastian Reichel To: Artur Rojek Cc: Paul Cercueil , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, od@zcrc.me, stable@vger.kernel.org Subject: Re: [PATCH v3] power/supply: ingenic-battery: Don't change scale if there's only one Message-ID: <20191219001756.vuvmrepmbrd7zjix@earth.universe> References: <20191116135619.9545-1-paul@crapouillou.net> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha512; protocol="application/pgp-signature"; boundary="qvszxbgcfqgngyks" Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --qvszxbgcfqgngyks Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hi, On Sat, Nov 16, 2019 at 03:08:46PM +0100, Artur Rojek wrote: > On 2019-11-16 14:56, Paul Cercueil wrote: > > The ADC in the JZ4740 can work either in high-precision mode with a 2.5V > > range, or in low-precision mode with a 7.5V range. The code in place in > > this driver will select the proper scale according to the maximum > > voltage of the battery. > >=20 > > The JZ4770 however only has one mode, with a 6.6V range. If only one > > scale is available, there's no need to change it (and nothing to change > > it to), and trying to do so will fail with -EINVAL. > >=20 > > Fixes: fb24ccfbe1e0 ("power: supply: add Ingenic JZ47xx battery > > driver.") > >=20 > > Signed-off-by: Paul Cercueil > > Cc: stable@vger.kernel.org >=20 > Looks good to me! >=20 > Acked-by: Artur Rojek Thanks, queued to power-supply's for-next branch. -- Sebastian > > --- > >=20 > > Notes: > > v2: Rebased on v5.4-rc7 > > v3: Move code after check for max scale voltage > >=20 > > drivers/power/supply/ingenic-battery.c | 15 +++++++++++---- > > 1 file changed, 11 insertions(+), 4 deletions(-) > >=20 > > diff --git a/drivers/power/supply/ingenic-battery.c > > b/drivers/power/supply/ingenic-battery.c > > index 35816d4b3012..2748715c4c75 100644 > > --- a/drivers/power/supply/ingenic-battery.c > > +++ b/drivers/power/supply/ingenic-battery.c > > @@ -100,10 +100,17 @@ static int ingenic_battery_set_scale(struct > > ingenic_battery *bat) > > return -EINVAL; > > } > >=20 > > - return iio_write_channel_attribute(bat->channel, > > - scale_raw[best_idx], > > - scale_raw[best_idx + 1], > > - IIO_CHAN_INFO_SCALE); > > + /* Only set scale if there is more than one (fractional) entry */ > > + if (scale_len > 2) { > > + ret =3D iio_write_channel_attribute(bat->channel, > > + scale_raw[best_idx], > > + scale_raw[best_idx + 1], > > + IIO_CHAN_INFO_SCALE); > > + if (ret) > > + return ret; > > + } > > + > > + return 0; > > } > >=20 > > static enum power_supply_property ingenic_battery_properties[] =3D { --qvszxbgcfqgngyks Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQIzBAEBCgAdFiEE72YNB0Y/i3JqeVQT2O7X88g7+poFAl36wbQACgkQ2O7X88g7 +prTHg/8DFNUybhomQ90wJsZPhq1g25jJsiwcHMP/q3IcK6OXrEGVGbE6+1x4qRB +xH5cbOBgDuDdDdZAYj/Iu0L6QSZu/UZ0KTrMforsKCPmktsL32+5R0/ib4nPIAd gucIo8VEt83wE/meSqFBsRaJ1YZk8UuIjgnl4iylK5E8jQdkbbVaM26SxaZim5qw 8WgJ6evF2OMeG9az6cVVxDhTDFOh9+HNTzrELeXrGtKbOJAUYFOIFTIDvLJFw+gk 91FnchNd6m//5bXcnz5m84G/vtfRiLMTlVKorsxoExG50shH6DuR4i2p8cI9orbx OG8zZKePdc26ePN/vGdUpfrUbWoFC69T1hCGzsAvDg3QlOG3lUD2ngP9cOwJr1ln drFprmhpylvb84+Fjb60aAsig0rIBLC4uUJwgJSpIaG+9NM5i2TzPWppwVMGmyRj H3WcciftA1osgQnkMjVuHQZEIztgAAnzi/KdiBPe3iWoRPS5NFzztGv+nimzHh+6 ks+qHtQCIG6Elo9UVD71IwvowrAu4aHJs9nDmHwVRQtAth18E3kCE8Xxj7550NQn uywIoFLkdftq9WIE/liiIbWyvg1B5Wqad7ukjS2LTW0Yy/ySSRuclQ4HGle9pByK 1W5BTTTxCk029b8MGBJuTJA/IcjIUTi3iqMaFVXLMneQjZPDFHI= =WUfr -----END PGP SIGNATURE----- --qvszxbgcfqgngyks--