New leds driver...

464 views
Skip to first unread message

regr...@shutko.ru

unread,
Jan 8, 2013, 9:31:00 PM1/8/13
to cubie...@googlegroups.com
I've made a driver to work with my cubieboard leds (/dev/class/leds). I'm too lazy to commit it to git so I put it here.
To compile it you need linux-sunxi kernel source with configured and compiled kernel. Here is instruction:

1. Create directory and put sun4i_leds.c there
2. Create Makefile with single line "obj-m := sun4i-leds.o"
3. Run 
make ARCH=arm CROSS_COMPILE=arm-linux-gnueabihf- -C /path/to/linux-sunxi/  SUBDIRS=$PWD modules
and you'll get sun4i-leds.ko module
4. Recompile kernel with CONFIG_NEW_LEDS=y (also there is a number of triggers available to enable)
5. Get your script.bin from /dev/mmcblk0p1 (mount it) and decompile it into script.fex
6. Add to script.fex following lines:

[leds]
leds_used = 1
leds_num = 2
leds_pin_1  = port:PH20<1><default><default><0>
leds_name_1 = "ph20:green:led1"
leds_pin_2  = port:PH21<1><default><default><0>
leds_name_2 = "ph21:blue:led2"

7. Compile script.fex into script.bin
8. Put new kernel and script.bin to /dev/mmcblk0p1 partition
9. Reboot & insmod sun4i-leds.ko

Now you can use 
echo 255 > /sys/class/leds/ph20:green:led1/brightness
 to light led or you can play with triggers to blink it on usb/mmc activity. 
Sata/ide trigger currently doesn't work (i'll try to fix this)

sun4i-leds.c

Alejandro Mery

unread,
Jan 9, 2013, 3:53:45 AM1/9/13
to cubie...@googlegroups.com
would you mind submitting it to the linux-sunxi ML?

thanks!
Alejandro Mery

regr...@shutko.ru

unread,
Jan 9, 2013, 7:58:55 PM1/9/13
to cubie...@googlegroups.com
 Sent a patch, but didn't received cc. Did you received it ?

Alejandro Mery

unread,
Jan 9, 2013, 8:27:40 PM1/9/13
to cubie...@googlegroups.com


El 10/01/2013 01:58, <regr...@shutko.ru> escribió:
>
>  Sent a patch, but didn't received cc. Did you received it ?
>

yes. received ;-)

Thank you!

Dmitriy B.

unread,
Jan 9, 2013, 8:31:31 PM1/9/13
to cubie...@googlegroups.com
It got into spamfolder (damn google groups spam detection triggering on each big patch), I've moved it from there and added your email in whitelist.

Best Regards,
Dmitriy Beykun

2013/1/10 <regr...@shutko.ru>

theRat

unread,
Feb 7, 2013, 4:53:17 AM2/7/13
to cubie...@googlegroups.com
What is the most efficient way to use this driver from within a userspace c program?
Reply all
Reply to author
Forward
0 new messages