aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/mfd/ucb1x00-ts.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/mfd/ucb1x00-ts.c')
-rw-r--r--drivers/mfd/ucb1x00-ts.c34
1 files changed, 6 insertions, 28 deletions
diff --git a/drivers/mfd/ucb1x00-ts.c b/drivers/mfd/ucb1x00-ts.c
index 40ec3c118868..63a3cbdfa3f3 100644
--- a/drivers/mfd/ucb1x00-ts.c
+++ b/drivers/mfd/ucb1x00-ts.c
@@ -47,7 +47,6 @@ struct ucb1x00_ts {
47 u16 x_res; 47 u16 x_res;
48 u16 y_res; 48 u16 y_res;
49 49
50 unsigned int restart:1;
51 unsigned int adcsync:1; 50 unsigned int adcsync:1;
52}; 51};
53 52
@@ -207,15 +206,17 @@ static int ucb1x00_thread(void *_ts)
207{ 206{
208 struct ucb1x00_ts *ts = _ts; 207 struct ucb1x00_ts *ts = _ts;
209 DECLARE_WAITQUEUE(wait, current); 208 DECLARE_WAITQUEUE(wait, current);
209 bool frozen, ignore = false;
210 int valid = 0; 210 int valid = 0;
211 211
212 set_freezable(); 212 set_freezable();
213 add_wait_queue(&ts->irq_wait, &wait); 213 add_wait_queue(&ts->irq_wait, &wait);
214 while (!kthread_should_stop()) { 214 while (!kthread_freezable_should_stop(&frozen)) {
215 unsigned int x, y, p; 215 unsigned int x, y, p;
216 signed long timeout; 216 signed long timeout;
217 217
218 ts->restart = 0; 218 if (frozen)
219 ignore = true;
219 220
220 ucb1x00_adc_enable(ts->ucb); 221 ucb1x00_adc_enable(ts->ucb);
221 222
@@ -258,7 +259,7 @@ static int ucb1x00_thread(void *_ts)
258 * space. We therefore leave it to user space 259 * space. We therefore leave it to user space
259 * to do any filtering they please. 260 * to do any filtering they please.
260 */ 261 */
261 if (!ts->restart) { 262 if (!ignore) {
262 ucb1x00_ts_evt_add(ts, p, x, y); 263 ucb1x00_ts_evt_add(ts, p, x, y);
263 valid = 1; 264 valid = 1;
264 } 265 }
@@ -267,8 +268,6 @@ static int ucb1x00_thread(void *_ts)
267 timeout = HZ / 100; 268 timeout = HZ / 100;
268 } 269 }
269 270
270 try_to_freeze();
271
272 schedule_timeout(timeout); 271 schedule_timeout(timeout);
273 } 272 }
274 273
@@ -340,26 +339,6 @@ static void ucb1x00_ts_close(struct input_dev *idev)
340 ucb1x00_disable(ts->ucb); 339 ucb1x00_disable(ts->ucb);
341} 340}
342 341
343#ifdef CONFIG_PM
344static int ucb1x00_ts_resume(struct ucb1x00_dev *dev)
345{
346 struct ucb1x00_ts *ts = dev->priv;
347
348 if (ts->rtask != NULL) {
349 /*
350 * Restart the TS thread to ensure the
351 * TS interrupt mode is set up again
352 * after sleep.
353 */
354 ts->restart = 1;
355 wake_up(&ts->irq_wait);
356 }
357 return 0;
358}
359#else
360#define ucb1x00_ts_resume NULL
361#endif
362
363 342
364/* 343/*
365 * Initialisation. 344 * Initialisation.
@@ -382,7 +361,7 @@ static int ucb1x00_ts_add(struct ucb1x00_dev *dev)
382 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC; 361 ts->adcsync = adcsync ? UCB_SYNC : UCB_NOSYNC;
383 362
384 idev->name = "Touchscreen panel"; 363 idev->name = "Touchscreen panel";
385 idev->id.product = ts->ucb->id->driver_data; 364 idev->id.product = ts->ucb->id;
386 idev->open = ucb1x00_ts_open; 365 idev->open = ucb1x00_ts_open;
387 idev->close = ucb1x00_ts_close; 366 idev->close = ucb1x00_ts_close;
388 367
@@ -425,7 +404,6 @@ static void ucb1x00_ts_remove(struct ucb1x00_dev *dev)
425static struct ucb1x00_driver ucb1x00_ts_driver = { 404static struct ucb1x00_driver ucb1x00_ts_driver = {
426 .add = ucb1x00_ts_add, 405 .add = ucb1x00_ts_add,
427 .remove = ucb1x00_ts_remove, 406 .remove = ucb1x00_ts_remove,
428 .resume = ucb1x00_ts_resume,
429}; 407};
430 408
431static int __init ucb1x00_ts_init(void) 409static int __init ucb1x00_ts_init(void)