在什么条件下/ sys / kernel / debug / gpio为空? [英] Under what conditions would /sys/kernel/debug/gpio be empty?

查看:1775
本文介绍了在什么条件下/ sys / kernel / debug / gpio为空?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

摘要



我的目标是在英特尔主板(具有C1037U处理器的NM70芯片组)上控制Peppermint 4 Linux(内核版本3.8.0)中的GPIO引脚。



我正在调试我使用sysfs界面的问题,并试图了解/ sys / kernel / debug / gpio为空的条件? p>

尝试通过



echo XX> / sys / class / gpio / export



对于XX从0到255,我收到以下错误消息



echo:write error:没有这样的设备



在什么条件下/ sys / kernel / debug / gpio为空?



背景




  • 主板:Intel使用NM70芯片组

  • 处理器:C1037U处理器

  • 操作系统:Peppermint 4 Linux

  • 内核版本:3.8。 0

  • GPIO界面:sysfs



我试图使用sysfs界面,允许通过文件系统从用户空间访问GPIO引脚。



我已经成功地遵循了 https://help.ubuntu.com/community/Kernel/Compile 按顺序重新编译内核暴露用户空间中的GPIO访问并打开调试模式对于GPIO:



一旦新的内核被编译,我可以第一次看到/ sys / class / gpio中的GPIO文件夹。那么在理论上应该是能够通过写入文件系统来打开/关闭GPIO端口的情况。这种方法在 http:/ /falsinsoft.blogspot.co.uk/2012/11/access-gpio-from-linux-user-space.html



尝试导出时pin 0到255 by



echo XX> / sys / class / gpio / export



对于XX从0到255,我收到以下错误消息



echo:write error:没有这样的设备



尝试导出外部引脚范围0到255由



echo XX> / sys / class / gpio / export



我收到以下错误消息



echo:write error:无效的参数



本教程建议这可能是因为GPIO端口被保留给另一个程序,如果是这样,调试文件(/ sys / kernel / debug / gpio)将能够显示它们在哪里保留。



然而,/ sys / kernel / debug / gpio为空。



我可以看到并控制BIOS中的GPIO引脚(将引脚更改为输入或输出为高电平/低电平)。 >

相关问题





启用GPIO

解决方案

/ sys /如果没有注册的GPIO设备,kernel / debug / gpio将为空(警告:当我说GPIO设备,我不是指硬件,而是内核表示)。



所以,这些GPIO设备是在运行时由内核注册并与特定的GPIO设备驱动程序相关联。



依次选择GPIO设备驱动程序并将其关联到给定的设备,因为它是声明与GPIO设备的兼容性。



例如,内核将匹配PCI供应商和产品ID,并探测一个GPIO驱动程序支持该PCI供应商/产品。当GPIO驱动程序被探测时,它通常会注册GPIO设备实例。



最后,注册的GPIO设备是提供/ sys / kernel / debug / gpio中显示的GPIO 。



以上是Linux中所谓的设备驱动程序模型的一部分。虽然这有点过时了,但您可以阅读[1]。



现在,看看您需要为您的NM70芯片组选择GPIO驱动程序。维基百科说,芯片组代号是Panther Point-M[2]。有一些运气,lpc_ich驱动程序可以支持它。您必须使用CONFIG_LPC_ICH = y构建您的内核。



或者,如果您的GPIO由PCI设备提供,您可以使用 lspci 获取ID,然后在这些ID的内核源中grep。



[1] http://www.oreilly.com/openbook/linuxdrive3/book/ch14.pdf



[2] https://en.wikipedia.org/wiki/List_of_Intel_chipsets


Summary

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).

I'm debugging issues I'm having using the sysfs interface and am trying to understand the conditions where /sys/kernel/debug/gpio would be empty?

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

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

 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

writing to /sys/class/gpio/export failing

Enable pullup GPIO

解决方案

/sys/kernel/debug/gpio will be empty if there no GPIO device registered (warning: when I say GPIO device, I don't mean the piece of hardware, but rather the kernel representation of it).

So, these GPIO devices are registered at runtime by the kernel and associated to a specific GPIO device driver.

In turn, the GPIO device driver is selected and associated to a given device, because it is the one declaring compatibility with said GPIO device.

E.g., the kernel would match on PCI vendor and product ID, and probe a GPIO driver that claims support for that PCI vendor/product. When the GPIO driver is probed, it typically registers the GPIO device instance.

Finally, that registered GPIO device is what provides GPIOs shown in /sys/kernel/debug/gpio.

The above is part of the so-called "Device Driver model" in Linux. Although it's a bit outdated, you can read [1].

Now, let's see what GPIO driver you need to select for your NM70 chipset. Wikipedia says that the chipset codename is "Panther Point-M" [2]. With some luck, the lpc_ich driver could support it. You would have to build your kernel with CONFIG_LPC_ICH=y.

Alternatively, if your GPIOs are provided by a PCI device, you could use lspci to get the IDs, and then grep in the kernel sources for those IDs.

[1] http://www.oreilly.com/openbook/linuxdrive3/book/ch14.pdf

[2] https://en.wikipedia.org/wiki/List_of_Intel_chipsets

这篇关于在什么条件下/ sys / kernel / debug / gpio为空?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆