diff options
author | Hans de Goede <hdegoede@redhat.com> | 2023-02-19 22:50:19 +0100 |
---|---|---|
committer | Hans de Goede <hdegoede@redhat.com> | 2023-03-07 12:08:31 +0100 |
commit | e2200d3f26dac108a519f014fb42a0a034105394 (patch) | |
tree | 0b8ca3b4e8a0824a54f2e20c0427ad0879de5444 /drivers/platform/x86/x86-android-tablets/other.c | |
parent | cc183ad4590bef3831c0688ccfa386c595adc428 (diff) | |
download | linux-stable-e2200d3f26dac108a519f014fb42a0a034105394.tar.gz linux-stable-e2200d3f26dac108a519f014fb42a0a034105394.tar.bz2 linux-stable-e2200d3f26dac108a519f014fb42a0a034105394.zip |
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/other.c')
-rw-r--r-- | drivers/platform/x86/x86-android-tablets/other.c | 51 |
1 files changed, 11 insertions, 40 deletions
diff --git a/drivers/platform/x86/x86-android-tablets/other.c b/drivers/platform/x86/x86-android-tablets/other.c index 83b30b24d57f..c1bde42315c4 100644 --- a/drivers/platform/x86/x86-android-tablets/other.c +++ b/drivers/platform/x86/x86-android-tablets/other.c @@ -9,8 +9,6 @@ */ #include <linux/acpi.h> -#include <linux/gpio_keys.h> -#include <linux/gpio/consumer.h> #include <linux/gpio/machine.h> #include <linux/input.h> #include <linux/platform_device.h> @@ -96,48 +94,21 @@ const struct x86_dev_info acer_b1_750_info __initconst = { * which is not described in the ACPI tables in anyway. * Use the x86-android-tablets infra to create a gpio-button device for this. */ -static struct gpio_keys_button advantech_mica_071_button = { - .code = KEY_PROG1, - /* .gpio gets filled in by advantech_mica_071_init() */ - .active_low = true, - .desc = "prog1_key", - .type = EV_KEY, - .wakeup = false, - .debounce_interval = 50, -}; - -static const struct gpio_keys_platform_data advantech_mica_071_button_pdata __initconst = { - .buttons = &advantech_mica_071_button, - .nbuttons = 1, - .name = "prog1_key", -}; - -static const struct platform_device_info advantech_mica_071_pdevs[] __initconst = { - { - .name = "gpio-keys", - .id = PLATFORM_DEVID_AUTO, - .data = &advantech_mica_071_button_pdata, - .size_data = sizeof(advantech_mica_071_button_pdata), +static struct x86_gpio_button advantech_mica_071_button = { + .button = { + .code = KEY_PROG1, + .active_low = true, + .desc = "prog1_key", + .type = EV_KEY, + .wakeup = false, + .debounce_interval = 50, }, + .chip = "INT33FC:00", + .pin = 2, }; -static int __init advantech_mica_071_init(void) -{ - struct gpio_desc *gpiod; - int ret; - - ret = x86_android_tablet_get_gpiod("INT33FC:00", 2, &gpiod); - if (ret < 0) - return ret; - advantech_mica_071_button.gpio = desc_to_gpio(gpiod); - - return 0; -} - const struct x86_dev_info advantech_mica_071_info __initconst = { - .pdev_info = advantech_mica_071_pdevs, - .pdev_count = ARRAY_SIZE(advantech_mica_071_pdevs), - .init = advantech_mica_071_init, + .gpio_button = &advantech_mica_071_button, }; /* |