Lines Matching refs:ss
320 struct f_sourcesink *ss = func_to_ss(f); in sourcesink_bind() local
332 ss->in_ep = usb_ep_autoconfig(cdev->gadget, &fs_source_desc); in sourcesink_bind()
333 if (!ss->in_ep) { in sourcesink_bind()
340 ss->out_ep = usb_ep_autoconfig(cdev->gadget, &fs_sink_desc); in sourcesink_bind()
341 if (!ss->out_ep) in sourcesink_bind()
345 if (ss->isoc_interval < 1) in sourcesink_bind()
346 ss->isoc_interval = 1; in sourcesink_bind()
347 if (ss->isoc_interval > 16) in sourcesink_bind()
348 ss->isoc_interval = 16; in sourcesink_bind()
349 if (ss->isoc_mult > 2) in sourcesink_bind()
350 ss->isoc_mult = 2; in sourcesink_bind()
351 if (ss->isoc_maxburst > 15) in sourcesink_bind()
352 ss->isoc_maxburst = 15; in sourcesink_bind()
355 fs_iso_source_desc.wMaxPacketSize = ss->isoc_maxpacket > 1023 ? in sourcesink_bind()
356 1023 : ss->isoc_maxpacket; in sourcesink_bind()
357 fs_iso_source_desc.bInterval = ss->isoc_interval; in sourcesink_bind()
358 fs_iso_sink_desc.wMaxPacketSize = ss->isoc_maxpacket > 1023 ? in sourcesink_bind()
359 1023 : ss->isoc_maxpacket; in sourcesink_bind()
360 fs_iso_sink_desc.bInterval = ss->isoc_interval; in sourcesink_bind()
363 ss->iso_in_ep = usb_ep_autoconfig(cdev->gadget, &fs_iso_source_desc); in sourcesink_bind()
364 if (!ss->iso_in_ep) in sourcesink_bind()
367 ss->iso_out_ep = usb_ep_autoconfig(cdev->gadget, &fs_iso_sink_desc); in sourcesink_bind()
368 if (!ss->iso_out_ep) { in sourcesink_bind()
369 usb_ep_autoconfig_release(ss->iso_in_ep); in sourcesink_bind()
370 ss->iso_in_ep = NULL; in sourcesink_bind()
382 if (ss->isoc_maxpacket > 1024) in sourcesink_bind()
383 ss->isoc_maxpacket = 1024; in sourcesink_bind()
394 hs_iso_source_desc.wMaxPacketSize = ss->isoc_maxpacket; in sourcesink_bind()
395 hs_iso_source_desc.wMaxPacketSize |= ss->isoc_mult << 11; in sourcesink_bind()
396 hs_iso_source_desc.bInterval = ss->isoc_interval; in sourcesink_bind()
400 hs_iso_sink_desc.wMaxPacketSize = ss->isoc_maxpacket; in sourcesink_bind()
401 hs_iso_sink_desc.wMaxPacketSize |= ss->isoc_mult << 11; in sourcesink_bind()
402 hs_iso_sink_desc.bInterval = ss->isoc_interval; in sourcesink_bind()
416 ss_iso_source_desc.wMaxPacketSize = ss->isoc_maxpacket; in sourcesink_bind()
417 ss_iso_source_desc.bInterval = ss->isoc_interval; in sourcesink_bind()
418 ss_iso_source_comp_desc.bmAttributes = ss->isoc_mult; in sourcesink_bind()
419 ss_iso_source_comp_desc.bMaxBurst = ss->isoc_maxburst; in sourcesink_bind()
420 ss_iso_source_comp_desc.wBytesPerInterval = ss->isoc_maxpacket * in sourcesink_bind()
421 (ss->isoc_mult + 1) * (ss->isoc_maxburst + 1); in sourcesink_bind()
425 ss_iso_sink_desc.wMaxPacketSize = ss->isoc_maxpacket; in sourcesink_bind()
426 ss_iso_sink_desc.bInterval = ss->isoc_interval; in sourcesink_bind()
427 ss_iso_sink_comp_desc.bmAttributes = ss->isoc_mult; in sourcesink_bind()
428 ss_iso_sink_comp_desc.bMaxBurst = ss->isoc_maxburst; in sourcesink_bind()
429 ss_iso_sink_comp_desc.wBytesPerInterval = ss->isoc_maxpacket * in sourcesink_bind()
430 (ss->isoc_mult + 1) * (ss->isoc_maxburst + 1); in sourcesink_bind()
440 f->name, ss->in_ep->name, ss->out_ep->name, in sourcesink_bind()
441 ss->iso_in_ep ? ss->iso_in_ep->name : "<none>", in sourcesink_bind()
442 ss->iso_out_ep ? ss->iso_out_ep->name : "<none>"); in sourcesink_bind()
462 static int check_read_data(struct f_sourcesink *ss, struct usb_request *req) in check_read_data() argument
466 struct usb_composite_dev *cdev = ss->function.config->cdev; in check_read_data()
467 int max_packet_size = le16_to_cpu(ss->out_ep->desc->wMaxPacketSize); in check_read_data()
469 if (ss->pattern == 2) in check_read_data()
473 switch (ss->pattern) { in check_read_data()
494 usb_ep_set_halt(ss->out_ep); in check_read_data()
505 struct f_sourcesink *ss = ep->driver_data; in reinit_write_data() local
507 switch (ss->pattern) { in reinit_write_data()
523 struct f_sourcesink *ss = ep->driver_data; in source_sink_complete() local
527 if (!ss) in source_sink_complete()
530 cdev = ss->function.config->cdev; in source_sink_complete()
535 if (ep == ss->out_ep) { in source_sink_complete()
536 check_read_data(ss, req); in source_sink_complete()
537 if (ss->pattern != 2) in source_sink_complete()
548 if (ep == ss->out_ep) in source_sink_complete()
549 check_read_data(ss, req); in source_sink_complete()
576 static int source_sink_start_ep(struct f_sourcesink *ss, bool is_in, in source_sink_start_ep() argument
587 size = ss->isoc_maxpacket * in source_sink_start_ep()
588 (ss->isoc_mult + 1) * in source_sink_start_ep()
589 (ss->isoc_maxburst + 1); in source_sink_start_ep()
592 size = ss->isoc_maxpacket * (ss->isoc_mult + 1); in source_sink_start_ep()
595 size = ss->isoc_maxpacket > 1023 ? in source_sink_start_ep()
596 1023 : ss->isoc_maxpacket; in source_sink_start_ep()
599 ep = is_in ? ss->iso_in_ep : ss->iso_out_ep; in source_sink_start_ep()
600 qlen = ss->iso_qlen; in source_sink_start_ep()
602 ep = is_in ? ss->in_ep : ss->out_ep; in source_sink_start_ep()
603 qlen = ss->bulk_qlen; in source_sink_start_ep()
604 size = ss->buflen; in source_sink_start_ep()
615 else if (ss->pattern != 2) in source_sink_start_ep()
622 cdev = ss->function.config->cdev; in source_sink_start_ep()
634 static void disable_source_sink(struct f_sourcesink *ss) in disable_source_sink() argument
638 cdev = ss->function.config->cdev; in disable_source_sink()
639 disable_endpoints(cdev, ss->in_ep, ss->out_ep, ss->iso_in_ep, in disable_source_sink()
640 ss->iso_out_ep); in disable_source_sink()
641 VDBG(cdev, "%s disabled\n", ss->function.name); in disable_source_sink()
645 enable_source_sink(struct usb_composite_dev *cdev, struct f_sourcesink *ss, in enable_source_sink() argument
653 ep = ss->in_ep; in enable_source_sink()
654 result = config_ep_by_speed(cdev->gadget, &(ss->function), ep); in enable_source_sink()
660 ep->driver_data = ss; in enable_source_sink()
662 result = source_sink_start_ep(ss, true, false, speed); in enable_source_sink()
665 ep = ss->in_ep; in enable_source_sink()
671 ep = ss->out_ep; in enable_source_sink()
672 result = config_ep_by_speed(cdev->gadget, &(ss->function), ep); in enable_source_sink()
678 ep->driver_data = ss; in enable_source_sink()
680 result = source_sink_start_ep(ss, false, false, speed); in enable_source_sink()
683 ep = ss->out_ep; in enable_source_sink()
692 ep = ss->iso_in_ep; in enable_source_sink()
694 result = config_ep_by_speed(cdev->gadget, &(ss->function), ep); in enable_source_sink()
700 ep->driver_data = ss; in enable_source_sink()
702 result = source_sink_start_ep(ss, true, true, speed); in enable_source_sink()
705 ep = ss->iso_in_ep; in enable_source_sink()
713 ep = ss->iso_out_ep; in enable_source_sink()
715 result = config_ep_by_speed(cdev->gadget, &(ss->function), ep); in enable_source_sink()
721 ep->driver_data = ss; in enable_source_sink()
723 result = source_sink_start_ep(ss, false, true, speed); in enable_source_sink()
730 ss->cur_alt = alt; in enable_source_sink()
732 DBG(cdev, "%s enabled, alt intf %d\n", ss->function.name, alt); in enable_source_sink()
739 struct f_sourcesink *ss = func_to_ss(f); in sourcesink_set_alt() local
742 disable_source_sink(ss); in sourcesink_set_alt()
743 return enable_source_sink(cdev, ss, alt); in sourcesink_set_alt()
748 struct f_sourcesink *ss = func_to_ss(f); in sourcesink_get_alt() local
750 return ss->cur_alt; in sourcesink_get_alt()
755 struct f_sourcesink *ss = func_to_ss(f); in sourcesink_disable() local
757 disable_source_sink(ss); in sourcesink_disable()
837 struct f_sourcesink *ss; in source_sink_alloc_func() local
840 ss = kzalloc(sizeof(*ss), GFP_KERNEL); in source_sink_alloc_func()
841 if (!ss) in source_sink_alloc_func()
850 ss->pattern = ss_opts->pattern; in source_sink_alloc_func()
851 ss->isoc_interval = ss_opts->isoc_interval; in source_sink_alloc_func()
852 ss->isoc_maxpacket = ss_opts->isoc_maxpacket; in source_sink_alloc_func()
853 ss->isoc_mult = ss_opts->isoc_mult; in source_sink_alloc_func()
854 ss->isoc_maxburst = ss_opts->isoc_maxburst; in source_sink_alloc_func()
855 ss->buflen = ss_opts->bulk_buflen; in source_sink_alloc_func()
856 ss->bulk_qlen = ss_opts->bulk_qlen; in source_sink_alloc_func()
857 ss->iso_qlen = ss_opts->iso_qlen; in source_sink_alloc_func()
859 ss->function.name = "source/sink"; in source_sink_alloc_func()
860 ss->function.bind = sourcesink_bind; in source_sink_alloc_func()
861 ss->function.set_alt = sourcesink_set_alt; in source_sink_alloc_func()
862 ss->function.get_alt = sourcesink_get_alt; in source_sink_alloc_func()
863 ss->function.disable = sourcesink_disable; in source_sink_alloc_func()
864 ss->function.setup = sourcesink_setup; in source_sink_alloc_func()
865 ss->function.strings = sourcesink_strings; in source_sink_alloc_func()
867 ss->function.free_func = sourcesink_free_func; in source_sink_alloc_func()
869 return &ss->function; in source_sink_alloc_func()