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; |
Aaron Lu | 633a21d | 2014-10-21 23:30:25 +0200 | [diff] [blame] | 5 | struct gpio_desc; |
Heiko Stübner | b18db3d | 2012-02-01 09:12:24 -0800 | [diff] [blame] | 6 | |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 7 | /** |
| 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 Lu | 633a21d | 2014-10-21 23:30:25 +0200 | [diff] [blame] | 21 | * @gpiod: GPIO descriptor |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 22 | */ |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 23 | struct gpio_keys_button { |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 24 | unsigned int code; |
| 25 | int gpio; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 26 | int active_low; |
Alexander Stein | 92a4767 | 2011-04-11 23:34:37 -0700 | [diff] [blame] | 27 | const char *desc; |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 28 | unsigned int type; |
| 29 | int wakeup; |
| 30 | int debounce_interval; |
Mika Westerberg | 9e3af04 | 2010-02-04 00:48:00 -0800 | [diff] [blame] | 31 | bool can_disable; |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 32 | int value; |
| 33 | unsigned int irq; |
Aaron Lu | 633a21d | 2014-10-21 23:30:25 +0200 | [diff] [blame] | 34 | struct gpio_desc *gpiod; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 35 | }; |
| 36 | |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 37 | /** |
| 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 Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 48 | struct gpio_keys_platform_data { |
| 49 | struct gpio_keys_button *buttons; |
| 50 | int nbuttons; |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 51 | unsigned int poll_interval; |
| 52 | unsigned int rep:1; |
Shubhrajyoti D | 173bdd7 | 2010-08-03 19:44:40 -0700 | [diff] [blame] | 53 | int (*enable)(struct device *dev); |
| 54 | void (*disable)(struct device *dev); |
Andy Shevchenko | 542ad4f | 2014-04-25 15:08:29 -0700 | [diff] [blame] | 55 | const char *name; |
Phil Blundell | 78a56aa | 2007-01-18 00:44:09 -0500 | [diff] [blame] | 56 | }; |
| 57 | |
| 58 | #endif |