diff options
Diffstat (limited to 'sound/usb')
-rw-r--r-- | sound/usb/usbaudio.c | 15 | ||||
-rw-r--r-- | sound/usb/usbaudio.h | 7 | ||||
-rw-r--r-- | sound/usb/usbmidi.c | 202 | ||||
-rw-r--r-- | sound/usb/usbmixer.c | 70 | ||||
-rw-r--r-- | sound/usb/usx2y/usx2yhwdeppcm.c | 2 |
5 files changed, 181 insertions, 115 deletions
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c index 4e614ac39f..627de9525a 100644 --- a/sound/usb/usbaudio.c +++ b/sound/usb/usbaudio.c | |||
@@ -2138,7 +2138,7 @@ static void proc_pcm_format_add(struct snd_usb_stream *stream) | |||
2138 | 2138 | ||
2139 | sprintf(name, "stream%d", stream->pcm_index); | 2139 | sprintf(name, "stream%d", stream->pcm_index); |
2140 | if (! snd_card_proc_new(card, name, &entry)) | 2140 | if (! snd_card_proc_new(card, name, &entry)) |
2141 | snd_info_set_text_ops(entry, stream, 1024, proc_pcm_format_read); | 2141 | snd_info_set_text_ops(entry, stream, proc_pcm_format_read); |
2142 | } | 2142 | } |
2143 | 2143 | ||
2144 | #else | 2144 | #else |
@@ -2627,9 +2627,10 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
2627 | if (!csep && altsd->bNumEndpoints >= 2) | 2627 | if (!csep && altsd->bNumEndpoints >= 2) |
2628 | csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT); | 2628 | csep = snd_usb_find_desc(alts->endpoint[1].extra, alts->endpoint[1].extralen, NULL, USB_DT_CS_ENDPOINT); |
2629 | if (!csep || csep[0] < 7 || csep[2] != EP_GENERAL) { | 2629 | if (!csep || csep[0] < 7 || csep[2] != EP_GENERAL) { |
2630 | snd_printk(KERN_ERR "%d:%u:%d : no or invalid class specific endpoint descriptor\n", | 2630 | snd_printk(KERN_WARNING "%d:%u:%d : no or invalid" |
2631 | " class specific endpoint descriptor\n", | ||
2631 | dev->devnum, iface_no, altno); | 2632 | dev->devnum, iface_no, altno); |
2632 | continue; | 2633 | csep = NULL; |
2633 | } | 2634 | } |
2634 | 2635 | ||
2635 | fp = kmalloc(sizeof(*fp), GFP_KERNEL); | 2636 | fp = kmalloc(sizeof(*fp), GFP_KERNEL); |
@@ -2648,7 +2649,7 @@ static int parse_audio_endpoints(struct snd_usb_audio *chip, int iface_no) | |||
2648 | if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) | 2649 | if (snd_usb_get_speed(dev) == USB_SPEED_HIGH) |
2649 | fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1) | 2650 | fp->maxpacksize = (((fp->maxpacksize >> 11) & 3) + 1) |
2650 | * (fp->maxpacksize & 0x7ff); | 2651 | * (fp->maxpacksize & 0x7ff); |
2651 | fp->attributes = csep[3]; | 2652 | fp->attributes = csep ? csep[3] : 0; |
2652 | 2653 | ||
2653 | /* some quirks for attributes here */ | 2654 | /* some quirks for attributes here */ |
2654 | 2655 | ||
@@ -2980,7 +2981,7 @@ static int create_ua1000_quirk(struct snd_usb_audio *chip, | |||
2980 | return -ENXIO; | 2981 | return -ENXIO; |
2981 | alts = &iface->altsetting[1]; | 2982 | alts = &iface->altsetting[1]; |
2982 | altsd = get_iface_desc(alts); | 2983 | altsd = get_iface_desc(alts); |
2983 | if (alts->extralen != 11 || alts->extra[1] != CS_AUDIO_INTERFACE || | 2984 | if (alts->extralen != 11 || alts->extra[1] != USB_DT_CS_INTERFACE || |
2984 | altsd->bNumEndpoints != 1) | 2985 | altsd->bNumEndpoints != 1) |
2985 | return -ENXIO; | 2986 | return -ENXIO; |
2986 | 2987 | ||
@@ -3197,9 +3198,9 @@ static void snd_usb_audio_create_proc(struct snd_usb_audio *chip) | |||
3197 | { | 3198 | { |
3198 | struct snd_info_entry *entry; | 3199 | struct snd_info_entry *entry; |
3199 | if (! snd_card_proc_new(chip->card, "usbbus", &entry)) | 3200 | if (! snd_card_proc_new(chip->card, "usbbus", &entry)) |
3200 | snd_info_set_text_ops(entry, chip, 1024, proc_audio_usbbus_read); | 3201 | snd_info_set_text_ops(entry, chip, proc_audio_usbbus_read); |
3201 | if (! snd_card_proc_new(chip->card, "usbid", &entry)) | 3202 | if (! snd_card_proc_new(chip->card, "usbid", &entry)) |
3202 | snd_info_set_text_ops(entry, chip, 1024, proc_audio_usbid_read); | 3203 | snd_info_set_text_ops(entry, chip, proc_audio_usbid_read); |
3203 | } | 3204 | } |
3204 | 3205 | ||
3205 | /* | 3206 | /* |
diff --git a/sound/usb/usbaudio.h b/sound/usb/usbaudio.h index 88733524d0..0f4b2b8541 100644 --- a/sound/usb/usbaudio.h +++ b/sound/usb/usbaudio.h | |||
@@ -30,13 +30,6 @@ | |||
30 | #define USB_SUBCLASS_MIDI_STREAMING 0x03 | 30 | #define USB_SUBCLASS_MIDI_STREAMING 0x03 |
31 | #define USB_SUBCLASS_VENDOR_SPEC 0xff | 31 | #define USB_SUBCLASS_VENDOR_SPEC 0xff |
32 | 32 | ||
33 | #define CS_AUDIO_UNDEFINED 0x20 | ||
34 | #define CS_AUDIO_DEVICE 0x21 | ||
35 | #define CS_AUDIO_CONFIGURATION 0x22 | ||
36 | #define CS_AUDIO_STRING 0x23 | ||
37 | #define CS_AUDIO_INTERFACE 0x24 | ||
38 | #define CS_AUDIO_ENDPOINT 0x25 | ||
39 | |||
40 | #define HEADER 0x01 | 33 | #define HEADER 0x01 |
41 | #define INPUT_TERMINAL 0x02 | 34 | #define INPUT_TERMINAL 0x02 |
42 | #define OUTPUT_TERMINAL 0x03 | 35 | #define OUTPUT_TERMINAL 0x03 |
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c index 2b9d940c80..5105b6b057 100644 --- a/sound/usb/usbmidi.c +++ b/sound/usb/usbmidi.c | |||
@@ -48,6 +48,7 @@ | |||
48 | #include <linux/usb.h> | 48 | #include <linux/usb.h> |
49 | #include <sound/core.h> | 49 | #include <sound/core.h> |
50 | #include <sound/rawmidi.h> | 50 | #include <sound/rawmidi.h> |
51 | #include <sound/asequencer.h> | ||
51 | #include "usbaudio.h" | 52 | #include "usbaudio.h" |
52 | 53 | ||
53 | 54 | ||
@@ -1010,97 +1011,157 @@ static struct snd_rawmidi_substream *snd_usbmidi_find_substream(struct snd_usb_m | |||
1010 | * "(product) MIDI (n)" schema because they aren't external MIDI ports, | 1011 | * "(product) MIDI (n)" schema because they aren't external MIDI ports, |
1011 | * such as internal control or synthesizer ports. | 1012 | * such as internal control or synthesizer ports. |
1012 | */ | 1013 | */ |
1013 | static struct { | 1014 | static struct port_info { |
1014 | u32 id; | 1015 | u32 id; |
1015 | int port; | 1016 | short int port; |
1016 | const char *name_format; | 1017 | short int voices; |
1017 | } snd_usbmidi_port_names[] = { | 1018 | const char *name; |
1019 | unsigned int seq_flags; | ||
1020 | } snd_usbmidi_port_info[] = { | ||
1021 | #define PORT_INFO(vendor, product, num, name_, voices_, flags) \ | ||
1022 | { .id = USB_ID(vendor, product), \ | ||
1023 | .port = num, .voices = voices_, \ | ||
1024 | .name = name_, .seq_flags = flags } | ||
1025 | #define EXTERNAL_PORT(vendor, product, num, name) \ | ||
1026 | PORT_INFO(vendor, product, num, name, 0, \ | ||
1027 | SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC | \ | ||
1028 | SNDRV_SEQ_PORT_TYPE_HARDWARE | \ | ||
1029 | SNDRV_SEQ_PORT_TYPE_PORT) | ||
1030 | #define CONTROL_PORT(vendor, product, num, name) \ | ||
1031 | PORT_INFO(vendor, product, num, name, 0, \ | ||
1032 | SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC | \ | ||
1033 | SNDRV_SEQ_PORT_TYPE_HARDWARE) | ||
1034 | #define ROLAND_SYNTH_PORT(vendor, product, num, name, voices) \ | ||
1035 | PORT_INFO(vendor, product, num, name, voices, \ | ||
1036 | SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC | \ | ||
1037 | SNDRV_SEQ_PORT_TYPE_MIDI_GM | \ | ||
1038 | SNDRV_SEQ_PORT_TYPE_MIDI_GM2 | \ | ||
1039 | SNDRV_SEQ_PORT_TYPE_MIDI_GS | \ | ||
1040 | SNDRV_SEQ_PORT_TYPE_MIDI_XG | \ | ||
1041 | SNDRV_SEQ_PORT_TYPE_HARDWARE | \ | ||
1042 | SNDRV_SEQ_PORT_TYPE_SYNTHESIZER) | ||
1043 | #define SOUNDCANVAS_PORT(vendor, product, num, name, voices) \ | ||
1044 | PORT_INFO(vendor, product, num, name, voices, \ | ||
1045 | SNDRV_SEQ_PORT_TYPE_MIDI_GENERIC | \ | ||
1046 | SNDRV_SEQ_PORT_TYPE_MIDI_GM | \ | ||
1047 | SNDRV_SEQ_PORT_TYPE_MIDI_GM2 | \ | ||
1048 | SNDRV_SEQ_PORT_TYPE_MIDI_GS | \ | ||
1049 | SNDRV_SEQ_PORT_TYPE_MIDI_XG | \ | ||
1050 | SNDRV_SEQ_PORT_TYPE_MIDI_MT32 | \ | ||
1051 | SNDRV_SEQ_PORT_TYPE_HARDWARE | \ | ||
1052 | SNDRV_SEQ_PORT_TYPE_SYNTHESIZER) | ||
1018 | /* Roland UA-100 */ | 1053 | /* Roland UA-100 */ |
1019 | { USB_ID(0x0582, 0x0000), 2, "%s Control" }, | 1054 | CONTROL_PORT(0x0582, 0x0000, 2, "%s Control"), |
1020 | /* Roland SC-8850 */ | 1055 | /* Roland SC-8850 */ |
1021 | { USB_ID(0x0582, 0x0003), 0, "%s Part A" }, | 1056 | SOUNDCANVAS_PORT(0x0582, 0x0003, 0, "%s Part A", 128), |
1022 | { USB_ID(0x0582, 0x0003), 1, "%s Part B" }, | 1057 | SOUNDCANVAS_PORT(0x0582, 0x0003, 1, "%s Part B", 128), |
1023 | { USB_ID(0x0582, 0x0003), 2, "%s Part C" }, | 1058 | SOUNDCANVAS_PORT(0x0582, 0x0003, 2, "%s Part C", 128), |
1024 | { USB_ID(0x0582, 0x0003), 3, "%s Part D" }, | 1059 | SOUNDCANVAS_PORT(0x0582, 0x0003, 3, "%s Part D", 128), |
1025 | { USB_ID(0x0582, 0x0003), 4, "%s MIDI 1" }, | 1060 | EXTERNAL_PORT(0x0582, 0x0003, 4, "%s MIDI 1"), |
1026 | { USB_ID(0x0582, 0x0003), 5, "%s MIDI 2" }, | 1061 | EXTERNAL_PORT(0x0582, 0x0003, 5, "%s MIDI 2"), |
1027 | /* Roland U-8 */ | 1062 | /* Roland U-8 */ |
1028 | { USB_ID(0x0582, 0x0004), 0, "%s MIDI" }, | 1063 | EXTERNAL_PORT(0x0582, 0x0004, 0, "%s MIDI"), |
1029 | { USB_ID(0x0582, 0x0004), 1, "%s Control" }, | 1064 | CONTROL_PORT(0x0582, 0x0004, 1, "%s Control"), |
1030 | /* Roland SC-8820 */ | 1065 | /* Roland SC-8820 */ |
1031 | { USB_ID(0x0582, 0x0007), 0, "%s Part A" }, | 1066 | SOUNDCANVAS_PORT(0x0582, 0x0007, 0, "%s Part A", 64), |
1032 | { USB_ID(0x0582, 0x0007), 1, "%s Part B" }, | 1067 | SOUNDCANVAS_PORT(0x0582, 0x0007, 1, "%s Part B", 64), |
1033 | { USB_ID(0x0582, 0x0007), 2, "%s MIDI" }, | 1068 | EXTERNAL_PORT(0x0582, 0x0007, 2, "%s MIDI"), |
1034 | /* Roland SK-500 */ | 1069 | /* Roland SK-500 */ |
1035 | { USB_ID(0x0582, 0x000b), 0, "%s Part A" }, | 1070 | SOUNDCANVAS_PORT(0x0582, 0x000b, 0, "%s Part A", 64), |
1036 | { USB_ID(0x0582, 0x000b), 1, "%s Part B" }, | 1071 | SOUNDCANVAS_PORT(0x0582, 0x000b, 1, "%s Part B", 64), |
1037 | { USB_ID(0x0582, 0x000b), 2, "%s MIDI" }, | 1072 | EXTERNAL_PORT(0x0582, 0x000b, 2, "%s MIDI"), |
1038 | /* Roland SC-D70 */ | 1073 | /* Roland SC-D70 */ |
1039 | { USB_ID(0x0582, 0x000c), 0, "%s Part A" }, | 1074 | SOUNDCANVAS_PORT(0x0582, 0x000c, 0, "%s Part A", 64), |
1040 | { USB_ID(0x0582, 0x000c), 1, "%s Part B" }, | 1075 | SOUNDCANVAS_PORT(0x0582, 0x000c, 1, "%s Part B", 64), |
1041 | { USB_ID(0x0582, 0x000c), 2, "%s MIDI" }, | 1076 | EXTERNAL_PORT(0x0582, 0x000c, 2, "%s MIDI"), |
1042 | /* Edirol UM-880 */ | 1077 | /* Edirol UM-880 */ |
1043 | { USB_ID(0x0582, 0x0014), 8, "%s Control" }, | 1078 | CONTROL_PORT(0x0582, 0x0014, 8, "%s Control"), |
1044 | /* Edirol SD-90 */ | 1079 | /* Edirol SD-90 */ |
1045 | { USB_ID(0x0582, 0x0016), 0, "%s Part A" }, | 1080 | ROLAND_SYNTH_PORT(0x0582, 0x0016, 0, "%s Part A", 128), |
1046 | { USB_ID(0x0582, 0x0016), 1, "%s Part B" }, | 1081 | ROLAND_SYNTH_PORT(0x0582, 0x0016, 1, "%s Part B", 128), |
1047 | { USB_ID(0x0582, 0x0016), 2, "%s MIDI 1" }, | 1082 | EXTERNAL_PORT(0x0582, 0x0016, 2, "%s MIDI 1"), |
1048 | { USB_ID(0x0582, 0x0016), 3, "%s MIDI 2" }, | 1083 | EXTERNAL_PORT(0x0582, 0x0016, 3, "%s MIDI 2"), |
1049 | /* Edirol UM-550 */ | 1084 | /* Edirol UM-550 */ |
1050 | { USB_ID(0x0582, 0x0023), 5, "%s Control" }, | 1085 | CONTROL_PORT(0x0582, 0x0023, 5, "%s Control"), |
1051 | /* Edirol SD-20 */ | 1086 | /* Edirol SD-20 */ |
1052 | { USB_ID(0x0582, 0x0027), 0, "%s Part A" }, | 1087 | ROLAND_SYNTH_PORT(0x0582, 0x0027, 0, "%s Part A", 64), |
1053 | { USB_ID(0x0582, 0x0027), 1, "%s Part B" }, | 1088 | ROLAND_SYNTH_PORT(0x0582, 0x0027, 1, "%s Part B", 64), |
1054 | { USB_ID(0x0582, 0x0027), 2, "%s MIDI" }, | 1089 | EXTERNAL_PORT(0x0582, 0x0027, 2, "%s MIDI"), |
1055 | /* Edirol SD-80 */ | 1090 | /* Edirol SD-80 */ |
1056 | { USB_ID(0x0582, 0x0029), 0, "%s Part A" }, | 1091 | ROLAND_SYNTH_PORT(0x0582, 0x0029, 0, "%s Part A", 128), |
1057 | { USB_ID(0x0582, 0x0029), 1, "%s Part B" }, | 1092 | ROLAND_SYNTH_PORT(0x0582, 0x0029, 1, "%s Part B", 128), |
1058 | { USB_ID(0x0582, 0x0029), 2, "%s MIDI 1" }, | 1093 | EXTERNAL_PORT(0x0582, 0x0029, 2, "%s MIDI 1"), |
1059 | { USB_ID(0x0582, 0x0029), 3, "%s MIDI 2" }, | 1094 | EXTERNAL_PORT(0x0582, 0x0029, 3, "%s MIDI 2"), |
1060 | /* Edirol UA-700 */ | 1095 | /* Edirol UA-700 */ |
1061 | { USB_ID(0x0582, 0x002b), 0, "%s MIDI" }, | 1096 | EXTERNAL_PORT(0x0582, 0x002b, 0, "%s MIDI"), |
1062 | { USB_ID(0x0582, 0x002b), 1, "%s Control" }, | 1097 | CONTROL_PORT(0x0582, 0x002b, 1, "%s Control"), |
1063 | /* Roland VariOS */ | 1098 | /* Roland VariOS */ |
1064 | { USB_ID(0x0582, 0x002f), 0, "%s MIDI" }, | 1099 | EXTERNAL_PORT(0x0582, 0x002f, 0, "%s MIDI"), |
1065 | { USB_ID(0x0582, 0x002f), 1, "%s External MIDI" }, | 1100 | EXTERNAL_PORT(0x0582, 0x002f, 1, "%s External MIDI"), |
1066 | { USB_ID(0x0582, 0x002f), 2, "%s Sync" }, | 1101 | EXTERNAL_PORT(0x0582, 0x002f, 2, "%s Sync"), |
1067 | /* Edirol PCR */ | 1102 | /* Edirol PCR */ |
1068 | { USB_ID(0x0582, 0x0033), 0, "%s MIDI" }, | 1103 | EXTERNAL_PORT(0x0582, 0x0033, 0, "%s MIDI"), |
1069 | { USB_ID(0x0582, 0x0033), 1, "%s 1" }, | 1104 | EXTERNAL_PORT(0x0582, 0x0033, 1, "%s 1"), |
1070 | { USB_ID(0x0582, 0x0033), 2, "%s 2" }, | 1105 | EXTERNAL_PORT(0x0582, 0x0033, 2, "%s 2"), |
1071 | /* BOSS GS-10 */ | 1106 | /* BOSS GS-10 */ |
1072 | { USB_ID(0x0582, 0x003b), 0, "%s MIDI" }, | 1107 | EXTERNAL_PORT(0x0582, 0x003b, 0, "%s MIDI"), |
1073 | { USB_ID(0x0582, 0x003b), 1, "%s Control" }, | 1108 | CONTROL_PORT(0x0582, 0x003b, 1, "%s Control"), |
1074 | /* Edirol UA-1000 */ | 1109 | /* Edirol UA-1000 */ |
1075 | { USB_ID(0x0582, 0x0044), 0, "%s MIDI" }, | 1110 | EXTERNAL_PORT(0x0582, 0x0044, 0, "%s MIDI"), |
1076 | { USB_ID(0x0582, 0x0044), 1, "%s Control" }, | 1111 | CONTROL_PORT(0x0582, 0x0044, 1, "%s Control"), |
1077 | /* Edirol UR-80 */ | 1112 | /* Edirol UR-80 */ |
1078 | { USB_ID(0x0582, 0x0048), 0, "%s MIDI" }, | 1113 | EXTERNAL_PORT(0x0582, 0x0048, 0, "%s MIDI"), |
1079 | { USB_ID(0x0582, 0x0048), 1, "%s 1" }, | 1114 | EXTERNAL_PORT(0x0582, 0x0048, 1, "%s 1"), |
1080 | { USB_ID(0x0582, 0x0048), 2, "%s 2" }, | 1115 | EXTERNAL_PORT(0x0582, 0x0048, 2, "%s 2"), |
1081 | /* Edirol PCR-A */ | 1116 | /* Edirol PCR-A */ |
1082 | { USB_ID(0x0582, 0x004d), 0, "%s MIDI" }, | 1117 | EXTERNAL_PORT(0x0582, 0x004d, 0, "%s MIDI"), |
1083 | { USB_ID(0x0582, 0x004d), 1, "%s 1" }, | 1118 | EXTERNAL_PORT(0x0582, 0x004d, 1, "%s 1"), |
1084 | { USB_ID(0x0582, 0x004d), 2, "%s 2" }, | 1119 | EXTERNAL_PORT(0x0582, 0x004d, 2, "%s 2"), |
1085 | /* Edirol UM-3EX */ | 1120 | /* Edirol UM-3EX */ |
1086 | { USB_ID(0x0582, 0x009a), 3, "%s Control" }, | 1121 | CONTROL_PORT(0x0582, 0x009a, 3, "%s Control"), |
1087 | /* M-Audio MidiSport 8x8 */ | 1122 | /* M-Audio MidiSport 8x8 */ |
1088 | { USB_ID(0x0763, 0x1031), 8, "%s Control" }, | 1123 | CONTROL_PORT(0x0763, 0x1031, 8, "%s Control"), |
1089 | { USB_ID(0x0763, 0x1033), 8, "%s Control" }, | 1124 | CONTROL_PORT(0x0763, 0x1033, 8, "%s Control"), |
1090 | /* MOTU Fastlane */ | 1125 | /* MOTU Fastlane */ |
1091 | { USB_ID(0x07fd, 0x0001), 0, "%s MIDI A" }, | 1126 | EXTERNAL_PORT(0x07fd, 0x0001, 0, "%s MIDI A"), |
1092 | { USB_ID(0x07fd, 0x0001), 1, "%s MIDI B" }, | 1127 | EXTERNAL_PORT(0x07fd, 0x0001, 1, "%s MIDI B"), |
1093 | /* Emagic Unitor8/AMT8/MT4 */ | 1128 | /* Emagic Unitor8/AMT8/MT4 */ |
1094 | { USB_ID(0x086a, 0x0001), 8, "%s Broadcast" }, | 1129 | EXTERNAL_PORT(0x086a, 0x0001, 8, "%s Broadcast"), |
1095 | { USB_ID(0x086a, 0x0002), 8, "%s Broadcast" }, | 1130 | EXTERNAL_PORT(0x086a, 0x0002, 8, "%s Broadcast"), |
1096 | { USB_ID(0x086a, 0x0003), 4, "%s Broadcast" }, | 1131 | EXTERNAL_PORT(0x086a, 0x0003, 4, "%s Broadcast"), |
1097 | }; | 1132 | }; |
1098 | 1133 | ||
1134 | static struct port_info *find_port_info(struct snd_usb_midi* umidi, int number) | ||
1135 | { | ||
1136 | int i; | ||
1137 | |||
1138 | for (i = 0; i < ARRAY_SIZE(snd_usbmidi_port_info); ++i) { | ||
1139 | if (snd_usbmidi_port_info[i].id == umidi->chip->usb_id && | ||
1140 | snd_usbmidi_port_info[i].port == number) | ||
1141 | return &snd_usbmidi_port_info[i]; | ||
1142 | } | ||
1143 | return NULL; | ||
1144 | } | ||
1145 | |||
1146 | static void snd_usbmidi_get_port_info(struct snd_rawmidi *rmidi, int number, | ||
1147 | struct snd_seq_port_info *seq_port_info) | ||
1148 | { | ||
1149 | struct snd_usb_midi *umidi = rmidi->private_data; | ||
1150 | struct port_info *port_info; | ||
1151 | |||
1152 | /* TODO: read port flags from descriptors */ | ||
1153 | port_info = find_port_info(umidi, number); | ||
1154 | if (port_info) { | ||
1155 | seq_port_info->type = port_info->seq_flags; | ||
1156 | seq_port_info->midi_voices = port_info->voices; | ||
1157 | } | ||
1158 | } | ||
1159 | |||
1099 | static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, | 1160 | static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, |
1100 | int stream, int number, | 1161 | int stream, int number, |
1101 | struct snd_rawmidi_substream ** rsubstream) | 1162 | struct snd_rawmidi_substream ** rsubstream) |
1102 | { | 1163 | { |
1103 | int i; | 1164 | struct port_info *port_info; |
1104 | const char *name_format; | 1165 | const char *name_format; |
1105 | 1166 | ||
1106 | struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number); | 1167 | struct snd_rawmidi_substream *substream = snd_usbmidi_find_substream(umidi, stream, number); |
@@ -1110,14 +1171,8 @@ static void snd_usbmidi_init_substream(struct snd_usb_midi* umidi, | |||
1110 | } | 1171 | } |
1111 | 1172 | ||
1112 | /* TODO: read port name from jack descriptor */ | 1173 | /* TODO: read port name from jack descriptor */ |
1113 | name_format = "%s MIDI %d"; | 1174 | port_info = find_port_info(umidi, number); |
1114 | for (i = 0; i < ARRAY_SIZE(snd_usbmidi_port_names); ++i) { | 1175 | name_format = port_info ? port_info->name : "%s MIDI %d"; |
1115 | if (snd_usbmidi_port_names[i].id == umidi->chip->usb_id && | ||
1116 | snd_usbmidi_port_names[i].port == number) { | ||
1117 | name_format = snd_usbmidi_port_names[i].name_format; | ||
1118 | break; | ||
1119 | } | ||
1120 | } | ||
1121 | snprintf(substream->name, sizeof(substream->name), | 1176 | snprintf(substream->name, sizeof(substream->name), |
1122 | name_format, umidi->chip->card->shortname, number + 1); | 1177 | name_format, umidi->chip->card->shortname, number + 1); |
1123 | 1178 | ||
@@ -1358,7 +1413,7 @@ static int snd_usbmidi_detect_yamaha(struct snd_usb_midi* umidi, | |||
1358 | for (cs_desc = hostif->extra; | 1413 | for (cs_desc = hostif->extra; |
1359 | cs_desc < hostif->extra + hostif->extralen && cs_desc[0] >= 2; | 1414 | cs_desc < hostif->extra + hostif->extralen && cs_desc[0] >= 2; |
1360 | cs_desc += cs_desc[0]) { | 1415 | cs_desc += cs_desc[0]) { |
1361 | if (cs_desc[1] == CS_AUDIO_INTERFACE) { | 1416 | if (cs_desc[1] == USB_DT_CS_INTERFACE) { |
1362 | if (cs_desc[2] == MIDI_IN_JACK) | 1417 | if (cs_desc[2] == MIDI_IN_JACK) |
1363 | endpoint->in_cables = (endpoint->in_cables << 1) | 1; | 1418 | endpoint->in_cables = (endpoint->in_cables << 1) | 1; |
1364 | else if (cs_desc[2] == MIDI_OUT_JACK) | 1419 | else if (cs_desc[2] == MIDI_OUT_JACK) |
@@ -1457,6 +1512,10 @@ static int snd_usbmidi_create_endpoints_midiman(struct snd_usb_midi* umidi, | |||
1457 | return 0; | 1512 | return 0; |
1458 | } | 1513 | } |
1459 | 1514 | ||
1515 | static struct snd_rawmidi_global_ops snd_usbmidi_ops = { | ||
1516 | .get_port_info = snd_usbmidi_get_port_info, | ||
1517 | }; | ||
1518 | |||
1460 | static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi, | 1519 | static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi, |
1461 | int out_ports, int in_ports) | 1520 | int out_ports, int in_ports) |
1462 | { | 1521 | { |
@@ -1472,6 +1531,7 @@ static int snd_usbmidi_create_rawmidi(struct snd_usb_midi* umidi, | |||
1472 | rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | | 1531 | rmidi->info_flags = SNDRV_RAWMIDI_INFO_OUTPUT | |
1473 | SNDRV_RAWMIDI_INFO_INPUT | | 1532 | SNDRV_RAWMIDI_INFO_INPUT | |
1474 | SNDRV_RAWMIDI_INFO_DUPLEX; | 1533 | SNDRV_RAWMIDI_INFO_DUPLEX; |
1534 | rmidi->ops = &snd_usbmidi_ops; | ||
1475 | rmidi->private_data = umidi; | 1535 | rmidi->private_data = umidi; |
1476 | rmidi->private_free = snd_usbmidi_rawmidi_free; | 1536 | rmidi->private_free = snd_usbmidi_rawmidi_free; |
1477 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_usbmidi_output_ops); | 1537 | snd_rawmidi_set_ops(rmidi, SNDRV_RAWMIDI_STREAM_OUTPUT, &snd_usbmidi_output_ops); |
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c index ce86283ee0..491e975a0c 100644 --- a/sound/usb/usbmixer.c +++ b/sound/usb/usbmixer.c | |||
@@ -46,6 +46,27 @@ | |||
46 | /* ignore error from controls - for debugging */ | 46 | /* ignore error from controls - for debugging */ |
47 | /* #define IGNORE_CTL_ERROR */ | 47 | /* #define IGNORE_CTL_ERROR */ |
48 | 48 | ||
49 | /* | ||
50 | * Sound Blaster remote control configuration | ||
51 | * | ||
52 | * format of remote control data: | ||
53 | * Extigy: xx 00 | ||
54 | * Audigy 2 NX: 06 80 xx 00 00 00 | ||
55 | * Live! 24-bit: 06 80 xx yy 22 83 | ||
56 | */ | ||
57 | static const struct rc_config { | ||
58 | u32 usb_id; | ||
59 | u8 offset; | ||
60 | u8 length; | ||
61 | u8 packet_length; | ||
62 | u8 mute_mixer_id; | ||
63 | u32 mute_code; | ||
64 | } rc_configs[] = { | ||
65 | { USB_ID(0x041e, 0x3000), 0, 1, 2, 18, 0x0013 }, /* Extigy */ | ||
66 | { USB_ID(0x041e, 0x3020), 2, 1, 6, 18, 0x0013 }, /* Audigy 2 NX */ | ||
67 | { USB_ID(0x041e, 0x3040), 2, 2, 6, 2, 0x6e91 }, /* Live! 24-bit */ | ||
68 | }; | ||
69 | |||
49 | struct usb_mixer_interface { | 70 | struct usb_mixer_interface { |
50 | struct snd_usb_audio *chip; | 71 | struct snd_usb_audio *chip; |
51 | unsigned int ctrlif; | 72 | unsigned int ctrlif; |
@@ -55,11 +76,7 @@ struct usb_mixer_interface { | |||
55 | struct usb_mixer_elem_info **id_elems; /* array[256], indexed by unit id */ | 76 | struct usb_mixer_elem_info **id_elems; /* array[256], indexed by unit id */ |
56 | 77 | ||
57 | /* Sound Blaster remote control stuff */ | 78 | /* Sound Blaster remote control stuff */ |
58 | enum { | 79 | const struct rc_config *rc_cfg; |
59 | RC_NONE, | ||
60 | RC_EXTIGY, | ||
61 | RC_AUDIGY2NX, | ||
62 | } rc_type; | ||
63 | unsigned long rc_hwdep_open; | 80 | unsigned long rc_hwdep_open; |
64 | u32 rc_code; | 81 | u32 rc_code; |
65 | wait_queue_head_t rc_waitq; | 82 | wait_queue_head_t rc_waitq; |
@@ -1647,7 +1664,7 @@ static void snd_usb_mixer_notify_id(struct usb_mixer_interface *mixer, | |||
1647 | static void snd_usb_mixer_memory_change(struct usb_mixer_interface *mixer, | 1664 | static void snd_usb_mixer_memory_change(struct usb_mixer_interface *mixer, |
1648 | int unitid) | 1665 | int unitid) |
1649 | { | 1666 | { |
1650 | if (mixer->rc_type == RC_NONE) | 1667 | if (!mixer->rc_cfg) |
1651 | return; | 1668 | return; |
1652 | /* unit ids specific to Extigy/Audigy 2 NX: */ | 1669 | /* unit ids specific to Extigy/Audigy 2 NX: */ |
1653 | switch (unitid) { | 1670 | switch (unitid) { |
@@ -1732,20 +1749,19 @@ static void snd_usb_soundblaster_remote_complete(struct urb *urb, | |||
1732 | struct pt_regs *regs) | 1749 | struct pt_regs *regs) |
1733 | { | 1750 | { |
1734 | struct usb_mixer_interface *mixer = urb->context; | 1751 | struct usb_mixer_interface *mixer = urb->context; |
1735 | /* | 1752 | const struct rc_config *rc = mixer->rc_cfg; |
1736 | * format of remote control data: | ||
1737 | * Extigy: xx 00 | ||
1738 | * Audigy 2 NX: 06 80 xx 00 00 00 | ||
1739 | */ | ||
1740 | int offset = mixer->rc_type == RC_EXTIGY ? 0 : 2; | ||
1741 | u32 code; | 1753 | u32 code; |
1742 | 1754 | ||
1743 | if (urb->status < 0 || urb->actual_length <= offset) | 1755 | if (urb->status < 0 || urb->actual_length < rc->packet_length) |
1744 | return; | 1756 | return; |
1745 | code = mixer->rc_buffer[offset]; | 1757 | |
1758 | code = mixer->rc_buffer[rc->offset]; | ||
1759 | if (rc->length == 2) | ||
1760 | code |= mixer->rc_buffer[rc->offset + 1] << 8; | ||
1761 | |||
1746 | /* the Mute button actually changes the mixer control */ | 1762 | /* the Mute button actually changes the mixer control */ |
1747 | if (code == 13) | 1763 | if (code == rc->mute_code) |
1748 | snd_usb_mixer_notify_id(mixer, 18); | 1764 | snd_usb_mixer_notify_id(mixer, rc->mute_mixer_id); |
1749 | mixer->rc_code = code; | 1765 | mixer->rc_code = code; |
1750 | wmb(); | 1766 | wmb(); |
1751 | wake_up(&mixer->rc_waitq); | 1767 | wake_up(&mixer->rc_waitq); |
@@ -1801,21 +1817,17 @@ static unsigned int snd_usb_sbrc_hwdep_poll(struct snd_hwdep *hw, struct file *f | |||
1801 | static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) | 1817 | static int snd_usb_soundblaster_remote_init(struct usb_mixer_interface *mixer) |
1802 | { | 1818 | { |
1803 | struct snd_hwdep *hwdep; | 1819 | struct snd_hwdep *hwdep; |
1804 | int err, len; | 1820 | int err, len, i; |
1805 | 1821 | ||
1806 | switch (mixer->chip->usb_id) { | 1822 | for (i = 0; i < ARRAY_SIZE(rc_configs); ++i) |
1807 | case USB_ID(0x041e, 0x3000): | 1823 | if (rc_configs[i].usb_id == mixer->chip->usb_id) |
1808 | mixer->rc_type = RC_EXTIGY; | 1824 | break; |
1809 | len = 2; | 1825 | if (i >= ARRAY_SIZE(rc_configs)) |
1810 | break; | ||
1811 | case USB_ID(0x041e, 0x3020): | ||
1812 | mixer->rc_type = RC_AUDIGY2NX; | ||
1813 | len = 6; | ||
1814 | break; | ||
1815 | default: | ||
1816 | return 0; | 1826 | return 0; |
1817 | } | 1827 | mixer->rc_cfg = &rc_configs[i]; |
1818 | 1828 | ||
1829 | len = mixer->rc_cfg->packet_length; | ||
1830 | |||
1819 | init_waitqueue_head(&mixer->rc_waitq); | 1831 | init_waitqueue_head(&mixer->rc_waitq); |
1820 | err = snd_hwdep_new(mixer->chip->card, "SB remote control", 0, &hwdep); | 1832 | err = snd_hwdep_new(mixer->chip->card, "SB remote control", 0, &hwdep); |
1821 | if (err < 0) | 1833 | if (err < 0) |
@@ -1998,7 +2010,7 @@ int snd_usb_create_mixer(struct snd_usb_audio *chip, int ctrlif) | |||
1998 | if ((err = snd_audigy2nx_controls_create(mixer)) < 0) | 2010 | if ((err = snd_audigy2nx_controls_create(mixer)) < 0) |
1999 | goto _error; | 2011 | goto _error; |
2000 | if (!snd_card_proc_new(chip->card, "audigy2nx", &entry)) | 2012 | if (!snd_card_proc_new(chip->card, "audigy2nx", &entry)) |
2001 | snd_info_set_text_ops(entry, mixer, 1024, | 2013 | snd_info_set_text_ops(entry, mixer, |
2002 | snd_audigy2nx_proc_read); | 2014 | snd_audigy2nx_proc_read); |
2003 | } | 2015 | } |
2004 | 2016 | ||
diff --git a/sound/usb/usx2y/usx2yhwdeppcm.c b/sound/usb/usx2y/usx2yhwdeppcm.c index fe67a92e2a..88b72b5259 100644 --- a/sound/usb/usx2y/usx2yhwdeppcm.c +++ b/sound/usb/usx2y/usx2yhwdeppcm.c | |||
@@ -632,7 +632,7 @@ static int usX2Y_pcms_lock_check(struct snd_card *card) | |||
632 | for (s = 0; s < 2; ++s) { | 632 | for (s = 0; s < 2; ++s) { |
633 | struct snd_pcm_substream *substream; | 633 | struct snd_pcm_substream *substream; |
634 | substream = pcm->streams[s].substream; | 634 | substream = pcm->streams[s].substream; |
635 | if (substream && substream->ffile != NULL) | 635 | if (SUBSTREAM_BUSY(substream)) |
636 | err = -EBUSY; | 636 | err = -EBUSY; |
637 | } | 637 | } |
638 | } | 638 | } |