How to use GPIO-LEDS in another driver without sys interface?

cancel
Showing results for 
Search instead for 
Did you mean: 

How to use GPIO-LEDS in another driver without sys interface?

1,131 Views
surendradhobale
Contributor III

Hello,

         We have developed one custom driver module and its working fine. Now we have blink,ON,OFF led on different conditions in the drivers. We know the conditions. But unable to understand how to drive the LEDS in the driver?

We are able to ON/OFF LED using the /sys/class/ interface.

But how we can do in the drivers with LED API, which directly control the LED.

Also we define the leds in the device tree. How use this in the driver.?

leds {

            compatible = "gpio-leds"

            led1 {

                     lable="led_red";

                                 gpios = <&gpio2 4 0>;

                   }

      Not looking to use triggers also.

Can anyone give pointers how to do that ? any referance code .

Thanks,

Surendra                            

0 Kudos
1 Reply

377 Views
Pavel
NXP TechSupport
NXP TechSupport

Look at the following pages about GPIO Linux Kernel Driver:

http://www.wiki.xilinx.com/Linux+GPIO+Driver

 

http://processors.wiki.ti.com/index.php/Processor_SDK_Linux_GPIO_Driver_Overview

 

http://developer.toradex.com/device-tree-customization

 

https://community.nxp.com/thread/310091

 

Note:

The SysFs driver has been tested and is working. It has been accepted into the mainline kernel and the old char mode GPIO driver that didn't work with arch/powerpc has been removed from the tree.

The SysFs interface is a very simple way to access the GPIO from user space and has the advantage of requiring very little setup.


Have a great day,
Pavel Chubakov

-----------------------------------------------------------------------------------------------------------------------
Note: If this post answers your question, please click the Correct Answer button. Thank you!
-----------------------------------------------------------------------------------------------------------------------

0 Kudos