How to declare a single GPIO-Pin which is not an LED in boards dts file?

We have a few GPIO Outputs we'd like to configure via device tree. However in all the examples found the output GPIOs are compatible="gpio-leds".

Those pins are necessary to communicate with another Chip so we'd rather not use the gpio-leds interface.

This is what we have so far:

pins {
// Todo don't use gpio-leds
compatible = "gpio-leds";
pin0: pin0 {
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
label = "Signal pin";
};
};

This is what we had in mind:

pins {
compatible = "gpio"; // sort of
pin0: pin0 {
gpios = <&gpio0 13 GPIO_ACTIVE_LOW>;
label = "Signal pin";
};
};

Parents
  • I resuming this post in order to know if someone know a method. I get bored seeing that I have to use something led-retaled to control a mosfet.

  • I would create a yaml file call, for example, gpio-outputs.yaml. and copy gpio-leds.yaml context into it and modify

    # Copyright (c) 2018, Linaro Limited
    # SPDX-License-Identifier: Apache-2.0
    
    compatible: "gpio-outputs"
    
    child-binding:
        description: GPIO output child node
        properties:
           gpios:
              type: phandle-array
              required: true
           label:
              required: false
              type: string
              description: |
                Human readable string describing the pin. It can be used by an
                application to identify this pin or to retrieve its number/index
                (i.e. child node number) on the parent device.
    

    and you can copy this file either into your project/boards/bindings or zephyr/dts/bindings/gpio. Both will work.

    if you copy into your project it will be valid for only that project, but if you copy into zephyr/dts then you can use it for all your project

Reply
  • I would create a yaml file call, for example, gpio-outputs.yaml. and copy gpio-leds.yaml context into it and modify

    # Copyright (c) 2018, Linaro Limited
    # SPDX-License-Identifier: Apache-2.0
    
    compatible: "gpio-outputs"
    
    child-binding:
        description: GPIO output child node
        properties:
           gpios:
              type: phandle-array
              required: true
           label:
              required: false
              type: string
              description: |
                Human readable string describing the pin. It can be used by an
                application to identify this pin or to retrieve its number/index
                (i.e. child node number) on the parent device.
    

    and you can copy this file either into your project/boards/bindings or zephyr/dts/bindings/gpio. Both will work.

    if you copy into your project it will be valid for only that project, but if you copy into zephyr/dts then you can use it for all your project

Children
No Data
Related