xref: /linux-6.15/include/linux/gpio_keys.h (revision bb7e5ce7)
1 #ifndef _GPIO_KEYS_H
2 #define _GPIO_KEYS_H
3 
4 struct device;
5 
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  */
21 struct gpio_keys_button {
22 	unsigned int code;
23 	int gpio;
24 	int active_low;
25 	const char *desc;
26 	unsigned int type;
27 	int wakeup;
28 	int debounce_interval;
29 	bool can_disable;
30 	int value;
31 	unsigned int irq;
32 };
33 
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  */
45 struct gpio_keys_platform_data {
46 	const struct gpio_keys_button *buttons;
47 	int nbuttons;
48 	unsigned int poll_interval;
49 	unsigned int rep:1;
50 	int (*enable)(struct device *dev);
51 	void (*disable)(struct device *dev);
52 	const char *name;
53 };
54 
55 #endif
56