Skip to content

Commit 34f243e

Browse files
jwrdegoedesre
authored andcommitted
power: supply: axp288_fuel_gauge: Fix battery reporting on the One Mix 1
Commit 3a06b91 ("power: supply: axp288_fuel_gauge: Make "T3 MRD" no_battery_list DMI entry more generic") added a generic no-battery DMI match for many mini-PCs / HDMI-sticks which use "T3 MRD" as their DMI board-name. It turns out that the One Mix 1 mini laptop also uses "T3 MRD" for its DMI boardname and it also has its chassis-type wrongly set to a value of "3" (desktop). This was causing the axp288_fuel_gauge driver to disable battery reporting because this matches the no-battery DMI list entry for generic "T3 MRD" mini-PCs. Change the no-battery DMI list into a quirks DMI list and add a specific match for the One Mix 1 mini laptop before the generic "T3 MRD" no-battery quirk entry to fix this. Fixes: 3a06b91 ("power: supply: axp288_fuel_gauge: Make "T3 MRD" no_battery_list DMI entry more generic") Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
1 parent e56a4be commit 34f243e

File tree

1 file changed

+36
-4
lines changed

1 file changed

+36
-4
lines changed

drivers/power/supply/axp288_fuel_gauge.c

Lines changed: 36 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -90,6 +90,8 @@
9090
#define AXP288_REG_UPDATE_INTERVAL (60 * HZ)
9191
#define AXP288_FG_INTR_NUM 6
9292

93+
#define AXP288_QUIRK_NO_BATTERY BIT(0)
94+
9395
static bool no_current_sense_res;
9496
module_param(no_current_sense_res, bool, 0444);
9597
MODULE_PARM_DESC(no_current_sense_res, "No (or broken) current sense resistor");
@@ -524,7 +526,7 @@ static struct power_supply_desc fuel_gauge_desc = {
524526
* detection reports one despite it not being there.
525527
* Please keep this listed sorted alphabetically.
526528
*/
527-
static const struct dmi_system_id axp288_no_battery_list[] = {
529+
static const struct dmi_system_id axp288_quirks[] = {
528530
{
529531
/* ACEPC T8 Cherry Trail Z8350 mini PC */
530532
.matches = {
@@ -534,6 +536,7 @@ static const struct dmi_system_id axp288_no_battery_list[] = {
534536
/* also match on somewhat unique bios-version */
535537
DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
536538
},
539+
.driver_data = (void *)AXP288_QUIRK_NO_BATTERY,
537540
},
538541
{
539542
/* ACEPC T11 Cherry Trail Z8350 mini PC */
@@ -544,48 +547,71 @@ static const struct dmi_system_id axp288_no_battery_list[] = {
544547
/* also match on somewhat unique bios-version */
545548
DMI_EXACT_MATCH(DMI_BIOS_VERSION, "1.000"),
546549
},
550+
.driver_data = (void *)AXP288_QUIRK_NO_BATTERY,
547551
},
548552
{
549553
/* Intel Cherry Trail Compute Stick, Windows version */
550554
.matches = {
551555
DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
552556
DMI_MATCH(DMI_PRODUCT_NAME, "STK1AW32SC"),
553557
},
558+
.driver_data = (void *)AXP288_QUIRK_NO_BATTERY,
554559
},
555560
{
556561
/* Intel Cherry Trail Compute Stick, version without an OS */
557562
.matches = {
558563
DMI_MATCH(DMI_SYS_VENDOR, "Intel"),
559564
DMI_MATCH(DMI_PRODUCT_NAME, "STK1A32SC"),
560565
},
566+
.driver_data = (void *)AXP288_QUIRK_NO_BATTERY,
561567
},
562568
{
563569
/* Meegopad T02 */
564570
.matches = {
565571
DMI_MATCH(DMI_PRODUCT_NAME, "MEEGOPAD T02"),
566572
},
573+
.driver_data = (void *)AXP288_QUIRK_NO_BATTERY,
567574
},
568575
{ /* Mele PCG03 Mini PC */
569576
.matches = {
570577
DMI_EXACT_MATCH(DMI_BOARD_VENDOR, "Mini PC"),
571578
DMI_EXACT_MATCH(DMI_BOARD_NAME, "Mini PC"),
572579
},
580+
.driver_data = (void *)AXP288_QUIRK_NO_BATTERY,
573581
},
574582
{
575583
/* Minix Neo Z83-4 mini PC */
576584
.matches = {
577585
DMI_MATCH(DMI_SYS_VENDOR, "MINIX"),
578586
DMI_MATCH(DMI_PRODUCT_NAME, "Z83-4"),
579-
}
587+
},
588+
.driver_data = (void *)AXP288_QUIRK_NO_BATTERY,
580589
},
581590
{
582-
/* Various Ace PC/Meegopad/MinisForum/Wintel Mini-PCs/HDMI-sticks */
591+
/*
592+
* One Mix 1, this uses the "T3 MRD" boardname used by
593+
* generic mini PCs, but it is a mini laptop so it does
594+
* actually have a battery!
595+
*/
596+
.matches = {
597+
DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"),
598+
DMI_MATCH(DMI_BIOS_DATE, "06/14/2018"),
599+
},
600+
.driver_data = NULL,
601+
},
602+
{
603+
/*
604+
* Various Ace PC/Meegopad/MinisForum/Wintel Mini-PCs/HDMI-sticks
605+
* This entry must be last because it is generic, this allows
606+
* adding more specifuc quirks overriding this generic entry.
607+
*/
583608
.matches = {
584609
DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"),
585610
DMI_MATCH(DMI_CHASSIS_TYPE, "3"),
586611
DMI_MATCH(DMI_BIOS_VENDOR, "American Megatrends Inc."),
587612
DMI_MATCH(DMI_BIOS_VERSION, "5.11"),
588613
},
614+
.driver_data = (void *)AXP288_QUIRK_NO_BATTERY,
589615
},
590616
{}
591617
};
@@ -665,7 +691,9 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
665691
[BAT_D_CURR] = "axp288-chrg-d-curr",
666692
[BAT_VOLT] = "axp288-batt-volt",
667693
};
694+
const struct dmi_system_id *dmi_id;
668695
struct device *dev = &pdev->dev;
696+
unsigned long quirks = 0;
669697
int i, pirq, ret;
670698

671699
/*
@@ -675,7 +703,11 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
675703
if (!acpi_quirk_skip_acpi_ac_and_battery())
676704
return -ENODEV;
677705

678-
if (dmi_check_system(axp288_no_battery_list))
706+
dmi_id = dmi_first_match(axp288_quirks);
707+
if (dmi_id)
708+
quirks = (unsigned long)dmi_id->driver_data;
709+
710+
if (quirks & AXP288_QUIRK_NO_BATTERY)
679711
return -ENODEV;
680712

681713
info = devm_kzalloc(dev, sizeof(*info), GFP_KERNEL);

0 commit comments

Comments
 (0)