0001
0002 #ifndef __USBAUDIO_H
0003 #define __USBAUDIO_H
0004
0005
0006
0007
0008
0009
0010
0011 #define USB_ID(vendor, product) (((unsigned int)(vendor) << 16) | (product))
0012 #define USB_ID_VENDOR(id) ((id) >> 16)
0013 #define USB_ID_PRODUCT(id) ((u16)(id))
0014
0015
0016
0017
0018
0019 struct media_device;
0020 struct media_intf_devnode;
0021
0022 #define MAX_CARD_INTERFACES 16
0023
0024 struct snd_usb_audio {
0025 int index;
0026 struct usb_device *dev;
0027 struct snd_card *card;
0028 struct usb_interface *intf[MAX_CARD_INTERFACES];
0029 u32 usb_id;
0030 uint16_t quirk_type;
0031 struct mutex mutex;
0032 unsigned int system_suspend;
0033 atomic_t active;
0034 atomic_t shutdown;
0035 atomic_t usage_count;
0036 wait_queue_head_t shutdown_wait;
0037 unsigned int quirk_flags;
0038 unsigned int need_delayed_register:1;
0039 int num_interfaces;
0040 int num_suspended_intf;
0041 int sample_rate_read_error;
0042
0043 int badd_profile;
0044
0045 struct list_head pcm_list;
0046 struct list_head ep_list;
0047 struct list_head iface_ref_list;
0048 struct list_head clock_ref_list;
0049 int pcm_devs;
0050
0051 struct list_head midi_list;
0052
0053 struct list_head mixer_list;
0054
0055 int setup;
0056 bool generic_implicit_fb;
0057 bool autoclock;
0058
0059 bool lowlatency;
0060 struct usb_host_interface *ctrl_intf;
0061 struct media_device *media_dev;
0062 struct media_intf_devnode *ctl_intf_media_devnode;
0063 };
0064
0065 #define USB_AUDIO_IFACE_UNUSED ((void *)-1L)
0066
0067 #define usb_audio_err(chip, fmt, args...) \
0068 dev_err(&(chip)->dev->dev, fmt, ##args)
0069 #define usb_audio_warn(chip, fmt, args...) \
0070 dev_warn(&(chip)->dev->dev, fmt, ##args)
0071 #define usb_audio_info(chip, fmt, args...) \
0072 dev_info(&(chip)->dev->dev, fmt, ##args)
0073 #define usb_audio_dbg(chip, fmt, args...) \
0074 dev_dbg(&(chip)->dev->dev, fmt, ##args)
0075
0076
0077
0078
0079
0080
0081 #define QUIRK_NODEV_INTERFACE -3
0082 #define QUIRK_NO_INTERFACE -2
0083 #define QUIRK_ANY_INTERFACE -1
0084
0085 enum quirk_type {
0086 QUIRK_IGNORE_INTERFACE,
0087 QUIRK_COMPOSITE,
0088 QUIRK_AUTODETECT,
0089 QUIRK_MIDI_STANDARD_INTERFACE,
0090 QUIRK_MIDI_FIXED_ENDPOINT,
0091 QUIRK_MIDI_YAMAHA,
0092 QUIRK_MIDI_ROLAND,
0093 QUIRK_MIDI_MIDIMAN,
0094 QUIRK_MIDI_NOVATION,
0095 QUIRK_MIDI_RAW_BYTES,
0096 QUIRK_MIDI_EMAGIC,
0097 QUIRK_MIDI_CME,
0098 QUIRK_MIDI_AKAI,
0099 QUIRK_MIDI_US122L,
0100 QUIRK_MIDI_FTDI,
0101 QUIRK_MIDI_CH345,
0102 QUIRK_AUDIO_STANDARD_INTERFACE,
0103 QUIRK_AUDIO_FIXED_ENDPOINT,
0104 QUIRK_AUDIO_EDIROL_UAXX,
0105 QUIRK_AUDIO_STANDARD_MIXER,
0106
0107 QUIRK_TYPE_COUNT
0108 };
0109
0110 struct snd_usb_audio_quirk {
0111 const char *vendor_name;
0112 const char *product_name;
0113 int16_t ifnum;
0114 uint16_t type;
0115 const void *data;
0116 };
0117
0118 #define combine_word(s) ((*(s)) | ((unsigned int)(s)[1] << 8))
0119 #define combine_triple(s) (combine_word(s) | ((unsigned int)(s)[2] << 16))
0120 #define combine_quad(s) (combine_triple(s) | ((unsigned int)(s)[3] << 24))
0121
0122 int snd_usb_lock_shutdown(struct snd_usb_audio *chip);
0123 void snd_usb_unlock_shutdown(struct snd_usb_audio *chip);
0124
0125 extern bool snd_usb_use_vmalloc;
0126 extern bool snd_usb_skip_validation;
0127
0128
0129
0130
0131
0132
0133
0134
0135
0136
0137
0138
0139
0140
0141
0142
0143
0144
0145
0146
0147
0148
0149
0150
0151
0152
0153
0154
0155
0156
0157
0158
0159
0160
0161
0162
0163
0164
0165
0166
0167
0168
0169
0170
0171
0172
0173
0174 #define QUIRK_FLAG_GET_SAMPLE_RATE (1U << 0)
0175 #define QUIRK_FLAG_SHARE_MEDIA_DEVICE (1U << 1)
0176 #define QUIRK_FLAG_ALIGN_TRANSFER (1U << 2)
0177 #define QUIRK_FLAG_TX_LENGTH (1U << 3)
0178 #define QUIRK_FLAG_PLAYBACK_FIRST (1U << 4)
0179 #define QUIRK_FLAG_SKIP_CLOCK_SELECTOR (1U << 5)
0180 #define QUIRK_FLAG_IGNORE_CLOCK_SOURCE (1U << 6)
0181 #define QUIRK_FLAG_ITF_USB_DSD_DAC (1U << 7)
0182 #define QUIRK_FLAG_CTL_MSG_DELAY (1U << 8)
0183 #define QUIRK_FLAG_CTL_MSG_DELAY_1M (1U << 9)
0184 #define QUIRK_FLAG_CTL_MSG_DELAY_5M (1U << 10)
0185 #define QUIRK_FLAG_IFACE_DELAY (1U << 11)
0186 #define QUIRK_FLAG_VALIDATE_RATES (1U << 12)
0187 #define QUIRK_FLAG_DISABLE_AUTOSUSPEND (1U << 13)
0188 #define QUIRK_FLAG_IGNORE_CTL_ERROR (1U << 14)
0189 #define QUIRK_FLAG_DSD_RAW (1U << 15)
0190 #define QUIRK_FLAG_SET_IFACE_FIRST (1U << 16)
0191 #define QUIRK_FLAG_GENERIC_IMPLICIT_FB (1U << 17)
0192 #define QUIRK_FLAG_SKIP_IMPLICIT_FB (1U << 18)
0193
0194 #endif