Add GPIO-Line-Name
Answer.
Assuming that GPIO0~GPIO7 are named "test0...test7" respectively, they need to be configured in ma35d1.dtsi. The relevant configuration is as follows:
Code: Select all
gpioa: gpioa@40040000 {
reg = <0x0 0x40040000 0 0x40>,
<0x0 0x40040800 0 0x40>;
interrupts = <GIC_SPI 14 IRQ_TYPE_LEVEL_HIGH>;
clocks = <&clk GPA_GATE>;
gpio-controller;
#gpio-cells = <2>;
interrupt-controller;
#interrupt-cells = <2>;
gpio-line-names =
"test0",
"test1",
"test2",
"test3",
"test4",
"test5",
"test6",
"test7","","","","","","","","";
};
After compiling, use the tool gpioinfo to query GPIO information as follows:
Code: Select all
# ./gpioinfo
line 0: "test0" unused input active-high
line 1: "test1" unused input active-high
line 2: "test2" unused input active-high
line 3: "test3" unused input active-high
line 4: "test4" unused input active-high
line 5: "test5" unused input active-high
line 6: "test6" unused input active-high
line 7: "test7" unused input active-high
line 8: unnamed unused input active-high
line 9: unnamed unused input active-high
line 10: unnamed unused input active-high
line 11: unnamed unused input active-high
line 12: unnamed unused input active-high
line 13: unnamed unused input active-high
line 14: unnamed unused input active-high
line 15: unnamed unused input active-high
......
The first column is the GPIO number, and the second column is line-name, which is configured in dts by configuring gpio-line-names.
The third column is the name of the user, the fourth column is the direction, and the last column is the activation status.
Test Command:
Code: Select all
# ./gpiofind test0
Code: Select all
# ./gpioget gpiochip0 0
#MA35D1, #GPIO
.