[alsa-devel] [PATCH 1/3] ALSA: usb: move udh01_fb_quirk setting to quirks.c
That's a quirk, after all, so move it where to all the other quirks live.
Signed-off-by: Daniel Mack daniel@zonque.org --- sound/usb/endpoint.c | 4 ---- sound/usb/quirks.c | 5 +++++ 2 files changed, 5 insertions(+), 4 deletions(-)
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index c07a7ed..4b4ffa0 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -502,10 +502,6 @@ struct snd_usb_endpoint *snd_usb_add_endpoint(struct snd_usb_audio *chip, ep->syncinterval = 3;
ep->syncmaxsize = le16_to_cpu(get_endpoint(alts, 1)->wMaxPacketSize); - - if (chip->usb_id == USB_ID(0x0644, 0x8038) /* TEAC UD-H01 */ && - ep->syncmaxsize == 4) - ep->udh01_fb_quirk = 1; }
list_add_tail(&ep->list, &chip->ep_list); diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 6cf1f35..299813f 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1216,6 +1216,11 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep) ep->chip->usb_id == USB_ID(0x0763, 0x2031)) && ep->type == SND_USB_ENDPOINT_TYPE_DATA) ep->skip_packets = 16; + + /* Work around devices that report unreasonable feedback data */ + if (ep->chip->usb_id == USB_ID(0x0644, 0x8038) /* TEAC UD-H01 */ && + ep->syncmaxsize == 4) + ep->udh01_fb_quirk = 1; }
void snd_usb_set_interface_quirk(struct usb_device *dev)
The quirk seems to be necessary not only for TEAC UD-H01 devices, but to more that are based on the Tenor 8802TL chipset. Devices built by T+A are affected too, and they apparently all use the same USB PID:PID.
Extend the quirky handling for that device as well, and rename the quirks flag.
Reported-and-tested-by: Thomas Gresens T.Gresens@intershop.de Signed-off-by: Daniel Mack daniel@zonque.org --- sound/usb/card.h | 2 +- sound/usb/endpoint.c | 5 +++-- sound/usb/quirks.c | 5 +++-- 3 files changed, 7 insertions(+), 5 deletions(-)
diff --git a/sound/usb/card.h b/sound/usb/card.h index 71778ca..111b0f0 100644 --- a/sound/usb/card.h +++ b/sound/usb/card.h @@ -92,7 +92,7 @@ struct snd_usb_endpoint { unsigned int curframesize; /* current packet size in frames (for capture) */ unsigned int syncmaxsize; /* sync endpoint packet size */ unsigned int fill_max:1; /* fill max packet size always */ - unsigned int udh01_fb_quirk:1; /* corrupted feedback data */ + unsigned int tenor_fb_quirk:1; /* corrupted feedback data */ unsigned int datainterval; /* log_2 of data packet interval */ unsigned int syncinterval; /* P for adaptive mode, 0 otherwise */ unsigned char silence_value; diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index 4b4ffa0..c317a8d 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -1167,9 +1167,10 @@ void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, if (f == 0) return;
- if (unlikely(sender->udh01_fb_quirk)) { + if (unlikely(sender->tenor_fb_quirk)) { /* - * The TEAC UD-H01 firmware sometimes changes the feedback value + * Devices based on Tenor 8802 chipsets (TEAC UD-H01 + * and others) sometimes change the feedback value * by +/- 0x1.0000. */ if (f < ep->freqn - 0x8000) diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 299813f..d47d927 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -1218,9 +1218,10 @@ void snd_usb_endpoint_start_quirk(struct snd_usb_endpoint *ep) ep->skip_packets = 16;
/* Work around devices that report unreasonable feedback data */ - if (ep->chip->usb_id == USB_ID(0x0644, 0x8038) /* TEAC UD-H01 */ && + if ((ep->chip->usb_id == USB_ID(0x0644, 0x8038) || /* TEAC UD-H01 */ + ep->chip->usb_id == USB_ID(0x1852, 0x5034)) && /* T+A Dac8 */ ep->syncmaxsize == 4) - ep->udh01_fb_quirk = 1; + ep->tenor_fb_quirk = 1; }
void snd_usb_set_interface_quirk(struct usb_device *dev)
Users of devices affected by the Tenor feedback data error report buffer underruns, even with the +/- 0x1.0000 quirk applied. Compensating the error with 0xf000 instead seems to reliably fix that issue.
See
https://sourceforge.net/p/alsa/mailman/message/35230259/
Reported-and-tested-by: Norman Nolte norman.nolte@gmx.net Reported-and-tested-by: Thomas Gresens T.Gresens@intershop.de Signed-off-by: Daniel Mack daniel@zonque.org --- sound/usb/endpoint.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/usb/endpoint.c b/sound/usb/endpoint.c index c317a8d..c470251 100644 --- a/sound/usb/endpoint.c +++ b/sound/usb/endpoint.c @@ -1174,9 +1174,9 @@ void snd_usb_handle_sync_urb(struct snd_usb_endpoint *ep, * by +/- 0x1.0000. */ if (f < ep->freqn - 0x8000) - f += 0x10000; + f += 0xf000; else if (f > ep->freqn + 0x8000) - f -= 0x10000; + f -= 0xf000; } else if (unlikely(ep->freqshift == INT_MIN)) { /* * The first time we see a feedback value, determine its format
On Mon, 22 Aug 2016 08:53:36 +0200, Daniel Mack wrote:
That's a quirk, after all, so move it where to all the other quirks live.
Signed-off-by: Daniel Mack daniel@zonque.org
Thanks, applied all three patches now.
Takashi
participants (2)
-
Daniel Mack
-
Takashi Iwai