platform/x86: x86-android-tablets: Add LID switch support for Yoga Tablet 2 1050...
authorHans de Goede <hdegoede@redhat.com>
Sat, 25 Feb 2023 16:11:04 +0000 (17:11 +0100)
committerHans de Goede <hdegoede@redhat.com>
Tue, 7 Mar 2023 11:08:31 +0000 (12:08 +0100)
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
drivers/platform/x86/x86-android-tablets/lenovo.c

index e9eae09..ec29c4d 100644 (file)
@@ -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,