Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 1 | /* |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 2 | * oxfw.c - a part of driver for OXFW970/971 based devices |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 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 | e2786ca | 2014-11-29 00:59:27 +0900 | [diff] [blame] | 8 | #include "oxfw.h" |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 9 | |
| 10 | #define OXFORD_FIRMWARE_ID_ADDRESS (CSR_REGISTER_BASE + 0x50000) |
| 11 | /* 0x970?vvvv or 0x971?vvvv, where vvvv = firmware version */ |
| 12 | |
| 13 | #define OXFORD_HARDWARE_ID_ADDRESS (CSR_REGISTER_BASE + 0x90020) |
| 14 | #define OXFORD_HARDWARE_ID_OXFW970 0x39443841 |
| 15 | #define OXFORD_HARDWARE_ID_OXFW971 0x39373100 |
| 16 | |
Takashi Sakamoto | ec4dba5 | 2014-12-09 00:10:45 +0900 | [diff] [blame] | 17 | #define VENDOR_LOUD 0x000ff2 |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 18 | #define VENDOR_GRIFFIN 0x001292 |
Takashi Sakamoto | ec4dba5 | 2014-12-09 00:10:45 +0900 | [diff] [blame] | 19 | #define VENDOR_BEHRINGER 0x001564 |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 20 | #define VENDOR_LACIE 0x00d04b |
Takashi Sakamoto | 759a2f4 | 2015-10-18 17:09:40 +0900 | [diff] [blame] | 21 | #define VENDOR_TASCAM 0x00022e |
Takashi Sakamoto | 9e2004f | 2015-12-22 09:15:45 +0900 | [diff] [blame] | 22 | #define OUI_STANTON 0x001260 |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 23 | |
Takashi Sakamoto | 13f3a46 | 2015-09-20 21:18:55 +0900 | [diff] [blame] | 24 | #define MODEL_SATELLITE 0x00200f |
| 25 | |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 26 | #define SPECIFIER_1394TA 0x00a02d |
| 27 | #define VERSION_AVC 0x010001 |
| 28 | |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 29 | MODULE_DESCRIPTION("Oxford Semiconductor FW970/971 driver"); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 30 | MODULE_AUTHOR("Clemens Ladisch <clemens@ladisch.de>"); |
| 31 | MODULE_LICENSE("GPL v2"); |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 32 | MODULE_ALIAS("snd-firewire-speakers"); |
Takashi Sakamoto | 9e2004f | 2015-12-22 09:15:45 +0900 | [diff] [blame] | 33 | MODULE_ALIAS("snd-scs1x"); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 34 | |
Takashi Sakamoto | d6ce6bb | 2015-12-16 20:37:57 +0900 | [diff] [blame] | 35 | struct compat_info { |
| 36 | const char *driver_name; |
| 37 | const char *vendor_name; |
| 38 | const char *model_name; |
| 39 | }; |
| 40 | |
Takashi Sakamoto | ec4dba5 | 2014-12-09 00:10:45 +0900 | [diff] [blame] | 41 | static bool detect_loud_models(struct fw_unit *unit) |
| 42 | { |
| 43 | const char *const models[] = { |
| 44 | "Onyxi", |
| 45 | "Onyx-i", |
| 46 | "d.Pro", |
| 47 | "Mackie Onyx Satellite", |
| 48 | "Tapco LINK.firewire 4x6", |
| 49 | "U.420"}; |
| 50 | char model[32]; |
| 51 | unsigned int i; |
| 52 | int err; |
| 53 | |
| 54 | err = fw_csr_string(unit->directory, CSR_MODEL, |
| 55 | model, sizeof(model)); |
| 56 | if (err < 0) |
Dan Carpenter | 0d3aba3 | 2014-12-12 22:28:10 +0300 | [diff] [blame] | 57 | return false; |
Takashi Sakamoto | ec4dba5 | 2014-12-09 00:10:45 +0900 | [diff] [blame] | 58 | |
| 59 | for (i = 0; i < ARRAY_SIZE(models); i++) { |
| 60 | if (strcmp(models[i], model) == 0) |
| 61 | break; |
| 62 | } |
| 63 | |
| 64 | return (i < ARRAY_SIZE(models)); |
| 65 | } |
| 66 | |
Takashi Sakamoto | fec7b75 | 2014-12-09 00:10:40 +0900 | [diff] [blame] | 67 | static int name_card(struct snd_oxfw *oxfw) |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 68 | { |
Takashi Sakamoto | fec7b75 | 2014-12-09 00:10:40 +0900 | [diff] [blame] | 69 | struct fw_device *fw_dev = fw_parent_device(oxfw->unit); |
Takashi Sakamoto | d6ce6bb | 2015-12-16 20:37:57 +0900 | [diff] [blame] | 70 | const struct compat_info *info; |
Takashi Sakamoto | ec4dba5 | 2014-12-09 00:10:45 +0900 | [diff] [blame] | 71 | char vendor[24]; |
| 72 | char model[32]; |
Takashi Sakamoto | fec7b75 | 2014-12-09 00:10:40 +0900 | [diff] [blame] | 73 | const char *d, *v, *m; |
| 74 | u32 firmware; |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 75 | int err; |
| 76 | |
Takashi Sakamoto | ec4dba5 | 2014-12-09 00:10:45 +0900 | [diff] [blame] | 77 | /* get vendor name from root directory */ |
| 78 | err = fw_csr_string(fw_dev->config_rom + 5, CSR_VENDOR, |
| 79 | vendor, sizeof(vendor)); |
| 80 | if (err < 0) |
| 81 | goto end; |
| 82 | |
| 83 | /* get model name from unit directory */ |
| 84 | err = fw_csr_string(oxfw->unit->directory, CSR_MODEL, |
| 85 | model, sizeof(model)); |
| 86 | if (err < 0) |
| 87 | goto end; |
| 88 | |
Takashi Sakamoto | fec7b75 | 2014-12-09 00:10:40 +0900 | [diff] [blame] | 89 | err = snd_fw_transaction(oxfw->unit, TCODE_READ_QUADLET_REQUEST, |
| 90 | OXFORD_FIRMWARE_ID_ADDRESS, &firmware, 4, 0); |
| 91 | if (err < 0) |
| 92 | goto end; |
| 93 | be32_to_cpus(&firmware); |
| 94 | |
Takashi Sakamoto | ec4dba5 | 2014-12-09 00:10:45 +0900 | [diff] [blame] | 95 | /* to apply card definitions */ |
Takashi Sakamoto | 27e6663 | 2015-12-15 23:56:20 +0900 | [diff] [blame] | 96 | if (oxfw->entry->vendor_id == VENDOR_GRIFFIN || |
| 97 | oxfw->entry->vendor_id == VENDOR_LACIE) { |
Takashi Sakamoto | d6ce6bb | 2015-12-16 20:37:57 +0900 | [diff] [blame] | 98 | info = (const struct compat_info *)oxfw->entry->driver_data; |
Takashi Sakamoto | 27e6663 | 2015-12-15 23:56:20 +0900 | [diff] [blame] | 99 | d = info->driver_name; |
| 100 | v = info->vendor_name; |
| 101 | m = info->model_name; |
Takashi Sakamoto | ec4dba5 | 2014-12-09 00:10:45 +0900 | [diff] [blame] | 102 | } else { |
| 103 | d = "OXFW"; |
| 104 | v = vendor; |
| 105 | m = model; |
| 106 | } |
Takashi Sakamoto | fec7b75 | 2014-12-09 00:10:40 +0900 | [diff] [blame] | 107 | |
| 108 | strcpy(oxfw->card->driver, d); |
| 109 | strcpy(oxfw->card->mixername, m); |
| 110 | strcpy(oxfw->card->shortname, m); |
| 111 | |
| 112 | snprintf(oxfw->card->longname, sizeof(oxfw->card->longname), |
| 113 | "%s %s (OXFW%x %04x), GUID %08x%08x at %s, S%d", |
| 114 | v, m, firmware >> 20, firmware & 0xffff, |
| 115 | fw_dev->config_rom[3], fw_dev->config_rom[4], |
| 116 | dev_name(&oxfw->unit->device), 100 << fw_dev->max_speed); |
| 117 | end: |
| 118 | return err; |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 119 | } |
| 120 | |
Takashi Sakamoto | 12ed719 | 2015-02-21 23:54:57 +0900 | [diff] [blame] | 121 | /* |
| 122 | * This module releases the FireWire unit data after all ALSA character devices |
| 123 | * are released by applications. This is for releasing stream data or finishing |
| 124 | * transactions safely. Thus at returning from .remove(), this module still keep |
| 125 | * references for the unit. |
| 126 | */ |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 127 | static void oxfw_card_free(struct snd_card *card) |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 128 | { |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 129 | struct snd_oxfw *oxfw = card->private_data; |
Takashi Sakamoto | 5cd1d3f | 2014-12-09 00:10:42 +0900 | [diff] [blame] | 130 | unsigned int i; |
| 131 | |
Takashi Sakamoto | dec8431 | 2015-02-21 23:55:00 +0900 | [diff] [blame] | 132 | snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream); |
| 133 | if (oxfw->has_output) |
| 134 | snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream); |
| 135 | |
Takashi Sakamoto | 12ed719 | 2015-02-21 23:54:57 +0900 | [diff] [blame] | 136 | fw_unit_put(oxfw->unit); |
| 137 | |
Takashi Sakamoto | b0ac000 | 2014-12-09 00:10:46 +0900 | [diff] [blame] | 138 | for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) { |
| 139 | kfree(oxfw->tx_stream_formats[i]); |
Takashi Sakamoto | 5cd1d3f | 2014-12-09 00:10:42 +0900 | [diff] [blame] | 140 | kfree(oxfw->rx_stream_formats[i]); |
Takashi Sakamoto | b0ac000 | 2014-12-09 00:10:46 +0900 | [diff] [blame] | 141 | } |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 142 | |
Takashi Sakamoto | c582cc6 | 2015-12-16 20:37:54 +0900 | [diff] [blame] | 143 | kfree(oxfw->spec); |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 144 | mutex_destroy(&oxfw->mutex); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 145 | } |
| 146 | |
Takashi Sakamoto | 5ce8cc4 | 2015-12-15 23:56:21 +0900 | [diff] [blame] | 147 | static int detect_quirks(struct snd_oxfw *oxfw) |
Takashi Sakamoto | 13f3a46 | 2015-09-20 21:18:55 +0900 | [diff] [blame] | 148 | { |
| 149 | struct fw_device *fw_dev = fw_parent_device(oxfw->unit); |
| 150 | struct fw_csr_iterator it; |
| 151 | int key, val; |
| 152 | int vendor, model; |
| 153 | |
Takashi Sakamoto | 27e6663 | 2015-12-15 23:56:20 +0900 | [diff] [blame] | 154 | /* |
Takashi Sakamoto | 5ce8cc4 | 2015-12-15 23:56:21 +0900 | [diff] [blame] | 155 | * Add ALSA control elements for two models to keep compatibility to |
| 156 | * old firewire-speaker module. |
| 157 | */ |
Takashi Sakamoto | 3e2f457 | 2015-12-16 20:37:56 +0900 | [diff] [blame] | 158 | if (oxfw->entry->vendor_id == VENDOR_GRIFFIN) |
| 159 | return snd_oxfw_add_spkr(oxfw, false); |
| 160 | if (oxfw->entry->vendor_id == VENDOR_LACIE) |
| 161 | return snd_oxfw_add_spkr(oxfw, true); |
Takashi Sakamoto | 5ce8cc4 | 2015-12-15 23:56:21 +0900 | [diff] [blame] | 162 | |
| 163 | /* |
Takashi Sakamoto | 9e2004f | 2015-12-22 09:15:45 +0900 | [diff] [blame] | 164 | * Stanton models supports asynchronous transactions for unique MIDI |
| 165 | * messages. |
| 166 | */ |
Takashi Sakamoto | de5126c | 2015-12-22 09:15:46 +0900 | [diff] [blame^] | 167 | if (oxfw->entry->vendor_id == OUI_STANTON) { |
| 168 | /* No physical MIDI ports. */ |
| 169 | oxfw->midi_input_ports = 0; |
| 170 | oxfw->midi_output_ports = 0; |
| 171 | |
| 172 | /* Output stream exists but no data channels are useful. */ |
| 173 | oxfw->has_output = false; |
| 174 | |
Takashi Sakamoto | 9e2004f | 2015-12-22 09:15:45 +0900 | [diff] [blame] | 175 | return snd_oxfw_scs1x_add(oxfw); |
Takashi Sakamoto | de5126c | 2015-12-22 09:15:46 +0900 | [diff] [blame^] | 176 | } |
Takashi Sakamoto | 9e2004f | 2015-12-22 09:15:45 +0900 | [diff] [blame] | 177 | |
| 178 | /* |
Takashi Sakamoto | 27e6663 | 2015-12-15 23:56:20 +0900 | [diff] [blame] | 179 | * TASCAM FireOne has physical control and requires a pair of additional |
| 180 | * MIDI ports. |
| 181 | */ |
| 182 | if (oxfw->entry->vendor_id == VENDOR_TASCAM) { |
| 183 | oxfw->midi_input_ports++; |
| 184 | oxfw->midi_output_ports++; |
Takashi Sakamoto | 5ce8cc4 | 2015-12-15 23:56:21 +0900 | [diff] [blame] | 185 | return 0; |
Takashi Sakamoto | 27e6663 | 2015-12-15 23:56:20 +0900 | [diff] [blame] | 186 | } |
| 187 | |
Takashi Sakamoto | 13f3a46 | 2015-09-20 21:18:55 +0900 | [diff] [blame] | 188 | /* Seek from Root Directory of Config ROM. */ |
| 189 | vendor = model = 0; |
| 190 | fw_csr_iterator_init(&it, fw_dev->config_rom + 5); |
| 191 | while (fw_csr_iterator_next(&it, &key, &val)) { |
| 192 | if (key == CSR_VENDOR) |
| 193 | vendor = val; |
| 194 | else if (key == CSR_MODEL) |
| 195 | model = val; |
| 196 | } |
| 197 | |
| 198 | /* |
| 199 | * Mackie Onyx Satellite with base station has a quirk to report a wrong |
| 200 | * value in 'dbs' field of CIP header against its format information. |
| 201 | */ |
| 202 | if (vendor == VENDOR_LOUD && model == MODEL_SATELLITE) |
| 203 | oxfw->wrong_dbs = true; |
Takashi Sakamoto | 5ce8cc4 | 2015-12-15 23:56:21 +0900 | [diff] [blame] | 204 | |
| 205 | return 0; |
Takashi Sakamoto | 13f3a46 | 2015-09-20 21:18:55 +0900 | [diff] [blame] | 206 | } |
| 207 | |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 208 | static int oxfw_probe(struct fw_unit *unit, |
Takashi Sakamoto | 27e6663 | 2015-12-15 23:56:20 +0900 | [diff] [blame] | 209 | const struct ieee1394_device_id *entry) |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 210 | { |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 211 | struct snd_card *card; |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 212 | struct snd_oxfw *oxfw; |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 213 | int err; |
| 214 | |
Takashi Sakamoto | 27e6663 | 2015-12-15 23:56:20 +0900 | [diff] [blame] | 215 | if (entry->vendor_id == VENDOR_LOUD && !detect_loud_models(unit)) |
Takashi Sakamoto | ec4dba5 | 2014-12-09 00:10:45 +0900 | [diff] [blame] | 216 | return -ENODEV; |
| 217 | |
Takashi Iwai | 06b45f0 | 2014-01-29 14:23:55 +0100 | [diff] [blame] | 218 | err = snd_card_new(&unit->device, -1, NULL, THIS_MODULE, |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 219 | sizeof(*oxfw), &card); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 220 | if (err < 0) |
| 221 | return err; |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 222 | |
Takashi Sakamoto | e2786ca | 2014-11-29 00:59:27 +0900 | [diff] [blame] | 223 | card->private_free = oxfw_card_free; |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 224 | oxfw = card->private_data; |
| 225 | oxfw->card = card; |
| 226 | mutex_init(&oxfw->mutex); |
Takashi Sakamoto | 12ed719 | 2015-02-21 23:54:57 +0900 | [diff] [blame] | 227 | oxfw->unit = fw_unit_get(unit); |
Takashi Sakamoto | 27e6663 | 2015-12-15 23:56:20 +0900 | [diff] [blame] | 228 | oxfw->entry = entry; |
Takashi Sakamoto | 05588d3 | 2014-12-09 00:10:48 +0900 | [diff] [blame] | 229 | spin_lock_init(&oxfw->lock); |
Takashi Sakamoto | 8985f4a | 2014-12-09 00:10:49 +0900 | [diff] [blame] | 230 | init_waitqueue_head(&oxfw->hwdep_wait); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 231 | |
Takashi Sakamoto | 5cd1d3f | 2014-12-09 00:10:42 +0900 | [diff] [blame] | 232 | err = snd_oxfw_stream_discover(oxfw); |
| 233 | if (err < 0) |
| 234 | goto error; |
| 235 | |
Takashi Sakamoto | 3f47152 | 2015-12-22 09:15:39 +0900 | [diff] [blame] | 236 | err = name_card(oxfw); |
Takashi Sakamoto | 5ce8cc4 | 2015-12-15 23:56:21 +0900 | [diff] [blame] | 237 | if (err < 0) |
| 238 | goto error; |
Takashi Sakamoto | 13f3a46 | 2015-09-20 21:18:55 +0900 | [diff] [blame] | 239 | |
Takashi Sakamoto | 3f47152 | 2015-12-22 09:15:39 +0900 | [diff] [blame] | 240 | err = detect_quirks(oxfw); |
Takashi Sakamoto | fec7b75 | 2014-12-09 00:10:40 +0900 | [diff] [blame] | 241 | if (err < 0) |
| 242 | goto error; |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 243 | |
Takashi Sakamoto | 3713d93 | 2014-11-29 00:59:28 +0900 | [diff] [blame] | 244 | err = snd_oxfw_create_pcm(oxfw); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 245 | if (err < 0) |
| 246 | goto error; |
| 247 | |
Takashi Sakamoto | 3c96101 | 2014-12-09 00:10:43 +0900 | [diff] [blame] | 248 | snd_oxfw_proc_init(oxfw); |
| 249 | |
Takashi Sakamoto | 05588d3 | 2014-12-09 00:10:48 +0900 | [diff] [blame] | 250 | err = snd_oxfw_create_midi(oxfw); |
| 251 | if (err < 0) |
| 252 | goto error; |
| 253 | |
Takashi Sakamoto | 8985f4a | 2014-12-09 00:10:49 +0900 | [diff] [blame] | 254 | err = snd_oxfw_create_hwdep(oxfw); |
| 255 | if (err < 0) |
| 256 | goto error; |
| 257 | |
Takashi Sakamoto | b0ac000 | 2014-12-09 00:10:46 +0900 | [diff] [blame] | 258 | err = snd_oxfw_stream_init_simplex(oxfw, &oxfw->rx_stream); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 259 | if (err < 0) |
| 260 | goto error; |
Takashi Sakamoto | b0ac000 | 2014-12-09 00:10:46 +0900 | [diff] [blame] | 261 | if (oxfw->has_output) { |
| 262 | err = snd_oxfw_stream_init_simplex(oxfw, &oxfw->tx_stream); |
| 263 | if (err < 0) |
| 264 | goto error; |
| 265 | } |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 266 | |
Takashi Sakamoto | e2786ca | 2014-11-29 00:59:27 +0900 | [diff] [blame] | 267 | err = snd_card_register(card); |
| 268 | if (err < 0) { |
Takashi Sakamoto | b0ac000 | 2014-12-09 00:10:46 +0900 | [diff] [blame] | 269 | snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->rx_stream); |
| 270 | if (oxfw->has_output) |
| 271 | snd_oxfw_stream_destroy_simplex(oxfw, &oxfw->tx_stream); |
Takashi Sakamoto | e2786ca | 2014-11-29 00:59:27 +0900 | [diff] [blame] | 272 | goto error; |
| 273 | } |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 274 | dev_set_drvdata(&unit->device, oxfw); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 275 | |
| 276 | return 0; |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 277 | error: |
| 278 | snd_card_free(card); |
| 279 | return err; |
| 280 | } |
| 281 | |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 282 | static void oxfw_bus_reset(struct fw_unit *unit) |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 283 | { |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 284 | struct snd_oxfw *oxfw = dev_get_drvdata(&unit->device); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 285 | |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 286 | fcp_bus_reset(oxfw->unit); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 287 | |
Takashi Sakamoto | e2786ca | 2014-11-29 00:59:27 +0900 | [diff] [blame] | 288 | mutex_lock(&oxfw->mutex); |
Takashi Sakamoto | b0ac000 | 2014-12-09 00:10:46 +0900 | [diff] [blame] | 289 | |
| 290 | snd_oxfw_stream_update_simplex(oxfw, &oxfw->rx_stream); |
| 291 | if (oxfw->has_output) |
| 292 | snd_oxfw_stream_update_simplex(oxfw, &oxfw->tx_stream); |
| 293 | |
Takashi Sakamoto | e2786ca | 2014-11-29 00:59:27 +0900 | [diff] [blame] | 294 | mutex_unlock(&oxfw->mutex); |
Takashi Sakamoto | 9e2004f | 2015-12-22 09:15:45 +0900 | [diff] [blame] | 295 | |
| 296 | if (oxfw->entry->vendor_id == OUI_STANTON) |
| 297 | snd_oxfw_scs1x_update(oxfw); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 298 | } |
| 299 | |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 300 | static void oxfw_remove(struct fw_unit *unit) |
Stefan Richter | 94a8715 | 2013-06-09 18:15:00 +0200 | [diff] [blame] | 301 | { |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 302 | struct snd_oxfw *oxfw = dev_get_drvdata(&unit->device); |
Stefan Richter | 94a8715 | 2013-06-09 18:15:00 +0200 | [diff] [blame] | 303 | |
Takashi Sakamoto | 12ed719 | 2015-02-21 23:54:57 +0900 | [diff] [blame] | 304 | /* No need to wait for releasing card object in this context. */ |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 305 | snd_card_free_when_closed(oxfw->card); |
Stefan Richter | 94a8715 | 2013-06-09 18:15:00 +0200 | [diff] [blame] | 306 | } |
| 307 | |
Takashi Sakamoto | d6ce6bb | 2015-12-16 20:37:57 +0900 | [diff] [blame] | 308 | static const struct compat_info griffin_firewave = { |
Stefan Richter | 94a8715 | 2013-06-09 18:15:00 +0200 | [diff] [blame] | 309 | .driver_name = "FireWave", |
Takashi Sakamoto | fec7b75 | 2014-12-09 00:10:40 +0900 | [diff] [blame] | 310 | .vendor_name = "Griffin", |
| 311 | .model_name = "FireWave", |
Stefan Richter | 94a8715 | 2013-06-09 18:15:00 +0200 | [diff] [blame] | 312 | }; |
| 313 | |
Takashi Sakamoto | d6ce6bb | 2015-12-16 20:37:57 +0900 | [diff] [blame] | 314 | static const struct compat_info lacie_speakers = { |
Stefan Richter | 94a8715 | 2013-06-09 18:15:00 +0200 | [diff] [blame] | 315 | .driver_name = "FWSpeakers", |
Takashi Sakamoto | fec7b75 | 2014-12-09 00:10:40 +0900 | [diff] [blame] | 316 | .vendor_name = "LaCie", |
| 317 | .model_name = "FireWire Speakers", |
Stefan Richter | 94a8715 | 2013-06-09 18:15:00 +0200 | [diff] [blame] | 318 | }; |
| 319 | |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 320 | static const struct ieee1394_device_id oxfw_id_table[] = { |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 321 | { |
| 322 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 323 | IEEE1394_MATCH_MODEL_ID | |
| 324 | IEEE1394_MATCH_SPECIFIER_ID | |
| 325 | IEEE1394_MATCH_VERSION, |
| 326 | .vendor_id = VENDOR_GRIFFIN, |
| 327 | .model_id = 0x00f970, |
| 328 | .specifier_id = SPECIFIER_1394TA, |
| 329 | .version = VERSION_AVC, |
Stefan Richter | 94a8715 | 2013-06-09 18:15:00 +0200 | [diff] [blame] | 330 | .driver_data = (kernel_ulong_t)&griffin_firewave, |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 331 | }, |
| 332 | { |
| 333 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 334 | IEEE1394_MATCH_MODEL_ID | |
| 335 | IEEE1394_MATCH_SPECIFIER_ID | |
| 336 | IEEE1394_MATCH_VERSION, |
| 337 | .vendor_id = VENDOR_LACIE, |
| 338 | .model_id = 0x00f970, |
| 339 | .specifier_id = SPECIFIER_1394TA, |
| 340 | .version = VERSION_AVC, |
Stefan Richter | 94a8715 | 2013-06-09 18:15:00 +0200 | [diff] [blame] | 341 | .driver_data = (kernel_ulong_t)&lacie_speakers, |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 342 | }, |
Takashi Sakamoto | ec4dba5 | 2014-12-09 00:10:45 +0900 | [diff] [blame] | 343 | /* Behringer,F-Control Audio 202 */ |
| 344 | { |
| 345 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 346 | IEEE1394_MATCH_MODEL_ID, |
| 347 | .vendor_id = VENDOR_BEHRINGER, |
| 348 | .model_id = 0x00fc22, |
| 349 | }, |
| 350 | /* |
| 351 | * Any Mackie(Loud) models (name string/model id): |
| 352 | * Onyx-i series (former models): 0x081216 |
| 353 | * Mackie Onyx Satellite: 0x00200f |
| 354 | * Tapco LINK.firewire 4x6: 0x000460 |
| 355 | * d.2 pro: Unknown |
| 356 | * d.4 pro: Unknown |
| 357 | * U.420: Unknown |
| 358 | * U.420d: Unknown |
| 359 | */ |
| 360 | { |
| 361 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 362 | IEEE1394_MATCH_SPECIFIER_ID | |
| 363 | IEEE1394_MATCH_VERSION, |
| 364 | .vendor_id = VENDOR_LOUD, |
| 365 | .specifier_id = SPECIFIER_1394TA, |
| 366 | .version = VERSION_AVC, |
| 367 | }, |
Takashi Sakamoto | 759a2f4 | 2015-10-18 17:09:40 +0900 | [diff] [blame] | 368 | /* TASCAM, FireOne */ |
| 369 | { |
| 370 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 371 | IEEE1394_MATCH_MODEL_ID, |
| 372 | .vendor_id = VENDOR_TASCAM, |
| 373 | .model_id = 0x800007, |
| 374 | }, |
Takashi Sakamoto | 9e2004f | 2015-12-22 09:15:45 +0900 | [diff] [blame] | 375 | /* Stanton, Stanton Controllers & Systems 1 Mixer (SCS.1m) */ |
| 376 | { |
| 377 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 378 | IEEE1394_MATCH_MODEL_ID, |
| 379 | .vendor_id = OUI_STANTON, |
| 380 | .model_id = 0x001000, |
| 381 | }, |
| 382 | /* Stanton, Stanton Controllers & Systems 1 Deck (SCS.1d) */ |
| 383 | { |
| 384 | .match_flags = IEEE1394_MATCH_VENDOR_ID | |
| 385 | IEEE1394_MATCH_MODEL_ID, |
| 386 | .vendor_id = OUI_STANTON, |
| 387 | .model_id = 0x002000, |
| 388 | }, |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 389 | { } |
| 390 | }; |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 391 | MODULE_DEVICE_TABLE(ieee1394, oxfw_id_table); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 392 | |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 393 | static struct fw_driver oxfw_driver = { |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 394 | .driver = { |
| 395 | .owner = THIS_MODULE, |
| 396 | .name = KBUILD_MODNAME, |
| 397 | .bus = &fw_bus_type, |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 398 | }, |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 399 | .probe = oxfw_probe, |
| 400 | .update = oxfw_bus_reset, |
| 401 | .remove = oxfw_remove, |
| 402 | .id_table = oxfw_id_table, |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 403 | }; |
| 404 | |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 405 | static int __init snd_oxfw_init(void) |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 406 | { |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 407 | return driver_register(&oxfw_driver.driver); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 408 | } |
| 409 | |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 410 | static void __exit snd_oxfw_exit(void) |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 411 | { |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 412 | driver_unregister(&oxfw_driver.driver); |
Clemens Ladisch | 31ef913 | 2011-03-15 07:53:21 +0100 | [diff] [blame] | 413 | } |
| 414 | |
Takashi Sakamoto | 8832c5a | 2014-11-29 00:59:25 +0900 | [diff] [blame] | 415 | module_init(snd_oxfw_init); |
| 416 | module_exit(snd_oxfw_exit); |