/sys/kernel/debug/gpio
在实际的开发任务中,
有时候不知道GPIO的状态,也不知道在内核中GPIO是否申请成功。
可以通过/sys/kernel/debug/gpio这个文件来查看。这个文件显示了申请成功的GPIO的输入输出状态和电平。
配置
- 内核打开 debugfs 的支持
Symbol: DEBUG_FS [=y]
Prompt: Debug Filesystem
Defined at lib/Kconfig.debug:77
Depends on: SYSFS
Location:
-> Kernel configuration
-> Kernel hacking
- 挂载 debugfs
mount -t debugfs debugfs /sys/kernel/debug
- 查看是否挂载成功
# mount | grep debug
debugfs on /sys/kernel/debug type debugfs (rw,relatime)
测试
# cat /sys/kernel/debug/gpio
GPIOs 0-31, platform/pinctrl, gpio0:
gpio-1 ( |hp-ctl ) out lo
gpio-2 ( |reset ) out hi
gpio-5 ( |spk-ctl ) out lo
gpio-7 ( |pwm ) out lo
gpio-8 ( |pwm ) out lo
gpio-15 ( |pwm ) out lo
gpio-16 ( |ir_rx ) in hi
gpio-21 ( |vbus_host ) out hi
GPIOs 32-63, platform/pinctrl, gpio1:
GPIOs 64-95, platform/pinctrl, gpio2:
GPIOs 96-127, platform/pinctrl, gpio3:
GPIOs 128-159, platform/pinctrl, gpio4:
gpio-135 ( |bt_default_rts ) out lo
gpio-139 ( |bt_default_poweron ) out hi
gpio-140 ( |bt_default_wake_host) in hi
gpio-158 ( |vcc_sd ) out hi
1422




被折叠的 条评论
为什么被折叠?



