On 11/07/2020 17:21, Linus Walleij wrote: > On Thu, Jul 9, 2020 at 4:11 PM Rodolfo Giometti <giometti@xxxxxxxxxxxx> wrote: > >> gpio_lines { >> compatible = "gpio-line"; >> >> bypass0 { >> gpios = <&gpionb 10 GPIO_ACTIVE_HIGH>; >> mode = "out-low"; >> }; >> >> bypass1 { >> gpios = <&gpiosb 11 GPIO_ACTIVE_HIGH>; >> mode = "out-low"; >> }; >> >> key { >> gpios = <&gpionb 4 GPIO_ACTIVE_HIGH>; >> mode = "input"; >> }; >> >> motor { >> gpios = <&gpionb 8 GPIO_ACTIVE_HIGH>; >> mode = "out-high-open-drain"; >> }; > > These mode = ... strings are really just a big confusion for me since > they reinvent several of the flags you can already give to the gpios, > see include/dt-bindings/gpio/gpio.h: > > /* Bit 0 express polarity */ > #define GPIO_ACTIVE_HIGH 0 > #define GPIO_ACTIVE_LOW 1 > > /* Bit 1 express single-endedness */ > #define GPIO_PUSH_PULL 0 > #define GPIO_SINGLE_ENDED 2 > > /* Bit 2 express Open drain or open source */ > #define GPIO_LINE_OPEN_SOURCE 0 > #define GPIO_LINE_OPEN_DRAIN 4 > > /* > * Open Drain/Collector is the combination of single-ended open drain interface. > * Open Source/Emitter is the combination of single-ended open source interface. > */ > #define GPIO_OPEN_DRAIN (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_DRAIN) > #define GPIO_OPEN_SOURCE (GPIO_SINGLE_ENDED | GPIO_LINE_OPEN_SOURCE) These modes came from include/linux/gpio/consumer.h: /** * Optional flags that can be passed to one of gpiod_* to configure direction * and output value. These values cannot be OR'd. */ enum gpiod_flags { GPIOD_ASIS = 0, GPIOD_IN = GPIOD_FLAGS_BIT_DIR_SET, GPIOD_OUT_LOW = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT, GPIOD_OUT_HIGH = GPIOD_FLAGS_BIT_DIR_SET | GPIOD_FLAGS_BIT_DIR_OUT | GPIOD_FLAGS_BIT_DIR_VAL, GPIOD_OUT_LOW_OPEN_DRAIN = GPIOD_OUT_LOW | GPIOD_FLAGS_BIT_OPEN_DRAIN, GPIOD_OUT_HIGH_OPEN_DRAIN = GPIOD_OUT_HIGH | GPIOD_FLAGS_BIT_OPEN_DRAIN, }; So a setting like the following should set at boot gpio10 as output to 0: bypass0 { gpios = <&gpionb 10 GPIO_ACTIVE_HIGH>; mode = "out-low"; }; While the next one should set gpio10 as output to 1: bypass0 { gpios = <&gpionb 10 GPIO_ACTIVE_LOW>; mode = "out-low"; }; Maybe I can do something similar to hog-gpio as below, if you prefer... bypass0 { gpios = <&gpionb 10 GPIO_ACTIVE_LOW>; output-low; }; Ciao, Rodolfo -- GNU/Linux Solutions e-mail: giometti@xxxxxxxxxxxx Linux Device Driver giometti@xxxxxxxx Embedded Systems phone: +39 349 2432127 UNIX programming skype: rodolfo.giometti