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.

Keypad customization in am3703 with 4x4

Other Parts Discussed in Thread: AM3703

Dear all,

i have been working on am3703 custom board with linux 2.6.32 kernel .

i am trying to integrate 4x4 keypad for my board,for that i want to use twl4030_keyboard.c default driver.

i have took my default board config file as board-omap3beagle.c file in that i have mapped single key in each button like this

 board_keymap[] = {
    KEY(2, 2, KEY_1),
    KEY(3, 2, KEY_5),
    KEY(4, 2, KEY_9),
    KEY(5, 2, KEY_WAKEUP),
 
    KEY(2, 3, KEY_3),
    KEY(3, 3, KEY_7),
    KEY(4, 3, KEY_ESC),
    KEY(5, 3, KEY_POWER),
  
    KEY(2, 4,KEY_0),
    KEY(3, 4,KEY_4),   
    KEY(4, 4,KEY_8),  
    KEY(5, 4,KEY_BACKSPACE),
  
    KEY(2, 5,KEY_2),
    KEY(3, 5,KEY_6),
    KEY(4, 5,KEY_ENTER),    
    KEY(5, 5,KEY_MENU)

};

and it's been working fine with default twl4030_keyboard.c driver.

now i want to integrate multiple functionality in each button,like

KEY(2, 4,KEY_0) // here 2 col,4 row i have assign function as KEY_0,now i  want assign KEY_0 along with KEY_A,KEY_B,KEY_C

if i press 1st time i should get KEY_0, 2cd time i should get KEY_A, 3rd time press i should get KEY_B, 4th time i should get KEY_C

please suggest me how to integrate it?

matrix_keypad_build_keymap(const struct matrix_keymap_data *keymap_data,
                           unsigned int row_shift,
                           unsigned short *keymap, unsigned long *keybit)
{
        int i;
        
        for (i = 0; i < keymap_data->keymap_size; i++) {
                unsigned int key = keymap_data->keymap[i];
                unsigned int row = KEY_ROW(key);
                unsigned int col = KEY_COL(key);
                unsigned short code = KEY_VAL(key);
                keymap[MATRIX_SCAN_CODE(row, col, row_shift)] = code;
                __set_bit(code, keybit);
        }
        __clear_bit(KEY_RESERVED, keybit); 
}

one more thing in the above  function , what   __set_bit(code,keybit); function do ? i didn't understand.

if i change code= KEY_VAL(key)  to code =KEY_VAL(30) ( 30 means KEY_A value)  then it's been effecting instead of KEY_0 KEY_A is coming.

please suggest me i have been  struggling with this integratoin .

thanks in advance!!!!