Skip to contentSkip to conversation

ACPI / AC / battery: DMI quirk cleanups

PATCH In review Hans de Goede 2 participants 4 messages Feb 23, 2020 – Mar 4, 2020 ACPI

lore
Share & tools
lore
#0 lore raw

cover ACPI / AC / battery: DMI quirk cleanups

Hi Rafael,

These 2 cleanup patches were preparation patches for adding a quirk to both drivers for one more model. But in the end I ended up solving the problem on that model in a different way.

I still think the cleanups are good to have, so I'm submitting them without any further changes on top.

Regards,

Hans

#1 lore raw

PATCH 1/2 ACPI / AC: Cleanup DMI quirk table

The 3 different entries we have sofar all use different identation and 2 of the use DMI_MATCH where as 1 unnecessarily used DMI_EXACT_MATCH Fix this to just use full tab idents for each level and DMI_MATCH everywhere and sort the entries alphabetically.

Also add a bit of text to the comments explaining why the quirk is necessary.

---
 drivers/acpi/ac.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/acpi/ac.c +13 -12
index 829f37d36b9f..69d2db13886b 100644
@@ -293,29 +293,30 @@ static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)
 	return 0;
 }
 
+/* Please keep this list alphabetically sorted */
 static const struct dmi_system_id ac_dmi_table[]  __initconst = {
 	{
-	/* Thinkpad e530 */
-	.callback = thinkpad_e530_quirk,
-	.matches = {
-		DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-		DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
+		/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
+		.callback = ac_do_not_check_pmic_quirk,
+		.matches = {
+			DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
 		},
 	},
 	{
-		/* ECS EF20EA */
+		/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
 		.callback = ac_do_not_check_pmic_quirk,
 		.matches = {
-			DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
 		},
 	},
 	{
-		/* Lenovo Ideapad Miix 320 */
-		.callback = ac_do_not_check_pmic_quirk,
+		/* Lenovo Thinkpad e530, see comment in acpi_ac_notify() */
+		.callback = thinkpad_e530_quirk,
 		.matches = {
-		  DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-		  DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"),
-		  DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
 		},
 	},
 	{},
Signature · 1 line
2.25.0
#2 lore raw

Re: [PATCH 1/2] ACPI / AC: Cleanup DMI quirk table

Quoted 51 lines · CET Hans de Goede

The 3 different entries we have sofar all use different identation and 2 of the use DMI_MATCH where as 1 unnecessarily used DMI_EXACT_MATCH Fix this to just use full tab idents for each level and DMI_MATCH everywhere and sort the entries alphabetically.

Also add a bit of text to the comments explaining why the quirk is necessary.

---
 drivers/acpi/ac.c | 25 +++++++++++++------------
 1 file changed, 13 insertions(+), 12 deletions(-)
drivers/acpi/ac.c +10 -9
index 829f37d36b9f..69d2db13886b 100644
@@ -293,29 +293,30 @@ static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d)
 	return 0;
 }
 
+/* Please keep this list alphabetically sorted */
 static const struct dmi_system_id ac_dmi_table[]  __initconst = {
 	{
-	/* Thinkpad e530 */
-	.callback = thinkpad_e530_quirk,
-	.matches = {
-		DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-		DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
+		/* ECS EF20EA, AXP288 PMIC but uses separate fuel-gauge */
+		.callback = ac_do_not_check_pmic_quirk,
+		.matches = {
+			DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
 		},
 	},
 	{
-		/* ECS EF20EA */
+		/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
 		.callback = ac_do_not_check_pmic_quirk,
 		.matches = {
-			DMI_MATCH(DMI_PRODUCT_NAME, "EF20EA"),
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
 		},
 	},
 	{
-		/* Lenovo Ideapad Miix 320 */
-		.callback = ac_do_not_check_pmic_quirk,
+		/* Lenovo Thinkpad e530, see comment in acpi_ac_notify() */

drivers/acpi/ac.c static int __init ac_do_not_check_pmic_quirk(const struct dmi_system_id *d) · line 322

Quoted 10 lines
drivers/acpi/ac.c +3 -3
+		.callback = thinkpad_e530_quirk,
 		.matches = {
-		  DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-		  DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"),
-		  DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "32597CG"),
 		},
 	},
 	{},

Both patches in the series applied as 5.7 material, thanks!

#3 lore raw

PATCH 2/2 ACPI / battery: Cleanup Lenovo Ideapad Miix 320 DMI table entry

In reply to Hans de Goede

The Lenovo Ideapad Miix 320 bat_dmi_table entry is using weird indentation and is the only entry which (unnecessarily) uses DMI_EXACT_MATCH instead of DMI_MATCH, fixup both to make the entry consistent with the others.

While at it also update the comments for battery_do_not_check_pmic_quirk entries, adding a bit of text explaining why the quirk is necessary.

---
 drivers/acpi/battery.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/acpi/battery.c +5 -5
index 111a407dcc77..366c389175d8 100644
@@ -1365,19 +1365,19 @@ static const struct dmi_system_id bat_dmi_table[] __initconst = {
 		},
 	},
 	{
-		/* ECS EF20EA */
+		/* 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 */
+		/* Lenovo Ideapad Miix 320, AXP288 PMIC, separate fuel-gauge */
 		.callback = battery_do_not_check_pmic_quirk,
 		.matches = {
-		  DMI_EXACT_MATCH(DMI_SYS_VENDOR, "LENOVO"),
-		  DMI_EXACT_MATCH(DMI_PRODUCT_NAME, "80XF"),
-		  DMI_EXACT_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
+			DMI_MATCH(DMI_SYS_VENDOR, "LENOVO"),
+			DMI_MATCH(DMI_PRODUCT_NAME, "80XF"),
+			DMI_MATCH(DMI_PRODUCT_VERSION, "Lenovo MIIX 320-10ICR"),
 		},
 	},
 	{},
Signature · 1 line
2.25.0