How can you check whether your kernel supports GPIO on your hardware?

拜拜、爱过 提交于 2019-12-24 05:19:28

问题


My aim is to control the GPIO pins in Peppermint 4 Linux (Kernel version 3.8.0) on an Intel motherboard (NM70 chipset with C1037U processor).

How can you check whether your kernel supports GPIO on your hardware?

Background

  • Motherboard: Intel with NM70 chipset
  • Processor: C1037U processor
  • OS: Peppermint 4 Linux
  • Kernel version: 3.8.0
  • GPIO interface: sysfs

I'm attempting to use the sysfs interface, which allows GPIO pins to be accessed from userspace through the filesystem.

I’ve successfully followed the "Alternate Build Method: The Old-Fashioned Debian Way" section of https://help.ubuntu.com/community/Kernel/Compile to recompile the kernel in order to expose GPIO access in user space and to turn on debug mode for GPIO:

Once the new kernel was compiled, I was able to see the GPIO folder in /sys/class/gpio for the first time. Then, in theory, it should be a case of being able to turn GPIO ports ON/OFF by writing to the filesystem. This approach is outlined at http://falsinsoft.blogspot.co.uk/2012/11/access-gpio-from-linux-user-space.html.

When attempting to export pins 0 to 255 by

echo XX > /sys/class/gpio/export

for XX from 0 to 255, I get the following error message

echo: write error: No such device

When attempting to export pins outside the range 0 to 255 by

echo XX > /sys/class/gpio/export

I get the following error message

echo: write error: Invalid argument

The tutorial suggests this could be because the GPIO ports are reserved for another program and that, if so, the debug file (/sys/kernel/debug/gpio) would be able to show where they are reserved.

However, /sys/kernel/debug/gpio is empty.

I can see and control the GPIO pins in the BIOS (change pins to be input or output HIGH/LOW).

Related questions

Under what conditions would /sys/kernel/debug/gpio be empty?

writing to /sys/class/gpio/export failing

来源:https://stackoverflow.com/questions/24146574/how-can-you-check-whether-your-kernel-supports-gpio-on-your-hardware

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!