* [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck
@ 2026-10-14 20:45 Umang Jain
2026-10-14 20:45 ` [PATCH v3 1/2] acpi: battery: Introduce Valve steamdeck devices quirk Umang Jain
` (2 more replies)
0 siblings, 3 replies; 7+ messages in thread
From: Umang Jain @ 2026-10-14 20:45 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown
Cc: linux-acpi, linux-kernel, kernel-dev, Umang Jain
Short series to query Battery charge time ("_BCT") from ACPI tables
for steamdeck devices.
Patch 1/2 introduces the steamdeck device battery quirk.
Patch 2/2 handles the case where steamdeck devices can report "Charging"
even when low power PSU is connected which is discharging the device.
Changes in v3:
- Only query BCT method for the steamdeck quirk
- Drop charge_time member from battery object
- check for returned value from acpi_evaluate_integer for max
ACPI_UINT32_MAX bounds as per the spec
Changes in v2:
- comment improvements
- split off BCT method handling into separate patch
- https://lore.kernel.org/all/20260923082932.1049270-1-uajain@igalia.com/
v1:
https://lore.kernel.org/all/20260918135628.2322188-1-uajain@igalia.com/
Umang Jain (2):
acpi: battery: Introduce Valve steamdeck devices quirk
acpi: battery: Read Battery charge time for Steamdeck devices
drivers/acpi/battery.c | 45 +++++++++++++++++++++++++++++++++++++++++-
1 file changed, 44 insertions(+), 1 deletion(-)
--
2.55.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 1/2] acpi: battery: Introduce Valve steamdeck devices quirk
2026-10-14 20:45 [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck Umang Jain
@ 2026-10-14 20:45 ` Umang Jain
2026-10-14 20:45 ` [PATCH v3 2/2] acpi: battery: Read Battery charge time for Steamdeck devices Umang Jain
2026-11-06 15:41 ` [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck Umang Jain
2 siblings, 0 replies; 7+ messages in thread
From: Umang Jain @ 2026-10-14 20:45 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown
Cc: linux-acpi, linux-kernel, kernel-dev, Umang Jain
Introduce a battery quirk for Valve Steamdeck devices
ACPI_BATTERY_QUIRK_VALVE_STEAMDECK. This is required to detect
if a low-power supply unit is connected to the device, which can
report charging status through sysfs as "charging", even though in
reality, it is discharging. We shall read Battery Charge Time ("_BCT")
information to handle these cases, in a subsequent commit.
Signed-off-by: Umang Jain <uajain@igalia.com>
---
drivers/acpi/battery.c | 20 ++++++++++++++++++++
1 file changed, 20 insertions(+)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 670853ec3a4d..fa20900bea0e 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -94,6 +94,14 @@ enum {
* on a full charge, but showing degradation in full charge cap.
*/
ACPI_BATTERY_QUIRK_DEGRADED_FULL_CHARGE,
+ /*
+ * Valve steamdeck devices can get discharged even when battery status
+ * is charging. This happens typically when low power supply unit is
+ * connected. To accurately determine this scenario, we shall read
+ * battery charge time ("_BCT"). This is the key differentiator to
+ * determine whether the steamdeck is actually charging or not.
+ */
+ ACPI_BATTERY_QUIRK_VALVE_STEAMDECK,
};
struct acpi_battery {
@@ -1057,6 +1065,18 @@ static void acpi_battery_quirks(struct acpi_battery *battery)
set_bit(ACPI_BATTERY_QUIRK_DEGRADED_FULL_CHARGE, &battery->flags);
battery->capacity_now = battery->full_charge_capacity;
}
+
+ if (test_bit(ACPI_BATTERY_QUIRK_VALVE_STEAMDECK, &battery->flags))
+ return;
+
+ if (dmi_name_in_vendors("Valve")) {
+ const char *name;
+
+ name = dmi_get_system_info(DMI_PRODUCT_NAME);
+ if ((name && (!strncmp("Jupiter", name, 7))) ||
+ (name && (!strncmp("Galileo", name, 7))))
+ set_bit(ACPI_BATTERY_QUIRK_VALVE_STEAMDECK, &battery->flags);
+ }
}
static int acpi_battery_update(struct acpi_battery *battery, bool resume)
--
2.55.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v3 2/2] acpi: battery: Read Battery charge time for Steamdeck devices
2026-10-14 20:45 [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck Umang Jain
2026-10-14 20:45 ` [PATCH v3 1/2] acpi: battery: Introduce Valve steamdeck devices quirk Umang Jain
@ 2026-10-14 20:45 ` Umang Jain
2026-11-09 18:22 ` Rafael J. Wysocki (Intel)
2026-11-06 15:41 ` [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck Umang Jain
2 siblings, 1 reply; 7+ messages in thread
From: Umang Jain @ 2026-10-14 20:45 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown
Cc: linux-acpi, linux-kernel, kernel-dev, Umang Jain
Valve steamdeck devices can report battery status as
charging, even when low-powered power supply is connected
to the device. The battery status is reported as charging
through sysfs, even though in reality, it is discharging.
To handle this case, read out Battery charge time ("_BCT")
as it is reported accurately on these devices, hence use that
information for report charging vs discharging status.
Battery charge time ("_BCT") with an eligible power supply unit
will have valid values whereas with a low-powered supply unit,
it shall report ACPI_BATTERY_VALUE_UNKNOWN. Use this as a
differentiator to determine, whether the battery of steamdeck
devices is really charging or not.
Signed-off-by: Umang Jain <uajain@igalia.com>
---
drivers/acpi/battery.c | 25 ++++++++++++++++++++++++-
1 file changed, 24 insertions(+), 1 deletion(-)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index fa20900bea0e..b7818695b6cb 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -242,7 +242,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
: POWER_SUPPLY_STATUS_DISCHARGING;
return 0;
}
- else if (battery->state & ACPI_BATTERY_STATE_CHARGING)
+ else if (battery->state & ACPI_BATTERY_STATE_CHARGING) {
/* Check the rate and capacity to validate the status. */
if (!acpi_battery_is_full(battery) ||
(battery->rate_now != ACPI_BATTERY_VALUE_UNKNOWN &&
@@ -252,6 +252,29 @@ static int acpi_battery_get_property(struct power_supply *psy,
/* Full and zero rate. */
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
}
+
+ /*
+ * For Valve Steamdeck devices, evaluate _BCT to determine
+ * if we are really charging.
+ */
+ if (test_bit(ACPI_BATTERY_QUIRK_VALVE_STEAMDECK, &battery->flags) &&
+ acpi_has_method(battery->device->handle, "_BCT")) {
+ unsigned long long bct;
+ acpi_status status;
+ union acpi_object arg0 = { ACPI_TYPE_INTEGER };
+ struct acpi_object_list args = { 1, &arg0 };
+
+ arg0.integer.value = 100;
+ status = acpi_evaluate_integer(battery->device->handle, "_BCT",
+ &args, &bct);
+ if (ACPI_FAILURE(status) || bct > ACPI_UINT32_MAX)
+ acpi_handle_info(battery->device->handle,
+ "_BCT evaluation failed: %s",
+ acpi_format_exception(status));
+ else if (bct == ACPI_BATTERY_VALUE_UNKNOWN)
+ val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
+ }
+ }
else if (battery->state & ACPI_BATTERY_STATE_CHARGE_LIMITING)
val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
else if (acpi_battery_is_charged(battery))
--
2.55.0
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck
2026-10-14 20:45 [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck Umang Jain
2026-10-14 20:45 ` [PATCH v3 1/2] acpi: battery: Introduce Valve steamdeck devices quirk Umang Jain
2026-10-14 20:45 ` [PATCH v3 2/2] acpi: battery: Read Battery charge time for Steamdeck devices Umang Jain
@ 2026-11-06 15:41 ` Umang Jain
2026-11-06 16:13 ` Rafael J. Wysocki (Intel)
2 siblings, 1 reply; 7+ messages in thread
From: Umang Jain @ 2026-11-06 15:41 UTC (permalink / raw)
To: Rafael J . Wysocki, Len Brown; +Cc: linux-acpi, linux-kernel
Hello,
Gentle ping for review?
On 2026-10-14 20:45, Umang Jain wrote:
> Short series to query Battery charge time ("_BCT") from ACPI tables
> for steamdeck devices.
>
> Patch 1/2 introduces the steamdeck device battery quirk.
> Patch 2/2 handles the case where steamdeck devices can report "Charging"
> even when low power PSU is connected which is discharging the device.
>
> Changes in v3:
> - Only query BCT method for the steamdeck quirk
> - Drop charge_time member from battery object
> - check for returned value from acpi_evaluate_integer for max
> ACPI_UINT32_MAX bounds as per the spec
>
> Changes in v2:
> - comment improvements
> - split off BCT method handling into separate patch
> - https://lore.kernel.org/all/20260923082932.1049270-1-uajain@igalia.com/
>
> v1:
> https://lore.kernel.org/all/20260918135628.2322188-1-uajain@igalia.com/
>
>
> Umang Jain (2):
> acpi: battery: Introduce Valve steamdeck devices quirk
> acpi: battery: Read Battery charge time for Steamdeck devices
>
> drivers/acpi/battery.c | 45 +++++++++++++++++++++++++++++++++++++++++-
> 1 file changed, 44 insertions(+), 1 deletion(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck
2026-11-06 15:41 ` [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck Umang Jain
@ 2026-11-06 16:13 ` Rafael J. Wysocki (Intel)
0 siblings, 0 replies; 7+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-11-06 16:13 UTC (permalink / raw)
To: Umang Jain; +Cc: linux-acpi, linux-kernel
On Fri, Nov 6, 2026 at 4:41 PM Umang Jain <uajain@igalia.com> wrote:
>
> Hello,
>
> Gentle ping for review?
I'd suggest finding somebody near you who can give you some feedback
on the list instead of sending messages like this.
The patch is in my queue of things to look at, FWIW.
Thanks!
> On 2026-10-14 20:45, Umang Jain wrote:
> > Short series to query Battery charge time ("_BCT") from ACPI tables
> > for steamdeck devices.
> >
> > Patch 1/2 introduces the steamdeck device battery quirk.
> > Patch 2/2 handles the case where steamdeck devices can report "Charging"
> > even when low power PSU is connected which is discharging the device.
> >
> > Changes in v3:
> > - Only query BCT method for the steamdeck quirk
> > - Drop charge_time member from battery object
> > - check for returned value from acpi_evaluate_integer for max
> > ACPI_UINT32_MAX bounds as per the spec
> >
> > Changes in v2:
> > - comment improvements
> > - split off BCT method handling into separate patch
> > - https://lore.kernel.org/all/20260923082932.1049270-1-uajain@igalia.com/
> >
> > v1:
> > https://lore.kernel.org/all/20260918135628.2322188-1-uajain@igalia.com/
> >
> >
> > Umang Jain (2):
> > acpi: battery: Introduce Valve steamdeck devices quirk
> > acpi: battery: Read Battery charge time for Steamdeck devices
> >
> > drivers/acpi/battery.c | 45 +++++++++++++++++++++++++++++++++++++++++-
> > 1 file changed, 44 insertions(+), 1 deletion(-)
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/2] acpi: battery: Read Battery charge time for Steamdeck devices
2026-10-14 20:45 ` [PATCH v3 2/2] acpi: battery: Read Battery charge time for Steamdeck devices Umang Jain
@ 2026-11-09 18:22 ` Rafael J. Wysocki (Intel)
2026-11-13 17:30 ` Umang Jain
0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki (Intel) @ 2026-11-09 18:22 UTC (permalink / raw)
To: Umang Jain
Cc: Rafael J . Wysocki, Len Brown, linux-acpi, linux-kernel, kernel-dev
On Wed, Oct 14, 2026 at 10:44 PM Umang Jain <uajain@igalia.com> wrote:
>
> Valve steamdeck devices can report battery status as
> charging, even when low-powered power supply is connected
> to the device. The battery status is reported as charging
> through sysfs, even though in reality, it is discharging.
>
> To handle this case, read out Battery charge time ("_BCT")
> as it is reported accurately on these devices, hence use that
> information for report charging vs discharging status.
> Battery charge time ("_BCT") with an eligible power supply unit
> will have valid values whereas with a low-powered supply unit,
> it shall report ACPI_BATTERY_VALUE_UNKNOWN. Use this as a
> differentiator to determine, whether the battery of steamdeck
> devices is really charging or not.
>
> Signed-off-by: Umang Jain <uajain@igalia.com>
I think that it would be better to merge this patch with the [1/2].
> ---
> drivers/acpi/battery.c | 25 ++++++++++++++++++++++++-
> 1 file changed, 24 insertions(+), 1 deletion(-)
>
> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
> index fa20900bea0e..b7818695b6cb 100644
> --- a/drivers/acpi/battery.c
> +++ b/drivers/acpi/battery.c
> @@ -242,7 +242,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
> : POWER_SUPPLY_STATUS_DISCHARGING;
> return 0;
> }
> - else if (battery->state & ACPI_BATTERY_STATE_CHARGING)
> + else if (battery->state & ACPI_BATTERY_STATE_CHARGING) {
> /* Check the rate and capacity to validate the status. */
> if (!acpi_battery_is_full(battery) ||
> (battery->rate_now != ACPI_BATTERY_VALUE_UNKNOWN &&
> @@ -252,6 +252,29 @@ static int acpi_battery_get_property(struct power_supply *psy,
> /* Full and zero rate. */
> val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
> }
> +
> + /*
> + * For Valve Steamdeck devices, evaluate _BCT to determine
> + * if we are really charging.
> + */
> + if (test_bit(ACPI_BATTERY_QUIRK_VALVE_STEAMDECK, &battery->flags) &&
> + acpi_has_method(battery->device->handle, "_BCT")) {
Can you check the _BCT presence at the time when the quirk bit is set
and avoid setting the bit when _BCT is not present? That would allow
you to just test the bit here.
> + unsigned long long bct;
> + acpi_status status;
> + union acpi_object arg0 = { ACPI_TYPE_INTEGER };
> + struct acpi_object_list args = { 1, &arg0 };
> +
> + arg0.integer.value = 100;
> + status = acpi_evaluate_integer(battery->device->handle, "_BCT",
> + &args, &bct);
> + if (ACPI_FAILURE(status) || bct > ACPI_UINT32_MAX)
> + acpi_handle_info(battery->device->handle,
This should be acpi_handle_debug(), but I'm not sure if this message
is interesting at all, especially if _BCT fails every time. Also, it
may be confusing in the bct > ACPI_UINT32_MAX case because it may
print "success" then.
> + "_BCT evaluation failed: %s",
> + acpi_format_exception(status));
> + else if (bct == ACPI_BATTERY_VALUE_UNKNOWN)
> + val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
> + }
> + }
> else if (battery->state & ACPI_BATTERY_STATE_CHARGE_LIMITING)
> val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
> else if (acpi_battery_is_charged(battery))
> --
^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH v3 2/2] acpi: battery: Read Battery charge time for Steamdeck devices
2026-11-09 18:22 ` Rafael J. Wysocki (Intel)
@ 2026-11-13 17:30 ` Umang Jain
0 siblings, 0 replies; 7+ messages in thread
From: Umang Jain @ 2026-11-13 17:30 UTC (permalink / raw)
To: Rafael J. Wysocki (Intel); +Cc: Len Brown, linux-acpi, linux-kernel, kernel-dev
Hi Rafael,
Thanks for the review
On 2026-11-09 18:22, Rafael J. Wysocki (Intel) wrote:
> On Wed, Oct 14, 2026 at 10:44 PM Umang Jain <uajain@igalia.com> wrote:
>>
>> Valve steamdeck devices can report battery status as
>> charging, even when low-powered power supply is connected
>> to the device. The battery status is reported as charging
>> through sysfs, even though in reality, it is discharging.
>>
>> To handle this case, read out Battery charge time ("_BCT")
>> as it is reported accurately on these devices, hence use that
>> information for report charging vs discharging status.
>> Battery charge time ("_BCT") with an eligible power supply unit
>> will have valid values whereas with a low-powered supply unit,
>> it shall report ACPI_BATTERY_VALUE_UNKNOWN. Use this as a
>> differentiator to determine, whether the battery of steamdeck
>> devices is really charging or not.
>>
>> Signed-off-by: Umang Jain <uajain@igalia.com>
>
> I think that it would be better to merge this patch with the [1/2].
>
>> ---
>> drivers/acpi/battery.c | 25 ++++++++++++++++++++++++-
>> 1 file changed, 24 insertions(+), 1 deletion(-)
>>
>> diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
>> index fa20900bea0e..b7818695b6cb 100644
>> --- a/drivers/acpi/battery.c
>> +++ b/drivers/acpi/battery.c
>> @@ -242,7 +242,7 @@ static int acpi_battery_get_property(struct power_supply *psy,
>> : POWER_SUPPLY_STATUS_DISCHARGING;
>> return 0;
>> }
>> - else if (battery->state & ACPI_BATTERY_STATE_CHARGING)
>> + else if (battery->state & ACPI_BATTERY_STATE_CHARGING) {
>> /* Check the rate and capacity to validate the status. */
>> if (!acpi_battery_is_full(battery) ||
>> (battery->rate_now != ACPI_BATTERY_VALUE_UNKNOWN &&
>> @@ -252,6 +252,29 @@ static int acpi_battery_get_property(struct power_supply *psy,
>> /* Full and zero rate. */
>> val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
>> }
>> +
>> + /*
>> + * For Valve Steamdeck devices, evaluate _BCT to determine
>> + * if we are really charging.
>> + */
>> + if (test_bit(ACPI_BATTERY_QUIRK_VALVE_STEAMDECK, &battery->flags) &&
>> + acpi_has_method(battery->device->handle, "_BCT")) {
>
> Can you check the _BCT presence at the time when the quirk bit is set
> and avoid setting the bit when _BCT is not present? That would allow
> you to just test the bit here.
>
>> + unsigned long long bct;
>> + acpi_status status;
>> + union acpi_object arg0 = { ACPI_TYPE_INTEGER };
>> + struct acpi_object_list args = { 1, &arg0 };
>> +
>> + arg0.integer.value = 100;
>> + status = acpi_evaluate_integer(battery->device->handle, "_BCT",
>> + &args, &bct);
>> + if (ACPI_FAILURE(status) || bct > ACPI_UINT32_MAX)
>> + acpi_handle_info(battery->device->handle,
>
> This should be acpi_handle_debug(), but I'm not sure if this message
> is interesting at all, especially if _BCT fails every time. Also, it
> may be confusing in the bct > ACPI_UINT32_MAX case because it may
> print "success" then.
Agree with the ACPI_UINT32_MAX comment. I would like to keep the message
with acpi_handle_debug and split the if branch to handle the bct >
ACPI_UINT32_MAX separately. In this case, I won't print the
acpi_format_exception(status) and simply write that bct value is just
invalid. How does that sound?
Thanks.
>
>> + "_BCT evaluation failed: %s",
>> + acpi_format_exception(status));
>> + else if (bct == ACPI_BATTERY_VALUE_UNKNOWN)
>> + val->intval = POWER_SUPPLY_STATUS_DISCHARGING;
>> + }
>> + }
>> else if (battery->state & ACPI_BATTERY_STATE_CHARGE_LIMITING)
>> val->intval = POWER_SUPPLY_STATUS_NOT_CHARGING;
>> else if (acpi_battery_is_charged(battery))
>> --
^ permalink raw reply [flat|nested] 7+ messages in thread
end of thread, other threads:[~2026-11-13 17:30 UTC | newest]
Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2026-10-14 20:45 [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck Umang Jain
2026-10-14 20:45 ` [PATCH v3 1/2] acpi: battery: Introduce Valve steamdeck devices quirk Umang Jain
2026-10-14 20:45 ` [PATCH v3 2/2] acpi: battery: Read Battery charge time for Steamdeck devices Umang Jain
2026-11-09 18:22 ` Rafael J. Wysocki (Intel)
2026-11-13 17:30 ` Umang Jain
2026-11-06 15:41 ` [PATCH v3 0/2] acpi: battery: Query BCT method for steamdeck Umang Jain
2026-11-06 16:13 ` Rafael J. Wysocki (Intel)
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®