diff options
-rw-r--r-- | sound/usb/usbaudio.c | 59 | ||||
-rw-r--r-- | sound/usb/usbaudio.h | 35 |
2 files changed, 53 insertions, 41 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 9a0b0899d156..8298c462c291 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2735,7 +2735,8 @@ static int create_standard_interface_quirk(snd_usb_audio_t *chip, | |||
2735 | * to detect the sample rate is by looking at wMaxPacketSize. | 2735 | * to detect the sample rate is by looking at wMaxPacketSize. |
2736 | */ | 2736 | */ |
2737 | static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, | 2737 | static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, |
2738 | struct usb_interface *iface) | 2738 | struct usb_interface *iface, |
2739 | const snd_usb_audio_quirk_t *quirk) | ||
2739 | { | 2740 | { |
2740 | static const struct audioformat ua_format = { | 2741 | static const struct audioformat ua_format = { |
2741 | .format = SNDRV_PCM_FORMAT_S24_3LE, | 2742 | .format = SNDRV_PCM_FORMAT_S24_3LE, |
@@ -2826,7 +2827,9 @@ static int create_ua700_ua25_quirk(snd_usb_audio_t *chip, | |||
2826 | /* | 2827 | /* |
2827 | * Create a stream for an Edirol UA-1000 interface. | 2828 | * Create a stream for an Edirol UA-1000 interface. |
2828 | */ | 2829 | */ |
2829 | static int create_ua1000_quirk(snd_usb_audio_t *chip, struct usb_interface *iface) | 2830 | static int create_ua1000_quirk(snd_usb_audio_t *chip, |
2831 | struct usb_interface *iface, | ||
2832 | const snd_usb_audio_quirk_t *quirk) | ||
2830 | { | 2833 | { |
2831 | static const struct audioformat ua1000_format = { | 2834 | static const struct audioformat ua1000_format = { |
2832 | .format = SNDRV_PCM_FORMAT_S32_LE, | 2835 | .format = SNDRV_PCM_FORMAT_S32_LE, |
@@ -2903,6 +2906,13 @@ static int create_composite_quirk(snd_usb_audio_t *chip, | |||
2903 | return 0; | 2906 | return 0; |
2904 | } | 2907 | } |
2905 | 2908 | ||
2909 | static int ignore_interface_quirk(snd_usb_audio_t *chip, | ||
2910 | struct usb_interface *iface, | ||
2911 | const snd_usb_audio_quirk_t *quirk) | ||
2912 | { | ||
2913 | return 0; | ||
2914 | } | ||
2915 | |||
2906 | 2916 | ||
2907 | /* | 2917 | /* |
2908 | * boot quirks | 2918 | * boot quirks |
@@ -2965,29 +2975,28 @@ static int snd_usb_create_quirk(snd_usb_audio_t *chip, | |||
2965 | struct usb_interface *iface, | 2975 | struct usb_interface *iface, |
2966 | const snd_usb_audio_quirk_t *quirk) | 2976 | const snd_usb_audio_quirk_t *quirk) |
2967 | { | 2977 | { |
2968 | switch (quirk->type) { | 2978 | typedef int (*quirk_func_t)(snd_usb_audio_t *, struct usb_interface *, |
2969 | case QUIRK_MIDI_FIXED_ENDPOINT: | 2979 | const snd_usb_audio_quirk_t *); |
2970 | case QUIRK_MIDI_YAMAHA: | 2980 | static const quirk_func_t quirk_funcs[] = { |
2971 | case QUIRK_MIDI_MIDIMAN: | 2981 | [QUIRK_IGNORE_INTERFACE] = ignore_interface_quirk, |
2972 | case QUIRK_MIDI_NOVATION: | 2982 | [QUIRK_COMPOSITE] = create_composite_quirk, |
2973 | case QUIRK_MIDI_RAW: | 2983 | [QUIRK_MIDI_STANDARD_INTERFACE] = snd_usb_create_midi_interface, |
2974 | case QUIRK_MIDI_EMAGIC: | 2984 | [QUIRK_MIDI_FIXED_ENDPOINT] = snd_usb_create_midi_interface, |
2975 | case QUIRK_MIDI_MIDITECH: | 2985 | [QUIRK_MIDI_YAMAHA] = snd_usb_create_midi_interface, |
2976 | return snd_usb_create_midi_interface(chip, iface, quirk); | 2986 | [QUIRK_MIDI_MIDIMAN] = snd_usb_create_midi_interface, |
2977 | case QUIRK_COMPOSITE: | 2987 | [QUIRK_MIDI_NOVATION] = snd_usb_create_midi_interface, |
2978 | return create_composite_quirk(chip, iface, quirk); | 2988 | [QUIRK_MIDI_RAW] = snd_usb_create_midi_interface, |
2979 | case QUIRK_AUDIO_FIXED_ENDPOINT: | 2989 | [QUIRK_MIDI_EMAGIC] = snd_usb_create_midi_interface, |
2980 | return create_fixed_stream_quirk(chip, iface, quirk); | 2990 | [QUIRK_MIDI_MIDITECH] = snd_usb_create_midi_interface, |
2981 | case QUIRK_AUDIO_STANDARD_INTERFACE: | 2991 | [QUIRK_AUDIO_STANDARD_INTERFACE] = create_standard_interface_quirk, |
2982 | case QUIRK_MIDI_STANDARD_INTERFACE: | 2992 | [QUIRK_AUDIO_FIXED_ENDPOINT] = create_fixed_stream_quirk, |
2983 | return create_standard_interface_quirk(chip, iface, quirk); | 2993 | [QUIRK_AUDIO_EDIROL_UA700_UA25] = create_ua700_ua25_quirk, |
2984 | case QUIRK_AUDIO_EDIROL_UA700_UA25: | 2994 | [QUIRK_AUDIO_EDIROL_UA1000] = create_ua1000_quirk, |
2985 | return create_ua700_ua25_quirk(chip, iface); | 2995 | }; |
2986 | case QUIRK_AUDIO_EDIROL_UA1000: | 2996 | |
2987 | return create_ua1000_quirk(chip, iface); | 2997 | if (quirk->type < QUIRK_TYPE_COUNT) { |
2988 | case QUIRK_IGNORE_INTERFACE: | 2998 | return quirk_funcs[quirk->type](chip, iface, quirk); |
2989 | return 0; | 2999 | } else { |
2990 | default: | ||
2991 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); | 3000 | snd_printd(KERN_ERR "invalid quirk type %d\n", quirk->type); |
2992 | return -ENXIO; | 3001 | return -ENXIO; |
2993 | } | 3002 | } |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index c1415f4b6004..ad9eab211d8f 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -153,21 +153,24 @@ struct snd_usb_audio { | |||
153 | #define QUIRK_NO_INTERFACE -2 | 153 | #define QUIRK_NO_INTERFACE -2 |
154 | #define QUIRK_ANY_INTERFACE -1 | 154 | #define QUIRK_ANY_INTERFACE -1 |
155 | 155 | ||
156 | /* quirk type */ | 156 | enum quirk_type { |
157 | #define QUIRK_MIDI_FIXED_ENDPOINT 0 | 157 | QUIRK_IGNORE_INTERFACE, |
158 | #define QUIRK_MIDI_YAMAHA 1 | 158 | QUIRK_COMPOSITE, |
159 | #define QUIRK_MIDI_MIDIMAN 2 | 159 | QUIRK_MIDI_STANDARD_INTERFACE, |
160 | #define QUIRK_COMPOSITE 3 | 160 | QUIRK_MIDI_FIXED_ENDPOINT, |
161 | #define QUIRK_AUDIO_FIXED_ENDPOINT 4 | 161 | QUIRK_MIDI_YAMAHA, |
162 | #define QUIRK_AUDIO_STANDARD_INTERFACE 5 | 162 | QUIRK_MIDI_MIDIMAN, |
163 | #define QUIRK_MIDI_STANDARD_INTERFACE 6 | 163 | QUIRK_MIDI_NOVATION, |
164 | #define QUIRK_AUDIO_EDIROL_UA700_UA25 7 | 164 | QUIRK_MIDI_RAW, |
165 | #define QUIRK_AUDIO_EDIROL_UA1000 8 | 165 | QUIRK_MIDI_EMAGIC, |
166 | #define QUIRK_IGNORE_INTERFACE 9 | 166 | QUIRK_MIDI_MIDITECH, |
167 | #define QUIRK_MIDI_NOVATION 10 | 167 | QUIRK_AUDIO_STANDARD_INTERFACE, |
168 | #define QUIRK_MIDI_RAW 11 | 168 | QUIRK_AUDIO_FIXED_ENDPOINT, |
169 | #define QUIRK_MIDI_EMAGIC 12 | 169 | QUIRK_AUDIO_EDIROL_UA700_UA25, |
170 | #define QUIRK_MIDI_MIDITECH 13 | 170 | QUIRK_AUDIO_EDIROL_UA1000, |
171 | |||
172 | QUIRK_TYPE_COUNT | ||
173 | }; | ||
171 | 174 | ||
172 | typedef struct snd_usb_audio_quirk snd_usb_audio_quirk_t; | 175 | typedef struct snd_usb_audio_quirk snd_usb_audio_quirk_t; |
173 | typedef struct snd_usb_midi_endpoint_info snd_usb_midi_endpoint_info_t; | 176 | typedef struct snd_usb_midi_endpoint_info snd_usb_midi_endpoint_info_t; |
@@ -176,7 +179,7 @@ struct snd_usb_audio_quirk { | |||
176 | const char *vendor_name; | 179 | const char *vendor_name; |
177 | const char *product_name; | 180 | const char *product_name; |
178 | int16_t ifnum; | 181 | int16_t ifnum; |
179 | int16_t type; | 182 | uint16_t type; |
180 | const void *data; | 183 | const void *data; |
181 | }; | 184 | }; |
182 | 185 | ||