Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 #ifndef _GPIO_KEYS_H
0003 #define _GPIO_KEYS_H
0004 
0005 #include <linux/types.h>
0006 
0007 struct device;
0008 
0009 /**
0010  * struct gpio_keys_button - configuration parameters
0011  * @code:       input event code (KEY_*, SW_*)
0012  * @gpio:       %-1 if this key does not support gpio
0013  * @active_low:     %true indicates that button is considered
0014  *          depressed when gpio is low
0015  * @desc:       label that will be attached to button's gpio
0016  * @type:       input event type (%EV_KEY, %EV_SW, %EV_ABS)
0017  * @wakeup:     configure the button as a wake-up source
0018  * @wakeup_event_action:    event action to trigger wakeup
0019  * @debounce_interval:  debounce ticks interval in msecs
0020  * @can_disable:    %true indicates that userspace is allowed to
0021  *          disable button via sysfs
0022  * @value:      axis value for %EV_ABS
0023  * @irq:        Irq number in case of interrupt keys
0024  */
0025 struct gpio_keys_button {
0026     unsigned int code;
0027     int gpio;
0028     int active_low;
0029     const char *desc;
0030     unsigned int type;
0031     int wakeup;
0032     int wakeup_event_action;
0033     int debounce_interval;
0034     bool can_disable;
0035     int value;
0036     unsigned int irq;
0037 };
0038 
0039 /**
0040  * struct gpio_keys_platform_data - platform data for gpio_keys driver
0041  * @buttons:        pointer to array of &gpio_keys_button structures
0042  *          describing buttons attached to the device
0043  * @nbuttons:       number of elements in @buttons array
0044  * @poll_interval:  polling interval in msecs - for polling driver only
0045  * @rep:        enable input subsystem auto repeat
0046  * @enable:     platform hook for enabling the device
0047  * @disable:        platform hook for disabling the device
0048  * @name:       input device name
0049  */
0050 struct gpio_keys_platform_data {
0051     const struct gpio_keys_button *buttons;
0052     int nbuttons;
0053     unsigned int poll_interval;
0054     unsigned int rep:1;
0055     int (*enable)(struct device *dev);
0056     void (*disable)(struct device *dev);
0057     const char *name;
0058 };
0059 
0060 #endif