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.

example code to setup and use keypad on 4460

Other Parts Discussed in Thread: 4430

Hello everyone,

I have a Variscite SOC with a OMAP4460 running linux, specs here:

     http://www.variscite.com/products/item/76-var-som-om44-ti-omap4460

Can anyone provide a simple example program of how to setup and read the keypad?

Thanks,

Jeff

  • for a reference to this you can look at 4430's TRM chapter 26, around page  5409.

    26.5 Keyboard Controller Programming Guide


  • sorry, i forgot TRM links
    OMAP4430 Multimedia Device Silicon Revision 2.x
    http://www.ti.com/pdfs/wtbu/OMAP4430_ES2.x_PUBLIC_TRM_vAA.zip
    OMAP4460 Multimedia Device Silicon Revision 1.x
    http://www.ti.com/pdfs/wtbu/OMAP4460_ES1.x_PUBLIC_TRM_vL.zip
    OMAP4470 Multimedia Device Silicon Revision 1.0
    http://www.ti.com/pdfs/wtbu/OMAP4470_ES1.0_PUBLIC_TRM_vD.zip

  • Graham;

    you can find a keypad definition in next files that can be copied to board-omap4panda.c [__init omap4_panda_init(..)], or make reference to them,

    ./kernel/android-3.0/arch/arm/plat-omap/include/plat/omap4-keypad.h

    struct omap4_keypad_platform_data {
        const struct matrix_keymap_data *keymap_data;
        u8 rows;
        u8 cols;
        void (*keypad_pad_wkup)(int enable);
    };

    extern int omap4_keyboard_init(struct omap4_keypad_platform_data *);

    ./kernel/android-3.0/arch/arm/mach-omap2/board-4430sdp.c

    /*
     * As OMAP4430 mux HSI and USB signals, when HSI is used (for instance HSI
     * modem is plugged) we should configure HSI pad conf and disable some USB
     * configurations.
     * HSI usage is declared using bootargs variable:
     * board-4430sdp.modem_ipc=hsi
     * Any other or missing value will not setup HSI pad conf, and port_mode[0]
     * will be used by USB.
     * Variable modem_ipc is used to catch bootargs parameter value.
     */
    static char *modem_ipc = "n/a";
    module_param(modem_ipc, charp, 0);
    MODULE_PARM_DESC(modem_ipc, "Modem IPC setting");

    static void __init omap_4430sdp_init(void)

    ...
    ...

        status = omap4_keyboard_init(&sdp4430_keypad_data);
        if (status)
            pr_err("Keypad initialization failed: %d\n", status);

        omap_dmm_init();
        omap_4430sdp_display_init();
        blaze_panel_init();
        blaze_keypad_init();

    ...
    ...


    ./kernel/android-3.0/arch/arm/mach-omap2/devices.c

    int __init omap4_keyboard_init(struct omap4_keypad_platform_data
                            *sdp4430_keypad_data)
    {
        struct omap_device *od;
        struct omap_hwmod *oh;
        struct omap4_keypad_platform_data *keypad_data;
        unsigned int id = -1;
        char *oh_name = "kbd";
        char *name = "omap4-keypad";

        oh = omap_hwmod_lookup(oh_name);
        if (!oh) {
            pr_err("Could not look up %s\n", oh_name);
            return -ENODEV;
        }

        keypad_data = sdp4430_keypad_data;

        od = omap_device_build(name, id, oh, keypad_data,
                sizeof(struct omap4_keypad_platform_data),
                omap_keyboard_latency,
                ARRAY_SIZE(omap_keyboard_latency), 0);

        if (IS_ERR(od)) {
            WARN(1, "Can't build omap_device for %s:%s.\n",
                            name, oh->name);
            return PTR_ERR(od);
        }

        return 0;
    }