Lines Matching refs:ftdi

195 	struct usb_ftdi *ftdi = kref_to_usb_ftdi(kref);  in ftdi_elan_delete()  local
196 dev_warn(&ftdi->udev->dev, "FREEING ftdi=%p\n", ftdi); in ftdi_elan_delete()
197 usb_put_dev(ftdi->udev); in ftdi_elan_delete()
198 ftdi->disconnected += 1; in ftdi_elan_delete()
200 list_del_init(&ftdi->ftdi_list); in ftdi_elan_delete()
203 kfree(ftdi->bulk_in_buffer); in ftdi_elan_delete()
204 ftdi->bulk_in_buffer = NULL; in ftdi_elan_delete()
205 kfree(ftdi); in ftdi_elan_delete()
208 static void ftdi_elan_put_kref(struct usb_ftdi *ftdi) in ftdi_elan_put_kref() argument
210 kref_put(&ftdi->kref, ftdi_elan_delete); in ftdi_elan_put_kref()
213 static void ftdi_elan_get_kref(struct usb_ftdi *ftdi) in ftdi_elan_get_kref() argument
215 kref_get(&ftdi->kref); in ftdi_elan_get_kref()
218 static void ftdi_elan_init_kref(struct usb_ftdi *ftdi) in ftdi_elan_init_kref() argument
220 kref_init(&ftdi->kref); in ftdi_elan_init_kref()
223 static void ftdi_status_requeue_work(struct usb_ftdi *ftdi, unsigned int delta) in ftdi_status_requeue_work() argument
225 if (!schedule_delayed_work(&ftdi->status_work, delta)) in ftdi_status_requeue_work()
226 kref_put(&ftdi->kref, ftdi_elan_delete); in ftdi_status_requeue_work()
229 static void ftdi_status_queue_work(struct usb_ftdi *ftdi, unsigned int delta) in ftdi_status_queue_work() argument
231 if (schedule_delayed_work(&ftdi->status_work, delta)) in ftdi_status_queue_work()
232 kref_get(&ftdi->kref); in ftdi_status_queue_work()
235 static void ftdi_status_cancel_work(struct usb_ftdi *ftdi) in ftdi_status_cancel_work() argument
237 if (cancel_delayed_work_sync(&ftdi->status_work)) in ftdi_status_cancel_work()
238 kref_put(&ftdi->kref, ftdi_elan_delete); in ftdi_status_cancel_work()
241 static void ftdi_command_requeue_work(struct usb_ftdi *ftdi, unsigned int delta) in ftdi_command_requeue_work() argument
243 if (!schedule_delayed_work(&ftdi->command_work, delta)) in ftdi_command_requeue_work()
244 kref_put(&ftdi->kref, ftdi_elan_delete); in ftdi_command_requeue_work()
247 static void ftdi_command_queue_work(struct usb_ftdi *ftdi, unsigned int delta) in ftdi_command_queue_work() argument
249 if (schedule_delayed_work(&ftdi->command_work, delta)) in ftdi_command_queue_work()
250 kref_get(&ftdi->kref); in ftdi_command_queue_work()
253 static void ftdi_command_cancel_work(struct usb_ftdi *ftdi) in ftdi_command_cancel_work() argument
255 if (cancel_delayed_work_sync(&ftdi->command_work)) in ftdi_command_cancel_work()
256 kref_put(&ftdi->kref, ftdi_elan_delete); in ftdi_command_cancel_work()
259 static void ftdi_response_requeue_work(struct usb_ftdi *ftdi, in ftdi_response_requeue_work() argument
262 if (!schedule_delayed_work(&ftdi->respond_work, delta)) in ftdi_response_requeue_work()
263 kref_put(&ftdi->kref, ftdi_elan_delete); in ftdi_response_requeue_work()
266 static void ftdi_respond_queue_work(struct usb_ftdi *ftdi, unsigned int delta) in ftdi_respond_queue_work() argument
268 if (schedule_delayed_work(&ftdi->respond_work, delta)) in ftdi_respond_queue_work()
269 kref_get(&ftdi->kref); in ftdi_respond_queue_work()
272 static void ftdi_response_cancel_work(struct usb_ftdi *ftdi) in ftdi_response_cancel_work() argument
274 if (cancel_delayed_work_sync(&ftdi->respond_work)) in ftdi_response_cancel_work()
275 kref_put(&ftdi->kref, ftdi_elan_delete); in ftdi_response_cancel_work()
280 struct usb_ftdi *ftdi = platform_device_to_usb_ftdi(pdev); in ftdi_elan_gone_away() local
281 ftdi->gone_away += 1; in ftdi_elan_gone_away()
282 ftdi_elan_put_kref(ftdi); in ftdi_elan_gone_away()
292 static void ftdi_elan_do_callback(struct usb_ftdi *ftdi,
294 static void ftdi_elan_kick_command_queue(struct usb_ftdi *ftdi);
295 static void ftdi_elan_kick_respond_queue(struct usb_ftdi *ftdi);
296 static int ftdi_elan_setupOHCI(struct usb_ftdi *ftdi);
297 static int ftdi_elan_checkingPCI(struct usb_ftdi *ftdi);
298 static int ftdi_elan_enumeratePCI(struct usb_ftdi *ftdi);
299 static int ftdi_elan_synchronize(struct usb_ftdi *ftdi);
300 static int ftdi_elan_stuck_waiting(struct usb_ftdi *ftdi);
301 static int ftdi_elan_command_engine(struct usb_ftdi *ftdi);
302 static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi);
303 static int ftdi_elan_hcd_init(struct usb_ftdi *ftdi) in ftdi_elan_hcd_init() argument
305 if (ftdi->platform_dev.dev.parent) in ftdi_elan_hcd_init()
308 ftdi_elan_get_kref(ftdi); in ftdi_elan_hcd_init()
309 ftdi->platform_data.potpg = 100; in ftdi_elan_hcd_init()
310 ftdi->platform_data.reset = NULL; in ftdi_elan_hcd_init()
311 ftdi->platform_dev.id = ftdi->sequence_num; in ftdi_elan_hcd_init()
312 ftdi->platform_dev.resource = ftdi->resources; in ftdi_elan_hcd_init()
313 ftdi->platform_dev.num_resources = ARRAY_SIZE(ftdi->resources); in ftdi_elan_hcd_init()
314 ftdi->platform_dev.dev.platform_data = &ftdi->platform_data; in ftdi_elan_hcd_init()
315 ftdi->platform_dev.dev.parent = NULL; in ftdi_elan_hcd_init()
316 ftdi->platform_dev.dev.release = ftdi_release_platform_dev; in ftdi_elan_hcd_init()
317 ftdi->platform_dev.dev.dma_mask = NULL; in ftdi_elan_hcd_init()
318 snprintf(ftdi->device_name, sizeof(ftdi->device_name), "u132_hcd"); in ftdi_elan_hcd_init()
319 ftdi->platform_dev.name = ftdi->device_name; in ftdi_elan_hcd_init()
320 dev_info(&ftdi->udev->dev, "requesting module '%s'\n", "u132_hcd"); in ftdi_elan_hcd_init()
322 dev_info(&ftdi->udev->dev, "registering '%s'\n", in ftdi_elan_hcd_init()
323 ftdi->platform_dev.name); in ftdi_elan_hcd_init()
325 return platform_device_register(&ftdi->platform_dev); in ftdi_elan_hcd_init()
328 static void ftdi_elan_abandon_completions(struct usb_ftdi *ftdi) in ftdi_elan_abandon_completions() argument
330 mutex_lock(&ftdi->u132_lock); in ftdi_elan_abandon_completions()
331 while (ftdi->respond_next > ftdi->respond_head) { in ftdi_elan_abandon_completions()
332 struct u132_respond *respond = &ftdi->respond[RESPOND_MASK & in ftdi_elan_abandon_completions()
333 ftdi->respond_head++]; in ftdi_elan_abandon_completions()
338 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_abandon_completions()
341 static void ftdi_elan_abandon_targets(struct usb_ftdi *ftdi) in ftdi_elan_abandon_targets() argument
344 mutex_lock(&ftdi->u132_lock); in ftdi_elan_abandon_targets()
346 struct u132_target *target = &ftdi->target[ed_number]; in ftdi_elan_abandon_targets()
349 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_abandon_targets()
350 ftdi_elan_do_callback(ftdi, target, NULL, 0); in ftdi_elan_abandon_targets()
351 mutex_lock(&ftdi->u132_lock); in ftdi_elan_abandon_targets()
354 ftdi->received = 0; in ftdi_elan_abandon_targets()
355 ftdi->expected = 4; in ftdi_elan_abandon_targets()
356 ftdi->ed_found = 0; in ftdi_elan_abandon_targets()
357 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_abandon_targets()
360 static void ftdi_elan_flush_targets(struct usb_ftdi *ftdi) in ftdi_elan_flush_targets() argument
363 mutex_lock(&ftdi->u132_lock); in ftdi_elan_flush_targets()
365 struct u132_target *target = &ftdi->target[ed_number]; in ftdi_elan_flush_targets()
368 int command_size = ftdi->command_next - in ftdi_elan_flush_targets()
369 ftdi->command_head; in ftdi_elan_flush_targets()
371 struct u132_command *command = &ftdi->command[ in ftdi_elan_flush_targets()
372 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_flush_targets()
380 ftdi->command_next += 1; in ftdi_elan_flush_targets()
381 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_flush_targets()
383 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_flush_targets()
385 mutex_lock(&ftdi->u132_lock); in ftdi_elan_flush_targets()
390 int command_size = ftdi->command_next - in ftdi_elan_flush_targets()
391 ftdi->command_head; in ftdi_elan_flush_targets()
393 struct u132_command *command = &ftdi->command[ in ftdi_elan_flush_targets()
394 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_flush_targets()
402 ftdi->command_next += 1; in ftdi_elan_flush_targets()
403 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_flush_targets()
405 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_flush_targets()
407 mutex_lock(&ftdi->u132_lock); in ftdi_elan_flush_targets()
412 ftdi->received = 0; in ftdi_elan_flush_targets()
413 ftdi->expected = 4; in ftdi_elan_flush_targets()
414 ftdi->ed_found = 0; in ftdi_elan_flush_targets()
415 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_flush_targets()
418 static void ftdi_elan_cancel_targets(struct usb_ftdi *ftdi) in ftdi_elan_cancel_targets() argument
421 mutex_lock(&ftdi->u132_lock); in ftdi_elan_cancel_targets()
423 struct u132_target *target = &ftdi->target[ed_number]; in ftdi_elan_cancel_targets()
426 int command_size = ftdi->command_next - in ftdi_elan_cancel_targets()
427 ftdi->command_head; in ftdi_elan_cancel_targets()
429 struct u132_command *command = &ftdi->command[ in ftdi_elan_cancel_targets()
430 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_cancel_targets()
438 ftdi->command_next += 1; in ftdi_elan_cancel_targets()
439 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_cancel_targets()
441 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_cancel_targets()
443 mutex_lock(&ftdi->u132_lock); in ftdi_elan_cancel_targets()
448 ftdi->received = 0; in ftdi_elan_cancel_targets()
449 ftdi->expected = 4; in ftdi_elan_cancel_targets()
450 ftdi->ed_found = 0; in ftdi_elan_cancel_targets()
451 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_cancel_targets()
454 static void ftdi_elan_kick_command_queue(struct usb_ftdi *ftdi) in ftdi_elan_kick_command_queue() argument
456 ftdi_command_queue_work(ftdi, 0); in ftdi_elan_kick_command_queue()
461 struct usb_ftdi *ftdi = in ftdi_elan_command_work() local
464 if (ftdi->disconnected > 0) { in ftdi_elan_command_work()
465 ftdi_elan_put_kref(ftdi); in ftdi_elan_command_work()
468 int retval = ftdi_elan_command_engine(ftdi); in ftdi_elan_command_work()
470 ftdi->disconnected += 1; in ftdi_elan_command_work()
472 ftdi->disconnected += 1; in ftdi_elan_command_work()
474 dev_err(&ftdi->udev->dev, "command error %d\n", retval); in ftdi_elan_command_work()
475 ftdi_command_requeue_work(ftdi, msecs_to_jiffies(10)); in ftdi_elan_command_work()
480 static void ftdi_elan_kick_respond_queue(struct usb_ftdi *ftdi) in ftdi_elan_kick_respond_queue() argument
482 ftdi_respond_queue_work(ftdi, 0); in ftdi_elan_kick_respond_queue()
487 struct usb_ftdi *ftdi = in ftdi_elan_respond_work() local
489 if (ftdi->disconnected > 0) { in ftdi_elan_respond_work()
490 ftdi_elan_put_kref(ftdi); in ftdi_elan_respond_work()
493 int retval = ftdi_elan_respond_engine(ftdi); in ftdi_elan_respond_work()
496 ftdi->disconnected += 1; in ftdi_elan_respond_work()
498 ftdi->disconnected += 1; in ftdi_elan_respond_work()
500 ftdi->disconnected += 1; in ftdi_elan_respond_work()
502 ftdi->disconnected += 1; in ftdi_elan_respond_work()
503 dev_err(&ftdi->udev->dev, "respond error %d\n", retval); in ftdi_elan_respond_work()
505 if (ftdi->disconnected > 0) { in ftdi_elan_respond_work()
506 ftdi_elan_abandon_completions(ftdi); in ftdi_elan_respond_work()
507 ftdi_elan_abandon_targets(ftdi); in ftdi_elan_respond_work()
509 ftdi_response_requeue_work(ftdi, msecs_to_jiffies(10)); in ftdi_elan_respond_work()
522 struct usb_ftdi *ftdi = in ftdi_elan_status_work() local
525 if (ftdi->disconnected > 0) { in ftdi_elan_status_work()
526 ftdi_elan_put_kref(ftdi); in ftdi_elan_status_work()
528 } else if (ftdi->synchronized == 0) { in ftdi_elan_status_work()
529 down(&ftdi->sw_lock); in ftdi_elan_status_work()
530 if (ftdi_elan_synchronize(ftdi) == 0) { in ftdi_elan_status_work()
531 ftdi->synchronized = 1; in ftdi_elan_status_work()
532 ftdi_command_queue_work(ftdi, 1); in ftdi_elan_status_work()
533 ftdi_respond_queue_work(ftdi, 1); in ftdi_elan_status_work()
534 up(&ftdi->sw_lock); in ftdi_elan_status_work()
537 dev_err(&ftdi->udev->dev, "synchronize failed\n"); in ftdi_elan_status_work()
538 up(&ftdi->sw_lock); in ftdi_elan_status_work()
541 } else if (ftdi->stuck_status > 0) { in ftdi_elan_status_work()
542 if (ftdi_elan_stuck_waiting(ftdi) == 0) { in ftdi_elan_status_work()
543 ftdi->stuck_status = 0; in ftdi_elan_status_work()
544 ftdi->synchronized = 0; in ftdi_elan_status_work()
545 } else if ((ftdi->stuck_status++ % 60) == 1) { in ftdi_elan_status_work()
546 dev_err(&ftdi->udev->dev, "WRONG type of card inserted - please remove\n"); in ftdi_elan_status_work()
548 dev_err(&ftdi->udev->dev, "WRONG type of card inserted - checked %d times\n", in ftdi_elan_status_work()
549 ftdi->stuck_status); in ftdi_elan_status_work()
551 } else if (ftdi->enumerated == 0) { in ftdi_elan_status_work()
552 if (ftdi_elan_enumeratePCI(ftdi) == 0) { in ftdi_elan_status_work()
553 ftdi->enumerated = 1; in ftdi_elan_status_work()
557 } else if (ftdi->initialized == 0) { in ftdi_elan_status_work()
558 if (ftdi_elan_setupOHCI(ftdi) == 0) { in ftdi_elan_status_work()
559 ftdi->initialized = 1; in ftdi_elan_status_work()
562 dev_err(&ftdi->udev->dev, "initialized failed - trying again in 10 seconds\n"); in ftdi_elan_status_work()
565 } else if (ftdi->registered == 0) { in ftdi_elan_status_work()
567 if (ftdi_elan_hcd_init(ftdi) == 0) { in ftdi_elan_status_work()
568 ftdi->registered = 1; in ftdi_elan_status_work()
570 dev_err(&ftdi->udev->dev, "register failed\n"); in ftdi_elan_status_work()
573 if (ftdi_elan_checkingPCI(ftdi) == 0) { in ftdi_elan_status_work()
575 } else if (ftdi->controlreg & 0x00400000) { in ftdi_elan_status_work()
576 if (ftdi->gone_away > 0) { in ftdi_elan_status_work()
577 …dev_err(&ftdi->udev->dev, "PCI device eject confirmed platform_dev.dev.parent=%p platform_dev.dev=… in ftdi_elan_status_work()
578 ftdi->platform_dev.dev.parent, in ftdi_elan_status_work()
579 &ftdi->platform_dev.dev); in ftdi_elan_status_work()
580 platform_device_unregister(&ftdi->platform_dev); in ftdi_elan_status_work()
581 ftdi->platform_dev.dev.parent = NULL; in ftdi_elan_status_work()
582 ftdi->registered = 0; in ftdi_elan_status_work()
583 ftdi->enumerated = 0; in ftdi_elan_status_work()
584 ftdi->card_ejected = 0; in ftdi_elan_status_work()
585 ftdi->initialized = 0; in ftdi_elan_status_work()
586 ftdi->gone_away = 0; in ftdi_elan_status_work()
588 ftdi_elan_flush_targets(ftdi); in ftdi_elan_status_work()
591 dev_err(&ftdi->udev->dev, "PCI device has disappeared\n"); in ftdi_elan_status_work()
592 ftdi_elan_cancel_targets(ftdi); in ftdi_elan_status_work()
594 ftdi->enumerated = 0; in ftdi_elan_status_work()
595 ftdi->initialized = 0; in ftdi_elan_status_work()
598 if (ftdi->disconnected > 0) { in ftdi_elan_status_work()
599 ftdi_elan_put_kref(ftdi); in ftdi_elan_status_work()
602 ftdi_status_requeue_work(ftdi, in ftdi_elan_status_work()
627 struct usb_ftdi *ftdi = usb_get_intfdata(interface); in ftdi_elan_open() local
628 if (!ftdi) { in ftdi_elan_open()
631 if (down_interruptible(&ftdi->sw_lock)) { in ftdi_elan_open()
634 ftdi_elan_get_kref(ftdi); in ftdi_elan_open()
635 file->private_data = ftdi; in ftdi_elan_open()
644 struct usb_ftdi *ftdi = file->private_data; in ftdi_elan_release() local
645 if (ftdi == NULL) in ftdi_elan_release()
647 up(&ftdi->sw_lock); /* decrement the count on our device */ in ftdi_elan_release()
648 ftdi_elan_put_kref(ftdi); in ftdi_elan_release()
667 struct usb_ftdi *ftdi = file->private_data; in ftdi_elan_read() local
668 if (ftdi->disconnected > 0) { in ftdi_elan_read()
672 have:if (ftdi->bulk_in_left > 0) { in ftdi_elan_read()
674 char *p = ++ftdi->bulk_in_last + ftdi->bulk_in_buffer; in ftdi_elan_read()
675 ftdi->bulk_in_left -= 1; in ftdi_elan_read()
692 int retval = usb_bulk_msg(ftdi->udev, in ftdi_elan_read()
693 usb_rcvbulkpipe(ftdi->udev, ftdi->bulk_in_endpointAddr), in ftdi_elan_read()
694 ftdi->bulk_in_buffer, ftdi->bulk_in_size, in ftdi_elan_read()
697 ftdi->bulk_in_left = packet_bytes - 2; in ftdi_elan_read()
698 ftdi->bulk_in_last = 1; in ftdi_elan_read()
720 struct usb_ftdi *ftdi = urb->context; in ftdi_elan_write_bulk_callback() local
725 dev_err(&ftdi->udev->dev, in ftdi_elan_write_bulk_callback()
732 static int fill_buffer_with_all_queued_commands(struct usb_ftdi *ftdi, in fill_buffer_with_all_queued_commands() argument
738 int i = ftdi->command_head; in fill_buffer_with_all_queued_commands()
740 struct u132_command *command = &ftdi->command[COMMAND_MASK & in fill_buffer_with_all_queued_commands()
759 static int ftdi_elan_total_command_size(struct usb_ftdi *ftdi, int command_size) in ftdi_elan_total_command_size() argument
763 int i = ftdi->command_head; in ftdi_elan_total_command_size()
765 struct u132_command *command = &ftdi->command[COMMAND_MASK & in ftdi_elan_total_command_size()
772 static int ftdi_elan_command_engine(struct usb_ftdi *ftdi) in ftdi_elan_command_engine() argument
779 int command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_command_engine()
782 total_size = ftdi_elan_total_command_size(ftdi, command_size); in ftdi_elan_command_engine()
786 buf = usb_alloc_coherent(ftdi->udev, total_size, GFP_KERNEL, in ftdi_elan_command_engine()
789 …dev_err(&ftdi->udev->dev, "could not get a buffer to write %d commands totaling %d bytes to the Ux… in ftdi_elan_command_engine()
794 ed_commands = fill_buffer_with_all_queued_commands(ftdi, buf, in ftdi_elan_command_engine()
796 usb_fill_bulk_urb(urb, ftdi->udev, usb_sndbulkpipe(ftdi->udev, in ftdi_elan_command_engine()
797 ftdi->bulk_out_endpointAddr), buf, total_size, in ftdi_elan_command_engine()
798 ftdi_elan_write_bulk_callback, ftdi); in ftdi_elan_command_engine()
816 …dev_err(&ftdi->udev->dev, "failed %d to submit urb %p to write %d commands totaling %d bytes to th… in ftdi_elan_command_engine()
818 usb_free_coherent(ftdi->udev, total_size, buf, urb->transfer_dma); in ftdi_elan_command_engine()
824 ftdi->command_head += command_size; in ftdi_elan_command_engine()
825 ftdi_elan_kick_respond_queue(ftdi); in ftdi_elan_command_engine()
829 static void ftdi_elan_do_callback(struct usb_ftdi *ftdi, in ftdi_elan_do_callback() argument
850 static char *have_ed_set_response(struct usb_ftdi *ftdi, in have_ed_set_response() argument
855 mutex_lock(&ftdi->u132_lock); in have_ed_set_response()
862 mutex_unlock(&ftdi->u132_lock); in have_ed_set_response()
863 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, in have_ed_set_response()
865 ftdi->received = 0; in have_ed_set_response()
866 ftdi->expected = 4; in have_ed_set_response()
867 ftdi->ed_found = 0; in have_ed_set_response()
868 return ftdi->response; in have_ed_set_response()
870 ftdi->expected = 4 + payload; in have_ed_set_response()
871 ftdi->ed_found = 1; in have_ed_set_response()
872 mutex_unlock(&ftdi->u132_lock); in have_ed_set_response()
877 mutex_unlock(&ftdi->u132_lock); in have_ed_set_response()
878 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, in have_ed_set_response()
880 ftdi->received = 0; in have_ed_set_response()
881 ftdi->expected = 4; in have_ed_set_response()
882 ftdi->ed_found = 0; in have_ed_set_response()
883 return ftdi->response; in have_ed_set_response()
887 static char *have_ed_get_response(struct usb_ftdi *ftdi, in have_ed_get_response() argument
891 mutex_lock(&ftdi->u132_lock); in have_ed_get_response()
896 mutex_unlock(&ftdi->u132_lock); in have_ed_get_response()
898 ftdi_elan_do_callback(ftdi, target, NULL, 0); in have_ed_get_response()
900 ftdi->received = 0; in have_ed_get_response()
901 ftdi->expected = 4; in have_ed_get_response()
902 ftdi->ed_found = 0; in have_ed_get_response()
903 return ftdi->response; in have_ed_get_response()
915 static int ftdi_elan_respond_engine(struct usb_ftdi *ftdi) in ftdi_elan_respond_engine() argument
917 u8 *b = ftdi->response + ftdi->received; in ftdi_elan_respond_engine()
923 int retval = usb_bulk_msg(ftdi->udev, in ftdi_elan_respond_engine()
924 usb_rcvbulkpipe(ftdi->udev, ftdi->bulk_in_endpointAddr), in ftdi_elan_respond_engine()
925 ftdi->bulk_in_buffer, ftdi->bulk_in_size, in ftdi_elan_respond_engine()
930 u8 *c = ftdi->bulk_in_buffer; in ftdi_elan_respond_engine()
940 ftdi->bulk_in_left = packet_bytes - 2; in ftdi_elan_respond_engine()
941 ftdi->bulk_in_last = 1; in ftdi_elan_respond_engine()
945 dev_err(&ftdi->udev->dev, "TIMED OUT with packet_bytes = %d with total %d bytes%s\n", in ftdi_elan_respond_engine()
949 dev_err(&ftdi->udev->dev, "ONLY %d bytes%s\n", in ftdi_elan_respond_engine()
953 dev_err(&ftdi->udev->dev, "TIMED OUT with packet_bytes = %d with total %d bytes%s\n", in ftdi_elan_respond_engine()
958 dev_err(&ftdi->udev->dev, "error = %d with packet_bytes = %d with total %d bytes%s\n", in ftdi_elan_respond_engine()
962 dev_err(&ftdi->udev->dev, "error = %d with packet_bytes = %d with total %d bytes%s\n", in ftdi_elan_respond_engine()
975 have:if (ftdi->bulk_in_left > 0) { in ftdi_elan_respond_engine()
976 u8 c = ftdi->bulk_in_buffer[++ftdi->bulk_in_last]; in ftdi_elan_respond_engine()
978 ftdi->bulk_in_left -= 1; in ftdi_elan_respond_engine()
979 if (ftdi->received == 0 && c == 0xFF) { in ftdi_elan_respond_engine()
983 if (++ftdi->received < ftdi->expected) { in ftdi_elan_respond_engine()
985 } else if (ftdi->ed_found) { in ftdi_elan_respond_engine()
986 int ed_number = (ftdi->response[0] >> 5) & 0x03; in ftdi_elan_respond_engine()
987 u16 ed_length = (ftdi->response[2] << 8) | in ftdi_elan_respond_engine()
988 ftdi->response[1]; in ftdi_elan_respond_engine()
989 struct u132_target *target = &ftdi->target[ed_number]; in ftdi_elan_respond_engine()
994 u8 *c = 4 + ftdi->response; in ftdi_elan_respond_engine()
1003 ftdi_elan_do_callback(ftdi, target, 4 + ftdi->response, in ftdi_elan_respond_engine()
1005 ftdi->received = 0; in ftdi_elan_respond_engine()
1006 ftdi->expected = 4; in ftdi_elan_respond_engine()
1007 ftdi->ed_found = 0; in ftdi_elan_respond_engine()
1008 b = ftdi->response; in ftdi_elan_respond_engine()
1010 } else if (ftdi->expected == 8) { in ftdi_elan_respond_engine()
1012 int respond_head = ftdi->respond_head++; in ftdi_elan_respond_engine()
1013 struct u132_respond *respond = &ftdi->respond[ in ftdi_elan_respond_engine()
1015 u32 data = ftdi->response[7]; in ftdi_elan_respond_engine()
1017 data |= ftdi->response[6]; in ftdi_elan_respond_engine()
1019 data |= ftdi->response[5]; in ftdi_elan_respond_engine()
1021 data |= ftdi->response[4]; in ftdi_elan_respond_engine()
1025 ftdi->received = 0; in ftdi_elan_respond_engine()
1026 ftdi->expected = 4; in ftdi_elan_respond_engine()
1027 ftdi->ed_found = 0; in ftdi_elan_respond_engine()
1028 b = ftdi->response; in ftdi_elan_respond_engine()
1029 buscmd = (ftdi->response[0] >> 0) & 0x0F; in ftdi_elan_respond_engine()
1035 dev_err(&ftdi->udev->dev, "Uxxx unknown(%0X) value = %08X\n", in ftdi_elan_respond_engine()
1039 if ((ftdi->response[0] & 0x80) == 0x00) { in ftdi_elan_respond_engine()
1040 ftdi->expected = 8; in ftdi_elan_respond_engine()
1043 int ed_number = (ftdi->response[0] >> 5) & 0x03; in ftdi_elan_respond_engine()
1044 int ed_type = (ftdi->response[0] >> 0) & 0x03; in ftdi_elan_respond_engine()
1045 u16 ed_length = (ftdi->response[2] << 8) | in ftdi_elan_respond_engine()
1046 ftdi->response[1]; in ftdi_elan_respond_engine()
1047 struct u132_target *target = &ftdi->target[ in ftdi_elan_respond_engine()
1049 target->halted = (ftdi->response[0] >> 3) & in ftdi_elan_respond_engine()
1051 target->skipped = (ftdi->response[0] >> 2) & in ftdi_elan_respond_engine()
1053 target->toggle_bits = (ftdi->response[3] >> 6) in ftdi_elan_respond_engine()
1055 target->error_count = (ftdi->response[3] >> 4) in ftdi_elan_respond_engine()
1057 target->condition_code = (ftdi->response[ in ftdi_elan_respond_engine()
1059 if ((ftdi->response[0] & 0x10) == 0x00) { in ftdi_elan_respond_engine()
1060 b = have_ed_set_response(ftdi, target, in ftdi_elan_respond_engine()
1065 b = have_ed_get_response(ftdi, target, in ftdi_elan_respond_engine()
1088 struct usb_ftdi *ftdi = file->private_data; in ftdi_elan_write() local
1090 if (ftdi->disconnected > 0) { in ftdi_elan_write()
1101 buf = usb_alloc_coherent(ftdi->udev, count, GFP_KERNEL, in ftdi_elan_write()
1111 usb_fill_bulk_urb(urb, ftdi->udev, usb_sndbulkpipe(ftdi->udev, in ftdi_elan_write()
1112 ftdi->bulk_out_endpointAddr), buf, count, in ftdi_elan_write()
1113 ftdi_elan_write_bulk_callback, ftdi); in ftdi_elan_write()
1117 dev_err(&ftdi->udev->dev, in ftdi_elan_write()
1126 usb_free_coherent(ftdi->udev, count, buf, urb->transfer_dma); in ftdi_elan_write()
1185 static int ftdi_elan_write_reg(struct usb_ftdi *ftdi, u32 data) in ftdi_elan_write_reg() argument
1187 wait:if (ftdi->disconnected > 0) { in ftdi_elan_write_reg()
1191 mutex_lock(&ftdi->u132_lock); in ftdi_elan_write_reg()
1192 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_write_reg()
1194 struct u132_command *command = &ftdi->command[ in ftdi_elan_write_reg()
1195 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_write_reg()
1203 ftdi->command_next += 1; in ftdi_elan_write_reg()
1204 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_write_reg()
1205 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_write_reg()
1208 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_write_reg()
1215 static int ftdi_elan_write_config(struct usb_ftdi *ftdi, int config_offset, in ftdi_elan_write_config() argument
1219 wait:if (ftdi->disconnected > 0) { in ftdi_elan_write_config()
1223 mutex_lock(&ftdi->u132_lock); in ftdi_elan_write_config()
1224 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_write_config()
1226 struct u132_command *command = &ftdi->command[ in ftdi_elan_write_config()
1227 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_write_config()
1235 ftdi->command_next += 1; in ftdi_elan_write_config()
1236 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_write_config()
1237 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_write_config()
1240 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_write_config()
1247 static int ftdi_elan_write_pcimem(struct usb_ftdi *ftdi, int mem_offset, in ftdi_elan_write_pcimem() argument
1251 wait:if (ftdi->disconnected > 0) { in ftdi_elan_write_pcimem()
1255 mutex_lock(&ftdi->u132_lock); in ftdi_elan_write_pcimem()
1256 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_write_pcimem()
1258 struct u132_command *command = &ftdi->command[ in ftdi_elan_write_pcimem()
1259 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_write_pcimem()
1267 ftdi->command_next += 1; in ftdi_elan_write_pcimem()
1268 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_write_pcimem()
1269 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_write_pcimem()
1272 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_write_pcimem()
1282 struct usb_ftdi *ftdi = platform_device_to_usb_ftdi(pdev); in usb_ftdi_elan_write_pcimem() local
1283 return ftdi_elan_write_pcimem(ftdi, mem_offset, width, data); in usb_ftdi_elan_write_pcimem()
1288 static int ftdi_elan_read_reg(struct usb_ftdi *ftdi, u32 *data) in ftdi_elan_read_reg() argument
1290 wait:if (ftdi->disconnected > 0) { in ftdi_elan_read_reg()
1295 mutex_lock(&ftdi->u132_lock); in ftdi_elan_read_reg()
1296 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_read_reg()
1297 respond_size = ftdi->respond_next - ftdi->respond_head; in ftdi_elan_read_reg()
1300 struct u132_command *command = &ftdi->command[ in ftdi_elan_read_reg()
1301 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_read_reg()
1302 struct u132_respond *respond = &ftdi->respond[ in ftdi_elan_read_reg()
1303 RESPOND_MASK & ftdi->respond_next]; in ftdi_elan_read_reg()
1315 ftdi->command_next += 1; in ftdi_elan_read_reg()
1316 ftdi->respond_next += 1; in ftdi_elan_read_reg()
1317 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_read_reg()
1318 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_read_reg()
1322 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_read_reg()
1329 static int ftdi_elan_read_config(struct usb_ftdi *ftdi, int config_offset, in ftdi_elan_read_config() argument
1333 wait:if (ftdi->disconnected > 0) { in ftdi_elan_read_config()
1338 mutex_lock(&ftdi->u132_lock); in ftdi_elan_read_config()
1339 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_read_config()
1340 respond_size = ftdi->respond_next - ftdi->respond_head; in ftdi_elan_read_config()
1343 struct u132_command *command = &ftdi->command[ in ftdi_elan_read_config()
1344 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_read_config()
1345 struct u132_respond *respond = &ftdi->respond[ in ftdi_elan_read_config()
1346 RESPOND_MASK & ftdi->respond_next]; in ftdi_elan_read_config()
1359 ftdi->command_next += 1; in ftdi_elan_read_config()
1360 ftdi->respond_next += 1; in ftdi_elan_read_config()
1361 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_read_config()
1362 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_read_config()
1366 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_read_config()
1373 static int ftdi_elan_read_pcimem(struct usb_ftdi *ftdi, int mem_offset, in ftdi_elan_read_pcimem() argument
1377 wait:if (ftdi->disconnected > 0) { in ftdi_elan_read_pcimem()
1382 mutex_lock(&ftdi->u132_lock); in ftdi_elan_read_pcimem()
1383 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_read_pcimem()
1384 respond_size = ftdi->respond_next - ftdi->respond_head; in ftdi_elan_read_pcimem()
1387 struct u132_command *command = &ftdi->command[ in ftdi_elan_read_pcimem()
1388 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_read_pcimem()
1389 struct u132_respond *respond = &ftdi->respond[ in ftdi_elan_read_pcimem()
1390 RESPOND_MASK & ftdi->respond_next]; in ftdi_elan_read_pcimem()
1403 ftdi->command_next += 1; in ftdi_elan_read_pcimem()
1404 ftdi->respond_next += 1; in ftdi_elan_read_pcimem()
1405 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_read_pcimem()
1406 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_read_pcimem()
1410 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_read_pcimem()
1420 struct usb_ftdi *ftdi = platform_device_to_usb_ftdi(pdev); in usb_ftdi_elan_read_pcimem() local
1421 if (ftdi->initialized == 0) { in usb_ftdi_elan_read_pcimem()
1424 return ftdi_elan_read_pcimem(ftdi, mem_offset, width, data); in usb_ftdi_elan_read_pcimem()
1429 static int ftdi_elan_edset_setup(struct usb_ftdi *ftdi, u8 ed_number, in ftdi_elan_edset_setup() argument
1436 wait:if (ftdi->disconnected > 0) { in ftdi_elan_edset_setup()
1438 } else if (ftdi->initialized == 0) { in ftdi_elan_edset_setup()
1442 mutex_lock(&ftdi->u132_lock); in ftdi_elan_edset_setup()
1443 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_edset_setup()
1445 struct u132_target *target = &ftdi->target[ed]; in ftdi_elan_edset_setup()
1446 struct u132_command *command = &ftdi->command[ in ftdi_elan_edset_setup()
1447 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_edset_setup()
1460 ftdi->command_next += 1; in ftdi_elan_edset_setup()
1461 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_edset_setup()
1462 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_setup()
1465 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_setup()
1478 struct usb_ftdi *ftdi = platform_device_to_usb_ftdi(pdev); in usb_ftdi_elan_edset_setup() local
1479 return ftdi_elan_edset_setup(ftdi, ed_number, endp, urb, address, in usb_ftdi_elan_edset_setup()
1485 static int ftdi_elan_edset_input(struct usb_ftdi *ftdi, u8 ed_number, in ftdi_elan_edset_input() argument
1492 wait:if (ftdi->disconnected > 0) { in ftdi_elan_edset_input()
1494 } else if (ftdi->initialized == 0) { in ftdi_elan_edset_input()
1498 mutex_lock(&ftdi->u132_lock); in ftdi_elan_edset_input()
1499 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_edset_input()
1501 struct u132_target *target = &ftdi->target[ed]; in ftdi_elan_edset_input()
1502 struct u132_command *command = &ftdi->command[ in ftdi_elan_edset_input()
1503 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_edset_input()
1524 ftdi->command_next += 1; in ftdi_elan_edset_input()
1525 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_edset_input()
1526 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_input()
1529 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_input()
1542 struct usb_ftdi *ftdi = platform_device_to_usb_ftdi(pdev); in usb_ftdi_elan_edset_input() local
1543 return ftdi_elan_edset_input(ftdi, ed_number, endp, urb, address, in usb_ftdi_elan_edset_input()
1549 static int ftdi_elan_edset_empty(struct usb_ftdi *ftdi, u8 ed_number, in ftdi_elan_edset_empty() argument
1556 wait:if (ftdi->disconnected > 0) { in ftdi_elan_edset_empty()
1558 } else if (ftdi->initialized == 0) { in ftdi_elan_edset_empty()
1562 mutex_lock(&ftdi->u132_lock); in ftdi_elan_edset_empty()
1563 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_edset_empty()
1565 struct u132_target *target = &ftdi->target[ed]; in ftdi_elan_edset_empty()
1566 struct u132_command *command = &ftdi->command[ in ftdi_elan_edset_empty()
1567 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_edset_empty()
1580 ftdi->command_next += 1; in ftdi_elan_edset_empty()
1581 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_edset_empty()
1582 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_empty()
1585 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_empty()
1598 struct usb_ftdi *ftdi = platform_device_to_usb_ftdi(pdev); in usb_ftdi_elan_edset_empty() local
1599 return ftdi_elan_edset_empty(ftdi, ed_number, endp, urb, address, in usb_ftdi_elan_edset_empty()
1605 static int ftdi_elan_edset_output(struct usb_ftdi *ftdi, u8 ed_number, in ftdi_elan_edset_output() argument
1612 wait:if (ftdi->disconnected > 0) { in ftdi_elan_edset_output()
1614 } else if (ftdi->initialized == 0) { in ftdi_elan_edset_output()
1618 mutex_lock(&ftdi->u132_lock); in ftdi_elan_edset_output()
1619 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_edset_output()
1628 struct u132_target *target = &ftdi->target[ed]; in ftdi_elan_edset_output()
1629 struct u132_command *command = &ftdi->command[ in ftdi_elan_edset_output()
1630 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_edset_output()
1658 ftdi->command_next += 1; in ftdi_elan_edset_output()
1659 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_edset_output()
1660 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_output()
1663 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_output()
1676 struct usb_ftdi *ftdi = platform_device_to_usb_ftdi(pdev); in usb_ftdi_elan_edset_output() local
1677 return ftdi_elan_edset_output(ftdi, ed_number, endp, urb, address, in usb_ftdi_elan_edset_output()
1683 static int ftdi_elan_edset_single(struct usb_ftdi *ftdi, u8 ed_number, in ftdi_elan_edset_single() argument
1690 wait:if (ftdi->disconnected > 0) { in ftdi_elan_edset_single()
1692 } else if (ftdi->initialized == 0) { in ftdi_elan_edset_single()
1696 mutex_lock(&ftdi->u132_lock); in ftdi_elan_edset_single()
1697 command_size = ftdi->command_next - ftdi->command_head; in ftdi_elan_edset_single()
1701 struct u132_target *target = &ftdi->target[ed]; in ftdi_elan_edset_single()
1702 struct u132_command *command = &ftdi->command[ in ftdi_elan_edset_single()
1703 COMMAND_MASK & ftdi->command_next]; in ftdi_elan_edset_single()
1722 ftdi->command_next += 1; in ftdi_elan_edset_single()
1723 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_edset_single()
1724 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_single()
1727 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_single()
1740 struct usb_ftdi *ftdi = platform_device_to_usb_ftdi(pdev); in usb_ftdi_elan_edset_single() local
1741 return ftdi_elan_edset_single(ftdi, ed_number, endp, urb, address, in usb_ftdi_elan_edset_single()
1747 static int ftdi_elan_edset_flush(struct usb_ftdi *ftdi, u8 ed_number, in ftdi_elan_edset_flush() argument
1751 if (ftdi->disconnected > 0) { in ftdi_elan_edset_flush()
1753 } else if (ftdi->initialized == 0) { in ftdi_elan_edset_flush()
1756 struct u132_target *target = &ftdi->target[ed]; in ftdi_elan_edset_flush()
1757 mutex_lock(&ftdi->u132_lock); in ftdi_elan_edset_flush()
1759 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_flush()
1764 int command_size = ftdi->command_next - in ftdi_elan_edset_flush()
1765 ftdi->command_head; in ftdi_elan_edset_flush()
1768 &ftdi->command[COMMAND_MASK & in ftdi_elan_edset_flush()
1769 ftdi->command_next]; in ftdi_elan_edset_flush()
1778 ftdi->command_next += 1; in ftdi_elan_edset_flush()
1779 ftdi_elan_kick_command_queue(ftdi); in ftdi_elan_edset_flush()
1781 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_flush()
1783 mutex_lock(&ftdi->u132_lock); in ftdi_elan_edset_flush()
1787 mutex_unlock(&ftdi->u132_lock); in ftdi_elan_edset_flush()
1796 struct usb_ftdi *ftdi = platform_device_to_usb_ftdi(pdev); in usb_ftdi_elan_edset_flush() local
1797 return ftdi_elan_edset_flush(ftdi, ed_number, endp); in usb_ftdi_elan_edset_flush()
1802 static int ftdi_elan_flush_input_fifo(struct usb_ftdi *ftdi) in ftdi_elan_flush_input_fifo() argument
1809 int retval = usb_bulk_msg(ftdi->udev, in ftdi_elan_flush_input_fifo()
1810 usb_rcvbulkpipe(ftdi->udev, ftdi->bulk_in_endpointAddr), in ftdi_elan_flush_input_fifo()
1811 ftdi->bulk_in_buffer, ftdi->bulk_in_size, in ftdi_elan_flush_input_fifo()
1817 char *b = ftdi->bulk_in_buffer; in ftdi_elan_flush_input_fifo()
1833 char s1 = ftdi->bulk_in_buffer[0]; in ftdi_elan_flush_input_fifo()
1834 char s2 = ftdi->bulk_in_buffer[1]; in ftdi_elan_flush_input_fifo()
1840 dev_err(&ftdi->udev->dev, "STATUS ERROR retry limit reached\n"); in ftdi_elan_flush_input_fifo()
1844 char b1 = ftdi->bulk_in_buffer[0]; in ftdi_elan_flush_input_fifo()
1845 dev_err(&ftdi->udev->dev, "only one byte flushed from FTDI = %02X\n", in ftdi_elan_flush_input_fifo()
1850 dev_err(&ftdi->udev->dev, "STATUS ERROR retry limit reached\n"); in ftdi_elan_flush_input_fifo()
1857 dev_err(&ftdi->udev->dev, "TIMED OUT retry limit reached\n"); in ftdi_elan_flush_input_fifo()
1864 dev_err(&ftdi->udev->dev, "empty packet retry limit reached\n"); in ftdi_elan_flush_input_fifo()
1868 dev_err(&ftdi->udev->dev, "error = %d\n", retval); in ftdi_elan_flush_input_fifo()
1880 static int ftdi_elan_synchronize_flush(struct usb_ftdi *ftdi) in ftdi_elan_synchronize_flush() argument
1890 buf = usb_alloc_coherent(ftdi->udev, I, GFP_KERNEL, &urb->transfer_dma); in ftdi_elan_synchronize_flush()
1892 dev_err(&ftdi->udev->dev, "could not get a buffer for flush sequence\n"); in ftdi_elan_synchronize_flush()
1898 usb_fill_bulk_urb(urb, ftdi->udev, usb_sndbulkpipe(ftdi->udev, in ftdi_elan_synchronize_flush()
1899 ftdi->bulk_out_endpointAddr), buf, i, in ftdi_elan_synchronize_flush()
1900 ftdi_elan_write_bulk_callback, ftdi); in ftdi_elan_synchronize_flush()
1904 dev_err(&ftdi->udev->dev, "failed to submit urb containing the flush sequence\n"); in ftdi_elan_synchronize_flush()
1905 usb_free_coherent(ftdi->udev, i, buf, urb->transfer_dma); in ftdi_elan_synchronize_flush()
1918 static int ftdi_elan_synchronize_reset(struct usb_ftdi *ftdi) in ftdi_elan_synchronize_reset() argument
1928 buf = usb_alloc_coherent(ftdi->udev, I, GFP_KERNEL, &urb->transfer_dma); in ftdi_elan_synchronize_reset()
1930 dev_err(&ftdi->udev->dev, "could not get a buffer for the reset sequence\n"); in ftdi_elan_synchronize_reset()
1938 usb_fill_bulk_urb(urb, ftdi->udev, usb_sndbulkpipe(ftdi->udev, in ftdi_elan_synchronize_reset()
1939 ftdi->bulk_out_endpointAddr), buf, i, in ftdi_elan_synchronize_reset()
1940 ftdi_elan_write_bulk_callback, ftdi); in ftdi_elan_synchronize_reset()
1944 dev_err(&ftdi->udev->dev, "failed to submit urb containing the reset sequence\n"); in ftdi_elan_synchronize_reset()
1945 usb_free_coherent(ftdi->udev, i, buf, urb->transfer_dma); in ftdi_elan_synchronize_reset()
1953 static int ftdi_elan_synchronize(struct usb_ftdi *ftdi) in ftdi_elan_synchronize() argument
1960 retval = ftdi_elan_flush_input_fifo(ftdi); in ftdi_elan_synchronize()
1963 ftdi->bulk_in_left = 0; in ftdi_elan_synchronize()
1964 ftdi->bulk_in_last = -1; in ftdi_elan_synchronize()
1968 retval = ftdi_elan_synchronize_flush(ftdi); in ftdi_elan_synchronize()
1971 retval = ftdi_elan_flush_input_fifo(ftdi); in ftdi_elan_synchronize()
1974 reset:retval = ftdi_elan_synchronize_reset(ftdi); in ftdi_elan_synchronize()
1981 retval = usb_bulk_msg(ftdi->udev, in ftdi_elan_synchronize()
1982 usb_rcvbulkpipe(ftdi->udev, in ftdi_elan_synchronize()
1983 ftdi->bulk_in_endpointAddr), in ftdi_elan_synchronize()
1984 ftdi->bulk_in_buffer, ftdi->bulk_in_size, in ftdi_elan_synchronize()
1990 char *b = ftdi->bulk_in_buffer; in ftdi_elan_synchronize()
2012 dev_err(&ftdi->udev->dev, "retry limit reached\n"); in ftdi_elan_synchronize()
2017 unsigned char s1 = ftdi->bulk_in_buffer[0]; in ftdi_elan_synchronize()
2018 unsigned char s2 = ftdi->bulk_in_buffer[1]; in ftdi_elan_synchronize()
2028 dev_err(&ftdi->udev->dev, "retry limit reached\n"); in ftdi_elan_synchronize()
2036 dev_err(&ftdi->udev->dev, "retry limit reached\n"); in ftdi_elan_synchronize()
2043 dev_err(&ftdi->udev->dev, "TIMED OUT retry limit reached\n"); in ftdi_elan_synchronize()
2050 dev_err(&ftdi->udev->dev, "empty packet retry limit reached\n"); in ftdi_elan_synchronize()
2055 dev_err(&ftdi->udev->dev, "error = %d\n", in ftdi_elan_synchronize()
2060 dev_err(&ftdi->udev->dev, "retry limit reached\n"); in ftdi_elan_synchronize()
2066 dev_err(&ftdi->udev->dev, "failed to synchronize\n"); in ftdi_elan_synchronize()
2070 static int ftdi_elan_stuck_waiting(struct usb_ftdi *ftdi) in ftdi_elan_stuck_waiting() argument
2077 int retval = usb_bulk_msg(ftdi->udev, in ftdi_elan_stuck_waiting()
2078 usb_rcvbulkpipe(ftdi->udev, ftdi->bulk_in_endpointAddr), in ftdi_elan_stuck_waiting()
2079 ftdi->bulk_in_buffer, ftdi->bulk_in_size, in ftdi_elan_stuck_waiting()
2085 char *b = ftdi->bulk_in_buffer; in ftdi_elan_stuck_waiting()
2100 char s1 = ftdi->bulk_in_buffer[0]; in ftdi_elan_stuck_waiting()
2101 char s2 = ftdi->bulk_in_buffer[1]; in ftdi_elan_stuck_waiting()
2110 char b1 = ftdi->bulk_in_buffer[0]; in ftdi_elan_stuck_waiting()
2111 dev_err(&ftdi->udev->dev, "only one byte flushed from FTDI = %02X\n", b1); in ftdi_elan_stuck_waiting()
2116 dev_err(&ftdi->udev->dev, "STATUS ERROR retry limit reached\n"); in ftdi_elan_stuck_waiting()
2123 dev_err(&ftdi->udev->dev, "TIMED OUT retry limit reached\n"); in ftdi_elan_stuck_waiting()
2130 dev_err(&ftdi->udev->dev, "empty packet retry limit reached\n"); in ftdi_elan_stuck_waiting()
2134 dev_err(&ftdi->udev->dev, "error = %d\n", retval); in ftdi_elan_stuck_waiting()
2141 static int ftdi_elan_checkingPCI(struct usb_ftdi *ftdi) in ftdi_elan_checkingPCI() argument
2143 int UxxxStatus = ftdi_elan_read_reg(ftdi, &ftdi->controlreg); in ftdi_elan_checkingPCI()
2146 if (ftdi->controlreg & 0x00400000) { in ftdi_elan_checkingPCI()
2147 if (ftdi->card_ejected) { in ftdi_elan_checkingPCI()
2149 ftdi->card_ejected = 1; in ftdi_elan_checkingPCI()
2150 dev_err(&ftdi->udev->dev, "CARD EJECTED - controlreg = %08X\n", in ftdi_elan_checkingPCI()
2151 ftdi->controlreg); in ftdi_elan_checkingPCI()
2155 u8 fn = ftdi->function - 1; in ftdi_elan_checkingPCI()
2161 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_checkingPCI()
2167 if (pciVID == ftdi->platform_data.vendor && pciPID == in ftdi_elan_checkingPCI()
2168 ftdi->platform_data.device) { in ftdi_elan_checkingPCI()
2171 dev_err(&ftdi->udev->dev, "vendor=%04X pciVID=%04X device=%04X pciPID=%04X\n", in ftdi_elan_checkingPCI()
2172 ftdi->platform_data.vendor, pciVID, in ftdi_elan_checkingPCI()
2173 ftdi->platform_data.device, pciPID); in ftdi_elan_checkingPCI()
2180 #define ftdi_read_pcimem(ftdi, member, data) ftdi_elan_read_pcimem(ftdi, \ argument
2182 #define ftdi_write_pcimem(ftdi, member, data) ftdi_elan_write_pcimem(ftdi, \ argument
2188 static int ftdi_elan_check_controller(struct usb_ftdi *ftdi, int quirk) in ftdi_elan_check_controller() argument
2206 retval = ftdi_write_pcimem(ftdi, intrdisable, OHCI_INTR_MIE); in ftdi_elan_check_controller()
2209 retval = ftdi_read_pcimem(ftdi, control, &control); in ftdi_elan_check_controller()
2212 retval = ftdi_read_pcimem(ftdi, roothub.a, &rh_a); in ftdi_elan_check_controller()
2216 retval = ftdi_read_pcimem(ftdi, fminterval, &hc_fminterval); in ftdi_elan_check_controller()
2223 retval = ftdi_read_pcimem(ftdi, control, &hc_control); in ftdi_elan_check_controller()
2242 retval = ftdi_write_pcimem(ftdi, control, hc_control); in ftdi_elan_check_controller()
2245 retval = ftdi_read_pcimem(ftdi, control, &control); in ftdi_elan_check_controller()
2249 retval = ftdi_read_pcimem(ftdi, roothub.a, &roothub_a); in ftdi_elan_check_controller()
2254 retval = ftdi_write_pcimem(ftdi, in ftdi_elan_check_controller()
2260 retval = ftdi_read_pcimem(ftdi, control, &control); in ftdi_elan_check_controller()
2263 retry:retval = ftdi_read_pcimem(ftdi, cmdstatus, &status); in ftdi_elan_check_controller()
2266 retval = ftdi_write_pcimem(ftdi, cmdstatus, OHCI_HCR); in ftdi_elan_check_controller()
2270 retval = ftdi_read_pcimem(ftdi, cmdstatus, &status); in ftdi_elan_check_controller()
2275 dev_err(&ftdi->udev->dev, "USB HC reset timed out!\n"); in ftdi_elan_check_controller()
2284 retval = ftdi_write_pcimem(ftdi, control, hc_control); in ftdi_elan_check_controller()
2287 retval = ftdi_read_pcimem(ftdi, control, &control); in ftdi_elan_check_controller()
2291 retval = ftdi_write_pcimem(ftdi, ed_controlhead, 0x00000000); in ftdi_elan_check_controller()
2294 retval = ftdi_write_pcimem(ftdi, ed_bulkhead, 0x11000000); in ftdi_elan_check_controller()
2297 retval = ftdi_write_pcimem(ftdi, hcca, 0x00000000); in ftdi_elan_check_controller()
2300 retval = ftdi_read_pcimem(ftdi, fminterval, &fminterval); in ftdi_elan_check_controller()
2303 retval = ftdi_write_pcimem(ftdi, fminterval, in ftdi_elan_check_controller()
2307 retval = ftdi_write_pcimem(ftdi, periodicstart, in ftdi_elan_check_controller()
2311 retval = ftdi_read_pcimem(ftdi, fminterval, &fminterval); in ftdi_elan_check_controller()
2314 retval = ftdi_read_pcimem(ftdi, periodicstart, &periodicstart); in ftdi_elan_check_controller()
2322 dev_err(&ftdi->udev->dev, "init err(%08x %04x)\n", in ftdi_elan_check_controller()
2327 retval = ftdi_write_pcimem(ftdi, control, hc_control); in ftdi_elan_check_controller()
2330 retval = ftdi_write_pcimem(ftdi, cmdstatus, OHCI_BLF); in ftdi_elan_check_controller()
2333 retval = ftdi_read_pcimem(ftdi, cmdstatus, &cmdstatus); in ftdi_elan_check_controller()
2336 retval = ftdi_read_pcimem(ftdi, control, &control); in ftdi_elan_check_controller()
2339 retval = ftdi_write_pcimem(ftdi, roothub.status, RH_HS_DRWE); in ftdi_elan_check_controller()
2342 retval = ftdi_write_pcimem(ftdi, intrstatus, mask); in ftdi_elan_check_controller()
2345 retval = ftdi_write_pcimem(ftdi, intrdisable, in ftdi_elan_check_controller()
2351 retval = ftdi_read_pcimem(ftdi, roothub.a, &roothub_a); in ftdi_elan_check_controller()
2358 retval = ftdi_write_pcimem(ftdi, roothub.a, roothub_a); in ftdi_elan_check_controller()
2363 retval = ftdi_write_pcimem(ftdi, roothub.a, roothub_a); in ftdi_elan_check_controller()
2367 retval = ftdi_write_pcimem(ftdi, roothub.status, RH_HS_LPSC); in ftdi_elan_check_controller()
2370 retval = ftdi_write_pcimem(ftdi, roothub.b, in ftdi_elan_check_controller()
2374 retval = ftdi_read_pcimem(ftdi, control, &control); in ftdi_elan_check_controller()
2380 retval = ftdi_read_pcimem(ftdi, roothub.portstatus[temp], in ftdi_elan_check_controller()
2390 static int ftdi_elan_setup_controller(struct usb_ftdi *ftdi, int fn) in ftdi_elan_setup_controller() argument
2397 UxxxStatus = ftdi_elan_write_reg(ftdi, 0x0000025FL | 0x2800); in ftdi_elan_setup_controller()
2401 UxxxStatus = ftdi_elan_write_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_setup_controller()
2405 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_setup_controller()
2409 UxxxStatus = ftdi_elan_write_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_setup_controller()
2413 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_setup_controller()
2418 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_setup_controller()
2424 UxxxStatus = ftdi_elan_write_config(ftdi, activePCIfn | reg, 0x00, in ftdi_elan_setup_controller()
2428 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_setup_controller()
2433 UxxxStatus = ftdi_elan_write_config(ftdi, activePCIfn | reg, 0x00, in ftdi_elan_setup_controller()
2437 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_setup_controller()
2442 UxxxStatus = ftdi_elan_read_pcimem(ftdi, reg, 0, &pcidata); in ftdi_elan_setup_controller()
2449 static int ftdi_elan_close_controller(struct usb_ftdi *ftdi, int fn) in ftdi_elan_close_controller() argument
2456 UxxxStatus = ftdi_elan_write_reg(ftdi, 0x0000025FL | 0x2800); in ftdi_elan_close_controller()
2460 UxxxStatus = ftdi_elan_write_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_close_controller()
2464 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_close_controller()
2468 UxxxStatus = ftdi_elan_write_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_close_controller()
2472 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_close_controller()
2477 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_close_controller()
2483 UxxxStatus = ftdi_elan_write_config(ftdi, activePCIfn | reg, 0x00, in ftdi_elan_close_controller()
2487 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_close_controller()
2492 UxxxStatus = ftdi_elan_write_config(ftdi, activePCIfn | reg, 0x00, in ftdi_elan_close_controller()
2496 return ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, &pcidata); in ftdi_elan_close_controller()
2499 static int ftdi_elan_found_controller(struct usb_ftdi *ftdi, int fn, int quirk) in ftdi_elan_found_controller() argument
2503 UxxxStatus = ftdi_elan_setup_controller(ftdi, fn); in ftdi_elan_found_controller()
2506 result = ftdi_elan_check_controller(ftdi, quirk); in ftdi_elan_found_controller()
2507 UxxxStatus = ftdi_elan_close_controller(ftdi, fn); in ftdi_elan_found_controller()
2513 static int ftdi_elan_enumeratePCI(struct usb_ftdi *ftdi) in ftdi_elan_enumeratePCI() argument
2518 UxxxStatus = ftdi_elan_read_reg(ftdi, &controlreg); in ftdi_elan_enumeratePCI()
2521 UxxxStatus = ftdi_elan_write_reg(ftdi, 0x00000000L); in ftdi_elan_enumeratePCI()
2525 UxxxStatus = ftdi_elan_write_reg(ftdi, 0x00000200L | 0x100); in ftdi_elan_enumeratePCI()
2528 UxxxStatus = ftdi_elan_write_reg(ftdi, 0x00000200L | 0x500); in ftdi_elan_enumeratePCI()
2531 UxxxStatus = ftdi_elan_read_reg(ftdi, &controlreg); in ftdi_elan_enumeratePCI()
2534 UxxxStatus = ftdi_elan_write_reg(ftdi, 0x0000020CL | 0x000); in ftdi_elan_enumeratePCI()
2537 UxxxStatus = ftdi_elan_write_reg(ftdi, 0x0000020DL | 0x000); in ftdi_elan_enumeratePCI()
2541 UxxxStatus = ftdi_elan_write_reg(ftdi, 0x0000020FL | 0x000); in ftdi_elan_enumeratePCI()
2544 UxxxStatus = ftdi_elan_read_reg(ftdi, &controlreg); in ftdi_elan_enumeratePCI()
2547 UxxxStatus = ftdi_elan_write_reg(ftdi, 0x0000025FL | 0x800); in ftdi_elan_enumeratePCI()
2550 UxxxStatus = ftdi_elan_read_reg(ftdi, &controlreg); in ftdi_elan_enumeratePCI()
2553 UxxxStatus = ftdi_elan_read_reg(ftdi, &controlreg); in ftdi_elan_enumeratePCI()
2564 static int ftdi_elan_setupOHCI(struct usb_ftdi *ftdi) in ftdi_elan_setupOHCI() argument
2574 ftdi->function = 0; in ftdi_elan_setupOHCI()
2580 UxxxStatus = ftdi_elan_read_config(ftdi, activePCIfn | reg, 0, in ftdi_elan_setupOHCI()
2587 devices = ftdi_elan_found_controller(ftdi, fn, 0); in ftdi_elan_setupOHCI()
2591 devices = ftdi_elan_found_controller(ftdi, fn, 0); in ftdi_elan_setupOHCI()
2594 devices = ftdi_elan_found_controller(ftdi, fn, 0); in ftdi_elan_setupOHCI()
2598 devices = ftdi_elan_found_controller(ftdi, fn, 0); in ftdi_elan_setupOHCI()
2601 devices = ftdi_elan_found_controller(ftdi, fn, in ftdi_elan_setupOHCI()
2605 devices = ftdi_elan_found_controller(ftdi, fn, in ftdi_elan_setupOHCI()
2613 ftdi->function = fn + 1; in ftdi_elan_setupOHCI()
2614 ftdi->platform_data.vendor = pciVID; in ftdi_elan_setupOHCI()
2615 ftdi->platform_data.device = pciPID; in ftdi_elan_setupOHCI()
2618 if (ftdi->function > 0) { in ftdi_elan_setupOHCI()
2619 return ftdi_elan_setup_controller(ftdi, ftdi->function - 1); in ftdi_elan_setupOHCI()
2625 ftdi->enumerated = 0; in ftdi_elan_setupOHCI()
2640 struct usb_ftdi *ftdi; in ftdi_elan_probe() local
2642 ftdi = kzalloc(sizeof(struct usb_ftdi), GFP_KERNEL); in ftdi_elan_probe()
2643 if (!ftdi) in ftdi_elan_probe()
2647 list_add_tail(&ftdi->ftdi_list, &ftdi_static_list); in ftdi_elan_probe()
2648 ftdi->sequence_num = ++ftdi_instances; in ftdi_elan_probe()
2650 ftdi_elan_init_kref(ftdi); in ftdi_elan_probe()
2651 sema_init(&ftdi->sw_lock, 1); in ftdi_elan_probe()
2652 ftdi->udev = usb_get_dev(interface_to_usbdev(interface)); in ftdi_elan_probe()
2653 ftdi->interface = interface; in ftdi_elan_probe()
2654 mutex_init(&ftdi->u132_lock); in ftdi_elan_probe()
2655 ftdi->expected = 4; in ftdi_elan_probe()
2661 dev_err(&ftdi->udev->dev, "Could not find both bulk-in and bulk-out endpoints\n"); in ftdi_elan_probe()
2665 ftdi->bulk_in_size = usb_endpoint_maxp(bulk_in); in ftdi_elan_probe()
2666 ftdi->bulk_in_endpointAddr = bulk_in->bEndpointAddress; in ftdi_elan_probe()
2667 ftdi->bulk_in_buffer = kmalloc(ftdi->bulk_in_size, GFP_KERNEL); in ftdi_elan_probe()
2668 if (!ftdi->bulk_in_buffer) { in ftdi_elan_probe()
2673 ftdi->bulk_out_endpointAddr = bulk_out->bEndpointAddress; in ftdi_elan_probe()
2675 dev_info(&ftdi->udev->dev, "interface %d has I=%02X O=%02X\n", in ftdi_elan_probe()
2676 iface_desc->desc.bInterfaceNumber, ftdi->bulk_in_endpointAddr, in ftdi_elan_probe()
2677 ftdi->bulk_out_endpointAddr); in ftdi_elan_probe()
2678 usb_set_intfdata(interface, ftdi); in ftdi_elan_probe()
2680 ftdi->bulk_in_endpointAddr == 0x81 && in ftdi_elan_probe()
2681 ftdi->bulk_out_endpointAddr == 0x02) { in ftdi_elan_probe()
2684 dev_err(&ftdi->udev->dev, "Not able to get a minor for this device\n"); in ftdi_elan_probe()
2689 ftdi->class = &ftdi_elan_jtag_class; in ftdi_elan_probe()
2690 dev_info(&ftdi->udev->dev, "USB FDTI=%p JTAG interface %d now attached to ftdi%d\n", in ftdi_elan_probe()
2691 ftdi, iface_desc->desc.bInterfaceNumber, in ftdi_elan_probe()
2696 ftdi->bulk_in_endpointAddr == 0x83 && in ftdi_elan_probe()
2697 ftdi->bulk_out_endpointAddr == 0x04) { in ftdi_elan_probe()
2698 ftdi->class = NULL; in ftdi_elan_probe()
2699 dev_info(&ftdi->udev->dev, "USB FDTI=%p ELAN interface %d now activated\n", in ftdi_elan_probe()
2700 ftdi, iface_desc->desc.bInterfaceNumber); in ftdi_elan_probe()
2701 INIT_DELAYED_WORK(&ftdi->status_work, ftdi_elan_status_work); in ftdi_elan_probe()
2702 INIT_DELAYED_WORK(&ftdi->command_work, ftdi_elan_command_work); in ftdi_elan_probe()
2703 INIT_DELAYED_WORK(&ftdi->respond_work, ftdi_elan_respond_work); in ftdi_elan_probe()
2704 ftdi_status_queue_work(ftdi, msecs_to_jiffies(3 *1000)); in ftdi_elan_probe()
2707 dev_err(&ftdi->udev->dev, in ftdi_elan_probe()
2712 error:if (ftdi) { in ftdi_elan_probe()
2713 ftdi_elan_put_kref(ftdi); in ftdi_elan_probe()
2720 struct usb_ftdi *ftdi = usb_get_intfdata(interface); in ftdi_elan_disconnect() local
2721 ftdi->disconnected += 1; in ftdi_elan_disconnect()
2722 if (ftdi->class) { in ftdi_elan_disconnect()
2724 struct usb_class_driver *class = ftdi->class; in ftdi_elan_disconnect()
2727 dev_info(&ftdi->udev->dev, "USB FTDI U132 jtag interface on minor %d now disconnected\n", in ftdi_elan_disconnect()
2730 ftdi_status_cancel_work(ftdi); in ftdi_elan_disconnect()
2731 ftdi_command_cancel_work(ftdi); in ftdi_elan_disconnect()
2732 ftdi_response_cancel_work(ftdi); in ftdi_elan_disconnect()
2733 ftdi_elan_abandon_completions(ftdi); in ftdi_elan_disconnect()
2734 ftdi_elan_abandon_targets(ftdi); in ftdi_elan_disconnect()
2735 if (ftdi->registered) { in ftdi_elan_disconnect()
2736 platform_device_unregister(&ftdi->platform_dev); in ftdi_elan_disconnect()
2737 ftdi->synchronized = 0; in ftdi_elan_disconnect()
2738 ftdi->enumerated = 0; in ftdi_elan_disconnect()
2739 ftdi->initialized = 0; in ftdi_elan_disconnect()
2740 ftdi->registered = 0; in ftdi_elan_disconnect()
2742 ftdi->disconnected += 1; in ftdi_elan_disconnect()
2744 dev_info(&ftdi->udev->dev, "USB FTDI U132 host controller interface now disconnected\n"); in ftdi_elan_disconnect()
2746 ftdi_elan_put_kref(ftdi); in ftdi_elan_disconnect()
2771 struct usb_ftdi *ftdi; in ftdi_elan_exit() local
2775 list_for_each_entry_safe(ftdi, temp, &ftdi_static_list, ftdi_list) { in ftdi_elan_exit()
2776 ftdi_status_cancel_work(ftdi); in ftdi_elan_exit()
2777 ftdi_command_cancel_work(ftdi); in ftdi_elan_exit()
2778 ftdi_response_cancel_work(ftdi); in ftdi_elan_exit()