Lines Matching defs:acm
308 struct f_acm *acm = ep->driver_data;
309 struct usb_composite_dev *cdev = acm->port.func.config->cdev;
312 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d completion, err %d\n",
313 acm->port_num, req->status);
318 if (req->actual != sizeof(acm->port_line_coding)) {
319 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d short resp, len %d\n",
320 acm->port_num, req->actual);
332 acm->port_line_coding = *value;
338 struct f_acm *acm = func_to_acm(f);
360 || w_index != acm->ctrl_id)
364 cdev->gadget->ep0->driver_data = acm;
371 if (w_index != acm->ctrl_id)
376 memcpy(req->buf, &acm->port_line_coding, value);
382 if (w_index != acm->ctrl_id)
391 acm->port_handshake_bits = w_value;
405 "acm ttyGS%d req%02x.%02x v%04x i%04x l%d\n",
406 acm->port_num, ctrl->bRequestType, ctrl->bRequest,
412 ERROR(cdev, "acm response on ttyGS%d, err %d\n",
413 acm->port_num, value);
422 struct f_acm *acm = func_to_acm(f);
427 if (intf == acm->ctrl_id) {
428 if (acm->notify->enabled) {
430 "reset acm control interface %d\n", intf);
431 usb_ep_disable(acm->notify);
434 if (!acm->notify->desc)
435 if (config_ep_by_speed(cdev->gadget, f, acm->notify))
438 usb_ep_enable(acm->notify);
440 } else if (intf == acm->data_id) {
441 if (acm->notify->enabled) {
443 "reset acm ttyGS%d\n", acm->port_num);
444 gserial_disconnect(&acm->port);
446 if (!acm->port.in->desc || !acm->port.out->desc) {
448 "activate acm ttyGS%d\n", acm->port_num);
450 acm->port.in) ||
452 acm->port.out)) {
453 acm->port.in->desc = NULL;
454 acm->port.out->desc = NULL;
458 gserial_connect(&acm->port, acm->port_num);
468 struct f_acm *acm = func_to_acm(f);
471 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d deactivated\n", acm->port_num);
472 gserial_disconnect(&acm->port);
473 usb_ep_disable(acm->notify);
480 * @acm: wraps host to be notified
485 * Context: irqs blocked, acm->lock held, acm_notify_req non-null
492 static int acm_cdc_notify(struct f_acm *acm, u8 type, u16 value,
495 struct usb_ep *ep = acm->notify;
502 req = acm->notify_req;
503 acm->notify_req = NULL;
504 acm->pending = false;
514 notify->wIndex = cpu_to_le16(acm->ctrl_id);
519 spin_unlock(&acm->lock);
521 spin_lock(&acm->lock);
524 ERROR(acm->port.func.config->cdev,
525 "acm ttyGS%d can't notify serial state, %d\n",
526 acm->port_num, status);
527 acm->notify_req = req;
533 static int acm_notify_serial_state(struct f_acm *acm)
535 struct usb_composite_dev *cdev = acm->port.func.config->cdev;
539 spin_lock(&acm->lock);
540 if (acm->notify_req) {
541 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d serial state %04x\n",
542 acm->port_num, acm->serial_state);
543 serial_state = cpu_to_le16(acm->serial_state);
544 status = acm_cdc_notify(acm, USB_CDC_NOTIFY_SERIAL_STATE,
545 0, &serial_state, sizeof(acm->serial_state));
547 acm->pending = true;
550 spin_unlock(&acm->lock);
556 struct f_acm *acm = req->context;
562 spin_lock(&acm->lock);
564 doit = acm->pending;
565 acm->notify_req = req;
566 spin_unlock(&acm->lock);
569 acm_notify_serial_state(acm);
576 struct f_acm *acm = port_to_acm(port);
578 acm->serial_state |= ACM_CTRL_DSR | ACM_CTRL_DCD;
579 acm_notify_serial_state(acm);
584 struct f_acm *acm = port_to_acm(port);
586 acm->serial_state &= ~(ACM_CTRL_DSR | ACM_CTRL_DCD);
587 acm_notify_serial_state(acm);
592 struct f_acm *acm = port_to_acm(port);
595 state = acm->serial_state;
600 acm->serial_state = state;
601 return acm_notify_serial_state(acm);
611 struct f_acm *acm = func_to_acm(f);
633 acm->ctrl_id = status;
642 acm->data_id = status;
654 acm->port.in = ep;
659 acm->port.out = ep;
664 acm->notify = ep;
667 acm->notify_req = gs_alloc_req(ep,
670 if (!acm->notify_req)
673 acm->notify_req->complete = acm_cdc_notify_complete;
674 acm->notify_req->context = acm;
694 "acm ttyGS%d: %s speed IN/%s OUT/%s NOTIFY/%s\n",
695 acm->port_num,
698 acm->port.in->name, acm->port.out->name,
699 acm->notify->name);
703 if (acm->notify_req)
704 gs_free_req(acm->notify, acm->notify_req);
713 struct f_acm *acm = func_to_acm(f);
717 if (acm->notify_req)
718 gs_free_req(acm->notify, acm->notify_req);
723 struct f_acm *acm = func_to_acm(f);
725 kfree(acm);
730 struct f_acm *acm = func_to_acm(f);
732 gserial_resume(&acm->port);
737 struct f_acm *acm = func_to_acm(f);
739 gserial_suspend(&acm->port);
745 struct f_acm *acm;
747 acm = kzalloc(sizeof(*acm), GFP_KERNEL);
748 if (!acm)
751 spin_lock_init(&acm->lock);
753 acm->port.connect = acm_connect;
754 acm->port.disconnect = acm_disconnect;
755 acm->port.send_break = acm_send_break;
757 acm->port.func.name = "acm";
758 acm->port.func.strings = acm_strings;
760 acm->port.func.bind = acm_bind;
761 acm->port.func.set_alt = acm_set_alt;
762 acm->port.func.setup = acm_setup;
763 acm->port.func.disable = acm_disable;
766 acm->port_num = opts->port_num;
767 acm->port.func.unbind = acm_unbind;
768 acm->port.func.free_func = acm_free_func;
769 acm->port.func.resume = acm_resume;
770 acm->port.func.suspend = acm_suspend;
772 return &acm->port.func;
858 DECLARE_USB_FUNCTION_INIT(acm, acm_alloc_instance, acm_alloc_func);