logicpd-pxa270-2.6.17: touchscreen load/unload fix (Shane Volpe)
authorCliff Brake <cbrake@bec-systems.com>
Mon, 13 Nov 2006 19:07:14 +0000 (19:07 +0000)
committerCliff Brake <cbrake@bec-systems.com>
Mon, 13 Nov 2006 19:07:14 +0000 (19:07 +0000)
fix for problem where touch is required to load/unload the driver

packages/linux/logicpd-pxa270-2.6.17-rc5/ucb1400-touchscreen.patch

index d995426..ba04d46 100644 (file)
@@ -375,7 +375,7 @@ Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-ts.c
  
  #include "ucb1x00.h"
  
-@@ -45,7 +43,7 @@ struct ucb1x00_ts {
+@@ -45,13 +43,14 @@ struct ucb1x00_ts {
        struct input_dev        *idev;
        struct ucb1x00          *ucb;
  
@@ -384,7 +384,14 @@ Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-ts.c
        struct task_struct      *rtask;
        u16                     x_res;
        u16                     y_res;
-@@ -205,7 +203,6 @@ static int ucb1x00_thread(void *_ts)
+       unsigned int            restart:1;
+       unsigned int            adcsync:1;
++      unsigned int            go_thread;
+ };
+ static int adcsync;
+@@ -205,7 +204,6 @@ static int ucb1x00_thread(void *_ts)
  {
        struct ucb1x00_ts *ts = _ts;
        struct task_struct *tsk = current;
@@ -392,18 +399,19 @@ Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-ts.c
        int valid;
  
        /*
-@@ -217,10 +214,8 @@ static int ucb1x00_thread(void *_ts)
+@@ -217,10 +215,8 @@ static int ucb1x00_thread(void *_ts)
  
        valid = 0;
  
 -      add_wait_queue(&ts->irq_wait, &wait);
-       while (!kthread_should_stop()) {
+-      while (!kthread_should_stop()) {
++      while (!kthread_should_stop() && ts->go_thread) {
                unsigned int x, y, p;
 -              signed long timeout;
  
                ts->restart = 0;
  
-@@ -242,8 +237,6 @@ static int ucb1x00_thread(void *_ts)
+@@ -242,8 +238,6 @@ static int ucb1x00_thread(void *_ts)
  
  
                if (ucb1x00_ts_pen_down(ts)) {
@@ -412,7 +420,7 @@ Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-ts.c
                        ucb1x00_enable_irq(ts->ucb, UCB_IRQ_TSPX, machine_is_collie() ? UCB_RISING : UCB_FALLING);
                        ucb1x00_disable(ts->ucb);
  
-@@ -256,7 +249,15 @@ static int ucb1x00_thread(void *_ts)
+@@ -256,7 +250,16 @@ static int ucb1x00_thread(void *_ts)
                                valid = 0;
                        }
  
@@ -426,10 +434,11 @@ Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-ts.c
 +                       * the issue.
 +                       */
 +                      wait_for_completion_interruptible(&ts->irq_wait);
++
                } else {
                        ucb1x00_disable(ts->ucb);
  
-@@ -271,16 +272,12 @@ static int ucb1x00_thread(void *_ts)
+@@ -271,16 +274,12 @@ static int ucb1x00_thread(void *_ts)
                        }
  
                        set_task_state(tsk, TASK_INTERRUPTIBLE);
@@ -447,7 +456,7 @@ Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-ts.c
        ts->rtask = NULL;
        return 0;
  }
-@@ -293,7 +290,7 @@ static void ucb1x00_ts_irq(int idx, void
+@@ -293,7 +292,7 @@ static void ucb1x00_ts_irq(int idx, void
  {
        struct ucb1x00_ts *ts = id;
        ucb1x00_disable_irq(ts->ucb, UCB_IRQ_TSPX, UCB_FALLING);
@@ -456,7 +465,7 @@ Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-ts.c
  }
  
  static int ucb1x00_ts_open(struct input_dev *idev)
-@@ -303,7 +300,7 @@ static int ucb1x00_ts_open(struct input_
+@@ -303,7 +302,7 @@ static int ucb1x00_ts_open(struct input_
  
        BUG_ON(ts->rtask);
  
@@ -465,7 +474,31 @@ Index: linux-2.6.17-rc5/drivers/mfd/ucb1x00-ts.c
        ret = ucb1x00_hook_irq(ts->ucb, UCB_IRQ_TSPX, ucb1x00_ts_irq, ts);
        if (ret < 0)
                goto out;
-@@ -358,7 +355,7 @@ static int ucb1x00_ts_resume(struct ucb1
+@@ -318,6 +317,8 @@ static int ucb1x00_ts_open(struct input_
+       ucb1x00_adc_disable(ts->ucb);
+       ts->rtask = kthread_run(ucb1x00_thread, ts, "ktsd");
++      ts->go_thread = 1; //start thread!
++
+       if (!IS_ERR(ts->rtask)) {
+               ret = 0;
+       } else {
+@@ -337,9 +338,14 @@ static void ucb1x00_ts_close(struct inpu
+ {
+       struct ucb1x00_ts *ts = idev->private;
++
++      ts->go_thread = 0; //Stop thread!
++      complete(&ts->irq_wait);
++
+       if (ts->rtask)
+               kthread_stop(ts->rtask);
++
+       ucb1x00_enable(ts->ucb);
+       ucb1x00_free_irq(ts->ucb, UCB_IRQ_TSPX, ts);
+       ucb1x00_reg_write(ts->ucb, UCB_TS_CR, 0);
+@@ -358,7 +364,7 @@ static int ucb1x00_ts_resume(struct ucb1
                 * after sleep.
                 */
                ts->restart = 1;