aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/mouse
diff options
context:
space:
mode:
authorDmitry Torokhov <dmitry.torokhov@gmail.com>2012-07-25 01:43:04 -0400
committerDmitry Torokhov <dmitry.torokhov@gmail.com>2012-07-25 01:43:04 -0400
commit314820c9e892d8f41ba4db300ec96770d9c8294b (patch)
tree3d5c59a429239b180c77e57f998a78d3f2b79827 /drivers/input/mouse
parente76b8ee25e034ab601b525abb95cea14aa167ed3 (diff)
parent07b8481d4aff73d6f451f25e74ea10240ff5131e (diff)
Merge branch 'next' into for-linus
Diffstat (limited to 'drivers/input/mouse')
-rw-r--r--drivers/input/mouse/appletouch.c59
-rw-r--r--drivers/input/mouse/bcm5974.c24
-rw-r--r--drivers/input/mouse/synaptics.c38
-rw-r--r--drivers/input/mouse/synaptics.h3
-rw-r--r--drivers/input/mouse/synaptics_usb.c2
5 files changed, 87 insertions, 39 deletions
diff --git a/drivers/input/mouse/appletouch.c b/drivers/input/mouse/appletouch.c
index 0acbc7d50d0..e42f1fa8cdc 100644
--- a/drivers/input/mouse/appletouch.c
+++ b/drivers/input/mouse/appletouch.c
@@ -195,6 +195,7 @@ enum atp_status_bits {
195struct atp { 195struct atp {
196 char phys[64]; 196 char phys[64];
197 struct usb_device *udev; /* usb device */ 197 struct usb_device *udev; /* usb device */
198 struct usb_interface *intf; /* usb interface */
198 struct urb *urb; /* usb request block */ 199 struct urb *urb; /* usb request block */
199 u8 *data; /* transferred data */ 200 u8 *data; /* transferred data */
200 struct input_dev *input; /* input dev */ 201 struct input_dev *input; /* input dev */
@@ -253,8 +254,9 @@ MODULE_PARM_DESC(debug, "Activate debugging output");
253 * packets (Report ID 2). This code changes device mode, so it 254 * packets (Report ID 2). This code changes device mode, so it
254 * sends raw sensor reports (Report ID 5). 255 * sends raw sensor reports (Report ID 5).
255 */ 256 */
256static int atp_geyser_init(struct usb_device *udev) 257static int atp_geyser_init(struct atp *dev)
257{ 258{
259 struct usb_device *udev = dev->udev;
258 char *data; 260 char *data;
259 int size; 261 int size;
260 int i; 262 int i;
@@ -262,7 +264,7 @@ static int atp_geyser_init(struct usb_device *udev)
262 264
263 data = kmalloc(8, GFP_KERNEL); 265 data = kmalloc(8, GFP_KERNEL);
264 if (!data) { 266 if (!data) {
265 err("Out of memory"); 267 dev_err(&dev->intf->dev, "Out of memory\n");
266 return -ENOMEM; 268 return -ENOMEM;
267 } 269 }
268 270
@@ -277,7 +279,7 @@ static int atp_geyser_init(struct usb_device *udev)
277 for (i = 0; i < 8; i++) 279 for (i = 0; i < 8; i++)
278 dprintk("appletouch[%d]: %d\n", i, data[i]); 280 dprintk("appletouch[%d]: %d\n", i, data[i]);
279 281
280 err("Failed to read mode from device."); 282 dev_err(&dev->intf->dev, "Failed to read mode from device.\n");
281 ret = -EIO; 283 ret = -EIO;
282 goto out_free; 284 goto out_free;
283 } 285 }
@@ -296,7 +298,7 @@ static int atp_geyser_init(struct usb_device *udev)
296 for (i = 0; i < 8; i++) 298 for (i = 0; i < 8; i++)
297 dprintk("appletouch[%d]: %d\n", i, data[i]); 299 dprintk("appletouch[%d]: %d\n", i, data[i]);
298 300
299 err("Failed to request geyser raw mode"); 301 dev_err(&dev->intf->dev, "Failed to request geyser raw mode\n");
300 ret = -EIO; 302 ret = -EIO;
301 goto out_free; 303 goto out_free;
302 } 304 }
@@ -313,16 +315,16 @@ out_free:
313static void atp_reinit(struct work_struct *work) 315static void atp_reinit(struct work_struct *work)
314{ 316{
315 struct atp *dev = container_of(work, struct atp, work); 317 struct atp *dev = container_of(work, struct atp, work);
316 struct usb_device *udev = dev->udev;
317 int retval; 318 int retval;
318 319
319 dprintk("appletouch: putting appletouch to sleep (reinit)\n"); 320 dprintk("appletouch: putting appletouch to sleep (reinit)\n");
320 atp_geyser_init(udev); 321 atp_geyser_init(dev);
321 322
322 retval = usb_submit_urb(dev->urb, GFP_ATOMIC); 323 retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
323 if (retval) 324 if (retval)
324 err("atp_reinit: usb_submit_urb failed with error %d", 325 dev_err(&dev->intf->dev,
325 retval); 326 "atp_reinit: usb_submit_urb failed with error %d\n",
327 retval);
326} 328}
327 329
328static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact, 330static int atp_calculate_abs(int *xy_sensors, int nb_sensors, int fact,
@@ -400,6 +402,7 @@ static inline void atp_report_fingers(struct input_dev *input, int fingers)
400static int atp_status_check(struct urb *urb) 402static int atp_status_check(struct urb *urb)
401{ 403{
402 struct atp *dev = urb->context; 404 struct atp *dev = urb->context;
405 struct usb_interface *intf = dev->intf;
403 406
404 switch (urb->status) { 407 switch (urb->status) {
405 case 0: 408 case 0:
@@ -407,8 +410,8 @@ static int atp_status_check(struct urb *urb)
407 break; 410 break;
408 case -EOVERFLOW: 411 case -EOVERFLOW:
409 if (!dev->overflow_warned) { 412 if (!dev->overflow_warned) {
410 printk(KERN_WARNING "appletouch: OVERFLOW with data " 413 dev_warn(&intf->dev,
411 "length %d, actual length is %d\n", 414 "appletouch: OVERFLOW with data length %d, actual length is %d\n",
412 dev->info->datalen, dev->urb->actual_length); 415 dev->info->datalen, dev->urb->actual_length);
413 dev->overflow_warned = true; 416 dev->overflow_warned = true;
414 } 417 }
@@ -416,13 +419,15 @@ static int atp_status_check(struct urb *urb)
416 case -ENOENT: 419 case -ENOENT:
417 case -ESHUTDOWN: 420 case -ESHUTDOWN:
418 /* This urb is terminated, clean up */ 421 /* This urb is terminated, clean up */
419 dbg("atp_complete: urb shutting down with status: %d", 422 dev_dbg(&intf->dev,
420 urb->status); 423 "atp_complete: urb shutting down with status: %d\n",
424 urb->status);
421 return ATP_URB_STATUS_ERROR_FATAL; 425 return ATP_URB_STATUS_ERROR_FATAL;
422 426
423 default: 427 default:
424 dbg("atp_complete: nonzero urb status received: %d", 428 dev_dbg(&intf->dev,
425 urb->status); 429 "atp_complete: nonzero urb status received: %d\n",
430 urb->status);
426 return ATP_URB_STATUS_ERROR; 431 return ATP_URB_STATUS_ERROR;
427 } 432 }
428 433
@@ -445,7 +450,8 @@ static void atp_detect_size(struct atp *dev)
445 for (i = dev->info->xsensors; i < ATP_XSENSORS; i++) { 450 for (i = dev->info->xsensors; i < ATP_XSENSORS; i++) {
446 if (dev->xy_cur[i]) { 451 if (dev->xy_cur[i]) {
447 452
448 printk(KERN_INFO "appletouch: 17\" model detected.\n"); 453 dev_info(&dev->intf->dev,
454 "appletouch: 17\" model detected.\n");
449 455
450 input_set_abs_params(dev->input, ABS_X, 0, 456 input_set_abs_params(dev->input, ABS_X, 0,
451 (dev->info->xsensors_17 - 1) * 457 (dev->info->xsensors_17 - 1) *
@@ -588,8 +594,9 @@ static void atp_complete_geyser_1_2(struct urb *urb)
588 exit: 594 exit:
589 retval = usb_submit_urb(dev->urb, GFP_ATOMIC); 595 retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
590 if (retval) 596 if (retval)
591 err("atp_complete: usb_submit_urb failed with result %d", 597 dev_err(&dev->intf->dev,
592 retval); 598 "atp_complete: usb_submit_urb failed with result %d\n",
599 retval);
593} 600}
594 601
595/* Interrupt function for older touchpads: GEYSER3/GEYSER4 */ 602/* Interrupt function for older touchpads: GEYSER3/GEYSER4 */
@@ -722,8 +729,9 @@ static void atp_complete_geyser_3_4(struct urb *urb)
722 exit: 729 exit:
723 retval = usb_submit_urb(dev->urb, GFP_ATOMIC); 730 retval = usb_submit_urb(dev->urb, GFP_ATOMIC);
724 if (retval) 731 if (retval)
725 err("atp_complete: usb_submit_urb failed with result %d", 732 dev_err(&dev->intf->dev,
726 retval); 733 "atp_complete: usb_submit_urb failed with result %d\n",
734 retval);
727} 735}
728 736
729static int atp_open(struct input_dev *input) 737static int atp_open(struct input_dev *input)
@@ -748,14 +756,12 @@ static void atp_close(struct input_dev *input)
748 756
749static int atp_handle_geyser(struct atp *dev) 757static int atp_handle_geyser(struct atp *dev)
750{ 758{
751 struct usb_device *udev = dev->udev;
752
753 if (dev->info != &fountain_info) { 759 if (dev->info != &fountain_info) {
754 /* switch to raw sensor mode */ 760 /* switch to raw sensor mode */
755 if (atp_geyser_init(udev)) 761 if (atp_geyser_init(dev))
756 return -EIO; 762 return -EIO;
757 763
758 printk(KERN_INFO "appletouch: Geyser mode initialized.\n"); 764 dev_info(&dev->intf->dev, "Geyser mode initialized.\n");
759 } 765 }
760 766
761 return 0; 767 return 0;
@@ -785,7 +791,7 @@ static int atp_probe(struct usb_interface *iface,
785 } 791 }
786 } 792 }
787 if (!int_in_endpointAddr) { 793 if (!int_in_endpointAddr) {
788 err("Could not find int-in endpoint"); 794 dev_err(&iface->dev, "Could not find int-in endpoint\n");
789 return -EIO; 795 return -EIO;
790 } 796 }
791 797
@@ -793,11 +799,12 @@ static int atp_probe(struct usb_interface *iface,
793 dev = kzalloc(sizeof(struct atp), GFP_KERNEL); 799 dev = kzalloc(sizeof(struct atp), GFP_KERNEL);
794 input_dev = input_allocate_device(); 800 input_dev = input_allocate_device();
795 if (!dev || !input_dev) { 801 if (!dev || !input_dev) {
796 err("Out of memory"); 802 dev_err(&iface->dev, "Out of memory\n");
797 goto err_free_devs; 803 goto err_free_devs;
798 } 804 }
799 805
800 dev->udev = udev; 806 dev->udev = udev;
807 dev->intf = iface;
801 dev->input = input_dev; 808 dev->input = input_dev;
802 dev->info = info; 809 dev->info = info;
803 dev->overflow_warned = false; 810 dev->overflow_warned = false;
@@ -886,7 +893,7 @@ static void atp_disconnect(struct usb_interface *iface)
886 usb_free_urb(dev->urb); 893 usb_free_urb(dev->urb);
887 kfree(dev); 894 kfree(dev);
888 } 895 }
889 printk(KERN_INFO "input: appletouch disconnected\n"); 896 dev_info(&iface->dev, "input: appletouch disconnected\n");
890} 897}
891 898
892static int atp_recover(struct atp *dev) 899static int atp_recover(struct atp *dev)
diff --git a/drivers/input/mouse/bcm5974.c b/drivers/input/mouse/bcm5974.c
index e410b98c227..d528c23e194 100644
--- a/drivers/input/mouse/bcm5974.c
+++ b/drivers/input/mouse/bcm5974.c
@@ -604,7 +604,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
604 int retval = 0, size; 604 int retval = 0, size;
605 605
606 if (!data) { 606 if (!data) {
607 err("bcm5974: out of memory"); 607 dev_err(&dev->intf->dev, "out of memory\n");
608 retval = -ENOMEM; 608 retval = -ENOMEM;
609 goto out; 609 goto out;
610 } 610 }
@@ -617,7 +617,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
617 BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); 617 BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000);
618 618
619 if (size != 8) { 619 if (size != 8) {
620 err("bcm5974: could not read from device"); 620 dev_err(&dev->intf->dev, "could not read from device\n");
621 retval = -EIO; 621 retval = -EIO;
622 goto out; 622 goto out;
623 } 623 }
@@ -635,7 +635,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
635 BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000); 635 BCM5974_WELLSPRING_MODE_REQUEST_INDEX, data, 8, 5000);
636 636
637 if (size != 8) { 637 if (size != 8) {
638 err("bcm5974: could not write to device"); 638 dev_err(&dev->intf->dev, "could not write to device\n");
639 retval = -EIO; 639 retval = -EIO;
640 goto out; 640 goto out;
641 } 641 }
@@ -651,6 +651,7 @@ static int bcm5974_wellspring_mode(struct bcm5974 *dev, bool on)
651static void bcm5974_irq_button(struct urb *urb) 651static void bcm5974_irq_button(struct urb *urb)
652{ 652{
653 struct bcm5974 *dev = urb->context; 653 struct bcm5974 *dev = urb->context;
654 struct usb_interface *intf = dev->intf;
654 int error; 655 int error;
655 656
656 switch (urb->status) { 657 switch (urb->status) {
@@ -660,10 +661,11 @@ static void bcm5974_irq_button(struct urb *urb)
660 case -ECONNRESET: 661 case -ECONNRESET:
661 case -ENOENT: 662 case -ENOENT:
662 case -ESHUTDOWN: 663 case -ESHUTDOWN:
663 dbg("bcm5974: button urb shutting down: %d", urb->status); 664 dev_dbg(&intf->dev, "button urb shutting down: %d\n",
665 urb->status);
664 return; 666 return;
665 default: 667 default:
666 dbg("bcm5974: button urb status: %d", urb->status); 668 dev_dbg(&intf->dev, "button urb status: %d\n", urb->status);
667 goto exit; 669 goto exit;
668 } 670 }
669 671
@@ -674,12 +676,13 @@ static void bcm5974_irq_button(struct urb *urb)
674exit: 676exit:
675 error = usb_submit_urb(dev->bt_urb, GFP_ATOMIC); 677 error = usb_submit_urb(dev->bt_urb, GFP_ATOMIC);
676 if (error) 678 if (error)
677 err("bcm5974: button urb failed: %d", error); 679 dev_err(&intf->dev, "button urb failed: %d\n", error);
678} 680}
679 681
680static void bcm5974_irq_trackpad(struct urb *urb) 682static void bcm5974_irq_trackpad(struct urb *urb)
681{ 683{
682 struct bcm5974 *dev = urb->context; 684 struct bcm5974 *dev = urb->context;
685 struct usb_interface *intf = dev->intf;
683 int error; 686 int error;
684 687
685 switch (urb->status) { 688 switch (urb->status) {
@@ -689,10 +692,11 @@ static void bcm5974_irq_trackpad(struct urb *urb)
689 case -ECONNRESET: 692 case -ECONNRESET:
690 case -ENOENT: 693 case -ENOENT:
691 case -ESHUTDOWN: 694 case -ESHUTDOWN:
692 dbg("bcm5974: trackpad urb shutting down: %d", urb->status); 695 dev_dbg(&intf->dev, "trackpad urb shutting down: %d\n",
696 urb->status);
693 return; 697 return;
694 default: 698 default:
695 dbg("bcm5974: trackpad urb status: %d", urb->status); 699 dev_dbg(&intf->dev, "trackpad urb status: %d\n", urb->status);
696 goto exit; 700 goto exit;
697 } 701 }
698 702
@@ -707,7 +711,7 @@ static void bcm5974_irq_trackpad(struct urb *urb)
707exit: 711exit:
708 error = usb_submit_urb(dev->tp_urb, GFP_ATOMIC); 712 error = usb_submit_urb(dev->tp_urb, GFP_ATOMIC);
709 if (error) 713 if (error)
710 err("bcm5974: trackpad urb failed: %d", error); 714 dev_err(&intf->dev, "trackpad urb failed: %d\n", error);
711} 715}
712 716
713/* 717/*
@@ -853,7 +857,7 @@ static int bcm5974_probe(struct usb_interface *iface,
853 dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL); 857 dev = kzalloc(sizeof(struct bcm5974), GFP_KERNEL);
854 input_dev = input_allocate_device(); 858 input_dev = input_allocate_device();
855 if (!dev || !input_dev) { 859 if (!dev || !input_dev) {
856 err("bcm5974: out of memory"); 860 dev_err(&iface->dev, "out of memory\n");
857 goto err_free_devs; 861 goto err_free_devs;
858 } 862 }
859 863
diff --git a/drivers/input/mouse/synaptics.c b/drivers/input/mouse/synaptics.c
index c703d53be3a..d5b390f75c9 100644
--- a/drivers/input/mouse/synaptics.c
+++ b/drivers/input/mouse/synaptics.c
@@ -139,6 +139,35 @@ static int synaptics_model_id(struct psmouse *psmouse)
139} 139}
140 140
141/* 141/*
142 * Read the board id from the touchpad
143 * The board id is encoded in the "QUERY MODES" response
144 */
145static int synaptics_board_id(struct psmouse *psmouse)
146{
147 struct synaptics_data *priv = psmouse->private;
148 unsigned char bid[3];
149
150 if (synaptics_send_cmd(psmouse, SYN_QUE_MODES, bid))
151 return -1;
152 priv->board_id = ((bid[0] & 0xfc) << 6) | bid[1];
153 return 0;
154}
155
156/*
157 * Read the firmware id from the touchpad
158 */
159static int synaptics_firmware_id(struct psmouse *psmouse)
160{
161 struct synaptics_data *priv = psmouse->private;
162 unsigned char fwid[3];
163
164 if (synaptics_send_cmd(psmouse, SYN_QUE_FIRMWARE_ID, fwid))
165 return -1;
166 priv->firmware_id = (fwid[0] << 16) | (fwid[1] << 8) | fwid[2];
167 return 0;
168}
169
170/*
142 * Read the capability-bits from the touchpad 171 * Read the capability-bits from the touchpad
143 * see also the SYN_CAP_* macros 172 * see also the SYN_CAP_* macros
144 */ 173 */
@@ -261,6 +290,10 @@ static int synaptics_query_hardware(struct psmouse *psmouse)
261 return -1; 290 return -1;
262 if (synaptics_model_id(psmouse)) 291 if (synaptics_model_id(psmouse))
263 return -1; 292 return -1;
293 if (synaptics_firmware_id(psmouse))
294 return -1;
295 if (synaptics_board_id(psmouse))
296 return -1;
264 if (synaptics_capability(psmouse)) 297 if (synaptics_capability(psmouse))
265 return -1; 298 return -1;
266 if (synaptics_resolution(psmouse)) 299 if (synaptics_resolution(psmouse))
@@ -1435,11 +1468,12 @@ static int __synaptics_init(struct psmouse *psmouse, bool absolute_mode)
1435 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS; 1468 priv->pkt_type = SYN_MODEL_NEWABS(priv->model_id) ? SYN_NEWABS : SYN_OLDABS;
1436 1469
1437 psmouse_info(psmouse, 1470 psmouse_info(psmouse,
1438 "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx\n", 1471 "Touchpad model: %ld, fw: %ld.%ld, id: %#lx, caps: %#lx/%#lx/%#lx, board id: %lu, fw id: %lu\n",
1439 SYN_ID_MODEL(priv->identity), 1472 SYN_ID_MODEL(priv->identity),
1440 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity), 1473 SYN_ID_MAJOR(priv->identity), SYN_ID_MINOR(priv->identity),
1441 priv->model_id, 1474 priv->model_id,
1442 priv->capabilities, priv->ext_cap, priv->ext_cap_0c); 1475 priv->capabilities, priv->ext_cap, priv->ext_cap_0c,
1476 priv->board_id, priv->firmware_id);
1443 1477
1444 set_input_params(psmouse->dev, priv); 1478 set_input_params(psmouse->dev, priv);
1445 1479
diff --git a/drivers/input/mouse/synaptics.h b/drivers/input/mouse/synaptics.h
index fd26ccca13d..e594af0b264 100644
--- a/drivers/input/mouse/synaptics.h
+++ b/drivers/input/mouse/synaptics.h
@@ -18,6 +18,7 @@
18#define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07 18#define SYN_QUE_SERIAL_NUMBER_SUFFIX 0x07
19#define SYN_QUE_RESOLUTION 0x08 19#define SYN_QUE_RESOLUTION 0x08
20#define SYN_QUE_EXT_CAPAB 0x09 20#define SYN_QUE_EXT_CAPAB 0x09
21#define SYN_QUE_FIRMWARE_ID 0x0a
21#define SYN_QUE_EXT_CAPAB_0C 0x0c 22#define SYN_QUE_EXT_CAPAB_0C 0x0c
22#define SYN_QUE_EXT_MAX_COORDS 0x0d 23#define SYN_QUE_EXT_MAX_COORDS 0x0d
23#define SYN_QUE_EXT_MIN_COORDS 0x0f 24#define SYN_QUE_EXT_MIN_COORDS 0x0f
@@ -148,6 +149,8 @@ struct synaptics_hw_state {
148struct synaptics_data { 149struct synaptics_data {
149 /* Data read from the touchpad */ 150 /* Data read from the touchpad */
150 unsigned long int model_id; /* Model-ID */ 151 unsigned long int model_id; /* Model-ID */
152 unsigned long int firmware_id; /* Firmware-ID */
153 unsigned long int board_id; /* Board-ID */
151 unsigned long int capabilities; /* Capabilities */ 154 unsigned long int capabilities; /* Capabilities */
152 unsigned long int ext_cap; /* Extended Capabilities */ 155 unsigned long int ext_cap; /* Extended Capabilities */
153 unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */ 156 unsigned long int ext_cap_0c; /* Ext Caps from 0x0c query */
diff --git a/drivers/input/mouse/synaptics_usb.c b/drivers/input/mouse/synaptics_usb.c
index 3c5eaaa5d15..64cf34ea760 100644
--- a/drivers/input/mouse/synaptics_usb.c
+++ b/drivers/input/mouse/synaptics_usb.c
@@ -364,7 +364,7 @@ static int synusb_probe(struct usb_interface *intf,
364 le16_to_cpu(udev->descriptor.idProduct)); 364 le16_to_cpu(udev->descriptor.idProduct));
365 365
366 if (synusb->flags & SYNUSB_STICK) 366 if (synusb->flags & SYNUSB_STICK)
367 strlcat(synusb->name, " (Stick) ", sizeof(synusb->name)); 367 strlcat(synusb->name, " (Stick)", sizeof(synusb->name));
368 368
369 usb_make_path(udev, synusb->phys, sizeof(synusb->phys)); 369 usb_make_path(udev, synusb->phys, sizeof(synusb->phys));
370 strlcat(synusb->phys, "/input0", sizeof(synusb->phys)); 370 strlcat(synusb->phys, "/input0", sizeof(synusb->phys));