Commit b0aba1e6 authored by Samu Onkalo's avatar Samu Onkalo Committed by Dmitry Torokhov

Input: add open and close methods for polled devices

Optional open and close methods for preparing and closing
the device.
Signed-off-by: default avatarSamu Onkalo <samu.p.onkalo@nokia.com>
Signed-off-by: default avatarDmitry Torokhov <dtor@mail.ru>
parent bc09dcad
...@@ -80,8 +80,8 @@ static int input_open_polled_device(struct input_dev *input) ...@@ -80,8 +80,8 @@ static int input_open_polled_device(struct input_dev *input)
if (error) if (error)
return error; return error;
if (dev->flush) if (dev->open)
dev->flush(dev); dev->open(dev);
queue_delayed_work(polldev_wq, &dev->work, queue_delayed_work(polldev_wq, &dev->work,
msecs_to_jiffies(dev->poll_interval)); msecs_to_jiffies(dev->poll_interval));
...@@ -95,6 +95,9 @@ static void input_close_polled_device(struct input_dev *input) ...@@ -95,6 +95,9 @@ static void input_close_polled_device(struct input_dev *input)
cancel_delayed_work_sync(&dev->work); cancel_delayed_work_sync(&dev->work);
input_polldev_stop_workqueue(); input_polldev_stop_workqueue();
if (dev->close)
dev->close(dev);
} }
/** /**
......
...@@ -1263,7 +1263,7 @@ static int __devinit setup_input_dev(void) ...@@ -1263,7 +1263,7 @@ static int __devinit setup_input_dev(void)
if (!wistron_idev) if (!wistron_idev)
return -ENOMEM; return -ENOMEM;
wistron_idev->flush = wistron_flush; wistron_idev->open = wistron_flush;
wistron_idev->poll = wistron_poll; wistron_idev->poll = wistron_poll;
wistron_idev->poll_interval = POLL_INTERVAL_DEFAULT; wistron_idev->poll_interval = POLL_INTERVAL_DEFAULT;
......
...@@ -14,9 +14,11 @@ ...@@ -14,9 +14,11 @@
/** /**
* struct input_polled_dev - simple polled input device * struct input_polled_dev - simple polled input device
* @private: private driver data * @private: private driver data.
* @flush: driver-supplied method that flushes device's state upon * @open: driver-supplied method that prepares device for polling
* opening (optional) * (enabled the device and maybe flushes device state).
* @close: driver-supplied method that is called when device is no
* longer being polled. Used to put device into low power mode.
* @poll: driver-supplied method that polls the device and posts * @poll: driver-supplied method that polls the device and posts
* input events (mandatory). * input events (mandatory).
* @poll_interval: specifies how often the poll() method shoudl be called. * @poll_interval: specifies how often the poll() method shoudl be called.
...@@ -30,7 +32,8 @@ ...@@ -30,7 +32,8 @@
struct input_polled_dev { struct input_polled_dev {
void *private; void *private;
void (*flush)(struct input_polled_dev *dev); void (*open)(struct input_polled_dev *dev);
void (*close)(struct input_polled_dev *dev);
void (*poll)(struct input_polled_dev *dev); void (*poll)(struct input_polled_dev *dev);
unsigned int poll_interval; /* msec */ unsigned int poll_interval; /* msec */
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment