gpio-hog and gpio export

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

gpio-hog and gpio export

15,032 Views
delauratfrançoi
Contributor II


Hello

My name is françois I work with imx7d. I want to use a gpio in output. The gpio output is software controlled and is not connected to a button or LED. I know how creat an gpio in user space with export but I want initialize the gpio in device tree with gpio-hog.

If I don't initialize the gpio with  gpio-hog in devicetree I can export the gpio but if  I initialize the gpio with gpio-hog in devicetre i can not export the gpio.

is it normal?

My gpio-hog in my device tree

gpio1: gpio@30200000 {

  compatible = "fsl,imx7d-gpio", "fsl,imx35-gpio";

  reg = <0x30200000 0x10000>;

  interrupts = <GIC_SPI 64 IRQ_TYPE_LEVEL_HIGH>, /* GPIO1_INT15_0 */

      <GIC_SPI 65 IRQ_TYPE_LEVEL_HIGH>; /* GPIO1_INT31_16 */

  gpio-controller;

  #gpio-cells = <2>;

  interrupt-controller;

  #interrupt-cells = <2>;

  gpio102{

                gpio-hog;

                gpios = <2 GPIO_ACTIVE_LOW>;

                output-high;

                line-name = "ResetBluetooth";

                };

  };

Thanks,

François.

Labels (2)
0 Kudos
7 Replies

8,573 Views
igorpadykov
NXP Employee
NXP Employee

Hi François

for creating GPIO entries one can look at

i.MX51 Device Tree GPIO as output

Best regards

igor

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

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

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

0 Kudos

8,573 Views
delauratfrançoi
Contributor II

Hi igorpadykov

I read the document i.MX51 Device Tree GPIO as output​ .  But I would know why if I use gpio-hog to one gpio in my devicetree , I can not use this gpio in the user space (export , unexport with this gpio)

thanks,

Best regards,

Francois.

0 Kudos

8,573 Views
igorpadykov
NXP Employee
NXP Employee

Hi Francois

as this is general linux question suggest to post this on

linux device tree resources like

Device Tree - eLinux.org

Best regards

igor

0 Kudos

8,573 Views
nxp_com
Contributor I

Managed to get it working, it started behaving as expected once I had a default pulldown on the pin

In the pinctrl hog I had to have

MX6QDL_PAD_GPIO_2__GPIO1_IO02  0x130b1 // GPIO2 LED Red, default pulldopwn

a ping config with a default 100k pullup 0x1b0b1 was NOT working

the definition is 

&gpio1 {
   led-red-gpio {
   gpio-hog;
   gpios = <2 0>;
   output-high;
   };
};

this will result in the following line in cat /sys/kernel/debug/gpio 

gpio-2   (                    |led-red-gpio        ) out hi  

Igor, take note

0 Kudos

8,573 Views
nxp_com
Contributor I

It is not a general question, how pincontrol works on IMX is specific to imx

I am also looking on how to use  gpio-hog; with imx6q-gpio and "fsl,imx6q-iomuxc-gpr", "syscon";

So far no luck 

if there is no support for imx6q in the forum you have to say it, not pretend that it is a "general question"

0 Kudos

8,573 Views
igorpadykov
NXP Employee
NXP Employee

Hi Damiano

nxp has extended support for porting issues

NXP Professional Services | NXP 

Best regards
igor

0 Kudos

8,573 Views
delauratfrançoi
Contributor II

Hi Igorpadykov

I read the  document i.MX51 Device Tree GPIO as output but I would know why if I use gpio-hog to one gpio I can use this gpio with export in user space.

thanks,

Best regards

François.

0 Kudos