blob: 3f84aeb81e480b238842cc5c0e18478da854778a [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
Matti Vaittinen2b6e6812018-07-18 16:40:46 +00005#include <linux/types.h>
6
Heiko Stübnerb18db3d2012-02-01 09:12:24 -08007struct device;
8
Andy Shevchenko542ad4f2014-04-25 15:08:29 -07009/**
10 * struct gpio_keys_button - configuration parameters
11 * @code: input event code (KEY_*, SW_*)
12 * @gpio: %-1 if this key does not support gpio
13 * @active_low: %true indicates that button is considered
14 * depressed when gpio is low
15 * @desc: label that will be attached to button's gpio
16 * @type: input event type (%EV_KEY, %EV_SW, %EV_ABS)
17 * @wakeup: configure the button as a wake-up source
Jeffy Chen83fc5802018-03-08 16:03:27 -080018 * @wakeup_event_action: event action to trigger wakeup
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070019 * @debounce_interval: debounce ticks interval in msecs
20 * @can_disable: %true indicates that userspace is allowed to
21 * disable button via sysfs
22 * @value: axis value for %EV_ABS
23 * @irq: Irq number in case of interrupt keys
24 */
Phil Blundell78a56aa2007-01-18 00:44:09 -050025struct gpio_keys_button {
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070026 unsigned int code;
27 int gpio;
Phil Blundell78a56aa2007-01-18 00:44:09 -050028 int active_low;
Alexander Stein92a47672011-04-11 23:34:37 -070029 const char *desc;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070030 unsigned int type;
31 int wakeup;
Jeffy Chen83fc5802018-03-08 16:03:27 -080032 int wakeup_event_action;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070033 int debounce_interval;
Mika Westerberg9e3af042010-02-04 00:48:00 -080034 bool can_disable;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070035 int value;
36 unsigned int irq;
Phil Blundell78a56aa2007-01-18 00:44:09 -050037};
38
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070039/**
40 * struct gpio_keys_platform_data - platform data for gpio_keys driver
41 * @buttons: pointer to array of &gpio_keys_button structures
42 * describing buttons attached to the device
43 * @nbuttons: number of elements in @buttons array
44 * @poll_interval: polling interval in msecs - for polling driver only
45 * @rep: enable input subsystem auto repeat
46 * @enable: platform hook for enabling the device
47 * @disable: platform hook for disabling the device
48 * @name: input device name
49 */
Phil Blundell78a56aa2007-01-18 00:44:09 -050050struct gpio_keys_platform_data {
Dmitry Torokhov0f78ba92016-02-23 15:32:14 -080051 const struct gpio_keys_button *buttons;
Phil Blundell78a56aa2007-01-18 00:44:09 -050052 int nbuttons;
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070053 unsigned int poll_interval;
54 unsigned int rep:1;
Shubhrajyoti D173bdd72010-08-03 19:44:40 -070055 int (*enable)(struct device *dev);
56 void (*disable)(struct device *dev);
Andy Shevchenko542ad4f2014-04-25 15:08:29 -070057 const char *name;
Phil Blundell78a56aa2007-01-18 00:44:09 -050058};
59
60#endif