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/am5716: linux driver support for the keyboard controller on the am5716

Part Number: AM5716
Other Parts Discussed in Thread: AM5716

Tool/software: Linux

Is there linux driver support for the built in keyboard controller on the am5716?

  • I have enabled KEYBOARD_OMAP4 in the kernel config and added the following to my device tree (taken mostly from omap5.dtsi)
    When the kernel boots, I get the message "[ 0.367277] platform 4ae1c000.keypad: Cannot lookup hwmod 'kbd'".
    What else needs to be done to get this working?

    keypad@4ae1c000 {
    compatible = "ti,omap4-keypad";
    linux,keymap = < 0x00000001
    0x0001006a
    0x01000067
    0x0101001c
    0x02000069
    0x0201006c >;
    keypad,num-rows = <3>;
    keypad,num-columns = <2>;
    linux,input-no-autorepeat;
    reg = <0x4ae1c000 0x80>;
    reg-names = "mpu";
    ti,hwmods = "kbd";
    };

  • Hi,

    Have you added &keypad with status = "okay" in the corresponding dts file?

    Best Regards,
    Yordan
  • Hi Yordan,

    Yes I do have status="okay" elsewhere for the keypad.

    I found in the file .../arch/arm/mach-omap2/omap_hwmod_7xx_data.c, the definition for the keypad is missing.  It looks like this defines the clock for the keypad and is required by the driver.

    Once I defined this, the driver now initializes and the /dev/input/event0 device is auto-created.

    However when I press buttons our keypad no interrupts are generated.

    I noticed that the datasheet says the keyboard controller has an IRQ_CROSSBAR Input of IRQ_CROSSBAR_115 and the default mapping is MPU_IRQ_120.

    Based on some other definitions (ie. UART3 etc), I think I defined the interrupts for the keypad incorrectly, so I changed it to 115.

    When I did this, the kernel now displays the following.

    I'm not sure how this IRQ crossbar works.

    [ 34.217006] irq 369: nobody cared (try booting with the "irqpoll" option)
    [ 34.299004] CPU: 0 PID: 1 Comm: swapper/0 Not tainted 4.4.32 #131
    [ 34.372591] Hardware name: Generic DRA72X (Flattened Device Tree)
    [ 34.446173] Backtrace:
    [ 34.475674] [<c00125c4>] (dump_backtrace) from [<c00127c0>] (show_stack+0x18/0x1c)
    [ 34.567120] r7:00000171 r6:20000193 r5:00000000 r4:c0963e34
    [ 34.635588] [<c00127a8>] (show_stack) from [<c027de34>] (dump_stack+0x84/0xa0)
    [ 34.722835] [<c027ddb0>] (dump_stack) from [<c0074ed4>] (__report_bad_irq+0x2c/0xc4)
    [ 34.816382] r7:00000171 r6:00000000 r5:00000002 r4:ef206c00
    [ 34.884845] [<c0074ea8>] (__report_bad_irq) from [<c007522c>] (note_interrupt+0x1ec/0x294)
    [ 34.984699] r9:00000171 r8:00000000 r7:00000171 r6:00000000 r5:00000002 r4:ef206c00
    [ 35.078415] [<c0075040>] (note_interrupt) from [<c0072978>] (handle_irq_event_percpu+0x110/0x130)
    [ 35.185621] r10:c0991e33 r9:00000002 r8:00000000 r7:00000171 r6:ef206c00 r5:00000002
    [ 35.280379] r4:00000000 r3:00000000
    [ 35.323564] [<c0072868>] (handle_irq_event_percpu) from [<c00729d8>] (handle_irq_event+0x40/0x64)
    [ 35.430771] r10:c0938080 r9:eeb47c00 r8:ef006000 r7:00000171 r6:ef206c60 r5:ef206c60
    [ 35.525528] r4:ef206c00
    [ 35.556063] [<c0072998>] (handle_irq_event) from [<c0075db0>] (handle_fasteoi_irq+0xb0/0x12c)
    [ 35.659067] r7:00000171 r6:ef206c60 r5:c09644b0 r4:ef206c00
    [ 35.727532] [<c0075d00>] (handle_fasteoi_irq) from [<c0071ff0>] (generic_handle_irq+0x20/0x30)
    [ 35.831586] r7:00000171 r6:c0933424 r5:ef07fc58 r4:00000000
    [ 35.900044] [<c0071fd0>] (generic_handle_irq) from [<c00722f8>] (__handle_domain_irq+0x94/0xbc)
    [ 36.005157] [<c0072264>] (__handle_domain_irq) from [<c0009450>] (gic_handle_irq+0x50/0x7c)
    [ 36.106060] r9:eeb47c00 r8:ef006000 r7:fa213000 r6:ef07fb50 r5:c09388e0 r4:fa212000
    [ 36.199772] [<c0009400>] (gic_handle_irq) from [<c0013200>] (__irq_svc+0x40/0x74)
    [ 36.290171] Exception stack(0xef07fb50 to 0xef07fb98)
    [ 36.351147] fb40: 00000000 00200140 00000000 00000000
    [ 36.449950] fb60: ef07e000 00000000 00000002 c0995300 ef006000 eeb47c00 c0938080 ef07fbf4
    [ 36.548748] fb80: ef07fbf8 ef07fba0 c0034aec c00346ac 60000113 ffffffff
    [ 36.628634] r7:ef07fb84 r6:ffffffff r5:60000113 r4:c00346ac
    [ 36.697098] [<c0034630>] (__do_softirq) from [<c0034aec>] (irq_exit+0x8c/0xf8)
    [ 36.784341] r10:00000000 r9:eeb47c00 r8:ef006000 r7:00000012 r6:c0933424 r5:00000000
    [ 36.879100] r4:ffffe000
    [ 36.909642] [<c0034a60>] (irq_exit) from [<c00722fc>] (__handle_domain_irq+0x98/0xbc)
    [ 37.004241] r5:00000000 r4:00000000
    [ 37.047423] [<c0072264>] (__handle_domain_irq) from [<c0009450>] (gic_handle_irq+0x50/0x7c)
    [ 37.148327] r9:eeb47c00 r8:eeb47c1c r7:fa213000 r6:ef07fc58 r5:c09388e0 r4:fa212000
    [ 37.242031] [<c0009400>] (gic_handle_irq) from [<c0013200>] (__irq_svc+0x40/0x74)
    [ 37.332430] Exception stack(0xef07fc58 to 0xef07fca0)
    [ 37.393406] fc40: ef206c60 60000013
    [ 37.492208] fc60: 00000001 0000000b ef206c00 00000001 eeb29ec0 eeb47d78 eeb47c1c eeb47c00
    [ 37.591008] fc80: 00000000 ef07fcb4 ef07fcb8 ef07fca8 c00723e8 c066fec4 00000013 ffffffff
    [ 37.689806] r7:ef07fc8c r6:ffffffff r5:00000013 r4:c066fec4
    [ 37.758267] [<c066fe9c>] (_raw_spin_unlock_irqrestore) from [<c00723e8>] (__irq_put_desc_unlock+0x1c/0x40)
    [ 37.874932] [<c00723cc>] (__irq_put_desc_unlock) from [<c0074054>] (enable_irq+0x5c/0x78)
    [ 37.973734] r5:00000171 r4:ef206c00
    [ 38.016920] [<c0073ff8>] (enable_irq) from [<c0440eb0>] (omap4_keypad_open+0xa8/0xc0)
    [ 38.111516] r5:eeb47c00 r4:eeb29c40
    [ 38.154692] [<c0440e08>] (omap4_keypad_open) from [<c0435360>] (input_open_device+0x74/0xb0)
    [ 38.256646] r5:eeb29ec0 r4:eeb47c00
    [ 38.299822] [<c04352ec>] (input_open_device) from [<c031f13c>] (kbd_connect+0x50/0x88)
    [ 38.395470] r7:c06bb97c r6:eeb47c00 r5:eeb29ec0 r4:00000000
    [ 38.463918] [<c031f0ec>] (kbd_connect) from [<c0435f00>] (input_attach_handler+0x1c4/0x1f4)
    [ 38.564822] r7:c06bb97c r6:c096ba74 r5:eeb47c00 r4:c06bb98c
    [ 38.633285] [<c0435d3c>] (input_attach_handler) from [<c0436304>] (input_register_device+0x310/0x3cc)
    [ 38.744697] r9:eeb47c00 r8:eeb47d98 r7:00000000 r6:c097eb0c r5:c096ba74 r4:eeb47c00
    [ 38.838412] [<c0435ff4>] (input_register_device) from [<c0441374>] (omap4_keypad_probe+0x430/0x544)
    [ 38.947720] r9:eeb47c00 r8:00000000 r7:ef20ca00 r6:eeb29c80 r5:ef20ca10 r4:eeb29c40
    [ 39.041421] [<c0440f44>] (omap4_keypad_probe) from [<c039ed68>] (platform_drv_probe+0x58/0xa8)
    [ 39.145474] r9:c0931674 r8:c097f008 r7:00000000 r6:c097f008 r5:ef20ca10 r4:c0440f44
    [ 39.239190] [<c039ed10>] (platform_drv_probe) from [<c039d348>] (driver_probe_device+0x118/0x29c)
    [ 39.346396] r7:00000000 r6:c09e5c1c r5:00000000 r4:ef20ca10
    [ 39.414852] [<c039d230>] (driver_probe_device) from [<c039d53c>] (__driver_attach+0x70/0x94)
    [ 39.516807] r9:c0931674 r8:c093b8a0 r7:c0974b88 r6:c097f008 r5:ef20ca44 r4:ef20ca10
    [ 39.610522] [<c039d4cc>] (__driver_attach) from [<c039ba6c>] (bus_for_each_dev+0x74/0x98)
    [ 39.709323] r7:c0974b88 r6:c039d4cc r5:c097f008 r4:00000000
    [ 39.777778] [<c039b9f8>] (bus_for_each_dev) from [<c039cea8>] (driver_attach+0x20/0x28)
    [ 39.874480] r6:eeb2a900 r5:00000000 r4:c097f008
    [ 39.930295] [<c039ce88>] (driver_attach) from [<c039ca6c>] (bus_add_driver+0xd4/0x1f0)
    [ 40.025951] [<c039c998>] (bus_add_driver) from [<c039ddcc>] (driver_register+0xa4/0xe8)
    [ 40.122652] r7:c093b8a0 r6:00000000 r5:c090bbcc r4:c097f008
    [ 40.191110] [<c039dd28>] (driver_register) from [<c039ec80>] (__platform_driver_register+0x38/0x4c)
    [ 40.300418] r5:c090bbcc r4:eeb29bc0
    [ 40.343603] [<c039ec48>] (__platform_driver_register) from [<c090bbe4>] (omap4_keypad_driver_init+0x18/0x20)
    [ 40.462373] [<c090bbcc>] (omap4_keypad_driver_init) from [<c000979c>] (do_one_initcall+0x10c/0x1c0)
    [ 40.571691] [<c0009690>] (do_one_initcall) from [<c08e5ef0>] (kernel_init_freeable+0x194/0x25c)
    [ 40.676796] r9:c0931674 r8:c0994000 r7:c0923834 r6:000000ba r5:c0994000 r4:00000007
    [ 40.770511] [<c08e5d5c>] (kernel_init_freeable) from [<c066b7e8>] (kernel_init+0x14/0xf4)
    [ 40.869311] r9:00000000 r8:00000000 r7:00000000 r6:00000000 r5:c066b7d4 r4:c0994000
    [ 40.963025] [<c066b7d4>] (kernel_init) from [<c000f288>] (ret_from_fork+0x14/0x2c)
    [ 41.054472] r5:c066b7d4 r4:00000000
    [ 41.097649] handlers:
    [ 41.125004] [<c0440c30>] omap4_keypad_irq_handler threaded [<c0440ca4>] omap4_keypad_irq_thread_fn
    [ 41.233322] Disabling IRQ #369