Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1899955pxb; Thu, 16 Sep 2021 19:34:16 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxSbx4fpJmdPkli/1vQlUBW7CkNzJDpbSjuf1kbOvG5hEsAT/yoQRmjNIwblPs75vZvjDvv X-Received: by 2002:a92:d38b:: with SMTP id o11mr6194304ilo.310.1631846056515; Thu, 16 Sep 2021 19:34:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631846056; cv=none; d=google.com; s=arc-20160816; b=KUHHCfb9gxbu27cjut2coEkFPcBRR0QvREswiFUl1JWBsjbPkyX2utzcrY55N/dnG1 KpcOg8efTIf5oBKWO1VPkvqf6alzANjWFTFOnhawIWuBux5WpXhV0pP/CAVUFDRnV/d3 pUcdg3Ka9Fqx+KLqSIzCRn24UnjO0xH/5kR0dXx/3IHmLh+6h9GOJe7GisVhvM3k5LQA CaBzDcMhJrowaW8PslR3+vGdYkTnjjCmxWNP20rna8LTQn4IMLAZMNRP17IGikoGj/mG d8uv0aMZ/qWcPlbSrffxi+3ORIWb8K/Hr9MM0neZU4Bi7PA6HIhFOpQUeiiy1YjbpLzA 6dBw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=0ivuq7mvCHfkgN6fqanbSmsEpDk5KsiLfu76ZwZz2i8=; b=Lqyuz3fCeCE08eS8Ab++g48IWKq+1GpQmYudj9gXDt4mfAwkmeJe86c30d1TZwGPUu UvUKIrJR+b6jfZeILg0gqZQBiSgvNusxz08QK7NF1l3YqM0tYO/EJ5FAOoW0qFgcM3xc MlajR1m+SGIlZvUuaoZKp9vRoSX7ZqhPDQ9MD8/ps1uaVjCuZRT4mjAPDyJn6Ur/7xYt B5ozGC/Zn42NFqvrNiLCJWJslpLy/k+tAxld4sKRUEX4T7YW+HgEIMjuKSZ1IS1S6iMd PPbY7hFRW0rTadvgnPE3fECPTYIi7EYu2Wv00Y2LqUy9R6Lb71D81M22Pq9xnLprTFNp BaCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZyN1NNbv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b12si3869950ila.38.2021.09.16.19.34.04; Thu, 16 Sep 2021 19:34:16 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZyN1NNbv; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S244692AbhIPRSD (ORCPT + 99 others); Thu, 16 Sep 2021 13:18:03 -0400 Received: from mail.kernel.org ([198.145.29.99]:37568 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S245477AbhIPRKG (ORCPT ); Thu, 16 Sep 2021 13:10:06 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 8F4C4613E8; Thu, 16 Sep 2021 16:37:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631810263; bh=Ro5hnwtteUQgbUV0dW/07sQ67En5/vCj9MEXfNkuXoM=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZyN1NNbvICQn4zJT52aIKLeMi2tQLY2/qveJnVF59uQqpCdRWcgTD4Xs8xK5pkfnz xu8p2MOGVYon1p+R4pQbZEahK5L7/R/z/hE0KrN9/ygoajwMMDIyEzOd8Pj+AlYwAH pFVahtQFtuTXc9e2BDY50MjRznbgDieimvpjaAMo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Kenneth Albanowski , Dmitry Torokhov , Jiri Kosina , Sasha Levin Subject: [PATCH 5.14 076/432] HID: input: do not report stylus battery state as "full" Date: Thu, 16 Sep 2021 17:57:05 +0200 Message-Id: <20210916155813.362278134@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155810.813340753@linuxfoundation.org> References: <20210916155810.813340753@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Dmitry Torokhov [ Upstream commit f4abaa9eebde334045ed6ac4e564d050f1df3013 ] The power supply states of discharging, charging, full, etc, represent state of charging, not the capacity level of the battery (for which we have a separate property). Current HID usage tables to not allow for expressing charging state of the batteries found in generic styli, so we should simply assume that the battery is discharging even if current capacity is at 100% when battery strength reporting is done via HID interface. In fact, we were doing just that before commit 581c4484769e. This change helps UIs to not mis-represent fully charged batteries in styli as being charging/topping-off. Fixes: 581c4484769e ("HID: input: map digitizer battery usage") Reported-by: Kenneth Albanowski Signed-off-by: Dmitry Torokhov Signed-off-by: Jiri Kosina Signed-off-by: Sasha Levin --- drivers/hid/hid-input.c | 2 -- 1 file changed, 2 deletions(-) diff --git a/drivers/hid/hid-input.c b/drivers/hid/hid-input.c index 4286a51f7f16..4b5ebeacd283 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -419,8 +419,6 @@ static int hidinput_get_battery_property(struct power_supply *psy, if (dev->battery_status == HID_BATTERY_UNKNOWN) val->intval = POWER_SUPPLY_STATUS_UNKNOWN; - else if (dev->battery_capacity == 100) - val->intval = POWER_SUPPLY_STATUS_FULL; else val->intval = POWER_SUPPLY_STATUS_DISCHARGING; break; -- 2.30.2