Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp2916695imu; Sun, 11 Nov 2018 03:57:51 -0800 (PST) X-Google-Smtp-Source: AJdET5fZrrSsmxasuWF9y4aDsHYGLfsLPYsiZZ2AXlVcJXQCSYrkeNPH6RdWuzEj6n6ixuAYYjUn X-Received: by 2002:a17:902:8486:: with SMTP id c6-v6mr15521844plo.119.1541937471222; Sun, 11 Nov 2018 03:57:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1541937471; cv=none; d=google.com; s=arc-20160816; b=QzJvdhdlEqqrvDYDEvYrA+OiNdFtzb9P0G5He1eXt3FiojdwlU9mCcL/CsZPZ0ao7J 8EKWYgX7hNtsjpb1QV/6r4El2ExLr9g1friz/B7KQmbUCn0HKbGO5aA2e+t43Z5JzcPl Yk3Kh5unNlUdGA0cwim9gKfuDJQTStvB6oZ8/YQH6VnIGvt0xy0XFnAQGNblnVcTe1+s hMKjLQbMcqHrpel+UlmPCZ+R1Q1I4KPiy0Mi+TSSSkUS5UZIVegnR524tsO6Ya8N1Xrg gRJZPZ+l9rnHxY/hqX1+dpxjJicGk8BKOEyrm4LlPdT9vboUeP9iKJ6yTJ5W17oXCA4U VkOA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:from:references:cc:to:subject; bh=6tF8O2vAgtqwLVdss95ldjlv+6Xr8yAgnMoHEZdpBW4=; b=CdVtg4xVO7oqWoKChWVhm+sG6+JUusrrfhxAvRukttpnRLHHWPjeGQjr2TCDUixU8F ikUvReSq7ZbY4MZQ69Zgbhor+GMSL1V1qVhpjb6jMqK2OgIpQdKHDjOq2XoV/RDJL0CX +EPMdstLmB32TFVHsCAcGWVkzIpI+UMttpdycQrkCpZC+wkrVhmIlKcuJj1flyOeDcng QeBn0pUytkqwkSISvPMua8clAasNqjJBnKp/+1//seTyIE3hkBe0c7wVix01Xeje2Qde 7fmUHMFLKAWkMfwldC0oMVXMNuTwIVTxpx4UlHHncyLro6ZtB/RRPEYCRPNgU+U9rVRS DTAQ== 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=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id h190-v6si15200048pfb.206.2018.11.11.03.57.36; Sun, 11 Nov 2018 03:57:51 -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=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727732AbeKKVpi (ORCPT + 99 others); Sun, 11 Nov 2018 16:45:38 -0500 Received: from mail-ed1-f65.google.com ([209.85.208.65]:40737 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727492AbeKKVph (ORCPT ); Sun, 11 Nov 2018 16:45:37 -0500 Received: by mail-ed1-f65.google.com with SMTP id d3so4556116edx.7 for ; Sun, 11 Nov 2018 03:57:14 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:to:cc:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=6tF8O2vAgtqwLVdss95ldjlv+6Xr8yAgnMoHEZdpBW4=; b=ni2cyW/JCkx+8KKLUBUPhHkaSHRMrUqsi5ztm2T45gB5lXx9Z7zbDBluig4kmI9gWe aV3VyYoXMtokOJ+5bRef+C0x+XpYt6H5hvBrYtYia4xkPOEDP4208x3baPzELH6lFPlG sv94GaFo2WlZV4Mw9vXLUuTwSWLWu/Py48hmiS+AvPvvia95211FlOoAMGjNTXLBmIDX Pzg+AQwTBcT6MVhtAwdRd7gnbASLISBJjdpgikt6z5RIj9RmZBXFl+tbRDgetfNOZquU Ca2ZgBNy8NunsdU7ilcnxpsIicoBPoe4CLXV1TJFf5jqoKs9S/0+JQop3jtB7mf6b5Pe cz8A== X-Gm-Message-State: AGRZ1gK/3LQr3SVYZxQcf1wWWut9IatTiH0aRihDR/RIX1OFOwK315vD NzdvSsHXAqsqNa6bPKOn3+LirFZyCKE= X-Received: by 2002:aa7:cfc3:: with SMTP id r3-v6mr9119467edy.208.1541937434135; Sun, 11 Nov 2018 03:57:14 -0800 (PST) Received: from dhcp-45-79.space.revspace.nl ([2a01:4f8:1c0c:6c86:74cc:2527:1001:2c5e]) by smtp.gmail.com with ESMTPSA id w6-v6sm3387207eds.54.2018.11.11.03.57.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Nov 2018 03:57:13 -0800 (PST) Subject: Re: [PATCH] ACPI / battery: Fix reporting "Not charging" when capacity is 100% To: Daniel Drake , pavel@ucw.cz Cc: "Rafael J. Wysocki" , Len Brown , ACPI Devel Maling List , sebastian.reichel@collabora.co.uk, Linux Kernel , linux@endlessm.com, =?UTF-8?Q?Jo=c3=a3o_Paulo_Rechi_Vita?= , =?UTF-8?Q?Jo=c3=a3o_Paulo_Rechi_Vita?= References: <20181103065732.12134-1-jprvita@endlessm.com> <20181105091917.GD4439@amd> From: Hans de Goede Message-ID: Date: Sun, 11 Nov 2018 12:57:12 +0100 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:60.0) Gecko/20100101 Thunderbird/60.3.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi, On 11/7/18 5:53 AM, Daniel Drake wrote: > On Mon, Nov 5, 2018 at 1:19 AM Pavel Machek wrote: >> 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). > > Hans also touched on this area in his response: > >> As for this kernel-side fix I do not believe that fixing thus in >> the kernel is the right thing to do. We try to stay away from >> heuristics using full_charge_capacity in the kernel since that >> is not really reliable / deterministic. > > I'm not fully convinced by this argument though. > > The ACPI spec is not very clear on what conditions you should apply to > decide when the battery is full. Instead, ACPI seems to provide a > pretty decent amount of data, and the decision about whether to > interpret that as "battery full" is left for consumers. Right, but in this case the "discharging" status bit is explicitly set, to me it feels wrong to report "full", when the firmware is reporting "discharging" IMHO, at best we are "not charging" (on AC, below the threshold where a new charge cycle starts) and that is what we are currently reporting. Anu heurstics to decide that "not charging" is close enough to full to report it as full to the user belongs in userspace IMHO. Anyways this ultimately is Rafael's call. If Rafael is ok with this patch then I would like to see Pavel's comment addressed and otherwise it is fine with me. Note that we will still often get the case where a laptop is charged, reports full, is unplugged for 5 minutes and then replugged and then reports a capacity of 97% combined with "not charging", so we will still need to fix userspace to handle this. Rafael, what is your take on this? Regards, Hans