When hisi3520dv400 is operating gpio, it prompts sh: write error: No such device
/home/mnt/Hi3521DV100_SDK_V1.0.5.0/osdrv/tools/board/reg-tools-1.0.0/bin # echo
73 > /sys/class/gpio/export
sh: write error: No such device
73 can not be operated, try some small numbers, such as 7 6 and so on. Looking at the situation of gpio, it is found that there are three related gpio, gpiochip0, gpiochip8, and gpiochip16. There are exactly 8 in each group. There are three groups here.
/sys/class/gpio # ls -l
total 0
--w------- 1 root root 4096 Jan 1 01:00 export
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpio10 -> ../../devices/soc/12160000.gpio/gpio/gpio10
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpio11 -> ../../devices/soc/12160000.gpio/gpio/gpio11
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpio12 -> ../../devices/soc/12160000.gpio/gpio/gpio12
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpio13 -> ../../devices/soc/12160000.gpio/gpio/gpio13
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpio14 -> ../../devices/soc/12160000.gpio/gpio/gpio14
lrwxrwxrwx 1 root root 0 Jan 1 00:08 gpio15 -> ../../devices/soc/12160000.gpio/gpio/gpio15
lrwxrwxrwx 1 root root 0 Jan 1 01:00 gpio16 -> ../../devices/soc/12170000.gpio/gpio/gpio16
lrwxrwxrwx 1 root root 0 Jan 1 01:00 gpio17 -> ../../devices/soc/12170000.gpio/gpio/gpio17
lrwxrwxrwx 1 root root 0 Jan 1 00:08 gpio7 -> ../../devices/soc/12150000.gpio/gpio/gpio7
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpio8 -> ../../devices/soc/12160000.gpio/gpio/gpio8
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpio9 -> ../../devices/soc/12160000.gpio/gpio/gpio9
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip0 -> ../../devices/soc/12150000.gpio/gpio/gpiochip0
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip16 -> ../../devices/soc/12170000.gpio/gpio/gpiochip16
lrwxrwxrwx 1 root root 0 Jan 1 00:00 gpiochip8 -> ../../devices/soc/12160000.gpio/gpio/gpiochip8
--w------- 1 root root 4096 Jan 1 00:00 unexport
The reason lies in the configuration of the kernel (linux-3.18.y):
Into the kernel directory: arch/arm/boot/dts
Check the device tree hi3520dv400.dtsi file: it happens to have the configuration of gpio_chip0, gpio_chip1, chip2, the others are not configured and 73 belongs to gpio9_1.
Omit part of the program
According to the example, you need to add gpio9 to dtsi