blob: ee2d8c6f91300db725b3681c830d4568de71cb19 [file] [log] [blame]
Phil Blundell78a56aa2007-01-18 00:44:09 -05001#ifndef _GPIO_KEYS_H
2#define _GPIO_KEYS_H
3
Heiko Stübnerb18db3d2012-02-01 09:12:24 -08004struct device;
Aaron Lu633a21d2014-10-21 23:30:25 +02005struct gpio_desc;
Heiko Stübnerb18db3d2012-02-01 09:12:24 -08006
Andy Shevchenko542ad4f2014-04-25 15:08:29 -07007/**
8 * struct gpio_keys_button - configuration parameters
9 * @code: input event code (KEY_*, SW_*)
10 * @gpio: %-1 if this key does not support gpio
11 * @active_low: %true indicates that button is considered
12 * depressed when gpio is low
13 * @desc: label that will be attached to button's gpio
14 * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS)
15 * @wakeup: configure the button as a wake-up source
16 * @debounce_interval: debounce ticks interval in msecs
17 * @can_disable: %true indicates that userspace is allowed to
18 * disable button via sysfs
19 * @value: axis value for %EV_ABS
20 * @irq: Irq number in case of interrupt keys
Aaron Lu633a21d2014-10-21 23:30:25 +020021 * @gpiod: GPIO descriptor
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070022 */
Phil Blundell78a56aa2007-01-18 00:44:09 -050023struct gpio_keys_button {
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070024 unsigned int code;
25 int gpio;
Phil Blundell78a56aa2007-01-18 00:44:09 -050026 int active_low;
Alexander Stein92a47672011-04-11 23:34:37 -070027 const char *desc;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070028 unsigned int type;
29 int wakeup;
30 int debounce_interval;
Mika Westerberg9e3af042010-02-04 00:48:00 -080031 bool can_disable;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070032 int value;
33 unsigned int irq;
Aaron Lu633a21d2014-10-21 23:30:25 +020034 struct gpio_desc *gpiod;
Phil Blundell78a56aa2007-01-18 00:44:09 -050035};
36
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070037/**
38 * struct gpio_keys_platform_data - platform data for gpio_keys driver
39 * @buttons: pointer to array of &gpio_keys_button structures
40 * describing buttons attached to the device
41 * @nbuttons: number of elements in @buttons array
42 * @poll_interval: polling interval in msecs - for polling driver only
43 * @rep: enable input subsystem auto repeat
44 * @enable: platform hook for enabling the device
45 * @disable: platform hook for disabling the device
46 * @name: input device name
47 */
Phil Blundell78a56aa2007-01-18 00:44:09 -050048struct gpio_keys_platform_data {
49 struct gpio_keys_button *buttons;
50 int nbuttons;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070051 unsigned int poll_interval;
52 unsigned int rep:1;
Shubhrajyoti D173bdd72010-08-03 19:44:40 -070053 int (*enable)(struct device *dev);
54 void (*disable)(struct device *dev);
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070055 const char *name;
Phil Blundell78a56aa2007-01-18 00:44:09 -050056};
57
58#endif