Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

platform/x86: x86-android-tablets: Workaround Lenovo Yoga Tablet 2 830/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

+21
+21
drivers/platform/x86/x86-android-tablets.c
··· 12 12 13 13 #include <linux/acpi.h> 14 14 #include <linux/dmi.h> 15 + #include <linux/efi.h> 15 16 #include <linux/gpio_keys.h> 16 17 #include <linux/gpio/consumer.h> 17 18 #include <linux/gpio/driver.h> ··· 25 24 #include <linux/mod_devicetable.h> 26 25 #include <linux/platform_data/lp855x.h> 27 26 #include <linux/platform_device.h> 27 + #include <linux/pm.h> 28 28 #include <linux/power/bq24190_charger.h> 29 29 #include <linux/rmi.h> 30 30 #include <linux/serdev.h> ··· 819 817 .modules = bq24190_modules, 820 818 .invalid_aei_gpiochip = "INT33FC:02", 821 819 .init = lenovo_yoga_tab2_830_1050_init, 820 + .exit = lenovo_yoga_tab2_830_1050_exit, 822 821 }; 823 822 824 823 /* ··· 866 863 return 0; 867 864 } 868 865 866 + /* 867 + * These tablet's DSDT does not set acpi_gbl_reduced_hardware, so acpi_power_off 868 + * gets used as pm_power_off handler. This causes "poweroff" on these tablets 869 + * to hang hard. Requiring pressing the powerbutton for 30 seconds *twice* 870 + * followed by a normal 3 second press to recover. Avoid this by doing an EFI 871 + * poweroff instead. 872 + */ 873 + static void lenovo_yoga_tab2_830_1050_power_off(void) 874 + { 875 + efi.reset_system(EFI_RESET_SHUTDOWN, EFI_SUCCESS, 0, NULL); 876 + } 877 + 869 878 static int __init lenovo_yoga_tab2_830_1050_init(void) 870 879 { 871 880 int ret; ··· 886 871 if (ret) 887 872 return ret; 888 873 874 + pm_power_off = lenovo_yoga_tab2_830_1050_power_off; 889 875 return 0; 876 + } 877 + 878 + static void lenovo_yoga_tab2_830_1050_exit(void) 879 + { 880 + pm_power_off = NULL; /* Just turn poweroff into halt on module unload */ 890 881 } 891 882 892 883 /* Nextbook Ares 8 tablets have an Android factory img with everything hardcoded */