aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2010-01-22 02:55:25 -0500
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2010-01-22 02:55:25 -0500
commit7755726fe90a8b253659756e6de68c1a55aa427f (patch)
treea3523fa77e07854db3b8089e3066a55ea997060c /drivers/input
parent3bf127637e22ddf95e67e10a23c339cee3d52429 (diff)
parent92dcffb916d309aa01778bf8963a6932e4014d07 (diff)
Merge commit 'v2.6.33-rc5' into next
Diffstat (limited to 'drivers/input')
-rw-r--r--drivers/input/evdev.c3
-rw-r--r--drivers/input/ff-memless.c48
-rw-r--r--drivers/input/input.c86
-rw-r--r--drivers/input/joystick/gf2k.c2
-rw-r--r--drivers/input/joystick/iforce/iforce-main.c29
-rw-r--r--drivers/input/joystick/iforce/iforce-usb.c29
-rw-r--r--drivers/input/joystick/iforce/iforce.h2
-rw-r--r--drivers/input/joystick/xpad.c4
-rw-r--r--drivers/input/keyboard/adp5588-keys.c2
-rw-r--r--drivers/input/keyboard/atkbd.c74
-rw-r--r--drivers/input/keyboard/davinci_keyscan.c8
-rw-r--r--drivers/input/keyboard/matrix_keypad.c29
-rw-r--r--drivers/input/keyboard/sh_keysc.c2
-rw-r--r--drivers/input/keyboard/twl4030_keypad.c11
-rw-r--r--drivers/input/misc/bfin_rotary.c2
-rw-r--r--drivers/input/misc/pcspkr.c2
-rw-r--r--drivers/input/misc/twl4030-pwrbutton.c14
-rw-r--r--drivers/input/misc/wistron_btns.c2
-rw-r--r--drivers/input/mouse/Kconfig2
-rw-r--r--drivers/input/mouse/bcm5974.c44
-rw-r--r--drivers/input/mouse/hgpk.c1
-rw-r--r--drivers/input/mouse/lifebook.c2
-rw-r--r--drivers/input/mouse/psmouse-base.c74
-rw-r--r--drivers/input/mouse/sentelic.c6
-rw-r--r--drivers/input/mouse/synaptics.c10
-rw-r--r--drivers/input/mouse/synaptics.h1
-rw-r--r--drivers/input/serio/i8042-x86ia64io.h7
-rw-r--r--drivers/input/serio/serio.c11
-rw-r--r--drivers/input/touchscreen/pcap_ts.c2
29 files changed, 306 insertions, 203 deletions
diff --git a/drivers/input/evdev.c b/drivers/input/evdev.c
index dee6706038aa..258c639571b5 100644
--- a/drivers/input/evdev.c
+++ b/drivers/input/evdev.c
@@ -59,7 +59,8 @@ static void evdev_pass_event(struct evdev_client *client,
59 client->head &= EVDEV_BUFFER_SIZE - 1; 59 client->head &= EVDEV_BUFFER_SIZE - 1;
60 spin_unlock(&client->buffer_lock); 60 spin_unlock(&client->buffer_lock);
61 61
62 kill_fasync(&client->fasync, SIGIO, POLL_IN); 62 if (event->type == EV_SYN)
63 kill_fasync(&client->fasync, SIGIO, POLL_IN);
63} 64}
64 65
65/* 66/*
diff --git a/drivers/input/ff-memless.c b/drivers/input/ff-memless.c
index b483b2995fa9..f967008f332e 100644
--- a/drivers/input/ff-memless.c
+++ b/drivers/input/ff-memless.c
@@ -221,11 +221,27 @@ static int get_compatible_type(struct ff_device *ff, int effect_type)
221} 221}
222 222
223/* 223/*
224 * Only left/right direction should be used (under/over 0x8000) for
225 * forward/reverse motor direction (to keep calculation fast & simple).
226 */
227static u16 ml_calculate_direction(u16 direction, u16 force,
228 u16 new_direction, u16 new_force)
229{
230 if (!force)
231 return new_direction;
232 if (!new_force)
233 return direction;
234 return (((u32)(direction >> 1) * force +
235 (new_direction >> 1) * new_force) /
236 (force + new_force)) << 1;
237}
238
239/*
224 * Combine two effects and apply gain. 240 * Combine two effects and apply gain.
225 */ 241 */
226static void ml_combine_effects(struct ff_effect *effect, 242static void ml_combine_effects(struct ff_effect *effect,
227 struct ml_effect_state *state, 243 struct ml_effect_state *state,
228 unsigned int gain) 244 int gain)
229{ 245{
230 struct ff_effect *new = state->effect; 246 struct ff_effect *new = state->effect;
231 unsigned int strong, weak, i; 247 unsigned int strong, weak, i;
@@ -252,8 +268,21 @@ static void ml_combine_effects(struct ff_effect *effect,
252 break; 268 break;
253 269
254 case FF_RUMBLE: 270 case FF_RUMBLE:
255 strong = new->u.rumble.strong_magnitude * gain / 0xffff; 271 strong = (u32)new->u.rumble.strong_magnitude * gain / 0xffff;
256 weak = new->u.rumble.weak_magnitude * gain / 0xffff; 272 weak = (u32)new->u.rumble.weak_magnitude * gain / 0xffff;
273
274 if (effect->u.rumble.strong_magnitude + strong)
275 effect->direction = ml_calculate_direction(
276 effect->direction,
277 effect->u.rumble.strong_magnitude,
278 new->direction, strong);
279 else if (effect->u.rumble.weak_magnitude + weak)
280 effect->direction = ml_calculate_direction(
281 effect->direction,
282 effect->u.rumble.weak_magnitude,
283 new->direction, weak);
284 else
285 effect->direction = 0;
257 effect->u.rumble.strong_magnitude = 286 effect->u.rumble.strong_magnitude =
258 min(strong + effect->u.rumble.strong_magnitude, 287 min(strong + effect->u.rumble.strong_magnitude,
259 0xffffU); 288 0xffffU);
@@ -268,6 +297,13 @@ static void ml_combine_effects(struct ff_effect *effect,
268 /* here we also scale it 0x7fff => 0xffff */ 297 /* here we also scale it 0x7fff => 0xffff */
269 i = i * gain / 0x7fff; 298 i = i * gain / 0x7fff;
270 299
300 if (effect->u.rumble.strong_magnitude + i)
301 effect->direction = ml_calculate_direction(
302 effect->direction,
303 effect->u.rumble.strong_magnitude,
304 new->direction, i);
305 else
306 effect->direction = 0;
271 effect->u.rumble.strong_magnitude = 307 effect->u.rumble.strong_magnitude =
272 min(i + effect->u.rumble.strong_magnitude, 0xffffU); 308 min(i + effect->u.rumble.strong_magnitude, 0xffffU);
273 effect->u.rumble.weak_magnitude = 309 effect->u.rumble.weak_magnitude =
@@ -411,8 +447,6 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
411 msecs_to_jiffies(state->effect->replay.length); 447 msecs_to_jiffies(state->effect->replay.length);
412 state->adj_at = state->play_at; 448 state->adj_at = state->play_at;
413 449
414 ml_schedule_timer(ml);
415
416 } else { 450 } else {
417 debug("initiated stop"); 451 debug("initiated stop");
418 452
@@ -420,10 +454,10 @@ static int ml_ff_playback(struct input_dev *dev, int effect_id, int value)
420 __set_bit(FF_EFFECT_ABORTING, &state->flags); 454 __set_bit(FF_EFFECT_ABORTING, &state->flags);
421 else 455 else
422 __clear_bit(FF_EFFECT_STARTED, &state->flags); 456 __clear_bit(FF_EFFECT_STARTED, &state->flags);
423
424 ml_play_effects(ml);
425 } 457 }
426 458
459 ml_play_effects(ml);
460
427 return 0; 461 return 0;
428} 462}
429 463
diff --git a/drivers/input/input.c b/drivers/input/input.c
index a31394c1eca8..6c161e220868 100644
--- a/drivers/input/input.c
+++ b/drivers/input/input.c
@@ -24,6 +24,7 @@
24#include <linux/mutex.h> 24#include <linux/mutex.h>
25#include <linux/rcupdate.h> 25#include <linux/rcupdate.h>
26#include <linux/smp_lock.h> 26#include <linux/smp_lock.h>
27#include "input-compat.h"
27 28
28MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>"); 29MODULE_AUTHOR("Vojtech Pavlik <vojtech@suse.cz>");
29MODULE_DESCRIPTION("Input core"); 30MODULE_DESCRIPTION("Input core");
@@ -767,6 +768,40 @@ static int input_attach_handler(struct input_dev *dev, struct input_handler *han
767 return error; 768 return error;
768} 769}
769 770
771#ifdef CONFIG_COMPAT
772
773static int input_bits_to_string(char *buf, int buf_size,
774 unsigned long bits, bool skip_empty)
775{
776 int len = 0;
777
778 if (INPUT_COMPAT_TEST) {
779 u32 dword = bits >> 32;
780 if (dword || !skip_empty)
781 len += snprintf(buf, buf_size, "%x ", dword);
782
783 dword = bits & 0xffffffffUL;
784 if (dword || !skip_empty || len)
785 len += snprintf(buf + len, max(buf_size - len, 0),
786 "%x", dword);
787 } else {
788 if (bits || !skip_empty)
789 len += snprintf(buf, buf_size, "%lx", bits);
790 }
791
792 return len;
793}
794
795#else /* !CONFIG_COMPAT */
796
797static int input_bits_to_string(char *buf, int buf_size,
798 unsigned long bits, bool skip_empty)
799{
800 return bits || !skip_empty ?
801 snprintf(buf, buf_size, "%lx", bits) : 0;
802}
803
804#endif
770 805
771#ifdef CONFIG_PROC_FS 806#ifdef CONFIG_PROC_FS
772 807
@@ -835,14 +870,25 @@ static void input_seq_print_bitmap(struct seq_file *seq, const char *name,
835 unsigned long *bitmap, int max) 870 unsigned long *bitmap, int max)
836{ 871{
837 int i; 872 int i;
838 873 bool skip_empty = true;
839 for (i = BITS_TO_LONGS(max) - 1; i > 0; i--) 874 char buf[18];
840 if (bitmap[i])
841 break;
842 875
843 seq_printf(seq, "B: %s=", name); 876 seq_printf(seq, "B: %s=", name);
844 for (; i >= 0; i--) 877
845 seq_printf(seq, "%lx%s", bitmap[i], i > 0 ? " " : ""); 878 for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {
879 if (input_bits_to_string(buf, sizeof(buf),
880 bitmap[i], skip_empty)) {
881 skip_empty = false;
882 seq_printf(seq, "%s%s", buf, i > 0 ? " " : "");
883 }
884 }
885
886 /*
887 * If no output was produced print a single 0.
888 */
889 if (skip_empty)
890 seq_puts(seq, "0");
891
846 seq_putc(seq, '\n'); 892 seq_putc(seq, '\n');
847} 893}
848 894
@@ -1131,14 +1177,23 @@ static int input_print_bitmap(char *buf, int buf_size, unsigned long *bitmap,
1131{ 1177{
1132 int i; 1178 int i;
1133 int len = 0; 1179 int len = 0;
1180 bool skip_empty = true;
1181
1182 for (i = BITS_TO_LONGS(max) - 1; i >= 0; i--) {
1183 len += input_bits_to_string(buf + len, max(buf_size - len, 0),
1184 bitmap[i], skip_empty);
1185 if (len) {
1186 skip_empty = false;
1187 if (i > 0)
1188 len += snprintf(buf + len, max(buf_size - len, 0), " ");
1189 }
1190 }
1134 1191
1135 for (i = BITS_TO_LONGS(max) - 1; i > 0; i--) 1192 /*
1136 if (bitmap[i]) 1193 * If no output was produced print a single 0.
1137 break; 1194 */
1138 1195 if (len == 0)
1139 for (; i >= 0; i--) 1196 len = snprintf(buf, buf_size, "%d", 0);
1140 len += snprintf(buf + len, max(buf_size - len, 0),
1141 "%lx%s", bitmap[i], i > 0 ? " " : "");
1142 1197
1143 if (add_cr) 1198 if (add_cr)
1144 len += snprintf(buf + len, max(buf_size - len, 0), "\n"); 1199 len += snprintf(buf + len, max(buf_size - len, 0), "\n");
@@ -1153,7 +1208,8 @@ static ssize_t input_dev_show_cap_##bm(struct device *dev, \
1153{ \ 1208{ \
1154 struct input_dev *input_dev = to_input_dev(dev); \ 1209 struct input_dev *input_dev = to_input_dev(dev); \
1155 int len = input_print_bitmap(buf, PAGE_SIZE, \ 1210 int len = input_print_bitmap(buf, PAGE_SIZE, \
1156 input_dev->bm##bit, ev##_MAX, 1); \ 1211 input_dev->bm##bit, ev##_MAX, \
1212 true); \
1157 return min_t(int, len, PAGE_SIZE); \ 1213 return min_t(int, len, PAGE_SIZE); \
1158} \ 1214} \
1159static DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL) 1215static DEVICE_ATTR(bm, S_IRUGO, input_dev_show_cap_##bm, NULL)
@@ -1217,7 +1273,7 @@ static int input_add_uevent_bm_var(struct kobj_uevent_env *env,
1217 1273
1218 len = input_print_bitmap(&env->buf[env->buflen - 1], 1274 len = input_print_bitmap(&env->buf[env->buflen - 1],
1219 sizeof(env->buf) - env->buflen, 1275 sizeof(env->buf) - env->buflen,
1220 bitmap, max, 0); 1276 bitmap, max, false);
1221 if (len >= (sizeof(env->buf) - env->buflen)) 1277 if (len >= (sizeof(env->buf) - env->buflen))
1222 return -ENOMEM; 1278 return -ENOMEM;
1223 1279
diff --git a/drivers/input/joystick/gf2k.c b/drivers/input/joystick/gf2k.c
index 67c207f5b1a1..45ac70eae0aa 100644
--- a/drivers/input/joystick/gf2k.c
+++ b/drivers/input/joystick/gf2k.c
@@ -277,7 +277,7 @@ static int gf2k_connect(struct gameport *gameport, struct gameport_driver *drv)
277 } 277 }
278 278
279#ifdef RESET_WORKS 279#ifdef RESET_WORKS
280 if ((gf2k->id != (GB(19,2,0) | GB(15,3,2) | GB(12,3,5))) || 280 if ((gf2k->id != (GB(19,2,0) | GB(15,3,2) | GB(12,3,5))) &&
281 (gf2k->id != (GB(31,2,0) | GB(27,3,2) | GB(24,3,5)))) { 281 (gf2k->id != (GB(31,2,0) | GB(27,3,2) | GB(24,3,5)))) {
282 err = -ENODEV; 282 err = -ENODEV;
283 goto fail2; 283 goto fail2;
diff --git a/drivers/input/joystick/iforce/iforce-main.c b/drivers/input/joystick/iforce/iforce-main.c
index f6c688cae334..b1edd778639c 100644
--- a/drivers/input/joystick/iforce/iforce-main.c
+++ b/drivers/input/joystick/iforce/iforce-main.c
@@ -210,7 +210,7 @@ static int iforce_open(struct input_dev *dev)
210 return 0; 210 return 0;
211} 211}
212 212
213static void iforce_release(struct input_dev *dev) 213static void iforce_close(struct input_dev *dev)
214{ 214{
215 struct iforce *iforce = input_get_drvdata(dev); 215 struct iforce *iforce = input_get_drvdata(dev);
216 int i; 216 int i;
@@ -228,30 +228,17 @@ static void iforce_release(struct input_dev *dev)
228 228
229 /* Disable force feedback playback */ 229 /* Disable force feedback playback */
230 iforce_send_packet(iforce, FF_CMD_ENABLE, "\001"); 230 iforce_send_packet(iforce, FF_CMD_ENABLE, "\001");
231 /* Wait for the command to complete */
232 wait_event_interruptible(iforce->wait,
233 !test_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags));
231 } 234 }
232 235
233 switch (iforce->bus) { 236 switch (iforce->bus) {
234#ifdef CONFIG_JOYSTICK_IFORCE_USB 237#ifdef CONFIG_JOYSTICK_IFORCE_USB
235 case IFORCE_USB:
236 usb_kill_urb(iforce->irq);
237
238 /* The device was unplugged before the file
239 * was released */
240 if (iforce->usbdev == NULL) {
241 iforce_delete_device(iforce);
242 kfree(iforce);
243 }
244 break;
245#endif
246 }
247}
248
249void iforce_delete_device(struct iforce *iforce)
250{
251 switch (iforce->bus) {
252#ifdef CONFIG_JOYSTICK_IFORCE_USB
253 case IFORCE_USB: 238 case IFORCE_USB:
254 iforce_usb_delete(iforce); 239 usb_kill_urb(iforce->irq);
240 usb_kill_urb(iforce->out);
241 usb_kill_urb(iforce->ctrl);
255 break; 242 break;
256#endif 243#endif
257#ifdef CONFIG_JOYSTICK_IFORCE_232 244#ifdef CONFIG_JOYSTICK_IFORCE_232
@@ -303,7 +290,7 @@ int iforce_init_device(struct iforce *iforce)
303 290
304 input_dev->name = "Unknown I-Force device"; 291 input_dev->name = "Unknown I-Force device";
305 input_dev->open = iforce_open; 292 input_dev->open = iforce_open;
306 input_dev->close = iforce_release; 293 input_dev->close = iforce_close;
307 294
308/* 295/*
309 * On-device memory allocation. 296 * On-device memory allocation.
diff --git a/drivers/input/joystick/iforce/iforce-usb.c b/drivers/input/joystick/iforce/iforce-usb.c
index 9f289d8f52c6..b41303d3ec54 100644
--- a/drivers/input/joystick/iforce/iforce-usb.c
+++ b/drivers/input/joystick/iforce/iforce-usb.c
@@ -109,6 +109,7 @@ static void iforce_usb_out(struct urb *urb)
109 struct iforce *iforce = urb->context; 109 struct iforce *iforce = urb->context;
110 110
111 if (urb->status) { 111 if (urb->status) {
112 clear_bit(IFORCE_XMIT_RUNNING, iforce->xmit_flags);
112 dbg("urb->status %d, exiting", urb->status); 113 dbg("urb->status %d, exiting", urb->status);
113 return; 114 return;
114 } 115 }
@@ -186,33 +187,19 @@ fail:
186 return err; 187 return err;
187} 188}
188 189
189/* Called by iforce_delete() */
190void iforce_usb_delete(struct iforce* iforce)
191{
192 usb_kill_urb(iforce->irq);
193 usb_kill_urb(iforce->out);
194 usb_kill_urb(iforce->ctrl);
195
196 usb_free_urb(iforce->irq);
197 usb_free_urb(iforce->out);
198 usb_free_urb(iforce->ctrl);
199}
200
201static void iforce_usb_disconnect(struct usb_interface *intf) 190static void iforce_usb_disconnect(struct usb_interface *intf)
202{ 191{
203 struct iforce *iforce = usb_get_intfdata(intf); 192 struct iforce *iforce = usb_get_intfdata(intf);
204 int open = 0; /* FIXME! iforce->dev.handle->open; */
205 193
206 usb_set_intfdata(intf, NULL); 194 usb_set_intfdata(intf, NULL);
207 if (iforce) {
208 iforce->usbdev = NULL;
209 input_unregister_device(iforce->dev);
210 195
211 if (!open) { 196 input_unregister_device(iforce->dev);
212 iforce_delete_device(iforce); 197
213 kfree(iforce); 198 usb_free_urb(iforce->irq);
214 } 199 usb_free_urb(iforce->out);
215 } 200 usb_free_urb(iforce->ctrl);
201
202 kfree(iforce);
216} 203}
217 204
218static struct usb_device_id iforce_usb_ids [] = { 205static struct usb_device_id iforce_usb_ids [] = {
diff --git a/drivers/input/joystick/iforce/iforce.h b/drivers/input/joystick/iforce/iforce.h
index f2d91f4028ca..9f494b75848a 100644
--- a/drivers/input/joystick/iforce/iforce.h
+++ b/drivers/input/joystick/iforce/iforce.h
@@ -150,11 +150,9 @@ void iforce_serial_xmit(struct iforce *iforce);
150 150
151/* iforce-usb.c */ 151/* iforce-usb.c */
152void iforce_usb_xmit(struct iforce *iforce); 152void iforce_usb_xmit(struct iforce *iforce);
153void iforce_usb_delete(struct iforce *iforce);
154 153
155/* iforce-main.c */ 154/* iforce-main.c */
156int iforce_init_device(struct iforce *iforce); 155int iforce_init_device(struct iforce *iforce);
157void iforce_delete_device(struct iforce *iforce);
158 156
159/* iforce-packets.c */ 157/* iforce-packets.c */
160int iforce_control_playback(struct iforce*, u16 id, unsigned int); 158int iforce_control_playback(struct iforce*, u16 id, unsigned int);
diff --git a/drivers/input/joystick/xpad.c b/drivers/input/joystick/xpad.c
index 5483fb9bd819..66be6901619d 100644
--- a/drivers/input/joystick/xpad.c
+++ b/drivers/input/joystick/xpad.c
@@ -471,7 +471,7 @@ static void xpad_irq_in(struct urb *urb)
471 } 471 }
472 472
473exit: 473exit:
474 retval = usb_submit_urb (urb, GFP_ATOMIC); 474 retval = usb_submit_urb(urb, GFP_ATOMIC);
475 if (retval) 475 if (retval)
476 err ("%s - usb_submit_urb failed with result %d", 476 err ("%s - usb_submit_urb failed with result %d",
477 __func__, retval); 477 __func__, retval);
@@ -596,7 +596,7 @@ static int xpad_play_effect(struct input_dev *dev, void *data,
596 xpad->odata[6] = 0x00; 596 xpad->odata[6] = 0x00;
597 xpad->odata[7] = 0x00; 597 xpad->odata[7] = 0x00;
598 xpad->irq_out->transfer_buffer_length = 8; 598 xpad->irq_out->transfer_buffer_length = 8;
599 usb_submit_urb(xpad->irq_out, GFP_KERNEL); 599 usb_submit_urb(xpad->irq_out, GFP_ATOMIC);
600 } 600 }
601 601
602 return 0; 602 return 0;
diff --git a/drivers/input/keyboard/adp5588-keys.c b/drivers/input/keyboard/adp5588-keys.c
index 6737fe4c0f12..b5142d2d5112 100644
--- a/drivers/input/keyboard/adp5588-keys.c
+++ b/drivers/input/keyboard/adp5588-keys.c
@@ -320,7 +320,7 @@ static int adp5588_resume(struct device *dev)
320 return 0; 320 return 0;
321} 321}
322 322
323static struct dev_pm_ops adp5588_dev_pm_ops = { 323static const struct dev_pm_ops adp5588_dev_pm_ops = {
324 .suspend = adp5588_suspend, 324 .suspend = adp5588_suspend,
325 .resume = adp5588_resume, 325 .resume = adp5588_resume,
326}; 326};
diff --git a/drivers/input/keyboard/atkbd.c b/drivers/input/keyboard/atkbd.c
index 7c235013dba3..326875be192e 100644
--- a/drivers/input/keyboard/atkbd.c
+++ b/drivers/input/keyboard/atkbd.c
@@ -134,7 +134,8 @@ static const unsigned short atkbd_unxlate_table[128] = {
134#define ATKBD_CMD_GETID 0x02f2 134#define ATKBD_CMD_GETID 0x02f2
135#define ATKBD_CMD_SETREP 0x10f3 135#define ATKBD_CMD_SETREP 0x10f3
136#define ATKBD_CMD_ENABLE 0x00f4 136#define ATKBD_CMD_ENABLE 0x00f4
137#define ATKBD_CMD_RESET_DIS 0x00f5 137#define ATKBD_CMD_RESET_DIS 0x00f5 /* Reset to defaults and disable */
138#define ATKBD_CMD_RESET_DEF 0x00f6 /* Reset to defaults */
138#define ATKBD_CMD_SETALL_MBR 0x00fa 139#define ATKBD_CMD_SETALL_MBR 0x00fa
139#define ATKBD_CMD_RESET_BAT 0x02ff 140#define ATKBD_CMD_RESET_BAT 0x02ff
140#define ATKBD_CMD_RESEND 0x00fe 141#define ATKBD_CMD_RESEND 0x00fe
@@ -224,8 +225,10 @@ struct atkbd {
224 225
225 struct delayed_work event_work; 226 struct delayed_work event_work;
226 unsigned long event_jiffies; 227 unsigned long event_jiffies;
227 struct mutex event_mutex;
228 unsigned long event_mask; 228 unsigned long event_mask;
229
230 /* Serializes reconnect(), attr->set() and event work */
231 struct mutex mutex;
229}; 232};
230 233
231/* 234/*
@@ -575,7 +578,7 @@ static void atkbd_event_work(struct work_struct *work)
575{ 578{
576 struct atkbd *atkbd = container_of(work, struct atkbd, event_work.work); 579 struct atkbd *atkbd = container_of(work, struct atkbd, event_work.work);
577 580
578 mutex_lock(&atkbd->event_mutex); 581 mutex_lock(&atkbd->mutex);
579 582
580 if (!atkbd->enabled) { 583 if (!atkbd->enabled) {
581 /* 584 /*
@@ -594,7 +597,7 @@ static void atkbd_event_work(struct work_struct *work)
594 atkbd_set_repeat_rate(atkbd); 597 atkbd_set_repeat_rate(atkbd);
595 } 598 }
596 599
597 mutex_unlock(&atkbd->event_mutex); 600 mutex_unlock(&atkbd->mutex);
598} 601}
599 602
600/* 603/*
@@ -610,7 +613,7 @@ static void atkbd_schedule_event_work(struct atkbd *atkbd, int event_bit)
610 613
611 atkbd->event_jiffies = jiffies; 614 atkbd->event_jiffies = jiffies;
612 set_bit(event_bit, &atkbd->event_mask); 615 set_bit(event_bit, &atkbd->event_mask);
613 wmb(); 616 mb();
614 schedule_delayed_work(&atkbd->event_work, delay); 617 schedule_delayed_work(&atkbd->event_work, delay);
615} 618}
616 619
@@ -840,7 +843,7 @@ static void atkbd_cleanup(struct serio *serio)
840 struct atkbd *atkbd = serio_get_drvdata(serio); 843 struct atkbd *atkbd = serio_get_drvdata(serio);
841 844
842 atkbd_disable(atkbd); 845 atkbd_disable(atkbd);
843 ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_BAT); 846 ps2_command(&atkbd->ps2dev, NULL, ATKBD_CMD_RESET_DEF);
844} 847}
845 848
846 849
@@ -852,13 +855,20 @@ static void atkbd_disconnect(struct serio *serio)
852{ 855{
853 struct atkbd *atkbd = serio_get_drvdata(serio); 856 struct atkbd *atkbd = serio_get_drvdata(serio);
854 857
858 sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group);
859
855 atkbd_disable(atkbd); 860 atkbd_disable(atkbd);
856 861
857 /* make sure we don't have a command in flight */ 862 input_unregister_device(atkbd->dev);
863
864 /*
865 * Make sure we don't have a command in flight.
866 * Note that since atkbd->enabled is false event work will keep
867 * rescheduling itself until it gets canceled and will not try
868 * accessing freed input device or serio port.
869 */
858 cancel_delayed_work_sync(&atkbd->event_work); 870 cancel_delayed_work_sync(&atkbd->event_work);
859 871
860 sysfs_remove_group(&serio->dev.kobj, &atkbd_attribute_group);
861 input_unregister_device(atkbd->dev);
862 serio_close(serio); 872 serio_close(serio);
863 serio_set_drvdata(serio, NULL); 873 serio_set_drvdata(serio, NULL);
864 kfree(atkbd); 874 kfree(atkbd);
@@ -1090,7 +1100,7 @@ static int atkbd_connect(struct serio *serio, struct serio_driver *drv)
1090 atkbd->dev = dev; 1100 atkbd->dev = dev;
1091 ps2_init(&atkbd->ps2dev, serio); 1101 ps2_init(&atkbd->ps2dev, serio);
1092 INIT_DELAYED_WORK(&atkbd->event_work, atkbd_event_work); 1102 INIT_DELAYED_WORK(&atkbd->event_work, atkbd_event_work);
1093 mutex_init(&atkbd->event_mutex); 1103 mutex_init(&atkbd->mutex);
1094 1104
1095 switch (serio->id.type) { 1105 switch (serio->id.type) {
1096 1106
@@ -1165,6 +1175,7 @@ static int atkbd_reconnect(struct serio *serio)
1165{ 1175{
1166 struct atkbd *atkbd = serio_get_drvdata(serio); 1176 struct atkbd *atkbd = serio_get_drvdata(serio);
1167 struct serio_driver *drv = serio->drv; 1177 struct serio_driver *drv = serio->drv;
1178 int retval = -1;
1168 1179
1169 if (!atkbd || !drv) { 1180 if (!atkbd || !drv) {
1170 dev_dbg(&serio->dev, 1181 dev_dbg(&serio->dev,
@@ -1172,13 +1183,16 @@ static int atkbd_reconnect(struct serio *serio)
1172 return -1; 1183 return -1;
1173 } 1184 }
1174 1185
1186 mutex_lock(&atkbd->mutex);
1187
1175 atkbd_disable(atkbd); 1188 atkbd_disable(atkbd);
1176 1189
1177 if (atkbd->write) { 1190 if (atkbd->write) {
1178 if (atkbd_probe(atkbd)) 1191 if (atkbd_probe(atkbd))
1179 return -1; 1192 goto out;
1193
1180 if (atkbd->set != atkbd_select_set(atkbd, atkbd->set, atkbd->extra)) 1194 if (atkbd->set != atkbd_select_set(atkbd, atkbd->set, atkbd->extra))
1181 return -1; 1195 goto out;
1182 1196
1183 atkbd_activate(atkbd); 1197 atkbd_activate(atkbd);
1184 1198
@@ -1196,8 +1210,11 @@ static int atkbd_reconnect(struct serio *serio)
1196 } 1210 }
1197 1211
1198 atkbd_enable(atkbd); 1212 atkbd_enable(atkbd);
1213 retval = 0;
1199 1214
1200 return 0; 1215 out:
1216 mutex_unlock(&atkbd->mutex);
1217 return retval;
1201} 1218}
1202 1219
1203static struct serio_device_id atkbd_serio_ids[] = { 1220static struct serio_device_id atkbd_serio_ids[] = {
@@ -1241,47 +1258,28 @@ static ssize_t atkbd_attr_show_helper(struct device *dev, char *buf,
1241 ssize_t (*handler)(struct atkbd *, char *)) 1258 ssize_t (*handler)(struct atkbd *, char *))
1242{ 1259{
1243 struct serio *serio = to_serio_port(dev); 1260 struct serio *serio = to_serio_port(dev);
1244 int retval; 1261 struct atkbd *atkbd = serio_get_drvdata(serio);
1245
1246 retval = serio_pin_driver(serio);
1247 if (retval)
1248 return retval;
1249
1250 if (serio->drv != &atkbd_drv) {
1251 retval = -ENODEV;
1252 goto out;
1253 }
1254
1255 retval = handler((struct atkbd *)serio_get_drvdata(serio), buf);
1256 1262
1257out: 1263 return handler(atkbd, buf);
1258 serio_unpin_driver(serio);
1259 return retval;
1260} 1264}
1261 1265
1262static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t count, 1266static ssize_t atkbd_attr_set_helper(struct device *dev, const char *buf, size_t count,
1263 ssize_t (*handler)(struct atkbd *, const char *, size_t)) 1267 ssize_t (*handler)(struct atkbd *, const char *, size_t))
1264{ 1268{
1265 struct serio *serio = to_serio_port(dev); 1269 struct serio *serio = to_serio_port(dev);
1266 struct atkbd *atkbd; 1270 struct atkbd *atkbd = serio_get_drvdata(serio);
1267 int retval; 1271 int retval;
1268 1272
1269 retval = serio_pin_driver(serio); 1273 retval = mutex_lock_interruptible(&atkbd->mutex);
1270 if (retval) 1274 if (retval)
1271 return retval; 1275 return retval;
1272 1276
1273 if (serio->drv != &atkbd_drv) {
1274 retval = -ENODEV;
1275 goto out;
1276 }
1277
1278 atkbd = serio_get_drvdata(serio);
1279 atkbd_disable(atkbd); 1277 atkbd_disable(atkbd);
1280 retval = handler(atkbd, buf, count); 1278 retval = handler(atkbd, buf, count);
1281 atkbd_enable(atkbd); 1279 atkbd_enable(atkbd);
1282 1280
1283out: 1281 mutex_unlock(&atkbd->mutex);
1284 serio_unpin_driver(serio); 1282
1285 return retval; 1283 return retval;
1286} 1284}
1287 1285
diff --git a/drivers/input/keyboard/davinci_keyscan.c b/drivers/input/keyboard/davinci_keyscan.c
index 6e52d855f637..d410d7a52f1d 100644
--- a/drivers/input/keyboard/davinci_keyscan.c
+++ b/drivers/input/keyboard/davinci_keyscan.c
@@ -174,6 +174,14 @@ static int __init davinci_ks_probe(struct platform_device *pdev)
174 struct davinci_ks_platform_data *pdata = pdev->dev.platform_data; 174 struct davinci_ks_platform_data *pdata = pdev->dev.platform_data;
175 int error, i; 175 int error, i;
176 176
177 if (pdata->device_enable) {
178 error = pdata->device_enable(dev);
179 if (error < 0) {
180 dev_dbg(dev, "device enable function failed\n");
181 return error;
182 }
183 }
184
177 if (!pdata->keymap) { 185 if (!pdata->keymap) {
178 dev_dbg(dev, "no keymap from pdata\n"); 186 dev_dbg(dev, "no keymap from pdata\n");
179 return -EINVAL; 187 return -EINVAL;
diff --git a/drivers/input/keyboard/matrix_keypad.c b/drivers/input/keyboard/matrix_keypad.c
index 34f4a29d4973..d3c8b61a941d 100644
--- a/drivers/input/keyboard/matrix_keypad.c
+++ b/drivers/input/keyboard/matrix_keypad.c
@@ -29,11 +29,13 @@ struct matrix_keypad {
29 unsigned short *keycodes; 29 unsigned short *keycodes;
30 unsigned int row_shift; 30 unsigned int row_shift;
31 31
32 DECLARE_BITMAP(disabled_gpios, MATRIX_MAX_ROWS);
33
32 uint32_t last_key_state[MATRIX_MAX_COLS]; 34 uint32_t last_key_state[MATRIX_MAX_COLS];
33 struct delayed_work work; 35 struct delayed_work work;
36 spinlock_t lock;
34 bool scan_pending; 37 bool scan_pending;
35 bool stopped; 38 bool stopped;
36 spinlock_t lock;
37}; 39};
38 40
39/* 41/*
@@ -222,9 +224,16 @@ static int matrix_keypad_suspend(struct device *dev)
222 224
223 matrix_keypad_stop(keypad->input_dev); 225 matrix_keypad_stop(keypad->input_dev);
224 226
225 if (device_may_wakeup(&pdev->dev)) 227 if (device_may_wakeup(&pdev->dev)) {
226 for (i = 0; i < pdata->num_row_gpios; i++) 228 for (i = 0; i < pdata->num_row_gpios; i++) {
227 enable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); 229 if (!test_bit(i, keypad->disabled_gpios)) {
230 unsigned int gpio = pdata->row_gpios[i];
231
232 if (enable_irq_wake(gpio_to_irq(gpio)) == 0)
233 __set_bit(i, keypad->disabled_gpios);
234 }
235 }
236 }
228 237
229 return 0; 238 return 0;
230} 239}
@@ -236,9 +245,15 @@ static int matrix_keypad_resume(struct device *dev)
236 const struct matrix_keypad_platform_data *pdata = keypad->pdata; 245 const struct matrix_keypad_platform_data *pdata = keypad->pdata;
237 int i; 246 int i;
238 247
239 if (device_may_wakeup(&pdev->dev)) 248 if (device_may_wakeup(&pdev->dev)) {
240 for (i = 0; i < pdata->num_row_gpios; i++) 249 for (i = 0; i < pdata->num_row_gpios; i++) {
241 disable_irq_wake(gpio_to_irq(pdata->row_gpios[i])); 250 if (test_and_clear_bit(i, keypad->disabled_gpios)) {
251 unsigned int gpio = pdata->row_gpios[i];
252
253 disable_irq_wake(gpio_to_irq(gpio));
254 }
255 }
256 }
242 257
243 matrix_keypad_start(keypad->input_dev); 258 matrix_keypad_start(keypad->input_dev);
244 259
diff --git a/drivers/input/keyboard/sh_keysc.c b/drivers/input/keyboard/sh_keysc.c
index 25706f802258..efcc3a3b9b53 100644
--- a/drivers/input/keyboard/sh_keysc.c
+++ b/drivers/input/keyboard/sh_keysc.c
@@ -295,7 +295,7 @@ static int sh_keysc_resume(struct device *dev)
295 return 0; 295 return 0;
296} 296}
297 297
298static struct dev_pm_ops sh_keysc_dev_pm_ops = { 298static const struct dev_pm_ops sh_keysc_dev_pm_ops = {
299 .suspend = sh_keysc_suspend, 299 .suspend = sh_keysc_suspend,
300 .resume = sh_keysc_resume, 300 .resume = sh_keysc_resume,
301}; 301};
diff --git a/drivers/input/keyboard/twl4030_keypad.c b/drivers/input/keyboard/twl4030_keypad.c
index eeaa7acb9cfc..21d6184efa96 100644
--- a/drivers/input/keyboard/twl4030_keypad.c
+++ b/drivers/input/keyboard/twl4030_keypad.c
@@ -253,14 +253,6 @@ static irqreturn_t do_kp_irq(int irq, void *_kp)
253 u8 reg; 253 u8 reg;
254 int ret; 254 int ret;
255 255
256#ifdef CONFIG_LOCKDEP
257 /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
258 * we don't want and can't tolerate. Although it might be
259 * friendlier not to borrow this thread context...
260 */
261 local_irq_enable();
262#endif
263
264 /* Read & Clear TWL4030 pending interrupt */ 256 /* Read & Clear TWL4030 pending interrupt */
265 ret = twl4030_kpread(kp, &reg, KEYP_ISR1, 1); 257 ret = twl4030_kpread(kp, &reg, KEYP_ISR1, 1);
266 258
@@ -403,7 +395,8 @@ static int __devinit twl4030_kp_probe(struct platform_device *pdev)
403 * 395 *
404 * NOTE: we assume this host is wired to TWL4040 INT1, not INT2 ... 396 * NOTE: we assume this host is wired to TWL4040 INT1, not INT2 ...
405 */ 397 */
406 error = request_irq(kp->irq, do_kp_irq, 0, pdev->name, kp); 398 error = request_threaded_irq(kp->irq, NULL, do_kp_irq,
399 0, pdev->name, kp);
407 if (error) { 400 if (error) {
408 dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n", 401 dev_info(kp->dbg_dev, "request_irq failed for irq no=%d\n",
409 kp->irq); 402 kp->irq);
diff --git a/drivers/input/misc/bfin_rotary.c b/drivers/input/misc/bfin_rotary.c
index 690f3fafa03b..61d10177fa83 100644
--- a/drivers/input/misc/bfin_rotary.c
+++ b/drivers/input/misc/bfin_rotary.c
@@ -247,7 +247,7 @@ static int bfin_rotary_resume(struct device *dev)
247 return 0; 247 return 0;
248} 248}
249 249
250static struct dev_pm_ops bfin_rotary_pm_ops = { 250static const struct dev_pm_ops bfin_rotary_pm_ops = {
251 .suspend = bfin_rotary_suspend, 251 .suspend = bfin_rotary_suspend,
252 .resume = bfin_rotary_resume, 252 .resume = bfin_rotary_resume,
253}; 253};
diff --git a/drivers/input/misc/pcspkr.c b/drivers/input/misc/pcspkr.c
index 21cb755a54fb..ea4e1fd12651 100644
--- a/drivers/input/misc/pcspkr.c
+++ b/drivers/input/misc/pcspkr.c
@@ -127,7 +127,7 @@ static void pcspkr_shutdown(struct platform_device *dev)
127 pcspkr_event(NULL, EV_SND, SND_BELL, 0); 127 pcspkr_event(NULL, EV_SND, SND_BELL, 0);
128} 128}
129 129
130static struct dev_pm_ops pcspkr_pm_ops = { 130static const struct dev_pm_ops pcspkr_pm_ops = {
131 .suspend = pcspkr_suspend, 131 .suspend = pcspkr_suspend,
132}; 132};
133 133
diff --git a/drivers/input/misc/twl4030-pwrbutton.c b/drivers/input/misc/twl4030-pwrbutton.c
index bdde5c889035..e9069b87fde2 100644
--- a/drivers/input/misc/twl4030-pwrbutton.c
+++ b/drivers/input/misc/twl4030-pwrbutton.c
@@ -39,18 +39,8 @@ static irqreturn_t powerbutton_irq(int irq, void *_pwr)
39 int err; 39 int err;
40 u8 value; 40 u8 value;
41 41
42#ifdef CONFIG_LOCKDEP
43 /* WORKAROUND for lockdep forcing IRQF_DISABLED on us, which
44 * we don't want and can't tolerate since this is a threaded
45 * IRQ and can sleep due to the i2c reads it has to issue.
46 * Although it might be friendlier not to borrow this thread
47 * context...
48 */
49 local_irq_enable();
50#endif
51
52 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value, 42 err = twl_i2c_read_u8(TWL4030_MODULE_PM_MASTER, &value,
53 STS_HW_CONDITIONS); 43 STS_HW_CONDITIONS);
54 if (!err) { 44 if (!err) {
55 input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ); 45 input_report_key(pwr, KEY_POWER, value & PWR_PWRON_IRQ);
56 input_sync(pwr); 46 input_sync(pwr);
@@ -80,7 +70,7 @@ static int __devinit twl4030_pwrbutton_probe(struct platform_device *pdev)
80 pwr->phys = "twl4030_pwrbutton/input0"; 70 pwr->phys = "twl4030_pwrbutton/input0";
81 pwr->dev.parent = &pdev->dev; 71 pwr->dev.parent = &pdev->dev;
82 72
83 err = request_irq(irq, powerbutton_irq, 73 err = request_threaded_irq(irq, NULL, powerbutton_irq,
84 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING, 74 IRQF_TRIGGER_FALLING | IRQF_TRIGGER_RISING,
85 "twl4030_pwrbutton", pwr); 75 "twl4030_pwrbutton", pwr);
86 if (err < 0) { 76 if (err < 0) {
diff --git a/drivers/input/misc/wistron_btns.c b/drivers/input/misc/wistron_btns.c
index 38da6ab04384..c0afb71a3a6d 100644
--- a/drivers/input/misc/wistron_btns.c
+++ b/drivers/input/misc/wistron_btns.c
@@ -1328,7 +1328,7 @@ static struct platform_driver wistron_driver = {
1328 .driver = { 1328 .driver = {
1329 .name = "wistron-bios", 1329 .name = "wistron-bios",
1330 .owner = THIS_MODULE, 1330 .owner = THIS_MODULE,
1331#if CONFIG_PM 1331#ifdef CONFIG_PM
1332 .pm = &wistron_pm_ops, 1332 .pm = &wistron_pm_ops,
1333#endif 1333#endif
1334 }, 1334 },
diff --git a/drivers/input/mouse/Kconfig b/drivers/input/mouse/Kconfig
index 3feeb3af8abd..c714ca2407f8 100644
--- a/drivers/input/mouse/Kconfig
+++ b/drivers/input/mouse/Kconfig
@@ -70,7 +70,7 @@ config MOUSE_PS2_SYNAPTICS
70config MOUSE_PS2_LIFEBOOK 70config MOUSE_PS2_LIFEBOOK
71 bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED 71 bool "Fujitsu Lifebook PS/2 mouse protocol extension" if EMBEDDED
72 default y 72 default y
73 depends on MOUSE_PS2 && X86 73 depends on MOUSE_PS2 && X86 && DMI
74 help 74 help
75 Say Y here if you have a Fujitsu B-series Lifebook PS/2 75 Say Y here if you have a Fujitsu B-series Lifebook PS/2
76 TouchScreen connected to your system. 76 TouchScreen connected to your system.
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index 0d1d33468b43..4f8fe0886b2a 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -139,6 +139,7 @@ struct tp_finger {
139/* trackpad finger data size, empirically at least ten fingers */ 139/* trackpad finger data size, empirically at least ten fingers */
140#define SIZEOF_FINGER sizeof(struct tp_finger) 140#define SIZEOF_FINGER sizeof(struct tp_finger)
141#define SIZEOF_ALL_FINGERS (16 * SIZEOF_FINGER) 141#define SIZEOF_ALL_FINGERS (16 * SIZEOF_FINGER)
142#define MAX_FINGER_ORIENTATION 16384
142 143
143/* device-specific parameters */ 144/* device-specific parameters */
144struct bcm5974_param { 145struct bcm5974_param {
@@ -284,6 +285,26 @@ static void setup_events_to_report(struct input_dev *input_dev,
284 input_set_abs_params(input_dev, ABS_Y, 285 input_set_abs_params(input_dev, ABS_Y,
285 0, cfg->y.dim, cfg->y.fuzz, 0); 286 0, cfg->y.dim, cfg->y.fuzz, 0);
286 287
288 /* finger touch area */
289 input_set_abs_params(input_dev, ABS_MT_TOUCH_MAJOR,
290 cfg->w.devmin, cfg->w.devmax, 0, 0);
291 input_set_abs_params(input_dev, ABS_MT_TOUCH_MINOR,
292 cfg->w.devmin, cfg->w.devmax, 0, 0);
293 /* finger approach area */
294 input_set_abs_params(input_dev, ABS_MT_WIDTH_MAJOR,
295 cfg->w.devmin, cfg->w.devmax, 0, 0);
296 input_set_abs_params(input_dev, ABS_MT_WIDTH_MINOR,
297 cfg->w.devmin, cfg->w.devmax, 0, 0);
298 /* finger orientation */
299 input_set_abs_params(input_dev, ABS_MT_ORIENTATION,
300 -MAX_FINGER_ORIENTATION,
301 MAX_FINGER_ORIENTATION, 0, 0);
302 /* finger position */
303 input_set_abs_params(input_dev, ABS_MT_POSITION_X,
304 cfg->x.devmin, cfg->x.devmax, 0, 0);
305 input_set_abs_params(input_dev, ABS_MT_POSITION_Y,
306 cfg->y.devmin, cfg->y.devmax, 0, 0);
307
287 __set_bit(EV_KEY, input_dev->evbit); 308 __set_bit(EV_KEY, input_dev->evbit);
288 __set_bit(BTN_TOUCH, input_dev->keybit); 309 __set_bit(BTN_TOUCH, input_dev->keybit);
289 __set_bit(BTN_TOOL_FINGER, input_dev->keybit); 310 __set_bit(BTN_TOOL_FINGER, input_dev->keybit);
@@ -310,13 +331,29 @@ static int report_bt_state(struct bcm5974 *dev, int size)
310 return 0; 331 return 0;
311} 332}
312 333
334static void report_finger_data(struct input_dev *input,
335 const struct bcm5974_config *cfg,
336 const struct tp_finger *f)
337{
338 input_report_abs(input, ABS_MT_TOUCH_MAJOR, raw2int(f->force_major));
339 input_report_abs(input, ABS_MT_TOUCH_MINOR, raw2int(f->force_minor));
340 input_report_abs(input, ABS_MT_WIDTH_MAJOR, raw2int(f->size_major));
341 input_report_abs(input, ABS_MT_WIDTH_MINOR, raw2int(f->size_minor));
342 input_report_abs(input, ABS_MT_ORIENTATION,
343 MAX_FINGER_ORIENTATION - raw2int(f->orientation));
344 input_report_abs(input, ABS_MT_POSITION_X, raw2int(f->abs_x));
345 input_report_abs(input, ABS_MT_POSITION_Y,
346 cfg->y.devmin + cfg->y.devmax - raw2int(f->abs_y));
347 input_mt_sync(input);
348}
349
313/* report trackpad data as logical trackpad state */ 350/* report trackpad data as logical trackpad state */
314static int report_tp_state(struct bcm5974 *dev, int size) 351static int report_tp_state(struct bcm5974 *dev, int size)
315{ 352{
316 const struct bcm5974_config *c = &dev->cfg; 353 const struct bcm5974_config *c = &dev->cfg;
317 const struct tp_finger *f; 354 const struct tp_finger *f;
318 struct input_dev *input = dev->input; 355 struct input_dev *input = dev->input;
319 int raw_p, raw_w, raw_x, raw_y, raw_n; 356 int raw_p, raw_w, raw_x, raw_y, raw_n, i;
320 int ptest, origin, ibt = 0, nmin = 0, nmax = 0; 357 int ptest, origin, ibt = 0, nmin = 0, nmax = 0;
321 int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0; 358 int abs_p = 0, abs_w = 0, abs_x = 0, abs_y = 0;
322 359
@@ -329,6 +366,11 @@ static int report_tp_state(struct bcm5974 *dev, int size)
329 366
330 /* always track the first finger; when detached, start over */ 367 /* always track the first finger; when detached, start over */
331 if (raw_n) { 368 if (raw_n) {
369
370 /* report raw trackpad data */
371 for (i = 0; i < raw_n; i++)
372 report_finger_data(input, c, &f[i]);
373
332 raw_p = raw2int(f->force_major); 374 raw_p = raw2int(f->force_major);
333 raw_w = raw2int(f->size_major); 375 raw_w = raw2int(f->size_major);
334 raw_x = raw2int(f->abs_x); 376 raw_x = raw2int(f->abs_x);
diff --git a/drivers/input/mouse/hgpk.c b/drivers/input/mouse/hgpk.c
index 29dc6aade766..9169d1591c1f 100644
--- a/drivers/input/mouse/hgpk.c
+++ b/drivers/input/mouse/hgpk.c
@@ -423,7 +423,6 @@ static void hgpk_recalib_work(struct work_struct *work)
423 423
424static int hgpk_register(struct psmouse *psmouse) 424static int hgpk_register(struct psmouse *psmouse)
425{ 425{
426 struct input_dev *dev = psmouse->dev;
427 int err; 426 int err;
428 427
429 /* register handlers */ 428 /* register handlers */
diff --git a/drivers/input/mouse/lifebook.c b/drivers/input/mouse/lifebook.c
index 2e6bdfea0165..6d7aa10d10f0 100644
--- a/drivers/input/mouse/lifebook.c
+++ b/drivers/input/mouse/lifebook.c
@@ -44,7 +44,6 @@ static int lifebook_set_6byte_proto(const struct dmi_system_id *d)
44} 44}
45 45
46static const struct dmi_system_id __initconst lifebook_dmi_table[] = { 46static const struct dmi_system_id __initconst lifebook_dmi_table[] = {
47#if defined(CONFIG_DMI) && defined(CONFIG_X86)
48 { 47 {
49 /* FLORA-ie 55mi */ 48 /* FLORA-ie 55mi */
50 .matches = { 49 .matches = {
@@ -118,7 +117,6 @@ static const struct dmi_system_id __initconst lifebook_dmi_table[] = {
118 }, 117 },
119 }, 118 },
120 { } 119 { }
121#endif
122}; 120};
123 121
124void __init lifebook_module_init(void) 122void __init lifebook_module_init(void)
diff --git a/drivers/input/mouse/psmouse-base.c b/drivers/input/mouse/psmouse-base.c
index fd0bc094616a..9774bdfaa482 100644
--- a/drivers/input/mouse/psmouse-base.c
+++ b/drivers/input/mouse/psmouse-base.c
@@ -627,8 +627,15 @@ static int psmouse_extensions(struct psmouse *psmouse,
627 synaptics_hardware = true; 627 synaptics_hardware = true;
628 628
629 if (max_proto > PSMOUSE_IMEX) { 629 if (max_proto > PSMOUSE_IMEX) {
630 if (!set_properties || synaptics_init(psmouse) == 0) 630/*
631 * Try activating protocol, but check if support is enabled first, since
632 * we try detecting Synaptics even when protocol is disabled.
633 */
634 if (synaptics_supported() &&
635 (!set_properties || synaptics_init(psmouse) == 0)) {
631 return PSMOUSE_SYNAPTICS; 636 return PSMOUSE_SYNAPTICS;
637 }
638
632/* 639/*
633 * Some Synaptics touchpads can emulate extended protocols (like IMPS/2). 640 * Some Synaptics touchpads can emulate extended protocols (like IMPS/2).
634 * Unfortunately Logitech/Genius probes confuse some firmware versions so 641 * Unfortunately Logitech/Genius probes confuse some firmware versions so
@@ -683,19 +690,6 @@ static int psmouse_extensions(struct psmouse *psmouse,
683 max_proto = PSMOUSE_IMEX; 690 max_proto = PSMOUSE_IMEX;
684 } 691 }
685 692
686/*
687 * Try Finger Sensing Pad
688 */
689 if (max_proto > PSMOUSE_IMEX) {
690 if (fsp_detect(psmouse, set_properties) == 0) {
691 if (!set_properties || fsp_init(psmouse) == 0)
692 return PSMOUSE_FSP;
693/*
694 * Init failed, try basic relative protocols
695 */
696 max_proto = PSMOUSE_IMEX;
697 }
698 }
699 693
700 if (max_proto > PSMOUSE_IMEX) { 694 if (max_proto > PSMOUSE_IMEX) {
701 if (genius_detect(psmouse, set_properties) == 0) 695 if (genius_detect(psmouse, set_properties) == 0)
@@ -712,6 +706,21 @@ static int psmouse_extensions(struct psmouse *psmouse,
712 } 706 }
713 707
714/* 708/*
709 * Try Finger Sensing Pad. We do it here because its probe upsets
710 * Trackpoint devices (causing TP_READ_ID command to time out).
711 */
712 if (max_proto > PSMOUSE_IMEX) {
713 if (fsp_detect(psmouse, set_properties) == 0) {
714 if (!set_properties || fsp_init(psmouse) == 0)
715 return PSMOUSE_FSP;
716/*
717 * Init failed, try basic relative protocols
718 */
719 max_proto = PSMOUSE_IMEX;
720 }
721 }
722
723/*
715 * Reset to defaults in case the device got confused by extended 724 * Reset to defaults in case the device got confused by extended
716 * protocol probes. Note that we follow up with full reset because 725 * protocol probes. Note that we follow up with full reset because
717 * some mice put themselves to sleep when they see PSMOUSE_RESET_DIS. 726 * some mice put themselves to sleep when they see PSMOUSE_RESET_DIS.
@@ -1137,7 +1146,10 @@ static void psmouse_cleanup(struct serio *serio)
1137 if (psmouse->cleanup) 1146 if (psmouse->cleanup)
1138 psmouse->cleanup(psmouse); 1147 psmouse->cleanup(psmouse);
1139 1148
1140 psmouse_reset(psmouse); 1149/*
1150 * Reset the mouse to defaults (bare PS/2 protocol).
1151 */
1152 ps2_command(&psmouse->ps2dev, NULL, PSMOUSE_CMD_RESET_DIS);
1141 1153
1142/* 1154/*
1143 * Some boxes, such as HP nx7400, get terribly confused if mouse 1155 * Some boxes, such as HP nx7400, get terribly confused if mouse
@@ -1447,24 +1459,10 @@ ssize_t psmouse_attr_show_helper(struct device *dev, struct device_attribute *de
1447 struct serio *serio = to_serio_port(dev); 1459 struct serio *serio = to_serio_port(dev);
1448 struct psmouse_attribute *attr = to_psmouse_attr(devattr); 1460 struct psmouse_attribute *attr = to_psmouse_attr(devattr);
1449 struct psmouse *psmouse; 1461 struct psmouse *psmouse;
1450 int retval;
1451
1452 retval = serio_pin_driver(serio);
1453 if (retval)
1454 return retval;
1455
1456 if (serio->drv != &psmouse_drv) {
1457 retval = -ENODEV;
1458 goto out;
1459 }
1460 1462
1461 psmouse = serio_get_drvdata(serio); 1463 psmouse = serio_get_drvdata(serio);
1462 1464
1463 retval = attr->show(psmouse, attr->data, buf); 1465 return attr->show(psmouse, attr->data, buf);
1464
1465out:
1466 serio_unpin_driver(serio);
1467 return retval;
1468} 1466}
1469 1467
1470ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr, 1468ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *devattr,
@@ -1475,18 +1473,9 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev
1475 struct psmouse *psmouse, *parent = NULL; 1473 struct psmouse *psmouse, *parent = NULL;
1476 int retval; 1474 int retval;
1477 1475
1478 retval = serio_pin_driver(serio);
1479 if (retval)
1480 return retval;
1481
1482 if (serio->drv != &psmouse_drv) {
1483 retval = -ENODEV;
1484 goto out_unpin;
1485 }
1486
1487 retval = mutex_lock_interruptible(&psmouse_mutex); 1476 retval = mutex_lock_interruptible(&psmouse_mutex);
1488 if (retval) 1477 if (retval)
1489 goto out_unpin; 1478 goto out;
1490 1479
1491 psmouse = serio_get_drvdata(serio); 1480 psmouse = serio_get_drvdata(serio);
1492 1481
@@ -1516,8 +1505,7 @@ ssize_t psmouse_attr_set_helper(struct device *dev, struct device_attribute *dev
1516 1505
1517 out_unlock: 1506 out_unlock:
1518 mutex_unlock(&psmouse_mutex); 1507 mutex_unlock(&psmouse_mutex);
1519 out_unpin: 1508 out:
1520 serio_unpin_driver(serio);
1521 return retval; 1509 return retval;
1522} 1510}
1523 1511
@@ -1579,9 +1567,7 @@ static ssize_t psmouse_attr_set_protocol(struct psmouse *psmouse, void *data, co
1579 } 1567 }
1580 1568
1581 mutex_unlock(&psmouse_mutex); 1569 mutex_unlock(&psmouse_mutex);
1582 serio_unpin_driver(serio);
1583 serio_unregister_child_port(serio); 1570 serio_unregister_child_port(serio);
1584 serio_pin_driver_uninterruptible(serio);
1585 mutex_lock(&psmouse_mutex); 1571 mutex_lock(&psmouse_mutex);
1586 1572
1587 if (serio->drv != &psmouse_drv) { 1573 if (serio->drv != &psmouse_drv) {
diff --git a/drivers/input/mouse/sentelic.c b/drivers/input/mouse/sentelic.c
index 77b9fd0b3fbf..81a6b81cb2fe 100644
--- a/drivers/input/mouse/sentelic.c
+++ b/drivers/input/mouse/sentelic.c
@@ -2,7 +2,7 @@
2 * Finger Sensing Pad PS/2 mouse driver. 2 * Finger Sensing Pad PS/2 mouse driver.
3 * 3 *
4 * Copyright (C) 2005-2007 Asia Vital Components Co., Ltd. 4 * Copyright (C) 2005-2007 Asia Vital Components Co., Ltd.
5 * Copyright (C) 2005-2009 Tai-hwa Liang, Sentelic Corporation. 5 * Copyright (C) 2005-2010 Tai-hwa Liang, Sentelic Corporation.
6 * 6 *
7 * This program is free software; you can redistribute it and/or 7 * This program is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU General Public License 8 * modify it under the terms of the GNU General Public License
@@ -658,9 +658,9 @@ static psmouse_ret_t fsp_process_byte(struct psmouse *psmouse)
658 if (packet[3] & BIT(1)) 658 if (packet[3] & BIT(1))
659 button_status |= 0x0f; /* wheel up */ 659 button_status |= 0x0f; /* wheel up */
660 if (packet[3] & BIT(2)) 660 if (packet[3] & BIT(2))
661 button_status |= BIT(5);/* horizontal left */ 661 button_status |= BIT(4);/* horizontal left */
662 if (packet[3] & BIT(3)) 662 if (packet[3] & BIT(3))
663 button_status |= BIT(4);/* horizontal right */ 663 button_status |= BIT(5);/* horizontal right */
664 /* push back to packet queue */ 664 /* push back to packet queue */
665 if (button_status != 0) 665 if (button_status != 0)
666 packet[3] = button_status; 666 packet[3] = button_status;
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index 05689e732191..d3f5243fa093 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -743,6 +743,11 @@ int synaptics_init(struct psmouse *psmouse)
743 return -1; 743 return -1;
744} 744}
745 745
746bool synaptics_supported(void)
747{
748 return true;
749}
750
746#else /* CONFIG_MOUSE_PS2_SYNAPTICS */ 751#else /* CONFIG_MOUSE_PS2_SYNAPTICS */
747 752
748void __init synaptics_module_init(void) 753void __init synaptics_module_init(void)
@@ -754,5 +759,10 @@ int synaptics_init(struct psmouse *psmouse)
754 return -ENOSYS; 759 return -ENOSYS;
755} 760}
756 761
762bool synaptics_supported(void)
763{
764 return false;
765}
766
757#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */ 767#endif /* CONFIG_MOUSE_PS2_SYNAPTICS */
758 768
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index 838e7f2c9b30..f0f40a331dc8 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -109,5 +109,6 @@ void synaptics_module_init(void);
109int synaptics_detect(struct psmouse *psmouse, bool set_properties); 109int synaptics_detect(struct psmouse *psmouse, bool set_properties);
110int synaptics_init(struct psmouse *psmouse); 110int synaptics_init(struct psmouse *psmouse);
111void synaptics_reset(struct psmouse *psmouse); 111void synaptics_reset(struct psmouse *psmouse);
112bool synaptics_supported(void);
112 113
113#endif /* _SYNAPTICS_H */ 114#endif /* _SYNAPTICS_H */
diff --git a/drivers/input/serio/i8042-x86ia64io.h b/drivers/input/serio/i8042-x86ia64io.h
index 64b688daf48a..2a5982e532f8 100644
--- a/drivers/input/serio/i8042-x86ia64io.h
+++ b/drivers/input/serio/i8042-x86ia64io.h
@@ -524,6 +524,13 @@ static const struct dmi_system_id __initconst i8042_dmi_laptop_table[] = {
524 */ 524 */
525static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = { 525static const struct dmi_system_id __initconst i8042_dmi_dritek_table[] = {
526 { 526 {
527 /* Acer Aspire 5610 */
528 .matches = {
529 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
530 DMI_MATCH(DMI_PRODUCT_NAME, "Aspire 5610"),
531 },
532 },
533 {
527 /* Acer Aspire 5630 */ 534 /* Acer Aspire 5630 */
528 .matches = { 535 .matches = {
529 DMI_MATCH(DMI_SYS_VENDOR, "Acer"), 536 DMI_MATCH(DMI_SYS_VENDOR, "Acer"),
diff --git a/drivers/input/serio/serio.c b/drivers/input/serio/serio.c
index ee69ec399e08..c3b626e9eae7 100644
--- a/drivers/input/serio/serio.c
+++ b/drivers/input/serio/serio.c
@@ -275,13 +275,7 @@ static void serio_handle_event(void)
275 275
276 mutex_lock(&serio_mutex); 276 mutex_lock(&serio_mutex);
277 277
278 /* 278 while ((event = serio_get_event())) {
279 * Note that we handle only one event here to give swsusp
280 * a chance to freeze kseriod thread. Serio events should
281 * be pretty rare so we are not concerned about taking
282 * performance hit.
283 */
284 if ((event = serio_get_event())) {
285 279
286 switch (event->type) { 280 switch (event->type) {
287 281
@@ -367,10 +361,9 @@ static struct serio *serio_get_pending_child(struct serio *parent)
367 361
368static int serio_thread(void *nothing) 362static int serio_thread(void *nothing)
369{ 363{
370 set_freezable();
371 do { 364 do {
372 serio_handle_event(); 365 serio_handle_event();
373 wait_event_freezable(serio_wait, 366 wait_event_interruptible(serio_wait,
374 kthread_should_stop() || !list_empty(&serio_event_list)); 367 kthread_should_stop() || !list_empty(&serio_event_list));
375 } while (!kthread_should_stop()); 368 } while (!kthread_should_stop());
376 369
diff --git a/drivers/input/touchscreen/pcap_ts.c b/drivers/input/touchscreen/pcap_ts.c
index 67fcd33595de..b79097e3028a 100644
--- a/drivers/input/touchscreen/pcap_ts.c
+++ b/drivers/input/touchscreen/pcap_ts.c
@@ -233,7 +233,7 @@ static int pcap_ts_resume(struct device *dev)
233 return 0; 233 return 0;
234} 234}
235 235
236static struct dev_pm_ops pcap_ts_pm_ops = { 236static const struct dev_pm_ops pcap_ts_pm_ops = {
237 .suspend = pcap_ts_suspend, 237 .suspend = pcap_ts_suspend,
238 .resume = pcap_ts_resume, 238 .resume = pcap_ts_resume,
239}; 239};