blob: 8b622468952c427470fa44905ba991d7220a0d68 [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;
5
Andy Shevchenko542ad4f2014-04-25 15:08:29 -07006/**
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 Blundell78a56aa2007-01-18 00:44:09 -050021struct gpio_keys_button {
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070022 unsigned int code;
23 int gpio;
Phil Blundell78a56aa2007-01-18 00:44:09 -050024 int active_low;
Alexander Stein92a47672011-04-11 23:34:37 -070025 const char *desc;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070026 unsigned int type;
27 int wakeup;
28 int debounce_interval;
Mika Westerberg9e3af042010-02-04 00:48:00 -080029 bool can_disable;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070030 int value;
31 unsigned int irq;
Phil Blundell78a56aa2007-01-18 00:44:09 -050032};
33
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070034/**
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 Blundell78a56aa2007-01-18 00:44:09 -050045struct gpio_keys_platform_data {
46 struct gpio_keys_button *buttons;
47 int nbuttons;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070048 unsigned int poll_interval;
49 unsigned int rep:1;
Shubhrajyoti D173bdd72010-08-03 19:44:40 -070050 int (*enable)(struct device *dev);
51 void (*disable)(struct device *dev);
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070052 const char *name;
Phil Blundell78a56aa2007-01-18 00:44:09 -050053};
54
55#endif