diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-02-20 00:50:19 +0300 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-03-07 14:08:31 +0300 |
commit | e2200d3f26dac108a519f014fb42a0a034105394 (patch) | |
tree | 0b8ca3b4e8a0824a54f2e20c0427ad0879de5444 /drivers/platform/x86/x86-android-tablets/asus.c | |
parent | cc183ad4590bef3831c0688ccfa386c595adc428 (diff) | |
download | linux-e2200d3f26dac108a519f014fb42a0a034105394.tar.xz |
platform/x86: x86-android-tablets: Add gpio_keys support to x86_android_tablet_init()
Add gpio_keys instantation support to x86_android_tablet_init(), to avoid
this having to be repeated in various x86_dev_info.init() functions.
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-10-hdegoede@redhat.com
Diffstat (limited to 'drivers/platform/x86/x86-android-tablets/asus.c')
-rw-r--r-- | drivers/platform/x86/x86-android-tablets/asus.c | 65 |
1 files changed, 16 insertions, 49 deletions
diff --git a/drivers/platform/x86/x86-android-tablets/asus.c b/drivers/platform/x86/x86-android-tablets/asus.c index 74c3b10e9ca7..cfa038b44b43 100644 --- a/drivers/platform/x86/x86-android-tablets/asus.c +++ b/drivers/platform/x86/x86-android-tablets/asus.c @@ -8,8 +8,6 @@ * Copyright (C) 2021-2023 Hans de Goede <hdegoede@redhat.com> */ -#include <linux/gpio_keys.h> -#include <linux/gpio/consumer.h> #include <linux/gpio/machine.h> #include <linux/input.h> #include <linux/platform_device.h> @@ -26,50 +24,19 @@ static struct gpiod_lookup_table int3496_gpo2_pin22_gpios = { }, }; -static struct gpio_keys_button asus_me176c_tf103c_lid = { - .code = SW_LID, - /* .gpio gets filled in by asus_me176c_tf103c_init() */ - .active_low = true, - .desc = "lid_sw", - .type = EV_SW, - .wakeup = true, - .debounce_interval = 50, -}; - -static const struct gpio_keys_platform_data asus_me176c_tf103c_lid_pdata __initconst = { - .buttons = &asus_me176c_tf103c_lid, - .nbuttons = 1, - .name = "lid_sw", -}; - -static const struct platform_device_info asus_me176c_tf103c_pdevs[] __initconst = { - { - .name = "gpio-keys", - .id = PLATFORM_DEVID_AUTO, - .data = &asus_me176c_tf103c_lid_pdata, - .size_data = sizeof(asus_me176c_tf103c_lid_pdata), - }, - { - /* For micro USB ID pin handling */ - .name = "intel-int3496", - .id = PLATFORM_DEVID_NONE, +static struct x86_gpio_button asus_me176c_tf103c_lid = { + .button = { + .code = SW_LID, + .active_low = true, + .desc = "lid_sw", + .type = EV_SW, + .wakeup = true, + .debounce_interval = 50, }, + .chip = "INT33FC:02", + .pin = 12, }; -static int __init asus_me176c_tf103c_init(void) -{ - struct gpio_desc *gpiod; - int ret; - - ret = x86_android_tablet_get_gpiod("INT33FC:02", 12, &gpiod); - if (ret < 0) - return ret; - asus_me176c_tf103c_lid.gpio = desc_to_gpio(gpiod); - - return 0; -} - - /* Asus ME176C tablets have an Android factory img with everything hardcoded */ static const char * const asus_me176c_accel_mount_matrix[] = { "-1", "0", "0", @@ -203,15 +170,15 @@ static struct gpiod_lookup_table * const asus_me176c_gpios[] = { const struct x86_dev_info asus_me176c_info __initconst = { .i2c_client_info = asus_me176c_i2c_clients, .i2c_client_count = ARRAY_SIZE(asus_me176c_i2c_clients), - .pdev_info = asus_me176c_tf103c_pdevs, - .pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs), + .pdev_info = int3496_pdevs, + .pdev_count = 1, .serdev_info = asus_me176c_serdevs, .serdev_count = ARRAY_SIZE(asus_me176c_serdevs), + .gpio_button = &asus_me176c_tf103c_lid, .gpiod_lookup_tables = asus_me176c_gpios, .bat_swnode = &generic_lipo_hv_4v35_battery_node, .modules = bq24190_modules, .invalid_aei_gpiochip = "INT33FC:02", - .init = asus_me176c_tf103c_init, }; /* Asus TF103C tablets have an Android factory img with everything hardcoded */ @@ -348,11 +315,11 @@ static struct gpiod_lookup_table * const asus_tf103c_gpios[] = { const struct x86_dev_info asus_tf103c_info __initconst = { .i2c_client_info = asus_tf103c_i2c_clients, .i2c_client_count = ARRAY_SIZE(asus_tf103c_i2c_clients), - .pdev_info = asus_me176c_tf103c_pdevs, - .pdev_count = ARRAY_SIZE(asus_me176c_tf103c_pdevs), + .pdev_info = int3496_pdevs, + .pdev_count = 1, + .gpio_button = &asus_me176c_tf103c_lid, .gpiod_lookup_tables = asus_tf103c_gpios, .bat_swnode = &asus_tf103c_battery_node, .modules = bq24190_modules, .invalid_aei_gpiochip = "INT33FC:02", - .init = asus_me176c_tf103c_init, }; |