How to configure Input/Output a GPIO in Devicetree?

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

How to configure Input/Output a GPIO in Devicetree?

11,151 Views
alokpawar
Contributor I

Hi All,

I am using yocto 1.6 daisy branch with kernel 3.10.17.

I am able to configure all platform data and pin-muxing correctly.

I have a query in that... How can we configure a GPIO that is Input/output in device tree?

I didn't find anything in device tree.

I have two GPIO in which one is input and other output, i am able to configure everything successfully.

But need to ask where i can define those pin as Input or Output ... In device tree? ... or ... in board file? ... or in driver?

Thanks

Alks

Labels (5)
0 Kudos
3 Replies

9,487 Views
avni
Contributor I

I want to set GPIO2_IO14 as output and set pin to 1 in device tree file.

what are the changes needed for that?

0 Kudos

10,114 Views
lategoodbye
Senior Contributor I

Hi Alok,

the purpose of the devicetree is to describe the hardware and not it's configuration. As far as i know it's not possible to set the GPIO direction directly via DT. But if you assign the GPIO to assigned function like a LED and the led driver would do that for you.

In the case you want to keep them as GPIOs you can set direction in board file or via sysfs.

BR Stefan

0 Kudos

10,114 Views
igorpadykov
NXP Employee
NXP Employee

Hi Alok

I think there is no intuitively clear description,

one can just look at examples

Re: Any examples on how to modify the .dts (device tree) source for custom hardware?

Definitive GPIO guide - Studio Kousagi Wiki

http://lxr.free-electrons.com/source/Documentation/devicetree/bindings/gpio/gpio.txt

Best regards

igor

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

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

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

0 Kudos