OLPC: psmouse: touchpad driver
Subsystems (2)
PATCH 1/1 OLPC: psmouse: touchpad driver
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.
Quoted 1 line
From psmouse-base, we use
psmouse_set_statequite a bit, as well
as piggy-backing off of kpsmoused_wq; so, this also makes those available to protocol extensions.
--- drivers/input/mouse/Kconfig | 9 + drivers/input/mouse/Makefile | 1 + drivers/input/mouse/olpc.c | 492 ++++++++++++++++++++++++++++++++++++ drivers/input/mouse/olpc.h | 48 ++++ drivers/input/mouse/psmouse-base.c | 27 ++- drivers/input/mouse/psmouse.h | 3 + 6 files changed, 577 insertions(+), 3 deletions(-) create mode 100644 drivers/input/mouse/olpc.c create mode 100644 drivers/input/mouse/olpc.h
drivers/input/mouse/Kconfig +9 -0
@@ -96,6 +96,15 @@ config MOUSE_PS2_TOUCHKIT If unsure, say N. +config MOUSE_PS2_OLPC + bool "OLPC PS/2 mouse protocol extension" + depends on MOUSE_PS2 && OLPC + help + Say Y here if you have an OLPC XO-1 laptop (with built-in + PS/2 touchpad/tablet device). + + If unsure, say N. + config MOUSE_SERIAL tristate "Serial mouse" select SERIO
drivers/input/mouse/Makefile +1 -0
@@ -24,3 +24,4 @@ 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) += olpc.o
drivers/input/mouse/olpc.c new file +492 -0
492 lines not on this page · raw message
drivers/input/mouse/olpc.h new file +48 -0
48 lines not on this page · raw message
drivers/input/mouse/psmouse-base.c +24 -3
@@ -25,6 +25,7 @@#include "synaptics.h" #include "logips2pp.h" #include "alps.h" +#include "olpc.h" #include "lifebook.h" #include "trackpoint.h" #include "touchkit_ps2.h"
@@ -102,7 +103,7 @@ static struct attribute_group psmouse_attribute_group = {*/ static DEFINE_MUTEX (psmouse_mutex); -static struct workqueue_struct *kpsmoused_wq; +struct workqueue_struct *kpsmoused_wq;struct psmouse_protocol {enum psmouse_type type;
@@ -220,7 +221,7 @@ 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->ps2dev.serio);__psmouse_set_state (psmouse, new_state);
@@ -630,8 +631,20 @@ static int psmouse_extensions(struct psmouse *psmouse, } } -if (max_proto >PSMOUSE_IMEX ) { +/* +* Try OLPC touchpad. +*/ +if (max_proto >PSMOUSE_IMEX && +olpc_detect (psmouse, set_properties) ==0 ) { +if (!set_properties ||olpc_init (psmouse) ==0 ) +return PSMOUSE_OLPC ; +/* +* Init failed, try basic relative protocols +*/ + max_proto =PSMOUSE_IMEX ; + } +if (max_proto >PSMOUSE_IMEX ) {if (genius_detect (psmouse, set_properties) ==0 )return PSMOUSE_GENPS ;
@@ -762,6 +775,14 @@ static const struct psmouse_protocol psmouse_protocols[] = { .detect = touchkit_ps2_detect, },#endif +#ifdef CONFIG_MOUSE_PS2_OLPC + { + .type = PSMOUSE_OLPC, + .name = "OLPC", + .alias = "olpc", + .detect = olpc_detect, + }, +#endif { .type = PSMOUSE_CORTRON, .name = "CortronPS/2",
drivers/input/mouse/psmouse.h +3 -0
@@ -89,13 +89,16 @@ enum psmouse_type { PSMOUSE_TRACKPOINT,PSMOUSE_TOUCHKIT_PS2 ,PSMOUSE_CORTRON , +PSMOUSE_OLPC ,PSMOUSE_AUTO /* This one should always be last */ };int psmouse_sliced_command (struct psmouse *psmouse,unsigned char command);int psmouse_reset (struct psmouse *psmouse);void psmouse_set_resolution (struct psmouse *psmouse,unsigned int resolution); +void psmouse_set_state (struct psmouse *psmouse,enum psmouse_state new_state); +extern struct workqueue_struct *kpsmoused_wq;struct psmouse_attribute {struct device_attribute dattr;
Signature · 1 line
1.5.6.3
Dmitry Torokhov
maintainerQuoted 10 lines · Andres Salomon
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.
Good stuff, thank you. I bet you named the module olpc and gave pregix hgpk to all the functions to mess with mt feeble brain ;) Maybe we should rename the module to hgpk as well?
Quoted 4 lines
From psmouse-base, we use
psmouse_set_statequite a bit, as well as piggy-backing off ofkpsmoused_wq; so, this also makes those available to protocol extensions.
Do you think we should provide assessor functions to deal with kpsmoused instead of playing with it directly? I was thinking about starting it on-demand for protocols that may use it and shut it off by default.
Signature · 1 line
Dmitry
Quoted 10 lines · On Fri, 1 Aug 2008 14:34:51 -0400 Dmitry Torokhov <[email protected]>…
Quoted 9 lines · Andres Salomon
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.
Quoted 7 lines
Quoted 2 lines
Stuff like this keeps me from getting bored.
Good stuff, thank you. I bet you named the module olpc and gave pregix hgpk to all the functions to mess with mt feeble brain ;) Maybe we should rename the module to hgpk as well?
I thought about it, but decided not to for now now (olpc.c is what people will recognize it as; people familiar w/ the spec will recognize it as HGPK). Granted, olpc.c is not a good long term name, as hardware will most definitely be changed in the XO-2 (and maybe even before then, who knows?)
So, I wouldn't be against renaming it hgpk.c, but I'm not sure that people would recognize it when looking for it.
Quoted 10 lines
Quoted 4 lines
From psmouse-base, we use
psmouse_set_statequite a bit, as well as piggy-backing off ofkpsmoused_wq; so, this also makes those available to protocol extensions.Do you think we should provide assessor functions to deal with kpsmoused instead of playing with it directly? I was thinking about starting it on-demand for protocols that may use it and shut it off by default.
Sure. Do you already have code to do the on-demand stuff, so I can make sure what I end up writing works w/ your code?