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()
442 f->name, ss->in_ep->name, ss->out_ep->name, in sourcesink_bind()
443 ss->iso_in_ep ? ss->iso_in_ep->name : "<none>", in sourcesink_bind()
444 ss->iso_out_ep ? ss->iso_out_ep->name : "<none>"); in sourcesink_bind()
464 static int check_read_data(struct f_sourcesink *ss, struct usb_request *req) in check_read_data() argument
468 struct usb_composite_dev *cdev = ss->function.config->cdev; in check_read_data()
469 int max_packet_size = le16_to_cpu(ss->out_ep->desc->wMaxPacketSize); in check_read_data()
471 if (ss->pattern == 2) in check_read_data()
475 switch (ss->pattern) { in check_read_data()
496 usb_ep_set_halt(ss->out_ep); in check_read_data()
507 struct f_sourcesink *ss = ep->driver_data; in reinit_write_data() local
509 switch (ss->pattern) { in reinit_write_data()
525 struct f_sourcesink *ss = ep->driver_data; in source_sink_complete() local
529 if (!ss) in source_sink_complete()
532 cdev = ss->function.config->cdev; in source_sink_complete()
537 if (ep == ss->out_ep) { in source_sink_complete()
538 check_read_data(ss, req); in source_sink_complete()
539 if (ss->pattern != 2) in source_sink_complete()
550 if (ep == ss->out_ep) in source_sink_complete()
551 check_read_data(ss, req); in source_sink_complete()
578 static int source_sink_start_ep(struct f_sourcesink *ss, bool is_in, in source_sink_start_ep() argument
588 size = ss->isoc_maxpacket * in source_sink_start_ep()
589 (ss->isoc_mult + 1) * in source_sink_start_ep()
590 (ss->isoc_maxburst + 1); in source_sink_start_ep()
593 size = ss->isoc_maxpacket * (ss->isoc_mult + 1); in source_sink_start_ep()
596 size = ss->isoc_maxpacket > 1023 ? in source_sink_start_ep()
597 1023 : ss->isoc_maxpacket; in source_sink_start_ep()
600 ep = is_in ? ss->iso_in_ep : ss->iso_out_ep; in source_sink_start_ep()
601 qlen = ss->iso_qlen; in source_sink_start_ep()
603 ep = is_in ? ss->in_ep : ss->out_ep; in source_sink_start_ep()
604 qlen = ss->bulk_qlen; in source_sink_start_ep()
605 size = ss->buflen; in source_sink_start_ep()
616 else if (ss->pattern != 2) in source_sink_start_ep()
623 cdev = ss->function.config->cdev; in source_sink_start_ep()
635 static void disable_source_sink(struct f_sourcesink *ss) in disable_source_sink() argument
639 cdev = ss->function.config->cdev; in disable_source_sink()
640 disable_endpoints(cdev, ss->in_ep, ss->out_ep, ss->iso_in_ep, in disable_source_sink()
641 ss->iso_out_ep); in disable_source_sink()
642 VDBG(cdev, "%s disabled\n", ss->function.name); in disable_source_sink()
646 enable_source_sink(struct usb_composite_dev *cdev, struct f_sourcesink *ss, in enable_source_sink() argument
654 ep = ss->in_ep; in enable_source_sink()
655 result = config_ep_by_speed(cdev->gadget, &(ss->function), ep); in enable_source_sink()
661 ep->driver_data = ss; in enable_source_sink()
663 result = source_sink_start_ep(ss, true, false, speed); in enable_source_sink()
666 ep = ss->in_ep; in enable_source_sink()
672 ep = ss->out_ep; in enable_source_sink()
673 result = config_ep_by_speed(cdev->gadget, &(ss->function), ep); in enable_source_sink()
679 ep->driver_data = ss; in enable_source_sink()
681 result = source_sink_start_ep(ss, false, false, speed); in enable_source_sink()
684 ep = ss->out_ep; in enable_source_sink()
693 ep = ss->iso_in_ep; in enable_source_sink()
695 result = config_ep_by_speed(cdev->gadget, &(ss->function), ep); in enable_source_sink()
701 ep->driver_data = ss; in enable_source_sink()
703 result = source_sink_start_ep(ss, true, true, speed); in enable_source_sink()
706 ep = ss->iso_in_ep; in enable_source_sink()
714 ep = ss->iso_out_ep; in enable_source_sink()
716 result = config_ep_by_speed(cdev->gadget, &(ss->function), ep); in enable_source_sink()
722 ep->driver_data = ss; in enable_source_sink()
724 result = source_sink_start_ep(ss, false, true, speed); in enable_source_sink()
731 ss->cur_alt = alt; in enable_source_sink()
733 DBG(cdev, "%s enabled, alt intf %d\n", ss->function.name, alt); in enable_source_sink()
740 struct f_sourcesink *ss = func_to_ss(f); in sourcesink_set_alt() local
743 disable_source_sink(ss); in sourcesink_set_alt()
744 return enable_source_sink(cdev, ss, alt); in sourcesink_set_alt()
749 struct f_sourcesink *ss = func_to_ss(f); in sourcesink_get_alt() local
751 return ss->cur_alt; in sourcesink_get_alt()
756 struct f_sourcesink *ss = func_to_ss(f); in sourcesink_disable() local
758 disable_source_sink(ss); in sourcesink_disable()
838 struct f_sourcesink *ss; in source_sink_alloc_func() local
841 ss = kzalloc(sizeof(*ss), GFP_KERNEL); in source_sink_alloc_func()
842 if (!ss) in source_sink_alloc_func()
851 ss->pattern = ss_opts->pattern; in source_sink_alloc_func()
852 ss->isoc_interval = ss_opts->isoc_interval; in source_sink_alloc_func()
853 ss->isoc_maxpacket = ss_opts->isoc_maxpacket; in source_sink_alloc_func()
854 ss->isoc_mult = ss_opts->isoc_mult; in source_sink_alloc_func()
855 ss->isoc_maxburst = ss_opts->isoc_maxburst; in source_sink_alloc_func()
856 ss->buflen = ss_opts->bulk_buflen; in source_sink_alloc_func()
857 ss->bulk_qlen = ss_opts->bulk_qlen; in source_sink_alloc_func()
858 ss->iso_qlen = ss_opts->iso_qlen; in source_sink_alloc_func()
860 ss->function.name = "source/sink"; in source_sink_alloc_func()
861 ss->function.bind = sourcesink_bind; in source_sink_alloc_func()
862 ss->function.set_alt = sourcesink_set_alt; in source_sink_alloc_func()
863 ss->function.get_alt = sourcesink_get_alt; in source_sink_alloc_func()
864 ss->function.disable = sourcesink_disable; in source_sink_alloc_func()
865 ss->function.setup = sourcesink_setup; in source_sink_alloc_func()
866 ss->function.strings = sourcesink_strings; in source_sink_alloc_func()
868 ss->function.free_func = sourcesink_free_func; in source_sink_alloc_func()
870 return &ss->function; in source_sink_alloc_func()