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),
12 GPIO_SLEEP_MAINTAIN_VALUE
= (0 << 3),
13 GPIO_SLEEP_MAY_LOOSE_VALUE
= (1 << 3),
17 * struct gpiod_lookup - lookup table
18 * @chip_label: name of the chip the GPIO belongs to
19 * @chip_hwnum: hardware number (i.e. relative to the chip) of the GPIO
20 * @con_id: name of the GPIO from the device's point of view
21 * @idx: index of the GPIO in case several GPIOs share the same name
22 * @flags: mask of GPIO_* values
24 * gpiod_lookup is a lookup table for associating GPIOs to specific devices and
25 * functions using platform data.
28 const char *chip_label
;
32 enum gpio_lookup_flags flags
;
35 struct gpiod_lookup_table
{
36 struct list_head list
;
38 struct gpiod_lookup table
[];
42 * Simple definition of a single GPIO under a con_id
44 #define GPIO_LOOKUP(_chip_label, _chip_hwnum, _con_id, _flags) \
45 GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, 0, _flags)
48 * Use this macro if you need to have several GPIOs under the same con_id.
49 * Each GPIO needs to use a different index and can be accessed using
52 #define GPIO_LOOKUP_IDX(_chip_label, _chip_hwnum, _con_id, _idx, _flags) \
54 .chip_label = _chip_label, \
55 .chip_hwnum = _chip_hwnum, \
62 void gpiod_add_lookup_table(struct gpiod_lookup_table
*table
);
63 void gpiod_remove_lookup_table(struct gpiod_lookup_table
*table
);
66 void gpiod_add_lookup_table(struct gpiod_lookup_table
*table
) {}
68 void gpiod_remove_lookup_table(struct gpiod_lookup_table
*table
) {}
71 #endif /* __LINUX_GPIO_MACHINE_H */