History

gpio: add new SET_CONFIG ioctl() to gpio chardev

Add the GPIOHANDLE_SET_CONFIG_IOCTL to the gpio chardev. The ioctl allows some of the configuration of a requested handle to be changed without having to release the line. The primary use case is the changing of direction for bi-directional lines. Based on initial work by Bartosz Golaszewski <bgolaszewski@baylibre.com>

Kent Gibson committed 7 years ago

Commit e588bb11 parent b043ed72 files · +87 −0Browse files

Showing the changes to include/uapi/linux (1 of 2 files). Show all

Unified · Split

include/uapi/linux/gpio.h+18−0
@@ -100,6 +100,24 @@ struct gpiohandle_request { · 99 unmodified lines
100100 int fd;
101101 };
102102
103+/**
104+ * struct gpiohandle_config - Configuration for a GPIO handle request
105+ * @flags: updated flags for the requested GPIO lines, such as
106+ * GPIOHANDLE_REQUEST_OUTPUT, GPIOHANDLE_REQUEST_ACTIVE_LOW etc, OR:ed
107+ * together
108+ * @default_values: if the GPIOHANDLE_REQUEST_OUTPUT is set in flags,
109+ * this specifies the default output value, should be 0 (low) or
110+ * 1 (high), anything else than 0 or 1 will be interpreted as 1 (high)
111+ * @padding: reserved for future use and should be zero filled
112+ */
113+struct gpiohandle_config {
114+ __u32 flags;
115+ __u8 default_values[GPIOHANDLES_MAX];
116+ __u32 padding[4]; /* padding for future use */
117+};
118+
119+#define GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0a, struct gpiohandle_config)
120+
103121 /**
104122 * struct gpiohandle_data - Information of values on a GPIO handle
105123 * @values: when getting the state of lines this contains the current