platform/x86: x86-android-tablets: Add Advantech MICA-071 extra button
PATCH 1/1 platform/x86: x86-android-tablets: Add Advantech MICA-071 extra button
The Advantech MICA-071 is a standard Windows tablet, but it has an extra "quick launch" button which is not described in the ACPI tables in anyway.
Use the x86-android-tablets infra to create a gpio-button device for this.
Signed-off-by Hans de Goede <[email protected]>
--- drivers/platform/x86/x86-android-tablets.c | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+)
drivers/platform/x86/x86-android-tablets.c +58 -0
@@ -265,6 +265,56 @@ static struct gpiod_lookup_table int3496_gpo2_pin22_gpios = { }, }; +/* +* Advantech MICA-071 +* This is a standard Windows tablet, but it has an extra "quick launch" button +* 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 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 ; +} + +static 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, +}; +/* Asus ME176C and TF103C tablets shared data */ static struct gpio_keys_button asus_me176c_tf103c_lid = { .code =SW_LID ,
@@ -1379,6 +1429,14 @@ static const struct x86_dev_info xiaomi_mipad2_info __initconst = { };static const struct dmi_system_id x86_android_tablet_ids[]__initconst = { + { +/* Advantech MICA-071 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Advantech" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"MICA-071" ), + }, + .driver_data = (void *)&advantech_mica_071_info, + }, {/* Asus MeMO Pad 7 ME176C */ .matches = {
Signature · 1 line
2.38.1
Hi,
Quoted 6 lines · Hans de Goede
The Advantech MICA-071 is a standard Windows tablet, but it has an extra "quick launch" button which is not described in the ACPI tables in anyway.
Use the x86-android-tablets infra to create a gpio-button device for this.
Signed-off-by Hans de Goede <[email protected]>
I've added this to my review-hans (soon to be for-next) branch now.
Regards,
Hans
Quoted 80 lines
--- drivers/platform/x86/x86-android-tablets.c | 58 ++++++++++++++++++++++ 1 file changed, 58 insertions(+)drivers/platform/x86/x86-android-tablets.c +58
-0@@ -265,6 +265,56 @@ static struct gpiod_lookup_table int3496_gpo2_pin22_gpios = { }, }; +/* +* Advantech MICA-071 +* This is a standard Windows tablet, but it has an extra "quick launch" button +* 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 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 ; +} + +static 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, +}; +/* Asus ME176C and TF103C tablets shared data */ static struct gpio_keys_button asus_me176c_tf103c_lid = { .code =SW_LID ,@@ -1379,6 +1429,14 @@ static const struct x86_dev_info xiaomi_mipad2_info __initconst = { };static const struct dmi_system_id x86_android_tablet_ids[]__initconst = { + { +/* Advantech MICA-071 */ + .matches = { +DMI_EXACT_MATCH (DMI_SYS_VENDOR ,"Advantech" ), +DMI_EXACT_MATCH (DMI_PRODUCT_NAME ,"MICA-071" ), + }, + .driver_data = (void *)&advantech_mica_071_info, + }, {/* Asus MeMO Pad 7 ME176C */ .matches = {