[PATCH] input: gpio_keys: added setup call for extending functionality of driver

Subsystems: input (keyboard, mouse, joystick, touchscreen) drivers, the rest

STALE5164d

3 messages, 3 authors, 2012-06-21 · open the first message on its own page

[PATCH] input: gpio_keys: added setup call for extending functionality of driver

From: Alexander Shiyan <hidden>
Date: 2012-06-20 16:21:03

This additional call can be used for extending functionality of
driver. For example we can add EV_SND, EV_LED, etc. handlers.

Signed-off-by: Alexander Shiyan <redacted>
---
 drivers/input/keyboard/gpio_keys.c |    3 +++
 include/linux/gpio_keys.h          |    2 ++
 2 files changed, 5 insertions(+), 0 deletions(-)
diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index 62bfce4..2b1bcb2 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
@@ -707,6 +707,9 @@ static int __devinit gpio_keys_probe(struct platform_device *pdev)
 			wakeup = 1;
 	}
 
+	if (pdata->setup)
+		pdata->setup(input);
+
 	error = sysfs_create_group(&pdev->dev.kobj, &gpio_keys_attr_group);
 	if (error) {
 		dev_err(dev, "Unable to export keys/switches, error: %d\n",
diff --git a/include/linux/gpio_keys.h b/include/linux/gpio_keys.h
index a7e977f..0dfd3fe 100644
--- a/include/linux/gpio_keys.h
+++ b/include/linux/gpio_keys.h
@@ -2,6 +2,7 @@
 #define _GPIO_KEYS_H
 
 struct device;
+struct input_dev;
 
 struct gpio_keys_button {
 	/* Configuration parameters */
@@ -25,6 +26,7 @@ struct gpio_keys_platform_data {
 	unsigned int rep:1;		/* enable input subsystem auto repeat */
 	int (*enable)(struct device *dev);
 	void (*disable)(struct device *dev);
+	int (*setup)(struct input_dev *input);
 	const char *name;		/* input device name */
 };
 
-- 
1.7.3.4

Re: [PATCH] input: gpio_keys: added setup call for extending functionality of driver

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2012-06-21 08:50:50

Hi Alexander,

On Wed, Jun 20, 2012 at 08:09:57PM +0400, Alexander Shiyan wrote:
This additional call can be used for extending functionality of
driver. For example we can add EV_SND, EV_LED, etc. handlers.
I am not sure that gpio_keys is quite ready to handle events besides
EV_KEY and EV_SW, additional changes are needed; and if you make those
additional changes then I think current platform data should be
sufficient to specify all supported even types.

Also, given the general push towards DT-ased setups platform-supplied
board setup code might not be the best approach.

Thanks.

-- 
Dmitry

Re: [PATCH] input: gpio_keys: added setup call for extending functionality of driver

From: Mark Brown <hidden>
Date: 2012-06-21 10:03:27

On Thu, Jun 21, 2012 at 01:50:45AM -0700, Dmitry Torokhov wrote:
Also, given the general push towards DT-ased setups platform-supplied
board setup code might not be the best approach.
This isn't a general thing, it's only for ARM really (plus things like
PowerPC that have already adopted it).  The majority of architectures
have no plans to use DT.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help