Olimex Support Forum

OLinuXino Android / Linux boards and System On Modules => A13 => Topic started by: Ted87 on October 25, 2015, 09:29:08 PM

Title: How to include ugly gpio driver via menuconfig and GPIO ->LED
Post by: Ted87 on October 25, 2015, 09:29:08 PM
People say that to include this driver it is possible to use menuconfig.

Navigate to Device Drivers —> Misc Devices and enable the following features as Module <M>:
<M> An ugly sun4i gpio driver
<M> Sunxi platform register debug driver

However I am now building my kernel (linux-sunxi) and there is no <> An ugly sun4i gpio driver in Misc Devices.

Does anyone know where it is?

If this driver is not used any more, could you explain how to light LED with GPIO without this driver?
Title: Re: How to include ugly gpio driver via menuconfig and GPIO ->LED
Post by: JohnS on October 25, 2015, 11:13:10 PM
You didn't say what version ...

You can download an old/oldish one that has what you post.

John
Title: Re: How to include ugly gpio driver via menuconfig and GPIO ->LED
Post by: MBR on October 27, 2015, 08:54:25 PM
Quote from: Ted87 on October 25, 2015, 09:29:08 PM
If this driver is not used any more, could you explain how to light LED with GPIO without this driver?

For firts, you must export the corresponding GPIO, for example on A13 Micro, the LED is attached to the pin PG9, which is mapped to GPIO #12. So you must write (as root) 12 into the file /sys/class/gpio/export. The pio12_pg9 directory will appear. The next step is to configure direction by writing value in or out into the file /sys/class/gpio/pio12_pg9/direction. Now you can tur the pin on or off by writing 0 or 1 into the file /sys/class/gpio/pio12_pg9/value. The whole shell code to turn the LED on is:

echo 12 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio12_pg9/direction
echo 1 > /sys/class/gpio/gpio12_pg9/value