Skip to content

Commit

Permalink
platform/x86: x86-android-tablets: Workaround Lenovo Yoga Tablet 2 83…
Browse files Browse the repository at this point in the history
…0/1050 poweroff hang

These tablets' DSDT does not set acpi_gbl_reduced_hardware, so
acpi_power_off gets used as pm_power_off handler. Not setting
acpi_gbl_reduced_hardware may very well be correct for these tablets,
but acpi_power_off is broken on them.

Using acpi_power_off causes "poweroff" to hang hard. Requiring pressing
the powerbutton for 30 seconds *twice* followed by a normal 3 second
press to recover.

Avoid this by overriding the global pm_power_off handler to do
an EFI poweroff, which does work, instead.

Signed-off-by: Hans de Goede <hdegoede@redhat.com>
Link: https://lore.kernel.org/r/20220223133153.730337-5-hdegoede@redhat.com
  • Loading branch information
Hans de Goede committed Mar 2, 2022
1 parent 67dfc2b commit bf8fd1a
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions drivers/platform/x86/x86-android-tablets.c
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@

#include <linux/acpi.h>
#include <linux/dmi.h>
#include <linux/efi.h>
#include <linux/gpio_keys.h>
#include <linux/gpio/consumer.h>
#include <linux/gpio/driver.h>
Expand All @@ -24,6 +25,7 @@
#include <linux/mod_devicetable.h>
#include <linux/platform_data/lp855x.h>
#include <linux/platform_device.h>
#include <linux/pm.h>
#include <linux/power/bq24190_charger.h>
#include <linux/rmi.h>
#include <linux/serdev.h>
Expand Down Expand Up @@ -817,6 +819,7 @@ static struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initdata = {
.modules = bq24190_modules,
.invalid_aei_gpiochip = "INT33FC:02",
.init = lenovo_yoga_tab2_830_1050_init,
.exit = lenovo_yoga_tab2_830_1050_exit,
};

/*
Expand Down Expand Up @@ -863,6 +866,18 @@ static int __init lenovo_yoga_tab2_830_1050_init_display(void)
return 0;
}

/*
* These tablet's DSDT does not set acpi_gbl_reduced_hardware, so acpi_power_off
* gets used as pm_power_off handler. This causes "poweroff" on these tablets
* to hang hard. Requiring pressing the powerbutton for 30 seconds *twice*
* followed by a normal 3 second press to recover. Avoid this by doing an EFI
* poweroff instead.
*/
static void lenovo_yoga_tab2_830_1050_power_off(void)
{
efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL);
}

static int __init lenovo_yoga_tab2_830_1050_init(void)
{
int ret;
Expand All @@ -871,9 +886,15 @@ static int __init lenovo_yoga_tab2_830_1050_init(void)
if (ret)
return ret;

pm_power_off = lenovo_yoga_tab2_830_1050_power_off;
return 0;
}

static void lenovo_yoga_tab2_830_1050_exit(void)
{
pm_power_off = NULL; /* Just turn poweroff into halt on module unload */
}

/* Nextbook Ares 8 tablets have an Android factory img with everything hardcoded */
static const char * const nextbook_ares8_accel_mount_matrix[] = {
"0", "-1", "0",
Expand Down

0 comments on commit bf8fd1a

Please sign in to comment.