From: Hans de Goede <hdegoede@redhat.com>
To: Mark Gross <markgross@kernel.org>,
Andy Shevchenko <andy@kernel.org>,
Mika Westerberg <mika.westerberg@linux.intel.com>,
Linus Walleij <linus.walleij@linaro.org>
Cc: Hans de Goede <hdegoede@redhat.com>,
platform-driver-x86@vger.kernel.org, linux-gpio@vger.kernel.org
Subject: [PATCH 4/5] platform/x86: x86-android-tablets: Workaround Lenovo Yoga Tablet 2 830/1050 poweroff hang
Date: Wed, 23 Feb 2022 14:31:52 +0100 [thread overview]
Message-ID: <20220223133153.730337-5-hdegoede@redhat.com> (raw)
In-Reply-To: <20220223133153.730337-1-hdegoede@redhat.com>
These tablets' 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 overriding the global pm_power_off handler to do
an EFI poweroff instead.
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
---
drivers/platform/x86/x86-android-tablets.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/drivers/platform/x86/x86-android-tablets.c b/drivers/platform/x86/x86-android-tablets.c
index 89972723f546..c3d2b30dbe26 100644
--- a/drivers/platform/x86/x86-android-tablets.c
+++ b/drivers/platform/x86/x86-android-tablets.c
@@ -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>
@@ -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>
@@ -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,
};
/*
@@ -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;
@@ -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",
--
2.35.1
next prev parent reply other threads:[~2022-02-23 13:32 UTC|newest]
Thread overview: 19+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-02-23 13:31 [PATCH 0/5] pinctrl/baytrail platform/x86: SUS6 mux / Lenovo Yoga Tablet 2 support Hans de Goede
2022-02-23 13:31 ` [PATCH 1/5] pinctrl: baytrail: Add pinconf group + function for the pmu_clk Hans de Goede
2022-02-23 14:54 ` Andy Shevchenko
2022-02-23 15:27 ` Andy Shevchenko
2022-02-23 13:31 ` [PATCH 2/5] platform/x86: x86-android-tablets: Fix EBUSY error when requesting IOAPIC IRQs Hans de Goede
2022-02-23 14:56 ` Andy Shevchenko
2022-02-23 15:16 ` Hans de Goede
2022-02-23 15:38 ` Andy Shevchenko
2022-02-24 16:49 ` Hans de Goede
2022-02-23 13:31 ` [PATCH 3/5] platform/x86: x86-android-tablets: Add Lenovo Yoga Tablet 2 830 / 1050 data Hans de Goede
2022-02-23 15:04 ` Andy Shevchenko
2022-02-23 13:31 ` Hans de Goede [this message]
2022-02-23 14:58 ` [PATCH 4/5] platform/x86: x86-android-tablets: Workaround Lenovo Yoga Tablet 2 830/1050 poweroff hang Andy Shevchenko
2022-02-24 16:57 ` Hans de Goede
2022-02-25 16:35 ` Andy Shevchenko
2022-02-23 13:31 ` [PATCH 5/5] platform/x86: x86-android-tablets: Lenovo Yoga Tablet 2 830/1050 sound support Hans de Goede
2022-02-23 15:04 ` Andy Shevchenko
2022-02-23 14:55 ` [PATCH 0/5] pinctrl/baytrail platform/x86: SUS6 mux / Lenovo Yoga Tablet 2 support Andy Shevchenko
2022-02-24 16:43 ` Hans de Goede
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220223133153.730337-5-hdegoede@redhat.com \
--to=hdegoede@redhat.com \
--cc=andy@kernel.org \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=markgross@kernel.org \
--cc=mika.westerberg@linux.intel.com \
--cc=platform-driver-x86@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox