Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

Input: max7359_keypad - switch to using matrix_keypad_build_keymap()

max7359_build_keycode() does the same thing as matrix_keypad_build_keymap(),
but the latter can also handle DT bindings.

Tested on beagleboard-xm.

Signed-off-by: Evgeniy A. Dushistov <dushistov@mail.ru>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Evgeniy Dushistov and committed by
Dmitry Torokhov
68aeee98 ee3514b2

+10 -21
+1
drivers/input/keyboard/Kconfig
··· 367 367 368 368 config KEYBOARD_MAX7359 369 369 tristate "Maxim MAX7359 Key Switch Controller" 370 + select INPUT_MATRIXKMAP 370 371 depends on I2C 371 372 help 372 373 If you say yes here you get support for the Maxim MAX7359 Key
+9 -21
drivers/input/keyboard/max7359_keypad.c
··· 84 84 return ret; 85 85 } 86 86 87 - static void max7359_build_keycode(struct max7359_keypad *keypad, 88 - const struct matrix_keymap_data *keymap_data) 89 - { 90 - struct input_dev *input_dev = keypad->input_dev; 91 - int i; 92 - 93 - for (i = 0; i < keymap_data->keymap_size; i++) { 94 - unsigned int key = keymap_data->keymap[i]; 95 - unsigned int row = KEY_ROW(key); 96 - unsigned int col = KEY_COL(key); 97 - unsigned int scancode = MATRIX_SCAN_CODE(row, col, 98 - MAX7359_ROW_SHIFT); 99 - unsigned short keycode = KEY_VAL(key); 100 - 101 - keypad->keycodes[scancode] = keycode; 102 - __set_bit(keycode, input_dev->keybit); 103 - } 104 - __clear_bit(KEY_RESERVED, input_dev->keybit); 105 - } 106 - 107 87 /* runs in an IRQ thread -- can (and will!) sleep */ 108 88 static irqreturn_t max7359_interrupt(int irq, void *dev_id) 109 89 { ··· 212 232 input_set_capability(input_dev, EV_MSC, MSC_SCAN); 213 233 input_set_drvdata(input_dev, keypad); 214 234 215 - max7359_build_keycode(keypad, keymap_data); 235 + error = matrix_keypad_build_keymap(keymap_data, NULL, 236 + MAX7359_MAX_KEY_ROWS, 237 + MAX7359_MAX_KEY_COLS, 238 + keypad->keycodes, 239 + input_dev); 240 + if (error) { 241 + dev_err(&client->dev, "failed to build keymap\n"); 242 + return error; 243 + } 216 244 217 245 error = devm_request_threaded_irq(&client->dev, client->irq, NULL, 218 246 max7359_interrupt,