blob: 416ce47f22914e2b6a557007776234733fdfb4fa [file] [log] [blame]
Linus Walleij3c702e92015-10-21 15:29:53 +02001/*
2 * <linux/gpio.h> - userspace ABI for the GPIO character devices
3 *
4 * Copyright (C) 2015 Linus Walleij
5 *
6 * This program is free software; you can redistribute it and/or modify it
7 * under the terms of the GNU General Public License version 2 as published by
8 * the Free Software Foundation.
9 */
10#ifndef _UAPI_GPIO_H_
11#define _UAPI_GPIO_H_
12
13#include <linux/ioctl.h>
14#include <linux/types.h>
15
16/**
17 * struct gpiochip_info - Information about a certain GPIO chip
18 * @name: the name of this GPIO chip
Linus Walleijdf4878e2016-02-12 14:48:23 +010019 * @label: a functional name for this GPIO chip
Linus Walleij3c702e92015-10-21 15:29:53 +020020 * @lines: number of GPIO lines on this chip
21 */
22struct gpiochip_info {
23 char name[32];
Linus Walleijdf4878e2016-02-12 14:48:23 +010024 char label[32];
Linus Walleij3c702e92015-10-21 15:29:53 +020025 __u32 lines;
26};
27
Linus Walleij521a2ad2016-02-12 22:25:22 +010028/* Line is in use by the kernel */
29#define GPIOLINE_FLAG_KERNEL (1UL << 0)
30#define GPIOLINE_FLAG_IS_OUT (1UL << 1)
31#define GPIOLINE_FLAG_ACTIVE_LOW (1UL << 2)
32#define GPIOLINE_FLAG_OPEN_DRAIN (1UL << 3)
33#define GPIOLINE_FLAG_OPEN_SOURCE (1UL << 4)
34
35/**
36 * struct gpioline_info - Information about a certain GPIO line
37 * @line_offset: the local offset on this GPIO device, fill in when
38 * requesting information from the kernel
39 * @flags: various flags for this line
40 * @name: the name of this GPIO line
41 * @label: a functional name for this GPIO line
42 * @kernel: this GPIO is in use by the kernel
43 * @out: this GPIO is an output line (false means it is an input)
44 * @active_low: this GPIO is active low
45 */
46struct gpioline_info {
47 __u32 line_offset;
48 __u32 flags;
49 char name[32];
50 char label[32];
51};
52
Linus Walleij3c702e92015-10-21 15:29:53 +020053#define GPIO_GET_CHIPINFO_IOCTL _IOR('o', 0x01, struct gpiochip_info)
Linus Walleij521a2ad2016-02-12 22:25:22 +010054#define GPIO_GET_LINEINFO_IOCTL _IOWR('o', 0x02, struct gpioline_info)
Linus Walleij3c702e92015-10-21 15:29:53 +020055
56#endif /* _UAPI_GPIO_H_ */