[PATCH v4 4/6] Add GPIO v2 ioctl decoding
Dmitry V. Levin
ldv at altlinux.org
Sun Jan 24 15:26:23 UTC 2021
On Sat, Jan 23, 2021 at 09:56:43AM +0800, Kent Gibson wrote:
> Add decoding of GPIO uAPI v2 ioctls added in Linux v5.10.
>
> Signed-off-by: Kent Gibson <warthog618 at gmail.com>
This patch would be required on top of yours if the
xlat/gpio_ioctl_cmds.in approach is going to be used:
diff --git a/xlat/gpio_ioctl_cmds.in b/xlat/gpio_ioctl_cmds.in
index 28deaf69a..1b3d70367 100644
--- a/xlat/gpio_ioctl_cmds.in
+++ b/xlat/gpio_ioctl_cmds.in
@@ -2,8 +2,14 @@ GPIO_GET_CHIPINFO_IOCTL _IOR(0xB4, 0x01, struct_gpiochip_info)
GPIO_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x02, struct_gpioline_info)
GPIO_GET_LINEHANDLE_IOCTL _IOWR(0xB4, 0x03, struct_gpiohandle_request)
GPIO_GET_LINEEVENT_IOCTL _IOWR(0xB4, 0x04, struct_gpioevent_request)
+GPIO_V2_GET_LINEINFO_IOCTL _IOWR(0xB4, 0x05, struct_gpio_v2_line_info)
+GPIO_V2_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x06, struct_gpio_v2_line_info)
+GPIO_V2_GET_LINE_IOCTL _IOWR(0xB4, 0x07, struct_gpio_v2_line_request)
GPIOHANDLE_GET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x08, struct_gpiohandle_data)
GPIOHANDLE_SET_LINE_VALUES_IOCTL _IOWR(0xB4, 0x09, struct_gpiohandle_data)
GPIOHANDLE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0A, struct_gpiohandle_config)
GPIO_GET_LINEINFO_WATCH_IOCTL _IOWR(0xB4, 0x0B, struct_gpioline_info)
GPIO_GET_LINEINFO_UNWATCH_IOCTL _IOWR(0xB4, 0x0C, uint32_t)
+GPIO_V2_LINE_SET_CONFIG_IOCTL _IOWR(0xB4, 0x0D, struct_gpio_v2_line_config)
+GPIO_V2_LINE_GET_VALUES_IOCTL _IOWR(0xB4, 0x0E, struct_gpio_v2_line_values)
+GPIO_V2_LINE_SET_VALUES_IOCTL _IOWR(0xB4, 0x0F, struct_gpio_v2_line_values)
The patch for types/gpio.h would look a bit different:
diff --git a/types/gpio.h b/types/gpio.h
index 747188526..67c981cae 100644
--- a/types/gpio.h
+++ b/types/gpio.h
@@ -22,6 +22,14 @@
# define GPIOHANDLES_MAX 64
# endif
+# ifndef GPIO_V2_LINES_MAX
+# define GPIO_V2_LINES_MAX 64
+# endif
+
+# ifndef GPIO_V2_LINE_NUM_ATTRS_MAX
+# define GPIO_V2_LINE_NUM_ATTRS_MAX 10
+# endif
+
typedef struct {
char name[GPIO_MAX_NAME_SIZE];
char label[GPIO_MAX_NAME_SIZE];
@@ -62,4 +70,51 @@ typedef struct {
uint32_t padding[4];
} struct_gpiohandle_config;
+typedef struct {
+ uint64_t bits;
+ uint64_t mask;
+} struct_gpio_v2_line_values;
+
+typedef struct {
+ uint32_t id;
+ uint32_t padding;
+ union {
+ uint32_t debounce_period_us;
+ uint64_t flags;
+ uint64_t values;
+ };
+} struct_gpio_v2_line_attribute;
+
+typedef struct {
+ struct_gpio_v2_line_attribute attr;
+ uint64_t mask;
+} struct_gpio_v2_line_config_attribute;
+
+typedef struct {
+ uint64_t flags;
+ uint32_t num_attrs;
+ uint32_t padding[5];
+ struct_gpio_v2_line_config_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
+} struct_gpio_v2_line_config;
+
+typedef struct {
+ uint32_t offsets[GPIO_V2_LINES_MAX];
+ char consumer[GPIO_MAX_NAME_SIZE];
+ struct_gpio_v2_line_config config;
+ uint32_t num_lines;
+ uint32_t event_buffer_size;
+ uint32_t padding[5];
+ int32_t fd;
+} struct_gpio_v2_line_request;
+
+typedef struct {
+ char name[GPIO_MAX_NAME_SIZE];
+ char consumer[GPIO_MAX_NAME_SIZE];
+ uint32_t offset;
+ uint32_t num_attrs;
+ uint64_t flags;
+ struct_gpio_v2_line_attribute attrs[GPIO_V2_LINE_NUM_ATTRS_MAX];
+ uint32_t padding[4];
+} struct_gpio_v2_line_info;
+
#endif /* STRACE_TYPES_GPIO_H */
--
ldv
More information about the Strace-devel
mailing list