blob: d06bf77400f16ae861b938696dae9f2b93d797f9 [file] [log] [blame]
Greg Kroah-Hartmanb2441312017-11-01 15:07:57 +01001/* SPDX-License-Identifier: GPL-2.0 */
Phil Blundell78a56aa2007-01-18 00:44:09 -05002#ifndef _GPIO_KEYS_H
3#define _GPIO_KEYS_H
4
Heiko Stübnerb18db3d2012-02-01 09:12:24 -08005struct device;
6
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
21 */
Phil Blundell78a56aa2007-01-18 00:44:09 -050022struct gpio_keys_button {
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070023 unsigned int code;
24 int gpio;
Phil Blundell78a56aa2007-01-18 00:44:09 -050025 int active_low;
Alexander Stein92a47672011-04-11 23:34:37 -070026 const char *desc;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070027 unsigned int type;
28 int wakeup;
29 int debounce_interval;
Mika Westerberg9e3af042010-02-04 00:48:00 -080030 bool can_disable;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070031 int value;
32 unsigned int irq;
Phil Blundell78a56aa2007-01-18 00:44:09 -050033};
34
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070035/**
36 * struct gpio_keys_platform_data - platform data for gpio_keys driver
37 * @buttons: pointer to array of &gpio_keys_button structures
38 * describing buttons attached to the device
39 * @nbuttons: number of elements in @buttons array
40 * @poll_interval: polling interval in msecs - for polling driver only
41 * @rep: enable input subsystem auto repeat
42 * @enable: platform hook for enabling the device
43 * @disable: platform hook for disabling the device
44 * @name: input device name
45 */
Phil Blundell78a56aa2007-01-18 00:44:09 -050046struct gpio_keys_platform_data {
Dmitry Torokhov0f78ba92016-02-23 15:32:14 -080047 const struct gpio_keys_button *buttons;
Phil Blundell78a56aa2007-01-18 00:44:09 -050048 int nbuttons;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070049 unsigned int poll_interval;
50 unsigned int rep:1;
Shubhrajyoti D173bdd72010-08-03 19:44:40 -070051 int (*enable)(struct device *dev);
52 void (*disable)(struct device *dev);
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070053 const char *name;
Phil Blundell78a56aa2007-01-18 00:44:09 -050054};
55
56#endif