iMX28 GPIO Setup In Device Tree

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

iMX28 GPIO Setup In Device Tree

3,772 Views
tomdeacon
Contributor II

Hi,

I have just gotten started getting my custom iMX28 board running the mainline kernel 3.14. One thing that I haven't figured out is how to setup GPIO's like I did in 2.6.35.

For example I have one GPIO that controls the power to the LCD backlight and it needs to be accessible from user space.

In 2.6.35 I simply did the following:

{
.name = "LCD_BACKLIGHT",
.id = PINID_SAIF1_SDATA0,
.fun = PIN_GPIO,
.data  = 1,
.output = 1,
},

Then using sysfs I could change the value from 1 to 0 to turn the backlight on and off.

Now my question is how do I accomplish the same thing with the device tree?

I read through the documentation in the kernel source tree but couldn't figure it out. Using regulators looked like they might be the way to go but I am not sure.

It was so simple before that I feel like I could be missing something easy.

Thanks in advance.

Labels (2)
0 Kudos
Reply
5 Replies

1,945 Views
tomdeacon
Contributor II

Thanks for the replies everyone. I ended up modifying the pinctrl driver for mxs/imx28 to accept fsl,data and fsl,output as inputs. Then I had to create a dummy driver that does nothing but I could assign the gpio's to so that pinctrl-mxs would configure them. Now the gpio's get set to output and exported to sysfs and I can use them just as before with 2.6.35.

0 Kudos
Reply

1,944 Views
lategoodbye
Senior Contributor I

Hello Tom,

1. define your GPIO under pinctrl section

2. use this gpio for the gpio-led driver just as led_pin_gpio3_5 in mx28-evk.dts

3. add the property default-state="on" (refer to http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/leds/leds-gpio.txt )

BR Stefan

1,945 Views
fabio_estevam
NXP Employee
NXP Employee

Tom,

Please check arch/arm/boot/dts/imx28-evk.dts, where we have the reg_lcd_3v3 regulator controlling the LCD backlight (we also have a PWM control there as well)

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/arch/arm/boot/dts/imx28-evk.dts...

0 Kudos
Reply

1,944 Views
tomdeacon
Contributor II

Thanks for the reply chipexpert but those two links didn't help. The first one never came to a satisfactory conclusion, and they talked about using u-boot, where I am using the bootlets and also I want the pin to be configured to be out by the kernel already and not have to do that using sysfs. Also both are about imx6 and didn't look like they would apply to imx28.

0 Kudos
Reply

1,944 Views
igorpadykov
NXP Employee
NXP Employee

Hi Tom

I think links below answer this question

https://community.freescale.com/thread/317876

http://stackoverflow.com/questions/20656006/default-config-of-gpios-using-device-tree-freescale-i-mx...

Best regards

chip

-----------------------------------------------------------------------------------------------------------------------

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

-----------------------------------------------------------------------------------------------------------------------

0 Kudos
Reply