Device Tree Configuration Generic GPIO Inputs & Outputs

nRF52833-DK
nRF Connect SDK v2.3.0
Zephyr v3.2.99

I am trying to figure out the best practise for defining generic GPIO input & output pins. To my understanding, devicetree is where all the hardware configuration resides.

It appears these are the goto bindings when trying to setup basic gpios
    compatible: "gpio-keys"
    compatible: "gpio-leds"

I have also seen suggestions on creating a custom binding for dealing with generic GPIOs,  extra gpios in board overlay for nrf9160dk
With that in mind I compared the .yaml files for gpio-leds (assuming these would be ouput GPIOs) & gpio-keys (assuming these would be input GPIOs) but found no obvious difference/explanation as to what determines input or output.

For reference:

gpio-keys.yaml

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
# Copyright (c) 2018, Linaro Limited
# SPDX-License-Identifier: Apache-2.0
description: GPIO KEYS parent node
compatible: "gpio-keys"
include: base.yaml
child-binding:
description: GPIO KEYS child node
properties:
gpios:
type: phandle-array
required: true
label:
type: string
description: Descriptive name of the key
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX


gpio-leds.yaml

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# Copyright (c) 2018, Linaro Limited
# SPDX-License-Identifier: Apache-2.0
description: |
This allows you to define a group of LEDs. Each LED in the group is
controlled by a GPIO. Each LED is defined in a child node of the
gpio-leds node.
Here is an example which defines three LEDs in the node /leds:
/ {
leds {
compatible = "gpio-leds";
led_0 {
gpios = <&gpio0 1 GPIO_ACTIVE_LOW>;
};
led_1 {
gpios = <&gpio0 2 GPIO_ACTIVE_HIGH>;
};
led_2 {
gpios = <&gpio1 15 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

If pins are inputs by default, will adding polarity flags in the device tree configure them as outputs, but omitting polarity flags leave them as inputs? (Maybe thats what the comments in yaml suggest, but then again polarity applies to both inputs & outputs)

Anyway, if gpio direction config isnt possible in device tree, then the required approach is to call 

gpio_pin_configure(PORT_DEVICE, PIN_NUMBER, _____ /* GPIO_OUTPUT or GPIO_INPUT */);

With this in mind, is there any point adding gpio configs to device tree, other than the initial configuration for polarity & pin biasing? Polarit & pin-biasing can be configured with gpio_pin_configure() anyway?