<?xml version="1.0" encoding="UTF-8"?>
<rdf:RDF xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns="http://purl.org/rss/1.0/" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:syn="http://purl.org/rss/1.0/modules/syndication/" xmlns:admin="http://webns.net/mvcb/">
  <channel rdf:about="http://blog.gmane.org/gmane.linux.kernel.input">
    <title>gmane.linux.kernel.input</title>
    <link>http://blog.gmane.org/gmane.linux.kernel.input</link>
    <description/>
    <syn:updatePeriod>hourly</syn:updatePeriod>
    <syn:updateFrequency>1</syn:updateFrequency>
    <syn:updateBase>1901-01-01T00:00+00:00</syn:updateBase>
    <items>
      <rdf:Seq>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5584"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5581"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5580"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5579"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5578"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5565"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5557"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5554"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5543"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5540"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5539"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5538"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5528"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5527"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5523"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5521"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5517"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5516"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5515"/>
        <rdf:li rdf:resource="http://comments.gmane.org/gmane.linux.kernel.input/5514"/>
      </rdf:Seq>
    </items>
    <image rdf:resource="http://gmane.org/img/gmane-25t.png"/>
    <textinput rdf:resource=""/>
  </channel>
  <image rdf:about="http://gmane.org/img/gmane-25t.png">
    <title>Gmane</title>
    <url>http://gmane.org/img/gmane-25t.png</url>
    <link>http://gmane.org</link>
  </image>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5584">
    <title>n-trig tablet driver</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5584</link>
    <description>﻿Hello,
  I'm an owner of a Dell Latitude XT with n-trig duosense tablet,
Is there anyone working on this driver?
Is this device in some way similar to a wacom tablet?


Andrea


--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>etjazz</dc:creator>
    <dc:date>2008-08-21T07:12:07</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5581">
    <title>[patch 2/4] Elantech touchpad driver</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5581</link>
    <description>From: Arjan Opmeer &lt;arjan&lt; at &gt;opmeer.net&gt;

- needs a changelog

- needs a signed-off-by:

Cc: Dmitry Torokhov &lt;dtor&lt; at &gt;mail.ru&gt;
Cc: Jiri Kosina &lt;jkosina&lt; at &gt;suse.cz&gt;
Signed-off-by: Andrew Morton &lt;akpm&lt; at &gt;linux-foundation.org&gt;
---

 Documentation/input/elantech.txt   |  172 +++++++++
 drivers/input/mouse/Kconfig        |   15 
 drivers/input/mouse/Makefile       |    1 
 drivers/input/mouse/elantech.c     |  485 +++++++++++++++++++++++++++
 drivers/input/mouse/elantech.h     |   82 ++++
 drivers/input/mouse/psmouse-base.c |   17 
 drivers/input/mouse/psmouse.h      |    1 
 7 files changed, 773 insertions(+)

diff -puN /dev/null Documentation/input/elantech.txt
--- /dev/null
+++ a/Documentation/input/elantech.txt
&lt; at &gt;&lt; at &gt; -0,0 +1,172 &lt; at &gt;&lt; at &gt;
+Elantech Touchpad Driver
+========================
+        Copyright (C) 2007 Arjan Opmeer &lt;arjan&lt; at &gt;opmeer.net&gt;
+
+        Extra information found and provided by Steve Havelka
+
+Configuration of the touchpad is performed by writing values to registers
+found under sysfs entries /sys/bus/serio/drivers/psmouse/serio?/reg_*.
+
+E.g. to disable tapping while leaving the other settings to the default
+Windows driver value one would:
+
+   echo -n 0x32 &gt; reg_10
+
+
+Registers
+~~~~~~~~~
+
+* reg_10        (Windows driver default value 0x12)
+
+   bit   7   6   5   4   3   2   1   0
+         B   C   T   D   L   A   S   E
+
+         E: 1 = enable smart edges in other cases
+         S: 1 = enable smart edges only when dragging
+         A: 1 = absolute mode (needs 4 byte packets, see reg_11)
+         L: 1 = enable drag lock (see reg_22)
+         D: 1 = disable dynamic resolution
+         T: 1 = disable tapping
+         C: 1 = enable corner tap
+         B: 1 = swap left and right button
+
+* reg_11        (Windows driver default value 0x8f)
+
+   bit   7   6   5   4   3   2   1   0
+         1   0   0   H   V   1   F   P
+
+         P: 1 = enable parity checking for relative mode
+         F: 1 = enable native 4 byte packet mode
+         V: 1 = enable vertical scroll area
+         H: 1 = enable horizonal scroll area
+
+
+* reg_20        (Windows driver default value 0x0a)
+
+         single finger width?
+
+* reg_21        (Windows driver default value 0x60)
+
+         scroll area width (small: 0x40 ... wide: 0xff)
+
+* reg_22        (Windows driver default value 0xff)
+
+         drag lock time out (short: 0x14 ... long: 0xfe; 0xff =never)
+
+* reg_23        (Windows driver default value 0x10)
+
+         tap make timeout?
+
+         Note: the Windows driver does not write this register
+
+* reg_24        (Windows driver default value 0x10)
+
+         tap release timeout?
+
+         Note: the Windows driver does not write this register
+
+* reg_25        (Windows driver default value 0x03)
+
+         smart edge cursor speed (0x02 = slow, 0x03 = medium, 0x04 = fast)
+
+* reg_26        (Windows driver default value 0x00 ?? )
+
+         smart edge activation area width?
+
+         Note: the Windows driver does not write this register
+         Note: the Windows driver default value of 0x00 disables smart edges
+               when it would get written
+         Note: the Windows driver sets bit 0 of the registry value to disable
+               tapping when typing, but never actually writes the register.
+               Only used as an internal driver flag?
+
+
+
+Initially the Elantouch Touchpad is in emulation mode and reports 3 byte
+standard PS/2 packets and hence works with a standard mouse driver.
+However, it can be configured to talk its native 4 byte relative mode and 4
+byte absolute mode both for which a dedicated driver is needed.
+
+
+Native 4 byte relative mode packet format
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+byte 0:
+   bit   7   6   5   4   3   2   1   0
+         c   c  p2  p1   1   M   R   L
+
+         L, R, M = 1 when Left, Right, Middle mouse button pressed
+            some models have M as byte 3 odd parity
+         when parity checking is enabled (P = 1):
+            p1 = byte 1 odd parity
+            p2 = byte 2 odd parity
+         c = 1 when corner tap detected
+
+byte 1:
+   bit   7   6   5   4   3   2   1   0
+        dx7 dx6 dx5 dx4 dx3 dx2 dx1 dx0
+
+         dx7..dx0 = x movement;   positive = right, negative = left
+         byte 1 = 0xf0 when corner tap detected
+
+byte 2:
+   bit   7   6   5   4   3   2   1   0
+        dy7 dy6 dy5 dy4 dy3 dy2 dy1 dy0
+
+         dy7..dy0 = y movement;   positive = up,    negative = down
+
+byte 3:
+   bit   7   6   5   4   3   2   1   0
+         w   h  n1  n0  d3  d2  d1  d0
+
+         when parity checking is enabled (P = 1):
+            normally:
+               d3..d0 = scroll wheel amount and direction
+                        positive = down or left
+                        negative = up or right
+            when corner tap detected:
+               d0 = 1 when top right corner tapped
+               d1 = 1 when bottom right corner tapped
+               d2 = 1 when bottom left corner tapped
+               d3 = 1 when top left corner tapped
+            n1..n0 = number of fingers on touchpad
+               not all models report this but map one, two and three
+               finger taps directly to L, M and R mouse buttons
+            w = 1 when wide finger touch?
+            h = 1 when horizontal scroll action
+         otherwise (P = 0):
+            all of byte 3 is vertical scroll amount and direction
+            negative = up
+            positive = down
+
+
+Native 4 byte absolute mode packet format
+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+
+byte 0:
+   bit   7   6   5   4   3   2   1   0
+         D   U  p1  p2   1  p3   R   L
+
+         L, R = 1 when Left, Right mouse button pressed
+         p1..p3 = parity bit of bytes 1..3
+         D, U = 1 when rocker switch pressed Up, Down
+
+byte 1:
+   bit   7   6   5   4   3   2   1   0
+         f   0  th  tw  x9  x8  y9  y8
+
+         tw = 1 when two finger touch
+         th = 1 when three finger touch
+         f  = 1 when finger touch
+
+byte 2:
+   bit   7   6   5   4   3   2   1   0
+        x7  x6  x5  x4  x3  x2  x1  x0
+
+         x9..x0 = absolute x value (horizontal)
+
+byte 3:
+   bit   7   6   5   4   3   2   1   0
+        y7  y6  y5  y4  y3  y2  y1  y0
+
+         y9..y0 = absolute y value (vertical)
diff -puN drivers/input/mouse/Kconfig~elantech-touchpad-driver drivers/input/mouse/Kconfig
--- a/drivers/input/mouse/Kconfig~elantech-touchpad-driver
+++ a/drivers/input/mouse/Kconfig
&lt; at &gt;&lt; at &gt; -96,6 +96,21 &lt; at &gt;&lt; at &gt; config MOUSE_PS2_TOUCHKIT
 
   If unsure, say N.
 
+config MOUSE_PS2_ELANTECH
+bool "Elantech PS/2 protocol extension"
+depends on MOUSE_PS2
+help
+  Say Y here if you have an Elantech PS/2 touchpad connected
+  to your system.
+
+  If unsure, say N.
+
+  This driver exposes some configuration registers via sysfs
+  entries.
+
+  For further information, see
+  &lt;file:Documentation/input/elantech.txt&gt;.
+
 config MOUSE_SERIAL
 tristate "Serial mouse"
 select SERIO
diff -puN drivers/input/mouse/Makefile~elantech-touchpad-driver drivers/input/mouse/Makefile
--- a/drivers/input/mouse/Makefile~elantech-touchpad-driver
+++ a/drivers/input/mouse/Makefile
&lt; at &gt;&lt; at &gt; -25,3 +25,4 &lt; at &gt;&lt; at &gt; psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP)+=
 psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK)+= lifebook.o
 psmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT)+= trackpoint.o
 psmouse-$(CONFIG_MOUSE_PS2_TOUCHKIT)+= touchkit_ps2.o
+psmouse-$(CONFIG_MOUSE_PS2_ELANTECH)+= elantech.o
diff -puN /dev/null drivers/input/mouse/elantech.c
--- /dev/null
+++ a/drivers/input/mouse/elantech.c
&lt; at &gt;&lt; at &gt; -0,0 +1,485 &lt; at &gt;&lt; at &gt;
+/*
+ * Elantech Touchpad driver
+ *
+ * Copyright (C) 2007 Arjan Opmeer &lt;arjan&lt; at &gt;opmeer.net&gt;
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Trademarks are the property of their respective owners.
+ */
+
+#include &lt;linux/module.h&gt;
+#include &lt;linux/input.h&gt;
+#include &lt;linux/serio.h&gt;
+#include &lt;linux/libps2.h&gt;
+#include "psmouse.h"
+#include "synaptics.h"
+#include "elantech.h"
+
+/*
+ * Native absolute mode reporting has odd parity check on the last 3 bytes.
+ * Native relative mode can have odd parity checking on second and third byte,
+ * or last 3 bytes depending on model.
+ */
+static unsigned char parity[256];
+
+/*
+ * Send a synaptics style special commands
+ */
+static int synaptics_send_cmd(struct psmouse *psmouse, unsigned char c, unsigned char *param)
+{
+if (psmouse_sliced_command(psmouse, c))
+return -1;
+if (ps2_command(&amp;psmouse-&gt;ps2dev, param, PSMOUSE_CMD_GETINFO))
+return -1;
+return 0;
+}
+
+/*
+ * Send an Elantech style special command to write a register with a value
+ */
+static int elantech_write_reg(struct psmouse *psmouse, unsigned char reg, unsigned char val)
+{
+if ((reg &lt; 0x10) || (reg &gt; 0x26))
+return -1;
+if ((reg &gt; 0x11) &amp;&amp; (reg &lt; 0x20))
+return -1;
+
+if (psmouse_sliced_command(psmouse, ELANTECH_COMMAND_START) ||
+    psmouse_sliced_command(psmouse, reg) ||
+    psmouse_sliced_command(psmouse, val) ||
+    ps2_command(&amp;psmouse-&gt;ps2dev, NULL, PSMOUSE_CMD_SETSCALE11)) {
+return -1;
+}
+
+return 0;
+}
+
+static void elantech_packet_dump(unsigned char *packet, int size)
+{
+inti;
+
+printk(KERN_DEBUG "elantech.c: PS/2 packet [");
+for (i = 0; i &lt; size; i++)
+printk("%s0x%02x ", (i) ? ", " : " ", packet[i]);
+printk("]\n");
+}
+
+/*
+ * Report absolute mode input events
+ */
+static void elantech_report_absolute(struct psmouse *psmouse)
+{
+struct elantech_data *etd = psmouse-&gt;private;
+struct input_dev *dev = psmouse-&gt;dev;
+unsigned char *packet = psmouse-&gt;packet;
+intfingers;
+
+/* byte 0:  D   U  p1  p2   1  p3   R   L
+ * byte 1:  f   0  th  tw  x9  x8  y9  y8
+ * byte 2: x7  x6  x5  x4  x3  x2  x1  x0
+ * byte 3: y7  y6  y5  y4  y3  y2  y1  y0 */
+fingers = ((packet[1] &amp; 0x80) &gt;&gt; 7) + ((packet[1] &amp; 0x30) &gt;&gt; 4);
+input_report_key(dev, BTN_TOUCH, fingers != 0);
+if (fingers == 1) {
+input_report_abs(dev, ABS_X,
+((packet[1] &amp; 0x0c) &lt;&lt; 6) | packet[2]);
+input_report_abs(dev, ABS_Y, ETP_YMAX -
+(((packet[1] &amp; 0x03) &lt;&lt; 8) | packet[3]));
+}
+input_report_abs(dev, ABS_PRESSURE, (fingers) ? ETP_DEF_PRESSURE : 0);
+input_report_key(dev, BTN_TOOL_FINGER, fingers == 1);
+input_report_key(dev, BTN_TOOL_DOUBLETAP, fingers == 2);
+input_report_key(dev, BTN_TOOL_TRIPLETAP, fingers == 3);
+input_report_key(dev, BTN_LEFT, packet[0] &amp; 0x01);
+input_report_key(dev, BTN_RIGHT, packet[0] &amp; 0x02);
+if (etd-&gt;capabilities &amp; ETP_CAP_HAS_ROCKER) {
+input_report_key(dev, BTN_FORWARD, packet[0] &amp; 0x40); /* rocker up */
+input_report_key(dev, BTN_BACK, packet[0] &amp; 0x80); /* rocker down */
+}
+}
+
+/*
+ * Report relative mode input events
+ */
+static void elantech_report_relative(struct psmouse *psmouse)
+{
+struct elantech_data *etd = psmouse-&gt;private;
+struct input_dev *dev = psmouse-&gt;dev;
+unsigned char *packet = psmouse-&gt;packet;
+int fingers, cornertap;
+
+/* byte 0:  c   c  p2  p1   1   M   R   L
+ * byte 1: dx7 dx6 dx5 dx4 dx3 dx2 dx1 dx0
+ * byte 2: dy7 dy6 dy5 dy4 dy3 dy2 dy1 dy0
+ * byte 3:  w   h  n1  n0  d3  d2  d1  d0 */
+input_report_key(dev, BTN_LEFT, packet[0] &amp; 0x01);
+input_report_key(dev, BTN_RIGHT, packet[0] &amp; 0x02);
+
+if (etd-&gt;capabilities &amp; ETP_CAP_REPORTS_MIDDLE_BUTTON)
+input_report_key(dev, BTN_MIDDLE, packet[0] &amp; 0x04);
+
+if (etd-&gt;capabilities &amp; ETP_CAP_ALTERNATE_TAP_BITS) {
+fingers = (packet[3] &amp; 0x30) &gt;&gt; 4;
+input_report_key(dev, BTN_LEFT, fingers == 1);
+input_report_key(dev, BTN_MIDDLE, fingers == 2);
+input_report_key(dev, BTN_RIGHT, fingers == 3);
+}
+
+cornertap = (((packet[0] &amp; 0xc0) == 0xc0) &amp;&amp; ((packet[1] &amp; 0xf0) == 0xf0));
+if (!cornertap) {
+input_report_rel(dev, REL_X, (int) (packet[1] &amp; 0x7f) -
+     (int) (packet[1] &amp; 0x80));
+input_report_rel(dev, REL_Y, (int) (packet[2] &amp; 0x80) -
+     (int) (packet[2] &amp; 0x7f));
+}
+
+/* No more information in 3 bytes */
+if (!(etd-&gt;reg_11 &amp; ETP_R11_4_BYTE_MODE))
+return;
+
+if (cornertap) {
+input_report_key(dev, BTN_0, packet[3] &amp; 0x01);/* top right */
+input_report_key(dev, BTN_1, packet[3] &amp; 0x02);/* bottom right */
+input_report_key(dev, BTN_2, packet[3] &amp; 0x04);/* bottom left */
+input_report_key(dev, BTN_3, packet[3] &amp; 0x08);/* top left */
+}
+
+if (etd-&gt;reg_11 &amp; ETP_R11_PARITY_CHECKING) {
+if (packet[3] &amp; 0x0f) {
+if (packet[3] &amp; 0x40) {
+input_report_rel(dev, REL_HWHEEL,
+(int) (packet[3] &amp; 0x08) -
+(int) (packet[3] &amp; 0x07));
+} else {
+input_report_rel(dev, REL_WHEEL,
+(int) (packet[3] &amp; 0x08) -
+(int) (packet[3] &amp; 0x07));
+}
+}
+} else {
+if (packet[3])
+input_report_rel(dev, REL_WHEEL,
+(int) (packet[3] &amp; 0x80) -
+(int) (packet[3] &amp; 0x7f));
+}
+}
+
+/*
+ * Process byte stream from mouse and interpret complete data packets
+ */
+static psmouse_ret_t elantech_process_byte(struct psmouse *psmouse)
+{
+struct elantech_data *etd = psmouse-&gt;private;
+struct input_dev *dev = psmouse-&gt;dev;
+unsigned char *packet = psmouse-&gt;packet;
+
+if (psmouse-&gt;pktcnt &lt; psmouse-&gt;pktsize)
+return PSMOUSE_GOOD_DATA;
+
+if (etd-&gt;debug)
+elantech_packet_dump(packet, psmouse-&gt;pktsize);
+
+if (etd-&gt;reg_10 &amp; ETP_R10_ABSOLUTE_MODE) {
+/* byte 0:  D   U  p1  p2   1  p3   R   L */
+if ((parity[packet[1]] != ((packet[0] &amp; 0x20) &gt;&gt; 5)) ||
+    (parity[packet[2]] != ((packet[0] &amp; 0x10) &gt;&gt; 4)) ||
+    (parity[packet[3]] != ((packet[0] &amp; 0x04) &gt;&gt; 2)))
+return PSMOUSE_BAD_DATA;
+} else if (etd-&gt;reg_11 &amp; ETP_R11_PARITY_CHECKING) {
+/* byte 0:  c   c  p2  p1   1   M   R   L */
+if ((parity[packet[1]] != ((packet[0] &amp; 0x10) &gt;&gt; 4)) ||
+    (parity[packet[2]] != ((packet[0] &amp; 0x20) &gt;&gt; 5)))
+return PSMOUSE_BAD_DATA;
+/* Parity bit has not been sacrificed as middle mouse button bit */
+if (!(etd-&gt;capabilities &amp; ETP_CAP_REPORTS_MIDDLE_BUTTON)) {
+if (parity[packet[3]] != ((packet[0] &amp; 0x04) &gt;&gt; 2))
+return PSMOUSE_BAD_DATA;
+}
+}
+
+if (etd-&gt;reg_10 &amp; ETP_R10_ABSOLUTE_MODE) {
+elantech_report_absolute(psmouse);
+} else {
+elantech_report_relative(psmouse);
+}
+
+input_sync(dev);
+
+return PSMOUSE_FULL_PACKET;
+}
+
+/*
+ * Initialise the touchpad to a default state. Because we don't know (yet)
+ * how to read registers we need to write some default values so we can
+ * report their contents when asked to.
+ */
+static void elantech_set_defaults(struct psmouse *psmouse)
+{
+struct elantech_data *etd = psmouse-&gt;private;
+struct input_dev *dev = psmouse-&gt;dev;
+
+/*
+ * For now, use the Elantech Windows driver default values
+ */
+etd-&gt;reg_10 = 0x12;
+elantech_write_reg(psmouse, 0x10, etd-&gt;reg_10);
+etd-&gt;reg_11 = 0x8f;
+elantech_write_reg(psmouse, 0x11, etd-&gt;reg_11);
+etd-&gt;reg_20 = 0x0a;
+elantech_write_reg(psmouse, 0x20, etd-&gt;reg_20);
+etd-&gt;reg_21 = 0x60;
+elantech_write_reg(psmouse, 0x21, etd-&gt;reg_21);
+etd-&gt;reg_22 = 0xff;
+elantech_write_reg(psmouse, 0x22, etd-&gt;reg_22);
+/*
+ * However, the Windows driver mentions registers 23, 24 and 26
+ * but seems to never actually write them
+ */
+etd-&gt;reg_23 = 0x10;
+/*
+ * elantech_write_reg(psmouse, 0x23, etd-&gt;reg_23);
+ */
+etd-&gt;reg_24 = 0x10;
+/*
+ * elantech_write_reg(psmouse, 0x24, etd-&gt;reg_24);
+ */
+etd-&gt;reg_25 = 0x03;
+elantech_write_reg(psmouse, 0x25, etd-&gt;reg_25);
+/*
+ * The Windows driver default value of 0x00 seems wrong as it
+ * disables smart edge cursor movement
+ */
+etd-&gt;reg_26 = 0x00;
+/*
+ * elantech_write_reg(psmouse, 0x26, etd-&gt;reg_26);
+ */
+
+set_bit(EV_KEY, dev-&gt;evbit);
+set_bit(BTN_LEFT, dev-&gt;keybit);
+set_bit(BTN_MIDDLE, dev-&gt;keybit);
+set_bit(BTN_RIGHT, dev-&gt;keybit);
+
+set_bit(BTN_TOUCH, dev-&gt;keybit);
+set_bit(BTN_TOOL_FINGER, dev-&gt;keybit);
+set_bit(BTN_TOOL_DOUBLETAP, dev-&gt;keybit);
+set_bit(BTN_TOOL_TRIPLETAP, dev-&gt;keybit);
+
+/* Rocker button */
+if (etd-&gt;capabilities &amp; ETP_CAP_HAS_ROCKER) {
+set_bit(BTN_FORWARD, dev-&gt;keybit);
+set_bit(BTN_BACK, dev-&gt;keybit);
+}
+
+/* Corner taps */
+set_bit(BTN_0, dev-&gt;keybit);
+set_bit(BTN_1, dev-&gt;keybit);
+set_bit(BTN_2, dev-&gt;keybit);
+set_bit(BTN_3, dev-&gt;keybit);
+
+set_bit(EV_REL, dev-&gt;evbit);
+set_bit(REL_X, dev-&gt;relbit);
+set_bit(REL_Y, dev-&gt;relbit);
+set_bit(REL_WHEEL, dev-&gt;relbit);
+set_bit(REL_HWHEEL, dev-&gt;relbit);
+
+set_bit(EV_ABS, dev-&gt;evbit);
+input_set_abs_params(dev, ABS_X, ETP_XMIN, ETP_XMAX, 0, 0);
+input_set_abs_params(dev, ABS_Y, ETP_YMIN, ETP_YMAX, 0, 0);
+input_set_abs_params(dev, ABS_PRESSURE, 0, ETP_MAX_PRESSURE, 0, 0);
+}
+
+struct elantech_attr_data {
+size_tfield_offset;
+unsigned charreg;
+};
+
+/*
+ * Display a register value by reading a sysfs entry
+ */
+static ssize_t elantech_show_int_attr(struct psmouse *psmouse, void *data, char *buf)
+{
+struct elantech_data*etd = psmouse-&gt;private;
+struct elantech_attr_data*attr = data;
+unsigned char*reg = (unsigned char *)
+etd + attr-&gt;field_offset;
+
+return sprintf(buf, "0x%02x\n", *reg);
+}
+
+/*
+ * Write a register value by writing a sysfs entry
+ */
+static ssize_t elantech_set_int_attr(struct psmouse *psmouse, void *data,
+const char *buf, size_t count)
+{
+struct elantech_data *etd = psmouse-&gt;private;
+struct elantech_attr_data *attr = data;
+unsigned char *reg = (unsigned char *)
+etd + attr-&gt;field_offset;
+unsigned longvalue;
+char*rest;
+
+value = simple_strtoul(buf, &amp;rest, 16);
+if (*rest || value &gt; 255)
+return -EINVAL;
+
+if (attr-&gt;reg == 0x10) {
+/* Force on 4 byte mode when absolute mode gets selected */
+if ((value &amp; ETP_R10_ABSOLUTE_MODE) &amp;&amp;
+   !(etd-&gt;reg_11 &amp; ETP_R11_4_BYTE_MODE)) {
+etd-&gt;reg_11 |= ETP_R11_4_BYTE_MODE;
+elantech_write_reg(psmouse, 0x11, etd-&gt;reg_11);
+psmouse-&gt;pktsize = 4;
+}
+} else if (attr-&gt;reg == 0x11) {
+if (value &amp; ETP_R11_4_BYTE_MODE)
+psmouse-&gt;pktsize = 4;
+else {
+/* Force off absolute mode when 4 byte mode is no longer selected */
+if (etd-&gt;reg_10 &amp; ETP_R10_ABSOLUTE_MODE) {
+etd-&gt;reg_10 ^= ETP_R10_ABSOLUTE_MODE;
+elantech_write_reg(psmouse, 0x10, etd-&gt;reg_10);
+}
+psmouse-&gt;pktsize = 3;
+}
+}
+
+*reg = value;
+elantech_write_reg(psmouse, attr-&gt;reg, value);
+
+return count;
+}
+
+#define ELANTECH_INT_ATTR(_name, _register)\
+static struct elantech_attr_data elantech_attr_##_name = {\
+.field_offset = offsetof(struct elantech_data, _name),\
+.reg = _register,\
+};\
+PSMOUSE_DEFINE_ATTR(_name, S_IWUSR | S_IRUGO,\
+    &amp;elantech_attr_##_name,\
+    elantech_show_int_attr,\
+    elantech_set_int_attr)
+
+ELANTECH_INT_ATTR(reg_10, 0x10);
+ELANTECH_INT_ATTR(reg_11, 0x11);
+ELANTECH_INT_ATTR(reg_20, 0x20);
+ELANTECH_INT_ATTR(reg_21, 0x21);
+ELANTECH_INT_ATTR(reg_22, 0x22);
+ELANTECH_INT_ATTR(reg_23, 0x23);
+ELANTECH_INT_ATTR(reg_24, 0x24);
+ELANTECH_INT_ATTR(reg_25, 0x25);
+ELANTECH_INT_ATTR(reg_26, 0x26);
+ELANTECH_INT_ATTR(debug, 0);
+
+static struct attribute *elantech_attrs[] = {
+&amp;psmouse_attr_reg_10.dattr.attr,
+&amp;psmouse_attr_reg_11.dattr.attr,
+&amp;psmouse_attr_reg_20.dattr.attr,
+&amp;psmouse_attr_reg_21.dattr.attr,
+&amp;psmouse_attr_reg_22.dattr.attr,
+&amp;psmouse_attr_reg_23.dattr.attr,
+&amp;psmouse_attr_reg_24.dattr.attr,
+&amp;psmouse_attr_reg_25.dattr.attr,
+&amp;psmouse_attr_reg_26.dattr.attr,
+&amp;psmouse_attr_debug.dattr.attr,
+NULL
+};
+
+static struct attribute_group elantech_attr_group = {
+.attrs = elantech_attrs,
+};
+
+/*
+ * Clean up sysfs entries when disconnecting
+ */
+static void elantech_disconnect(struct psmouse *psmouse)
+{
+sysfs_remove_group(&amp;psmouse-&gt;ps2dev.serio-&gt;dev.kobj,
+&amp;elantech_attr_group);
+kfree(psmouse-&gt;private);
+psmouse-&gt;private = NULL;
+}
+
+/*
+ * Use magic knock to detect Elantech touchpad
+ */
+int elantech_detect(struct psmouse *psmouse, int set_properties)
+{
+struct ps2dev*ps2dev = &amp;psmouse-&gt;ps2dev;
+unsigned charparam[3];
+
+ps2_command(ps2dev,  NULL, PSMOUSE_CMD_DISABLE);
+ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE11);
+ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE11);
+ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE11);
+ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO);
+
+if ((param[0] != 0x3c) || (param[1] != 0x03) || (param[2] != 0xc8)) {
+pr_info("elantech.c: unexpected magic knock result 0x%02x, 0x%02x, 0x%02x.\n",
+param[0], param[1], param[2]);
+return -1;
+}
+
+if (set_properties) {
+psmouse-&gt;vendor = "Elantech";
+psmouse-&gt;name = "Touchpad";
+}
+
+return 0;
+}
+
+/*
+ * Initialize the touchpad and create sysfs entries
+ */
+int elantech_init(struct psmouse *psmouse)
+{
+struct elantech_data *etd;
+inti, error;
+unsigned charparam[3];
+
+etd = kzalloc(sizeof(struct elantech_data), GFP_KERNEL);
+psmouse-&gt;private = etd;
+if (!etd)
+return -1;
+
+parity[0] = 1;
+for (i = 1; i &lt; 256; i++)
+parity[i] = (parity[i &amp; (i - 1)] ^ 1);
+
+/*
+ * Why does the Elantech Windows driver try this?
+ * For now just report it and see if it makes sense
+ * when more people use this driver
+ */
+if (!synaptics_send_cmd(psmouse, SYN_QUE_IDENTIFY, param))
+pr_info("elantech.c: Synaptics identify query result 0x%02x, 0x%02x, 0x%02x.\n",
+param[0], param[1], param[2]);
+if (!synaptics_send_cmd(psmouse, SYN_QUE_MODES, param))
+pr_info("elantech.c: Synaptics modes query result 0x%02x, 0x%02x, 0x%02x.\n",
+param[0], param[1], param[2]);
+if (!synaptics_send_cmd(psmouse, SYN_QUE_CAPABILITIES, param)) {
+pr_info("elantech.c: Synaptics capabilities query result 0x%02x, 0x%02x, 0x%02x.\n",
+param[0], param[1], param[2]);
+etd-&gt;capabilities = param[0];
+}
+
+elantech_set_defaults(psmouse);
+
+psmouse-&gt;protocol_handler = elantech_process_byte;
+psmouse-&gt;disconnect = elantech_disconnect;
+psmouse-&gt;pktsize = 4;
+
+error = sysfs_create_group(&amp;psmouse-&gt;ps2dev.serio-&gt;dev.kobj,
+&amp;elantech_attr_group);
+if (error) {
+printk(KERN_ERR "elantech.c: failed to create sysfs attributes, error: %d\n",
+error);
+kfree(etd);
+return -1;
+}
+
+return 0;
+}
diff -puN /dev/null drivers/input/mouse/elantech.h
--- /dev/null
+++ a/drivers/input/mouse/elantech.h
&lt; at &gt;&lt; at &gt; -0,0 +1,82 &lt; at &gt;&lt; at &gt;
+/*
+ * Elantech Touchpad driver
+ *
+ * Copyright (C) 2007 Arjan Opmeer &lt;arjan&lt; at &gt;opmeer.net&gt;
+ *
+ * This program is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU General Public License version 2 as published
+ * by the Free Software Foundation.
+ *
+ * Trademarks are the property of their respective owners.
+ */
+
+#ifndef _ELANTECH_H
+#define _ELANTECH_H
+
+/*
+ * Commands start with this value
+ */
+#define ELANTECH_COMMAND_START0x11
+
+/*
+ * Register bitmasks
+ */
+#define ETP_R10_ABSOLUTE_MODE0x04
+#define ETP_R11_PARITY_CHECKING0x01
+#define ETP_R11_4_BYTE_MODE 0x02
+
+/*
+ * Capability bitmasks
+ */
+#define ETP_CAP_REPORTS_MIDDLE_BUTTON0x02
+#define ETP_CAP_HAS_ROCKER0x04
+#define ETP_CAP_ALTERNATE_TAP_BITS0x10
+
+/*
+ * One hard to find application note states that X axis range is 0 to 576
+ * and Y axis range is 0 to 384.
+ * Edge fuzz might be necessary because of bezel around the touchpad.
+ */
+#define ETP_EDGE_FUZZ32
+
+#define ETP_XMIN (  0 + ETP_EDGE_FUZZ)
+#define ETP_XMAX (576 - ETP_EDGE_FUZZ)
+#define ETP_YMIN (  0 + ETP_EDGE_FUZZ)
+#define ETP_YMAX (384 - ETP_EDGE_FUZZ)
+
+/*
+ * It seems the touchpad does not report pressure.
+ * Just choose some values for compatibility with X Synaptics driver
+ */
+#define ETP_MAX_PRESSURE127
+#define ETP_DEF_PRESSURE64
+
+struct elantech_data {
+unsigned char reg_10;
+unsigned char reg_11;
+unsigned char reg_20;
+unsigned char reg_21;
+unsigned char reg_22;
+unsigned char reg_23;
+unsigned char reg_24;
+unsigned char reg_25;
+unsigned char reg_26;
+unsigned char debug;
+unsigned char capabilities;
+};
+
+#ifdef CONFIG_MOUSE_PS2_ELANTECH
+int elantech_detect(struct psmouse *psmouse, int set_properties);
+int elantech_init(struct psmouse *psmouse);
+#else
+static inline int elantech_detect(struct psmouse *psmouse, int set_properties)
+{
+return -ENOSYS;
+}
+static inline int elantech_init(struct psmouse *psmouse)
+{
+return -ENOSYS;
+}
+#endif /* CONFIG_MOUSE_PS2_ELANTECH */
+
+#endif
diff -puN drivers/input/mouse/psmouse-base.c~elantech-touchpad-driver drivers/input/mouse/psmouse-base.c
--- a/drivers/input/mouse/psmouse-base.c~elantech-touchpad-driver
+++ a/drivers/input/mouse/psmouse-base.c
&lt; at &gt;&lt; at &gt; -28,6 +28,7 &lt; at &gt;&lt; at &gt;
 #include "lifebook.h"
 #include "trackpoint.h"
 #include "touchkit_ps2.h"
+#include "elantech.h"
 
 #define DRIVER_DESC"PS/2 mouse driver"
 
&lt; at &gt;&lt; at &gt; -653,6 +654,13 &lt; at &gt;&lt; at &gt; static int psmouse_extensions(struct psm
 ps2_command(&amp;psmouse-&gt;ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
 psmouse_reset(psmouse);
 
+if (elantech_detect(psmouse, set_properties) == 0) {
+if (max_proto &gt; PSMOUSE_IMEX) {
+if (!set_properties || elantech_init(psmouse) == 0)
+return PSMOUSE_ELANTECH;
+}
+}
+
 if (max_proto &gt;= PSMOUSE_IMEX &amp;&amp; im_explorer_detect(psmouse, set_properties) == 0)
 return PSMOUSE_IMEX;
 
&lt; at &gt;&lt; at &gt; -762,6 +770,15 &lt; at &gt;&lt; at &gt; static const struct psmouse_protocol psm
 .detect= touchkit_ps2_detect,
 },
 #endif
+#ifdef CONFIG_MOUSE_PS2_ELANTECH
+{
+.type= PSMOUSE_ELANTECH,
+.name= "ETPS/2",
+.alias= "elantech",
+.detect= elantech_detect,
+.init= elantech_init,
+},
+#endif
 {
 .type= PSMOUSE_CORTRON,
 .name= "CortronPS/2",
diff -puN drivers/input/mouse/psmouse.h~elantech-touchpad-driver drivers/input/mouse/psmouse.h
--- a/drivers/input/mouse/psmouse.h~elantech-touchpad-driver
+++ a/drivers/input/mouse/psmouse.h
&lt; at &gt;&lt; at &gt; -89,6 +89,7 &lt; at &gt;&lt; at &gt; enum psmouse_type {
 PSMOUSE_TRACKPOINT,
 PSMOUSE_TOUCHKIT_PS2,
 PSMOUSE_CORTRON,
+PSMOUSE_ELANTECH,
 PSMOUSE_AUTO/* This one should always be last */
 };
 
_
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>akpm&lt; at &gt;linux-foundation.org</dc:creator>
    <dc:date>2008-08-20T23:46:42</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5580">
    <title>[patch 1/4] drivers/input/touchscreen/ucb1400_ts.c needs GPIO</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5580</link>
    <description>From: Andrew Morton &lt;akpm&lt; at &gt;linux-foundation.org&gt;

ia64 allmodconfig:

include/asm-generic/gpio.h: In function `gpio_get_value_cansleep':
include/asm-generic/gpio.h:147: error: implicit declaration of function `gpio_get_value'
include/asm-generic/gpio.h: In function `gpio_set_value_cansleep':
include/asm-generic/gpio.h:153: error: implicit declaration of function `gpio_set_value'

recent linux-next breakage.  Not sure what caused it..

Cc: Marek Vasut &lt;marek.vasut&lt; at &gt;gmail.com&gt;
Cc: Russell King &lt;rmk+kernel&lt; at &gt;arm.linux.org.uk&gt;
Cc: Vernon Sauder &lt;vsauder&lt; at &gt;inhand.com&gt;
Cc: Nicolas Pitre &lt;nico&lt; at &gt;marvell.com&gt;
Cc: Dmitry Torokhov &lt;dtor&lt; at &gt;mail.ru&gt;
Cc: David Brownell &lt;david-b&lt; at &gt;pacbell.net&gt;
Signed-off-by: Andrew Morton &lt;akpm&lt; at &gt;linux-foundation.org&gt;
---

 drivers/input/touchscreen/Kconfig |    1 +
 1 file changed, 1 insertion(+)

diff -puN drivers/input/touchscreen/Kconfig~drivers-input-touchscreen-ucb1400_tsc-needs-gpio drivers/input/touchscreen/Kconfig
--- a/drivers/input/touchscreen/Kconfig~drivers-input-touchscreen-ucb1400_tsc-needs-gpio
+++ a/drivers/input/touchscreen/Kconfig
&lt; at &gt;&lt; at &gt; -221,6 +221,7 &lt; at &gt;&lt; at &gt; config TOUCHSCREEN_UCB1400
 tristate "Philips UCB1400 touchscreen"
 depends on AC97_BUS
 depends on UCB1400_CORE
+depends on GPIOLIB
 help
   This enables support for the Philips UCB1400 touchscreen interface.
   The UCB1400 is an AC97 audio codec.  The touchscreen interface
_
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>akpm&lt; at &gt;linux-foundation.org</dc:creator>
    <dc:date>2008-08-20T23:46:41</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5579">
    <title>[patch 3/4] input/touchscreen driver: add support AD7877 touchscreen driver</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5579</link>
    <description>From: Michael Hennerich &lt;michael.hennerich&lt; at &gt;analog.com&gt;

Signed-off-by: Michael Hennerich &lt;michael.hennerich&lt; at &gt;analog.com&gt;
Signed-off-by: Bryan Wu &lt;bryan.wu&lt; at &gt;analog.com&gt;
Cc: Jiri Kosina &lt;jkosina&lt; at &gt;suse.cz&gt;
Cc: Dmitry Torokhov &lt;dmitry.torokhov&lt; at &gt;gmail.com&gt;
Signed-off-by: Andrew Morton &lt;akpm&lt; at &gt;linux-foundation.org&gt;
---

 drivers/input/touchscreen/Kconfig  |   13 
 drivers/input/touchscreen/Makefile |    1 
 drivers/input/touchscreen/ad7877.c |  899 +++++++++++++++++++++++++++
 3 files changed, 913 insertions(+)

diff -puN drivers/input/touchscreen/Kconfig~input-touchscreen-driver-add-support-ad7877-touchscreen-driver drivers/input/touchscreen/Kconfig
--- a/drivers/input/touchscreen/Kconfig~input-touchscreen-driver-add-support-ad7877-touchscreen-driver
+++ a/drivers/input/touchscreen/Kconfig
&lt; at &gt;&lt; at &gt; -29,6 +29,19 &lt; at &gt;&lt; at &gt; config TOUCHSCREEN_ADS7846
   To compile this driver as a module, choose M here: the
   module will be called ads7846.
 
+config TOUCHSCREEN_AD7877
+tristate "AD7877 based touchscreens"
+depends on SPI_MASTER
+help
+  Say Y here if you have a touchscreen interface using the
+  AD7877 controller, and your board-specific initialization
+  code includes that in its table of SPI devices.
+
+  If unsure, say N (but it's safe to say "Y").
+
+  To compile this driver as a module, choose M here: the
+  module will be called ad7877.
+
 config TOUCHSCREEN_BITSY
 tristate "Compaq iPAQ H3600 (Bitsy) touchscreen"
 depends on SA1100_BITSY
diff -puN drivers/input/touchscreen/Makefile~input-touchscreen-driver-add-support-ad7877-touchscreen-driver drivers/input/touchscreen/Makefile
--- a/drivers/input/touchscreen/Makefile~input-touchscreen-driver-add-support-ad7877-touchscreen-driver
+++ a/drivers/input/touchscreen/Makefile
&lt; at &gt;&lt; at &gt; -6,6 +6,7 &lt; at &gt;&lt; at &gt;
 
 wm97xx-ts-y := wm97xx-core.o
 
+obj-$(CONFIG_TOUCHSCREEN_AD7877)+= ad7877.o
 obj-$(CONFIG_TOUCHSCREEN_ADS7846)+= ads7846.o
 obj-$(CONFIG_TOUCHSCREEN_ATMEL_TSADCC)+= atmel_tsadcc.o
 obj-$(CONFIG_TOUCHSCREEN_BITSY)+= h3600_ts_input.o
diff -puN /dev/null drivers/input/touchscreen/ad7877.c
--- /dev/null
+++ a/drivers/input/touchscreen/ad7877.c
&lt; at &gt;&lt; at &gt; -0,0 +1,899 &lt; at &gt;&lt; at &gt;
+/*
+ * File:        drivers/input/touchscreen/ad7877.c
+ *
+ * Based on: ads7846.c
+ *
+ *Copyright (C) 2006-2008 Michael Hennerich, Analog Devices Inc.
+ *
+ * Author:Michael Hennerich, Analog Devices Inc.
+ *
+ * Created:Nov, 10th 2006
+ * Description:AD7877 based touchscreen, sensor (ADCs), DAC and GPIO driver
+ *
+ *
+ * Modified:
+ *
+ * Bugs:        Enter bugs at http://blackfin.uclinux.org/
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, see the file COPYING, or write
+ * to the Free Software Foundation, Inc.,
+ * 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
+ *
+ * History:
+ * Copyright (c) 2005 David Brownell
+ * Copyright (c) 2006 Nokia Corporation
+ * Various changes: Imre Deak &lt;imre.deak&lt; at &gt;nokia.com&gt;
+ *
+ * Using code from:
+ *  - corgi_ts.c
+ *Copyright (C) 2004-2005 Richard Purdie
+ *  - omap_ts.[hc], ads7846.h, ts_osk.c
+ *Copyright (C) 2002 MontaVista Software
+ *Copyright (C) 2004 Texas Instruments
+ *Copyright (C) 2005 Dirk Behme
+ */
+
+
+#include &lt;linux/device.h&gt;
+#include &lt;linux/init.h&gt;
+#include &lt;linux/delay.h&gt;
+#include &lt;linux/input.h&gt;
+#include &lt;linux/interrupt.h&gt;
+#include &lt;linux/slab.h&gt;
+#include &lt;linux/spi/spi.h&gt;
+#include &lt;linux/spi/ad7877.h&gt;
+#include &lt;asm/irq.h&gt;
+
+#defineTS_PEN_UP_TIMEOUTmsecs_to_jiffies(50)
+
+/*--------------------------------------------------------------------------*/
+
+#define MAX_SPI_FREQ_HZ20000000
+#defineMAX_12BIT((1&lt;&lt;12)-1)
+
+#define AD7877_REG_ZEROS0
+#define AD7877_REG_CTRL11
+#define AD7877_REG_CTRL22
+#define AD7877_REG_ALERT3
+#define AD7877_REG_AUX1HIGH4
+#define AD7877_REG_AUX1LOW5
+#define AD7877_REG_BAT1HIGH6
+#define AD7877_REG_BAT1LOW7
+#define AD7877_REG_BAT2HIGH8
+#define AD7877_REG_BAT2LOW9
+#define AD7877_REG_TEMP1HIGH10
+#define AD7877_REG_TEMP1LOW11
+#define AD7877_REG_SEQ012
+#define AD7877_REG_SEQ113
+#define AD7877_REG_DAC14
+#define AD7877_REG_NONE115
+#define AD7877_REG_EXTWRITE15
+#define AD7877_REG_XPLUS16
+#define AD7877_REG_YPLUS17
+#define AD7877_REG_Z218
+#define AD7877_REG_aux119
+#define AD7877_REG_aux220
+#define AD7877_REG_aux321
+#define AD7877_REG_bat122
+#define AD7877_REG_bat223
+#define AD7877_REG_temp124
+#define AD7877_REG_temp225
+#define AD7877_REG_Z126
+#define AD7877_REG_GPIOCTRL127
+#define AD7877_REG_GPIOCTRL228
+#define AD7877_REG_GPIODATA29
+#define AD7877_REG_NONE230
+#define AD7877_REG_NONE331
+
+#define AD7877_SEQ_YPLUS_BIT(1&lt;&lt;11)
+#define AD7877_SEQ_XPLUS_BIT(1&lt;&lt;10)
+#define AD7877_SEQ_Z2_BIT(1&lt;&lt;9)
+#define AD7877_SEQ_AUX1_BIT(1&lt;&lt;8)
+#define AD7877_SEQ_AUX2_BIT(1&lt;&lt;7)
+#define AD7877_SEQ_AUX3_BIT(1&lt;&lt;6)
+#define AD7877_SEQ_BAT1_BIT(1&lt;&lt;5)
+#define AD7877_SEQ_BAT2_BIT(1&lt;&lt;4)
+#define AD7877_SEQ_TEMP1_BIT(1&lt;&lt;3)
+#define AD7877_SEQ_TEMP2_BIT(1&lt;&lt;2)
+#define AD7877_SEQ_Z1_BIT(1&lt;&lt;1)
+
+enum {
+AD7877_SEQ_YPOS  = 0,
+AD7877_SEQ_XPOS  = 1,
+AD7877_SEQ_Z2    = 2,
+AD7877_SEQ_AUX1  = 3,
+AD7877_SEQ_AUX2  = 4,
+AD7877_SEQ_AUX3  = 5,
+AD7877_SEQ_BAT1  = 6,
+AD7877_SEQ_BAT2  = 7,
+AD7877_SEQ_TEMP1 = 8,
+AD7877_SEQ_TEMP2 = 9,
+AD7877_SEQ_Z1    = 10,
+AD7877_NR_SENSE  = 11,
+};
+
+/* DAC Register Default RANGE 0 to Vcc, Volatge Mode, DAC On */
+#define AD7877_DAC_CONF0x1
+
+/* If gpio3 is set AUX3/GPIO3 acts as GPIO Output */
+#define AD7877_EXTW_GPIO_3_CONF0x1C4
+#define AD7877_EXTW_GPIO_DATA0x200
+
+/* Control REG 2 */
+#define AD7877_TMR(x)((x &amp; 0x3) &lt;&lt; 0)
+#define AD7877_REF(x)((x &amp; 0x1) &lt;&lt; 2)
+#define AD7877_POL(x)((x &amp; 0x1) &lt;&lt; 3)
+#define AD7877_FCD(x)((x &amp; 0x3) &lt;&lt; 4)
+#define AD7877_PM(x)((x &amp; 0x3) &lt;&lt; 6)
+#define AD7877_ACQ(x)((x &amp; 0x3) &lt;&lt; 8)
+#define AD7877_AVG(x)((x &amp; 0x3) &lt;&lt; 10)
+
+/* Control REG 1 */
+#defineAD7877_SER(1 &lt;&lt; 11)/* non-differential */
+#defineAD7877_DFR(0 &lt;&lt; 11)/* differential */
+
+#define AD7877_MODE_NOC  (0)/* Do not convert */
+#define AD7877_MODE_SCC  (1)/* Single channel conversion */
+#define AD7877_MODE_SEQ0 (2)/* Sequence 0 in Slave Mode */
+#define AD7877_MODE_SEQ1 (3)/* Sequence 1 in Master Mode */
+
+#define AD7877_CHANADD(x)((x&amp;0xF)&lt;&lt;7)
+#define AD7877_READADD(x)((x)&lt;&lt;2)
+#define AD7877_WRITEADD(x)((x)&lt;&lt;12)
+
+#define AD7877_READ_CHAN(x) (AD7877_WRITEADD(AD7877_REG_CTRL1) | AD7877_SER | \
+AD7877_MODE_SCC | AD7877_CHANADD(AD7877_REG_ ## x) | \
+AD7877_READADD(AD7877_REG_ ## x))
+
+
+#define AD7877_MM_SEQUENCE (AD7877_SEQ_YPLUS_BIT | AD7877_SEQ_XPLUS_BIT | \
+AD7877_SEQ_Z2_BIT | AD7877_SEQ_Z1_BIT)
+/*--------------------------------------------------------------------------*/
+
+/*
+ * Non-touchscreen sensors only use single-ended conversions.
+ */
+
+struct ser_req {
+u16ref_on;
+u16command;
+u16sample;
+struct spi_messagemsg;
+struct spi_transferxfer[5];
+};
+
+struct ad7877 {
+struct input_dev*input;
+charphys[32];
+
+struct spi_device*spi;
+u16model;
+u16vref_delay_usecs;
+u16x_plate_ohms;
+u16pressure_max;
+
+u16cmd_crtl1;
+u16cmd_crtl2;
+u16cmd_dummy;
+u16dac;
+
+u8stopacq_polarity;
+u8first_conversion_delay;
+u8acquisition_time;
+u8averaging;
+u8pen_down_acc_interval;
+
+u16 conversion_data[AD7877_NR_SENSE];
+
+struct spi_transferxfer[13];
+struct spi_messagemsg;
+
+int intr_flag;
+
+spinlock_tlock;
+struct timer_listtimer;/* P: lock */
+unsignedpendown:1;/* P: lock */
+unsignedpending:1;/* P: lock */
+
+unsignedirq_disabled:1;/* P: lock */
+unsigneddisabled:1;
+unsignedgpio3:1;
+unsignedgpio4:1;
+};
+
+static int gpio3;
+
+static void ad7877_enable(struct ad7877 *ts);
+static void ad7877_disable(struct ad7877 *ts);
+
+static int ad7877_read(struct device *dev, u16 reg)
+{
+struct spi_device*spi = to_spi_device(dev);
+struct ser_req*req = kzalloc(sizeof *req, GFP_KERNEL);
+intstatus;
+
+if (!req)
+return -ENOMEM;
+
+spi_message_init(&amp;req-&gt;msg);
+
+req-&gt;command = (u16) (AD7877_WRITEADD(AD7877_REG_CTRL1) |
+AD7877_READADD(reg));
+req-&gt;xfer[0].tx_buf = &amp;req-&gt;command;
+req-&gt;xfer[0].len = 2;
+
+req-&gt;xfer[1].rx_buf = &amp;req-&gt;sample;
+req-&gt;xfer[1].len = 2;
+
+spi_message_add_tail(&amp;req-&gt;xfer[0], &amp;req-&gt;msg);
+spi_message_add_tail(&amp;req-&gt;xfer[1], &amp;req-&gt;msg);
+
+status = spi_sync(spi, &amp;req-&gt;msg);
+
+if (status == 0)
+status = req-&gt;msg.status;
+
+kfree(req);
+return status ? status : req-&gt;sample;
+}
+
+static int ad7877_write(struct device *dev, u16 reg, u16 val)
+{
+struct spi_device*spi = to_spi_device(dev);
+struct ser_req*req = kzalloc(sizeof *req, GFP_KERNEL);
+intstatus;
+
+if (!req)
+return -ENOMEM;
+
+spi_message_init(&amp;req-&gt;msg);
+
+req-&gt;command = (u16) (AD7877_WRITEADD(reg) | (val &amp; MAX_12BIT));
+req-&gt;xfer[0].tx_buf = &amp;req-&gt;command;
+req-&gt;xfer[0].len = 2;
+
+spi_message_add_tail(&amp;req-&gt;xfer[0], &amp;req-&gt;msg);
+
+status = spi_sync(spi, &amp;req-&gt;msg);
+
+if (status == 0)
+status = req-&gt;msg.status;
+
+kfree(req);
+
+return status;
+}
+
+static int ad7877_read_adc(struct device *dev, unsigned command)
+{
+struct spi_device*spi = to_spi_device(dev);
+struct ad7877*ts = dev_get_drvdata(dev);
+struct ser_req*req = kzalloc(sizeof *req, GFP_KERNEL);
+intstatus;
+intsample;
+inti;
+
+if (!req)
+return -ENOMEM;
+
+spi_message_init(&amp;req-&gt;msg);
+
+/* activate reference, so it has time to settle; */
+req-&gt;ref_on = AD7877_WRITEADD(AD7877_REG_CTRL2) |
+ AD7877_POL(ts-&gt;stopacq_polarity) |
+ AD7877_AVG(0) | AD7877_PM(2) | AD7877_TMR(0) |
+ AD7877_ACQ(ts-&gt;acquisition_time) | AD7877_FCD(0);
+
+req-&gt;command = (u16) command;
+
+req-&gt;xfer[0].tx_buf = &amp;req-&gt;ref_on;
+req-&gt;xfer[0].len = 2;
+req-&gt;xfer[0].delay_usecs = ts-&gt;vref_delay_usecs;
+
+req-&gt;xfer[1].tx_buf = &amp;req-&gt;command;
+req-&gt;xfer[1].len = 2;
+req-&gt;xfer[1].delay_usecs = ts-&gt;vref_delay_usecs;
+
+req-&gt;xfer[2].rx_buf = &amp;req-&gt;sample;
+req-&gt;xfer[2].len = 2;
+
+req-&gt;xfer[3].tx_buf = &amp;ts-&gt;cmd_crtl2;/*REF OFF*/
+req-&gt;xfer[3].len = 2;
+
+req-&gt;xfer[4].tx_buf = &amp;ts-&gt;cmd_crtl1;/*DEFAULT*/
+req-&gt;xfer[4].len = 2;
+
+/* group all the transfers together, so we can't interfere with
+ * reading touchscreen state; disable penirq while sampling
+ */
+for (i = 0; i &lt; 5; i++)
+spi_message_add_tail(&amp;req-&gt;xfer[i], &amp;req-&gt;msg);
+
+ts-&gt;irq_disabled = 1;
+disable_irq(spi-&gt;irq);
+status = spi_sync(spi, &amp;req-&gt;msg);
+ts-&gt;irq_disabled = 0;
+enable_irq(spi-&gt;irq);
+
+if (status == 0)
+status = req-&gt;msg.status;
+
+sample = req-&gt;sample;
+
+kfree(req);
+return status ? status : sample;
+}
+
+#define SHOW(name) static ssize_t \
+name ## _show(struct device *dev, struct device_attribute *attr, char *buf) \
+{ \
+ssize_t v = ad7877_read_adc(dev, \
+AD7877_READ_CHAN(name)); \
+if (v &lt; 0) \
+return v; \
+return sprintf(buf, "%u\n", (unsigned) v); \
+} \
+static DEVICE_ATTR(name, S_IRUGO, name ## _show, NULL);
+
+SHOW(aux1)
+SHOW(aux2)
+SHOW(aux3)
+SHOW(bat1)
+SHOW(bat2)
+SHOW(temp1)
+SHOW(temp2)
+
+static ssize_t ad7877_disable_show(struct device *dev,
+     struct device_attribute *attr, char *buf)
+{
+struct ad7877*ts = dev_get_drvdata(dev);
+
+return sprintf(buf, "%u\n", ts-&gt;disabled);
+}
+
+static ssize_t ad7877_disable_store(struct device *dev,
+     struct device_attribute *attr,
+     const char *buf, size_t count)
+{
+struct ad7877 *ts = dev_get_drvdata(dev);
+char *endp;
+int i;
+
+i = simple_strtoul(buf, &amp;endp, 10);
+
+if (i)
+ad7877_disable(ts);
+else
+ad7877_enable(ts);
+
+return count;
+}
+
+static DEVICE_ATTR(disable, 0664, ad7877_disable_show, ad7877_disable_store);
+
+static ssize_t ad7877_dac_show(struct device *dev,
+     struct device_attribute *attr, char *buf)
+{
+struct ad7877*ts = dev_get_drvdata(dev);
+
+return sprintf(buf, "%u\n", ts-&gt;dac);
+}
+
+static ssize_t ad7877_dac_store(struct device *dev,
+     struct device_attribute *attr,
+     const char *buf, size_t count)
+{
+struct ad7877 *ts = dev_get_drvdata(dev);
+char *endp;
+int i;
+
+i = simple_strtoul(buf, &amp;endp, 10);
+
+ts-&gt;dac = i &amp; 0xFF;
+
+ad7877_write(dev, AD7877_REG_DAC, (ts-&gt;dac &lt;&lt; 4) | AD7877_DAC_CONF);
+
+return count;
+}
+
+static DEVICE_ATTR(dac, 0664, ad7877_dac_show, ad7877_dac_store);
+
+static ssize_t ad7877_gpio3_show(struct device *dev,
+     struct device_attribute *attr, char *buf)
+{
+struct ad7877*ts = dev_get_drvdata(dev);
+
+return sprintf(buf, "%u\n", ts-&gt;gpio3);
+}
+
+static ssize_t ad7877_gpio3_store(struct device *dev,
+     struct device_attribute *attr,
+     const char *buf, size_t count)
+{
+struct ad7877 *ts = dev_get_drvdata(dev);
+char *endp;
+int i;
+
+i = simple_strtoul(buf, &amp;endp, 10);
+
+ts-&gt;gpio3 = !!i;
+
+ad7877_write(dev, AD7877_REG_EXTWRITE, AD7877_EXTW_GPIO_DATA |
+ (ts-&gt;gpio4 &lt;&lt; 4) | (ts-&gt;gpio3 &lt;&lt; 5));
+
+return count;
+}
+
+static DEVICE_ATTR(gpio3, 0664, ad7877_gpio3_show, ad7877_gpio3_store);
+
+static ssize_t ad7877_gpio4_show(struct device *dev,
+     struct device_attribute *attr, char *buf)
+{
+struct ad7877*ts = dev_get_drvdata(dev);
+
+return sprintf(buf, "%u\n", ts-&gt;gpio4);
+}
+
+static ssize_t ad7877_gpio4_store(struct device *dev,
+     struct device_attribute *attr,
+     const char *buf, size_t count)
+{
+struct ad7877 *ts = dev_get_drvdata(dev);
+char *endp;
+int i;
+
+i = simple_strtoul(buf, &amp;endp, 10);
+
+ts-&gt;gpio4 = !!i;
+
+ad7877_write(dev, AD7877_REG_EXTWRITE, AD7877_EXTW_GPIO_DATA |
+ (ts-&gt;gpio4 &lt;&lt; 4) | (ts-&gt;gpio3 &lt;&lt; 5));
+
+return count;
+}
+
+static DEVICE_ATTR(gpio4, 0664, ad7877_gpio4_show, ad7877_gpio4_store);
+
+static struct attribute *ad7877_attributes[] = {
+&amp;dev_attr_temp1.attr,
+&amp;dev_attr_temp2.attr,
+&amp;dev_attr_aux1.attr,
+&amp;dev_attr_aux2.attr,
+&amp;dev_attr_bat1.attr,
+&amp;dev_attr_bat2.attr,
+&amp;dev_attr_disable.attr,
+&amp;dev_attr_dac.attr,
+&amp;dev_attr_gpio4.attr,
+NULL
+};
+
+static const struct attribute_group ad7877_attr_group = {
+.attrs = ad7877_attributes,
+};
+
+/*--------------------------------------------------------------------------*/
+
+/*
+ * /DAV Data available Interrupt only kicks the kthread.
+ * The kthread kicks the timer only to issue the Pen Up Event if
+ * no new data is available
+ *
+ */
+
+static void ad7877_rx(void *ads)
+{
+struct ad7877*ts = ads;
+struct input_dev*input_dev = ts-&gt;input;
+unsignedRt;
+u16x, y, z1, z2;
+
+x = ts-&gt;conversion_data[AD7877_SEQ_XPOS] &amp; MAX_12BIT;
+y = ts-&gt;conversion_data[AD7877_SEQ_YPOS]&amp; MAX_12BIT;
+z1 = ts-&gt;conversion_data[AD7877_SEQ_Z1] &amp; MAX_12BIT;
+z2 = ts-&gt;conversion_data[AD7877_SEQ_Z2] &amp; MAX_12BIT;
+
+/* range filtering */
+if (x == MAX_12BIT)
+x = 0;
+
+if (likely(x &amp;&amp; z1)) {
+/* compute touch pressure resistance using equation #2 */
+Rt = z2;
+Rt -= z1;
+Rt *= x;
+Rt *= ts-&gt;x_plate_ohms;
+Rt /= z1;
+Rt = (Rt + 2047) &gt;&gt; 12;
+} else
+Rt = 0;
+
+if (Rt) {
+input_report_abs(input_dev, ABS_X, x);
+input_report_abs(input_dev, ABS_Y, y);
+input_report_abs(input_dev, ABS_PRESSURE, Rt);
+input_sync(input_dev);
+#ifdefVERBOSE
+pr_debug("%s: %d/%d/%d%s\n", ts-&gt;spi-&gt;dev.bus_id,
+x, y, Rt, Rt ? "" : " UP");
+#endif
+}
+}
+
+static inline void ad7877_ts_event_release(struct ad7877 *ts)
+{
+struct input_dev *input_dev = ts-&gt;input;
+
+input_report_abs(input_dev, ABS_PRESSURE, 0);
+input_sync(input_dev);
+}
+
+static void ad7877_timer(unsigned long handle)
+{
+struct ad7877*ts = (void *)handle;
+
+ad7877_ts_event_release(ts);
+}
+
+
+static irqreturn_t ad7877_irq(int irq, void *handle)
+{
+struct ad7877 *ts = handle;
+unsigned long flags;
+int status;
+
+spin_lock_irqsave(&amp;ts-&gt;lock, flags);
+
+if (!ts-&gt;irq_disabled) {
+ts-&gt;irq_disabled = 1;
+disable_irq(ts-&gt;spi-&gt;irq);
+ts-&gt;pending = 1;
+}
+
+ts-&gt;intr_flag = 1;
+
+spin_unlock_irqrestore(&amp;ts-&gt;lock, flags);
+
+status = spi_async(ts-&gt;spi, &amp;ts-&gt;msg);
+
+if (status)
+dev_err(&amp;ts-&gt;spi-&gt;dev, "spi_sync --&gt; %d\n", status);
+
+return IRQ_HANDLED;
+}
+
+
+static void ad7877_callback(void *_ts)
+{
+struct ad7877 *ts = _ts;
+unsigned long flags;
+
+if (ts-&gt;intr_flag) {
+
+ad7877_rx(ts);
+
+spin_lock_irqsave(&amp;ts-&gt;lock, flags);
+
+ts-&gt;intr_flag = 0;
+ts-&gt;pending = 0;
+ts-&gt;irq_disabled = 0;
+enable_irq(ts-&gt;spi-&gt;irq);
+mod_timer(&amp;ts-&gt;timer, jiffies + TS_PEN_UP_TIMEOUT);
+
+spin_unlock_irqrestore(&amp;ts-&gt;lock, flags);
+}
+}
+
+
+/*--------------------------------------------------------------------------*/
+
+static void ad7877_disable(struct ad7877 *ts)
+{
+unsigned long flags;
+
+if (ts-&gt;disabled)
+return;
+
+ts-&gt;disabled = 1;
+
+spin_lock_irqsave(&amp;ts-&gt;lock, flags);
+ts-&gt;irq_disabled = 1;
+disable_irq(ts-&gt;spi-&gt;irq);
+spin_unlock_irqrestore(&amp;ts-&gt;lock, flags);
+
+while (ts-&gt;pending) /* Wait for spi_async callback */
+msleep(1);
+
+if (del_timer_sync(&amp;ts-&gt;timer))
+ad7877_ts_event_release(ts);
+
+/* we know the chip's in lowpower mode since we always
+ * leave it that way after every request
+ */
+}
+
+/* Must be called with ts-&gt;lock held */
+static void ad7877_enable(struct ad7877 *ts)
+{
+unsigned long flags;
+
+if (!ts-&gt;disabled)
+return;
+
+spin_lock_irqsave(&amp;ts-&gt;lock, flags);
+ts-&gt;disabled = 0;
+ts-&gt;irq_disabled = 0;
+enable_irq(ts-&gt;spi-&gt;irq);
+spin_unlock_irqrestore(&amp;ts-&gt;lock, flags);
+}
+
+static int ad7877_suspend(struct spi_device *spi, pm_message_t message)
+{
+struct ad7877 *ts = dev_get_drvdata(&amp;spi-&gt;dev);
+
+ad7877_disable(ts);
+
+return 0;
+}
+
+static int ad7877_resume(struct spi_device *spi)
+{
+struct ad7877 *ts = dev_get_drvdata(&amp;spi-&gt;dev);
+
+ad7877_enable(ts);
+
+return 0;
+}
+
+static inline void ad7877_setup_ts_def_msg(struct spi_device *spi, struct ad7877 *ts)
+{
+struct spi_message *m;
+int i;
+
+ts-&gt;cmd_crtl2 = AD7877_WRITEADD(AD7877_REG_CTRL2) |
+AD7877_POL(ts-&gt;stopacq_polarity) |
+AD7877_AVG(ts-&gt;averaging) | AD7877_PM(1) |
+AD7877_TMR(ts-&gt;pen_down_acc_interval) |
+AD7877_ACQ(ts-&gt;acquisition_time) |
+AD7877_FCD(ts-&gt;first_conversion_delay);
+
+ad7877_write((struct device *) spi, AD7877_REG_CTRL2, ts-&gt;cmd_crtl2);
+
+ts-&gt;cmd_crtl1 = AD7877_WRITEADD(AD7877_REG_CTRL1) |
+AD7877_READADD(AD7877_REG_XPLUS-1) |
+AD7877_MODE_SEQ1 | AD7877_DFR;
+
+ad7877_write((struct device *) spi, AD7877_REG_CTRL1, ts-&gt;cmd_crtl1);
+
+ts-&gt;cmd_dummy = 0;
+
+m = &amp;ts-&gt;msg;
+
+spi_message_init(m);
+
+m-&gt;complete = ad7877_callback;
+m-&gt;context = ts;
+
+ts-&gt;xfer[0].tx_buf = &amp;ts-&gt;cmd_crtl1;
+ts-&gt;xfer[0].len = 2;
+
+spi_message_add_tail(&amp;ts-&gt;xfer[0], m);
+
+ts-&gt;xfer[1].tx_buf = &amp;ts-&gt;cmd_dummy; /* Send ZERO */
+ts-&gt;xfer[1].len = 2;
+
+spi_message_add_tail(&amp;ts-&gt;xfer[1], m);
+
+for (i = 0; i &lt; 11; i++) {
+ts-&gt;xfer[i + 2].rx_buf = &amp;ts-&gt;conversion_data[AD7877_SEQ_YPOS + i];
+ts-&gt;xfer[i + 2].len = 2;
+
+spi_message_add_tail(&amp;ts-&gt;xfer[i+2], m);
+}
+}
+
+static int __devinit ad7877_probe(struct spi_device *spi)
+{
+struct ad7877*ts;
+struct input_dev*input_dev;
+struct ad7877_platform_data*pdata = spi-&gt;dev.platform_data;
+interr;
+u16verify;
+
+if (!spi-&gt;irq) {
+dev_dbg(&amp;spi-&gt;dev, "no IRQ?\n");
+return -ENODEV;
+}
+
+if (!pdata) {
+dev_dbg(&amp;spi-&gt;dev, "no platform data?\n");
+return -ENODEV;
+}
+
+/* don't exceed max specified SPI CLK frequency */
+if (spi-&gt;max_speed_hz &gt; MAX_SPI_FREQ_HZ) {
+dev_dbg(&amp;spi-&gt;dev, "SPI CLK %d Hz?\n",spi-&gt;max_speed_hz);
+return -EINVAL;
+}
+
+ts = kzalloc(sizeof(struct ad7877), GFP_KERNEL);
+input_dev = input_allocate_device();
+if (!ts || !input_dev) {
+err = -ENOMEM;
+goto err_free_mem;
+}
+
+dev_set_drvdata(&amp;spi-&gt;dev, ts);
+
+ts-&gt;spi = spi;
+ts-&gt;input = input_dev;
+ts-&gt;intr_flag = 0;
+
+setup_timer(&amp;ts-&gt;timer, ad7877_timer, (unsigned long) ts);
+
+spin_lock_init(&amp;ts-&gt;lock);
+
+ts-&gt;model = pdata-&gt;model ? : 7877;
+ts-&gt;vref_delay_usecs = pdata-&gt;vref_delay_usecs ? : 100;
+ts-&gt;x_plate_ohms = pdata-&gt;x_plate_ohms ? : 400;
+ts-&gt;pressure_max = pdata-&gt;pressure_max ? : ~0;
+
+ts-&gt;stopacq_polarity = pdata-&gt;stopacq_polarity;
+ts-&gt;first_conversion_delay = pdata-&gt;first_conversion_delay;
+ts-&gt;acquisition_time = pdata-&gt;acquisition_time;
+ts-&gt;averaging = pdata-&gt;averaging;
+ts-&gt;pen_down_acc_interval = pdata-&gt;pen_down_acc_interval;
+
+snprintf(ts-&gt;phys, sizeof(ts-&gt;phys), "%s/input0", spi-&gt;dev.bus_id);
+
+input_dev-&gt;name = "AD7877 Touchscreen";
+input_dev-&gt;phys = ts-&gt;phys;
+input_dev-&gt;dev.parent = &amp;spi-&gt;dev;
+
+__set_bit(EV_ABS, input_dev-&gt;evbit);
+__set_bit(ABS_X, input_dev-&gt;absbit);
+__set_bit(ABS_Y, input_dev-&gt;absbit);
+__set_bit(ABS_PRESSURE, input_dev-&gt;absbit);
+
+input_set_abs_params(input_dev, ABS_X,
+pdata-&gt;x_min ? : 0,
+pdata-&gt;x_max ? : MAX_12BIT,
+0, 0);
+input_set_abs_params(input_dev, ABS_Y,
+pdata-&gt;y_min ? : 0,
+pdata-&gt;y_max ? : MAX_12BIT,
+0, 0);
+input_set_abs_params(input_dev, ABS_PRESSURE,
+pdata-&gt;pressure_min, pdata-&gt;pressure_max, 0, 0);
+
+ad7877_write((struct device *) spi, AD7877_REG_SEQ1, AD7877_MM_SEQUENCE);
+
+verify = ad7877_read((struct device *) spi, AD7877_REG_SEQ1);
+
+if (verify != AD7877_MM_SEQUENCE){
+dev_err(&amp;spi-&gt;dev, "%s: Failed to probe %s\n", spi-&gt;dev.bus_id,
+ input_dev-&gt;name);
+err = -ENODEV;
+goto err_free_mem;
+}
+
+if (gpio3)
+ad7877_write((struct device *) spi, AD7877_REG_EXTWRITE,
+ AD7877_EXTW_GPIO_3_CONF);
+
+ad7877_setup_ts_def_msg(spi, ts);
+
+/* Request AD7877 /DAV GPIO interrupt */
+
+if (request_irq(spi-&gt;irq, ad7877_irq, IRQF_TRIGGER_LOW | IRQF_SAMPLE_RANDOM,
+spi-&gt;dev.driver-&gt;name, ts)) {
+dev_dbg(&amp;spi-&gt;dev, "irq %d busy?\n", spi-&gt;irq);
+err = -EBUSY;
+goto err_free_mem;
+}
+
+dev_info(&amp;spi-&gt;dev, "touchscreen, irq %d\n", spi-&gt;irq);
+
+err = sysfs_create_group(&amp;spi-&gt;dev.kobj, &amp;ad7877_attr_group);
+if (err)
+goto err_remove_attr;
+
+if (gpio3)
+err = device_create_file(&amp;spi-&gt;dev, &amp;dev_attr_gpio3);
+else
+err = device_create_file(&amp;spi-&gt;dev, &amp;dev_attr_aux3);
+
+if (err)
+goto err_remove_attr;
+
+err = input_register_device(input_dev);
+if (err)
+goto err_remove_attr;
+
+ts-&gt;intr_flag = 0;
+
+return 0;
+
+err_remove_attr:
+
+sysfs_remove_group(&amp;spi-&gt;dev.kobj, &amp;ad7877_attr_group);
+
+if (gpio3)
+device_remove_file(&amp;spi-&gt;dev, &amp;dev_attr_gpio3);
+else
+device_remove_file(&amp;spi-&gt;dev, &amp;dev_attr_aux3);
+
+free_irq(spi-&gt;irq, ts);
+
+err_free_mem:
+input_free_device(input_dev);
+kfree(ts);
+dev_set_drvdata(&amp;spi-&gt;dev, NULL);
+return err;
+}
+
+static int __devexit ad7877_remove(struct spi_device *spi)
+{
+struct ad7877*ts = dev_get_drvdata(&amp;spi-&gt;dev);
+
+ad7877_suspend(spi, PMSG_SUSPEND);
+
+sysfs_remove_group(&amp;spi-&gt;dev.kobj, &amp;ad7877_attr_group);
+
+if (gpio3)
+device_remove_file(&amp;spi-&gt;dev, &amp;dev_attr_gpio3);
+else
+device_remove_file(&amp;spi-&gt;dev, &amp;dev_attr_aux3);
+
+free_irq(ts-&gt;spi-&gt;irq, ts);
+
+input_unregister_device(ts-&gt;input);
+
+kfree(ts);
+
+dev_dbg(&amp;spi-&gt;dev, "unregistered touchscreen\n");
+dev_set_drvdata(&amp;spi-&gt;dev, NULL);
+
+return 0;
+}
+
+static struct spi_driver ad7877_driver = {
+.driver = {
+.name= "ad7877",
+.bus= &amp;spi_bus_type,
+.owner= THIS_MODULE,
+},
+.probe= ad7877_probe,
+.remove= __devexit_p(ad7877_remove),
+.suspend= ad7877_suspend,
+.resume= ad7877_resume,
+};
+
+static int __init ad7877_init(void)
+{
+return spi_register_driver(&amp;ad7877_driver);
+}
+module_init(ad7877_init);
+
+static void __exit ad7877_exit(void)
+{
+spi_unregister_driver(&amp;ad7877_driver);
+}
+module_exit(ad7877_exit);
+
+module_param(gpio3, int, 0);
+MODULE_PARM_DESC(gpio3,
+"If gpio3 is set to 1 AUX3 acts as GPIO3");
+
+MODULE_DESCRIPTION("ad7877 TouchScreen Driver");
+MODULE_LICENSE("GPL");
_
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>akpm&lt; at &gt;linux-foundation.org</dc:creator>
    <dc:date>2008-08-20T23:46:43</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5578">
    <title>[patch 4/4] input: ads7846.c sparse lock annotation</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5578</link>
    <description>From: Harvey Harrison &lt;harvey.harrison&lt; at &gt;gmail.com&gt;

Signed-off-by: Harvey Harrison &lt;harvey.harrison&lt; at &gt;gmail.com&gt;
Cc: Dmitry Torokhov &lt;dtor&lt; at &gt;mail.ru&gt;
Signed-off-by: Andrew Morton &lt;akpm&lt; at &gt;linux-foundation.org&gt;
---

 drivers/input/touchscreen/ads7846.c |    2 ++
 1 file changed, 2 insertions(+)

diff -puN drivers/input/touchscreen/ads7846.c~input-ads7846c-sparse-lock-annotation drivers/input/touchscreen/ads7846.c
--- a/drivers/input/touchscreen/ads7846.c~input-ads7846c-sparse-lock-annotation
+++ a/drivers/input/touchscreen/ads7846.c
&lt; at &gt;&lt; at &gt; -741,6 +741,8 &lt; at &gt;&lt; at &gt; static irqreturn_t ads7846_irq(int irq, 
 
 /* Must be called with ts-&gt;lock held */
 static void ads7846_disable(struct ads7846 *ts)
+__acquires(&amp;ts-&gt;lock)
+__releases(&amp;ts-&gt;lock)
 {
 if (ts-&gt;disabled)
 return;
_
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>akpm&lt; at &gt;linux-foundation.org</dc:creator>
    <dc:date>2008-08-20T23:46:44</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5565">
    <title>[git pull] Input updates for 2.6.27-rc3 (part 2)</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5565</link>
    <description>Hi Linus,

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus

to receive updates for the input subsystem.

Changelog:
---------

Geert Uytterhoeven (1):
      Input: evdev - fix printf() format for sizeof

Huang Weiyi (1):
      Input: remove version.h from drivers that don't need it

Martin Michlmayr (1):
      Input: cobalt_btns - add missing MODULE_LICENSE


Diffstat:
--------

 drivers/input/evdev.c                   |    4 ++--
 drivers/input/keyboard/gpio_keys.c      |    1 -
 drivers/input/misc/cobalt_btns.c        |    3 +++
 drivers/input/mouse/gpio_mouse.c        |    1 -
 drivers/input/tablet/gtco.c             |    1 -
 drivers/input/touchscreen/wm9705.c      |    1 -
 drivers/input/touchscreen/wm9712.c      |    1 -
 drivers/input/touchscreen/wm9713.c      |    1 -
 drivers/input/touchscreen/wm97xx-core.c |    1 -
 9 files changed, 5 insertions(+), 9 deletions(-)

</description>
    <dc:creator>Dmitry Torokhov</dc:creator>
    <dc:date>2008-08-19T16:23:37</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5557">
    <title>[PATCH] drivers/input/evdev.c: Fix printf() format for sizeof</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5557</link>
    <description>commit f2afa7711f8585ffc088ba538b9a510e0d5dca12 ("Input: paper over a bug in
Synaptics X driver") introduced a compiler warning on 64-bit platforms, as
sizeof() returns a size_t, not an (unsigned) int:

| drivers/input/evdev.c: In function 'handle_eviocgbit':
| drivers/input/evdev.c:684: warning: format '%d' expects type 'int', but argument 3 has type 'long unsigned int'

Use the proper `z' modifier for size_t, and make the printf() formats for the
sizes unsigned while we're at it.

Signed-off-by: Geert Uytterhoeven &lt;Geert.Uytterhoeven&lt; at &gt;sonycom.com&gt;

diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index a92d815..3524bef 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
&lt; at &gt;&lt; at &gt; -677,8 +677,8 &lt; at &gt;&lt; at &gt; static int handle_eviocgbit(struct input_dev *dev, unsigned int cmd, void __user
 len = OLD_KEY_MAX;
 if (printk_timed_ratelimit(&amp;keymax_warn_time, 10 * 1000))
 printk(KERN_WARNING
-"evdev.c(EVIOCGBIT): Suspicious buffer size %d, "
-"limiting output to %d bytes. See "
+"evdev.c(EVIOCGBIT): Suspicious buffer size %u, "
+"limiting output to %zu bytes. See "
 "http://userweb.kernel.org/~dtor/eviocgbit-bug.html\n",
 OLD_KEY_MAX,
 BITS_TO_LONGS(OLD_KEY_MAX) * sizeof(long));

With kind regards,

Geert Uytterhoeven
Software Architect

Sony Techsoft Centre Europe
The Corporate Village · Da Vincilaan 7-D1 · B-1935 Zaventem · Belgium

Phone:    +32 (0)2 700 8453
Fax:      +32 (0)2 700 8622
E-mail:   Geert.Uytterhoeven&lt; at &gt;sonycom.com
Internet: http://www.sony-europe.com/

A division of Sony Europe (Belgium) N.V.
VAT BE 0413.825.160 · RPR Brussels
Fortis 293-0376800-10 GEBA-BE-BB</description>
    <dc:creator>Geert Uytterhoeven</dc:creator>
    <dc:date>2008-08-19T09:43:32</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5554">
    <title>Your E-mail Has Won</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5554</link>
    <description>Contact:Mr. Pinkett (mr_pinketgriphin02&lt; at &gt;hotmail.co.uk)for a lump sum pay out of £500,000 pounds.Provide him with the 
information  below: 1.Full Name: 2.Full Address:3.sex.4.Occupation.5.Phone/Fax:6.Age.7.Country.8.Nationality.

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>UK Online Lottery Board 2008</dc:creator>
    <dc:date>2008-08-19T00:06:18</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5543">
    <title>[PATCH] Autocentering support for Logitech MOMO Racing Wheel (force feedback)</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5543</link>
    <description>Hello.
  Current kernel has no support for autocentering for Logitech wheels.
By default autocentering enabled in wheel and constant effect does not
work properly. Using USB sniffer I found command which change
autocentering settings: 0xFE, 0x0D, 0x0R, 0x0L, 0x80, 0x00, 0x00,
where R - clockwise force, L - counter-clockwise (0x0-0xF, 0xC =
100%). I write patch for my current kernel (2.6.25), but I think git
version also supported, because I do not found any changes in it.
Currently kernel interface has no support for separate autocenter
control and so I do not implement it.
  And some interesting command 0xF3 (or 0xF5 - I do not understand
difference) which makes wheel very easy to rotate (a-la wheel booster
- no any resistance). Effect of that command can be disabled by
setting any (zero too) autocentering strength. I do not found in
kernel interface any standart command for this feature.

===================================================================================

--- linux-source-2.6.24/drivers/hid/usbhid/hid-lgff.c2008-02-11
08:51:11.000000000 +0300
+++ linux-source-2.6.24.n/drivers/hid/usbhid/hid-lgff.c2008-08-15
14:00:39.000000000 +0400
&lt; at &gt;&lt; at &gt; -48,6 +48,12 &lt; at &gt;&lt; at &gt;
 -1
 };

+static const signed short ff_momo_wheel[] = {
+FF_CONSTANT,
+FF_AUTOCENTER,
+-1
+};
+
 static const struct dev_type devices[] = {
 { 0x046d, 0xc211, ff_rumble },
 { 0x046d, 0xc219, ff_rumble },
&lt; at &gt;&lt; at &gt; -55,7 +61,7 &lt; at &gt;&lt; at &gt;
 { 0x046d, 0xc286, ff_joystick },
 { 0x046d, 0xc294, ff_joystick },
 { 0x046d, 0xc295, ff_joystick },
-{ 0x046d, 0xca03, ff_joystick },
+{ 0x046d, 0xca03, ff_momo_wheel },
 };

 static int hid_lgff_play(struct input_dev *dev, void *data, struct
ff_effect *effect)
&lt; at &gt;&lt; at &gt; -100,6 +106,23 &lt; at &gt;&lt; at &gt;
 return 0;
 }

+static void hid_lgff_set_autocenter(struct input_dev *dev, u16 magnitude)
+{
+struct hid_device *hid = input_get_drvdata(dev);
+struct list_head *report_list =
&amp;hid-&gt;report_enum[HID_OUTPUT_REPORT].report_list;
+struct hid_report *report = list_entry(report_list-&gt;next, struct
hid_report, list);
+__s32 *value = report-&gt;field[0]-&gt;value;
+magnitude = (magnitude &gt;&gt; 12) &amp; 0xf;
+*value++ = 0xfe;
+*value++ = 0x0d;
+*value++ = magnitude;/* clockwise strength */
+*value++ = magnitude;/* counter-clockwise strength */
+*value++ = 0x80;
+*value++ = 0x00;
+*value++ = 0x00;
+usbhid_submit_report(hid, report, USB_DIR_OUT);
+}
+
 int hid_lgff_init(struct hid_device* hid)
 {
 struct hid_input *hidinput = list_entry(hid-&gt;inputs.next, struct
hid_input, list);
&lt; at &gt;&lt; at &gt; -110,6 +133,7 &lt; at &gt;&lt; at &gt;
 const signed short *ff_bits = ff_joystick;
 int error;
 int i;
+int autocenter = 0;

 /* Find the report to use */
 if (list_empty(report_list)) {
&lt; at &gt;&lt; at &gt; -138,13 +162,19 &lt; at &gt;&lt; at &gt;
 }
 }

-for (i = 0; ff_bits[i] &gt;= 0; i++)
+for (i = 0; ff_bits[i] &gt;= 0; i++) {
 set_bit(ff_bits[i], dev-&gt;ffbit);
+if (ff_bits[i] == FF_AUTOCENTER)
+    autocenter = 1;
+}

 error = input_ff_create_memless(dev, NULL, hid_lgff_play);
 if (error)
 return error;

+if (autocenter &amp;&amp; dev-&gt;ff &amp;&amp; (!dev-&gt;ff-&gt;set_autocenter))
+dev-&gt;ff-&gt;set_autocenter = hid_lgff_set_autocenter;
+
 printk(KERN_INFO "Force feedback for Logitech force feedback devices
by Johann Deneux &lt;johann.deneux&lt; at &gt;it.uu.se&gt;\n");

 return 0;

========================================================================
Changes in this patch only for MOMO Racing wheels. But some other
wheels (G25, for example) may be also understand this protocol, but I
cannot check it.
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>Сергей Беляшов</dc:creator>
    <dc:date>2008-08-18T09:17:48</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5540">
    <title>[INPUT] removed unused #include &lt;version.h&gt;</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5540</link>
    <description>The drivers below do not use LINUX_VERSION_CODE nor KERNEL_VERSION.
  drivers/input/keyboard/gpio_keys.c
  drivers/input/mouse/gpio_mouse.c
  drivers/input/tablet/gtco.c

This patch removes the said #include &lt;version.h&gt;.

Signed-off-by: Huang Weiyi &lt;weiyi.huang&lt; at &gt;gmail.com&gt;

diff --git a/drivers/input/keyboard/gpio_keys.c b/drivers/input/keyboard/gpio_keys.c
index be58730..a0fcc4c 100644
--- a/drivers/input/keyboard/gpio_keys.c
+++ b/drivers/input/keyboard/gpio_keys.c
&lt; at &gt;&lt; at &gt; -9,7 +9,6 &lt; at &gt;&lt; at &gt;
  */
 
 #include &lt;linux/module.h&gt;
-#include &lt;linux/version.h&gt;
 
 #include &lt;linux/init.h&gt;
 #include &lt;linux/fs.h&gt;
diff --git a/drivers/input/mouse/gpio_mouse.c b/drivers/input/mouse/gpio_mouse.c
index 3392901..72cf5e3 100644
--- a/drivers/input/mouse/gpio_mouse.c
+++ b/drivers/input/mouse/gpio_mouse.c
&lt; at &gt;&lt; at &gt; -9,7 +9,6 &lt; at &gt;&lt; at &gt;
  */
 
 #include &lt;linux/init.h&gt;
-#include &lt;linux/version.h&gt;
 #include &lt;linux/module.h&gt;
 #include &lt;linux/platform_device.h&gt;
 #include &lt;linux/input-polldev.h&gt;
diff --git a/drivers/input/tablet/gtco.c b/drivers/input/tablet/gtco.c
index b9b7a98..7df0228 100644
--- a/drivers/input/tablet/gtco.c
+++ b/drivers/input/tablet/gtco.c
&lt; at &gt;&lt; at &gt; -64,7 +64,6 &lt; at &gt;&lt; at &gt; Scott Hill shill&lt; at &gt;gtcocalcomp.com
 #include &lt;asm/byteorder.h&gt;
 
 
-#include &lt;linux/version.h&gt;
 #include &lt;linux/usb/input.h&gt;
 
 /* Version with a Major number of 2 is for kernel inclusion only. */

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>Huang Weiyi</dc:creator>
    <dc:date>2008-08-16T23:50:53</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5539">
    <title>[TOUCHSCREEN] removed unused #include &lt;version.h&gt;</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5539</link>
    <description>The drivers below do not use LINUX_VERSION_CODE nor KERNEL_VERSION.
  drivers/input/touchscreen/wm9705.c
  drivers/input/touchscreen/wm9712.c
  drivers/input/touchscreen/wm9713.c
  drivers/input/touchscreen/wm97xx-core.c

This patch removes the said #include &lt;version.h&gt;.

Signed-off-by: Huang Weiyi &lt;weiyi.huang&lt; at &gt;gmail.com&gt;

diff --git a/drivers/input/touchscreen/wm9705.c b/drivers/input/touchscreen/wm9705.c
index 978e1a1..372efbc 100644
--- a/drivers/input/touchscreen/wm9705.c
+++ b/drivers/input/touchscreen/wm9705.c
&lt; at &gt;&lt; at &gt; -17,7 +17,6 &lt; at &gt;&lt; at &gt;
 
 #include &lt;linux/module.h&gt;
 #include &lt;linux/moduleparam.h&gt;
-#include &lt;linux/version.h&gt;
 #include &lt;linux/kernel.h&gt;
 #include &lt;linux/input.h&gt;
 #include &lt;linux/delay.h&gt;
diff --git a/drivers/input/touchscreen/wm9712.c b/drivers/input/touchscreen/wm9712.c
index 4c5d85a..c8bb1e7 100644
--- a/drivers/input/touchscreen/wm9712.c
+++ b/drivers/input/touchscreen/wm9712.c
&lt; at &gt;&lt; at &gt; -17,7 +17,6 &lt; at &gt;&lt; at &gt;
 
 #include &lt;linux/module.h&gt;
 #include &lt;linux/moduleparam.h&gt;
-#include &lt;linux/version.h&gt;
 #include &lt;linux/kernel.h&gt;
 #include &lt;linux/input.h&gt;
 #include &lt;linux/delay.h&gt;
diff --git a/drivers/input/touchscreen/wm9713.c b/drivers/input/touchscreen/wm9713.c
index 8384587..781ee83 100644
--- a/drivers/input/touchscreen/wm9713.c
+++ b/drivers/input/touchscreen/wm9713.c
&lt; at &gt;&lt; at &gt; -17,7 +17,6 &lt; at &gt;&lt; at &gt;
 
 #include &lt;linux/module.h&gt;
 #include &lt;linux/moduleparam.h&gt;
-#include &lt;linux/version.h&gt;
 #include &lt;linux/kernel.h&gt;
 #include &lt;linux/input.h&gt;
 #include &lt;linux/delay.h&gt;
diff --git a/drivers/input/touchscreen/wm97xx-core.c b/drivers/input/touchscreen/wm97xx-core.c
index cdc24ad..d589ab0 100644
--- a/drivers/input/touchscreen/wm97xx-core.c
+++ b/drivers/input/touchscreen/wm97xx-core.c
&lt; at &gt;&lt; at &gt; -37,7 +37,6 &lt; at &gt;&lt; at &gt;
 
 #include &lt;linux/module.h&gt;
 #include &lt;linux/moduleparam.h&gt;
-#include &lt;linux/version.h&gt;
 #include &lt;linux/kernel.h&gt;
 #include &lt;linux/init.h&gt;
 #include &lt;linux/delay.h&gt;

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>Huang Weiyi</dc:creator>
    <dc:date>2008-08-16T23:50:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5538">
    <title>[PATCH] GPIO driven matrix keypad driver</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5538</link>
    <description>Hi,
the following patch adds the generic GPIO driven matrix keypad driver. I 
tested this on two devices I had available - palmtc and palmt3. It should be 
able to replace corgikbd.c later as well, but I dont have that device. And 
since this is platform independent driver, any chip that makes it's GPIOs 
available through gpiolib should be OK with this driver as well. Please 
consider applying.

Thanks
Marek
</description>
    <dc:creator>Marek Vasut</dc:creator>
    <dc:date>2008-08-16T17:22:35</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5528">
    <title>Remove HID ignore quirk for MGE UPS devices</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5528</link>
    <description>The attached patch reverts the change made four years ago here:
http://www.vg.kernel.org/pub/linux/kernel/people/gregkh/usb/2.4/usb-hid-2.4.25-pre7.patch

UPS's made by MGE can be used with usbhid just fine, and by removing the
ignore quirk allows them to be used with HAL so they just work when plugged
in, without needing to be manually configured.

With the ignore quirk in place a user would have to configure NUT before the
UPS could be used, as NUT uses it's own internal USB matching framework
to match against the USB devices, do low level control messages on the
device and then parse the HID tables all in userspace.

This is not needed, as allowing the device to be claimed as a usbhid device
allows it to be used like any other USB UPS device. The devices correctly
advertise the power device page which can be queried for the device state.

I assume the quirk was changed so that people using &lt; libusb 0.1.8 could
still use NUT's internal HID code to manage the UPS.
libusb 0.1.8 was released quite some time ago: 2004-02-11.

This patch does not break NUT as in drivers/libusb.c the device is force
unbound from the kernel driver using usb_detach_kernel_driver_np () where
it can be controlled like normal.

Signed-off-by: Richard Hughes &lt;rhughes&lt; at &gt;redhat.com&gt;

diff --git a/drivers/hid/usbhid/hid-quirks.c b/drivers/hid/usbhid/hid-quirks.c
index 61e78a4..faf3f4e 100644
--- a/drivers/hid/usbhid/hid-quirks.c
+++ b/drivers/hid/usbhid/hid-quirks.c
&lt; at &gt;&lt; at &gt; -568,8 +568,8 &lt; at &gt;&lt; at &gt; static const struct hid_blacklist {
 { USB_VENDOR_ID_LD, USB_DEVICE_ID_LD_MACHINETEST, HID_QUIRK_IGNORE },
 { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1024LS, HID_QUIRK_IGNORE },
 { USB_VENDOR_ID_MCC, USB_DEVICE_ID_MCC_PMD1208LS, HID_QUIRK_IGNORE },
-{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_IGNORE },
-{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_IGNORE },
+{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS, HID_QUIRK_HIDDEV },
+{ USB_VENDOR_ID_MGE, USB_DEVICE_ID_MGE_UPS1, HID_QUIRK_HIDDEV },
 { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100, HID_QUIRK_IGNORE },
 { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 20, HID_QUIRK_IGNORE },
 { USB_VENDOR_ID_ONTRAK, USB_DEVICE_ID_ONTRAK_ADU100 + 30, HID_QUIRK_IGNORE },


</description>
    <dc:creator>Richard Hughes</dc:creator>
    <dc:date>2008-08-15T11:01:01</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5527">
    <title>[PATCH 1/1] Input/keyboard: add uctional power management support to Blackfin BF54x keypad driver</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5527</link>
    <description>From: Michael Hennerich &lt;michael.hennerich&lt; at &gt;analog.com&gt;

Fix Bug: does nor properply resume after suspend mem
Fix for PM_SUSPEND_MEM: Save and restore peripheral base registers

Signed-off-by: Michael Hennerich &lt;michael.hennerich&lt; at &gt;analog.com&gt;
Signed-off-by: Bryan Wu &lt;cooloney&lt; at &gt;kernel.org&gt;
---
 drivers/input/keyboard/bf54x-keys.c |   13 ++++++++++++-
 1 files changed, 12 insertions(+), 1 deletions(-)

diff --git a/drivers/input/keyboard/bf54x-keys.c b/drivers/input/keyboard/bf54x-keys.c
index 54ed8e2..f1d2081 100644
--- a/drivers/input/keyboard/bf54x-keys.c
+++ b/drivers/input/keyboard/bf54x-keys.c
&lt; at &gt;&lt; at &gt; -8,7 +8,7 &lt; at &gt;&lt; at &gt;
  *
  *
  * Modified:
- *               Copyright 2007 Analog Devices Inc.
+ *               Copyright 2007-2008 Analog Devices Inc.
  *
  * Bugs:         Enter bugs at http://blackfin.uclinux.org/
  *
&lt; at &gt;&lt; at &gt; -82,6 +82,9 &lt; at &gt;&lt; at &gt; struct bf54x_kpad {
 unsigned short *keycode;
 struct timer_list timer;
 unsigned int keyup_test_jiffies;
+unsigned short kpad_msel;
+unsigned short kpad_prescale;
+unsigned short kpad_ctl;
 };
 
 static inline int bfin_kpad_find_key(struct bf54x_kpad *bf54x_kpad,
&lt; at &gt;&lt; at &gt; -361,6 +364,10 &lt; at &gt;&lt; at &gt; static int bfin_kpad_suspend(struct platform_device *pdev, pm_message_t state)
 {
 struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
 
+bf54x_kpad-&gt;kpad_msel = bfin_read_KPAD_MSEL();
+bf54x_kpad-&gt;kpad_prescale = bfin_read_KPAD_PRESCALE();
+bf54x_kpad-&gt;kpad_ctl = bfin_read_KPAD_CTL();
+
 if (device_may_wakeup(&amp;pdev-&gt;dev))
 enable_irq_wake(bf54x_kpad-&gt;irq);
 
&lt; at &gt;&lt; at &gt; -371,6 +378,10 &lt; at &gt;&lt; at &gt; static int bfin_kpad_resume(struct platform_device *pdev)
 {
 struct bf54x_kpad *bf54x_kpad = platform_get_drvdata(pdev);
 
+bfin_write_KPAD_MSEL(bf54x_kpad-&gt;kpad_msel);
+bfin_write_KPAD_PRESCALE(bf54x_kpad-&gt;kpad_prescale);
+bfin_write_KPAD_CTL(bf54x_kpad-&gt;kpad_ctl);
+
 if (device_may_wakeup(&amp;pdev-&gt;dev))
 disable_irq_wake(bf54x_kpad-&gt;irq);
 
</description>
    <dc:creator>Bryan Wu</dc:creator>
    <dc:date>2008-08-15T09:02:39</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5523">
    <title>[git pull] Input updates for 2.6.27-rc0 (round 2)</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5523</link>
    <description>Hi Linus,

Please pull from:

git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input.git for-linus
or
master.kernel.org:/pub/scm/linux/kernel/git/dtor/input.git for-linus

to receive updates for the input subsystem. You will get a bunch of
small fixes, the change to evdev to print an warning abount invalid
parameters to EVIOCGBIT ioctl and a new driver for Macbook Air
touchpads.

Changelog:
---------

Andrew Morton (1):
      Input: xilinx_ps2 - fix warning

Carlos Corbacho (1):
      Input: i8042 - Add Dritek quirk for Acer TravelMate 4280

Dmitry Torokhov (2):
      Input: paper over a bug in Synaptics X driver
      Input: bcm5974 - implement autosuspend support

Harley Laue (1):
      Input: xpad - add Pelican Eclipse D-Pad to the list of devices

Henrik Rydberg (1):
      Input: bcm5974 - add driver for Macbook Air and Pro Penryn touchpads

Linus Torvalds (1):
      Input: evdev - split EVIOCGBIT handlig into a separate function

Mark Brown (1):
      Input: wm97xx - enable sub-drivers by default

Uwe Kleine-König (2):
      Input: gpio-keys - fix possible NULL pointer dereference
      Input: gpio-keys - make gpio_keys_device_driver static


Diffstat:
--------

 drivers/hid/usbhid/hid-quirks.c       |   12 +-
 drivers/input/evdev.c                 |   63 ++-
 drivers/input/joystick/xpad.c         |    1 +
 drivers/input/keyboard/gpio_keys.c    |    3 +-
 drivers/input/mouse/Kconfig           |   23 ++
 drivers/input/mouse/Makefile          |    1 +
 drivers/input/mouse/bcm5974.c         |  681 +++++++++++++++++++++++++++++++++
 drivers/input/serio/i8042-x86ia64io.h |    7 +
 drivers/input/serio/xilinx_ps2.c      |    4 +-
 drivers/input/touchscreen/Kconfig     |   21 +-
 10 files changed, 775 insertions(+), 41 deletions(-)
 create mode 100644 drivers/input/mouse/bcm5974.c

</description>
    <dc:creator>Dmitry Torokhov</dc:creator>
    <dc:date>2008-08-15T02:28:26</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5521">
    <title>[PATCH/RFC]  Resolve 2 year old issue with different demands on EVIOCGRAB</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5521</link>
    <description>
I'll let the comments in the patch below to most of the talking.
This came up because I wanted to use EVIOCGRAB in some code on an
Openmoko Freerunner, and found that EVIOCGRAG does different things on
that kernel to elsewhere.  I looked into why, and found that there was
a good reason but that the issues hadn't been completely resolved.  I
hope to help resolve the issues so that EVIOCGRAB can behave the same
everywhere, and still meet everybody's needs.

I would have Cc:ed to Magnus Vigerlof who wrote the original patch on
which this is based, but his Email address doesn't appear in lkml.org.

NeilBrown



Support multiple styles of input device GRABbing with EVIOCGRAB

From: NeilBrown &lt;neilb&lt; at &gt;suse.de&gt;

This is a 2 year old issue (almost to the day!) which does not
appear to have been properly resolved yet.
See http://lkml.org/lkml/2006/8/12/64

An input device (e.g. touch pad, key board) can be attached to
multiple handlers (/dev/mouseX, console, etc) one of which can be
evdev which provides the /dev/input/event* files.
evdev can support multiple clients on a single device, as multiple
processes can open /dev/input/eventX.  They each get to see all the
events.

EVIOCGRAB is an ioctl on an evdev device which causes all events to go
to that handler, and that client, exclusively.

It is being used for two distinct purposes.

1/ Stop events going to other handlers, so that e.g. absolute touchpad 
   events don't get mapped to relative mouse events.  Keyboard events
   processed by X server don't get processed by console and control-C
   kills the X server.
2/ Stop events going to any other client, so they can temporarily be
   used for a different purpose.  e.g. GRAB all events when putting a
   device partially to sleep (e.g. screen blank) so the events can
   cause a wakeup without being processed by any application.

So there are three levels of grab that are required:

 0/ no grab : all events go to all handlers and all clients
 1/ evdev grab: events only go to evdev, but can then go to any
       client of evdev
 2/ total grab:  events only go to the specific evdev client that
       requested the grab.


0 is the default
mainline allows you to select 2 but not 1.
There is a patch floating around (in the above mail thread, and
in the Openmoko kernel for example) that allows you to select 1, but not 2.

It seems that the "obvious" thing to do is to interpret the argument
to EVIOCGRAB to select between these options.
We cannot use 0, 1, 2 as above - despite the fact that it makes sense
- because that would be a regression in mainline: working programs could break.
Maybe it's best to use 0, 2, 1 and document it clearly.  The chance of
anyone using 2 already has got to be very close to zero.

With this patch in place, clients that are interested in purpose '1'
above would need to be changed to pass '2' to EVIOCGRAB, then (I
think) everyone would be happy.

Note that this patch causes any value other than 0, 1, 2 to return
EINVAL.  I believe this is appropriate defensive practice in general
to allow for future enhancements.  However it does mean that any
current code which uses a value other than 0 or 1 would break.  Is
there any such code?

Note also that it is not possible to switch between '1' and '2'.  A
client must always release the grab first.  Such a switch could be
implemented, but there doesn't seem much point.

Signed-off-by: NeilBrown &lt;neilb&lt; at &gt;suse.de&gt;

---

 drivers/input/evdev.c |   53 ++++++++++++++++++++++++++++++++++++++++---------
 include/linux/input.h |   10 ++++++++-
 2 files changed, 52 insertions(+), 11 deletions(-)


diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index 2d65411..ff4169f 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
&lt; at &gt;&lt; at &gt; -29,6 +29,7 &lt; at &gt;&lt; at &gt; struct evdev {
 struct input_handle handle;
 wait_queue_head_t wait;
 struct evdev_client *grab;
+int grabcnt;
 struct list_head client_list;
 spinlock_t client_lock; /* protects client_list */
 struct mutex mutex;
&lt; at &gt;&lt; at &gt; -39,6 +40,7 &lt; at &gt;&lt; at &gt; struct evdev_client {
 struct input_event buffer[EVDEV_BUFFER_SIZE];
 int head;
 int tail;
+int grab;
 spinlock_t buffer_lock; /* protects access to buffer, head and tail */
 struct fasync_struct *fasync;
 struct evdev *evdev;
&lt; at &gt;&lt; at &gt; -129,17 +131,38 &lt; at &gt;&lt; at &gt; static void evdev_free(struct device *dev)
 }
 
 /*
+ * Grabs an underlying input device for use by evdev only.
+ */
+static int evdev_shared_grab(struct evdev *evdev, struct evdev_client *client)
+{
+int error;
+
+if (client-&gt;grab)
+return -EBUSY;
+
+if (!evdev-&gt;grabcnt) {
+    error = input_grab_device(&amp;evdev-&gt;handle);
+    if (error)
+    return error;
+}
+evdev-&gt;grabcnt++;
+client-&gt;grab = 1;
+
+return 0;
+}
+
+/*
  * Grabs an event device (along with underlying input device).
  * This function is called with evdev-&gt;mutex taken.
  */
-static int evdev_grab(struct evdev *evdev, struct evdev_client *client)
+static int evdev_exclusive_grab(struct evdev *evdev, struct evdev_client *client)
 {
 int error;
 
 if (evdev-&gt;grab)
 return -EBUSY;
 
-error = input_grab_device(&amp;evdev-&gt;handle);
+error = evdev_shared_grab(evdev, client);
 if (error)
 return error;
 
&lt; at &gt;&lt; at &gt; -151,12 +174,17 &lt; at &gt;&lt; at &gt; static int evdev_grab(struct evdev *evdev, struct evdev_client *client)
 
 static int evdev_ungrab(struct evdev *evdev, struct evdev_client *client)
 {
-if (evdev-&gt;grab != client)
+if (!client-&gt;grab)
 return  -EINVAL;
 
-rcu_assign_pointer(evdev-&gt;grab, NULL);
-synchronize_rcu();
-input_release_device(&amp;evdev-&gt;handle);
+if (evdev-&gt;grab == client) {
+rcu_assign_pointer(evdev-&gt;grab, NULL);
+synchronize_rcu();
+}
+
+if (!--evdev-&gt;grabcnt &amp;&amp; evdev-&gt;exist)
+input_release_device(&amp;evdev-&gt;handle);
+client-&gt;grab = 0;
 
 return 0;
 }
&lt; at &gt;&lt; at &gt; -231,7 +259,7 &lt; at &gt;&lt; at &gt; static int evdev_release(struct inode *inode, struct file *file)
 struct evdev *evdev = client-&gt;evdev;
 
 mutex_lock(&amp;evdev-&gt;mutex);
-if (evdev-&gt;grab == client)
+if (client-&gt;grab)
 evdev_ungrab(evdev, client);
 mutex_unlock(&amp;evdev-&gt;mutex);
 
&lt; at &gt;&lt; at &gt; -721,10 +749,15 &lt; at &gt;&lt; at &gt; static long evdev_do_ioctl(struct file *file, unsigned int cmd,
 return 0;
 
 case EVIOCGRAB:
-if (p)
-return evdev_grab(evdev, client);
-else
+switch ((unsigned long)p) {
+case EVG_NONE:
 return evdev_ungrab(evdev, client);
+case EVG_EXCLUSIVE:
+return evdev_exclusive_grab(evdev, client);
+case EVG_SHARED:
+return evdev_shared_grab(evdev, client);
+default: return -EINVAL;
+}
 
 default:
 
diff --git a/include/linux/input.h b/include/linux/input.h
index a5802c9..d1e6a8a 100644
--- a/include/linux/input.h
+++ b/include/linux/input.h
&lt; at &gt;&lt; at &gt; -79,7 +79,7 &lt; at &gt;&lt; at &gt; struct input_absinfo {
 #define EVIOCRMFF_IOW('E', 0x81, int)/* Erase a force effect */
 #define EVIOCGEFFECTS_IOR('E', 0x84, int)/* Report number of effects playable at the same time */
 
-#define EVIOCGRAB_IOW('E', 0x90, int)/* Grab/Release device */
+#define EVIOCGRAB_IOW('E', 0x90, int)/* Grab/Release device. See GRAB types below */
 
 /*
  * Event types
&lt; at &gt;&lt; at &gt; -108,6 +108,14 &lt; at &gt;&lt; at &gt; struct input_absinfo {
 #define SYN_CONFIG1
 
 /*
+ * GRAB types
+ */
+#defineEVG_NONE0/* release any active GRAB */
+#defineEVG_EXCLUSIVE1/* No other handler or evdev gets events */
+#defineEVG_SHARED2/* No other handler gets events, but other
+ * evdev clients still do.
+ */
+/*
  * Keys and buttons
  *
  * Most of the keys/buttons are modeled after USB HUT 1.12
--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>Neil Brown</dc:creator>
    <dc:date>2008-08-15T02:02:09</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5517">
    <title>[PATCH] Make Dell keyboard repeat quirk apply to a wider range of hardware</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5517</link>
    <description>Dell laptops fail to send key up events for several of their special 
keys. There's an existing quirk in the kernel to handle this, but it's 
limited to the Latitude range. This patch extends it to cover all 
portable Dells.

Signed-off-by: Matthew Garrett &lt;mjg&lt; at &gt;redhat.com&gt;

---
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index b1ce10f..e32c24d 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
&lt; at &gt;&lt; at &gt; -834,10 +834,10 &lt; at &gt;&lt; at &gt; static void atkbd_disconnect(struct serio *serio)
 }
 
 /*
- * Most special keys (Fn+F?) on Dell Latitudes do not generate release
+ * Most special keys (Fn+F?) on Dell laptops do not generate release
  * events so we have to do it ourselves.
  */
-static void atkbd_latitude_keymap_fixup(struct atkbd *atkbd)
+static void atkbd_dell_laptop_keymap_fixup(struct atkbd *atkbd)
 {
 const unsigned int forced_release_keys[] = {
 0x85, 0x86, 0x87, 0x88, 0x89, 0x8a, 0x8b, 0x8f, 0x93,
&lt; at &gt;&lt; at &gt; -1461,13 +1461,13 &lt; at &gt;&lt; at &gt; static int __init atkbd_setup_fixup(const struct dmi_system_id *id)
 
 static struct dmi_system_id atkbd_dmi_quirk_table[] __initdata = {
 {
-.ident = "Dell Latitude series",
+.ident = "Dell Laptop",
 .matches = {
 DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
-DMI_MATCH(DMI_PRODUCT_NAME, "Latitude"),
+DMI_MATCH(DMI_CHASSIS_TYPE, "8"), /* Portable */
 },
 .callback = atkbd_setup_fixup,
-.driver_data = atkbd_latitude_keymap_fixup,
+.driver_data = atkbd_dell_laptop_keymap_fixup,
 },
 {
 .ident = "HP 2133",

</description>
    <dc:creator>Matthew Garrett</dc:creator>
    <dc:date>2008-08-14T03:32:55</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5516">
    <title>Confirm Receipt</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5516</link>
    <description>Contact:Mr.Charton Powel for the claim of £100,000,00GBP which you have won in NATIONAL-LOTTERY.

Provide your Names,Address,Age,Occupation,Tel,Country.send to Email: directiveboardoffice&lt; at &gt;yahoo.co.uk

--
To unsubscribe from this list: send the line "unsubscribe linux-input" in
the body of a message to majordomo&lt; at &gt;vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

</description>
    <dc:creator>Powerball</dc:creator>
    <dc:date>2008-08-14T00:38:53</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5515">
    <title>[PATCH 3/3] OLPC: touchpad driver (take 2)</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5515</link>
    <description>
This adds support for OLPC's touchpad.  It has lots of neat features,
none of which are enabled because the hardware is too buggy.  Instead,
we use it like a normal touchpad, but with a number of workarounds in
place to deal with the frequent hardware spasms.  Humidity changes,
sweat, tinfoil underwear, plugging in AC, drinks, evil felines.. All
tend to cause the touchpad to freak out.

Stuff like this keeps me from getting bored.

We make use of psmouse_set_state and psmouse_queue_work quite a bit.

(also, extension renamed from olpc.c to hgpk.c)

Signed-off-by: Andres Salomon &lt;dilinger&lt; at &gt;debian.org&gt;
---
 drivers/input/mouse/Kconfig        |   10 +
 drivers/input/mouse/Makefile       |    1 +
 drivers/input/mouse/hgpk.c         |  492 ++++++++++++++++++++++++++++++++++++
 drivers/input/mouse/hgpk.h         |   48 ++++
 drivers/input/mouse/psmouse-base.c |   23 ++-
 drivers/input/mouse/psmouse.h      |    2 +-
 6 files changed, 574 insertions(+), 2 deletions(-)
 create mode 100644 drivers/input/mouse/hgpk.c
 create mode 100644 drivers/input/mouse/hgpk.h

diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 7bbea09..fff0253 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
&lt; at &gt;&lt; at &gt; -96,6 +96,16 &lt; at &gt;&lt; at &gt; config MOUSE_PS2_TOUCHKIT
 
   If unsure, say N.
 
+config MOUSE_PS2_OLPC
+bool "OLPC PS/2 mouse protocol extension"
+depends on MOUSE_PS2 &amp;&amp; OLPC
+help
+  Say Y here if you have an OLPC XO-1 laptop (with built-in
+  PS/2 touchpad/tablet device).  The manufacturer calls the
+  touchpad an HGPK.
+
+  If unsure, say N.
+
 config MOUSE_SERIAL
 tristate "Serial mouse"
 select SERIO
diff --git a/drivers/input/mouse/Makefile b/drivers/input/mouse/Makefile
index 9e6e363..799aa3f 100644
--- a/drivers/input/mouse/Makefile
+++ b/drivers/input/mouse/Makefile
&lt; at &gt;&lt; at &gt; -24,3 +24,4 &lt; at &gt;&lt; at &gt; psmouse-$(CONFIG_MOUSE_PS2_LOGIPS2PP)+= logips2pp.o
 psmouse-$(CONFIG_MOUSE_PS2_LIFEBOOK)+= lifebook.o
 psmouse-$(CONFIG_MOUSE_PS2_TRACKPOINT)+= trackpoint.o
 psmouse-$(CONFIG_MOUSE_PS2_TOUCHKIT)+= touchkit_ps2.o
+psmouse-$(CONFIG_MOUSE_PS2_OLPC)+= hgpk.o
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c
new file mode 100644
index 0000000..ac7c2a8
--- /dev/null
+++ b/drivers/input/mouse/hgpk.c
&lt; at &gt;&lt; at &gt; -0,0 +1,492 &lt; at &gt;&lt; at &gt;
+/*
+ * OLPC HGPK (XO-1) touchpad PS/2 mouse driver
+ *
+ * Copyright (c) 2006-2008 One Laptop Per Child
+ * Authors:
+ *   Zephaniah E. Hull
+ *   Andres Salomon &lt;dilinger&lt; at &gt;debian.org&gt;
+ *
+ * This driver is partly based on the ALPS driver, which is:
+ *
+ * Copyright (c) 2003 Neil Brown &lt;neilb&lt; at &gt;cse.unsw.edu.au&gt;
+ * Copyright (c) 2003-2005 Peter Osterlund &lt;petero2&lt; at &gt;telia.com&gt;
+ * Copyright (c) 2004 Dmitry Torokhov &lt;dtor&lt; at &gt;mail.ru&gt;
+ * Copyright (c) 2005 Vojtech Pavlik &lt;vojtech&lt; at &gt;suse.cz&gt;
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License version 2 as
+ * published by the Free Software Foundation.
+ */
+
+/*
+ * The spec from ALPS is available from
+ * &lt;http://wiki.laptop.org/go/Touch_Pad/Tablet&gt;.  It refers to this
+ * device as HGPK (Hybrid GS, PT, and Keymatrix).
+ *
+ * The earliest versions of the device had simultaneous reporting; that
+ * was removed.  After that, the device used the Advanced Mode GS/PT streaming
+ * stuff.  That turned out to be too buggy to support, so we've finally
+ * switched to Mouse Mode (which utilizes only the center 1/3 of the touchpad).
+ */
+
+#define DEBUG
+#include &lt;linux/input.h&gt;
+#include &lt;linux/serio.h&gt;
+#include &lt;linux/libps2.h&gt;
+#include &lt;linux/delay.h&gt;
+#include &lt;asm/olpc.h&gt;
+
+#include "psmouse.h"
+#include "hgpk.h"
+
+static int tpdebug;
+module_param(tpdebug, int, 0644);
+MODULE_PARM_DESC(tpdebug, "enable debugging, dumping packets to KERN_DEBUG.");
+
+static int recalib_delta = 100;
+module_param(recalib_delta, int, 0644);
+MODULE_PARM_DESC(recalib_delta,
+"packets containing a delta this large will cause a recalibration.");
+
+/*
+ * When the touchpad gets ultra-sensitive, one can keep their finger 1/2"
+ * above the pad and still have it send packets.  This causes a jump cursor
+ * when one places their finger on the pad.  We can probably detect the
+ * jump as we see a large deltas (&gt;= 100px).  In mouse mode, I've been
+ * unable to even come close to 100px deltas during normal usage, so I think
+ * this threshold is safe.  If a large delta occurs, trigger a recalibration.
+ */
+static void hgpk_jumpy_hack(struct psmouse *psmouse, int x, int y)
+{
+struct hgpk_data *priv = psmouse-&gt;private;
+
+if (abs(x) &gt; recalib_delta || abs(y) &gt; recalib_delta) {
+hgpk_err(psmouse, "&gt;%dpx jump detected (%d,%d)\n",
+recalib_delta, x, y);
+/* My car gets forty rods to the hogshead and that's the
+ * way I likes it! */
+psmouse_queue_work(psmouse, &amp;priv-&gt;recalib_wq,
+msecs_to_jiffies(1000));
+}
+}
+
+/*
+ * We have no idea why this particular hardware bug occurs.  The touchpad
+ * will randomly start spewing packets without anything touching the
+ * pad.  This wouldn't necessarily be bad, but it's indicative of a
+ * severely miscalibrated pad; attempting to use the touchpad while it's
+ * spewing means the cursor will jump all over the place, and act "drunk".
+ *
+ * The packets that are spewed tend to all have deltas between -2 and 2, and
+ * the cursor will move around without really going very far.  It will
+ * tend to end up in the same location; if we tally up the changes over
+ * 100 packets, we end up w/ a final delta of close to 0.  This happens
+ * pretty regularly when the touchpad is spewing, and is pretty hard to
+ * manually trigger (at least for *my* fingers).  So, it makes a perfect
+ * scheme for detecting spews.
+ */
+static void hgpk_spewing_hack(struct psmouse *psmouse, int l, int r, int x,
+int y)
+{
+struct hgpk_data *priv = psmouse-&gt;private;
+static int count;
+static int x_tally;
+static int y_tally;
+
+/* ignore button press packets; many in a row could trigger
+ * a false-positive! */
+if (l || r)
+return;
+
+count++;
+x_tally += x;
+y_tally += y;
+if (count &gt; 100) {
+if (abs(x_tally) &lt; 3 &amp;&amp; abs(y_tally) &lt; 3) {
+hgpk_dbg(psmouse, "packet spew detected (%d,%d). :(\n",
+x_tally, y_tally);
+psmouse_queue_work(psmouse, &amp;priv-&gt;recalib_wq,
+msecs_to_jiffies(1000));
+}
+/* reset every 100 packets */
+count = 0;
+x_tally = 0;
+y_tally = 0;
+}
+}
+
+/*
+ * HGPK Mouse Mode format (standard mouse format, sans middle button)
+ *
+ * byte 0:y-overx-overy-negx-neg10swrswl
+ * byte 1:x7x6x5x4x3x2x1x0
+ * byte 2:y7y6y5y4y3y2y1y0
+ *
+ * swr/swl are the left/right buttons.
+ * x-neg/y-neg are the x and y delta negative bits
+ * x-over/y-over are the x and y overflow bits
+ */
+static int hgpk_validate_byte(unsigned char *packet)
+{
+if (!(packet[0] &amp; (1&lt;&lt;3)) || (packet[0] &amp; (1&lt;&lt;2)))
+return -1;
+
+return 0;
+}
+
+static void hgpk_process_packet(struct psmouse *psmouse)
+{
+struct input_dev *dev = psmouse-&gt;dev;
+unsigned char *packet = psmouse-&gt;packet;
+int x, y, left, right;
+
+left = packet[0] &amp; 1;
+right = (packet[0] &gt;&gt; 1) &amp; 1;
+
+x = packet[1] - ((packet[0] &lt;&lt; 4) &amp; 0x100);
+y = ((packet[0] &lt;&lt; 3) &amp; 0x100) - packet[2];
+
+hgpk_jumpy_hack(psmouse, x, y);
+hgpk_spewing_hack(psmouse, left, right, x, y);
+
+if (tpdebug)
+hgpk_dbg(psmouse, "l=%d r=%d x=%d y=%d\n", left, right, x, y);
+
+input_report_key(dev, BTN_LEFT, left);
+input_report_key(dev, BTN_RIGHT, right);
+
+input_report_rel(dev, REL_X, x);
+input_report_rel(dev, REL_Y, y);
+
+input_sync(dev);
+}
+
+static psmouse_ret_t hgpk_process_byte(struct psmouse *psmouse)
+{
+struct hgpk_data *priv = psmouse-&gt;private;
+
+if (hgpk_validate_byte(psmouse-&gt;packet)) {
+hgpk_dbg(psmouse, "%s: (%d) %02x %02x %02x\n",
+__func__, psmouse-&gt;pktcnt, psmouse-&gt;packet[0],
+psmouse-&gt;packet[1], psmouse-&gt;packet[2]);
+return PSMOUSE_BAD_DATA;
+}
+
+if (psmouse-&gt;pktcnt &gt;= psmouse-&gt;pktsize) {
+hgpk_process_packet(psmouse);
+return PSMOUSE_FULL_PACKET;
+}
+
+if (priv-&gt;recalib_window) {
+if (time_before(jiffies, priv-&gt;recalib_window)) {
+/*
+ * ugh, got a packet inside our recalibration
+ * window, schedule another recalibration.
+ */
+hgpk_dbg(psmouse, "packet inside calibration window, queueing another recalibration\n");
+psmouse_queue_work(psmouse, &amp;priv-&gt;recalib_wq,
+msecs_to_jiffies(1000));
+}
+priv-&gt;recalib_window = 0;
+}
+
+return PSMOUSE_GOOD_DATA;
+}
+
+static int hgpk_force_recalibrate(struct psmouse *psmouse)
+{
+struct ps2dev *ps2dev = &amp;psmouse-&gt;ps2dev;
+struct hgpk_data *priv = psmouse-&gt;private;
+
+/* C-series touchpads added the recalibrate command */
+if (psmouse-&gt;model &lt; HGPK_MODEL_C)
+return 0;
+
+/* we don't want to race with the irq handler, nor with resyncs */
+psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
+
+/* start by resetting the device */
+psmouse_reset(psmouse);
+
+/* send the recalibrate request */
+if (ps2_command(ps2dev, NULL, 0xf5) ||
+ps2_command(ps2dev, NULL, 0xf5) ||
+ps2_command(ps2dev, NULL, 0xe6) ||
+ps2_command(ps2dev, NULL, 0xf5))
+return -1;
+
+
+/* according to ALPS, 150mS is required for recalibration */
+msleep(150);
+
+/* XXX: If a finger is down during this delay, recalibration will
+ * detect capacitance incorrectly.  This is a hardware bug, and
+ * we don't have a good way to deal with it.  The 2s window stuff
+ * (below) is our best option for now.
+ */
+
+if (ps2_command(ps2dev, NULL, PSMOUSE_CMD_ENABLE))
+return -1;
+
+psmouse_set_state(psmouse, PSMOUSE_ACTIVATED);
+
+/* After we recalibrate, we shouldn't get any packets for 2s.  If
+ * we do, it's likely that someone's finger was on the touchpad.
+ * If someone's finger *was* on the touchpad, it's probably
+ * miscalibrated.  So, we should schedule another recalibration
+ */
+priv-&gt;recalib_window = jiffies +  msecs_to_jiffies(2000);
+
+return 0;
+}
+
+/*
+ * This kills power to the touchpad; according to ALPS, current consumption
+ * goes down to 50uA after running this.  To turn power back on, we drive
+ * MS-DAT low.
+ */
+static int hgpk_toggle_power(struct psmouse *psmouse, int enable)
+{
+struct ps2dev *ps2dev = &amp;psmouse-&gt;ps2dev;
+int timeo;
+
+/* Added on D-series touchpads */
+if (psmouse-&gt;model &lt; HGPK_MODEL_D)
+return 0;
+
+if (enable) {
+psmouse_set_state(psmouse, PSMOUSE_INITIALIZING);
+
+/*
+ * Sending a byte will drive MS-DAT low; this will wake up
+ * the controller.  Once we get an ACK back from it, it
+ * means we can continue with the touchpad re-init.  ALPS
+ * tells us that 1s should be long enough, so set that as
+ * the upper bound.
+ */
+for (timeo = 20; timeo &gt; 0; timeo--) {
+if (!ps2_sendbyte(&amp;psmouse-&gt;ps2dev,
+PSMOUSE_CMD_DISABLE, 20))
+break;
+msleep(50);
+}
+
+psmouse_reset(psmouse);
+
+} else {
+hgpk_dbg(psmouse, "Powering off touchpad.\n");
+psmouse_set_state(psmouse, PSMOUSE_IGNORE);
+
+if (ps2_command(ps2dev, NULL, 0xec) ||
+ps2_command(ps2dev, NULL, 0xec) ||
+ps2_command(ps2dev, NULL, 0xea))
+return -1;
+/* probably won't see an ACK, the touchpad will be off */
+ps2_sendbyte(&amp;psmouse-&gt;ps2dev, 0xec, 20);
+}
+
+return 0;
+}
+
+static int hgpk_poll(struct psmouse *psmouse)
+{
+/* We can't poll, so always return failure. */
+return -1;
+}
+
+static int hgpk_reconnect(struct psmouse *psmouse)
+{
+if (olpc_board_at_least(olpc_board(0xb2)))
+if (psmouse-&gt;ps2dev.serio-&gt;dev.power.power_state.event !=
+PM_EVENT_ON)
+return 0;
+
+psmouse_reset(psmouse);
+return 0;
+}
+
+static ssize_t hgpk_show_powered(struct device *dev,
+struct device_attribute *attr, char *buf)
+{
+struct serio *serio = to_serio_port(dev);
+struct psmouse *psmouse;
+struct hgpk_data *priv;
+int retval;
+
+retval = serio_pin_driver(serio);
+if (retval)
+return retval;
+
+psmouse = serio_get_drvdata(serio);
+priv = psmouse-&gt;private;
+
+retval = sprintf(buf, "%d\n", priv-&gt;powered);
+serio_unpin_driver(serio);
+return retval;
+}
+
+static ssize_t hgpk_set_powered(struct device *dev,
+struct device_attribute *attr, const char *buf, size_t count)
+{
+struct serio *serio = to_serio_port(dev);
+struct psmouse *psmouse;
+struct hgpk_data *priv;
+unsigned long val;
+int retval;
+
+if (*buf == '1')
+val = 1;
+else if (*buf == '0')
+val = 0;
+else
+return -EINVAL;
+
+retval = serio_pin_driver(serio);
+if (retval)
+return retval;
+
+psmouse = serio_get_drvdata(serio);
+priv = psmouse-&gt;private;
+
+if (val == priv-&gt;powered)
+goto done;
+
+/* hgpk_toggle_power will deal w/ state so we're not racing w/ irq */
+retval = hgpk_toggle_power(psmouse, val);
+if (!retval)
+priv-&gt;powered = val;
+
+done:
+serio_unpin_driver(serio);
+return retval ? retval : count;
+}
+
+static DEVICE_ATTR(powered, S_IWUSR | S_IRUGO, hgpk_show_powered,
+hgpk_set_powered);
+
+static void hgpk_disconnect(struct psmouse *psmouse)
+{
+struct hgpk_data *priv = psmouse-&gt;private;
+
+device_remove_file(&amp;psmouse-&gt;ps2dev.serio-&gt;dev, &amp;dev_attr_powered);
+psmouse_reset(psmouse);
+flush_scheduled_work();
+kfree(priv);
+}
+
+static void hgpk_recalib_work(struct work_struct *work)
+{
+struct delayed_work *w = container_of(work, struct delayed_work, work);
+struct hgpk_data *priv = container_of(w, struct hgpk_data, recalib_wq);
+struct psmouse *psmouse = priv-&gt;psmouse;
+
+hgpk_dbg(psmouse, "recalibrating touchpad..\n");
+
+if (hgpk_force_recalibrate(psmouse))
+hgpk_err(psmouse, "recalibration failed!\n");
+}
+
+static int hgpk_register(struct psmouse *psmouse)
+{
+struct input_dev *dev = psmouse-&gt;dev;
+int err;
+
+/* unset the things that psmouse-base sets which we don't have */
+clear_bit(BTN_MIDDLE, dev-&gt;keybit);
+
+/* set the things we do have */
+set_bit(EV_KEY, dev-&gt;evbit);
+set_bit(EV_REL, dev-&gt;evbit);
+
+set_bit(REL_X, dev-&gt;relbit);
+set_bit(REL_Y, dev-&gt;relbit);
+
+set_bit(BTN_LEFT, dev-&gt;keybit);
+set_bit(BTN_RIGHT, dev-&gt;keybit);
+
+/* register handlers */
+psmouse-&gt;protocol_handler = hgpk_process_byte;
+psmouse-&gt;poll = hgpk_poll;
+psmouse-&gt;disconnect = hgpk_disconnect;
+psmouse-&gt;reconnect = hgpk_reconnect;
+psmouse-&gt;pktsize = 3;
+
+/* Disable the idle resync. */
+psmouse-&gt;resync_time = 0;
+/* Reset after a lot of bad bytes. */
+psmouse-&gt;resetafter = 1024;
+
+err = device_create_file(&amp;psmouse-&gt;ps2dev.serio-&gt;dev,
+&amp;dev_attr_powered);
+if (err)
+hgpk_err(psmouse, "Failed to create sysfs attribute\n");
+
+return err;
+}
+
+int hgpk_init(struct psmouse *psmouse)
+{
+struct hgpk_data *priv;
+int err = -ENOMEM;
+
+priv = kzalloc(sizeof(struct hgpk_data), GFP_KERNEL);
+if (!priv)
+goto alloc_fail;
+
+psmouse-&gt;private = priv;
+priv-&gt;psmouse = psmouse;
+priv-&gt;powered = 1;
+INIT_DELAYED_WORK(&amp;priv-&gt;recalib_wq, hgpk_recalib_work);
+
+err = psmouse_reset(psmouse);
+if (err)
+goto init_fail;
+err = hgpk_register(psmouse);
+if (err)
+goto init_fail;
+
+return 0;
+
+init_fail:
+kfree(priv);
+alloc_fail:
+return err;
+}
+
+static enum hgpk_model_t hgpk_get_model(struct psmouse *psmouse)
+{
+struct ps2dev *ps2dev = &amp;psmouse-&gt;ps2dev;
+unsigned char param[3];
+
+/* E7, E7, E7, E9 gets us a 3 byte identifier */
+if (ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE21) ||
+ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE21) ||
+ps2_command(ps2dev,  NULL, PSMOUSE_CMD_SETSCALE21) ||
+ps2_command(ps2dev, param, PSMOUSE_CMD_GETINFO))
+return -EIO;
+
+hgpk_dbg(psmouse, "ID: %02x %02x %02x", param[0], param[1], param[2]);
+
+/* HGPK signature: 0x67, 0x00, 0x&lt;model&gt; */
+if (param[0] != 0x67 || param[1] != 0x00)
+return -ENODEV;
+
+hgpk_info(psmouse, "OLPC touchpad revision 0x%x\n", param[2]);
+return param[2];
+}
+
+int hgpk_detect(struct psmouse *psmouse, int set_properties)
+{
+int version;
+
+version = hgpk_get_model(psmouse);
+if (version &lt; 0)
+return version;
+
+if (set_properties) {
+psmouse-&gt;vendor = "ALPS";
+psmouse-&gt;name = "HGPK";
+psmouse-&gt;model = version;
+}
+return 0;
+}
diff --git a/drivers/input/mouse/hgpk.h b/drivers/input/mouse/hgpk.h
new file mode 100644
index 0000000..2b1f074
--- /dev/null
+++ b/drivers/input/mouse/hgpk.h
&lt; at &gt;&lt; at &gt; -0,0 +1,48 &lt; at &gt;&lt; at &gt;
+/*
+ * OLPC HGPK (XO-1) touchpad PS/2 mouse driver
+ */
+
+#ifndef _HGPK_H
+#define _HGPK_H
+
+enum hgpk_model_t {
+HGPK_MODEL_PREA = 0x0a,/* pre-B1s */
+HGPK_MODEL_A = 0x14,/* found on B1s, PT disabled in hardware */
+HGPK_MODEL_B = 0x28,/* B2s, has capacitance issues */
+HGPK_MODEL_C = 0x3c,
+HGPK_MODEL_D = 0x50,/* C1, mass production */
+};
+
+struct hgpk_data {
+struct psmouse *psmouse;
+int powered;
+unsigned long recalib_window;
+struct delayed_work recalib_wq;
+};
+
+#define hgpk_dbg(psmouse, format, arg...)\
+dev_dbg(&amp;(psmouse)-&gt;ps2dev.serio-&gt;dev, format, ## arg)
+#define hgpk_err(psmouse, format, arg...)\
+dev_err(&amp;(psmouse)-&gt;ps2dev.serio-&gt;dev, format, ## arg)
+#define hgpk_info(psmouse, format, arg...)\
+dev_info(&amp;(psmouse)-&gt;ps2dev.serio-&gt;dev, format, ## arg)
+#define hgpk_warn(psmouse, format, arg...)\
+dev_warn(&amp;(psmouse)-&gt;ps2dev.serio-&gt;dev, format, ## arg)
+#define hgpk_notice(psmouse, format, arg...)\
+dev_notice(&amp;(psmouse)-&gt;ps2dev.serio-&gt;dev, format, ## arg)
+
+#ifdef CONFIG_MOUSE_PS2_OLPC
+int hgpk_detect(struct psmouse *psmouse, int set_properties);
+int hgpk_init(struct psmouse *psmouse);
+#else
+static inline int hgpk_detect(struct psmouse *psmouse, int set_properties)
+{
+return -ENODEV;
+}
+static inline int hgpk_init(struct psmouse *psmouse)
+{
+return -ENODEV;
+}
+#endif
+
+#endif
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 488ba95..2864678 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
&lt; at &gt;&lt; at &gt; -25,6 +25,7 &lt; at &gt;&lt; at &gt;
 #include "synaptics.h"
 #include "logips2pp.h"
 #include "alps.h"
+#include "hgpk.h"
 #include "lifebook.h"
 #include "trackpoint.h"
 #include "touchkit_ps2.h"
&lt; at &gt;&lt; at &gt; -636,8 +637,20 &lt; at &gt;&lt; at &gt; static int psmouse_extensions(struct psmouse *psmouse,
 }
 }
 
-if (max_proto &gt; PSMOUSE_IMEX) {
+/*
+ * Try OLPC HGPK touchpad.
+ */
+if (max_proto &gt; PSMOUSE_IMEX &amp;&amp;
+hgpk_detect(psmouse, set_properties) == 0) {
+if (!set_properties || hgpk_init(psmouse) == 0)
+return PSMOUSE_HGPK;
+/*
+ * Init failed, try basic relative protocols
+ */
+max_proto = PSMOUSE_IMEX;
+}
 
+if (max_proto &gt; PSMOUSE_IMEX) {
 if (genius_detect(psmouse, set_properties) == 0)
 return PSMOUSE_GENPS;
 
&lt; at &gt;&lt; at &gt; -768,6 +781,14 &lt; at &gt;&lt; at &gt; static const struct psmouse_protocol psmouse_protocols[] = {
 .detect= touchkit_ps2_detect,
 },
 #endif
+#ifdef CONFIG_MOUSE_PS2_OLPC
+{
+.type= PSMOUSE_HGPK,
+.name= "OLPC HGPK",
+.alias= "hgpk",
+.detect= hgpk_detect,
+},
+#endif
 {
 .type= PSMOUSE_CORTRON,
 .name= "CortronPS/2",
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 48e0112..dfdc89d 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
&lt; at &gt;&lt; at &gt; -89,6 +89,7 &lt; at &gt;&lt; at &gt; enum psmouse_type {
 PSMOUSE_TRACKPOINT,
 PSMOUSE_TOUCHKIT_PS2,
 PSMOUSE_CORTRON,
+PSMOUSE_HGPK,
 PSMOUSE_AUTO/* This one should always be last */
 };
 
&lt; at &gt;&lt; at &gt; -99,7 +100,6 &lt; at &gt;&lt; at &gt; int psmouse_reset(struct psmouse *psmouse);
 void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state);
 void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution);
 
-
 struct psmouse_attribute {
 struct device_attribute dattr;
 void *data;
</description>
    <dc:creator>Andres Salomon</dc:creator>
    <dc:date>2008-08-13T19:24:59</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5514">
    <title>[PATCH 2/3] psmouse: add psmouse_queue_work() for ps/2 extension to make use of</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5514</link>
    <description>
psmouse_queue_work is passed a delayed_work struct, and queues up the work
with kpsmouse_wq.  Since we're dealing with delayed_work stuff, this
also switches resync_work to a delayed_work struct as well, and makes
use of psmouse_queue_work when doing a resync within psmouse-base.

Dmitry, is this what you had in mind?

Signed-off-by: Andres Salomon &lt;dilinger&lt; at &gt;debian.org&gt;
---
 drivers/input/mouse/psmouse-base.c |   14 ++++++++++----
 drivers/input/mouse/psmouse.h      |    4 +++-
 2 files changed, 13 insertions(+), 5 deletions(-)

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index 960f2da..488ba95 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
&lt; at &gt;&lt; at &gt; -201,6 +201,12 &lt; at &gt;&lt; at &gt; static psmouse_ret_t psmouse_process_byte(struct psmouse *psmouse)
 return PSMOUSE_FULL_PACKET;
 }
 
+void psmouse_queue_work(struct psmouse *psmouse, struct delayed_work *work,
+unsigned long delay)
+{
+queue_delayed_work(kpsmoused_wq, work, delay);
+}
+
 /*
  * __psmouse_set_state() sets new psmouse state and resets all flags.
  */
&lt; at &gt;&lt; at &gt; -305,7 +311,7 &lt; at &gt;&lt; at &gt; static irqreturn_t psmouse_interrupt(struct serio *serio,
        psmouse-&gt;name, psmouse-&gt;phys, psmouse-&gt;pktcnt);
 psmouse-&gt;badbyte = psmouse-&gt;packet[0];
 __psmouse_set_state(psmouse, PSMOUSE_RESYNCING);
-queue_work(kpsmoused_wq, &amp;psmouse-&gt;resync_work);
+psmouse_queue_work(psmouse, &amp;psmouse-&gt;resync_work, 0);
 goto out;
 }
 
&lt; at &gt;&lt; at &gt; -342,7 +348,7 &lt; at &gt;&lt; at &gt; static irqreturn_t psmouse_interrupt(struct serio *serio,
     time_after(jiffies, psmouse-&gt;last + psmouse-&gt;resync_time * HZ)) {
 psmouse-&gt;badbyte = psmouse-&gt;packet[0];
 __psmouse_set_state(psmouse, PSMOUSE_RESYNCING);
-queue_work(kpsmoused_wq, &amp;psmouse-&gt;resync_work);
+psmouse_queue_work(psmouse, &amp;psmouse-&gt;resync_work, 0);
 goto out;
 }
 
&lt; at &gt;&lt; at &gt; -935,7 +941,7 &lt; at &gt;&lt; at &gt; static int psmouse_poll(struct psmouse *psmouse)
 static void psmouse_resync(struct work_struct *work)
 {
 struct psmouse *parent = NULL, *psmouse =
-container_of(work, struct psmouse, resync_work);
+container_of(work, struct psmouse, resync_work.work);
 struct serio *serio = psmouse-&gt;ps2dev.serio;
 psmouse_ret_t rc = PSMOUSE_GOOD_DATA;
 int failed = 0, enabled = 0;
&lt; at &gt;&lt; at &gt; -1194,7 +1200,7 &lt; at &gt;&lt; at &gt; static int psmouse_connect(struct serio *serio, struct serio_driver *drv)
 goto err_free;
 
 ps2_init(&amp;psmouse-&gt;ps2dev, serio);
-INIT_WORK(&amp;psmouse-&gt;resync_work, psmouse_resync);
+INIT_DELAYED_WORK(&amp;psmouse-&gt;resync_work, psmouse_resync);
 psmouse-&gt;dev = input_dev;
 snprintf(psmouse-&gt;phys, sizeof(psmouse-&gt;phys), "%s/input0", serio-&gt;phys);
 
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index ed40415..48e0112 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
&lt; at &gt;&lt; at &gt; -39,7 +39,7 &lt; at &gt;&lt; at &gt; struct psmouse {
 void *private;
 struct input_dev *dev;
 struct ps2dev ps2dev;
-struct work_struct resync_work;
+struct delayed_work resync_work;
 char *vendor;
 char *name;
 unsigned char packet[8];
&lt; at &gt;&lt; at &gt; -92,6 +92,8 &lt; at &gt;&lt; at &gt; enum psmouse_type {
 PSMOUSE_AUTO/* This one should always be last */
 };
 
+void psmouse_queue_work(struct psmouse *psmouse, struct delayed_work *work,
+unsigned long delay);
 int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command);
 int psmouse_reset(struct psmouse *psmouse);
 void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state);
</description>
    <dc:creator>Andres Salomon</dc:creator>
    <dc:date>2008-08-13T19:24:50</dc:date>
  </item>
  <item rdf:about="http://comments.gmane.org/gmane.linux.kernel.input/5513">
    <title>[PATCH 1/3] psmouse: export psmouse_set_state for ps/2 extensions to use</title>
    <link>http://comments.gmane.org/gmane.linux.kernel.input/5513</link>
    <description>
Signed-off-by: Andres Salomon &lt;dilinger&lt; at &gt;debian.org&gt;
---
 drivers/input/mouse/psmouse-base.c |    2 +-
 drivers/input/mouse/psmouse.h      |    1 +
 2 files changed, 2 insertions(+), 1 deletions(-)

diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index f5a6be1..960f2da 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
&lt; at &gt;&lt; at &gt; -220,7 +220,7 &lt; at &gt;&lt; at &gt; static inline void __psmouse_set_state(struct psmouse *psmouse, enum psmouse_sta
  * is not a concern.
  */
 
-static void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state)
+void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state)
 {
 serio_pause_rx(psmouse-&gt;ps2dev.serio);
 __psmouse_set_state(psmouse, new_state);
diff --git a/drivers/input/mouse/psmouse.h b/drivers/input/mouse/psmouse.h
index 1317bdd..ed40415 100644
--- a/drivers/input/mouse/psmouse.h
+++ b/drivers/input/mouse/psmouse.h
&lt; at &gt;&lt; at &gt; -94,6 +94,7 &lt; at &gt;&lt; at &gt; enum psmouse_type {
 
 int psmouse_sliced_command(struct psmouse *psmouse, unsigned char command);
 int psmouse_reset(struct psmouse *psmouse);
+void psmouse_set_state(struct psmouse *psmouse, enum psmouse_state new_state);
 void psmouse_set_resolution(struct psmouse *psmouse, unsigned int resolution);
 
 
</description>
    <dc:creator>Andres Salomon</dc:creator>
    <dc:date>2008-08-13T19:24:43</dc:date>
  </item>
  <textinput rdf:about="http://search.gmane.org/?group=$group=gmane.linux.kernel.input">
    <title>Search Engine</title>
    <description>Search the mailing list at Gmane</description>
    <name>query</name>
    <link>http://search.gmane.org/?group=$group=gmane.linux.kernel.input</link>
  </textinput>
</rdf:RDF>
