All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/2] ACPI / x86: ac and battery device quirk work
@ 2021-12-30 19:31 Hans de Goede
  2021-12-30 19:31 ` [PATCH 1/2] ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper Hans de Goede
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Hans de Goede @ 2021-12-30 19:31 UTC (permalink / raw)
  To: Rafael J . Wysocki; +Cc: Hans de Goede, Len Brown, linux-acpi, Stephan Gerhold

Hi Rafael,

Here are 2 patches for ACPI ac and battery device quirk handling on x86,
the first one refactors the almost identical quirk handling in ac.c and
battery.c out into a shared helper.

And the 2nd patch then uses the now shared code to also skip / ignore
ac and battery devices on x86 Android tablets with known broken DSDTs.

Note this applies on top of my:
"[PATCH v2 0/3] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs"
series which you've just merged into your bleeding edge branch.

Regards,

Hans


Hans de Goede (2):
  ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
  ACPI / x86: Skip ac and battery devices on x86 Android tablets with
    broken DSDTs

 drivers/acpi/ac.c        | 43 ++------------------
 drivers/acpi/battery.c   | 42 ++------------------
 drivers/acpi/x86/utils.c | 86 ++++++++++++++++++++++++++++++++++++----
 include/acpi/acpi_bus.h  |  5 +++
 4 files changed, 90 insertions(+), 86 deletions(-)

-- 
2.33.1


^ permalink raw reply	[flat|nested] 7+ messages in thread

* [PATCH 1/2] ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
  2021-12-30 19:31 [PATCH 0/2] ACPI / x86: ac and battery device quirk work Hans de Goede
@ 2021-12-30 19:31 ` Hans de Goede
  2021-12-30 19:31 ` [PATCH 2/2] ACPI / x86: Skip ac and battery devices on x86 Android tablets with broken DSDTs Hans de Goede
  2022-01-04 14:52 ` [PATCH 0/2] ACPI / x86: ac and battery device quirk work Rafael J. Wysocki
  2 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2021-12-30 19:31 UTC (permalink / raw)
  To: Rafael J . Wysocki; +Cc: Hans de Goede, Len Brown, linux-acpi, Stephan Gerhold

Some x86 ACPI boards have broken AC and battery ACPI devices in their ACPI
tables. This is often tied to these devices using certain PMICs where the
factory OS image seems to be using native charger and fuel-gauge drivers
instead.

So far both the ac and battery drivers have almost identical checks for
these PMICs including both of them having a DMI based mechanism to force
usage of the ACPI ac and battery drivers on some boards even though one
of these PMICs is present, with the same 2 boards listed in both driver's
DMI tables for this.

The only difference is that the ac driver checks for 2 PMICs and the
battery driver only for one. This has grown this way because the other
(Whiskey Cove) PMIC is only used on a few boards (3 known boards) and
although some of these do have non working ACPI battery devices, their
_STA method always returns 0, but that really should not be relied on.

This patch factors out the shared checks into a new
acpi_quirk_skip_acpi_ac_and_battery() helper and moves the ac and
battery drivers over to this new helper.

Note the DMI table is shared with acpi_quirk_skip_i2c_client_enumeration()
and acpi_quirk_skip_serdev_enumeration(), because boards needing DMI quirks
for either of these typically also have broken ac and battery ACPI devices.
The ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY quirk is not set yet on boards
already in this DMI table, to avoid introducing any functional changes
in this refactoring patch.

Besided sharing the code between the ac and battery drivers this
refactoring also moves this quirk handling to under #ifdef CONFIG_X86,
removing this x86 specific code from non x86 ACPI builds.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/ac.c        | 43 ++--------------------
 drivers/acpi/battery.c   | 42 ++--------------------
 drivers/acpi/x86/utils.c | 77 +++++++++++++++++++++++++++++++++++++---
 include/acpi/acpi_bus.h  |  5 +++
 4 files changed, 84 insertions(+), 83 deletions(-)

diff --git a/drivers/acpi/ac.c b/drivers/acpi/ac.c
index 81aff651a0d4..db487ff9dd1b 100644
--- a/drivers/acpi/ac.c
+++ b/drivers/acpi/ac.c
@@ -48,19 +48,12 @@ static const struct acpi_device_id ac_device_ids[] = {
 };
 MODULE_DEVICE_TABLE(acpi, ac_device_ids);
 
-/* Lists of PMIC ACPI HIDs with an (often better) native charger driver */
-static const struct acpi_ac_bl acpi_ac_blacklist[] = {
-	{ "INT33F4", -1 }, /* X-Powers AXP288 PMIC */
-	{ "INT34D3",  3 }, /* Intel Cherrytrail Whiskey Cove PMIC */
-};
-
 #ifdef CONFIG_PM_SLEEP
 static int acpi_ac_resume(struct device *dev);
 #endif
 static SIMPLE_DEV_PM_OPS(acpi_ac_pm, NULL, acpi_ac_resume);
 
 static int ac_sleep_before_get_state_ms;
-static int ac_check_pmic = 1;
 static int ac_only;
 
 static struct acpi_driver acpi_ac_driver = {
@@ -200,12 +193,6 @@ static int __init thinkpad_e530_quirk(const struct dmi_system_id *d)
 	return 0;
 }
 
-static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)
-{
-	ac_check_pmic = 0;
-	return 0;
-}
-
 static int __init ac_only_quirk(const struct dmi_system_id *d)
 {
 	ac_only = 1;
@@ -214,13 +201,6 @@ static int __init ac_only_quirk(const struct dmi_system_id *d)
 
 /* Please keep this list alphabetically sorted */
 static const struct dmi_system_id ac_dmi_table[]  __initconst = {
-	{
-		/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
-		.callback = ac_do_not_check_pmic_quirk,
-		.matches = {
-			DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
-		},
-	},
 	{
 		/* Kodlix GK45 returning incorrect state */
 		.callback = ac_only_quirk,
@@ -228,15 +208,6 @@ static const struct dmi_system_id ac_dmi_table[]  __initconst = {
 			DMI_MATCH(DMI_PRODUCT_NAME, "GK45"),
 		},
 	},
-	{
-		/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
-		.callback = ac_do_not_check_pmic_quirk,
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
-		},
-	},
 	{
 		/* Lenovo Thinkpad e530, see comment in acpi_ac_notify() */
 		.callback = thinkpad_e530_quirk,
@@ -341,23 +312,15 @@ static int acpi_ac_remove(struct acpi_device *device)
 
 static int __init acpi_ac_init(void)
 {
-	unsigned int i;
 	int result;
 
 	if (acpi_disabled)
 		return -ENODEV;
 
-	dmi_check_system(ac_dmi_table);
+	if (acpi_quirk_skip_acpi_ac_and_battery())
+		return -ENODEV;
 
-	if (ac_check_pmic) {
-		for (i = 0; i < ARRAY_SIZE(acpi_ac_blacklist); i++)
-			if (acpi_dev_present(acpi_ac_blacklist[i].hid, "1",
-					     acpi_ac_blacklist[i].hrv)) {
-				pr_info("found native %s PMIC, not loading\n",
-					acpi_ac_blacklist[i].hid);
-				return -ENODEV;
-			}
-	}
+	dmi_check_system(ac_dmi_table);
 
 	result = acpi_bus_register_driver(&acpi_ac_driver);
 	if (result < 0)
diff --git a/drivers/acpi/battery.c b/drivers/acpi/battery.c
index 8afa85d6eb6a..bf4b7f0b627a 100644
--- a/drivers/acpi/battery.c
+++ b/drivers/acpi/battery.c
@@ -52,7 +52,6 @@ static bool battery_driver_registered;
 static int battery_bix_broken_package;
 static int battery_notification_delay_ms;
 static int battery_ac_is_broken;
-static int battery_check_pmic = 1;
 static unsigned int cache_time = 1000;
 module_param(cache_time, uint, 0644);
 MODULE_PARM_DESC(cache_time, "cache time in milliseconds");
@@ -64,11 +63,6 @@ static const struct acpi_device_id battery_device_ids[] = {
 
 MODULE_DEVICE_TABLE(acpi, battery_device_ids);
 
-/* Lists of PMIC ACPI HIDs with an (often better) native battery driver */
-static const char * const acpi_battery_blacklist[] = {
-	"INT33F4", /* X-Powers AXP288 PMIC */
-};
-
 enum {
 	ACPI_BATTERY_ALARM_PRESENT,
 	ACPI_BATTERY_XINFO_PRESENT,
@@ -1104,13 +1098,6 @@ battery_ac_is_broken_quirk(const struct dmi_system_id *d)
 	return 0;
 }
 
-static int __init
-battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
-{
-	battery_check_pmic = 0;
-	return 0;
-}
-
 static const struct dmi_system_id bat_dmi_table[] __initconst = {
 	{
 		/* NEC LZ750/LS */
@@ -1139,22 +1126,6 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
 			DMI_MATCH(DMI_BIOS_DATE, "08/22/2014"),
 		},
 	},
-	{
-		/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
-		.callback = battery_do_not_check_pmic_quirk,
-		.matches = {
-			DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
-		},
-	},
-	{
-		/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
-		.callback = battery_do_not_check_pmic_quirk,
-		.matches = {
-			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-			DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
-			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
-		},
-	},
 	{},
 };
 
@@ -1279,19 +1250,12 @@ static struct acpi_driver acpi_battery_driver = {
 
 static void __init acpi_battery_init_async(void *unused, async_cookie_t cookie)
 {
-	unsigned int i;
 	int result;
 
-	dmi_check_system(bat_dmi_table);
+	if (acpi_quirk_skip_acpi_ac_and_battery())
+		return;
 
-	if (battery_check_pmic) {
-		for (i = 0; i < ARRAY_SIZE(acpi_battery_blacklist); i++)
-			if (acpi_dev_present(acpi_battery_blacklist[i], "1", -1)) {
-				pr_info("found native %s PMIC, not loading\n",
-					acpi_battery_blacklist[i]);
-				return;
-			}
-	}
+	dmi_check_system(bat_dmi_table);
 
 	result = acpi_bus_register_driver(&acpi_battery_driver);
 	battery_driver_registered = (result == 0);
diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c
index 375a0911f06d..5411f2f1254e 100644
--- a/drivers/acpi/x86/utils.c
+++ b/drivers/acpi/x86/utils.c
@@ -8,6 +8,8 @@
  * Copyright (C) 2013-2015 Intel Corporation. All rights reserved.
  */
 
+#define pr_fmt(fmt) "ACPI: " fmt
+
 #include <linux/acpi.h>
 #include <linux/dmi.h>
 #include <linux/platform_device.h>
@@ -210,7 +212,6 @@ bool force_storage_d3(void)
 	return x86_match_cpu(storage_d3_cpu_ids);
 }
 
-#if IS_ENABLED(CONFIG_X86_ANDROID_TABLETS)
 /*
  * x86 ACPI boards which ship with only Android as their factory image usually
  * declare a whole bunch of bogus I2C devices in their ACPI tables and sometimes
@@ -236,8 +237,36 @@ bool force_storage_d3(void)
  */
 #define ACPI_QUIRK_SKIP_I2C_CLIENTS				BIT(0)
 #define ACPI_QUIRK_UART1_TTY_UART2_SKIP				BIT(1)
+#define ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY			BIT(2)
+#define ACPI_QUIRK_USE_ACPI_AC_AND_BATTERY			BIT(3)
+
+static const struct dmi_system_id acpi_quirk_skip_dmi_ids[] = {
+	/*
+	 * 1. Devices with only the skip / don't-skip AC and battery quirks,
+	 *    sorted alphabetically.
+	 */
+	{
+		/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
+		.matches = {
+			DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
+		},
+		.driver_data = (void *)ACPI_QUIRK_USE_ACPI_AC_AND_BATTERY
+	},
+	{
+		/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
+		.matches = {
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
+		},
+		.driver_data = (void *)ACPI_QUIRK_USE_ACPI_AC_AND_BATTERY
+	},
 
-static const struct dmi_system_id acpi_skip_serial_bus_enumeration_ids[] = {
+	/*
+	 * 2. Devices which also have the skip i2c/serdev quirks and which
+	 *    need the x86-android-tablets module to properly work.
+	 */
+#if IS_ENABLED(CONFIG_X86_ANDROID_TABLETS)
 	{
 		.matches = {
 			DMI_EXACT_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
@@ -263,9 +292,11 @@ static const struct dmi_system_id acpi_skip_serial_bus_enumeration_ids[] = {
 		},
 		.driver_data = (void *)ACPI_QUIRK_SKIP_I2C_CLIENTS,
 	},
+#endif
 	{}
 };
 
+#if IS_ENABLED(CONFIG_X86_ANDROID_TABLETS)
 static const struct acpi_device_id i2c_acpi_known_good_ids[] = {
 	{ "10EC5640", 0 }, /* RealTek ALC5640 audio codec */
 	{ "INT33F4", 0 },  /* X-Powers AXP288 PMIC */
@@ -279,7 +310,7 @@ bool acpi_quirk_skip_i2c_client_enumeration(struct acpi_device *adev)
 	const struct dmi_system_id *dmi_id;
 	long quirks;
 
-	dmi_id = dmi_first_match(acpi_skip_serial_bus_enumeration_ids);
+	dmi_id = dmi_first_match(acpi_quirk_skip_dmi_ids);
 	if (!dmi_id)
 		return false;
 
@@ -303,7 +334,7 @@ int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *s
 	if (!adev || !adev->pnp.unique_id || !dev_is_platform(controller_parent))
 		return 0;
 
-	dmi_id = dmi_first_match(acpi_skip_serial_bus_enumeration_ids);
+	dmi_id = dmi_first_match(acpi_quirk_skip_dmi_ids);
 	if (dmi_id)
 		quirks = (unsigned long)dmi_id->driver_data;
 
@@ -319,3 +350,41 @@ int acpi_quirk_skip_serdev_enumeration(struct device *controller_parent, bool *s
 }
 EXPORT_SYMBOL_GPL(acpi_quirk_skip_serdev_enumeration);
 #endif
+
+/* Lists of PMIC ACPI HIDs with an (often better) native charger driver */
+static const struct {
+	const char *hid;
+	int hrv;
+} acpi_skip_ac_and_battery_pmic_ids[] = {
+	{ "INT33F4", -1 }, /* X-Powers AXP288 PMIC */
+	{ "INT34D3",  3 }, /* Intel Cherrytrail Whiskey Cove PMIC */
+};
+
+bool acpi_quirk_skip_acpi_ac_and_battery(void)
+{
+	const struct dmi_system_id *dmi_id;
+	long quirks = 0;
+	int i;
+
+	dmi_id = dmi_first_match(acpi_quirk_skip_dmi_ids);
+	if (dmi_id)
+		quirks = (unsigned long)dmi_id->driver_data;
+
+	if (quirks & ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY)
+		return true;
+
+	if (quirks & ACPI_QUIRK_USE_ACPI_AC_AND_BATTERY)
+		return false;
+
+	for (i = 0; i < ARRAY_SIZE(acpi_skip_ac_and_battery_pmic_ids); i++) {
+		if (acpi_dev_present(acpi_skip_ac_and_battery_pmic_ids[i].hid, "1",
+				     acpi_skip_ac_and_battery_pmic_ids[i].hrv)) {
+			pr_info_once("found native %s PMIC, skipping ACPI AC and battery devices\n",
+				     acpi_skip_ac_and_battery_pmic_ids[i].hid);
+			return true;
+		}
+	}
+
+	return false;
+}
+EXPORT_SYMBOL_GPL(acpi_quirk_skip_acpi_ac_and_battery);
diff --git a/include/acpi/acpi_bus.h b/include/acpi/acpi_bus.h
index 102b1cf433c7..e0fd99462ddd 100644
--- a/include/acpi/acpi_bus.h
+++ b/include/acpi/acpi_bus.h
@@ -616,12 +616,17 @@ int acpi_disable_wakeup_device_power(struct acpi_device *dev);
 
 #ifdef CONFIG_X86
 bool acpi_device_override_status(struct acpi_device *adev, unsigned long long *status);
+bool acpi_quirk_skip_acpi_ac_and_battery(void);
 #else
 static inline bool acpi_device_override_status(struct acpi_device *adev,
 					       unsigned long long *status)
 {
 	return false;
 }
+static inline bool acpi_quirk_skip_acpi_ac_and_battery(void)
+{
+	return false;
+}
 #endif
 
 #if IS_ENABLED(CONFIG_X86_ANDROID_TABLETS)
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* [PATCH 2/2] ACPI / x86: Skip ac and battery devices on x86 Android tablets with broken DSDTs
  2021-12-30 19:31 [PATCH 0/2] ACPI / x86: ac and battery device quirk work Hans de Goede
  2021-12-30 19:31 ` [PATCH 1/2] ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper Hans de Goede
@ 2021-12-30 19:31 ` Hans de Goede
  2022-01-04 14:52 ` [PATCH 0/2] ACPI / x86: ac and battery device quirk work Rafael J. Wysocki
  2 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2021-12-30 19:31 UTC (permalink / raw)
  To: Rafael J . Wysocki; +Cc: Hans de Goede, Len Brown, linux-acpi, Stephan Gerhold

Sofar all of the tablets for which the skip i2c-client/serdev enumeration
quirks have been added also all have broken ACPI ac / battery devices
extend the existing quirks for these tablets to also skip the broken
ac / battery devices.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
 drivers/acpi/x86/utils.c | 9 ++++++---
 1 file changed, 6 insertions(+), 3 deletions(-)

diff --git a/drivers/acpi/x86/utils.c b/drivers/acpi/x86/utils.c
index 5411f2f1254e..ffdeed5334d6 100644
--- a/drivers/acpi/x86/utils.c
+++ b/drivers/acpi/x86/utils.c
@@ -273,14 +273,16 @@ static const struct dmi_system_id acpi_quirk_skip_dmi_ids[] = {
 			DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "ME176C"),
 		},
 		.driver_data = (void *)(ACPI_QUIRK_SKIP_I2C_CLIENTS |
-					ACPI_QUIRK_UART1_TTY_UART2_SKIP),
+					ACPI_QUIRK_UART1_TTY_UART2_SKIP |
+					ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY),
 	},
 	{
 		.matches = {
 			DMI_MATCH(DMI_SYS_VENDOR, "ASUSTeK COMPUTER INC."),
 			DMI_MATCH(DMI_PRODUCT_NAME, "TF103C"),
 		},
-		.driver_data = (void *)ACPI_QUIRK_SKIP_I2C_CLIENTS,
+		.driver_data = (void *)(ACPI_QUIRK_SKIP_I2C_CLIENTS |
+					ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY),
 	},
 	{
 		/* Whitelabel (sold as various brands) TM800A550L */
@@ -290,7 +292,8 @@ static const struct dmi_system_id acpi_quirk_skip_dmi_ids[] = {
 			/* Above strings are too generic, also match on BIOS version */
 			DMI_MATCH(DMI_BIOS_VERSION, "ZY-8-BI-PX4S70VTR400-X423B-005-D"),
 		},
-		.driver_data = (void *)ACPI_QUIRK_SKIP_I2C_CLIENTS,
+		.driver_data = (void *)(ACPI_QUIRK_SKIP_I2C_CLIENTS |
+					ACPI_QUIRK_SKIP_ACPI_AC_AND_BATTERY),
 	},
 #endif
 	{}
-- 
2.33.1


^ permalink raw reply related	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] ACPI / x86: ac and battery device quirk work
  2021-12-30 19:31 [PATCH 0/2] ACPI / x86: ac and battery device quirk work Hans de Goede
  2021-12-30 19:31 ` [PATCH 1/2] ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper Hans de Goede
  2021-12-30 19:31 ` [PATCH 2/2] ACPI / x86: Skip ac and battery devices on x86 Android tablets with broken DSDTs Hans de Goede
@ 2022-01-04 14:52 ` Rafael J. Wysocki
  2022-01-04 15:07   ` Hans de Goede
  2 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2022-01-04 14:52 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Rafael J . Wysocki, Len Brown, ACPI Devel Maling List, Stephan Gerhold

On Thu, Dec 30, 2021 at 8:31 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi Rafael,
>
> Here are 2 patches for ACPI ac and battery device quirk handling on x86,
> the first one refactors the almost identical quirk handling in ac.c and
> battery.c out into a shared helper.
>
> And the 2nd patch then uses the now shared code to also skip / ignore
> ac and battery devices on x86 Android tablets with known broken DSDTs.
>
> Note this applies on top of my:
> "[PATCH v2 0/3] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs"
> series which you've just merged into your bleeding edge branch.
>
> Regards,
>
> Hans
>
>
> Hans de Goede (2):
>   ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
>   ACPI / x86: Skip ac and battery devices on x86 Android tablets with
>     broken DSDTs
>
>  drivers/acpi/ac.c        | 43 ++------------------
>  drivers/acpi/battery.c   | 42 ++------------------
>  drivers/acpi/x86/utils.c | 86 ++++++++++++++++++++++++++++++++++++----
>  include/acpi/acpi_bus.h  |  5 +++
>  4 files changed, 90 insertions(+), 86 deletions(-)

Applied as 5.17 material.

Note that the changes here clashed with some recent battery driver
changes, so I needed to resolve the merge conflict.  Please double
check the result.

Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] ACPI / x86: ac and battery device quirk work
  2022-01-04 14:52 ` [PATCH 0/2] ACPI / x86: ac and battery device quirk work Rafael J. Wysocki
@ 2022-01-04 15:07   ` Hans de Goede
  2022-01-04 20:03     ` Rafael J. Wysocki
  0 siblings, 1 reply; 7+ messages in thread
From: Hans de Goede @ 2022-01-04 15:07 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, ACPI Devel Maling List, Stephan Gerhold

Hi Rafael,

On 1/4/22 15:52, Rafael J. Wysocki wrote:
> On Thu, Dec 30, 2021 at 8:31 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi Rafael,
>>
>> Here are 2 patches for ACPI ac and battery device quirk handling on x86,
>> the first one refactors the almost identical quirk handling in ac.c and
>> battery.c out into a shared helper.
>>
>> And the 2nd patch then uses the now shared code to also skip / ignore
>> ac and battery devices on x86 Android tablets with known broken DSDTs.
>>
>> Note this applies on top of my:
>> "[PATCH v2 0/3] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs"
>> series which you've just merged into your bleeding edge branch.
>>
>> Regards,
>>
>> Hans
>>
>>
>> Hans de Goede (2):
>>   ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
>>   ACPI / x86: Skip ac and battery devices on x86 Android tablets with
>>     broken DSDTs
>>
>>  drivers/acpi/ac.c        | 43 ++------------------
>>  drivers/acpi/battery.c   | 42 ++------------------
>>  drivers/acpi/x86/utils.c | 86 ++++++++++++++++++++++++++++++++++++----
>>  include/acpi/acpi_bus.h  |  5 +++
>>  4 files changed, 90 insertions(+), 86 deletions(-)
> 
> Applied as 5.17 material.
> 
> Note that the changes here clashed with some recent battery driver
> changes, so I needed to resolve the merge conflict.  Please double
> check the result.

Sorry about the conflict.

I just checked and something indeed went wrong with the merge.

Checking drivers/acpi/battery.c from your bleeding-edge
branch there a bunch of now dead code still present there
related to setting the now never checked battery_check_pmic
global quirk flag:

Line 55: "static int battery_check_pmic = 1;"

Line 1105-1111:

"""
static int __init
battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
{
	battery_check_pmic = 0;
	return 0;
}

"""

Line 1146-1161:

"""
	{
		/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
		.callback = battery_do_not_check_pmic_quirk,
		.matches = {
			DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
		},
	},
	{
		/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
		.callback = battery_do_not_check_pmic_quirk,
		.matches = {
			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
			DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
		},
	},
"""

Since this all just sets the now no longer checked battery_check_pmic flag, it
is harmless, but all of this can be removed.

Regards,

Hans




^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] ACPI / x86: ac and battery device quirk work
  2022-01-04 15:07   ` Hans de Goede
@ 2022-01-04 20:03     ` Rafael J. Wysocki
  2022-01-05 12:17       ` Hans de Goede
  0 siblings, 1 reply; 7+ messages in thread
From: Rafael J. Wysocki @ 2022-01-04 20:03 UTC (permalink / raw)
  To: Hans de Goede
  Cc: Rafael J. Wysocki, Len Brown, ACPI Devel Maling List, Stephan Gerhold

On Tue, Jan 4, 2022 at 4:08 PM Hans de Goede <hdegoede@redhat.com> wrote:
>
> Hi Rafael,
>
> On 1/4/22 15:52, Rafael J. Wysocki wrote:
> > On Thu, Dec 30, 2021 at 8:31 PM Hans de Goede <hdegoede@redhat.com> wrote:
> >>
> >> Hi Rafael,
> >>
> >> Here are 2 patches for ACPI ac and battery device quirk handling on x86,
> >> the first one refactors the almost identical quirk handling in ac.c and
> >> battery.c out into a shared helper.
> >>
> >> And the 2nd patch then uses the now shared code to also skip / ignore
> >> ac and battery devices on x86 Android tablets with known broken DSDTs.
> >>
> >> Note this applies on top of my:
> >> "[PATCH v2 0/3] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs"
> >> series which you've just merged into your bleeding edge branch.
> >>
> >> Regards,
> >>
> >> Hans
> >>
> >>
> >> Hans de Goede (2):
> >>   ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
> >>   ACPI / x86: Skip ac and battery devices on x86 Android tablets with
> >>     broken DSDTs
> >>
> >>  drivers/acpi/ac.c        | 43 ++------------------
> >>  drivers/acpi/battery.c   | 42 ++------------------
> >>  drivers/acpi/x86/utils.c | 86 ++++++++++++++++++++++++++++++++++++----
> >>  include/acpi/acpi_bus.h  |  5 +++
> >>  4 files changed, 90 insertions(+), 86 deletions(-)
> >
> > Applied as 5.17 material.
> >
> > Note that the changes here clashed with some recent battery driver
> > changes, so I needed to resolve the merge conflict.  Please double
> > check the result.
>
> Sorry about the conflict.
>
> I just checked and something indeed went wrong with the merge.
>
> Checking drivers/acpi/battery.c from your bleeding-edge
> branch there a bunch of now dead code still present there
> related to setting the now never checked battery_check_pmic
> global quirk flag:
>
> Line 55: "static int battery_check_pmic = 1;"
>
> Line 1105-1111:
>
> """
> static int __init
> battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
> {
>         battery_check_pmic = 0;
>         return 0;
> }
>
> """
>
> Line 1146-1161:
>
> """
>         {
>                 /* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
>                 .callback = battery_do_not_check_pmic_quirk,
>                 .matches = {
>                         DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
>                 },
>         },
>         {
>                 /* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
>                 .callback = battery_do_not_check_pmic_quirk,
>                 .matches = {
>                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
>                         DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
>                         DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
>                 },
>         },
> """
>
> Since this all just sets the now no longer checked battery_check_pmic flag, it
> is harmless, but all of this can be removed.

OK, I redid the merge, please check again.

Thanks!

^ permalink raw reply	[flat|nested] 7+ messages in thread

* Re: [PATCH 0/2] ACPI / x86: ac and battery device quirk work
  2022-01-04 20:03     ` Rafael J. Wysocki
@ 2022-01-05 12:17       ` Hans de Goede
  0 siblings, 0 replies; 7+ messages in thread
From: Hans de Goede @ 2022-01-05 12:17 UTC (permalink / raw)
  To: Rafael J. Wysocki; +Cc: Len Brown, ACPI Devel Maling List, Stephan Gerhold

Hi,

On 1/4/22 21:03, Rafael J. Wysocki wrote:
> On Tue, Jan 4, 2022 at 4:08 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>
>> Hi Rafael,
>>
>> On 1/4/22 15:52, Rafael J. Wysocki wrote:
>>> On Thu, Dec 30, 2021 at 8:31 PM Hans de Goede <hdegoede@redhat.com> wrote:
>>>>
>>>> Hi Rafael,
>>>>
>>>> Here are 2 patches for ACPI ac and battery device quirk handling on x86,
>>>> the first one refactors the almost identical quirk handling in ac.c and
>>>> battery.c out into a shared helper.
>>>>
>>>> And the 2nd patch then uses the now shared code to also skip / ignore
>>>> ac and battery devices on x86 Android tablets with known broken DSDTs.
>>>>
>>>> Note this applies on top of my:
>>>> "[PATCH v2 0/3] ACPI / pdx86: Add support for x86 Android tablets with broken DSDTs"
>>>> series which you've just merged into your bleeding edge branch.
>>>>
>>>> Regards,
>>>>
>>>> Hans
>>>>
>>>>
>>>> Hans de Goede (2):
>>>>   ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper
>>>>   ACPI / x86: Skip ac and battery devices on x86 Android tablets with
>>>>     broken DSDTs
>>>>
>>>>  drivers/acpi/ac.c        | 43 ++------------------
>>>>  drivers/acpi/battery.c   | 42 ++------------------
>>>>  drivers/acpi/x86/utils.c | 86 ++++++++++++++++++++++++++++++++++++----
>>>>  include/acpi/acpi_bus.h  |  5 +++
>>>>  4 files changed, 90 insertions(+), 86 deletions(-)
>>>
>>> Applied as 5.17 material.
>>>
>>> Note that the changes here clashed with some recent battery driver
>>> changes, so I needed to resolve the merge conflict.  Please double
>>> check the result.
>>
>> Sorry about the conflict.
>>
>> I just checked and something indeed went wrong with the merge.
>>
>> Checking drivers/acpi/battery.c from your bleeding-edge
>> branch there a bunch of now dead code still present there
>> related to setting the now never checked battery_check_pmic
>> global quirk flag:
>>
>> Line 55: "static int battery_check_pmic = 1;"
>>
>> Line 1105-1111:
>>
>> """
>> static int __init
>> battery_do_not_check_pmic_quirk(const struct dmi_system_id *d)
>> {
>>         battery_check_pmic = 0;
>>         return 0;
>> }
>>
>> """
>>
>> Line 1146-1161:
>>
>> """
>>         {
>>                 /* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
>>                 .callback = battery_do_not_check_pmic_quirk,
>>                 .matches = {
>>                         DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
>>                 },
>>         },
>>         {
>>                 /* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
>>                 .callback = battery_do_not_check_pmic_quirk,
>>                 .matches = {
>>                         DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
>>                         DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
>>                         DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
>>                 },
>>         },
>> """
>>
>> Since this all just sets the now no longer checked battery_check_pmic flag, it
>> is harmless, but all of this can be removed.
> 
> OK, I redid the merge, please check again.

This looks good now, thanks.

Regards,

Hans


^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2022-01-05 12:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-30 19:31 [PATCH 0/2] ACPI / x86: ac and battery device quirk work Hans de Goede
2021-12-30 19:31 ` [PATCH 1/2] ACPI / x86: Introduce an acpi_quirk_skip_acpi_ac_and_battery() helper Hans de Goede
2021-12-30 19:31 ` [PATCH 2/2] ACPI / x86: Skip ac and battery devices on x86 Android tablets with broken DSDTs Hans de Goede
2022-01-04 14:52 ` [PATCH 0/2] ACPI / x86: ac and battery device quirk work Rafael J. Wysocki
2022-01-04 15:07   ` Hans de Goede
2022-01-04 20:03     ` Rafael J. Wysocki
2022-01-05 12:17       ` Hans de Goede

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.