summaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard/max7359_keypad.c
diff options
context:
space:
mode:
authorEvgeniy Dushistov2015-05-15 22:49:00 +0200
committerDmitry Torokhov2015-05-16 00:58:40 +0200
commit68aeee98eeb311958be4dfeb03f1da2d90a270d9 (patch)
tree01fd155e975735400e24b0b504032a719f10ce98 /drivers/input/keyboard/max7359_keypad.c
parentInput: max7359_keypad - do not set MAX7359_CFG_INTERRUPT flag (diff)
downloadkernel-qcow2-linux-68aeee98eeb311958be4dfeb03f1da2d90a270d9.tar.gz
kernel-qcow2-linux-68aeee98eeb311958be4dfeb03f1da2d90a270d9.tar.xz
kernel-qcow2-linux-68aeee98eeb311958be4dfeb03f1da2d90a270d9.zip
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>
Diffstat (limited to 'drivers/input/keyboard/max7359_keypad.c')
-rw-r--r--drivers/input/keyboard/max7359_keypad.c30
1 files changed, 9 insertions, 21 deletions
diff --git a/drivers/input/keyboard/max7359_keypad.c b/drivers/input/keyboard/max7359_keypad.c
index 4e35904d65ad..5091133b7b8e 100644
--- a/drivers/input/keyboard/max7359_keypad.c
+++ b/drivers/input/keyboard/max7359_keypad.c
@@ -84,26 +84,6 @@ static int max7359_read_reg(struct i2c_client *client, int reg)
return ret;
}
-static void max7359_build_keycode(struct max7359_keypad *keypad,
- const struct matrix_keymap_data *keymap_data)
-{
- struct input_dev *input_dev = keypad->input_dev;
- 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 int scancode = MATRIX_SCAN_CODE(row, col,
- MAX7359_ROW_SHIFT);
- unsigned short keycode = KEY_VAL(key);
-
- keypad->keycodes[scancode] = keycode;
- __set_bit(keycode, input_dev->keybit);
- }
- __clear_bit(KEY_RESERVED, input_dev->keybit);
-}
-
/* runs in an IRQ thread -- can (and will!) sleep */
static irqreturn_t max7359_interrupt(int irq, void *dev_id)
{
@@ -232,7 +212,15 @@ static int max7359_probe(struct i2c_client *client,
input_set_capability(input_dev, EV_MSC, MSC_SCAN);
input_set_drvdata(input_dev, keypad);
- max7359_build_keycode(keypad, keymap_data);
+ error = matrix_keypad_build_keymap(keymap_data, NULL,
+ MAX7359_MAX_KEY_ROWS,
+ MAX7359_MAX_KEY_COLS,
+ keypad->keycodes,
+ input_dev);
+ if (error) {
+ dev_err(&client->dev, "failed to build keymap\n");
+ return error;
+ }
error = devm_request_threaded_irq(&client->dev, client->irq, NULL,
max7359_interrupt,