Lines Matching refs:acm

298 	struct f_acm	*acm = ep->driver_data;  in acm_complete_set_line_coding()  local
299 struct usb_composite_dev *cdev = acm->port.func.config->cdev; in acm_complete_set_line_coding()
303 acm->port_num, req->status); in acm_complete_set_line_coding()
308 if (req->actual != sizeof(acm->port_line_coding)) { in acm_complete_set_line_coding()
310 acm->port_num, req->actual); in acm_complete_set_line_coding()
322 acm->port_line_coding = *value; in acm_complete_set_line_coding()
330 struct f_acm *acm = func_to_acm(f); in acm_setup() local
352 || w_index != acm->ctrl_id) in acm_setup()
356 cdev->gadget->ep0->driver_data = acm; in acm_setup()
363 if (w_index != acm->ctrl_id) in acm_setup()
368 memcpy(req->buf, &acm->port_line_coding, value); in acm_setup()
374 if (w_index != acm->ctrl_id) in acm_setup()
383 acm->port_handshake_bits = w_value; in acm_setup()
388 if (w_index != acm->ctrl_id) in acm_setup()
391 acm_send_break(&acm->port, w_value); in acm_setup()
406 acm->port_num, ctrl->bRequestType, ctrl->bRequest, in acm_setup()
413 acm->port_num, value); in acm_setup()
422 struct f_acm *acm = func_to_acm(f); in acm_set_alt() local
427 if (intf == acm->ctrl_id) { in acm_set_alt()
428 if (acm->notify->enabled) { in acm_set_alt()
431 usb_ep_disable(acm->notify); in acm_set_alt()
434 if (!acm->notify->desc) in acm_set_alt()
435 if (config_ep_by_speed(cdev->gadget, f, acm->notify)) in acm_set_alt()
438 usb_ep_enable(acm->notify); in acm_set_alt()
440 } else if (intf == acm->data_id) { in acm_set_alt()
441 if (acm->notify->enabled) { in acm_set_alt()
443 "reset acm ttyGS%d\n", acm->port_num); in acm_set_alt()
444 gserial_disconnect(&acm->port); in acm_set_alt()
446 if (!acm->port.in->desc || !acm->port.out->desc) { in acm_set_alt()
448 "activate acm ttyGS%d\n", acm->port_num); in acm_set_alt()
450 acm->port.in) || in acm_set_alt()
452 acm->port.out)) { in acm_set_alt()
453 acm->port.in->desc = NULL; in acm_set_alt()
454 acm->port.out->desc = NULL; in acm_set_alt()
458 gserial_connect(&acm->port, acm->port_num); in acm_set_alt()
468 struct f_acm *acm = func_to_acm(f); in acm_disable() local
471 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d deactivated\n", acm->port_num); in acm_disable()
472 gserial_disconnect(&acm->port); in acm_disable()
473 usb_ep_disable(acm->notify); in acm_disable()
492 static int acm_cdc_notify(struct f_acm *acm, u8 type, u16 value, in acm_cdc_notify() argument
495 struct usb_ep *ep = acm->notify; in acm_cdc_notify()
502 req = acm->notify_req; in acm_cdc_notify()
503 acm->notify_req = NULL; in acm_cdc_notify()
504 acm->pending = false; in acm_cdc_notify()
514 notify->wIndex = cpu_to_le16(acm->ctrl_id); in acm_cdc_notify()
519 spin_unlock(&acm->lock); in acm_cdc_notify()
521 spin_lock(&acm->lock); in acm_cdc_notify()
524 ERROR(acm->port.func.config->cdev, in acm_cdc_notify()
526 acm->port_num, status); in acm_cdc_notify()
527 acm->notify_req = req; in acm_cdc_notify()
533 static int acm_notify_serial_state(struct f_acm *acm) in acm_notify_serial_state() argument
535 struct usb_composite_dev *cdev = acm->port.func.config->cdev; in acm_notify_serial_state()
539 spin_lock(&acm->lock); in acm_notify_serial_state()
540 if (acm->notify_req) { in acm_notify_serial_state()
542 acm->port_num, acm->serial_state); in acm_notify_serial_state()
543 serial_state = cpu_to_le16(acm->serial_state); in acm_notify_serial_state()
544 status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE, in acm_notify_serial_state()
545 0, &serial_state, sizeof(acm->serial_state)); in acm_notify_serial_state()
547 acm->pending = true; in acm_notify_serial_state()
550 spin_unlock(&acm->lock); in acm_notify_serial_state()
556 struct f_acm *acm = req->context; in acm_cdc_notify_complete() local
562 spin_lock(&acm->lock); in acm_cdc_notify_complete()
564 doit = acm->pending; in acm_cdc_notify_complete()
565 acm->notify_req = req; in acm_cdc_notify_complete()
566 spin_unlock(&acm->lock); in acm_cdc_notify_complete()
569 acm_notify_serial_state(acm); in acm_cdc_notify_complete()
576 struct f_acm *acm = port_to_acm(port); in acm_connect() local
578 acm->serial_state |= USB_CDC_SERIAL_STATE_DSR | USB_CDC_SERIAL_STATE_DCD; in acm_connect()
579 acm_notify_serial_state(acm); in acm_connect()
584 struct f_acm *acm = port_to_acm(port); in acm_disconnect() local
586 acm->serial_state &= ~(USB_CDC_SERIAL_STATE_DSR | USB_CDC_SERIAL_STATE_DCD); in acm_disconnect()
587 acm_notify_serial_state(acm); in acm_disconnect()
592 struct f_acm *acm = port_to_acm(port); in acm_send_break() local
595 state = acm->serial_state; in acm_send_break()
600 acm->serial_state = state; in acm_send_break()
601 return acm_notify_serial_state(acm); in acm_send_break()
611 struct f_acm *acm = func_to_acm(f); in acm_bind() local
633 acm->ctrl_id = status; in acm_bind()
642 acm->data_id = status; in acm_bind()
654 acm->port.in = ep; in acm_bind()
659 acm->port.out = ep; in acm_bind()
664 acm->notify = ep; in acm_bind()
667 acm->notify_req = gs_alloc_req(ep, in acm_bind()
670 if (!acm->notify_req) in acm_bind()
673 acm->notify_req->complete = acm_cdc_notify_complete; in acm_bind()
674 acm->notify_req->context = acm; in acm_bind()
695 acm->port_num, in acm_bind()
698 acm->port.in->name, acm->port.out->name, in acm_bind()
699 acm->notify->name); in acm_bind()
703 if (acm->notify_req) in acm_bind()
704 gs_free_req(acm->notify, acm->notify_req); in acm_bind()
713 struct f_acm *acm = func_to_acm(f); in acm_unbind() local
717 if (acm->notify_req) in acm_unbind()
718 gs_free_req(acm->notify, acm->notify_req); in acm_unbind()
723 struct f_acm *acm = func_to_acm(f); in acm_free_func() local
725 kfree(acm); in acm_free_func()
730 struct f_acm *acm = func_to_acm(f); in acm_resume() local
732 gserial_resume(&acm->port); in acm_resume()
737 struct f_acm *acm = func_to_acm(f); in acm_suspend() local
739 gserial_suspend(&acm->port); in acm_suspend()
745 struct f_acm *acm; in acm_alloc_func() local
747 acm = kzalloc(sizeof(*acm), GFP_KERNEL); in acm_alloc_func()
748 if (!acm) in acm_alloc_func()
751 spin_lock_init(&acm->lock); in acm_alloc_func()
753 acm->port.connect = acm_connect; in acm_alloc_func()
754 acm->port.disconnect = acm_disconnect; in acm_alloc_func()
755 acm->port.send_break = acm_send_break; in acm_alloc_func()
757 acm->port.func.name = "acm"; in acm_alloc_func()
758 acm->port.func.strings = acm_strings; in acm_alloc_func()
760 acm->port.func.bind = acm_bind; in acm_alloc_func()
761 acm->port.func.set_alt = acm_set_alt; in acm_alloc_func()
762 acm->port.func.setup = acm_setup; in acm_alloc_func()
763 acm->port.func.disable = acm_disable; in acm_alloc_func()
766 acm->port_num = opts->port_num; in acm_alloc_func()
767 acm->port.func.unbind = acm_unbind; in acm_alloc_func()
768 acm->port.func.free_func = acm_free_func; in acm_alloc_func()
769 acm->port.func.resume = acm_resume; in acm_alloc_func()
770 acm->port.func.suspend = acm_suspend; in acm_alloc_func()
772 return &acm->port.func; in acm_alloc_func()
858 DECLARE_USB_FUNCTION_INIT(acm, acm_alloc_instance, acm_alloc_func);