3

I have a single board computer with 8 GPIO pins that I would like to access from user space on my CentOS 6.4 installation. I see the GPIO pins mentioned in the 'dmesg' output, but the /sys/class/gpio directory does not exist. Is there a special driver I need, or is my kernel just not new enough (2.6.32-358.el6.i686)? The SBC model is Advantech PCM-9389 in case that matters.

GPIO mentioned in dmesg:

    pci 0000:00:1f.0: quirk: [io  0x0800-0x087f] claimed by ICH6 ACPI/GPIO/TCO
    pci 0000:00:1f.0: quirk: [io  0x0500-0x053f] claimed by ICH6 GPIO
KyleL
  • 445
  • 2
  • 5
  • 13

2 Answers2

1

You do indeed need to load the correct GPIO driver module for your hardware. You may also need to load it manually (by naming it in /etc/modules) if it doesn't get loaded automatically (some don't because they're not "plug-and-play").

Lack of GPIO modules loaded into your running kernel is the reason why you don't have a /sys/class/gpio directory.

From the bootup messages you quoted, the correct module is probably gpio_ich. But only testing will tell for sure.

I use the gpio_ich module, so for comparison purposes, here are some details of my system. I haven't tested my GPIO pins, but my system's definitely closer to working than yours, so this should get you closer.

$ modinfo gpio_ich
ERROR: Module gpio_ich not found.

This is because my gpio_ich is statically linked in to my kernel, for a tiny bit faster bootup. I recommend you build it as a module, in which case the above command will succeed (unlike in my case) and will show you the module's parameters if any.

$ ls -l /sys/class/gpio/
total 0
--w------- 1 root root 4096 Jul 14 16:12 export
lrwxrwxrwx 1 root root    0 Jul 14 16:12 gpiochip195 -> ../../devices/pci0000:00/0000:00:1f.0/gpio_ich/gpio/gpiochip195
--w------- 1 root root 4096 Jul 14 16:12 unexport

$ dmesg|fgrep -i gpio
gpio_ich: GPIO from 195 to 255 on gpio_ich
lpc_ich: Resource conflict(s) found affecting gpio_ich
it87: VID is disabled (pins used for GPIO)

The first message is the module initialising. Lack of this is a show-stopper. I don't know whether the Resource conflict(s) stated on the second line are a problem or not (I suspect they are due to the re-use of pins stated on the third line, so are not a problem).

Good luck!

0

Works for me:

We need to activate it through config.txt :

echo -e "dtparam=i2c1=on\ndtparam=i2c_arm=on" >> /boot/config.txt
echo -e "i2c-bcm2708\ni2c-dev" >> /etc/modules-load.d/i2c.conf
yum install -y i2c-tools
systemctl reboot

P.S. CentOS Linux release 7.6.1810 (AltArch)