Linux Application layer directly operates GPIO
Under the guidance of an expert, the application layer can operate the GPIO directly, which refers to setting the input and output of the GPIO and the high or low output level. This greatly improves flexibility, the official documentation has GPIO Sysfs Interface for Userspace,gpio Sysfs.
Here I take a look at the examples used:
# RK30_PIN0_PD4# A0-7 -> 0-7 / B0-7 -> 8-15 / C0-7 -> 16-23 / D0-7 -> 24-31echo 28 > /sys/class/gpio/exportecho "out" > /sys/class/gpio/gpio28/directionecho 1 > /sys/class/gpio/gpio28/value
The code above is set to RK30_PIN0_PD4
output and the output level is set to high.
OTG's PIN pin is RK30_PIN3_PD5
.
It's good to have an old finger, before I imagined there was no way to control the input/output of the Gpio directly at the user level and set the output level, but eventually there was no result.
The background of this problem is the USB host Port power control on the motherboard, when porting the latest kernel version to the motherboard, the USB port does not have the power output, the manual enable power supply solves the problem. This is manual control, which you will add to the DTS file later.
Linux Application layer directly operates GPIO