Skip to content

Commit 67df411

Browse files
johnkeepingtiwai
authored andcommitted
ALSA: usb-audio: Add quirk for Tascam Model 12
Tascam's Model 12 is a mixer which can also operate as a USB audio interface. The audio interface uses explicit feedback but it seems that it does not correctly handle missing isochronous frames. When injecting an xrun (or doing anything else that pauses the playback stream) the feedback rate climbs (for example, at 44,100Hz nominal, I see a stable rate around 44,099 but xrun injection sees this peak at around 44,135 in most cases) and glitches are heard in the audio stream for several seconds - this is significantly worse than the single glitch expected for an underrun. While the stream does normally recover and the feedback rate returns to a stable value, I have seen some occurrences where this does not happen and the rate continues to increase while no audio is heard from the output. I have not found a solid reproduction for this. This misbehaviour can be avoided by totally resetting the stream state by switching the interface to alt 0 and back before restarting the playback stream. Add a new quirk flag which forces the endpoint and interface to be reconfigured whenever the stream is stopped, and use this for the Tascam Model 12. Separate interfaces are used for the playback and capture endpoints, so resetting the playback interface here will not affect the capture stream if it is running. While there are two endpoints on the interface, these are the OUT data endpoint and the IN explicit feedback endpoint corresponding to it and these are always stopped and started together. Signed-off-by: John Keeping <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 1d8025e commit 67df411

File tree

3 files changed

+13
-0
lines changed

3 files changed

+13
-0
lines changed

sound/usb/endpoint.c

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1673,6 +1673,13 @@ void snd_usb_endpoint_stop(struct snd_usb_endpoint *ep, bool keep_pending)
16731673
stop_urbs(ep, false, keep_pending);
16741674
if (ep->clock_ref)
16751675
atomic_dec(&ep->clock_ref->locked);
1676+
1677+
if (ep->chip->quirk_flags & QUIRK_FLAG_FORCE_IFACE_RESET &&
1678+
usb_pipeout(ep->pipe)) {
1679+
ep->need_prepare = true;
1680+
if (ep->iface_ref)
1681+
ep->iface_ref->need_setup = true;
1682+
}
16761683
}
16771684
}
16781685

sound/usb/quirks.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2044,6 +2044,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
20442044
DEVICE_FLG(0x0644, 0x804a, /* TEAC UD-301 */
20452045
QUIRK_FLAG_ITF_USB_DSD_DAC | QUIRK_FLAG_CTL_MSG_DELAY |
20462046
QUIRK_FLAG_IFACE_DELAY),
2047+
DEVICE_FLG(0x0644, 0x805f, /* TEAC Model 12 */
2048+
QUIRK_FLAG_FORCE_IFACE_RESET),
20472049
DEVICE_FLG(0x06f8, 0xb000, /* Hercules DJ Console (Windows Edition) */
20482050
QUIRK_FLAG_IGNORE_CTL_ERROR),
20492051
DEVICE_FLG(0x06f8, 0xd002, /* Hercules DJ Console (Macintosh Edition) */

sound/usb/usbaudio.h

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -172,6 +172,9 @@ extern bool snd_usb_skip_validation;
172172
* Don't apply implicit feedback sync mode
173173
* QUIRK_FLAG_IFACE_SKIP_CLOSE
174174
* Don't closed interface during setting sample rate
175+
* QUIRK_FLAG_FORCE_IFACE_RESET
176+
* Force an interface reset whenever stopping & restarting a stream
177+
* (e.g. after xrun)
175178
*/
176179

177180
#define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
@@ -194,5 +197,6 @@ extern bool snd_usb_skip_validation;
194197
#define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17)
195198
#define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18)
196199
#define QUIRK_FLAG_IFACE_SKIP_CLOSE (1U << 19)
200+
#define QUIRK_FLAG_FORCE_IFACE_RESET (1U << 20)
197201

198202
#endif /* __USBAUDIO_H */

0 commit comments

Comments
 (0)