I want to use libgpiod
to control a few GPIOs via userspace on a custom board. I have an i.MX6UL processor, which has hundreds of pins, I'll use only 8 of them (as GPIOs).
I read about the libgpiod
as it is replacing the old sysfs API, and I'm happy that you can specify labels for each GPIO. The GPIO block of the processor looks like the following code block and has already the gpio-controller
property set. (Taken from Linux kernel v4.14)
gpio2: gpio@20a0000 {
compatible = "fsl,imx6ul-gpio", "fsl,imx35-gpio";
reg = <0x020a0000 0x4000>;
interrupts = <GIC_SPI 68 IRQ_TYPE_LEVEL_HIGH>,
<GIC_SPI 69 IRQ_TYPE_LEVEL_HIGH>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
gpio-ranges = <&iomuxc 0 49 16>, <&iomuxc 16 111 6>;
};
I want to use a single pin of this controller, so I added the following block:
&gpio2 {
resetl0 {
//gpio-hog;
output-high;
line-name = "COBO0_ResetL";
gpios = <15 1>;
};
};
Without the gpio-hog
property, the gpioinfo
tool is unable to show me the labels, same if I omit the output-high/low. With the property, the label is correctly displayed, but the gpio is marked as used
, so I cannot control from userspace. (Device or resource busy)
So in short:
I need a way to set a label in device tree, which I'm able to read from userspace and to control the gpios. I already saw the gpio-line-names
in the RPi devicetree, but I don't want to specify the whole bank as NC, when using only one. Is it possible with libgpiod
? How?
gpio-line-names
, but does this mean that i have to define the labels for the whole gpio2 IO-Bank? – Cardholdergpio-line-names
(see here for details). YMMV - I'm under the impression that device trees and their "compilation" vary widely between platofrms. – Geosyncline