Skip to contentSkip to conversation

Input: gpio_keys: allocate pins

PATCH New Daniel Mack 1 participant 1 message Oct 12, 2012

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

PATCH v2 1/1 Input: gpio_keys: allocate pins

This allows DT driven boards to allocate and configure the pinmux once the driver is probed.

Cc Linus Walleij <[email protected]>
Cc Dmitry Torokhov <[email protected]>
---
 drivers/input/keyboard/gpio_keys.c | 7 +++++++
 1 file changed, 7 insertions(+)
drivers/input/keyboard/gpio_keys.c +7 -0
index 6a68041..52c6698 100644
@@ -29,6 +29,7 @@
 #include <linux/of_platform.h>
 #include <linux/of_gpio.h>
 #include <linux/spinlock.h>
+#include <linux/pinctrl/consumer.h>
 
 struct gpio_button_data {
 	const struct gpio_keys_button *button;
@@ -664,6 +665,7 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
 	const struct gpio_keys_platform_data *pdata = dev_get_platdata(dev);
 	struct gpio_keys_drvdata *ddata;
 	struct input_dev *input;
+	struct pinctrl *pinctrl;
 	int i, error;
 	int wakeup = 0;
 
@@ -701,6 +703,11 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
 	input->id.product = 0x0001;
 	input->id.version = 0x0100;
 
+	/* request pin mux */
+	pinctrl = devm_pinctrl_get_select_default(dev);
+	if (IS_ERR(pinctrl))
+		dev_info(dev, "pins are not configured from the driver\n");
+
 	/* Enable auto repeat feature of Linux input subsystem */
 	if (pdata->rep)
 		__set_bit(EV_REP, input->evbit);
Signature · 1 line
1.7.11.4