Lines Matching defs:acm

298 	struct f_acm	*acm = ep->driver_data;
299 struct usb_composite_dev *cdev = acm->port.func.config->cdev;
302 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d completion, err %d\n",
303 acm->port_num, req->status);
308 if (req->actual != sizeof(acm->port_line_coding)) {
309 dev_dbg(&cdev->gadget->dev, "acm ttyGS%d short resp, len %d\n",
310 acm->port_num, req->actual);
322 acm->port_line_coding = *value;
330 struct f_acm *acm = func_to_acm(f);
352 || w_index != acm->ctrl_id)
356 cdev->gadget->ep0->driver_data = acm;
363 if (w_index != acm->ctrl_id)
368 memcpy(req->buf, &acm->port_line_coding, value);
374 if (w_index != acm->ctrl_id)
383 acm->port_handshake_bits = w_value;
388 if (w_index != acm->ctrl_id)
391 acm_send_break(&acm->port, 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 |= USB_CDC_SERIAL_STATE_DSR | USB_CDC_SERIAL_STATE_DCD;
579 acm_notify_serial_state(acm);
584 struct f_acm *acm = port_to_acm(port);
586 acm->serial_state &= ~(USB_CDC_SERIAL_STATE_DSR | USB_CDC_SERIAL_STATE_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: IN/%s OUT/%s NOTIFY/%s\n",
695 acm->port_num,
696 acm->port.in->name, acm->port.out->name,
697 acm->notify->name);
701 if (acm->notify_req)
702 gs_free_req(acm->notify, acm->notify_req);
711 struct f_acm *acm = func_to_acm(f);
715 if (acm->notify_req)
716 gs_free_req(acm->notify, acm->notify_req);
721 struct f_acm *acm = func_to_acm(f);
723 kfree(acm);
728 struct f_acm *acm = func_to_acm(f);
730 gserial_resume(&acm->port);
735 struct f_acm *acm = func_to_acm(f);
737 gserial_suspend(&acm->port);
743 struct f_acm *acm;
745 acm = kzalloc(sizeof(*acm), GFP_KERNEL);
746 if (!acm)
749 spin_lock_init(&acm->lock);
751 acm->port.connect = acm_connect;
752 acm->port.disconnect = acm_disconnect;
753 acm->port.send_break = acm_send_break;
755 acm->port.func.name = "acm";
756 acm->port.func.strings = acm_strings;
758 acm->port.func.bind = acm_bind;
759 acm->port.func.set_alt = acm_set_alt;
760 acm->port.func.setup = acm_setup;
761 acm->port.func.disable = acm_disable;
764 acm->port_num = opts->port_num;
765 acm->port.func.unbind = acm_unbind;
766 acm->port.func.free_func = acm_free_func;
767 acm->port.func.resume = acm_resume;
768 acm->port.func.suspend = acm_suspend;
770 return &acm->port.func;
856 DECLARE_USB_FUNCTION_INIT(acm, acm_alloc_instance, acm_alloc_func);