Revision: 132
          http://svn.sourceforge.net/mactel-linux/?rev=132&view=rev
Author:   nboichat
Date:     2007-06-24 02:03:48 -0700 (Sun, 24 Jun 2007)

Log Message:
-----------
Add 2 patches provided on the lists.

Modified Paths:
--------------
    trunk/kernel/mactel-patches-2.6.22/series

Added Paths:
-----------
    trunk/kernel/mactel-patches-2.6.22/appletouch-fix-run-amok-problem.patch
    
trunk/kernel/mactel-patches-2.6.22/appletouch-shut-up-when-it-has-nothing-to-say.patch

Added: trunk/kernel/mactel-patches-2.6.22/appletouch-fix-run-amok-problem.patch
===================================================================
--- trunk/kernel/mactel-patches-2.6.22/appletouch-fix-run-amok-problem.patch    
                        (rev 0)
+++ trunk/kernel/mactel-patches-2.6.22/appletouch-fix-run-amok-problem.patch    
2007-06-24 09:03:48 UTC (rev 132)
@@ -0,0 +1,32 @@
+The attached patch tries to resolve the 'appletouch runs amok' problem.
+
+From: Soeren Sonnenburg <[EMAIL PROTECTED]>
+
+
+---
+
+ drivers/input/mouse/appletouch.c |   10 +++++++++-
+ 1 files changed, 9 insertions(+), 1 deletions(-)
+
+diff --git a/drivers/input/mouse/appletouch.c 
b/drivers/input/mouse/appletouch.c
+index 724bcd4..6b7aefe 100644
+--- a/drivers/input/mouse/appletouch.c
++++ b/drivers/input/mouse/appletouch.c
+@@ -502,8 +502,16 @@ static void atp_complete(struct urb* urb)
+                  several hundred times a second */
+               if (atp_is_geyser_3(dev)) {
+                       dev->idlecount++;
+-                      if (dev->idlecount == 10)
++                      if (dev->idlecount == 10) {
++                              if (dev->data[dev->datalen-1] != 20) 
++                                      input_report_key(dev->input, BTN_LEFT,
++                                                      
!!dev->data[dev->datalen - 1]);
++
++                              input_sync(dev->input);
+                               schedule_work (&dev->work);
++
++                              goto exit;
++                      }
+               }
+       }
+ 

Added: 
trunk/kernel/mactel-patches-2.6.22/appletouch-shut-up-when-it-has-nothing-to-say.patch
===================================================================
--- 
trunk/kernel/mactel-patches-2.6.22/appletouch-shut-up-when-it-has-nothing-to-say.patch
                              (rev 0)
+++ 
trunk/kernel/mactel-patches-2.6.22/appletouch-shut-up-when-it-has-nothing-to-say.patch
      2007-06-24 09:03:48 UTC (rev 132)
@@ -0,0 +1,153 @@
+The appletouch devices found in the Intel Macs (and possibly some later PPC 
ones?) send a constant stream of packets after the first touch. This results in 
the kernel waking up around once every couple of milliseconds to process them, 
making it almost impossible to spend any significant period of time in C3 state 
on a dynamic HZ kernel. Sending the mode initialisation code makes the device 
shut up until it's touched again. This patch does so after receiving 10 packets 
with no interesting content.
+
+From: Matthew Garrett <[EMAIL PROTECTED]>
+
+
+---
+
+ drivers/input/mouse/appletouch.c |   93 ++++++++++++++++++++++++++------------
+ 1 files changed, 63 insertions(+), 30 deletions(-)
+
+diff --git a/drivers/input/mouse/appletouch.c 
b/drivers/input/mouse/appletouch.c
+index c26af96..724bcd4 100644
+--- a/drivers/input/mouse/appletouch.c
++++ b/drivers/input/mouse/appletouch.c
+@@ -155,6 +155,8 @@ struct atp {
+       int                     xy_acc[ATP_XSENSORS + ATP_YSENSORS];
+       int                     overflowwarn;   /* overflow warning printed? */
+       int                     datalen;        /* size of an USB urb transfer 
*/
++      int                     idlecount;      /* number of empty packets */
++      struct work_struct      work;
+ };
+ 
+ #define dbg_dump(msg, tab) \
+@@ -208,6 +210,51 @@ static inline int atp_is_geyser_3(struct atp *dev)
+               (productId == GEYSER4_JIS_PRODUCT_ID);
+ }
+ 
++static int atp_geyser3_init(struct usb_device *udev)
++{
++      char data[8];
++      int size;
++
++      size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
++                             ATP_GEYSER3_MODE_READ_REQUEST_ID,
++                             USB_DIR_IN | USB_TYPE_CLASS | 
USB_RECIP_INTERFACE,
++                             ATP_GEYSER3_MODE_REQUEST_VALUE,
++                             ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
++  
++      if (size != 8) {
++              err("Could not do mode read request from device"
++                  " (Geyser 3 mode)");
++              return -EIO;
++      }
++
++      /* Apply the mode switch */
++      data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE;
++  
++      size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
++                             ATP_GEYSER3_MODE_WRITE_REQUEST_ID,
++                             USB_DIR_OUT | USB_TYPE_CLASS | 
++                             USB_RECIP_INTERFACE,
++                             ATP_GEYSER3_MODE_REQUEST_VALUE,
++                             ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
++      
++      if (size != 8) {
++              err("Could not do mode write request to device"
++                  " (Geyser 3 mode)");
++              return -EIO;
++      }
++      return 0;
++}
++
++/* Reinitialise the device if it's a geyser 3 */
++static void atp_reinit(struct work_struct *work)
++{
++      struct atp *dev = container_of(work, struct atp, work);
++      struct usb_device *udev = dev->udev;
++
++      dev->idlecount = 0;
++      atp_geyser3_init(udev);
++}
++
+ static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
+                            int *z, int *fingers)
+ {
+@@ -441,7 +488,6 @@ static void atp_complete(struct urb* urb)
+               dev->y_old = y;
+       }
+       else if (!x && !y) {
+-
+               dev->x_old = dev->y_old = -1;
+               input_report_key(dev->input, BTN_TOUCH, 0);
+               input_report_abs(dev->input, ABS_PRESSURE, 0);
+@@ -449,10 +495,21 @@ static void atp_complete(struct urb* urb)
+ 
+               /* reset the accumulator on release */
+               memset(dev->xy_acc, 0, sizeof(dev->xy_acc));
++
++              /* Geyser 3 will continue to send packets continually after
++                 the first touch unless reinitialised. Do so if it's been
++                 idle for a while in order to avoid waking the kernel up
++                 several hundred times a second */
++              if (atp_is_geyser_3(dev)) {
++                      dev->idlecount++;
++                      if (dev->idlecount == 10)
++                              schedule_work (&dev->work);
++              }
+       }
+ 
+-      input_report_key(dev->input, BTN_LEFT,
+-                       !!dev->data[dev->datalen - 1]);
++      if (dev->data[dev->datalen-1] != 20) 
++              input_report_key(dev->input, BTN_LEFT,
++                               !!dev->data[dev->datalen - 1]);
+ 
+       input_sync(dev->input);
+ 
+@@ -533,35 +590,9 @@ static int atp_probe(struct usb_interface *iface, const 
struct usb_device_id *id
+                * packets (Report ID 2). This code changes device mode, so it
+                * sends raw sensor reports (Report ID 5).
+                */
+-              char data[8];
+-              int size;
+-
+-              size = usb_control_msg(udev, usb_rcvctrlpipe(udev, 0),
+-                      ATP_GEYSER3_MODE_READ_REQUEST_ID,
+-                      USB_DIR_IN | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+-                      ATP_GEYSER3_MODE_REQUEST_VALUE,
+-                      ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
+-
+-              if (size != 8) {
+-                      err("Could not do mode read request from device"
+-                                                      " (Geyser 3 mode)");
++              if (atp_geyser3_init(udev))
+                       goto err_free_devs;
+-              }
+ 
+-              /* Apply the mode switch */
+-              data[0] = ATP_GEYSER3_MODE_VENDOR_VALUE;
+-
+-              size = usb_control_msg(udev, usb_sndctrlpipe(udev, 0),
+-                      ATP_GEYSER3_MODE_WRITE_REQUEST_ID,
+-                      USB_DIR_OUT | USB_TYPE_CLASS | USB_RECIP_INTERFACE,
+-                      ATP_GEYSER3_MODE_REQUEST_VALUE,
+-                      ATP_GEYSER3_MODE_REQUEST_INDEX, &data, 8, 5000);
+-
+-              if (size != 8) {
+-                      err("Could not do mode write request to device"
+-                                                      " (Geyser 3 mode)");
+-                      goto err_free_devs;
+-              }
+               printk("appletouch Geyser 3 inited.\n");
+       }
+ 
+@@ -636,6 +667,8 @@ static int atp_probe(struct usb_interface *iface, const 
struct usb_device_id *id
+       /* save our data pointer in this interface device */
+       usb_set_intfdata(iface, dev);
+ 
++        INIT_WORK(&dev->work, atp_reinit);
++
+       return 0;
+ 
+  err_free_buffer:

Modified: trunk/kernel/mactel-patches-2.6.22/series
===================================================================
--- trunk/kernel/mactel-patches-2.6.22/series   2007-06-19 17:59:55 UTC (rev 
131)
+++ trunk/kernel/mactel-patches-2.6.22/series   2007-06-24 09:03:48 UTC (rev 
132)
@@ -1,7 +1,9 @@
-# This series applies on GIT commit de7f928ca460005086a8296be07c217aac4b625d
+# This series applies on GIT commit 75154f402ef18e459ff97ddece25656b6c2b329c
 sigmatel_audio2.patch
 sigmatel_audio3.patch
 applesmc_int.patch
 appletouch.patch
 appleir.patch
 applesmc-use-input-polldev.patch
+appletouch-shut-up-when-it-has-nothing-to-say.patch
+appletouch-fix-run-amok-problem.patch


This was sent by the SourceForge.net collaborative development platform, the 
world's largest Open Source development site.

-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
_______________________________________________
Mactel-linux-devel mailing list
Mactel-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/mactel-linux-devel

Reply via email to