ALSA: usb-audio: Move tx_length quirk handling to quirk_flags
There is another quirk for the transfer, and that's currently specific to Zoom R16/24, handled in create_standard_audio_quirk(). Let's move this also to the new quirk_flags. Link: https://lore.kernel.org/r/20210729073855.19043-5-tiwai@suse.de Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
af158a7f8d
commit
c1b034a421
@ -240,6 +240,11 @@ static void retire_inbound_urb(struct snd_usb_endpoint *ep,
|
||||
call_retire_callback(ep, urb);
|
||||
}
|
||||
|
||||
static inline bool has_tx_length_quirk(struct snd_usb_audio *chip)
|
||||
{
|
||||
return chip->quirk_flags & QUIRK_FLAG_TX_LENGTH;
|
||||
}
|
||||
|
||||
static void prepare_silent_urb(struct snd_usb_endpoint *ep,
|
||||
struct snd_urb_ctx *ctx)
|
||||
{
|
||||
@ -250,7 +255,7 @@ static void prepare_silent_urb(struct snd_usb_endpoint *ep,
|
||||
int i;
|
||||
|
||||
/* For tx_length_quirk, put packet length at start of packet */
|
||||
if (ep->chip->tx_length_quirk)
|
||||
if (has_tx_length_quirk(ep->chip))
|
||||
extra = sizeof(packet_length);
|
||||
|
||||
for (i = 0; i < ctx->packets; ++i) {
|
||||
@ -952,7 +957,7 @@ static int data_ep_set_params(struct snd_usb_endpoint *ep)
|
||||
unsigned int max_urbs, i;
|
||||
const struct audioformat *fmt = ep->cur_audiofmt;
|
||||
int frame_bits = ep->cur_frame_bytes * 8;
|
||||
int tx_length_quirk = (chip->tx_length_quirk &&
|
||||
int tx_length_quirk = (has_tx_length_quirk(chip) &&
|
||||
usb_pipeout(ep->pipe));
|
||||
|
||||
usb_audio_dbg(chip, "Setting params for data EP 0x%x, pipe 0x%x\n",
|
||||
|
@ -95,9 +95,6 @@ static int create_standard_audio_quirk(struct snd_usb_audio *chip,
|
||||
struct usb_interface_descriptor *altsd;
|
||||
int err;
|
||||
|
||||
if (chip->usb_id == USB_ID(0x1686, 0x00dd)) /* Zoom R16/24 */
|
||||
chip->tx_length_quirk = 1;
|
||||
|
||||
alts = &iface->altsetting[0];
|
||||
altsd = get_iface_desc(alts);
|
||||
err = snd_usb_parse_audio_interface(chip, altsd->bInterfaceNumber);
|
||||
@ -1909,6 +1906,8 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
|
||||
QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER),
|
||||
DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */
|
||||
QUIRK_FLAG_GET_SAMPLE_RATE),
|
||||
DEVICE_FLG(0x1686, 0x00dd, /* Zoom R16/24 */
|
||||
QUIRK_FLAG_TX_LENGTH),
|
||||
DEVICE_FLG(0x1901, 0x0191, /* GE B850V3 CP2114 audio interface */
|
||||
QUIRK_FLAG_GET_SAMPLE_RATE),
|
||||
DEVICE_FLG(0x2040, 0x7200, /* Hauppauge HVR-950Q */
|
||||
|
@ -90,7 +90,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as,
|
||||
subs->direction = stream;
|
||||
subs->dev = as->chip->dev;
|
||||
subs->txfr_quirk = !!(as->chip->quirk_flags & QUIRK_FLAG_ALIGN_TRANSFER);
|
||||
subs->tx_length_quirk = as->chip->tx_length_quirk;
|
||||
subs->tx_length_quirk = !!(as->chip->quirk_flags & QUIRK_FLAG_TX_LENGTH);
|
||||
subs->speed = snd_usb_get_speed(subs->dev);
|
||||
subs->pkt_offset_adj = 0;
|
||||
subs->stream_offset_adj = 0;
|
||||
|
@ -35,7 +35,6 @@ struct snd_usb_audio {
|
||||
atomic_t usage_count;
|
||||
wait_queue_head_t shutdown_wait;
|
||||
unsigned int quirk_flags;
|
||||
unsigned int tx_length_quirk:1; /* Put length specifier in transfers */
|
||||
unsigned int need_delayed_register:1; /* warn for delayed registration */
|
||||
unsigned int playback_first:1; /* for implicit fb: don't wait for the first capture URBs */
|
||||
int num_interfaces;
|
||||
@ -138,10 +137,13 @@ extern bool snd_usb_skip_validation;
|
||||
* QUIRK_FLAG_ALIGN_TRANSFER:
|
||||
* Allow alignment on audio sub-slot (channel samples) rather than on audio
|
||||
* slots (audio frames)
|
||||
* QUIRK_TX_LENGTH:
|
||||
* Add length specifier to transfers
|
||||
*/
|
||||
|
||||
#define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
|
||||
#define QUIRK_FLAG_SHARE_MEDIA_DEVICE (1U << 1)
|
||||
#define QUIRK_FLAG_ALIGN_TRANSFER (1U << 2)
|
||||
#define QUIRK_FLAG_TX_LENGTH (1U << 3)
|
||||
|
||||
#endif /* __USBAUDIO_H */
|
||||
|
Loading…
Reference in New Issue
Block a user