Received: by 2002:a05:6520:4d:b0:139:a872:a4c9 with SMTP id i13csp2566072lkm; Mon, 20 Sep 2021 18:52:45 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxUdwk91aX5IrU1kf/HgEM7a3C/3lyKW1P5+KUVDj7XzJAnIitEaz1hspcKaqANxFcGGZcT X-Received: by 2002:a5e:c018:: with SMTP id u24mr17294184iol.129.1632188769152; Mon, 20 Sep 2021 18:46:09 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632188769; cv=none; d=google.com; s=arc-20160816; b=aYOijrqsM5QtWTYKJYKW0D+pfW6udxyi/sb27C3w4IQt8mFXMB1RORCdn2ATZpoMxe Kl5axnUmvnTq8xFKUCHn4JHEc5UI4DTf6aU8qY5qW9h9rA5dl+K7lqMtmPhnTKSNDraP NkPor2D045EopmAU6GJTCndNVZXenia6mI0WsvfTWAuYKBNhaqfIZ4T9I9eQVs9x1bdv 3WImaaU7Wlv4ZxmJEGh1GTdBqw2zxKIcpWNLup/O1ppBG6bToOQksR0HPe8byt2U+veg 1CseVwErzadRksadTULwn0H0bOJmaFyQiemLHBYiGwJra/kvOUjQZQAqAG21P8jFG0Lc FZTw== 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=aFZm5yGSEio2k2HszZpdUPLscabjJgU3S9eqWNx2zmc=; b=eBUKZgcY1szlTvnwLyOqLeVRxIoXfI1QfaTq9QDV2t03vfRJtHZhsP6WbWfVDCtSF8 7Gd/z7fO+FpExaWRU4m7XaGfkd8xZdXtlYHoo2gG9n0ppHtye3H2nI36u+7IpwWEK0jw OW1/TVGhNyozUszf2V2HSYL3cqXetyv/hxyy1fYFw/RHUaMTkxnqh7Kf0Ppxh0tz22QO GuW9RdLLzxCOi5TWQz0RZ/uQXofUlRJZa25ge1LssegoixBG4XPryjy7/C+vS3qBvGPR wqXWgyBUcDwy/7jTztcl36hFgu5r6MQOcSR2izQiP8EVjzTaHY3DuGgmYCQf1zKFSrxh TsxQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=xTHos39k; 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 o8si360249ilu.166.2021.09.20.18.45.58; Mon, 20 Sep 2021 18:46:09 -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=xTHos39k; 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 S245206AbhITRXL (ORCPT + 99 others); Mon, 20 Sep 2021 13:23:11 -0400 Received: from mail.kernel.org ([198.145.29.99]:49392 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1347122AbhITRU5 (ORCPT ); Mon, 20 Sep 2021 13:20:57 -0400 Received: by mail.kernel.org (Postfix) with ESMTPSA id 1D83761A61; Mon, 20 Sep 2021 17:00:45 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1632157246; bh=6jRHIV4Zis04KDtLVnpYg/lDv5pWhNekpe8VIykgC+E=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=xTHos39kvV7f6lh9CvJ3+JQnP2TMmW3711nbFHe2h0oLjaY0/G/qZ263u3jU/o26X ecinakm8uhXlxszGznhDc7QyuNK627j+wCcw2qnFe4B7+YNyhr+RbKgC7bynthA+4T h3IBBQ+Ukd/PY9QtgYWiJiRLEGL1Qord5NDKk6hI= 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 4.14 121/217] HID: input: do not report stylus battery state as "full" Date: Mon, 20 Sep 2021 18:42:22 +0200 Message-Id: <20210920163928.760467060@linuxfoundation.org> X-Mailer: git-send-email 2.33.0 In-Reply-To: <20210920163924.591371269@linuxfoundation.org> References: <20210920163924.591371269@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 0e63cedcc3b5..96bf221ba572 100644 --- a/drivers/hid/hid-input.c +++ b/drivers/hid/hid-input.c @@ -425,8 +425,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