Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 1 | #ifndef _GPIO_KEYS_H |
| 2 | #define _GPIO_KEYS_H |
| 3 | |
Heiko Stübner | b18db3d | 2012-02-01 09:12:24 -0800 | [diff] [blame] | 4 | struct device; |
| 5 | |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 6 | /** |
| 7 | * struct gpio_keys_button - configuration parameters |
| 8 | * @code: input event code (KEY_*, SW_*) |
| 9 | * @gpio: %-1 if this key does not support gpio |
| 10 | * @active_low: %true indicates that button is considered |
| 11 | * depressed when gpio is low |
| 12 | * @desc: label that will be attached to button's gpio |
| 13 | * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS) |
| 14 | * @wakeup: configure the button as a wake-up source |
| 15 | * @debounce_interval: debounce ticks interval in msecs |
| 16 | * @can_disable: %true indicates that userspace is allowed to |
| 17 | * disable button via sysfs |
| 18 | * @value: axis value for %EV_ABS |
| 19 | * @irq: Irq number in case of interrupt keys |
| 20 | */ |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 21 | struct gpio_keys_button { |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 22 | unsigned int code; |
| 23 | int gpio; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 24 | int active_low; |
Alexander Stein | 92a4767 | 2011-04-11 23:34:37 -0700 | [diff] [blame] | 25 | const char *desc; |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 26 | unsigned int type; |
| 27 | int wakeup; |
| 28 | int debounce_interval; |
Mika Westerberg | 9e3af04 | 2010-02-04 00:48:00 -0800 | [diff] [blame] | 29 | bool can_disable; |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 30 | int value; |
| 31 | unsigned int irq; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 32 | }; |
| 33 | |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 34 | /** |
| 35 | * struct gpio_keys_platform_data - platform data for gpio_keys driver |
| 36 | * @buttons: pointer to array of &gpio_keys_button structures |
| 37 | * describing buttons attached to the device |
| 38 | * @nbuttons: number of elements in @buttons array |
| 39 | * @poll_interval: polling interval in msecs - for polling driver only |
| 40 | * @rep: enable input subsystem auto repeat |
| 41 | * @enable: platform hook for enabling the device |
| 42 | * @disable: platform hook for disabling the device |
| 43 | * @name: input device name |
| 44 | */ |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 45 | struct gpio_keys_platform_data { |
Dmitry Torokhov | 0f78ba9 | 2016-02-23 15:32:14 -0800 | [diff] [blame] | 46 | const struct gpio_keys_button *buttons; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 47 | int nbuttons; |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 48 | unsigned int poll_interval; |
| 49 | unsigned int rep:1; |
Shubhrajyoti D | 173bdd7 | 2010-08-03 19:44:40 -0700 | [diff] [blame] | 50 | int (*enable)(struct device *dev); |
| 51 | void (*disable)(struct device *dev); |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 52 | const char *name; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 53 | }; |
| 54 | |
| 55 | #endif |