linux-surface/patches/5.16/0012-misc-fixes.patch
2022-03-24 21:39:36 +01:00

112 lines
3.5 KiB
Diff

From 0169488e6792b0939ec350c59b608e744faf3fc4 Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Wed, 8 Dec 2021 16:22:50 +0100
Subject: [PATCH] acpi/battery: Add device HID and quirk for Microsoft Surface
Go 3
For some reason, the Microsoft Surface Go 3 uses the standard ACPI
interface for battery information, but does not use the standard PNP0C0A
HID. Instead it uses MSHW0146 as identifier. Add that ID to the driver
as this seems to work well.
Additionally, the power state is not updated immediately after the AC
has been (un-)plugged, so add the respective quirk for that.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: misc-fixes
---
drivers/acpi/battery.c | 12 ++++++++++++
1 file changed, 12 insertions(+)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index ead0114f27c9..56db7b4da514 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -60,6 +60,10 @@ MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
static const struct acpi_device_id battery_device_ids[] = {
{"PNP0C0A", 0},
+
+ /* Microsoft Surface Go 3 */
+ {"MSHW0146", 0},
+
{"", 0},
};
@@ -1177,6 +1181,14 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"),
},
},
+ {
+ /* Microsoft Surface Go 3 */
+ .callback = battery_notification_delay_quirk,
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Surface Go 3"),
+ },
+ },
{},
};
--
2.35.1
From ed246dbe6d9a05f195f78fb1b325b088add2321a Mon Sep 17 00:00:00 2001
From: Maximilian Luz <luzmaximilian@gmail.com>
Date: Tue, 8 Feb 2022 01:29:48 +0100
Subject: [PATCH] ACPI: battery: Add "Not Charging" quirk for Microsoft Surface
devices
Microsoft Surface devices have a limiter that sets a fixed maximum
charge capacity for the battery. When that maximum capacity has been
reached, charging stops. In that case, _BST returns a battery state
field with both "charging" and "discharging" bits cleared. The battery
driver, however, returns "unknown" as status.
This seems to be the same behavior as observed on the ThinkPads, so
let's use the same quirk to handle that as well.
Signed-off-by: Maximilian Luz <luzmaximilian@gmail.com>
Patchset: misc-fixes
---
For what it's worth, I don't think the ACPI spec explicitly states that
any of the status bits need to be set, or that there are only the
"charging" and "discharging" states. As far as I can tell, ACPI only
states:
Notice that the Charging bit and the Discharging bit are mutually
exclusive and must not both be set at the same time. Even in
critical state, hardware should report the corresponding
charging/discharging state.
But that does not exclude the case that no bit is set. So, strictly
going by spec, I don't think it's necessary to put all of this behind a
quirk.
---
drivers/acpi/battery.c | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 56db7b4da514..8edaa3020af3 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -1181,6 +1181,14 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
DMI_MATCH(DMI_PRODUCT_VERSION, "ThinkPad"),
},
},
+ {
+ .callback = battery_quirk_not_charging,
+ .ident = "Microsoft Surface",
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Microsoft Corporation"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "Surface"),
+ },
+ },
{
/* Microsoft Surface Go 3 */
.callback = battery_notification_delay_quirk,
--
2.35.1