xref: /netbsd-src/sys/external/gpl2/dts/dist/include/dt-bindings/gpio/gpio.h (revision aa174a4d2377d88d4ff74f054c556c7eaadc52be)
1 /*	$NetBSD: gpio.h,v 1.2 2024/10/31 07:07:45 skrll Exp $	*/
2 
3 /* SPDX-License-Identifier: (GPL-2.0 OR BSD-2-Clause) */
4 /*
5  * This header provides constants for most GPIO bindings.
6  *
7  * Most GPIO bindings include a flags cell as part of the GPIO specifier.
8  * In most cases, the format of the flags cell uses the standard values
9  * defined in this header.
10  */
11 
12 #ifndef _DT_BINDINGS_GPIO_GPIO_H
13 #define _DT_BINDINGS_GPIO_GPIO_H
14 
15 /* Bit 0 express polarity */
16 #define GPIO_ACTIVE_HIGH 0
17 #define GPIO_ACTIVE_LOW 1
18 
19 /* Bit 1 express single-endedness */
20 #define GPIO_PUSH_PULL 0
21 #define GPIO_SINGLE_ENDED 2
22 
23 /* Bit 2 express Open drain or open source */
24 #define GPIO_LINE_OPEN_SOURCE 0
25 #define GPIO_LINE_OPEN_DRAIN 4
26 
27 /*
28  * Open Drain/Collector is the combination of single-ended open drain interface.
29  * Open Source/Emitter is the combination of single-ended open source interface.
30  */
31 #define GPIO_OPEN_DRAIN (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_DRAIN)
32 #define GPIO_OPEN_SOURCE (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_SOURCE)
33 
34 /* Bit 3 express GPIO suspend/resume and reset persistence */
35 #define GPIO_PERSISTENT 0
36 #define GPIO_TRANSITORY 8
37 
38 /* Bit 4 express pull up */
39 #define GPIO_PULL_UP 16
40 
41 /* Bit 5 express pull down */
42 #define GPIO_PULL_DOWN 32
43 
44 /* Bit 6 express pull disable */
45 #define GPIO_PULL_DISABLE 64
46 
47 #endif
48