summaryrefslogtreecommitdiff
path: root/drivers/power/supply
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2017-12-26 15:59:13 +0300
committerSebastian Reichel <sebastian.reichel@collabora.co.uk>2018-01-09 19:50:05 +0300
commitb60c75b6a502077f0edb10c274eb5ac8e72ba342 (patch)
treeb2403d5716987c1eb7a3f85071e655bdccb1a8fd /drivers/power/supply
parentceb40831c94115134581ee6eaaa26001e00def5f (diff)
downloadlinux-b60c75b6a502077f0edb10c274eb5ac8e72ba342.tar.xz
power: supply: axp288_fuel_gauge: Do not register our psy on (some) HDMI sticks
The Intel Compute Stick (Cherry Trail version) and the Meegopad T08 HDMI stick, both use an axp288 PMIC. They also both have this wired up in such a way that the detection logic in the PMIC claims that a valid battery is present, resuling in GNOME and KDE showing a full-battery in their status bar and power-settings, while these devices do not have a battery. For lack of a better fix add a DMI blacklist and do not register the axp288_fuel_gauge psy on devices on the blacklist. Reviewed-by: Chen-Yu Tsai <wens@csie.org> Signed-off-by: Hans de Goede <hdegoede@redhat.com> Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk>
Diffstat (limited to 'drivers/power/supply')
-rw-r--r--drivers/power/supply/axp288_fuel_gauge.c35
1 files changed, 35 insertions, 0 deletions
diff --git a/drivers/power/supply/axp288_fuel_gauge.c b/drivers/power/supply/axp288_fuel_gauge.c
index e0f3965b6964..4cc6e038dfdd 100644
--- a/drivers/power/supply/axp288_fuel_gauge.c
+++ b/drivers/power/supply/axp288_fuel_gauge.c
@@ -17,6 +17,7 @@
*
*/
+#include <linux/dmi.h>
#include <linux/module.h>
#include <linux/kernel.h>
#include <linux/device.h>
@@ -679,6 +680,37 @@ intr_failed:
}
}
+/*
+ * Some devices have no battery (HDMI sticks) and the axp288 battery's
+ * detection reports one despite it not being there.
+ */
+static const struct dmi_system_id axp288_fuel_gauge_blacklist[] = {
+ {
+ /* Intel Cherry Trail Compute Stick, Windows version */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "STK1AW32SC"),
+ },
+ },
+ {
+ /* Intel Cherry Trail Compute Stick, version without an OS */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Intel Corporation"),
+ DMI_MATCH(DMI_PRODUCT_NAME, "STK1A32SC"),
+ },
+ },
+ {
+ /* Meegopad T08 */
+ .matches = {
+ DMI_MATCH(DMI_SYS_VENDOR, "Default string"),
+ DMI_MATCH(DMI_BOARD_VENDOR, "To be filled by OEM."),
+ DMI_MATCH(DMI_BOARD_NAME, "T3 MRD"),
+ DMI_MATCH(DMI_BOARD_VERSION, "V1.1"),
+ },
+ },
+ {}
+};
+
static int axp288_fuel_gauge_probe(struct platform_device *pdev)
{
int i, ret = 0;
@@ -694,6 +726,9 @@ static int axp288_fuel_gauge_probe(struct platform_device *pdev)
[BAT_VOLT] = "axp288-batt-volt",
};
+ if (dmi_check_system(axp288_fuel_gauge_blacklist))
+ return -ENODEV;
+
info = devm_kzalloc(&pdev->dev, sizeof(*info), GFP_KERNEL);
if (!info)
return -ENOMEM;