diff options
author | Thomas Abraham <thomas.abraham@linaro.org> | 2013-06-25 12:20:08 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2013-06-25 12:46:29 -0400 |
commit | 41cc2aaf802ee21a3eb2c4bcb6995b3bb975bf87 (patch) | |
tree | 5f0b46b85afba797c61828ac603be4e901c65f44 | |
parent | be66227151c0cd4da536098c3ee07809101c6faa (diff) |
Input: samsung-keypad - let device core setup the default pin configuration
With device core now able to setup the default pin configuration,
the pin configuration code based on the deprecated Samsung specific
gpio bindings is removed.
Signed-off-by: Thomas Abraham <thomas.abraham@linaro.org>
Acked-by: Linus Walleij <linus.walleij@linaro.org>
Signed-off-by: Sachin Kamat <sachin.kamat@linaro.org>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
-rw-r--r-- | Documentation/devicetree/bindings/input/samsung-keypad.txt | 24 | ||||
-rw-r--r-- | drivers/input/keyboard/samsung-keypad.c | 52 |
2 files changed, 7 insertions, 69 deletions
diff --git a/Documentation/devicetree/bindings/input/samsung-keypad.txt b/Documentation/devicetree/bindings/input/samsung-keypad.txt index ce3e394c0e64..942d071baaa5 100644 --- a/Documentation/devicetree/bindings/input/samsung-keypad.txt +++ b/Documentation/devicetree/bindings/input/samsung-keypad.txt | |||
@@ -25,14 +25,6 @@ Required Board Specific Properties: | |||
25 | - samsung,keypad-num-columns: Number of column lines connected to the | 25 | - samsung,keypad-num-columns: Number of column lines connected to the |
26 | keypad controller. | 26 | keypad controller. |
27 | 27 | ||
28 | - row-gpios: List of gpios used as row lines. The gpio specifier for | ||
29 | this property depends on the gpio controller to which these row lines | ||
30 | are connected. | ||
31 | |||
32 | - col-gpios: List of gpios used as column lines. The gpio specifier for | ||
33 | this property depends on the gpio controller to which these column | ||
34 | lines are connected. | ||
35 | |||
36 | - Keys represented as child nodes: Each key connected to the keypad | 28 | - Keys represented as child nodes: Each key connected to the keypad |
37 | controller is represented as a child node to the keypad controller | 29 | controller is represented as a child node to the keypad controller |
38 | device node and should include the following properties. | 30 | device node and should include the following properties. |
@@ -41,6 +33,9 @@ Required Board Specific Properties: | |||
41 | - linux,code: the key-code to be reported when the key is pressed | 33 | - linux,code: the key-code to be reported when the key is pressed |
42 | and released. | 34 | and released. |
43 | 35 | ||
36 | - pinctrl-0: Should specify pin control groups used for this controller. | ||
37 | - pinctrl-names: Should contain only one value - "default". | ||
38 | |||
44 | Optional Properties specific to linux: | 39 | Optional Properties specific to linux: |
45 | - linux,keypad-no-autorepeat: do no enable autorepeat feature. | 40 | - linux,keypad-no-autorepeat: do no enable autorepeat feature. |
46 | - linux,keypad-wakeup: use any event on keypad as wakeup event. | 41 | - linux,keypad-wakeup: use any event on keypad as wakeup event. |
@@ -56,17 +51,8 @@ Example: | |||
56 | linux,input-no-autorepeat; | 51 | linux,input-no-autorepeat; |
57 | linux,input-wakeup; | 52 | linux,input-wakeup; |
58 | 53 | ||
59 | row-gpios = <&gpx2 0 3 3 0 | 54 | pinctrl-names = "default"; |
60 | &gpx2 1 3 3 0>; | 55 | pinctrl-0 = <&keypad_rows &keypad_columns>; |
61 | |||
62 | col-gpios = <&gpx1 0 3 0 0 | ||
63 | &gpx1 1 3 0 0 | ||
64 | &gpx1 2 3 0 0 | ||
65 | &gpx1 3 3 0 0 | ||
66 | &gpx1 4 3 0 0 | ||
67 | &gpx1 5 3 0 0 | ||
68 | &gpx1 6 3 0 0 | ||
69 | &gpx1 7 3 0 0>; | ||
70 | 56 | ||
71 | key_1 { | 57 | key_1 { |
72 | keypad,row = <0>; | 58 | keypad,row = <0>; |
diff --git a/drivers/input/keyboard/samsung-keypad.c b/drivers/input/keyboard/samsung-keypad.c index 22e357b51024..03bdad771d2d 100644 --- a/drivers/input/keyboard/samsung-keypad.c +++ b/drivers/input/keyboard/samsung-keypad.c | |||
@@ -24,7 +24,6 @@ | |||
24 | #include <linux/pm_runtime.h> | 24 | #include <linux/pm_runtime.h> |
25 | #include <linux/slab.h> | 25 | #include <linux/slab.h> |
26 | #include <linux/of.h> | 26 | #include <linux/of.h> |
27 | #include <linux/of_gpio.h> | ||
28 | #include <linux/sched.h> | 27 | #include <linux/sched.h> |
29 | #include <linux/input/samsung-keypad.h> | 28 | #include <linux/input/samsung-keypad.h> |
30 | 29 | ||
@@ -79,10 +78,6 @@ struct samsung_keypad { | |||
79 | unsigned int rows; | 78 | unsigned int rows; |
80 | unsigned int cols; | 79 | unsigned int cols; |
81 | unsigned int row_state[SAMSUNG_MAX_COLS]; | 80 | unsigned int row_state[SAMSUNG_MAX_COLS]; |
82 | #ifdef CONFIG_OF | ||
83 | int row_gpios[SAMSUNG_MAX_ROWS]; | ||
84 | int col_gpios[SAMSUNG_MAX_COLS]; | ||
85 | #endif | ||
86 | unsigned short keycodes[]; | 81 | unsigned short keycodes[]; |
87 | }; | 82 | }; |
88 | 83 | ||
@@ -304,45 +299,6 @@ static struct samsung_keypad_platdata *samsung_keypad_parse_dt( | |||
304 | 299 | ||
305 | return pdata; | 300 | return pdata; |
306 | } | 301 | } |
307 | |||
308 | static void samsung_keypad_parse_dt_gpio(struct device *dev, | ||
309 | struct samsung_keypad *keypad) | ||
310 | { | ||
311 | struct device_node *np = dev->of_node; | ||
312 | int gpio, error, row, col; | ||
313 | |||
314 | for (row = 0; row < keypad->rows; row++) { | ||
315 | gpio = of_get_named_gpio(np, "row-gpios", row); | ||
316 | keypad->row_gpios[row] = gpio; | ||
317 | if (!gpio_is_valid(gpio)) { | ||
318 | dev_err(dev, "keypad row[%d]: invalid gpio %d\n", | ||
319 | row, gpio); | ||
320 | continue; | ||
321 | } | ||
322 | |||
323 | error = devm_gpio_request(dev, gpio, "keypad-row"); | ||
324 | if (error) | ||
325 | dev_err(dev, | ||
326 | "keypad row[%d] gpio request failed: %d\n", | ||
327 | row, error); | ||
328 | } | ||
329 | |||
330 | for (col = 0; col < keypad->cols; col++) { | ||
331 | gpio = of_get_named_gpio(np, "col-gpios", col); | ||
332 | keypad->col_gpios[col] = gpio; | ||
333 | if (!gpio_is_valid(gpio)) { | ||
334 | dev_err(dev, "keypad column[%d]: invalid gpio %d\n", | ||
335 | col, gpio); | ||
336 | continue; | ||
337 | } | ||
338 | |||
339 | error = devm_gpio_request(dev, gpio, "keypad-col"); | ||
340 | if (error) | ||
341 | dev_err(dev, | ||
342 | "keypad column[%d] gpio request failed: %d\n", | ||
343 | col, error); | ||
344 | } | ||
345 | } | ||
346 | #else | 302 | #else |
347 | static | 303 | static |
348 | struct samsung_keypad_platdata *samsung_keypad_parse_dt(struct device *dev) | 304 | struct samsung_keypad_platdata *samsung_keypad_parse_dt(struct device *dev) |
@@ -424,15 +380,11 @@ static int samsung_keypad_probe(struct platform_device *pdev) | |||
424 | keypad->stopped = true; | 380 | keypad->stopped = true; |
425 | init_waitqueue_head(&keypad->wait); | 381 | init_waitqueue_head(&keypad->wait); |
426 | 382 | ||
427 | if (pdev->dev.of_node) { | 383 | if (pdev->dev.of_node) |
428 | #ifdef CONFIG_OF | ||
429 | samsung_keypad_parse_dt_gpio(&pdev->dev, keypad); | ||
430 | keypad->type = of_device_is_compatible(pdev->dev.of_node, | 384 | keypad->type = of_device_is_compatible(pdev->dev.of_node, |
431 | "samsung,s5pv210-keypad"); | 385 | "samsung,s5pv210-keypad"); |
432 | #endif | 386 | else |
433 | } else { | ||
434 | keypad->type = platform_get_device_id(pdev)->driver_data; | 387 | keypad->type = platform_get_device_id(pdev)->driver_data; |
435 | } | ||
436 | 388 | ||
437 | input_dev->name = pdev->name; | 389 | input_dev->name = pdev->name; |
438 | input_dev->id.bustype = BUS_HOST; | 390 | input_dev->id.bustype = BUS_HOST; |