fireworks.c (bde8a8f23bbe6db51fa4e81644273af18fef3d7a) fireworks.c (315fd41fe9d43838ab5afd26c58d908d18313d9a)
1/*
2 * fireworks.c - a part of driver for Fireworks based devices
3 *
4 * Copyright (c) 2009-2010 Clemens Ladisch
5 * Copyright (c) 2013-2014 Takashi Sakamoto
6 *
7 * Licensed under the terms of the GNU General Public License, version 2.
8 */

--- 84 unchanged lines hidden (view full) ---

93 hwinfo->vendor_name, hwinfo->model_name, version,
94 hwinfo->guid_hi, hwinfo->guid_lo,
95 dev_name(&efw->unit->device), 100 << fw_dev->max_speed);
96 if (err < 0)
97 goto end;
98
99 if (hwinfo->flags & BIT(FLAG_RESP_ADDR_CHANGABLE))
100 efw->resp_addr_changable = true;
1/*
2 * fireworks.c - a part of driver for Fireworks based devices
3 *
4 * Copyright (c) 2009-2010 Clemens Ladisch
5 * Copyright (c) 2013-2014 Takashi Sakamoto
6 *
7 * Licensed under the terms of the GNU General Public License, version 2.
8 */

--- 84 unchanged lines hidden (view full) ---

93 hwinfo->vendor_name, hwinfo->model_name, version,
94 hwinfo->guid_hi, hwinfo->guid_lo,
95 dev_name(&efw->unit->device), 100 << fw_dev->max_speed);
96 if (err < 0)
97 goto end;
98
99 if (hwinfo->flags & BIT(FLAG_RESP_ADDR_CHANGABLE))
100 efw->resp_addr_changable = true;
101
102 efw->supported_sampling_rate = 0;
103 if ((hwinfo->min_sample_rate <= 22050)
104 && (22050 <= hwinfo->max_sample_rate))
105 efw->supported_sampling_rate |= SNDRV_PCM_RATE_22050;
106 if ((hwinfo->min_sample_rate <= 32000)
107 && (32000 <= hwinfo->max_sample_rate))
108 efw->supported_sampling_rate |= SNDRV_PCM_RATE_32000;
109 if ((hwinfo->min_sample_rate <= 44100)
110 && (44100 <= hwinfo->max_sample_rate))
111 efw->supported_sampling_rate |= SNDRV_PCM_RATE_44100;
112 if ((hwinfo->min_sample_rate <= 48000)
113 && (48000 <= hwinfo->max_sample_rate))
114 efw->supported_sampling_rate |= SNDRV_PCM_RATE_48000;
115 if ((hwinfo->min_sample_rate <= 88200)
116 && (88200 <= hwinfo->max_sample_rate))
117 efw->supported_sampling_rate |= SNDRV_PCM_RATE_88200;
118 if ((hwinfo->min_sample_rate <= 96000)
119 && (96000 <= hwinfo->max_sample_rate))
120 efw->supported_sampling_rate |= SNDRV_PCM_RATE_96000;
121 if ((hwinfo->min_sample_rate <= 176400)
122 && (176400 <= hwinfo->max_sample_rate))
123 efw->supported_sampling_rate |= SNDRV_PCM_RATE_176400;
124 if ((hwinfo->min_sample_rate <= 192000)
125 && (192000 <= hwinfo->max_sample_rate))
126 efw->supported_sampling_rate |= SNDRV_PCM_RATE_192000;
127
128 /* the number of MIDI ports, not of MIDI conformant data channels */
129 if (hwinfo->midi_out_ports > SND_EFW_MAX_MIDI_OUT_PORTS ||
130 hwinfo->midi_in_ports > SND_EFW_MAX_MIDI_IN_PORTS) {
131 err = -EIO;
132 goto end;
133 }
134 efw->midi_out_ports = hwinfo->midi_out_ports;
135 efw->midi_in_ports = hwinfo->midi_in_ports;
136
137 if (hwinfo->amdtp_tx_pcm_channels > AMDTP_MAX_CHANNELS_FOR_PCM ||
138 hwinfo->amdtp_tx_pcm_channels_2x > AMDTP_MAX_CHANNELS_FOR_PCM ||
139 hwinfo->amdtp_tx_pcm_channels_4x > AMDTP_MAX_CHANNELS_FOR_PCM ||
140 hwinfo->amdtp_rx_pcm_channels > AMDTP_MAX_CHANNELS_FOR_PCM ||
141 hwinfo->amdtp_rx_pcm_channels_2x > AMDTP_MAX_CHANNELS_FOR_PCM ||
142 hwinfo->amdtp_rx_pcm_channels_4x > AMDTP_MAX_CHANNELS_FOR_PCM) {
143 err = -ENOSYS;
144 goto end;
145 }
146 efw->pcm_capture_channels[0] = hwinfo->amdtp_tx_pcm_channels;
147 efw->pcm_capture_channels[1] = hwinfo->amdtp_tx_pcm_channels_2x;
148 efw->pcm_capture_channels[2] = hwinfo->amdtp_tx_pcm_channels_4x;
149 efw->pcm_playback_channels[0] = hwinfo->amdtp_rx_pcm_channels;
150 efw->pcm_playback_channels[1] = hwinfo->amdtp_rx_pcm_channels_2x;
151 efw->pcm_playback_channels[2] = hwinfo->amdtp_rx_pcm_channels_4x;
101end:
102 kfree(hwinfo);
103 return err;
104}
105
106static void
107efw_card_free(struct snd_card *card)
108{

--- 41 unchanged lines hidden (view full) ---

150 efw->unit = unit;
151 mutex_init(&efw->mutex);
152 spin_lock_init(&efw->lock);
153
154 err = get_hardware_info(efw);
155 if (err < 0)
156 goto error;
157
152end:
153 kfree(hwinfo);
154 return err;
155}
156
157static void
158efw_card_free(struct snd_card *card)
159{

--- 41 unchanged lines hidden (view full) ---

201 efw->unit = unit;
202 mutex_init(&efw->mutex);
203 spin_lock_init(&efw->lock);
204
205 err = get_hardware_info(efw);
206 if (err < 0)
207 goto error;
208
158 err = snd_card_register(card);
209 err = snd_efw_stream_init_duplex(efw);
159 if (err < 0)
160 goto error;
161
210 if (err < 0)
211 goto error;
212
213 err = snd_card_register(card);
214 if (err < 0) {
215 snd_efw_stream_destroy_duplex(efw);
216 goto error;
217 }
218
162 dev_set_drvdata(&unit->device, efw);
163end:
164 mutex_unlock(&devices_mutex);
165 return err;
166error:
167 mutex_unlock(&devices_mutex);
168 snd_card_free(card);
169 return err;
170}
171
172static void efw_update(struct fw_unit *unit)
173{
174 struct snd_efw *efw = dev_get_drvdata(&unit->device);
219 dev_set_drvdata(&unit->device, efw);
220end:
221 mutex_unlock(&devices_mutex);
222 return err;
223error:
224 mutex_unlock(&devices_mutex);
225 snd_card_free(card);
226 return err;
227}
228
229static void efw_update(struct fw_unit *unit)
230{
231 struct snd_efw *efw = dev_get_drvdata(&unit->device);
232
175 snd_efw_transaction_bus_reset(efw->unit);
233 snd_efw_transaction_bus_reset(efw->unit);
234 snd_efw_stream_update_duplex(efw);
176}
177
178static void efw_remove(struct fw_unit *unit)
179{
180 struct snd_efw *efw = dev_get_drvdata(&unit->device);
235}
236
237static void efw_remove(struct fw_unit *unit)
238{
239 struct snd_efw *efw = dev_get_drvdata(&unit->device);
240
241 snd_efw_stream_destroy_duplex(efw);
242
181 snd_card_disconnect(efw->card);
182 snd_card_free_when_closed(efw->card);
183}
184
185static const struct ieee1394_device_id efw_id_table[] = {
186 SND_EFW_DEV_ENTRY(VENDOR_LOUD, MODEL_MACKIE_400F),
187 SND_EFW_DEV_ENTRY(VENDOR_LOUD, MODEL_MACKIE_1200F),
188 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_AUDIOFIRE_8),

--- 51 unchanged lines hidden ---
243 snd_card_disconnect(efw->card);
244 snd_card_free_when_closed(efw->card);
245}
246
247static const struct ieee1394_device_id efw_id_table[] = {
248 SND_EFW_DEV_ENTRY(VENDOR_LOUD, MODEL_MACKIE_400F),
249 SND_EFW_DEV_ENTRY(VENDOR_LOUD, MODEL_MACKIE_1200F),
250 SND_EFW_DEV_ENTRY(VENDOR_ECHO, MODEL_ECHO_AUDIOFIRE_8),

--- 51 unchanged lines hidden ---