Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 1 | /* |
| 2 | * TC Applied Technologies Digital Interface Communications Engine driver |
| 3 | * |
| 4 | * Copyright (c) Clemens Ladisch <clemens@ladisch.de> |
| 5 | * Licensed under the terms of the GNU General Public License, version 2. |
| 6 | */ |
| 7 | |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 8 | #include "dice.h" |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 9 | |
| 10 | MODULE_DESCRIPTION("DICE driver"); |
| 11 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
| 12 | MODULE_LICENSE("GPL v2"); |
| 13 | |
Clemens Ladisch | a471fcd | 2012-02-13 21:55:13 +0100 | [diff] [blame] | 14 | #define OUI_WEISS 0x001c6a |
Takashi Sakamoto | 5d5563b | 2015-11-14 16:42:04 +0900 | [diff] [blame] | 15 | #define OUI_LOUD 0x000ff2 |
Takashi Sakamoto | 7cafc65b | 2016-03-07 22:35:45 +0900 | [diff] [blame] | 16 | #define OUI_FOCUSRITE 0x00130e |
Takashi Sakamoto | 10412c4 | 2018-04-22 21:19:24 +0900 | [diff] [blame] | 17 | #define OUI_TCELECTRONIC 0x000166 |
Takashi Sakamoto | 28b208f | 2018-05-02 19:16:44 +0900 | [diff] [blame] | 18 | #define OUI_ALESIS 0x000595 |
Takashi Sakamoto | 58579c0 | 2018-05-02 19:16:45 +0900 | [diff] [blame] | 19 | #define OUI_MAUDIO 0x000d6c |
Melvin Vermeeren | 7c1543f | 2018-05-17 21:00:00 +0200 | [diff] [blame] | 20 | #define OUI_MYTEK 0x001ee8 |
Clemens Ladisch | a471fcd | 2012-02-13 21:55:13 +0100 | [diff] [blame] | 21 | |
| 22 | #define DICE_CATEGORY_ID 0x04 |
| 23 | #define WEISS_CATEGORY_ID 0x00 |
Takashi Sakamoto | 5d5563b | 2015-11-14 16:42:04 +0900 | [diff] [blame] | 24 | #define LOUD_CATEGORY_ID 0x10 |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 25 | |
Takashi Sakamoto | 28b208f | 2018-05-02 19:16:44 +0900 | [diff] [blame] | 26 | #define MODEL_ALESIS_IO_BOTH 0x000001 |
| 27 | |
Takashi Sakamoto | 4a47a87 | 2015-12-31 13:58:11 +0900 | [diff] [blame] | 28 | static int check_dice_category(struct fw_unit *unit) |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 29 | { |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 30 | struct fw_device *device = fw_parent_device(unit); |
| 31 | struct fw_csr_iterator it; |
Takashi Sakamoto | 4a47a87 | 2015-12-31 13:58:11 +0900 | [diff] [blame] | 32 | int key, val, vendor = -1, model = -1; |
| 33 | unsigned int category; |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 34 | |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 35 | /* |
| 36 | * Check that GUID and unit directory are constructed according to DICE |
| 37 | * rules, i.e., that the specifier ID is the GUID's OUI, and that the |
Clemens Ladisch | a471fcd | 2012-02-13 21:55:13 +0100 | [diff] [blame] | 38 | * GUID chip ID consists of the 8-bit category ID, the 10-bit product |
| 39 | * ID, and a 22-bit serial number. |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 40 | */ |
| 41 | fw_csr_iterator_init(&it, unit->directory); |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 42 | while (fw_csr_iterator_next(&it, &key, &val)) { |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 43 | switch (key) { |
| 44 | case CSR_SPECIFIER_ID: |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 45 | vendor = val; |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 46 | break; |
| 47 | case CSR_MODEL: |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 48 | model = val; |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 49 | break; |
| 50 | } |
| 51 | } |
Takashi Sakamoto | 7cafc65b | 2016-03-07 22:35:45 +0900 | [diff] [blame] | 52 | |
Clemens Ladisch | a471fcd | 2012-02-13 21:55:13 +0100 | [diff] [blame] | 53 | if (vendor == OUI_WEISS) |
| 54 | category = WEISS_CATEGORY_ID; |
Takashi Sakamoto | 5d5563b | 2015-11-14 16:42:04 +0900 | [diff] [blame] | 55 | else if (vendor == OUI_LOUD) |
| 56 | category = LOUD_CATEGORY_ID; |
Clemens Ladisch | a471fcd | 2012-02-13 21:55:13 +0100 | [diff] [blame] | 57 | else |
| 58 | category = DICE_CATEGORY_ID; |
| 59 | if (device->config_rom[3] != ((vendor << 8) | category) || |
Takashi Sakamoto | 4a47a87 | 2015-12-31 13:58:11 +0900 | [diff] [blame] | 60 | device->config_rom[4] >> 22 != model) |
| 61 | return -ENODEV; |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 62 | |
Takashi Sakamoto | 4a47a87 | 2015-12-31 13:58:11 +0900 | [diff] [blame] | 63 | return 0; |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 64 | } |
| 65 | |
Takashi Sakamoto | 6f68826 | 2016-02-08 22:54:19 +0900 | [diff] [blame] | 66 | static int check_clock_caps(struct snd_dice *dice) |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 67 | { |
Clemens Ladisch | a030199 | 2011-12-04 21:47:00 +0100 | [diff] [blame] | 68 | __be32 value; |
Takashi Sakamoto | 6f68826 | 2016-02-08 22:54:19 +0900 | [diff] [blame] | 69 | int err; |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 70 | |
Clemens Ladisch | a030199 | 2011-12-04 21:47:00 +0100 | [diff] [blame] | 71 | /* some very old firmwares don't tell about their clock support */ |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 72 | if (dice->clock_caps > 0) { |
| 73 | err = snd_dice_transaction_read_global(dice, |
| 74 | GLOBAL_CLOCK_CAPABILITIES, |
| 75 | &value, 4); |
Clemens Ladisch | a030199 | 2011-12-04 21:47:00 +0100 | [diff] [blame] | 76 | if (err < 0) |
| 77 | return err; |
| 78 | dice->clock_caps = be32_to_cpu(value); |
| 79 | } else { |
| 80 | /* this should be supported by any device */ |
| 81 | dice->clock_caps = CLOCK_CAP_RATE_44100 | |
| 82 | CLOCK_CAP_RATE_48000 | |
| 83 | CLOCK_CAP_SOURCE_ARX1 | |
| 84 | CLOCK_CAP_SOURCE_INTERNAL; |
| 85 | } |
| 86 | |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 87 | return 0; |
| 88 | } |
| 89 | |
Takashi Sakamoto | 732d153 | 2014-11-29 00:59:11 +0900 | [diff] [blame] | 90 | static void dice_card_strings(struct snd_dice *dice) |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 91 | { |
| 92 | struct snd_card *card = dice->card; |
| 93 | struct fw_device *dev = fw_parent_device(dice->unit); |
| 94 | char vendor[32], model[32]; |
| 95 | unsigned int i; |
| 96 | int err; |
| 97 | |
| 98 | strcpy(card->driver, "DICE"); |
| 99 | |
| 100 | strcpy(card->shortname, "DICE"); |
| 101 | BUILD_BUG_ON(NICK_NAME_SIZE < sizeof(card->shortname)); |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 102 | err = snd_dice_transaction_read_global(dice, GLOBAL_NICK_NAME, |
| 103 | card->shortname, |
| 104 | sizeof(card->shortname)); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 105 | if (err >= 0) { |
| 106 | /* DICE strings are returned in "always-wrong" endianness */ |
| 107 | BUILD_BUG_ON(sizeof(card->shortname) % 4 != 0); |
| 108 | for (i = 0; i < sizeof(card->shortname); i += 4) |
| 109 | swab32s((u32 *)&card->shortname[i]); |
| 110 | card->shortname[sizeof(card->shortname) - 1] = '\0'; |
| 111 | } |
| 112 | |
| 113 | strcpy(vendor, "?"); |
| 114 | fw_csr_string(dev->config_rom + 5, CSR_VENDOR, vendor, sizeof(vendor)); |
| 115 | strcpy(model, "?"); |
| 116 | fw_csr_string(dice->unit->directory, CSR_MODEL, model, sizeof(model)); |
| 117 | snprintf(card->longname, sizeof(card->longname), |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 118 | "%s %s (serial %u) at %s, S%d", |
| 119 | vendor, model, dev->config_rom[4] & 0x3fffff, |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 120 | dev_name(&dice->unit->device), 100 << dev->max_speed); |
| 121 | |
| 122 | strcpy(card->mixername, "DICE"); |
| 123 | } |
| 124 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 125 | static void dice_free(struct snd_dice *dice) |
| 126 | { |
| 127 | snd_dice_stream_destroy_duplex(dice); |
| 128 | snd_dice_transaction_destroy(dice); |
| 129 | fw_unit_put(dice->unit); |
| 130 | |
| 131 | mutex_destroy(&dice->mutex); |
| 132 | kfree(dice); |
| 133 | } |
| 134 | |
Takashi Sakamoto | 12ed719 | 2015-02-21 23:54:57 +0900 | [diff] [blame] | 135 | /* |
| 136 | * This module releases the FireWire unit data after all ALSA character devices |
| 137 | * are released by applications. This is for releasing stream data or finishing |
| 138 | * transactions safely. Thus at returning from .remove(), this module still keep |
| 139 | * references for the unit. |
| 140 | */ |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 141 | static void dice_card_free(struct snd_card *card) |
| 142 | { |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 143 | dice_free(card->private_data); |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 144 | } |
| 145 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 146 | static void do_registration(struct work_struct *work) |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 147 | { |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 148 | struct snd_dice *dice = container_of(work, struct snd_dice, dwork.work); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 149 | int err; |
| 150 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 151 | if (dice->registered) |
| 152 | return; |
| 153 | |
| 154 | err = snd_card_new(&dice->unit->device, -1, NULL, THIS_MODULE, 0, |
| 155 | &dice->card); |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 156 | if (err < 0) |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 157 | return; |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 158 | |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 159 | err = snd_dice_transaction_init(dice); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 160 | if (err < 0) |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 161 | goto error; |
Clemens Ladisch | 5ea4018 | 2011-12-05 22:09:42 +0100 | [diff] [blame] | 162 | |
Takashi Sakamoto | 6f68826 | 2016-02-08 22:54:19 +0900 | [diff] [blame] | 163 | err = check_clock_caps(dice); |
Clemens Ladisch | 5ea4018 | 2011-12-05 22:09:42 +0100 | [diff] [blame] | 164 | if (err < 0) |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 165 | goto error; |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 166 | |
| 167 | dice_card_strings(dice); |
| 168 | |
Takashi Sakamoto | f1f0f33 | 2018-05-02 19:16:43 +0900 | [diff] [blame] | 169 | err = dice->detect_formats(dice); |
Takashi Sakamoto | b60152f | 2018-05-02 19:16:42 +0900 | [diff] [blame] | 170 | if (err < 0) |
| 171 | goto error; |
| 172 | |
Takashi Sakamoto | 0eced45 | 2016-03-31 08:47:03 +0900 | [diff] [blame] | 173 | err = snd_dice_stream_init_duplex(dice); |
| 174 | if (err < 0) |
| 175 | goto error; |
| 176 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 177 | snd_dice_create_proc(dice); |
| 178 | |
Takashi Sakamoto | c50fb91 | 2014-11-29 00:59:15 +0900 | [diff] [blame] | 179 | err = snd_dice_create_pcm(dice); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 180 | if (err < 0) |
| 181 | goto error; |
| 182 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 183 | err = snd_dice_create_midi(dice); |
| 184 | if (err < 0) |
| 185 | goto error; |
| 186 | |
Takashi Sakamoto | 19af57b | 2014-11-29 00:59:16 +0900 | [diff] [blame] | 187 | err = snd_dice_create_hwdep(dice); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 188 | if (err < 0) |
| 189 | goto error; |
| 190 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 191 | err = snd_card_register(dice->card); |
Takashi Sakamoto | a113ff8 | 2014-12-09 00:10:39 +0900 | [diff] [blame] | 192 | if (err < 0) |
| 193 | goto error; |
| 194 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 195 | /* |
| 196 | * After registered, dice instance can be released corresponding to |
| 197 | * releasing the sound card instance. |
| 198 | */ |
| 199 | dice->card->private_free = dice_card_free; |
| 200 | dice->card->private_data = dice; |
| 201 | dice->registered = true; |
| 202 | |
| 203 | return; |
| 204 | error: |
Takashi Sakamoto | 0eced45 | 2016-03-31 08:47:03 +0900 | [diff] [blame] | 205 | snd_dice_stream_destroy_duplex(dice); |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 206 | snd_dice_transaction_destroy(dice); |
Takashi Sakamoto | 923f92e | 2016-03-31 08:47:04 +0900 | [diff] [blame] | 207 | snd_dice_stream_destroy_duplex(dice); |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 208 | snd_card_free(dice->card); |
| 209 | dev_info(&dice->unit->device, |
| 210 | "Sound card registration failed: %d\n", err); |
| 211 | } |
| 212 | |
Takashi Sakamoto | f1f0f33 | 2018-05-02 19:16:43 +0900 | [diff] [blame] | 213 | static int dice_probe(struct fw_unit *unit, |
| 214 | const struct ieee1394_device_id *entry) |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 215 | { |
| 216 | struct snd_dice *dice; |
| 217 | int err; |
| 218 | |
Takashi Sakamoto | f1f0f33 | 2018-05-02 19:16:43 +0900 | [diff] [blame] | 219 | if (!entry->driver_data) { |
| 220 | err = check_dice_category(unit); |
| 221 | if (err < 0) |
| 222 | return -ENODEV; |
| 223 | } |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 224 | |
| 225 | /* Allocate this independent of sound card instance. */ |
| 226 | dice = kzalloc(sizeof(struct snd_dice), GFP_KERNEL); |
| 227 | if (dice == NULL) |
| 228 | return -ENOMEM; |
| 229 | |
| 230 | dice->unit = fw_unit_get(unit); |
| 231 | dev_set_drvdata(&unit->device, dice); |
| 232 | |
Takashi Sakamoto | f1f0f33 | 2018-05-02 19:16:43 +0900 | [diff] [blame] | 233 | if (!entry->driver_data) { |
| 234 | dice->detect_formats = snd_dice_stream_detect_current_formats; |
| 235 | } else { |
| 236 | dice->detect_formats = |
| 237 | (snd_dice_detect_formats_t)entry->driver_data; |
| 238 | } |
| 239 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 240 | spin_lock_init(&dice->lock); |
| 241 | mutex_init(&dice->mutex); |
| 242 | init_completion(&dice->clock_accepted); |
| 243 | init_waitqueue_head(&dice->hwdep_wait); |
| 244 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 245 | /* Allocate and register this sound card later. */ |
| 246 | INIT_DEFERRABLE_WORK(&dice->dwork, do_registration); |
Takashi Sakamoto | 923f92e | 2016-03-31 08:47:04 +0900 | [diff] [blame] | 247 | snd_fw_schedule_registration(unit, &dice->dwork); |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 248 | |
| 249 | return 0; |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 250 | } |
| 251 | |
| 252 | static void dice_remove(struct fw_unit *unit) |
| 253 | { |
Takashi Sakamoto | 732d153 | 2014-11-29 00:59:11 +0900 | [diff] [blame] | 254 | struct snd_dice *dice = dev_get_drvdata(&unit->device); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 255 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 256 | /* |
| 257 | * Confirm to stop the work for registration before the sound card is |
| 258 | * going to be released. The work is not scheduled again because bus |
| 259 | * reset handler is not called anymore. |
| 260 | */ |
| 261 | cancel_delayed_work_sync(&dice->dwork); |
| 262 | |
| 263 | if (dice->registered) { |
| 264 | /* No need to wait for releasing card object in this context. */ |
| 265 | snd_card_free_when_closed(dice->card); |
| 266 | } else { |
| 267 | /* Don't forget this case. */ |
| 268 | dice_free(dice); |
| 269 | } |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 270 | } |
| 271 | |
| 272 | static void dice_bus_reset(struct fw_unit *unit) |
| 273 | { |
Takashi Sakamoto | 732d153 | 2014-11-29 00:59:11 +0900 | [diff] [blame] | 274 | struct snd_dice *dice = dev_get_drvdata(&unit->device); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 275 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 276 | /* Postpone a workqueue for deferred registration. */ |
| 277 | if (!dice->registered) |
Takashi Sakamoto | 923f92e | 2016-03-31 08:47:04 +0900 | [diff] [blame] | 278 | snd_fw_schedule_registration(unit, &dice->dwork); |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 279 | |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 280 | /* The handler address register becomes initialized. */ |
| 281 | snd_dice_transaction_reinit(dice); |
| 282 | |
Takashi Sakamoto | b59fb19 | 2015-12-31 13:58:12 +0900 | [diff] [blame] | 283 | /* |
| 284 | * After registration, userspace can start packet streaming, then this |
| 285 | * code block works fine. |
| 286 | */ |
| 287 | if (dice->registered) { |
| 288 | mutex_lock(&dice->mutex); |
| 289 | snd_dice_stream_update_duplex(dice); |
| 290 | mutex_unlock(&dice->mutex); |
| 291 | } |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 292 | } |
| 293 | |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 294 | #define DICE_INTERFACE 0x000001 |
| 295 | |
| 296 | static const struct ieee1394_device_id dice_id_table[] = { |
Takashi Sakamoto | 58579c0 | 2018-05-02 19:16:45 +0900 | [diff] [blame] | 297 | /* M-Audio Profire 2626 has a different value in version field. */ |
Takashi Sakamoto | f8ff65b | 2016-04-30 22:06:46 +0900 | [diff] [blame] | 298 | { |
| 299 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
Takashi Sakamoto | 58579c0 | 2018-05-02 19:16:45 +0900 | [diff] [blame] | 300 | IEEE1394_MATCH_MODEL_ID, |
| 301 | .vendor_id = OUI_MAUDIO, |
| 302 | .model_id = 0x000010, |
| 303 | .driver_data = (kernel_ulong_t)snd_dice_detect_extension_formats, |
| 304 | }, |
| 305 | /* M-Audio Profire 610 has a different value in version field. */ |
| 306 | { |
| 307 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 308 | IEEE1394_MATCH_MODEL_ID, |
| 309 | .vendor_id = OUI_MAUDIO, |
| 310 | .model_id = 0x000011, |
| 311 | .driver_data = (kernel_ulong_t)snd_dice_detect_extension_formats, |
Takashi Sakamoto | f8ff65b | 2016-04-30 22:06:46 +0900 | [diff] [blame] | 312 | }, |
Takashi Sakamoto | f1f0f33 | 2018-05-02 19:16:43 +0900 | [diff] [blame] | 313 | /* TC Electronic Konnekt 24D. */ |
| 314 | { |
| 315 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 316 | IEEE1394_MATCH_MODEL_ID, |
| 317 | .vendor_id = OUI_TCELECTRONIC, |
| 318 | .model_id = 0x000020, |
| 319 | .driver_data = (kernel_ulong_t)snd_dice_detect_tcelectronic_formats, |
| 320 | }, |
| 321 | /* TC Electronic Konnekt 8. */ |
| 322 | { |
| 323 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 324 | IEEE1394_MATCH_MODEL_ID, |
| 325 | .vendor_id = OUI_TCELECTRONIC, |
| 326 | .model_id = 0x000021, |
| 327 | .driver_data = (kernel_ulong_t)snd_dice_detect_tcelectronic_formats, |
| 328 | }, |
| 329 | /* TC Electronic Studio Konnekt 48. */ |
| 330 | { |
| 331 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 332 | IEEE1394_MATCH_MODEL_ID, |
| 333 | .vendor_id = OUI_TCELECTRONIC, |
| 334 | .model_id = 0x000022, |
| 335 | .driver_data = (kernel_ulong_t)snd_dice_detect_tcelectronic_formats, |
| 336 | }, |
| 337 | /* TC Electronic Konnekt Live. */ |
| 338 | { |
| 339 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 340 | IEEE1394_MATCH_MODEL_ID, |
| 341 | .vendor_id = OUI_TCELECTRONIC, |
| 342 | .model_id = 0x000023, |
| 343 | .driver_data = (kernel_ulong_t)snd_dice_detect_tcelectronic_formats, |
| 344 | }, |
| 345 | /* TC Electronic Desktop Konnekt 6. */ |
| 346 | { |
| 347 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 348 | IEEE1394_MATCH_MODEL_ID, |
| 349 | .vendor_id = OUI_TCELECTRONIC, |
| 350 | .model_id = 0x000024, |
| 351 | .driver_data = (kernel_ulong_t)snd_dice_detect_tcelectronic_formats, |
| 352 | }, |
| 353 | /* TC Electronic Impact Twin. */ |
| 354 | { |
| 355 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 356 | IEEE1394_MATCH_MODEL_ID, |
| 357 | .vendor_id = OUI_TCELECTRONIC, |
| 358 | .model_id = 0x000027, |
| 359 | .driver_data = (kernel_ulong_t)snd_dice_detect_tcelectronic_formats, |
| 360 | }, |
Takashi Sakamoto | d0aa590 | 2018-05-20 14:40:44 +0900 | [diff] [blame] | 361 | /* TC Electronic Digital Konnekt x32. */ |
| 362 | { |
| 363 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 364 | IEEE1394_MATCH_MODEL_ID, |
| 365 | .vendor_id = OUI_TCELECTRONIC, |
| 366 | .model_id = 0x000030, |
| 367 | .driver_data = (kernel_ulong_t)snd_dice_detect_tcelectronic_formats, |
| 368 | }, |
Takashi Sakamoto | 28b208f | 2018-05-02 19:16:44 +0900 | [diff] [blame] | 369 | /* Alesis iO14/iO26. */ |
| 370 | { |
| 371 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 372 | IEEE1394_MATCH_MODEL_ID, |
| 373 | .vendor_id = OUI_ALESIS, |
| 374 | .model_id = MODEL_ALESIS_IO_BOTH, |
| 375 | .driver_data = (kernel_ulong_t)snd_dice_detect_alesis_formats, |
| 376 | }, |
Melvin Vermeeren | 7c1543f | 2018-05-17 21:00:00 +0200 | [diff] [blame] | 377 | /* Mytek Stereo 192 DSD-DAC. */ |
| 378 | { |
| 379 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 380 | IEEE1394_MATCH_MODEL_ID, |
| 381 | .vendor_id = OUI_MYTEK, |
| 382 | .model_id = 0x000002, |
| 383 | .driver_data = (kernel_ulong_t)snd_dice_detect_mytek_formats, |
| 384 | }, |
Takashi Sakamoto | f1f0f33 | 2018-05-02 19:16:43 +0900 | [diff] [blame] | 385 | { |
| 386 | .match_flags = IEEE1394_MATCH_VERSION, |
| 387 | .version = DICE_INTERFACE, |
| 388 | }, |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 389 | { } |
| 390 | }; |
| 391 | MODULE_DEVICE_TABLE(ieee1394, dice_id_table); |
| 392 | |
| 393 | static struct fw_driver dice_driver = { |
| 394 | .driver = { |
| 395 | .owner = THIS_MODULE, |
| 396 | .name = KBUILD_MODNAME, |
| 397 | .bus = &fw_bus_type, |
| 398 | }, |
| 399 | .probe = dice_probe, |
| 400 | .update = dice_bus_reset, |
| 401 | .remove = dice_remove, |
| 402 | .id_table = dice_id_table, |
| 403 | }; |
| 404 | |
| 405 | static int __init alsa_dice_init(void) |
| 406 | { |
| 407 | return driver_register(&dice_driver.driver); |
| 408 | } |
| 409 | |
| 410 | static void __exit alsa_dice_exit(void) |
| 411 | { |
| 412 | driver_unregister(&dice_driver.driver); |
| 413 | } |
| 414 | |
| 415 | module_init(alsa_dice_init); |
| 416 | module_exit(alsa_dice_exit); |