Commit 103e9625 authored by Alberto Aguirre's avatar Alberto Aguirre Committed by Takashi Iwai

ALSA: usb-audio: simplify set_sync_ep_implicit_fb_quirk

Signed-off-by: default avatarAlberto Aguirre <albaguirre@gmail.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent c99c5a3b
...@@ -321,6 +321,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, ...@@ -321,6 +321,7 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
struct usb_host_interface *alts; struct usb_host_interface *alts;
struct usb_interface *iface; struct usb_interface *iface;
unsigned int ep; unsigned int ep;
unsigned int ifnum;
/* Implicit feedback sync EPs consumers are always playback EPs */ /* Implicit feedback sync EPs consumers are always playback EPs */
if (subs->direction != SNDRV_PCM_STREAM_PLAYBACK) if (subs->direction != SNDRV_PCM_STREAM_PLAYBACK)
...@@ -330,44 +331,23 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, ...@@ -330,44 +331,23 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */ case USB_ID(0x0763, 0x2030): /* M-Audio Fast Track C400 */
case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */ case USB_ID(0x0763, 0x2031): /* M-Audio Fast Track C600 */
ep = 0x81; ep = 0x81;
iface = usb_ifnum_to_if(dev, 3); ifnum = 3;
goto add_sync_ep_from_ifnum;
if (!iface || iface->num_altsetting == 0)
return -EINVAL;
alts = &iface->altsetting[1];
goto add_sync_ep;
break;
case USB_ID(0x0763, 0x2080): /* M-Audio FastTrack Ultra */ case USB_ID(0x0763, 0x2080): /* M-Audio FastTrack Ultra */
case USB_ID(0x0763, 0x2081): case USB_ID(0x0763, 0x2081):
ep = 0x81; ep = 0x81;
iface = usb_ifnum_to_if(dev, 2); ifnum = 2;
goto add_sync_ep_from_ifnum;
if (!iface || iface->num_altsetting == 0) case USB_ID(0x2466, 0x8003): /* Fractal Audio Axe-Fx II */
return -EINVAL;
alts = &iface->altsetting[1];
goto add_sync_ep;
case USB_ID(0x2466, 0x8003):
ep = 0x86; ep = 0x86;
iface = usb_ifnum_to_if(dev, 2); ifnum = 2;
goto add_sync_ep_from_ifnum;
if (!iface || iface->num_altsetting == 0) case USB_ID(0x1397, 0x0002): /* Behringer UFX1204 */
return -EINVAL;
alts = &iface->altsetting[1];
goto add_sync_ep;
case USB_ID(0x1397, 0x0002):
ep = 0x81; ep = 0x81;
iface = usb_ifnum_to_if(dev, 1); ifnum = 1;
goto add_sync_ep_from_ifnum;
if (!iface || iface->num_altsetting == 0)
return -EINVAL;
alts = &iface->altsetting[1];
goto add_sync_ep;
} }
if (attr == USB_ENDPOINT_SYNC_ASYNC && if (attr == USB_ENDPOINT_SYNC_ASYNC &&
altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC && altsd->bInterfaceClass == USB_CLASS_VENDOR_SPEC &&
altsd->bInterfaceProtocol == 2 && altsd->bInterfaceProtocol == 2 &&
...@@ -382,6 +362,14 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs, ...@@ -382,6 +362,14 @@ static int set_sync_ep_implicit_fb_quirk(struct snd_usb_substream *subs,
/* No quirk */ /* No quirk */
return 0; return 0;
add_sync_ep_from_ifnum:
iface = usb_ifnum_to_if(dev, ifnum);
if (!iface || iface->num_altsetting == 0)
return -EINVAL;
alts = &iface->altsetting[1];
add_sync_ep: add_sync_ep:
subs->sync_endpoint = snd_usb_add_endpoint(subs->stream->chip, subs->sync_endpoint = snd_usb_add_endpoint(subs->stream->chip,
alts, ep, !subs->direction, alts, ep, !subs->direction,
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment