mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: "Ata İlhan Köktürk" <atailhan2006@gmail.com>
To: rafael@kernel.org
Cc: lenb@kernel.org, linux-acpi@vger.kernel.org,
	linux-kernel@vger.kernel.org,
	"Ata İlhan Köktürk" <atailhan2006@gmail.com>
Subject: [PATCH] ACPI: battery: fix incorrect charging status when current is zero
Date: Thu, 29 Jan 2026 17:48:56 +0300	[thread overview]
Message-ID: <20260129144856.43058-1-atailhan2006@gmail.com> (raw)

On some laptops, such as the Huawei Matebook series
the Embedded Controller continues to report "Charging"
status even when the charge threshold is
reached and no current is being drawn.

This incorrect reporting prevents the
system from switching to battery
power profiles, leading to significantly
higher power consumption (e.g., 18W
instead of 7W during browsing) and
broken battery remaining time estimation.

Validate the "Charging" state
by checking if rate_now is zero. If the
hardware reports charging but the current is zero,
report "Not Charging" to user space.

Signed-off-by: Ata İlhan Köktürk <atailhan2006@gmail.com>
---
 drivers/acpi/battery.c | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 34181fa52..b4ba8085f 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -211,7 +211,13 @@ static int acpi_battery_get_property(struct power_supply *psy,
 		if (battery->state & ACPI_BATTERY_STATE_DISCHARGING)
 			val->intval = acpi_battery_handle_discharging(battery);
 		else if (battery->state & ACPI_BATTERY_STATE_CHARGING)
-			val->intval = POWER_SUPPLY_STATUS_CHARGING;
+			/* Check if we can fetch ACPI current info */
+			if (battery->rate_now != ACPI_BATTERY_VALUE_UNKNOWN &&
+				battery->rate_now == 0)
+				/* On charge but no current (0W/0mA) */
+				val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
+			else
+				val->intval = POWER_SUPPLY_STATUS_CHARGING;
 		else if (battery->state & ACPI_BATTERY_STATE_CHARGE_LIMITING)
 			val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
 		else if (acpi_battery_is_charged(battery))
-- 
2.43.0


             reply	other threads:[~2026-01-29 14:49 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-01-29 14:48 Ata İlhan Köktürk [this message]
2026-02-01 12:50 ` Rafael J. Wysocki

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20260129144856.43058-1-atailhan2006@gmail.com \
    --to=atailhan2006@gmail.com \
    --cc=lenb@kernel.org \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=rafael@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®