cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
leith
Adventurer
Adventurer
7,443 Views
Registered: ‎11-28-2009

Problems with gpio-keys and gpio-leds

Jump to solution

Attempting to use gpio-leds and gpio-keys on Zynq/Petalinux_15_4.

 

I've modified the device tree.  I can uncompile the blob and see what I expect.  I believe I have all the correct modules enabled in the kernel config.

 

When I boot the Zynq, I can find no evidence of gpio-leds or gpio-keys in either /proc/device-tree or /sys??

 

I can cause gpio bits to flip as expected with  the "echo xxx > export", "echo 1 > value" stuff.  So I know I have basic gpio working.

 

I don't see anything helpful in dmesg.

 

For reasons unknown it seems like the kernel is just not recognizing the compatible = "gpio-xxx" and populating it in its data structures.

 

Anybody have some helpful hints?

0 Kudos
1 Solution

Accepted Solutions
leith
Adventurer
Adventurer
12,820 Views
Registered: ‎11-28-2009

Well... I knew it had to be something stupid...

 

My update of the Linux image to the flash was flawed.  I was not getting a new image.ub.  

Discovered this sort of by accident.  Shazam.  Now I see gpio-keys and gpio_leds in /proc/device-tree and my heartbeat LED is flashing as expected.

View solution in original post

0 Kudos
6 Replies
ibaie
Xilinx Employee
Xilinx Employee
7,410 Views
Registered: ‎10-06-2016

Hi Leith,

 

Did you enabled the LED support in your kernel?? Otherwise the kernel is not going to bind your gpio-leds definition with the corresponding Linux driver. Same applies to gpio-keys.

 

Capture.PNG

 

Regards,

Ibai

 

 


Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos
leith
Adventurer
Adventurer
7,391 Views
Registered: ‎11-28-2009

I once again checked ./build/linux/kernel/xlnx-4.0/.config and it shows all four of those modules as uncommented and "=y".

 

If I grep ./images/linux/image.ub it matches both "gpio-keys" and "gpio-leds".

 

Perhaps a bug in the peta_15_4 Linux???

 

At this point the only thing I can think to do is start installing printks in the kernel and try to get some/any clues about what's amiss. 

 

 

0 Kudos
ibaie
Xilinx Employee
Xilinx Employee
7,381 Views
Registered: ‎10-06-2016

Hi Leith,

 

I'm not completely sure but I think that if you cannot find any reference to gpio-keys module in the /proc/device-tree, that means that the device tree blob you are loading does not have any reference to this module.

 

You can check again if you device tree blob includes the definition. Take the dtb file from images folder and generate the dts file to check.

 

Kind Regards,

Ibai


Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos
leith
Adventurer
Adventurer
7,314 Views
Registered: ‎11-28-2009

Here's the gpio-keys and gpio-leds extracted from the output of "dtc -I dtb images/linux/system.dtb":

 

gpio_leds {
compatible = "gpio-leds";

led-uzed-user {
label = "led-uzed-user";
gpios = <0x5 0x2f 0x0>;
default-state = "on";
linux,default-trigger = "heartbeat";
};
};

gpio-keys {
compatible = "gpio-keys";
#address-cells = <0x1>;
#size-cells = <0x0>;
autorepeat;

sw_uzed_user {
label = "sw_uzed_user";
gpios = <0x5 0x33 0x0>;
linux,code = <0x6c>;
gpio-key,wakeup;
autorepeat;
};
};

 

Its located in the "amba" group.

 

I totally agree that I expect this device to show up in the /proc/device-tree structure.  Its acting like I've misspelled the compatible fields.  But I've double checked that any number of times and ways.

 

Is there any easy way to cause the kernel to output more debug info as its decoding the device tree??

 

Thanks in advance for any helpful suggestions.

 

Leith

0 Kudos
leith
Adventurer
Adventurer
12,821 Views
Registered: ‎11-28-2009

Well... I knew it had to be something stupid...

 

My update of the Linux image to the flash was flawed.  I was not getting a new image.ub.  

Discovered this sort of by accident.  Shazam.  Now I see gpio-keys and gpio_leds in /proc/device-tree and my heartbeat LED is flashing as expected.

View solution in original post

0 Kudos
prasanna_mn
Observer
Observer
6,246 Views
Registered: ‎11-10-2016

HI Ibai,

 

I am also having problem with Gpio, But it is quite different than the subject.

 

I am using zynq7000 in AMP mode, Petalinux(cpu0) and freertos(cpu1), I am able to boot both the cpu's successfully, and cpu1 is running.

I am trying to control gpio(MIO7 connected to PS) from cpu1. I am not able to write it. But if I write the gpio from cpu0 with the same code it works fine. I am not getting what is the problem. Please help me in this problem.

 

Thanks

Prasanna

0 Kudos