how to write a helloworld module for GPIO driver

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

how to write a helloworld module for GPIO driver

565 Views
listplot3d
Contributor III

Based on imx6ulevk EVK, I would like to write a helloworld GPIO module for char driver, and think the ON/OFF hardware button on board can be a reference design.

From schema and pin tool, I see that ON/OFF button is on R8 pin, peripheral is System Reset Controllor(SRC) , with src.RESET_B in IOMUX

However, where is the source code for this driver? I tried various of searching ways, including searching keywords in source, in build directory, and in running board /proc, but none of them had got me there. I had written drivers for linux 2.6 many years ago, but when trying to refresh self and picking things up in yocto + Linux 4.x recently, confusion are confronted more than expected.

Could anyone tell me what is the correct steps to search for its driver?  Or... is it a pure hardware button and just power off CPU without any source code..?

Thanks & Regards

-Shawn

Labels (3)
0 Kudos
2 Replies

434 Views
igorpadykov
NXP Employee
NXP Employee

Hi Shawn

I doubt if "ON/OFF" driver exists, but for usage System Reset Controllor(SRC) may be

useful to look at FreeRTOS examples

..boards/evkmcimx6ul/demo_apps/power_mode_switch/power_mode_switch.c
..boards/evkmcimx6ul/driver_examples/src/src_reset_source/src_reset_source.c
..boards/evkmcimx6ul/driver_examples/wdog/wdog.c

Board Support Packages (7)
SDK2.2_iMX6UL_WIN(REV SDK2.2)
http://www.nxp.com/products/microcontrollers-and-processors/arm-processors/i.mx-processors/i.mx-6-pr...

for hello world one can look at

IMX Hello World - Variscite Wiki 

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

0 Kudos

434 Views
listplot3d
Contributor III

Thanks. as you said, on/off button doesn't have driver. Then I found a proper pin and mux'd it as GPIO, then had written a userspace driver. It was enough for the experiment.

0 Kudos