Skip to content

Commit 8b42be5

Browse files
brockus-zephyrnashif
authored andcommitted
gpio: Add GPIO voltage overrides
Add GPIO_flag values for GPIO DTS creation that allows for pins that do not use the default voltage. IT8xxx2 supports setting voltage levels for each pin. The default for this SoC is 3P3 but they can be set individually to 1P8. This will be used, for example: i2c_c_scl { gpios = <&gpioc 1 (GPIO_INPUT | GPIO_VOLTAGE_1P8)>; enum-name = "GPIO_I2C_C_SCL"; label = "I2C_C_SCL"; }; Signed-off-by: Denis Brockus <[email protected]>
1 parent 421ff47 commit 8b42be5

File tree

1 file changed

+26
-0
lines changed
  • include/dt-bindings/gpio

1 file changed

+26
-0
lines changed

include/dt-bindings/gpio/gpio.h

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,32 @@
7676

7777
/** @} */
7878

79+
/**
80+
* @name GPIO pin voltage flags
81+
*
82+
* The voltage flags are a Zephyr specific extension of the standard GPIO
83+
* flags specified by the Linux GPIO binding. Only applicable if SoC allows
84+
* to configure pin voltage per individual pin.
85+
*
86+
* @{
87+
*/
88+
89+
/** @cond INTERNAL_HIDDEN */
90+
#define GPIO_VOLTAGE_POS 6
91+
#define GPIO_VOLTAGE_MASK (3U << GPIO_VOLTAGE_POS)
92+
/** @endcond */
93+
94+
/** Set pin at the default voltage level */
95+
#define GPIO_VOLTAGE_DEFAULT (0U << GPIO_VOLTAGE_POS)
96+
/** Set pin voltage level at 1.8 V */
97+
#define GPIO_VOLTAGE_1P8 (1U << GPIO_VOLTAGE_POS)
98+
/** Set pin voltage level at 3.3 V */
99+
#define GPIO_VOLTAGE_3P3 (2U << GPIO_VOLTAGE_POS)
100+
/** Set pin voltage level at 5.0 V */
101+
#define GPIO_VOLTAGE_5P0 (3U << GPIO_VOLTAGE_POS)
102+
103+
/** @} */
104+
79105
/**
80106
* @}
81107
*/

0 commit comments

Comments
 (0)