I've asked this question on Unix Stackexchange, but it seems it was a wrong place for this kind of problem. Ad rem:
I'm creating a kernel driver for SPI controlled display, which is meant to be working with Raspberry PI. Besides the three SPI lines, the display has 3 additional control lines: BUSY, RST and DC. In order to has a possibility of controlling these lines, my DTS has to include additional fragment for GPIO.
fragment@0 {
target = <&spi0>;
__overlay__ {
#address-cells = <1>;
#size-cells = <0>;
status = "okay";
spidev@0 {
status = "disabled";
};
epd0: epd@0 {
compatible = "waveshare,epd";
reg = <0>;
pinctrl-names = "default";
pinctrl-0 = <&epd_pins>;
spi-max-frequency = <1000000>;
width = <128>;
height = <296>;
dc-gpios = <&gpio 16 0>;
reset-gpios = <&gpio 20 0>;
busy-gpios = <&gpio 21 0>;
status = "okay";
};
};
};
fragment@1 {
target = <&gpio>;
__overlay__ {
epd_pins: epd_pins {
brcm,pins = <16 20 21>; /* DC RST BUSY */
brcm,function = <1 1 0>; /* out out in */
};
};
};
That DTS works perfectly fine and I didn't expect any troubles. But there is one thing I'm not sure about:
pinctrl-names = "default";
pinctrl-0 = <&epd_pins>;
I've seen properties like that in other's DTs with gpio fragments, but not always; sometimes they are, sometimes they're not. If I comment out these two lines, it seems like nothing changes, and my driver still works as it should.
I have two questions:
- What is the purpose of those
pinctrllines? I'm aware of pin controller subsystem, but I'm asking strictly in context of my DT. - Why do I need to declare the
gpiooverlay? I set IN or OUT function directly from my driver code anyway and my gpio numbers are defined inspioverlay (dc-gpios,reset-gpios,busy-gpios).