gpio_keys.h 1.74 KB
Newer Older
1
/* SPDX-License-Identifier: GPL-2.0 */
2 3 4
#ifndef _GPIO_KEYS_H
#define _GPIO_KEYS_H

5 6
#include <linux/types.h>

7 8
struct device;

9 10 11 12 13 14 15 16 17
/**
 * struct gpio_keys_button - configuration parameters
 * @code:		input event code (KEY_*, SW_*)
 * @gpio:		%-1 if this key does not support gpio
 * @active_low:		%true indicates that button is considered
 *			depressed when gpio is low
 * @desc:		label that will be attached to button's gpio
 * @type:		input event type (%EV_KEY, %EV_SW, %EV_ABS)
 * @wakeup:		configure the button as a wake-up source
18
 * @wakeup_event_action:	event action to trigger wakeup
19 20 21 22 23 24
 * @debounce_interval:	debounce ticks interval in msecs
 * @can_disable:	%true indicates that userspace is allowed to
 *			disable button via sysfs
 * @value:		axis value for %EV_ABS
 * @irq:		Irq number in case of interrupt keys
 */
25
struct gpio_keys_button {
26 27
	unsigned int code;
	int gpio;
28
	int active_low;
29
	const char *desc;
30 31
	unsigned int type;
	int wakeup;
32
	int wakeup_event_action;
33
	int debounce_interval;
34
	bool can_disable;
35 36
	int value;
	unsigned int irq;
37 38
};

39 40 41 42 43 44 45 46 47 48 49
/**
 * struct gpio_keys_platform_data - platform data for gpio_keys driver
 * @buttons:		pointer to array of &gpio_keys_button structures
 *			describing buttons attached to the device
 * @nbuttons:		number of elements in @buttons array
 * @poll_interval:	polling interval in msecs - for polling driver only
 * @rep:		enable input subsystem auto repeat
 * @enable:		platform hook for enabling the device
 * @disable:		platform hook for disabling the device
 * @name:		input device name
 */
50
struct gpio_keys_platform_data {
51
	const struct gpio_keys_button *buttons;
52
	int nbuttons;
53 54
	unsigned int poll_interval;
	unsigned int rep:1;
55 56
	int (*enable)(struct device *dev);
	void (*disable)(struct device *dev);
57
	const char *name;
58 59 60
};

#endif