Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp326703imu; Mon, 5 Nov 2018 01:20:04 -0800 (PST) X-Google-Smtp-Source: AJdET5fBcXGm0umJm3v+tL85b8yWAQ+3NdIhoRRuRQg6M/b7ndIcXQTZlaoYI0c/MpaCbxWFa73R X-Received: by 2002:a17:902:163:: with SMTP id 90-v6mr21655465plb.87.1541409604636; Mon, 05 Nov 2018 01:20:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541409604; cv=none; d=google.com; s=arc-20160816; b=dTmXhTB+eLxh0KohV1LFU7JzZltwH77QXkq9Yyyguk0PLOD6IQkxlw0Fb8TSAyyHhz rpNrTBm3ihU/pZGw9JvkHoNDITkucqMm2Co1xCT0oiLOjoTq5cCOefeRqfVqvxatIc+R b6xPiuEDtmVgmF5bZG9Myq65MYqCJ0/Zi8Y7p55FgnebYlPPIFZuCPuW2IEKNVKq5ubi iTPBQe5xgxIJe3p/Pyyf+ih1xOmsQC//u/2fcdDGFlOoYSQLiR3wwA6WDrKSzsg53YWB kvGYwhgKxdO2AboRejYSxhRQzm+yqGYpzVtBj8W0mihkwU3P4+eD5cGFcXfLvp4rmboj wGqA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=M5svSiTSMPcFoPTabX1Hmi4NP4/UCtgl6nQM1NWQL30=; b=p9I4z4yH8+AeMLR7T3GnCPWuoR7LuQSLxR+mztV4I4jR0EIvzpg4BoH3pxC7cNQKRx e48L7JFpgVg5ajbs4iLDzj4S4UNGh5/KhcVYxR02G3zDFtd1Z6OIbKrMIu/B7BuzucH/ OdHJDqFOtWmJG5D/tfnOrH/+WwWNTfH+8mq5yI+wbjhvYDedXjI8p3KgwQhSEsdRe3m+ hWiuDaW4UIlnQzAIfsl1g8LRVs224NATBTZiQDKzYz2/9UqZBytpNLd0L//Y4aYeIA8Z P4t12u3jhYlzvoVkJoGzN6A04m64ozuSPoX85Kz/n1c1ANV6HK44UDE++nsi8+gPQ4a2 LOXQ== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id m75-v6si42677002pga.481.2018.11.05.01.19.49; Mon, 05 Nov 2018 01:20:04 -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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1729143AbeKESiG (ORCPT + 99 others); Mon, 5 Nov 2018 13:38:06 -0500 Received: from atrey.karlin.mff.cuni.cz ([195.113.26.193]:46093 "EHLO atrey.karlin.mff.cuni.cz" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727351AbeKESiF (ORCPT ); Mon, 5 Nov 2018 13:38:05 -0500 Received: by atrey.karlin.mff.cuni.cz (Postfix, from userid 512) id 67C2E80805; Mon, 5 Nov 2018 10:19:16 +0100 (CET) Date: Mon, 5 Nov 2018 10:19:18 +0100 From: Pavel Machek To: =?iso-8859-1?Q?Jo=E3o?= Paulo Rechi Vita Cc: "Rafael J . Wysocki" , Len Brown , Hans de Goede , linux-acpi@vger.kernel.org, Daniel Drake , Sebastian Reichel , linux-kernel@vger.kernel.org, linux@endlessm.com, =?iso-8859-1?Q?Jo=E3o?= Paulo Rechi Vita Subject: Re: [PATCH] ACPI / battery: Fix reporting "Not charging" when capacity is 100% Message-ID: <20181105091917.GD4439@amd> References: <20181103065732.12134-1-jprvita@endlessm.com> MIME-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha1; protocol="application/pgp-signature"; boundary="fOHHtNG4YXGJ0yqR" Content-Disposition: inline In-Reply-To: <20181103065732.12134-1-jprvita@endlessm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org --fOHHtNG4YXGJ0yqR Content-Type: text/plain; charset=iso-8859-1 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri 2018-11-02 23:57:32, Jo=E3o Paulo Rechi Vita wrote: > Commit 19fffc8450d4378580a8f019b195c4617083176f fixed reporting > "Discharging" on some machines when AC was connected but the battery was > not charging. But now on these machines the battery status is reported > as "Not charging" even when the battery is fully charged. >=20 > This commit takes the battery capacity into consideration when checking > if "Not charging" should be returned and "Full" is returned when the > capacity is 100%. >=20 > Signed-off-by: Jo=E3o Paulo Rechi Vita We have people trying to modify this and it caused regressions in MATE, IIRC. Plus, I don't think "100% charge" is right test for "battery full". At least on thinkpads, there's configuration option, and it is common _not_ to charge batterry above 95% or so (to increase its lifetime). Pavel > * was plugged in and the device thus did not start a new charge cycle. > */ > if ((battery_ac_is_broken || power_supply_is_system_supplied()) && > - battery->rate_now =3D=3D 0) > + battery->rate_now =3D=3D 0) { > + if (battery->capacity_now && battery->full_charge_capacity && > + battery->capacity_now / battery->full_charge_capacity =3D=3D 1) > + return POWER_SUPPLY_STATUS_FULL; Division? Really? Pavel --=20 (english) http://www.livejournal.com/~pavelmachek (cesky, pictures) http://atrey.karlin.mff.cuni.cz/~pavel/picture/horses/blo= g.html --fOHHtNG4YXGJ0yqR Content-Type: application/pgp-signature; name="signature.asc" Content-Description: Digital signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1 iEYEARECAAYFAlvgCxUACgkQMOfwapXb+vJ5/QCgvEm/0gpEFDo8LrQRTWXV1aBz 3mIAoIgXec2F6lOKyyfYdsxU2iiESeBC =8whT -----END PGP SIGNATURE----- --fOHHtNG4YXGJ0yqR--