From: Matthew Schwartz <matthew.schwartz@linux.dev>
To: Hans de Goede <hansg@kernel.org>
Cc: pmarheine@chromium.org, Sebastian Reichel <sre@kernel.org>,
regressions@lists.linux.dev, stable@vger.kernel.org,
rafael.j.wysocki@intel.com, linux-acpi@vger.kernel.org
Subject: Re: [REGRESSION] - Multiple userspace implementations of battery estimate broken after "ACPI: battery: negate current when discharging"
Date: Thu, 3 Jul 2025 08:51:10 -0700 [thread overview]
Message-ID: <10A90071-DC0B-4860-845F-556A33FC79BC@linux.dev> (raw)
In-Reply-To: <84dfa466-d201-4a51-8794-6c64568bec95@kernel.org>
> On Jul 3, 2025, at 7:47 AM, Hans de Goede <hansg@kernel.org> wrote:
>
> Hi Matthew,
>
>> On 3-Jul-25 3:54 AM, Matthew Schwartz wrote:
>> Hello,
>>
>> I installed kernel 6.15.4 to find that my battery estimate on my handheld gaming device was completely inaccurate, instead giving negative values and an unknown estimated battery life in multiple places.
>>
>> After bisecting, I landed on "ACPI: battery: negate current when discharging” as the bad commit. This commit breaks not one but several userspace implementations of battery monitoring: Steam and MangoHud. Perhaps it breaks more, but those are the two I have noticed so far.
>
> Thank you for reporting this.
>
> As Rafael already indicated this patch will need to be reverted to
> unbreak userspace.
>
> But, the patch was actually doing the right thing, according to:
>
> Documentation/ABI/testing/sysfs-class-power
>
> What: /sys/class/power_supply/<supply_name>/current_avg
> Date: May 2007
> Contact: linux-pm@vger.kernel.org
> Description:
> Battery:
> ...
> Access: Read
>
> Valid values: Represented in microamps. Negative values are
> used for discharging batteries, positive values for charging
> batteries and for USB IBUS current.
>
> (and the same for current_now)
>
> and there are many power_supply fuel-gauge drivers (1) under
> drivers/power/supply/ which do adhere to this specification
> and report a negative current for discharging.
>
> So if any of the userspace consumers of this API you mention
> were to run on hw with these drivers the same problem will
> be hit. Can you please file bugs against these userspace
> projects so that they can fix this?
Sure, I filed a bug with MangoHud last night about the kernel change breaking the current battery logic so I will mention this concern when updating that issue, and I will also file a new bug with Steam.
Thanks,
Matt
>
> Regards,
>
> Hans
>
>
>
> 1) For directly accessing fuel-gauge chips on devices where these
> are directly accessible instead of being exposed through ACPI
next prev parent reply other threads:[~2025-07-03 15:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-07-03 1:54 [REGRESSION] - Multiple userspace implementations of battery estimate broken after "ACPI: battery: negate current when discharging" Matthew Schwartz
2025-07-03 10:58 ` Rafael J. Wysocki
2025-07-03 14:47 ` Hans de Goede
2025-07-03 15:51 ` Matthew Schwartz [this message]
2025-07-06 22:27 ` Sebastian Reichel
2025-07-04 4:56 ` Peter Marheine
2025-07-04 8:47 ` Hans de Goede
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=10A90071-DC0B-4860-845F-556A33FC79BC@linux.dev \
--to=matthew.schwartz@linux.dev \
--cc=hansg@kernel.org \
--cc=linux-acpi@vger.kernel.org \
--cc=pmarheine@chromium.org \
--cc=rafael.j.wysocki@intel.com \
--cc=regressions@lists.linux.dev \
--cc=sre@kernel.org \
--cc=stable@vger.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;
as well as URLs for NNTP newsgroup(s).