Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp1522599pxb; Thu, 16 Sep 2021 09:10:50 -0700 (PDT) X-Google-Smtp-Source: ABdhPJx91baSnn7ZLYaEWB0IRVrm9zpZsA5Yau4ltkGa1DbWRbgH2FgE4JQr/sCqPkOzylBSBMnk X-Received: by 2002:a17:906:165a:: with SMTP id n26mr6964347ejd.236.1631808650411; Thu, 16 Sep 2021 09:10:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631808650; cv=none; d=google.com; s=arc-20160816; b=Mt8NHfOojGrXsApMi8RNQfUwUSIibUut8ZAX9VT0Jt1mp9/tYcI3JR5DlPsLZqafAf rSJvqGxeoVPlWCzOV06n/wfAGb0mbzzKijq5iJl6pTCWp8cnH6AwIJrZtrvA1LFzy+yD ncv+D2pTCo+fTGoHhQn4sMaZZKwFjQG7ZDCiKiMD9QUcQxpyThmGgjYq3lvvLveIfh1a JwIEY15CjvsurYHTGuZX4+zv8/zQ26lMWGX3dbVNc3fj3X5fnGSPh+/EHMm87hh35shI SOsOLsVgT4CIJhi9mhjUFhs9H4NJmHrxyutXd2DO1XP1RvHRHjquCeARXZzlZ6WJF7c9 LLmQ== 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=cFeFIkHU2aIafIE1ts0s0WSl/cpvxCHZsShj8cE93a0=; b=ULF3d8xBk6T1Pqy08Y8jJm+QfI/xTGlPiUfzMHjAxGp4TCzscsFZP9HM/QWP6KsoZj HPZQB2rDG4PZ/75v+zIksczB/CaqcF+pKzVldG2yuhvZk+xiyQM0J6/M95jbbv7Sskl0 0w7rlaNB2fP6xQW71MWphSJaA2293uyVcO5ur/bx81PEt14lxUyADMZpRWNOdhf6dygl 9lmq7KgmPVdkwAHxzEU6Ouf1qszQlxbWEpMISAkqT8xHLABY5IDFJy+e0T4/CQsdpsTi BIj4z0MI7L+kF1agtPdMdUnQYnJiJU2KeoDtosPMomXPgNKN+tVQy0Q7xBZED9qDIYBg i6mA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=ZHT7Okyt; 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 d1si3717387ede.162.2021.09.16.09.10.25; Thu, 16 Sep 2021 09:10:50 -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=ZHT7Okyt; 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 S232154AbhIPQJi (ORCPT + 99 others); Thu, 16 Sep 2021 12:09:38 -0400 Received: from mail.kernel.org ([198.145.29.99]:46666 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233083AbhIPQHE (ORCPT ); Thu, 16 Sep 2021 12:07:04 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id D443961263; Thu, 16 Sep 2021 16:05:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1631808343; bh=Gu7JCVohVotJTRucFHdqrqHjRRLjk7V4vTgNo7ThTPU=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=ZHT7OkytrL6bYj3UGayFwHlhhjgiiI9vDHpq+FU2m4M0VMgxQwdLgyB/rpMcnIhA8 Q7kEV2DoOw3UhDwDcoIdwJJNKtV2nEy+NX/mvzLyil2GoffnVmr7kOm+13K+XmW43V eFMbVYwvgY+Y5DtQxQPh6iy1hb8ARjdTBM5LZy1o= 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.10 054/306] HID: input: do not report stylus battery state as "full" Date: Thu, 16 Sep 2021 17:56:39 +0200 Message-Id: <20210916155755.790110920@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210916155753.903069397@linuxfoundation.org> References: <20210916155753.903069397@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 d1ab2dccf6fd..580d378342c4 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -415,8 +415,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