This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Linux/BEAGLEBK: GPIO keys configuration

Part Number: BEAGLEBK
Other Parts Discussed in Thread: DRA75

Tool/software: Linux

Hi,

I am quite new into device-tree, and I still have lacks of understanding it entirely.

I have the arago build already. I enabled the gpio_keys module and a cp2112 module of USB/i2C driver. The cp2112
exposes the device as /dev/i2c-X and the on-board gpio's as /dev/gpiochip4 and  /sys/class/gpio/gpio/gpio (504 .. 511), when exported.

root@am335x-evm:/sys/class/gpio/gpio508# cat value 
1
root@am335x-evm:/sys/class/gpio/gpio508# cat value 
0
cat /sys/kernel/debug/gpio
gpiochip0: GPIOs 0-31, parent: platform/44e07000.gpio, gpio:
 gpio-6   (                    |cd                  ) in  lo IRQ

gpiochip1: GPIOs 32-63, parent: platform/4804c000.gpio, gpio:
 gpio-53  (                    |beaglebone:green:hea) out lo    
 gpio-54  (                    |beaglebone:green:mmc) out lo    
 gpio-55  (                    |beaglebone:green:usr) out hi    
 gpio-56  (                    |beaglebone:green:usr) out lo    

gpiochip2: GPIOs 64-95, parent: platform/481ac000.gpio, gpio:

gpiochip3: GPIOs 96-127, parent: platform/481ae000.gpio, gpio:

gpiochip4: GPIOs 504-511, parent: hid/0003:10C4:EA90.0001, cp2112_gpio, can sleep:
 gpio-508 (                    |sysfs               ) in  hi    

I can read the value from all using the sys filesystem. I have to add them as KEY_EVENTS.

Also they are shown as:   gpiochip4: GPIOs 504-511, parent: hid/0003:10C4:EA90.0001, cp2112_gpio, can sleep

ON which dts file I have to add, or if I am using a totally new one just for the purpose of the keys, where I should look.
I've seen samples but they are using PX  rail names and using unexistent am335x-bbw-bbb-base.h


Thank you.

  • Hi Marius,

    Marius Chincisan said:
    I have the arago build already

    Do you use AM335x PSDK Linux v5.03 (kernel v4.14.79)

    Regarding "gpio-key" DTS node, you can integrate it in your main DTS file (like for AM3335x EVM/SK boards and AM437x IDK board) or put it in separate DTSI file which you can include in your main DTS file (like for DRA75 EVM board). Both options are possible. Refer to below file for details.

    linux-4.14.79/arch/arm/boot/dts/am335x-evm.dts
    linux-4.14.79/arch/arm/boot/dts/am335x-evmsk.dts
    linux-4.14.79/arch/arm/boot/dts/am437x-idk-evm.dts

    linux-4.14.79/arch/arm/boot/dts/dra7-evm-common.dtsi

    linux-4.14.79/Documentation/devicetree/bindings/input/gpio-keys.txt

    linux-4.14.79/Documentation/devicetree/bindings/input/gpio-keys-polled.txt

    Regards,
    Pavel