Lines Matching refs:ecm
378 static void ecm_do_notify(struct f_ecm *ecm) in ecm_do_notify() argument
380 struct usb_request *req = ecm->notify_req; in ecm_do_notify()
382 struct usb_composite_dev *cdev = ecm->port.func.config->cdev; in ecm_do_notify()
391 switch (ecm->notify_state) { in ecm_do_notify()
397 if (ecm->is_open) in ecm_do_notify()
405 ecm->is_open ? "true" : "false"); in ecm_do_notify()
406 ecm->notify_state = ECM_NOTIFY_SPEED; in ecm_do_notify()
421 ecm->notify_state = ECM_NOTIFY_NONE; in ecm_do_notify()
425 event->wIndex = cpu_to_le16(ecm->ctrl_id); in ecm_do_notify()
427 ecm->notify_req = NULL; in ecm_do_notify()
428 status = usb_ep_queue(ecm->notify, req, GFP_ATOMIC); in ecm_do_notify()
430 ecm->notify_req = req; in ecm_do_notify()
435 static void ecm_notify(struct f_ecm *ecm) in ecm_notify() argument
442 ecm->notify_state = ECM_NOTIFY_CONNECT; in ecm_notify()
443 ecm_do_notify(ecm); in ecm_notify()
448 struct f_ecm *ecm = req->context; in ecm_notify_complete() local
449 struct usb_composite_dev *cdev = ecm->port.func.config->cdev; in ecm_notify_complete()
458 ecm->notify_state = ECM_NOTIFY_NONE; in ecm_notify_complete()
465 ecm->notify_req = req; in ecm_notify_complete()
466 ecm_do_notify(ecm); in ecm_notify_complete()
471 struct f_ecm *ecm = func_to_ecm(f); in ecm_setup() local
488 if (w_length != 0 || w_index != ecm->ctrl_id) in ecm_setup()
495 ecm->port.cdc_filter = w_value; in ecm_setup()
536 struct f_ecm *ecm = func_to_ecm(f); in ecm_set_alt() local
540 if (intf == ecm->ctrl_id) { in ecm_set_alt()
544 if (ecm->notify->driver_data) { in ecm_set_alt()
546 usb_ep_disable(ecm->notify); in ecm_set_alt()
548 if (!(ecm->notify->desc)) { in ecm_set_alt()
550 if (config_ep_by_speed(cdev->gadget, f, ecm->notify)) in ecm_set_alt()
553 usb_ep_enable(ecm->notify); in ecm_set_alt()
554 ecm->notify->driver_data = ecm; in ecm_set_alt()
557 } else if (intf == ecm->data_id) { in ecm_set_alt()
561 if (ecm->port.in_ep->driver_data) { in ecm_set_alt()
563 gether_disconnect(&ecm->port); in ecm_set_alt()
566 if (!ecm->port.in_ep->desc || in ecm_set_alt()
567 !ecm->port.out_ep->desc) { in ecm_set_alt()
570 ecm->port.in_ep) || in ecm_set_alt()
572 ecm->port.out_ep)) { in ecm_set_alt()
573 ecm->port.in_ep->desc = NULL; in ecm_set_alt()
574 ecm->port.out_ep->desc = NULL; in ecm_set_alt()
588 ecm->port.is_zlp_ok = !(gadget_is_musbhdrc(cdev->gadget) in ecm_set_alt()
590 ecm->port.cdc_filter = DEFAULT_FILTER; in ecm_set_alt()
592 net = gether_connect(&ecm->port); in ecm_set_alt()
603 ecm_notify(ecm); in ecm_set_alt()
617 struct f_ecm *ecm = func_to_ecm(f); in ecm_get_alt() local
619 if (intf == ecm->ctrl_id) in ecm_get_alt()
621 return ecm->port.in_ep->driver_data ? 1 : 0; in ecm_get_alt()
626 struct f_ecm *ecm = func_to_ecm(f); in ecm_disable() local
631 if (ecm->port.in_ep->driver_data) in ecm_disable()
632 gether_disconnect(&ecm->port); in ecm_disable()
634 if (ecm->notify->driver_data) { in ecm_disable()
635 usb_ep_disable(ecm->notify); in ecm_disable()
636 ecm->notify->driver_data = NULL; in ecm_disable()
637 ecm->notify->desc = NULL; in ecm_disable()
663 struct f_ecm *ecm = func_to_ecm(&geth->func); in ecm_open() local
665 DBG(ecm->port.func.config->cdev, "%s\n", __func__); in ecm_open()
667 ecm->is_open = true; in ecm_open()
668 ecm_notify(ecm); in ecm_open()
673 struct f_ecm *ecm = func_to_ecm(&geth->func); in ecm_close() local
675 DBG(ecm->port.func.config->cdev, "%s\n", __func__); in ecm_close()
677 ecm->is_open = false; in ecm_close()
678 ecm_notify(ecm); in ecm_close()
689 struct f_ecm *ecm = func_to_ecm(f); in ecm_bind() local
731 ecm->ctrl_id = status; in ecm_bind()
740 ecm->data_id = status; in ecm_bind()
752 ecm->port.in_ep = ep; in ecm_bind()
758 ecm->port.out_ep = ep; in ecm_bind()
768 ecm->notify = ep; in ecm_bind()
774 ecm->notify_req = usb_ep_alloc_request(ep, GFP_KERNEL); in ecm_bind()
775 if (!ecm->notify_req) in ecm_bind()
777 ecm->notify_req->buf = kmalloc(ECM_STATUS_BYTECOUNT, GFP_KERNEL); in ecm_bind()
778 if (!ecm->notify_req->buf) in ecm_bind()
780 ecm->notify_req->context = ecm; in ecm_bind()
781 ecm->notify_req->complete = ecm_notify_complete; in ecm_bind()
807 ecm->port.open = ecm_open; in ecm_bind()
808 ecm->port.close = ecm_close; in ecm_bind()
813 ecm->port.in_ep->name, ecm->port.out_ep->name, in ecm_bind()
814 ecm->notify->name); in ecm_bind()
818 if (ecm->notify_req) { in ecm_bind()
819 kfree(ecm->notify_req->buf); in ecm_bind()
820 usb_ep_free_request(ecm->notify, ecm->notify_req); in ecm_bind()
824 if (ecm->notify) in ecm_bind()
825 ecm->notify->driver_data = NULL; in ecm_bind()
826 if (ecm->port.out_ep) in ecm_bind()
827 ecm->port.out_ep->driver_data = NULL; in ecm_bind()
828 if (ecm->port.in_ep) in ecm_bind()
829 ecm->port.in_ep->driver_data = NULL; in ecm_bind()
843 USB_ETHERNET_CONFIGFS_ITEM(ecm);
846 USB_ETHERNET_CONFIGFS_ITEM_ATTR_DEV_ADDR(ecm);
849 USB_ETHERNET_CONFIGFS_ITEM_ATTR_HOST_ADDR(ecm);
852 USB_ETHERNET_CONFIGFS_ITEM_ATTR_QMULT(ecm);
855 USB_ETHERNET_CONFIGFS_ITEM_ATTR_IFNAME(ecm);
906 struct f_ecm *ecm; in ecm_free() local
909 ecm = func_to_ecm(f); in ecm_free()
911 kfree(ecm); in ecm_free()
919 struct f_ecm *ecm = func_to_ecm(f); in ecm_unbind() local
925 kfree(ecm->notify_req->buf); in ecm_unbind()
926 usb_ep_free_request(ecm->notify, ecm->notify_req); in ecm_unbind()
931 struct f_ecm *ecm; in ecm_alloc() local
936 ecm = kzalloc(sizeof(*ecm), GFP_KERNEL); in ecm_alloc()
937 if (!ecm) in ecm_alloc()
945 status = gether_get_host_addr_cdc(opts->net, ecm->ethaddr, in ecm_alloc()
946 sizeof(ecm->ethaddr)); in ecm_alloc()
948 kfree(ecm); in ecm_alloc()
952 ecm_string_defs[1].s = ecm->ethaddr; in ecm_alloc()
954 ecm->port.ioport = netdev_priv(opts->net); in ecm_alloc()
956 ecm->port.cdc_filter = DEFAULT_FILTER; in ecm_alloc()
958 ecm->port.func.name = "cdc_ethernet"; in ecm_alloc()
960 ecm->port.func.bind = ecm_bind; in ecm_alloc()
961 ecm->port.func.unbind = ecm_unbind; in ecm_alloc()
962 ecm->port.func.set_alt = ecm_set_alt; in ecm_alloc()
963 ecm->port.func.get_alt = ecm_get_alt; in ecm_alloc()
964 ecm->port.func.setup = ecm_setup; in ecm_alloc()
965 ecm->port.func.disable = ecm_disable; in ecm_alloc()
966 ecm->port.func.free_func = ecm_free; in ecm_alloc()
968 return &ecm->port.func; in ecm_alloc()
971 DECLARE_USB_FUNCTION_INIT(ecm, ecm_alloc_inst, ecm_alloc);