summaryrefslogtreecommitdiff
path: root/drivers/platform/x86/x86-android-tablets/lenovo.c
diff options
context:
space:
mode:
authorHans de Goede <hdegoede@redhat.com>2023-02-25 19:11:04 +0300
committerHans de Goede <hdegoede@redhat.com>2023-03-07 14:08:31 +0300
commitdadbc368f4f26f59debe49e1cdf44883e8799fd2 (patch)
tree26134e718fd7497891d8ca0bf4e0f5f0b82b01f7 /drivers/platform/x86/x86-android-tablets/lenovo.c
parent607fbac0fccba506b4f9e47994504121db776956 (diff)
downloadlinux-dadbc368f4f26f59debe49e1cdf44883e8799fd2.tar.xz
platform/x86: x86-android-tablets: Add LID switch support for Yoga Tablet 2 1050/830 series
The Yoga Tablet 2 1050/830 series have a HALL sensor for detecting when their (optional) case/cover is closed over the screen. Their Windows counterparts (alsmost the same HW, different BIOS) model this as a LID switch. Add support for reporting this as a LID switch on the Android models too. Signed-off-by: Hans de Goede <hdegoede@redhat.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Link: https://lore.kernel.org/r/20230301092331.7038-14-hdegoede@redhat.com
Diffstat (limited to 'drivers/platform/x86/x86-android-tablets/lenovo.c')
-rw-r--r--drivers/platform/x86/x86-android-tablets/lenovo.c14
1 files changed, 14 insertions, 0 deletions
diff --git a/drivers/platform/x86/x86-android-tablets/lenovo.c b/drivers/platform/x86/x86-android-tablets/lenovo.c
index e9eae09784ef..ec29c4d24451 100644
--- a/drivers/platform/x86/x86-android-tablets/lenovo.c
+++ b/drivers/platform/x86/x86-android-tablets/lenovo.c
@@ -56,6 +56,19 @@ static const struct software_node lenovo_yoga_tab2_830_1050_bq24190_node = {
.properties = lenovo_yoga_tab2_830_1050_bq24190_props,
};
+static struct x86_gpio_button lenovo_yoga_tab2_830_1050_lid = {
+ .button = {
+ .code = SW_LID,
+ .active_low = true,
+ .desc = "lid_sw",
+ .type = EV_SW,
+ .wakeup = true,
+ .debounce_interval = 50,
+ },
+ .chip = "INT33FC:02",
+ .pin = 26,
+};
+
/* This gets filled by lenovo_yoga_tab2_830_1050_init() */
static struct rmi_device_platform_data lenovo_yoga_tab2_830_1050_rmi_pdata = { };
@@ -154,6 +167,7 @@ struct x86_dev_info lenovo_yoga_tab2_830_1050_info __initdata = {
/* i2c_client_count gets set by lenovo_yoga_tab2_830_1050_init() */
.pdev_info = int3496_pdevs,
.pdev_count = 1,
+ .gpio_button = &lenovo_yoga_tab2_830_1050_lid,
.gpiod_lookup_tables = lenovo_yoga_tab2_830_1050_gpios,
.bat_swnode = &generic_lipo_hv_4v35_battery_node,
.modules = bq24190_modules,