sound/usb/quirks.c
Source file repositories/reference/linux-study-clean/sound/usb/quirks.c
File Facts
- System
- Linux kernel
- Corpus path
sound/usb/quirks.c- Extension
.c- Size
- 91320 bytes
- Lines
- 2779
- Domain
- Driver Families
- Bucket
- sound/usb
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Allocates kernel memory; connect allocation flags and lifetime to context constraints.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/cleanup.hlinux/err.hlinux/init.hlinux/slab.hlinux/string.hlinux/usb.hlinux/usb/audio.hlinux/usb/midi.hlinux/bits.hsound/control.hsound/core.hsound/info.hsound/pcm.husbaudio.hcard.hmixer.hmixer_quirks.hmidi.hmidi2.hquirks.hhelper.hendpoint.hpcm.hclock.hstream.h
Detected Declarations
struct usb_string_matchstruct usb_audio_quirk_flags_tablefunction create_composite_quirkfunction ignore_interface_quirkfunction create_any_midi_quirkfunction create_standard_audio_quirkfunction add_audio_stream_from_fixed_fmtfunction create_fixed_stream_quirkfunction create_auto_pcm_quirkfunction create_yamaha_midi_quirkfunction create_roland_midi_quirkfunction create_std_midi_quirkfunction create_auto_midi_quirkfunction create_autodetect_quirkfunction create_uaxx_quirkfunction create_standard_mixer_quirkfunction snd_usb_create_quirkfunction snd_usb_extigy_boot_quirkfunction snd_usb_audigy2nx_boot_quirkfunction snd_usb_fasttrackpro_boot_quirkfunction snd_usb_cm106_write_int_regfunction snd_usb_cm106_boot_quirkfunction snd_usb_cm6206_boot_quirkfunction snd_usb_gamecon780_boot_quirkfunction snd_usb_novation_boot_quirkfunction USBfunction snd_usb_nativeinstruments_boot_quirkfunction mbox2_setup_48_24_magicfunction snd_usb_mbox2_boot_quirkfunction snd_usb_axefx3_boot_quirkfunction mbox3_setup_defaultsfunction snd_usb_mbox3_boot_quirkfunction snd_usb_motu_microbookii_communicatefunction snd_usb_motu_microbookii_boot_quirkfunction snd_usb_motu_m_series_boot_quirkfunction snd_usb_rme_digiface_boot_quirkfunction quattro_skip_setting_quirkfunction audiophile_skip_setting_quirkfunction fasttrackpro_skip_setting_quirkfunction s1810c_skip_setting_quirkfunction snd_usb_apply_interface_quirkfunction snd_usb_apply_boot_quirkfunction snd_usb_apply_boot_quirk_oncefunction snd_usb_is_big_endian_formatfunction set_format_emu_quirkfunction pioneer_djm_set_format_quirkfunction mbox3_set_format_quirkfunction rme_digiface_set_format_quirk
Annotated Snippet
struct usb_string_match {
const char *manufacturer;
const char *product;
};
struct usb_audio_quirk_flags_table {
u32 id;
u32 flags;
const struct usb_string_match *usb_string_match;
};
#define DEVICE_FLG(vid, pid, _flags) \
{ .id = USB_ID(vid, pid), .flags = (_flags) }
#define VENDOR_FLG(vid, _flags) DEVICE_FLG(vid, 0, _flags)
/*
* Use as a last resort if using DEVICE_FLG() is prone to VID/PID conflicts.
*
* Usage:
* // match vid, pid, "manufacturer", and "product"
* DEVICE_STRING_FLG(vid, pid, "manufacturer", "product", flags)
*
* // match vid, pid, "manufacturer", and any product string
* DEVICE_STRING_FLG(vid, pid, "manufacturer", NULL, flags)
*
* // match vid, pid, "manufacturer", and device must have no product string
* DEVICE_STRING_FLG(vid, pid, "manufacturer", "", flags)
*
* // match vid, pid, any manufacturer string, and "product"
* DEVICE_STRING_FLG(vid, pid, NULL, "product", flags)
*
* // match vid, pid, no manufacturer string, and "product"
* DEVICE_STRING_FLG(vid, pid, "", "product", flags)
*
* // match vid, pid, no manufacturer string, and no product string
* DEVICE_STRING_FLG(vid, pid, "", "", flags)
*/
#define DEVICE_STRING_FLG(vid, pid, _manufacturer, _product, _flags) \
{ \
.id = USB_ID(vid, pid), \
.usb_string_match = &(const struct usb_string_match) { \
.manufacturer = _manufacturer, \
.product = _product, \
}, \
.flags = (_flags), \
}
/*
* Use as a last resort if using VENDOR_FLG() is prone to VID conflicts.
*
* Usage:
* // match vid, and "manufacturer"
* VENDOR_STRING_FLG(vid, "manufacturer", flags)
*
* // match vid, and device must have no manufacturer string
* VENDOR_STRING_FLG(vid, "", flags)
*/
#define VENDOR_STRING_FLG(vid, _manufacturer, _flags) \
DEVICE_STRING_FLG(vid, 0, _manufacturer, NULL, _flags)
static const struct usb_audio_quirk_flags_table quirk_flags_table[] = {
/* Device and string descriptor matches */
/* Device matches */
DEVICE_FLG(0x001f, 0x0b21, /* AB13X USB Audio */
QUIRK_FLAG_FORCE_IFACE_RESET | QUIRK_FLAG_IFACE_DELAY),
DEVICE_FLG(0x001f, 0x0b23, /* AB17X USB Audio */
QUIRK_FLAG_FORCE_IFACE_RESET | QUIRK_FLAG_IFACE_DELAY),
DEVICE_FLG(0x0020, 0x0b21, /* GHW-123P */
QUIRK_FLAG_FORCE_IFACE_RESET | QUIRK_FLAG_IFACE_DELAY),
DEVICE_FLG(0x03f0, 0x654a, /* HP 320 FHD Webcam */
QUIRK_FLAG_GET_SAMPLE_RATE | QUIRK_FLAG_MIC_RES_16),
DEVICE_FLG(0x041e, 0x3000, /* Creative SB Extigy */
QUIRK_FLAG_IGNORE_CTL_ERROR),
DEVICE_FLG(0x041e, 0x4080, /* Creative Live Cam VF0610 */
QUIRK_FLAG_GET_SAMPLE_RATE),
DEVICE_FLG(0x045e, 0x083c, /* MS USB Link headset */
QUIRK_FLAG_GET_SAMPLE_RATE | QUIRK_FLAG_CTL_MSG_DELAY |
QUIRK_FLAG_DISABLE_AUTOSUSPEND),
DEVICE_FLG(0x045e, 0x070f, /* MS LifeChat LX-3000 Headset */
QUIRK_FLAG_MIXER_PLAYBACK_MIN_MUTE),
DEVICE_FLG(0x046d, 0x0807, /* Logitech Webcam C500 */
QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_MIC_RES_384),
DEVICE_FLG(0x046d, 0x0808, /* Logitech Webcam C600 */
QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_MIC_RES_384),
DEVICE_FLG(0x046d, 0x0809,
QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_MIC_RES_384),
DEVICE_FLG(0x046d, 0x0819, /* Logitech Webcam C210 */
QUIRK_FLAG_CTL_MSG_DELAY_1M | QUIRK_FLAG_MIC_RES_384),
DEVICE_FLG(0x046d, 0x081b, /* HD Webcam c310 */
Annotation
- Immediate include surface: `linux/cleanup.h`, `linux/err.h`, `linux/init.h`, `linux/slab.h`, `linux/string.h`, `linux/usb.h`, `linux/usb/audio.h`, `linux/usb/midi.h`.
- Detected declarations: `struct usb_string_match`, `struct usb_audio_quirk_flags_table`, `function create_composite_quirk`, `function ignore_interface_quirk`, `function create_any_midi_quirk`, `function create_standard_audio_quirk`, `function add_audio_stream_from_fixed_fmt`, `function create_fixed_stream_quirk`, `function create_auto_pcm_quirk`, `function create_yamaha_midi_quirk`.
- Atlas domain: Driver Families / sound/usb.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.