aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/input/tablet/wacom_sys.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 10:59:01 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2010-10-25 10:59:01 -0400
commit3a99c6319064af3f2e18eb929f638d555dbf7a62 (patch)
treee611927f41142123dc8efed7e07a3a91151edb01 /drivers/input/tablet/wacom_sys.c
parent1dfd166e93f98892aa4427069a23ed73259983c8 (diff)
parent49327ad2bbbaf1945d5ba431522201574219d150 (diff)
Merge branch 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input
* 'for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/dtor/input: (75 commits) Input: wacom - specify Cinitq supported tools Input: ab8500-ponkey - fix IRQ freeing in error path Input: adp5588-keys - use more obvious i2c_device_id name string Input: ad7877 - switch to using threaded IRQ Input: ad7877 - use attribute group to control visibility of attributes Input: serio - add support for PS2Mult multiplexer protocol Input: wacom - properly enable runtime PM Input: ad7877 - filter events where pressure is beyond the maximum Input: ad7877 - implement EV_KEY:BTN_TOUCH reporting Input: ad7877 - implement specified chip select behavior Input: hp680_ts_input - use cancel_delayed_work_sync() Input: mousedev - correct lockdep annotation Input: ads7846 - switch to using threaded IRQ Input: serio - support multiple child devices per single parent Input: synaptics - simplify pass-through port handling Input: add ROHM BU21013 touch panel controller support Input: omap4-keypad - wake-up on events & long presses Input: omap4-keypad - fix interrupt line configuration Input: omap4-keypad - SYSCONFIG register configuration Input: omap4-keypad - use platform device helpers ...
Diffstat (limited to 'drivers/input/tablet/wacom_sys.c')
-rw-r--r--drivers/input/tablet/wacom_sys.c77
1 files changed, 53 insertions, 24 deletions
diff --git a/drivers/input/tablet/wacom_sys.c b/drivers/input/tablet/wacom_sys.c
index b35876ee6908..fc381498b798 100644
--- a/drivers/input/tablet/wacom_sys.c
+++ b/drivers/input/tablet/wacom_sys.c
@@ -120,14 +120,16 @@ static int wacom_open(struct input_dev *dev)
120 120
121out: 121out:
122 mutex_unlock(&wacom->lock); 122 mutex_unlock(&wacom->lock);
123 if (retval) 123 usb_autopm_put_interface(wacom->intf);
124 usb_autopm_put_interface(wacom->intf);
125 return retval; 124 return retval;
126} 125}
127 126
128static void wacom_close(struct input_dev *dev) 127static void wacom_close(struct input_dev *dev)
129{ 128{
130 struct wacom *wacom = input_get_drvdata(dev); 129 struct wacom *wacom = input_get_drvdata(dev);
130 int autopm_error;
131
132 autopm_error = usb_autopm_get_interface(wacom->intf);
131 133
132 mutex_lock(&wacom->lock); 134 mutex_lock(&wacom->lock);
133 usb_kill_urb(wacom->irq); 135 usb_kill_urb(wacom->irq);
@@ -135,7 +137,8 @@ static void wacom_close(struct input_dev *dev)
135 wacom->intf->needs_remote_wakeup = 0; 137 wacom->intf->needs_remote_wakeup = 0;
136 mutex_unlock(&wacom->lock); 138 mutex_unlock(&wacom->lock);
137 139
138 usb_autopm_put_interface(wacom->intf); 140 if (!autopm_error)
141 usb_autopm_put_interface(wacom->intf);
139} 142}
140 143
141static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc, 144static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hid_desc,
@@ -196,17 +199,30 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
196 features->pktlen = WACOM_PKGLEN_TPC2FG; 199 features->pktlen = WACOM_PKGLEN_TPC2FG;
197 features->device_type = BTN_TOOL_TRIPLETAP; 200 features->device_type = BTN_TOOL_TRIPLETAP;
198 } 201 }
199 features->x_max = 202 if (features->type == BAMBOO_PT) {
200 get_unaligned_le16(&report[i + 3]); 203 /* need to reset back */
201 features->x_phy = 204 features->pktlen = WACOM_PKGLEN_BBTOUCH;
202 get_unaligned_le16(&report[i + 6]); 205 features->device_type = BTN_TOOL_TRIPLETAP;
203 features->unit = report[i + 9]; 206 features->x_phy =
204 features->unitExpo = report[i + 11]; 207 get_unaligned_le16(&report[i + 5]);
205 i += 12; 208 features->x_max =
209 get_unaligned_le16(&report[i + 8]);
210 i += 15;
211 } else {
212 features->x_max =
213 get_unaligned_le16(&report[i + 3]);
214 features->x_phy =
215 get_unaligned_le16(&report[i + 6]);
216 features->unit = report[i + 9];
217 features->unitExpo = report[i + 11];
218 i += 12;
219 }
206 } else if (pen) { 220 } else if (pen) {
207 /* penabled only accepts exact bytes of data */ 221 /* penabled only accepts exact bytes of data */
208 if (features->type == TABLETPC2FG) 222 if (features->type == TABLETPC2FG)
209 features->pktlen = WACOM_PKGLEN_GRAPHIRE; 223 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
224 if (features->type == BAMBOO_PT)
225 features->pktlen = WACOM_PKGLEN_BBFUN;
210 features->device_type = BTN_TOOL_PEN; 226 features->device_type = BTN_TOOL_PEN;
211 features->x_max = 227 features->x_max =
212 get_unaligned_le16(&report[i + 3]); 228 get_unaligned_le16(&report[i + 3]);
@@ -235,6 +251,15 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
235 features->y_phy = 251 features->y_phy =
236 get_unaligned_le16(&report[i + 6]); 252 get_unaligned_le16(&report[i + 6]);
237 i += 7; 253 i += 7;
254 } else if (features->type == BAMBOO_PT) {
255 /* need to reset back */
256 features->pktlen = WACOM_PKGLEN_BBTOUCH;
257 features->device_type = BTN_TOOL_TRIPLETAP;
258 features->y_phy =
259 get_unaligned_le16(&report[i + 3]);
260 features->y_max =
261 get_unaligned_le16(&report[i + 6]);
262 i += 12;
238 } else { 263 } else {
239 features->y_max = 264 features->y_max =
240 features->x_max; 265 features->x_max;
@@ -246,6 +271,8 @@ static int wacom_parse_hid(struct usb_interface *intf, struct hid_descriptor *hi
246 /* penabled only accepts exact bytes of data */ 271 /* penabled only accepts exact bytes of data */
247 if (features->type == TABLETPC2FG) 272 if (features->type == TABLETPC2FG)
248 features->pktlen = WACOM_PKGLEN_GRAPHIRE; 273 features->pktlen = WACOM_PKGLEN_GRAPHIRE;
274 if (features->type == BAMBOO_PT)
275 features->pktlen = WACOM_PKGLEN_BBFUN;
249 features->device_type = BTN_TOOL_PEN; 276 features->device_type = BTN_TOOL_PEN;
250 features->y_max = 277 features->y_max =
251 get_unaligned_le16(&report[i + 3]); 278 get_unaligned_le16(&report[i + 3]);
@@ -296,8 +323,9 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
296 if (!rep_data) 323 if (!rep_data)
297 return error; 324 return error;
298 325
299 /* ask to report tablet data if it is 2FGT or not a Tablet PC */ 326 /* ask to report tablet data if it is 2FGT Tablet PC or
300 if (features->device_type == BTN_TOOL_TRIPLETAP) { 327 * not a Tablet PC */
328 if (features->type == TABLETPC2FG) {
301 do { 329 do {
302 rep_data[0] = 3; 330 rep_data[0] = 3;
303 rep_data[1] = 4; 331 rep_data[1] = 4;
@@ -309,7 +337,7 @@ static int wacom_query_tablet_data(struct usb_interface *intf, struct wacom_feat
309 WAC_HID_FEATURE_REPORT, report_id, 337 WAC_HID_FEATURE_REPORT, report_id,
310 rep_data, 3); 338 rep_data, 3);
311 } while ((error < 0 || rep_data[1] != 4) && limit++ < 5); 339 } while ((error < 0 || rep_data[1] != 4) && limit++ < 5);
312 } else if (features->type != TABLETPC && features->type != TABLETPC2FG) { 340 } else if (features->type != TABLETPC) {
313 do { 341 do {
314 rep_data[0] = 2; 342 rep_data[0] = 2;
315 rep_data[1] = 2; 343 rep_data[1] = 2;
@@ -334,11 +362,16 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
334 struct usb_host_interface *interface = intf->cur_altsetting; 362 struct usb_host_interface *interface = intf->cur_altsetting;
335 struct hid_descriptor *hid_desc; 363 struct hid_descriptor *hid_desc;
336 364
337 /* default device to penabled */ 365 /* default features */
338 features->device_type = BTN_TOOL_PEN; 366 features->device_type = BTN_TOOL_PEN;
339 367 features->x_fuzz = 4;
340 /* only Tablet PCs need to retrieve the info */ 368 features->y_fuzz = 4;
341 if ((features->type != TABLETPC) && (features->type != TABLETPC2FG)) 369 features->pressure_fuzz = 0;
370 features->distance_fuzz = 0;
371
372 /* only Tablet PCs and Bamboo P&T need to retrieve the info */
373 if ((features->type != TABLETPC) && (features->type != TABLETPC2FG) &&
374 (features->type != BAMBOO_PT))
342 goto out; 375 goto out;
343 376
344 if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) { 377 if (usb_get_extra_descriptor(interface, HID_DEVICET_HID, &hid_desc)) {
@@ -353,12 +386,6 @@ static int wacom_retrieve_hid_descriptor(struct usb_interface *intf,
353 if (error) 386 if (error)
354 goto out; 387 goto out;
355 388
356 /* touch device found but size is not defined. use default */
357 if (features->device_type == BTN_TOOL_DOUBLETAP && !features->x_max) {
358 features->x_max = 1023;
359 features->y_max = 1023;
360 }
361
362 out: 389 out:
363 return error; 390 return error;
364} 391}
@@ -494,9 +521,11 @@ static int wacom_probe(struct usb_interface *intf, const struct usb_device_id *i
494 if (error) 521 if (error)
495 goto fail2; 522 goto fail2;
496 523
524 wacom_setup_device_quirks(features);
525
497 strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name)); 526 strlcpy(wacom_wac->name, features->name, sizeof(wacom_wac->name));
498 527
499 if (features->type == TABLETPC || features->type == TABLETPC2FG) { 528 if (features->quirks & WACOM_QUIRK_MULTI_INPUT) {
500 /* Append the device type to the name */ 529 /* Append the device type to the name */
501 strlcat(wacom_wac->name, 530 strlcat(wacom_wac->name,
502 features->device_type == BTN_TOOL_PEN ? 531 features->device_type == BTN_TOOL_PEN ?