aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/keyboard/omap4-keypad.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/input/keyboard/omap4-keypad.c')
-rw-r--r--drivers/input/keyboard/omap4-keypad.c32
1 files changed, 6 insertions, 26 deletions
diff --git a/drivers/input/keyboard/omap4-keypad.c b/drivers/input/keyboard/omap4-keypad.c
index 0400b3f2b4b9..024b7bdffe5b 100644
--- a/drivers/input/keyboard/omap4-keypad.c
+++ b/drivers/input/keyboard/omap4-keypad.c
@@ -28,11 +28,10 @@
28#include <linux/io.h> 28#include <linux/io.h>
29#include <linux/of.h> 29#include <linux/of.h>
30#include <linux/input.h> 30#include <linux/input.h>
31#include <linux/input/matrix_keypad.h>
31#include <linux/slab.h> 32#include <linux/slab.h>
32#include <linux/pm_runtime.h> 33#include <linux/pm_runtime.h>
33 34
34#include <linux/platform_data/omap4-keypad.h>
35
36/* OMAP4 registers */ 35/* OMAP4 registers */
37#define OMAP4_KBD_REVISION 0x00 36#define OMAP4_KBD_REVISION 0x00
38#define OMAP4_KBD_SYSCONFIG 0x10 37#define OMAP4_KBD_SYSCONFIG 0x10
@@ -218,7 +217,6 @@ static void omap4_keypad_close(struct input_dev *input)
218 pm_runtime_put_sync(input->dev.parent); 217 pm_runtime_put_sync(input->dev.parent);
219} 218}
220 219
221#ifdef CONFIG_OF
222static int omap4_keypad_parse_dt(struct device *dev, 220static int omap4_keypad_parse_dt(struct device *dev,
223 struct omap4_keypad *keypad_data) 221 struct omap4_keypad *keypad_data)
224{ 222{
@@ -235,20 +233,9 @@ static int omap4_keypad_parse_dt(struct device *dev,
235 233
236 return 0; 234 return 0;
237} 235}
238#else
239static inline int omap4_keypad_parse_dt(struct device *dev,
240 struct omap4_keypad *keypad_data)
241{
242 return -ENOSYS;
243}
244#endif
245 236
246static int omap4_keypad_probe(struct platform_device *pdev) 237static int omap4_keypad_probe(struct platform_device *pdev)
247{ 238{
248 const struct omap4_keypad_platform_data *pdata =
249 dev_get_platdata(&pdev->dev);
250 const struct matrix_keymap_data *keymap_data =
251 pdata ? pdata->keymap_data : NULL;
252 struct omap4_keypad *keypad_data; 239 struct omap4_keypad *keypad_data;
253 struct input_dev *input_dev; 240 struct input_dev *input_dev;
254 struct resource *res; 241 struct resource *res;
@@ -277,14 +264,9 @@ static int omap4_keypad_probe(struct platform_device *pdev)
277 264
278 keypad_data->irq = irq; 265 keypad_data->irq = irq;
279 266
280 if (pdata) { 267 error = omap4_keypad_parse_dt(&pdev->dev, keypad_data);
281 keypad_data->rows = pdata->rows; 268 if (error)
282 keypad_data->cols = pdata->cols; 269 return error;
283 } else {
284 error = omap4_keypad_parse_dt(&pdev->dev, keypad_data);
285 if (error)
286 return error;
287 }
288 270
289 res = request_mem_region(res->start, resource_size(res), pdev->name); 271 res = request_mem_region(res->start, resource_size(res), pdev->name);
290 if (!res) { 272 if (!res) {
@@ -363,7 +345,7 @@ static int omap4_keypad_probe(struct platform_device *pdev)
363 goto err_free_input; 345 goto err_free_input;
364 } 346 }
365 347
366 error = matrix_keypad_build_keymap(keymap_data, NULL, 348 error = matrix_keypad_build_keymap(NULL, NULL,
367 keypad_data->rows, keypad_data->cols, 349 keypad_data->rows, keypad_data->cols,
368 keypad_data->keymap, input_dev); 350 keypad_data->keymap, input_dev);
369 if (error) { 351 if (error) {
@@ -434,13 +416,11 @@ static int omap4_keypad_remove(struct platform_device *pdev)
434 return 0; 416 return 0;
435} 417}
436 418
437#ifdef CONFIG_OF
438static const struct of_device_id omap_keypad_dt_match[] = { 419static const struct of_device_id omap_keypad_dt_match[] = {
439 { .compatible = "ti,omap4-keypad" }, 420 { .compatible = "ti,omap4-keypad" },
440 {}, 421 {},
441}; 422};
442MODULE_DEVICE_TABLE(of, omap_keypad_dt_match); 423MODULE_DEVICE_TABLE(of, omap_keypad_dt_match);
443#endif
444 424
445#ifdef CONFIG_PM_SLEEP 425#ifdef CONFIG_PM_SLEEP
446static int omap4_keypad_suspend(struct device *dev) 426static int omap4_keypad_suspend(struct device *dev)
@@ -482,7 +462,7 @@ static struct platform_driver omap4_keypad_driver = {
482 .name = "omap4-keypad", 462 .name = "omap4-keypad",
483 .owner = THIS_MODULE, 463 .owner = THIS_MODULE,
484 .pm = &omap4_keypad_pm_ops, 464 .pm = &omap4_keypad_pm_ops,
485 .of_match_table = of_match_ptr(omap_keypad_dt_match), 465 .of_match_table = omap_keypad_dt_match,
486 }, 466 },
487}; 467};
488module_platform_driver(omap4_keypad_driver); 468module_platform_driver(omap4_keypad_driver);