From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-8.5 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, INCLUDES_PATCH,MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS, URIBL_BLOCKED,USER_AGENT_MUTT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 58404C004C9 for ; Sun, 5 May 2019 19:14:14 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 292A5208C0 for ; Sun, 5 May 2019 19:14:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727615AbfEETON (ORCPT ); Sun, 5 May 2019 15:14:13 -0400 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:46698 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726636AbfEETON (ORCPT ); Sun, 5 May 2019 15:14:13 -0400 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 1C53A803EE; Sun, 5 May 2019 21:14:02 +0200 (CEST) Date: Sun, 5 May 2019 21:14:12 +0200 From: Pavel Machek To: Tony Lindgren Cc: Sebastian Reichel , linux-pm@vger.kernel.org, linux-omap@vger.kernel.org Subject: Re: [PATCH 2/7] power: supply: cpcap-battery: Fix low battery check Message-ID: <20190505191412.GA4050@amd> References: <20190407181254.64537-1-tony@atomide.com> <20190407181254.64537-3-tony@atomide.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="DocE+STaALJfprDB" Content-Disposition: inline In-Reply-To: <20190407181254.64537-3-tony@atomide.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org --DocE+STaALJfprDB Content-Type: text/plain; charset=us-ascii Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Sun 2019-04-07 11:12:49, Tony Lindgren wrote: > We need to check current instead of the charge counter to see if > a charger is connected. The charge counter shows the cumulated value > instead of the current charge current and can be negative or positive. >=20 Acked-by: Pavel Machek > Signed-off-by: Tony Lindgren > --- > drivers/power/supply/cpcap-battery.c | 4 ++-- > 1 file changed, 2 insertions(+), 2 deletions(-) >=20 > diff --git a/drivers/power/supply/cpcap-battery.c b/drivers/power/supply/= cpcap-battery.c > --- a/drivers/power/supply/cpcap-battery.c > +++ b/drivers/power/supply/cpcap-battery.c > @@ -562,11 +562,11 @@ static irqreturn_t cpcap_battery_irq_thread(int irq= , void *data) > =20 > switch (d->action) { > case CPCAP_BATTERY_IRQ_ACTION_BATTERY_LOW: > - if (latest->counter_uah >=3D 0) > + if (latest->current_ua >=3D 0) > dev_warn(ddata->dev, "Battery low at 3.3V!\n"); > break; > case CPCAP_BATTERY_IRQ_ACTION_POWEROFF: > - if (latest->counter_uah >=3D 0) { > + if (latest->current_ua >=3D 0) { > dev_emerg(ddata->dev, > "Battery empty at 3.1V, powering off\n"); > orderly_poweroff(true); --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --DocE+STaALJfprDB Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlzPNgQACgkQMOfwapXb+vJkoACfa+jKGnMxD78TLrJv6xTQhYU9 CbYAnRwmWa7RdzyUAExv8D+lmgIAMz8K =xE1L -----END PGP SIGNATURE----- --DocE+STaALJfprDB--