From 6ffec3fa77ae2922562388ad99254da61e94446a Mon Sep 17 00:00:00 2001 From: hselasky Date: Sun, 11 Nov 2018 12:35:30 +0000 Subject: [PATCH] MFC r340248: Don't read the USB audio sync endpoint when we don't use it to save isochronous bandwidth. Sponsored by: Mellanox Technologies git-svn-id: svn://svn.freebsd.org/base/stable/9@340353 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f --- sys/dev/sound/usb/uaudio.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/sys/dev/sound/usb/uaudio.c b/sys/dev/sound/usb/uaudio.c index b4514fd92..bbf1ff8c0 100644 --- a/sys/dev/sound/usb/uaudio.c +++ b/sys/dev/sound/usb/uaudio.c @@ -97,7 +97,7 @@ static int uaudio_default_bits = 32; static int uaudio_default_channels = 0; /* use default */ #ifdef USB_DEBUG -static int uaudio_debug = 0; +static int uaudio_debug; static SYSCTL_NODE(_hw_usb, OID_AUTO, uaudio, CTLFLAG_RW, 0, "USB uaudio"); @@ -115,6 +115,8 @@ SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_bits, CTLFLAG_RW, TUNABLE_INT("hw.usb.uaudio.default_channels", &uaudio_default_channels); SYSCTL_INT(_hw_usb_uaudio, OID_AUTO, default_channels, CTLFLAG_RW, &uaudio_default_channels, 0, "uaudio default sample channels"); +#else +#define uaudio_debug 0 #endif #define UAUDIO_IRQS (8000 / UAUDIO_NFRAMES) /* interrupts per second */ @@ -2128,6 +2130,14 @@ uaudio_chan_play_sync_callback(struct usb_xfer *xfer, usb_error_t error) break; case USB_ST_SETUP: + /* + * Check if the recording stream can be used as a + * source of jitter information to save some + * isochronous bandwidth: + */ + if (ch->priv_sc->sc_rec_chan.num_alt != 0 && + uaudio_debug == 0) + break; usbd_xfer_set_frames(xfer, 1); usbd_xfer_set_frame_len(xfer, 0, usbd_xfer_max_framelen(xfer)); usbd_transfer_submit(xfer); -- 2.42.0