My company (Silicon Labs) makes a CP2615 USB audio class 1.0 device which uses implicit feedback. I saw these two issues when testing with aplay/arecord/alsabat/alsaloop: * During playback-only operation, the implicit feedback (IN) endpoint was not active. * During play/record operation, the implicit feedback values were not acted on, i.e. the host always sent 192 bytes per OUT packet even if previous IN packets had been 188 or 196 bytes. This behavior was observed on these systems: RaspberryPi2: Raspbian 9 (stretch), kernel v4.14.72 x86-64: Ubuntu 18.04, kernel v4.15.0-36 I was able to get implicit feedback working properly in playback mode by adding a device-specific quirk to 'pcm.c' that is similar to existing quirks for implicit-feedback devices, e.g. M-Audio Fast Track Ultra. (Note: The following patch applies to kernel v4.14.72. In v4.18, the set_sync_ep_implicit_fb_quirk function was changed so that there is a single call to usb_ifnum_to_if(), rather than a call for each device-dependent quirk.) $ git diff pcm.c diff --git a/sound/usb/pcm.c b/sound/usb/pcm.c index b9c9a19f..6fb5567b 100644 --- a/sound/usb/pcm.c +++ b/sound/usb/pcm.c @@ -358,6 +358,21 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, alts = &iface->altsetting[1]; goto add_sync_ep; + case USB_ID(0x10C4, 0xEAC1): // Silicon Labs CP2615 + // Ensure CP2615 is configured in Async Mode + if (attr != USB_ENDPOINT_SYNC_ASYNC) + return 0; + + // In P16R16 async mode, AudioIN EP (IF:4 EP:0x83) used for implicit feedback + ep = 0x83; + iface = usb_ifnum_to_if(dev, 4); + + if (!iface || iface->num_altsetting == 0) + return -EINVAL; + + alts = &iface->altsetting[1]; + goto add_sync_ep; + } if (attr == USB_ENDPOINT_SYNC_ASYNC && altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC && After adding the patch, I verified that implicit feedback worked properly for playback, i.e. the OUT samples per packet tracked previous IN values. However, when attempting to perform simultaneous play and record via alsabat, alsaloop, or separate aplay/arecord, the system reports the 'endpoint already in use' error when attempting to set the format for the IN endpoint that is already in use (note that this dmesg log has customized printk messages): [Oct23 10:13] snd_usb_hw_params->set_format() [ +0.000014] set_format(): dev:b3856c00 alts:b67e8824 ifnum: 3 [ +0.001654] set_format()->usb_set_interface 3:1 [ +0.000006] Creating new playback data endpoint 03 [ +0.000004] Creating new capture data endpoint 83 <Begin Playback. SYNC endpoint also starts because feedback is implicit> [ +0.000027] snd_usb_pcm_prepare->set_format() [ +0.000005] set_format(): dev:b3856c00 alts:b67e8824 ifnum: 3 [ +0.000755] Setting params for EP 03 (type 0, 12 urbs), ret=0 [ +0.000017] Setting params for EP 83 (type 0, 12 urbs), ret=0 [ +0.000004] Starting DATA_EP 03 @b9224000 [ +0.000004] snd_usb_endpoint_implicit_feedback_sink (03) is TRUE [ +0.001495] Starting SYNC_EP 83 @b9222000 <After playing for 0.5s, start recording. Failure occurs because EP83 is already in use.> [ +0.493035] snd_usb_hw_params->set_format() [ +0.000016] set_format(): dev:b3856c00 alts:b67e88a4 ifnum: 4 [ +0.001549] set_format()->usb_set_interface 4:1 [ +0.000005] Re-using EP 83 in iface 4:1 [ +0.000028] snd_usb_pcm_prepare->set_format() [ +0.000004] set_format(): dev:b3856c00 alts:b67e88a4 ifnum: 4 *** [ +0.003196] *** snd_usb_endpoint_set_params(): EP #83: already in use [ +0.000003] configure_endpoint->endpoint_set_params: err=FFFFFFF0 I bought a used Fast Track Ultra device for comparison testing, and found that it behaved the same way as the CP2615 does with the implicit feedback quirk: in playback-only mode implicit feedback works properly, but play/record causes the 'EP already in use' error. Are there any suggestions on how I can resolve this issue? Any help would be greatly appreciated! Thanks, Bob Giaraffa _______________________________________________ Alsa-devel mailing list Alsa-devel@xxxxxxxxxxxxxxxx http://mailman.alsa-project.org/mailman/listinfo/alsa-devel