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 |
Clemens Ladisch | a471fcd | 2012-02-13 21:55:13 +0100 | [diff] [blame] | 16 | |
| 17 | #define DICE_CATEGORY_ID 0x04 |
| 18 | #define WEISS_CATEGORY_ID 0x00 |
Takashi Sakamoto | 5d5563b | 2015-11-14 16:42:04 +0900 | [diff] [blame] | 19 | #define LOUD_CATEGORY_ID 0x10 |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 20 | |
Takashi Sakamoto | 4a47a87 | 2015-12-31 13:58:11 +0900 | [diff] [blame^] | 21 | static int check_dice_category(struct fw_unit *unit) |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 22 | { |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 23 | struct fw_device *device = fw_parent_device(unit); |
| 24 | struct fw_csr_iterator it; |
Takashi Sakamoto | 4a47a87 | 2015-12-31 13:58:11 +0900 | [diff] [blame^] | 25 | int key, val, vendor = -1, model = -1; |
| 26 | unsigned int category; |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 27 | |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 28 | /* |
| 29 | * Check that GUID and unit directory are constructed according to DICE |
| 30 | * 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] | 31 | * GUID chip ID consists of the 8-bit category ID, the 10-bit product |
| 32 | * ID, and a 22-bit serial number. |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 33 | */ |
| 34 | fw_csr_iterator_init(&it, unit->directory); |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 35 | while (fw_csr_iterator_next(&it, &key, &val)) { |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 36 | switch (key) { |
| 37 | case CSR_SPECIFIER_ID: |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 38 | vendor = val; |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 39 | break; |
| 40 | case CSR_MODEL: |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 41 | model = val; |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 42 | break; |
| 43 | } |
| 44 | } |
Clemens Ladisch | a471fcd | 2012-02-13 21:55:13 +0100 | [diff] [blame] | 45 | if (vendor == OUI_WEISS) |
| 46 | category = WEISS_CATEGORY_ID; |
Takashi Sakamoto | 5d5563b | 2015-11-14 16:42:04 +0900 | [diff] [blame] | 47 | else if (vendor == OUI_LOUD) |
| 48 | category = LOUD_CATEGORY_ID; |
Clemens Ladisch | a471fcd | 2012-02-13 21:55:13 +0100 | [diff] [blame] | 49 | else |
| 50 | category = DICE_CATEGORY_ID; |
| 51 | if (device->config_rom[3] != ((vendor << 8) | category) || |
Takashi Sakamoto | 4a47a87 | 2015-12-31 13:58:11 +0900 | [diff] [blame^] | 52 | device->config_rom[4] >> 22 != model) |
| 53 | return -ENODEV; |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 54 | |
Takashi Sakamoto | 4a47a87 | 2015-12-31 13:58:11 +0900 | [diff] [blame^] | 55 | return 0; |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 56 | } |
| 57 | |
Takashi Sakamoto | 6eb6c81 | 2014-11-29 00:59:14 +0900 | [diff] [blame] | 58 | static int highest_supported_mode_rate(struct snd_dice *dice, |
| 59 | unsigned int mode, unsigned int *rate) |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 60 | { |
Takashi Sakamoto | 6eb6c81 | 2014-11-29 00:59:14 +0900 | [diff] [blame] | 61 | unsigned int i, m; |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 62 | |
Takashi Sakamoto | 6eb6c81 | 2014-11-29 00:59:14 +0900 | [diff] [blame] | 63 | for (i = ARRAY_SIZE(snd_dice_rates); i > 0; i--) { |
| 64 | *rate = snd_dice_rates[i - 1]; |
| 65 | if (snd_dice_stream_get_rate_mode(dice, *rate, &m) < 0) |
| 66 | continue; |
| 67 | if (mode == m) |
| 68 | break; |
| 69 | } |
| 70 | if (i == 0) |
| 71 | return -EINVAL; |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 72 | |
Takashi Sakamoto | 6eb6c81 | 2014-11-29 00:59:14 +0900 | [diff] [blame] | 73 | return 0; |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 74 | } |
| 75 | |
Takashi Sakamoto | 732d153 | 2014-11-29 00:59:11 +0900 | [diff] [blame] | 76 | static int dice_read_mode_params(struct snd_dice *dice, unsigned int mode) |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 77 | { |
| 78 | __be32 values[2]; |
Takashi Sakamoto | 6eb6c81 | 2014-11-29 00:59:14 +0900 | [diff] [blame] | 79 | unsigned int rate; |
| 80 | int err; |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 81 | |
Takashi Sakamoto | 6eb6c81 | 2014-11-29 00:59:14 +0900 | [diff] [blame] | 82 | if (highest_supported_mode_rate(dice, mode, &rate) < 0) { |
Takashi Sakamoto | 9a02843 | 2014-12-09 00:10:36 +0900 | [diff] [blame] | 83 | dice->tx_channels[mode] = 0; |
| 84 | dice->tx_midi_ports[mode] = 0; |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 85 | dice->rx_channels[mode] = 0; |
| 86 | dice->rx_midi_ports[mode] = 0; |
| 87 | return 0; |
| 88 | } |
| 89 | |
Takashi Sakamoto | 6eb6c81 | 2014-11-29 00:59:14 +0900 | [diff] [blame] | 90 | err = snd_dice_transaction_set_rate(dice, rate); |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 91 | if (err < 0) |
| 92 | return err; |
| 93 | |
Takashi Sakamoto | 9a02843 | 2014-12-09 00:10:36 +0900 | [diff] [blame] | 94 | err = snd_dice_transaction_read_tx(dice, TX_NUMBER_AUDIO, |
| 95 | values, sizeof(values)); |
| 96 | if (err < 0) |
| 97 | return err; |
| 98 | |
| 99 | dice->tx_channels[mode] = be32_to_cpu(values[0]); |
| 100 | dice->tx_midi_ports[mode] = be32_to_cpu(values[1]); |
| 101 | |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 102 | err = snd_dice_transaction_read_rx(dice, RX_NUMBER_AUDIO, |
| 103 | values, sizeof(values)); |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 104 | if (err < 0) |
| 105 | return err; |
| 106 | |
| 107 | dice->rx_channels[mode] = be32_to_cpu(values[0]); |
| 108 | dice->rx_midi_ports[mode] = be32_to_cpu(values[1]); |
| 109 | |
| 110 | return 0; |
| 111 | } |
| 112 | |
Takashi Sakamoto | 732d153 | 2014-11-29 00:59:11 +0900 | [diff] [blame] | 113 | static int dice_read_params(struct snd_dice *dice) |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 114 | { |
Clemens Ladisch | a030199 | 2011-12-04 21:47:00 +0100 | [diff] [blame] | 115 | __be32 value; |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 116 | int mode, err; |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 117 | |
Clemens Ladisch | a030199 | 2011-12-04 21:47:00 +0100 | [diff] [blame] | 118 | /* some very old firmwares don't tell about their clock support */ |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 119 | if (dice->clock_caps > 0) { |
| 120 | err = snd_dice_transaction_read_global(dice, |
| 121 | GLOBAL_CLOCK_CAPABILITIES, |
| 122 | &value, 4); |
Clemens Ladisch | a030199 | 2011-12-04 21:47:00 +0100 | [diff] [blame] | 123 | if (err < 0) |
| 124 | return err; |
| 125 | dice->clock_caps = be32_to_cpu(value); |
| 126 | } else { |
| 127 | /* this should be supported by any device */ |
| 128 | dice->clock_caps = CLOCK_CAP_RATE_44100 | |
| 129 | CLOCK_CAP_RATE_48000 | |
| 130 | CLOCK_CAP_SOURCE_ARX1 | |
| 131 | CLOCK_CAP_SOURCE_INTERNAL; |
| 132 | } |
| 133 | |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 134 | for (mode = 2; mode >= 0; --mode) { |
| 135 | err = dice_read_mode_params(dice, mode); |
| 136 | if (err < 0) |
| 137 | return err; |
| 138 | } |
| 139 | |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 140 | return 0; |
| 141 | } |
| 142 | |
Takashi Sakamoto | 732d153 | 2014-11-29 00:59:11 +0900 | [diff] [blame] | 143 | static void dice_card_strings(struct snd_dice *dice) |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 144 | { |
| 145 | struct snd_card *card = dice->card; |
| 146 | struct fw_device *dev = fw_parent_device(dice->unit); |
| 147 | char vendor[32], model[32]; |
| 148 | unsigned int i; |
| 149 | int err; |
| 150 | |
| 151 | strcpy(card->driver, "DICE"); |
| 152 | |
| 153 | strcpy(card->shortname, "DICE"); |
| 154 | BUILD_BUG_ON(NICK_NAME_SIZE < sizeof(card->shortname)); |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 155 | err = snd_dice_transaction_read_global(dice, GLOBAL_NICK_NAME, |
| 156 | card->shortname, |
| 157 | sizeof(card->shortname)); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 158 | if (err >= 0) { |
| 159 | /* DICE strings are returned in "always-wrong" endianness */ |
| 160 | BUILD_BUG_ON(sizeof(card->shortname) % 4 != 0); |
| 161 | for (i = 0; i < sizeof(card->shortname); i += 4) |
| 162 | swab32s((u32 *)&card->shortname[i]); |
| 163 | card->shortname[sizeof(card->shortname) - 1] = '\0'; |
| 164 | } |
| 165 | |
| 166 | strcpy(vendor, "?"); |
| 167 | fw_csr_string(dev->config_rom + 5, CSR_VENDOR, vendor, sizeof(vendor)); |
| 168 | strcpy(model, "?"); |
| 169 | fw_csr_string(dice->unit->directory, CSR_MODEL, model, sizeof(model)); |
| 170 | snprintf(card->longname, sizeof(card->longname), |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 171 | "%s %s (serial %u) at %s, S%d", |
| 172 | vendor, model, dev->config_rom[4] & 0x3fffff, |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 173 | dev_name(&dice->unit->device), 100 << dev->max_speed); |
| 174 | |
| 175 | strcpy(card->mixername, "DICE"); |
| 176 | } |
| 177 | |
Takashi Sakamoto | 12ed719 | 2015-02-21 23:54:57 +0900 | [diff] [blame] | 178 | /* |
| 179 | * This module releases the FireWire unit data after all ALSA character devices |
| 180 | * are released by applications. This is for releasing stream data or finishing |
| 181 | * transactions safely. Thus at returning from .remove(), this module still keep |
| 182 | * references for the unit. |
| 183 | */ |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 184 | static void dice_card_free(struct snd_card *card) |
| 185 | { |
| 186 | struct snd_dice *dice = card->private_data; |
| 187 | |
Takashi Sakamoto | dec8431 | 2015-02-21 23:55:00 +0900 | [diff] [blame] | 188 | snd_dice_stream_destroy_duplex(dice); |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 189 | snd_dice_transaction_destroy(dice); |
Takashi Sakamoto | 12ed719 | 2015-02-21 23:54:57 +0900 | [diff] [blame] | 190 | fw_unit_put(dice->unit); |
| 191 | |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 192 | mutex_destroy(&dice->mutex); |
| 193 | } |
| 194 | |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 195 | static int dice_probe(struct fw_unit *unit, const struct ieee1394_device_id *id) |
| 196 | { |
| 197 | struct snd_card *card; |
Takashi Sakamoto | 732d153 | 2014-11-29 00:59:11 +0900 | [diff] [blame] | 198 | struct snd_dice *dice; |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 199 | int err; |
| 200 | |
Takashi Sakamoto | 4a47a87 | 2015-12-31 13:58:11 +0900 | [diff] [blame^] | 201 | err = check_dice_category(unit); |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 202 | if (err < 0) |
Takashi Sakamoto | 4a47a87 | 2015-12-31 13:58:11 +0900 | [diff] [blame^] | 203 | return -ENODEV; |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 204 | |
Takashi Iwai | 06b45f0 | 2014-01-29 14:23:55 +0100 | [diff] [blame] | 205 | err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE, |
| 206 | sizeof(*dice), &card); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 207 | if (err < 0) |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 208 | goto end; |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 209 | |
| 210 | dice = card->private_data; |
| 211 | dice->card = card; |
Takashi Sakamoto | 12ed719 | 2015-02-21 23:54:57 +0900 | [diff] [blame] | 212 | dice->unit = fw_unit_get(unit); |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 213 | card->private_free = dice_card_free; |
| 214 | |
Clemens Ladisch | 0c29c91 | 2011-09-04 22:14:15 +0200 | [diff] [blame] | 215 | spin_lock_init(&dice->lock); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 216 | mutex_init(&dice->mutex); |
Clemens Ladisch | 15a75c8 | 2011-12-04 22:23:59 +0100 | [diff] [blame] | 217 | init_completion(&dice->clock_accepted); |
Clemens Ladisch | 0c29c91 | 2011-09-04 22:14:15 +0200 | [diff] [blame] | 218 | init_waitqueue_head(&dice->hwdep_wait); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 219 | |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 220 | err = snd_dice_transaction_init(dice); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 221 | if (err < 0) |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 222 | goto error; |
Clemens Ladisch | 5ea4018 | 2011-12-05 22:09:42 +0100 | [diff] [blame] | 223 | |
| 224 | err = dice_read_params(dice); |
| 225 | if (err < 0) |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 226 | goto error; |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 227 | |
| 228 | dice_card_strings(dice); |
| 229 | |
Takashi Sakamoto | c50fb91 | 2014-11-29 00:59:15 +0900 | [diff] [blame] | 230 | err = snd_dice_create_pcm(dice); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 231 | if (err < 0) |
| 232 | goto error; |
| 233 | |
Takashi Sakamoto | 19af57b | 2014-11-29 00:59:16 +0900 | [diff] [blame] | 234 | err = snd_dice_create_hwdep(dice); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 235 | if (err < 0) |
| 236 | goto error; |
| 237 | |
Takashi Sakamoto | 04d426a | 2014-11-29 00:59:17 +0900 | [diff] [blame] | 238 | snd_dice_create_proc(dice); |
Clemens Ladisch | c614475 | 2012-01-05 22:36:08 +0100 | [diff] [blame] | 239 | |
Takashi Sakamoto | a113ff8 | 2014-12-09 00:10:39 +0900 | [diff] [blame] | 240 | err = snd_dice_create_midi(dice); |
| 241 | if (err < 0) |
| 242 | goto error; |
| 243 | |
Takashi Sakamoto | 9a02843 | 2014-12-09 00:10:36 +0900 | [diff] [blame] | 244 | err = snd_dice_stream_init_duplex(dice); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 245 | if (err < 0) |
| 246 | goto error; |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 247 | |
| 248 | err = snd_card_register(card); |
| 249 | if (err < 0) { |
Takashi Sakamoto | 9a02843 | 2014-12-09 00:10:36 +0900 | [diff] [blame] | 250 | snd_dice_stream_destroy_duplex(dice); |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 251 | goto error; |
| 252 | } |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 253 | |
| 254 | dev_set_drvdata(&unit->device, dice); |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 255 | end: |
| 256 | return err; |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 257 | error: |
| 258 | snd_card_free(card); |
| 259 | return err; |
| 260 | } |
| 261 | |
| 262 | static void dice_remove(struct fw_unit *unit) |
| 263 | { |
Takashi Sakamoto | 732d153 | 2014-11-29 00:59:11 +0900 | [diff] [blame] | 264 | struct snd_dice *dice = dev_get_drvdata(&unit->device); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 265 | |
Takashi Sakamoto | 12ed719 | 2015-02-21 23:54:57 +0900 | [diff] [blame] | 266 | /* No need to wait for releasing card object in this context. */ |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 267 | snd_card_free_when_closed(dice->card); |
| 268 | } |
| 269 | |
| 270 | static void dice_bus_reset(struct fw_unit *unit) |
| 271 | { |
Takashi Sakamoto | 732d153 | 2014-11-29 00:59:11 +0900 | [diff] [blame] | 272 | struct snd_dice *dice = dev_get_drvdata(&unit->device); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 273 | |
Takashi Sakamoto | 7c2d4c0c | 2014-11-29 00:59:13 +0900 | [diff] [blame] | 274 | /* The handler address register becomes initialized. */ |
| 275 | snd_dice_transaction_reinit(dice); |
| 276 | |
Stefan Richter | a8c558f | 2011-08-27 20:05:15 +0200 | [diff] [blame] | 277 | mutex_lock(&dice->mutex); |
Takashi Sakamoto | 9a02843 | 2014-12-09 00:10:36 +0900 | [diff] [blame] | 278 | snd_dice_stream_update_duplex(dice); |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 279 | mutex_unlock(&dice->mutex); |
| 280 | } |
| 281 | |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 282 | #define DICE_INTERFACE 0x000001 |
| 283 | |
| 284 | static const struct ieee1394_device_id dice_id_table[] = { |
| 285 | { |
Clemens Ladisch | cbab328 | 2011-09-04 22:16:02 +0200 | [diff] [blame] | 286 | .match_flags = IEEE1394_MATCH_VERSION, |
| 287 | .version = DICE_INTERFACE, |
Clemens Ladisch | 82fbb4f | 2011-09-04 22:04:49 +0200 | [diff] [blame] | 288 | }, |
| 289 | { } |
| 290 | }; |
| 291 | MODULE_DEVICE_TABLE(ieee1394, dice_id_table); |
| 292 | |
| 293 | static struct fw_driver dice_driver = { |
| 294 | .driver = { |
| 295 | .owner = THIS_MODULE, |
| 296 | .name = KBUILD_MODNAME, |
| 297 | .bus = &fw_bus_type, |
| 298 | }, |
| 299 | .probe = dice_probe, |
| 300 | .update = dice_bus_reset, |
| 301 | .remove = dice_remove, |
| 302 | .id_table = dice_id_table, |
| 303 | }; |
| 304 | |
| 305 | static int __init alsa_dice_init(void) |
| 306 | { |
| 307 | return driver_register(&dice_driver.driver); |
| 308 | } |
| 309 | |
| 310 | static void __exit alsa_dice_exit(void) |
| 311 | { |
| 312 | driver_unregister(&dice_driver.driver); |
| 313 | } |
| 314 | |
| 315 | module_init(alsa_dice_init); |
| 316 | module_exit(alsa_dice_exit); |