aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard/tc3589x-keypad.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 13:34:29 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2012-05-24 13:34:29 -0400
commit2c01e7bc46f10e9190818437e564f7e0db875ae9 (patch)
tree8b06c85d69754f7df27f7fb42520f6e2ceaea907 /drivers/input/keyboard/tc3589x-keypad.c
parentab11ca34eea8fda7a1a9302d86f6ef6108ffd68f (diff)
parente644dae645e167d154c0526358940986682a72b0 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
Pull input layer updates from Dmitry Torokhov: - a bunch of new drivers (DA9052/53 touchscreenn controller, Synaptics Navpoint, LM8333 keypads, Wacom I2C touhscreen); - updates to existing touchpad drivers (ALPS, Sntelic); - Wacom driver now supports Intuos5; - device-tree bindings in numerous drivers; - other cleanups and fixes. Fix annoying conflict in drivers/input/tablet/wacom_wac.c that I think implies that the input layer device naming is broken, but let's see. I brough it up with Dmitry. * 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (57 commits) Input: matrix-keymap - fix building keymaps Input: spear-keyboard - document DT bindings Input: spear-keyboard - add device tree bindings Input: matrix-keymap - wire up device tree support Input: matrix-keymap - uninline and prepare for device tree support Input: adp5588 - add support for gpio names Input: omap-keypad - dynamically handle register offsets Input: synaptics - fix compile warning MAINTAINERS: adjust input-related patterns Input: ALPS - switch to using input_mt_report_finger_count Input: ALPS - add semi-MT support for v4 protocol Input: Add Synaptics NavPoint (PXA27x SSP/SPI) driver Input: atmel_mxt_ts - dump each message on just 1 line Input: atmel_mxt_ts - do not read extra (checksum) byte Input: atmel_mxt_ts - verify object size in mxt_write_object Input: atmel_mxt_ts - only allow root to update firmware Input: atmel_mxt_ts - use CONFIG_PM_SLEEP Input: sentelic - report device's production serial number Input: tl6040-vibra - Device Tree support Input: evdev - properly handle read/write with count 0 ...
Diffstat (limited to 'drivers/input/keyboard/tc3589x-keypad.c')
-rw-r--r--drivers/input/keyboard/tc3589x-keypad.c41
1 files changed, 18 insertions, 23 deletions
diff --git a/drivers/input/keyboard/tc3589x-keypad.c b/drivers/input/keyboard/tc3589x-keypad.c
index 2dee3e4e7c6f..7d498e698508 100644
--- a/drivers/input/keyboard/tc3589x-keypad.c
+++ b/drivers/input/keyboard/tc3589x-keypad.c
@@ -78,7 +78,7 @@
78 * @input: pointer to input device object 78 * @input: pointer to input device object
79 * @board: keypad platform device 79 * @board: keypad platform device
80 * @krow: number of rows 80 * @krow: number of rows
81 * @kcol: number of coloumns 81 * @kcol: number of columns
82 * @keymap: matrix scan code table for keycodes 82 * @keymap: matrix scan code table for keycodes
83 * @keypad_stopped: holds keypad status 83 * @keypad_stopped: holds keypad status
84 */ 84 */
@@ -96,21 +96,15 @@ static int tc3589x_keypad_init_key_hardware(struct tc_keypad *keypad)
96{ 96{
97 int ret; 97 int ret;
98 struct tc3589x *tc3589x = keypad->tc3589x; 98 struct tc3589x *tc3589x = keypad->tc3589x;
99 u8 settle_time = keypad->board->settle_time; 99 const struct tc3589x_keypad_platform_data *board = keypad->board;
100 u8 dbounce_period = keypad->board->debounce_period; 100
101 u8 rows = keypad->board->krow & 0xf; /* mask out the nibble */ 101 /* validate platform configuration */
102 u8 column = keypad->board->kcol & 0xf; /* mask out the nibble */ 102 if (board->kcol > TC3589x_MAX_KPCOL || board->krow > TC3589x_MAX_KPROW)
103
104 /* validate platform configurations */
105 if (keypad->board->kcol > TC3589x_MAX_KPCOL ||
106 keypad->board->krow > TC3589x_MAX_KPROW ||
107 keypad->board->debounce_period > TC3589x_MAX_DEBOUNCE_SETTLE ||
108 keypad->board->settle_time > TC3589x_MAX_DEBOUNCE_SETTLE)
109 return -EINVAL; 103 return -EINVAL;
110 104
111 /* configure KBDSIZE 4 LSbits for cols and 4 MSbits for rows */ 105 /* configure KBDSIZE 4 LSbits for cols and 4 MSbits for rows */
112 ret = tc3589x_reg_write(tc3589x, TC3589x_KBDSIZE, 106 ret = tc3589x_reg_write(tc3589x, TC3589x_KBDSIZE,
113 (rows << KP_ROW_SHIFT) | column); 107 (board->krow << KP_ROW_SHIFT) | board->kcol);
114 if (ret < 0) 108 if (ret < 0)
115 return ret; 109 return ret;
116 110
@@ -124,12 +118,14 @@ static int tc3589x_keypad_init_key_hardware(struct tc_keypad *keypad)
124 return ret; 118 return ret;
125 119
126 /* Configure settle time */ 120 /* Configure settle time */
127 ret = tc3589x_reg_write(tc3589x, TC3589x_KBDSETTLE_REG, settle_time); 121 ret = tc3589x_reg_write(tc3589x, TC3589x_KBDSETTLE_REG,
122 board->settle_time);
128 if (ret < 0) 123 if (ret < 0)
129 return ret; 124 return ret;
130 125
131 /* Configure debounce time */ 126 /* Configure debounce time */
132 ret = tc3589x_reg_write(tc3589x, TC3589x_KBDBOUNCE, dbounce_period); 127 ret = tc3589x_reg_write(tc3589x, TC3589x_KBDBOUNCE,
128 board->debounce_period);
133 if (ret < 0) 129 if (ret < 0)
134 return ret; 130 return ret;
135 131
@@ -337,23 +333,22 @@ static int __devinit tc3589x_keypad_probe(struct platform_device *pdev)
337 input->name = pdev->name; 333 input->name = pdev->name;
338 input->dev.parent = &pdev->dev; 334 input->dev.parent = &pdev->dev;
339 335
340 input->keycode = keypad->keymap;
341 input->keycodesize = sizeof(keypad->keymap[0]);
342 input->keycodemax = ARRAY_SIZE(keypad->keymap);
343
344 input->open = tc3589x_keypad_open; 336 input->open = tc3589x_keypad_open;
345 input->close = tc3589x_keypad_close; 337 input->close = tc3589x_keypad_close;
346 338
347 input_set_drvdata(input, keypad); 339 error = matrix_keypad_build_keymap(plat->keymap_data, NULL,
340 TC3589x_MAX_KPROW, TC3589x_MAX_KPCOL,
341 keypad->keymap, input);
342 if (error) {
343 dev_err(&pdev->dev, "Failed to build keymap\n");
344 goto err_free_mem;
345 }
348 346
349 input_set_capability(input, EV_MSC, MSC_SCAN); 347 input_set_capability(input, EV_MSC, MSC_SCAN);
350
351 __set_bit(EV_KEY, input->evbit);
352 if (!plat->no_autorepeat) 348 if (!plat->no_autorepeat)
353 __set_bit(EV_REP, input->evbit); 349 __set_bit(EV_REP, input->evbit);
354 350
355 matrix_keypad_build_keymap(plat->keymap_data, 0x3, 351 input_set_drvdata(input, keypad);
356 input->keycode, input->keybit);
357 352
358 error = request_threaded_irq(irq, NULL, 353 error = request_threaded_irq(irq, NULL,
359 tc3589x_keypad_irq, plat->irqtype, 354 tc3589x_keypad_irq, plat->irqtype,