diff options
author | Takashi Iwai <tiwai@suse.de> | 2021-07-29 10:38:49 +0300 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2021-08-02 10:05:56 +0300 |
commit | af158a7f8d9a858971bbb3c241545928fb327c6a (patch) | |
tree | 2c2dfb7b1f5ec10f93370dbca9ac24473eb06327 /sound/usb | |
parent | ce47d47e5cc8768ba6db4a5a6fb166b176fe12e6 (diff) | |
download | linux-af158a7f8d9a858971bbb3c241545928fb327c6a.tar.xz |
ALSA: usb-audio: Move txfr_quirk handling to quirk_flags
The txfr_quirk field was meant for aligning the transfer, and it's set
for certain devices in quirks-table.h. Now we can move that stuff
also to the new quirk_flags gracefully, and reduce the quirks-table.h
entries (that are exposed to module device table).
As the quirks-table.h entries are also with the name string override,
provide the corresponding entries to the usb_audio_names[] table,
too.
Link: https://lore.kernel.org/r/20210729073855.19043-4-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/card.c | 21 | ||||
-rw-r--r-- | sound/usb/quirks-table.h | 52 | ||||
-rw-r--r-- | sound/usb/quirks.c | 52 | ||||
-rw-r--r-- | sound/usb/stream.c | 2 | ||||
-rw-r--r-- | sound/usb/usbaudio.h | 6 |
5 files changed, 48 insertions, 85 deletions
diff --git a/sound/usb/card.c b/sound/usb/card.c index 5f5095890a29..8c32a784f1e4 100644 --- a/sound/usb/card.c +++ b/sound/usb/card.c @@ -378,6 +378,9 @@ static const struct usb_audio_device_name usb_audio_names[] = { DEVICE_NAME(0x046d, 0x0990, "Logitech, Inc.", "QuickCam Pro 9000"), + DEVICE_NAME(0x05e1, 0x0408, "Syntek", "STK1160"), + DEVICE_NAME(0x05e1, 0x0480, "Hauppauge", "Woodbury"), + /* ASUS ROG Strix */ PROFILE_NAME(0x0b05, 0x1917, "Realtek", "ALC1220-VB-DT", "Realtek-ALC1220-VB-Desktop"), @@ -406,6 +409,8 @@ static const struct usb_audio_device_name usb_audio_names[] = { PROFILE_NAME(0x0db0, 0x543d, "Realtek", "ALC1220-VB-DT", "Realtek-ALC1220-VB-Desktop"), + DEVICE_NAME(0x0fd9, 0x0008, "Hauppauge", "HVR-950Q"), + /* Stanton/N2IT Final Scratch v1 device ('Scratchamp') */ DEVICE_NAME(0x103d, 0x0100, "Stanton", "ScratchAmp"), DEVICE_NAME(0x103d, 0x0101, "Stanton", "ScratchAmp"), @@ -424,6 +429,22 @@ static const struct usb_audio_device_name usb_audio_names[] = { PROFILE_NAME(0x26ce, 0x0a01, "Realtek", "ALC1220-VB-DT", "Realtek-ALC1220-VB-Desktop"), + DEVICE_NAME(0x2040, 0x7200, "Hauppauge", "HVR-950Q"), + DEVICE_NAME(0x2040, 0x7201, "Hauppauge", "HVR-950Q-MXL"), + DEVICE_NAME(0x2040, 0x7210, "Hauppauge", "HVR-950Q"), + DEVICE_NAME(0x2040, 0x7211, "Hauppauge", "HVR-950Q-MXL"), + DEVICE_NAME(0x2040, 0x7213, "Hauppauge", "HVR-950Q"), + DEVICE_NAME(0x2040, 0x7217, "Hauppauge", "HVR-950Q"), + DEVICE_NAME(0x2040, 0x721b, "Hauppauge", "HVR-950Q"), + DEVICE_NAME(0x2040, 0x721e, "Hauppauge", "HVR-950Q"), + DEVICE_NAME(0x2040, 0x721f, "Hauppauge", "HVR-950Q"), + DEVICE_NAME(0x2040, 0x7240, "Hauppauge", "HVR-850"), + DEVICE_NAME(0x2040, 0x7260, "Hauppauge", "HVR-950Q"), + DEVICE_NAME(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), + DEVICE_NAME(0x2040, 0x7280, "Hauppauge", "HVR-950Q"), + DEVICE_NAME(0x2040, 0x7281, "Hauppauge", "HVR-950Q-MXL"), + DEVICE_NAME(0x2040, 0x8200, "Hauppauge", "Woodbury"), + { } /* terminator */ }; diff --git a/sound/usb/quirks-table.h b/sound/usb/quirks-table.h index d644b31c4c7f..b5e82363cf47 100644 --- a/sound/usb/quirks-table.h +++ b/sound/usb/quirks-table.h @@ -2802,52 +2802,6 @@ YAMAHA_DEVICE(0x7010, "UB99"), } }, -/* - * Auvitek au0828 devices with audio interface. - * This should be kept in sync with drivers/media/usb/au0828/au0828-cards.c - * Please notice that some drivers are DVB only, and don't need to be - * here. That's the case, for example, of DVICO_FUSIONHDTV7. - */ - -#define AU0828_DEVICE(vid, pid, vname, pname) { \ - USB_AUDIO_DEVICE(vid, pid), \ - .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { \ - .vendor_name = vname, \ - .product_name = pname, \ - .ifnum = QUIRK_ANY_INTERFACE, \ - .type = QUIRK_AUDIO_ALIGN_TRANSFER, \ - } \ -} - -AU0828_DEVICE(0x2040, 0x7200, "Hauppauge", "HVR-950Q"), -AU0828_DEVICE(0x2040, 0x7240, "Hauppauge", "HVR-850"), -AU0828_DEVICE(0x2040, 0x7210, "Hauppauge", "HVR-950Q"), -AU0828_DEVICE(0x2040, 0x7217, "Hauppauge", "HVR-950Q"), -AU0828_DEVICE(0x2040, 0x721b, "Hauppauge", "HVR-950Q"), -AU0828_DEVICE(0x2040, 0x721e, "Hauppauge", "HVR-950Q"), -AU0828_DEVICE(0x2040, 0x721f, "Hauppauge", "HVR-950Q"), -AU0828_DEVICE(0x2040, 0x7280, "Hauppauge", "HVR-950Q"), -AU0828_DEVICE(0x0fd9, 0x0008, "Hauppauge", "HVR-950Q"), -AU0828_DEVICE(0x2040, 0x7201, "Hauppauge", "HVR-950Q-MXL"), -AU0828_DEVICE(0x2040, 0x7211, "Hauppauge", "HVR-950Q-MXL"), -AU0828_DEVICE(0x2040, 0x7281, "Hauppauge", "HVR-950Q-MXL"), -AU0828_DEVICE(0x05e1, 0x0480, "Hauppauge", "Woodbury"), -AU0828_DEVICE(0x2040, 0x8200, "Hauppauge", "Woodbury"), -AU0828_DEVICE(0x2040, 0x7260, "Hauppauge", "HVR-950Q"), -AU0828_DEVICE(0x2040, 0x7213, "Hauppauge", "HVR-950Q"), -AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), - -/* Syntek STK1160 */ -{ - USB_AUDIO_DEVICE(0x05e1, 0x0408), - .driver_info = (unsigned long) &(const struct snd_usb_audio_quirk) { - .vendor_name = "Syntek", - .product_name = "STK1160", - .ifnum = QUIRK_ANY_INTERFACE, - .type = QUIRK_AUDIO_ALIGN_TRANSFER - } -}, - /* Digidesign Mbox */ { /* Thanks to Clemens Ladisch <clemens@ladisch.de> */ @@ -3810,7 +3764,7 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), * MacroSilicon MS2109 based HDMI capture cards * * These claim 96kHz 1ch in the descriptors, but are actually 48kHz 2ch. - * They also need QUIRK_AUDIO_ALIGN_TRANSFER, which makes one wonder if + * They also need QUIRK_FLAG_ALIGN_TRANSFER, which makes one wonder if * they pretend to be 96kHz mono as a workaround for stereo being broken * by that... * @@ -3827,10 +3781,6 @@ AU0828_DEVICE(0x2040, 0x7270, "Hauppauge", "HVR-950Q"), .data = &(const struct snd_usb_audio_quirk[]) { { .ifnum = 2, - .type = QUIRK_AUDIO_ALIGN_TRANSFER, - }, - { - .ifnum = 2, .type = QUIRK_AUDIO_STANDARD_MIXER, }, { diff --git a/sound/usb/quirks.c b/sound/usb/quirks.c index 798aec4298f4..5dce068f613a 100644 --- a/sound/usb/quirks.c +++ b/sound/usb/quirks.c @@ -75,19 +75,6 @@ static int ignore_interface_quirk(struct snd_usb_audio *chip, } -/* - * Allow alignment on audio sub-slot (channel samples) rather than - * on audio slots (audio frames) - */ -static int create_align_transfer_quirk(struct snd_usb_audio *chip, - struct usb_interface *iface, - struct usb_driver *driver, - const struct snd_usb_audio_quirk *quirk) -{ - chip->txfr_quirk = 1; - return 1; /* Continue with creating streams and mixer */ -} - static int create_any_midi_quirk(struct snd_usb_audio *chip, struct usb_interface *intf, struct usb_driver *driver, @@ -595,7 +582,6 @@ int snd_usb_create_quirk(struct snd_usb_audio *chip, [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_audio_quirk, [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, [QUIRK_AUDIO_EDIROL_UAXX] = create_uaxx_quirk, - [QUIRK_AUDIO_ALIGN_TRANSFER] = create_align_transfer_quirk, [QUIRK_AUDIO_STANDARD_MIXER] = create_standard_mixer_quirk, [QUIRK_SETUP_DISABLE_AUTOSUSPEND] = setup_disable_autosuspend, }; @@ -1913,52 +1899,56 @@ static const struct usb_audio_quirk_flags_table quirk_flags_table[] = { QUIRK_FLAG_GET_SAMPLE_RATE), DEVICE_FLG(0x05a7, 0x1020, /* Bose Companion 5 */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x05e1, 0x0408, /* Syntek STK1160 */ + QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x05e1, 0x0480, /* Hauppauge Woodbury */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x074d, 0x3553, /* Outlaw RR2150 (Micronas UAC3553B) */ QUIRK_FLAG_GET_SAMPLE_RATE), DEVICE_FLG(0x0fd9, 0x0008, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x1395, 0x740a, /* Sennheiser DECT */ QUIRK_FLAG_GET_SAMPLE_RATE), DEVICE_FLG(0x1901, 0x0191, /* GE B850V3 CP2114 audio interface */ QUIRK_FLAG_GET_SAMPLE_RATE), DEVICE_FLG(0x2040, 0x7200, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x7201, /* Hauppauge HVR-950Q-MXL */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x7210, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x7211, /* Hauppauge HVR-950Q-MXL */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x7213, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x7217, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x721b, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x721e, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x721f, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x7240, /* Hauppauge HVR-850 */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x7260, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x7270, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x7280, /* Hauppauge HVR-950Q */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x7281, /* Hauppauge HVR-950Q-MXL */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x2040, 0x8200, /* Hauppauge Woodbury */ - QUIRK_FLAG_SHARE_MEDIA_DEVICE), + QUIRK_FLAG_SHARE_MEDIA_DEVICE | QUIRK_FLAG_ALIGN_TRANSFER), DEVICE_FLG(0x21b4, 0x0081, /* AudioQuest DragonFly */ QUIRK_FLAG_GET_SAMPLE_RATE), DEVICE_FLG(0x2912, 0x30c8, /* Audioengine D1 */ QUIRK_FLAG_GET_SAMPLE_RATE), DEVICE_FLG(0x413c, 0xa506, /* Dell AE515 sound bar */ QUIRK_FLAG_GET_SAMPLE_RATE), + DEVICE_FLG(0x534d, 0x2109, /* MacroSilicon MS2109 */ + QUIRK_FLAG_ALIGN_TRANSFER), /* Vendor matches */ VENDOR_FLG(0x045e, /* MS Lifecam */ diff --git a/sound/usb/stream.c b/sound/usb/stream.c index ee9aa1dcf0d8..541ab19101eb 100644 --- a/sound/usb/stream.c +++ b/sound/usb/stream.c @@ -89,7 +89,7 @@ static void snd_usb_init_substream(struct snd_usb_stream *as, subs->stream = as; subs->direction = stream; subs->dev = as->chip->dev; - subs->txfr_quirk = as->chip->txfr_quirk; + subs->txfr_quirk = !!(as->chip->quirk_flags & QUIRK_FLAG_ALIGN_TRANSFER); subs->tx_length_quirk = as->chip->tx_length_quirk; subs->speed = snd_usb_get_speed(subs->dev); subs->pkt_offset_adj = 0; diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index ece244637798..170e96865061 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h @@ -35,7 +35,6 @@ struct snd_usb_audio { atomic_t usage_count; wait_queue_head_t shutdown_wait; unsigned int quirk_flags; - unsigned int txfr_quirk:1; /* Subframe boundaries on transfers */ 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 */ @@ -103,7 +102,6 @@ enum quirk_type { QUIRK_AUDIO_STANDARD_INTERFACE, QUIRK_AUDIO_FIXED_ENDPOINT, QUIRK_AUDIO_EDIROL_UAXX, - QUIRK_AUDIO_ALIGN_TRANSFER, QUIRK_AUDIO_STANDARD_MIXER, QUIRK_SETUP_FMT_AFTER_RESUME, QUIRK_SETUP_DISABLE_AUTOSUSPEND, @@ -137,9 +135,13 @@ extern bool snd_usb_skip_validation; * or return error * QUIRK_FLAG_SHARE_MEDIA_DEVICE: * Create Media Controller API entries + * QUIRK_FLAG_ALIGN_TRANSFER: + * Allow alignment on audio sub-slot (channel samples) rather than on audio + * slots (audio frames) */ #define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0) #define QUIRK_FLAG_SHARE_MEDIA_DEVICE (1U << 1) +#define QUIRK_FLAG_ALIGN_TRANSFER (1U << 2) #endif /* __USBAUDIO_H */ |