aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorAlexander Stein <alexander.stein@systec-electronic.com>2014-11-25 14:53:45 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2014-12-03 18:28:39 -0500
commitf2d347ff70be453e861304448cb2f32ff94d40e9 (patch)
tree206349299d3784d12d9c6eae11f299bb94a9a2ae /drivers/input
parente147af492e6c80855550908c86d6d11a501cbfaf (diff)
Input: gpio_keys - add device tree support for interrupt only keys
This features already exists for board config setups. Add support for device tree based systems. Signed-off-by: Alexander Stein <alexander.stein@systec-electronic.com> Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/keyboard/gpio_keys.c34
1 files changed, 20 insertions, 14 deletions
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 8c98e97f8e41..ce0d9090bbe9 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -29,6 +29,7 @@
29#include <linux/of.h> 29#include <linux/of.h>
30#include <linux/of_platform.h> 30#include <linux/of_platform.h>
31#include <linux/of_gpio.h> 31#include <linux/of_gpio.h>
32#include <linux/of_irq.h>
32#include <linux/spinlock.h> 33#include <linux/spinlock.h>
33 34
34struct gpio_button_data { 35struct gpio_button_data {
@@ -617,28 +618,33 @@ gpio_keys_get_devtree_pdata(struct device *dev)
617 618
618 i = 0; 619 i = 0;
619 for_each_child_of_node(node, pp) { 620 for_each_child_of_node(node, pp) {
620 int gpio; 621 int gpio = -1;
622 int irq;
621 enum of_gpio_flags flags; 623 enum of_gpio_flags flags;
622 624
623 if (!of_find_property(pp, "gpios", NULL)) { 625 if (!of_find_property(pp, "gpios", NULL)) {
624 pdata->nbuttons--; 626 irq = irq_of_parse_and_map(pp, 0);
625 dev_warn(dev, "Found button without gpios\n"); 627 if (irq == 0) {
626 continue; 628 pdata->nbuttons--;
627 } 629 dev_warn(dev, "Found button without gpios or irqs\n");
628 630 continue;
629 gpio = of_get_gpio_flags(pp, 0, &flags); 631 }
630 if (gpio < 0) { 632 } else {
631 error = gpio; 633 gpio = of_get_gpio_flags(pp, 0, &flags);
632 if (error != -EPROBE_DEFER) 634 if (gpio < 0) {
633 dev_err(dev, 635 error = gpio;
634 "Failed to get gpio flags, error: %d\n", 636 if (error != -EPROBE_DEFER)
635 error); 637 dev_err(dev,
636 return ERR_PTR(error); 638 "Failed to get gpio flags, error: %d\n",
639 error);
640 return ERR_PTR(error);
641 }
637 } 642 }
638 643
639 button = &pdata->buttons[i++]; 644 button = &pdata->buttons[i++];
640 645
641 button->gpio = gpio; 646 button->gpio = gpio;
647 button->irq = irq;
642 button->active_low = flags & OF_GPIO_ACTIVE_LOW; 648 button->active_low = flags & OF_GPIO_ACTIVE_LOW;
643 649
644 if (of_property_read_u32(pp, "linux,code", &button->code)) { 650 if (of_property_read_u32(pp, "linux,code", &button->code)) {