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