coreboot
coreboot is an Open Source project aimed at replacing the proprietary BIOS found in most computers.
chip.h
Go to the documentation of this file.
1 /* SPDX-License-Identifier: GPL-2.0-only */
2 
3 #ifndef __DRIVERS_GENERIC_GPIO_KEYS_H__
4 #define __DRIVERS_GENERIC_GPIO_KEYS_H__
5 
6 #include <acpi/acpi_device.h>
7 #include <stdint.h>
8 
9 /* Linux input type */
10 enum {
11  /* Switch event */
12  EV_SW = 0x5,
13 };
14 
15 /* Switch events type (Linux code emitted for EV_SW) */
16 enum {
19 };
20 
21 /* Trigger for wakeup event action */
22 enum {
26 };
27 
28 enum {
29  /*
30  * GPIO key uses SCI route to wake the system from suspend state. This is typically used
31  * when the input line is dual routed i.e. one for IRQ and other for SCI or if the GPIO
32  * controller is capable of handling the filtering for IRQ and SCI separately. This
33  * requires "wake" property to be provided by the board which represents the GPE # for
34  * wake. It is exposed as _PRW in ACPI tables.
35  */
37  /*
38  * GPIO key uses GPIO controller IRQ route for wake. This is used when IRQ and wake are
39  * routed to the same pad and the GPIO controller is not capable of handling the trigger
40  * filtering separately for IRQ and wake. Kernel driver for gpio-keys takes care of
41  * reconfiguring the IRQ trigger as both edges when used in S0 and the edge requested by
42  * BIOS (as per wakeup_event_action) when entering suspend. In this case, _PRW is not
43  * exposed for the key device.
44  */
46  /* GPIO key does not support wake. */
48 };
49 
50 /* Details of the child node defining key */
51 struct key_info {
52  /* Device name of the child node - Mandatory */
53  const char *dev_name;
54  /* Keycode emitted for this key - Mandatory */
56  /*
57  * Event type generated for this key
58  * See EV_* above.
59  */
61  /* Descriptive name of the key */
62  const char *label;
63  /* Wakeup route (if any) for the key. See WAKEUP_ROUTE_* macros above. */
64  unsigned int wakeup_route;
65  /* Wake GPE -- SCI GPE # for wake. Required for WAKEUP_ROUTE_SCI. */
66  unsigned int wake_gpe;
67  /* Trigger for Wakeup Event Action as defined in EV_ACT_* enum */
68  unsigned int wakeup_event_action;
69  /* Can this key be disabled? */
71  /* Debounce interval time in milliseconds */
73 };
74 
76  /* Device name of the parent gpio-keys node */
77  const char *name;
78  /* Name of the input device - Optional */
79  const char *label;
80  /* GPIO line providing the key - Mandatory */
81  struct acpi_gpio gpio;
82  /* Is this a polled GPIO button? - Optional */
83  bool is_polled;
84  /* Poll interval - Mandatory only if GPIO is polled. */
86  /* Details about the key - Mandatory */
87  struct key_info key;
88 };
89 
90 #endif /* __DRIVERS_GENERIC_GPIO_KEYS_H__ */
@ EV_SW
Definition: chip.h:12
@ EV_ACT_ANY
Definition: chip.h:23
@ EV_ACT_DEASSERTED
Definition: chip.h:25
@ EV_ACT_ASSERTED
Definition: chip.h:24
@ WAKEUP_ROUTE_GPIO_IRQ
Definition: chip.h:45
@ WAKEUP_ROUTE_DISABLED
Definition: chip.h:47
@ WAKEUP_ROUTE_SCI
Definition: chip.h:36
@ SW_PEN_INSERTED
Definition: chip.h:18
@ SW_MUTE_DEVICE
Definition: chip.h:17
unsigned int uint32_t
Definition: stdint.h:14
struct key_info key
Definition: chip.h:87
Definition: pinmux.c:36
Definition: chip.h:51
uint32_t linux_input_type
Definition: chip.h:60
uint32_t linux_code
Definition: chip.h:55
unsigned int wakeup_route
Definition: chip.h:64
const char * dev_name
Definition: chip.h:53
bool can_be_disabled
Definition: chip.h:70
const char * label
Definition: chip.h:62
uint32_t debounce_interval
Definition: chip.h:72
unsigned int wake_gpe
Definition: chip.h:66
unsigned int wakeup_event_action
Definition: chip.h:68