Lines Matching refs:es2
142 static void usb_log_enable(struct es2_ap_dev *es2);
143 static void usb_log_disable(struct es2_ap_dev *es2);
144 static int arpc_sync(struct es2_ap_dev *es2, u8 type, void *payload,
147 static int output_sync(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd) in output_sync() argument
149 struct usb_device *udev = es2->usb_dev; in output_sync()
179 static int output_async(struct es2_ap_dev *es2, void *req, u16 size, u8 cmd) in output_async() argument
181 struct usb_device *udev = es2->usb_dev; in output_async()
220 struct es2_ap_dev *es2 = hd_to_es2(hd); in output() local
223 return output_async(es2, req, size, cmd); in output()
225 return output_sync(es2, req, size, cmd); in output()
228 static int es2_cport_in_enable(struct es2_ap_dev *es2, in es2_cport_in_enable() argument
240 dev_err(&es2->usb_dev->dev, in es2_cport_in_enable()
257 static void es2_cport_in_disable(struct es2_ap_dev *es2, in es2_cport_in_disable() argument
269 static int es2_arpc_in_enable(struct es2_ap_dev *es2) in es2_arpc_in_enable() argument
276 urb = es2->arpc_urb[i]; in es2_arpc_in_enable()
280 dev_err(&es2->usb_dev->dev, in es2_arpc_in_enable()
290 urb = es2->arpc_urb[i]; in es2_arpc_in_enable()
297 static void es2_arpc_in_disable(struct es2_ap_dev *es2) in es2_arpc_in_disable() argument
303 urb = es2->arpc_urb[i]; in es2_arpc_in_disable()
308 static struct urb *next_free_urb(struct es2_ap_dev *es2, gfp_t gfp_mask) in next_free_urb() argument
314 spin_lock_irqsave(&es2->cport_out_urb_lock, flags); in next_free_urb()
318 if (!es2->cport_out_urb_busy[i] && in next_free_urb()
319 !es2->cport_out_urb_cancelled[i]) { in next_free_urb()
320 es2->cport_out_urb_busy[i] = true; in next_free_urb()
321 urb = es2->cport_out_urb[i]; in next_free_urb()
325 spin_unlock_irqrestore(&es2->cport_out_urb_lock, flags); in next_free_urb()
333 dev_dbg(&es2->usb_dev->dev, in next_free_urb()
338 static void free_urb(struct es2_ap_dev *es2, struct urb *urb) in free_urb() argument
346 spin_lock_irqsave(&es2->cport_out_urb_lock, flags); in free_urb()
348 if (urb == es2->cport_out_urb[i]) { in free_urb()
349 es2->cport_out_urb_busy[i] = false; in free_urb()
354 spin_unlock_irqrestore(&es2->cport_out_urb_lock, flags); in free_urb()
393 struct es2_ap_dev *es2 = hd_to_es2(hd); in message_send() local
394 struct usb_device *udev = es2->usb_dev; in message_send()
411 urb = next_free_urb(es2, gfp_mask); in message_send()
415 spin_lock_irqsave(&es2->cport_out_urb_lock, flags); in message_send()
417 spin_unlock_irqrestore(&es2->cport_out_urb_lock, flags); in message_send()
426 es2->cport_out_endpoint), in message_send()
437 spin_lock_irqsave(&es2->cport_out_urb_lock, flags); in message_send()
439 spin_unlock_irqrestore(&es2->cport_out_urb_lock, flags); in message_send()
441 free_urb(es2, urb); in message_send()
456 struct es2_ap_dev *es2 = hd_to_es2(hd); in message_cancel() local
462 spin_lock_irq(&es2->cport_out_urb_lock); in message_cancel()
470 if (urb == es2->cport_out_urb[i]) { in message_cancel()
471 es2->cport_out_urb_cancelled[i] = true; in message_cancel()
475 spin_unlock_irq(&es2->cport_out_urb_lock); in message_cancel()
480 spin_lock_irq(&es2->cport_out_urb_lock); in message_cancel()
481 es2->cport_out_urb_cancelled[i] = false; in message_cancel()
482 spin_unlock_irq(&es2->cport_out_urb_lock); in message_cancel()
491 struct es2_ap_dev *es2 = hd_to_es2(hd); in es2_cport_allocate() local
504 if (es2->cdsi1_in_use) { in es2_cport_allocate()
509 es2->cdsi1_in_use = true; in es2_cport_allocate()
530 struct es2_ap_dev *es2 = hd_to_es2(hd); in es2_cport_release() local
534 es2->cdsi1_in_use = false; in es2_cport_release()
544 struct es2_ap_dev *es2 = hd_to_es2(hd); in cport_enable() local
545 struct usb_device *udev = es2->usb_dev; in cport_enable()
585 struct es2_ap_dev *es2 = hd_to_es2(hd); in es2_cport_connected() local
586 struct device *dev = &es2->usb_dev->dev; in es2_cport_connected()
591 ret = arpc_sync(es2, ARPC_TYPE_CPORT_CONNECTED, &req, sizeof(req), in es2_cport_connected()
604 struct es2_ap_dev *es2 = hd_to_es2(hd); in es2_cport_flush() local
605 struct device *dev = &es2->usb_dev->dev; in es2_cport_flush()
610 ret = arpc_sync(es2, ARPC_TYPE_CPORT_FLUSH, &req, sizeof(req), in es2_cport_flush()
623 struct es2_ap_dev *es2 = hd_to_es2(hd); in es2_cport_shutdown() local
624 struct device *dev = &es2->usb_dev->dev; in es2_cport_shutdown()
635 ret = arpc_sync(es2, ARPC_TYPE_CPORT_SHUTDOWN, &req, sizeof(req), in es2_cport_shutdown()
649 struct es2_ap_dev *es2 = hd_to_es2(hd); in es2_cport_quiesce() local
650 struct device *dev = &es2->usb_dev->dev; in es2_cport_quiesce()
664 ret = arpc_sync(es2, ARPC_TYPE_CPORT_QUIESCE, &req, sizeof(req), in es2_cport_quiesce()
677 struct es2_ap_dev *es2 = hd_to_es2(hd); in es2_cport_clear() local
678 struct device *dev = &es2->usb_dev->dev; in es2_cport_clear()
683 ret = arpc_sync(es2, ARPC_TYPE_CPORT_CLEAR, &req, sizeof(req), in es2_cport_clear()
696 struct es2_ap_dev *es2 = hd_to_es2(hd); in latency_tag_enable() local
697 struct usb_device *udev = es2->usb_dev; in latency_tag_enable()
714 struct es2_ap_dev *es2 = hd_to_es2(hd); in latency_tag_disable() local
715 struct usb_device *udev = es2->usb_dev; in latency_tag_disable()
773 static void es2_destroy(struct es2_ap_dev *es2) in es2_destroy() argument
779 debugfs_remove(es2->apb_log_enable_dentry); in es2_destroy()
780 usb_log_disable(es2); in es2_destroy()
784 urb = es2->cport_out_urb[i]; in es2_destroy()
787 es2->cport_out_urb[i] = NULL; in es2_destroy()
788 es2->cport_out_urb_busy[i] = false; /* just to be anal */ in es2_destroy()
792 usb_free_urb(es2->arpc_urb[i]); in es2_destroy()
793 kfree(es2->arpc_buffer[i]); in es2_destroy()
794 es2->arpc_buffer[i] = NULL; in es2_destroy()
798 usb_free_urb(es2->cport_in.urb[i]); in es2_destroy()
799 kfree(es2->cport_in.buffer[i]); in es2_destroy()
800 es2->cport_in.buffer[i] = NULL; in es2_destroy()
804 gb_hd_cport_release_reserved(es2->hd, ES2_CPORT_CDSI1); in es2_destroy()
805 gb_hd_cport_release_reserved(es2->hd, ES2_CPORT_CDSI0); in es2_destroy()
807 udev = es2->usb_dev; in es2_destroy()
808 gb_hd_put(es2->hd); in es2_destroy()
860 struct es2_ap_dev *es2 = hd_to_es2(hd); in cport_out_callback() local
866 spin_lock_irqsave(&es2->cport_out_urb_lock, flags); in cport_out_callback()
868 spin_unlock_irqrestore(&es2->cport_out_urb_lock, flags); in cport_out_callback()
876 free_urb(es2, urb); in cport_out_callback()
922 static struct arpc *arpc_find(struct es2_ap_dev *es2, __le16 id) in arpc_find() argument
926 list_for_each_entry(rpc, &es2->arpcs, list) { in arpc_find()
934 static void arpc_add(struct es2_ap_dev *es2, struct arpc *rpc) in arpc_add() argument
937 rpc->req->id = cpu_to_le16(es2->arpc_id_cycle++); in arpc_add()
938 list_add_tail(&rpc->list, &es2->arpcs); in arpc_add()
941 static void arpc_del(struct es2_ap_dev *es2, struct arpc *rpc) in arpc_del() argument
949 static int arpc_send(struct es2_ap_dev *es2, struct arpc *rpc, int timeout) in arpc_send() argument
951 struct usb_device *udev = es2->usb_dev; in arpc_send()
971 static int arpc_sync(struct es2_ap_dev *es2, u8 type, void *payload, in arpc_sync() argument
985 spin_lock_irqsave(&es2->arpc_lock, flags); in arpc_sync()
986 arpc_add(es2, rpc); in arpc_sync()
987 spin_unlock_irqrestore(&es2->arpc_lock, flags); in arpc_sync()
989 retval = arpc_send(es2, rpc, timeout); in arpc_sync()
1011 spin_lock_irqsave(&es2->arpc_lock, flags); in arpc_sync()
1012 arpc_del(es2, rpc); in arpc_sync()
1013 spin_unlock_irqrestore(&es2->arpc_lock, flags); in arpc_sync()
1017 dev_err(&es2->usb_dev->dev, in arpc_sync()
1026 struct es2_ap_dev *es2 = urb->context; in arpc_in_callback() local
1052 spin_lock_irqsave(&es2->arpc_lock, flags); in arpc_in_callback()
1053 rpc = arpc_find(es2, resp->id); in arpc_in_callback()
1057 spin_unlock_irqrestore(&es2->arpc_lock, flags); in arpc_in_callback()
1061 arpc_del(es2, rpc); in arpc_in_callback()
1064 spin_unlock_irqrestore(&es2->arpc_lock, flags); in arpc_in_callback()
1074 static void apb_log_get(struct es2_ap_dev *es2, char *buf) in apb_log_get() argument
1079 retval = usb_control_msg(es2->usb_dev, in apb_log_get()
1080 usb_rcvctrlpipe(es2->usb_dev, 0), in apb_log_get()
1089 kfifo_in(&es2->apb_log_fifo, buf, retval); in apb_log_get()
1095 struct es2_ap_dev *es2 = data; in apb_log_poll() local
1104 apb_log_get(es2, buf); in apb_log_poll()
1115 struct es2_ap_dev *es2 = file_inode(f)->i_private; in apb_log_read() local
1127 copied = kfifo_out(&es2->apb_log_fifo, tmp_buf, count); in apb_log_read()
1139 static void usb_log_enable(struct es2_ap_dev *es2) in usb_log_enable() argument
1141 if (!IS_ERR_OR_NULL(es2->apb_log_task)) in usb_log_enable()
1145 es2->apb_log_task = kthread_run(apb_log_poll, es2, "apb_log"); in usb_log_enable()
1146 if (IS_ERR(es2->apb_log_task)) in usb_log_enable()
1149 es2->apb_log_dentry = debugfs_create_file("apb_log", 0444, in usb_log_enable()
1150 gb_debugfs_get(), es2, in usb_log_enable()
1154 static void usb_log_disable(struct es2_ap_dev *es2) in usb_log_disable() argument
1156 if (IS_ERR_OR_NULL(es2->apb_log_task)) in usb_log_disable()
1159 debugfs_remove(es2->apb_log_dentry); in usb_log_disable()
1160 es2->apb_log_dentry = NULL; in usb_log_disable()
1162 kthread_stop(es2->apb_log_task); in usb_log_disable()
1163 es2->apb_log_task = NULL; in usb_log_disable()
1169 struct es2_ap_dev *es2 = file_inode(f)->i_private; in apb_log_enable_read() local
1170 int enable = !IS_ERR_OR_NULL(es2->apb_log_task); in apb_log_enable_read()
1182 struct es2_ap_dev *es2 = file_inode(f)->i_private; in apb_log_enable_write() local
1189 usb_log_enable(es2); in apb_log_enable_write()
1191 usb_log_disable(es2); in apb_log_enable_write()
1247 struct es2_ap_dev *es2; in ap_probe() local
1277 es2 = hd_to_es2(hd); in ap_probe()
1278 es2->hd = hd; in ap_probe()
1279 es2->usb_intf = interface; in ap_probe()
1280 es2->usb_dev = udev; in ap_probe()
1281 spin_lock_init(&es2->cport_out_urb_lock); in ap_probe()
1282 INIT_KFIFO(es2->apb_log_fifo); in ap_probe()
1283 usb_set_intfdata(interface, es2); in ap_probe()
1304 es2->cport_in.endpoint = ep_addr; in ap_probe()
1307 es2->arpc_endpoint_in = ep_addr; in ap_probe()
1318 es2->cport_out_endpoint = ep_addr; in ap_probe()
1347 es2->cport_in.urb[i] = urb; in ap_probe()
1356 usb_rcvbulkpipe(udev, es2->cport_in.endpoint), in ap_probe()
1360 es2->cport_in.buffer[i] = buffer; in ap_probe()
1373 es2->arpc_urb[i] = urb; in ap_probe()
1383 es2->arpc_endpoint_in), in ap_probe()
1385 arpc_in_callback, es2); in ap_probe()
1387 es2->arpc_buffer[i] = buffer; in ap_probe()
1400 es2->cport_out_urb[i] = urb; in ap_probe()
1401 es2->cport_out_urb_busy[i] = false; /* just to be anal */ in ap_probe()
1405 es2->apb_log_enable_dentry = debugfs_create_file("apb_log_enable", in ap_probe()
1407 gb_debugfs_get(), es2, in ap_probe()
1410 INIT_LIST_HEAD(&es2->arpcs); in ap_probe()
1411 spin_lock_init(&es2->arpc_lock); in ap_probe()
1413 retval = es2_arpc_in_enable(es2); in ap_probe()
1421 retval = es2_cport_in_enable(es2, &es2->cport_in); in ap_probe()
1430 es2_arpc_in_disable(es2); in ap_probe()
1432 es2_destroy(es2); in ap_probe()
1439 struct es2_ap_dev *es2 = usb_get_intfdata(interface); in ap_disconnect() local
1441 gb_hd_del(es2->hd); in ap_disconnect()
1443 es2_cport_in_disable(es2, &es2->cport_in); in ap_disconnect()
1444 es2_arpc_in_disable(es2); in ap_disconnect()
1446 es2_destroy(es2); in ap_disconnect()