Tool/software: Linux
Hi,
In my custom board, we use pins of GPIO to output or input some information. I have modified the DTS by referring to community threads. For example,
&gpio5{
P5_3{ /* gpio5-3, for input Power_monitor */
gpio-hog;
gpios = <3 GPIO_ACTIVE_HIGH>;
input;
line-name = "PowerMonitor ";
};
P5_10{ /* gpio5-10, connect to FPGA */
gpio-hog;
gpios = <10 GPIO_ACTIVE_HIGH>;
output-high;
line-name = "GPIO_FPGA";
};
};
I also set pinmux mode in UBOOT. When Linux has been started, I have seen the following related messages.
[ 0.486689] GPIO line 131 (PowerMonitor ) hogged as input
[ 0.486707] GPIO line 138 (GPIO_FPGA) hogged as output/high
.......
I have checked the output of GPIO5_10 is high level. Now I am wondering how can I control these two gpio in my application program. I am using SDK5.0 and the Linux kernel is 4.9.59. How can I read status of gpio5_3 ? How can I set low level for gpio5_10? and may I change the direction of gpio5_10 to input mode ?
BTW, if I append these contents in DTS, the gpio export command will failed after Linux has been started. Please give some guide to help me operating these two gpios in my codes.
Best Regards,
Thanks!
Guan Qing