diff options
author | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-08-24 01:57:00 -0400 |
---|---|---|
committer | Dmitry Torokhov <dmitry.torokhov@gmail.com> | 2011-08-24 02:07:47 -0400 |
commit | e9496746cc0954c43720de0c88fef95a9d229baa (patch) | |
tree | 6f5ff1d9bee1ea44acd343aaea69b3ccce390272 /drivers/input/touchscreen | |
parent | c17ca3f5a2c98784739bbbcc3f6b6ee177f4f201 (diff) |
Input: wacom_w8001 - implement open and close
Implement open() and close() methods for the input device so that we
do not start the device unless there are users listening to the events.
Acked-by: Chris Bagwell <chris@cnpbagwell.com>
Tested-by: Ping Cheng <pingc@wacom.com>
Signed-off-by: Dmitry Torokhov <dtor@mail.ru>
Diffstat (limited to 'drivers/input/touchscreen')
-rw-r--r-- | drivers/input/touchscreen/wacom_w8001.c | 21 |
1 files changed, 20 insertions, 1 deletions
diff --git a/drivers/input/touchscreen/wacom_w8001.c b/drivers/input/touchscreen/wacom_w8001.c index c14412ef4648..5ece6c1f3296 100644 --- a/drivers/input/touchscreen/wacom_w8001.c +++ b/drivers/input/touchscreen/wacom_w8001.c | |||
@@ -367,6 +367,20 @@ static int w8001_command(struct w8001 *w8001, unsigned char command, | |||
367 | return rc; | 367 | return rc; |
368 | } | 368 | } |
369 | 369 | ||
370 | static int w8001_open(struct input_dev *dev) | ||
371 | { | ||
372 | struct w8001 *w8001 = input_get_drvdata(dev); | ||
373 | |||
374 | return w8001_command(w8001, W8001_CMD_START, false); | ||
375 | } | ||
376 | |||
377 | static void w8001_close(struct input_dev *dev) | ||
378 | { | ||
379 | struct w8001 *w8001 = input_get_drvdata(dev); | ||
380 | |||
381 | w8001_command(w8001, W8001_CMD_STOP, false); | ||
382 | } | ||
383 | |||
370 | static int w8001_setup(struct w8001 *w8001) | 384 | static int w8001_setup(struct w8001 *w8001) |
371 | { | 385 | { |
372 | struct input_dev *dev = w8001->dev; | 386 | struct input_dev *dev = w8001->dev; |
@@ -474,7 +488,7 @@ static int w8001_setup(struct w8001 *w8001) | |||
474 | 488 | ||
475 | strlcat(w8001->name, " Touchscreen", sizeof(w8001->name)); | 489 | strlcat(w8001->name, " Touchscreen", sizeof(w8001->name)); |
476 | 490 | ||
477 | return w8001_command(w8001, W8001_CMD_START, false); | 491 | return 0; |
478 | } | 492 | } |
479 | 493 | ||
480 | /* | 494 | /* |
@@ -534,6 +548,11 @@ static int w8001_connect(struct serio *serio, struct serio_driver *drv) | |||
534 | input_dev->id.version = 0x0100; | 548 | input_dev->id.version = 0x0100; |
535 | input_dev->dev.parent = &serio->dev; | 549 | input_dev->dev.parent = &serio->dev; |
536 | 550 | ||
551 | input_dev->open = w8001_open; | ||
552 | input_dev->close = w8001_close; | ||
553 | |||
554 | input_set_drvdata(input_dev, w8001); | ||
555 | |||
537 | err = input_register_device(w8001->dev); | 556 | err = input_register_device(w8001->dev); |
538 | if (err) | 557 | if (err) |
539 | goto fail3; | 558 | goto fail3; |