1 #ifndef __LINUX_GPIO_MACHINE_H
2 #define __LINUX_GPIO_MACHINE_H
4 #include <linux/types.h>
5 #include <linux/list.h>
7 enum gpio_lookup_flags
{
8 GPIO_ACTIVE_HIGH
= (0 << 0),
9 GPIO_ACTIVE_LOW
= (1 << 0),
10 GPIO_OPEN_DRAIN
= (1 << 1),
11 GPIO_OPEN_SOURCE
= (1 << 2),
15 * struct gpiod_lookup - lookup table
16 * @chip_label: name of the chip the GPIO belongs to
17 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
18 * @con_id: name of the GPIO from the device's point of view
19 * @idx: index of the GPIO in case several GPIOs share the same name
20 * @flags: mask of GPIO_* values
22 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
23 * functions using platform data.
26 const char *chip_label
;
30 enum gpio_lookup_flags flags
;
33 struct gpiod_lookup_table
{
34 struct list_head list
;
36 struct gpiod_lookup table
[];
40 * Simple definition of a single GPIO under a con_id
42 #define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
43 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
46 * Use this macro if you need to have several GPIOs under the same con_id.
47 * Each GPIO needs to use a different index and can be accessed using
50 #define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
52 .chip_label = _chip_label, \
53 .chip_hwnum = _chip_hwnum, \
59 void gpiod_add_lookup_table(struct gpiod_lookup_table
*table
);
60 void gpiod_remove_lookup_table(struct gpiod_lookup_table
*table
);
62 #endif /* __LINUX_GPIO_MACHINE_H */