Hi all,
I'd like to write a device tree that configures some GPIOs and lets them be re-configured and used by other overlays/drivers, if enabled.
Specifically, I need to configure them as inputs with no pulls, when there's nothing else using them.
My starting point was something like this:
But if any other overlay uses one of my pins the kernel will complain saying that they are already requested.
So I thought I'd remove the configuration from my device tree and have them configured and immediately released in my driver code. I didn't like the idea to begin with, but then I also realised that there is no gpiod_* API to configure the pulls.
So, what is the right way to achieve this?
Thanks!
I'd like to write a device tree that configures some GPIOs and lets them be re-configured and used by other overlays/drivers, if enabled.
Specifically, I need to configure them as inputs with no pulls, when there's nothing else using them.
My starting point was something like this:
Code:
/dts-v1/;/plugin/;/ { compatible = "brcm,bcm2835"; fragment@0 { target-path = "/"; __overlay__ { bar: bar { pinctrl-names = "default"; pinctrl-0 = <&mypins>; compatible = "foo,bar"; status = "okay"; }; }; }; fragment@1 { target = <&gpio>; __overlay__ { mypins: mypins { brcm,pins = <16 17 18>; brcm,function = <0>; /* in */ brcm,pull = <0>; /* no pull */ }; }; };};
So I thought I'd remove the configuration from my device tree and have them configured and immediately released in my driver code. I didn't like the idea to begin with, but then I also realised that there is no gpiod_* API to configure the pulls.
So, what is the right way to achieve this?
Thanks!
Statistics: Posted by giampiero — Fri Oct 18, 2024 12:54 pm