ff.c (3eb8a24459491acc40440b655ca640c87125c5a3) ff.c (a91f676074c05b3c455700b90849adcfda50079e)
1/*
2 * ff.c - a part of driver for RME Fireface series
3 *
4 * Copyright (c) 2015-2017 Takashi Sakamoto
5 *
6 * Licensed under the terms of the GNU General Public License, version 2.
7 */
8

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

26 fw_dev->config_rom[3], fw_dev->config_rom[4],
27 dev_name(&ff->unit->device), 100 << fw_dev->max_speed);
28}
29
30static void ff_card_free(struct snd_card *card)
31{
32 struct snd_ff *ff = card->private_data;
33
1/*
2 * ff.c - a part of driver for RME Fireface series
3 *
4 * Copyright (c) 2015-2017 Takashi Sakamoto
5 *
6 * Licensed under the terms of the GNU General Public License, version 2.
7 */
8

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

26 fw_dev->config_rom[3], fw_dev->config_rom[4],
27 dev_name(&ff->unit->device), 100 << fw_dev->max_speed);
28}
29
30static void ff_card_free(struct snd_card *card)
31{
32 struct snd_ff *ff = card->private_data;
33
34 snd_ff_stream_destroy_duplex(ff);
34 if (ff->spec->protocol->begin_session)
35 snd_ff_stream_destroy_duplex(ff);
35 snd_ff_transaction_unregister(ff);
36}
37
38static void do_registration(struct work_struct *work)
39{
40 struct snd_ff *ff = container_of(work, struct snd_ff, dwork.work);
41 int err;
42

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

51 ff->card->private_data = ff;
52
53 err = snd_ff_transaction_register(ff);
54 if (err < 0)
55 goto error;
56
57 name_card(ff);
58
36 snd_ff_transaction_unregister(ff);
37}
38
39static void do_registration(struct work_struct *work)
40{
41 struct snd_ff *ff = container_of(work, struct snd_ff, dwork.work);
42 int err;
43

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

52 ff->card->private_data = ff;
53
54 err = snd_ff_transaction_register(ff);
55 if (err < 0)
56 goto error;
57
58 name_card(ff);
59
59 err = snd_ff_stream_init_duplex(ff);
60 if (err < 0)
61 goto error;
60 if (ff->spec->protocol->begin_session) {
61 err = snd_ff_stream_init_duplex(ff);
62 if (err < 0)
63 goto error;
64 }
62
63 snd_ff_proc_init(ff);
64
65 err = snd_ff_create_midi_devices(ff);
66 if (err < 0)
67 goto error;
68
65
66 snd_ff_proc_init(ff);
67
68 err = snd_ff_create_midi_devices(ff);
69 if (err < 0)
70 goto error;
71
69 err = snd_ff_create_pcm_devices(ff);
70 if (err < 0)
71 goto error;
72 if (ff->spec->protocol->begin_session) {
73 err = snd_ff_create_pcm_devices(ff);
74 if (err < 0)
75 goto error;
72
76
73 err = snd_ff_create_hwdep_devices(ff);
74 if (err < 0)
75 goto error;
77 err = snd_ff_create_hwdep_devices(ff);
78 if (err < 0)
79 goto error;
80 }
76
77 err = snd_card_register(ff->card);
78 if (err < 0)
79 goto error;
80
81 ff->registered = true;
82
83 return;

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

116 struct snd_ff *ff = dev_get_drvdata(&unit->device);
117
118 /* Postpone a workqueue for deferred registration. */
119 if (!ff->registered)
120 snd_fw_schedule_registration(unit, &ff->dwork);
121
122 snd_ff_transaction_reregister(ff);
123
81
82 err = snd_card_register(ff->card);
83 if (err < 0)
84 goto error;
85
86 ff->registered = true;
87
88 return;

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

121 struct snd_ff *ff = dev_get_drvdata(&unit->device);
122
123 /* Postpone a workqueue for deferred registration. */
124 if (!ff->registered)
125 snd_fw_schedule_registration(unit, &ff->dwork);
126
127 snd_ff_transaction_reregister(ff);
128
124 if (ff->registered)
129 if (ff->registered && ff->spec->protocol->begin_session)
125 snd_ff_stream_update_duplex(ff);
126}
127
128static void snd_ff_remove(struct fw_unit *unit)
129{
130 struct snd_ff *ff = dev_get_drvdata(&unit->device);
131
132 /*

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

140 // Block till all of ALSA character devices are released.
141 snd_card_free(ff->card);
142 }
143
144 mutex_destroy(&ff->mutex);
145 fw_unit_put(ff->unit);
146}
147
130 snd_ff_stream_update_duplex(ff);
131}
132
133static void snd_ff_remove(struct fw_unit *unit)
134{
135 struct snd_ff *ff = dev_get_drvdata(&unit->device);
136
137 /*

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

145 // Block till all of ALSA character devices are released.
146 snd_card_free(ff->card);
147 }
148
149 mutex_destroy(&ff->mutex);
150 fw_unit_put(ff->unit);
151}
152
153static const struct snd_ff_spec spec_ff800 = {
154 .name = "Fireface800",
155 .midi_in_ports = 1,
156 .midi_out_ports = 1,
157 .protocol = &snd_ff_protocol_ff800,
158 .regs = {
159 [SND_FF_REG_TYPE_MIDI_HIGH_ADDR] = 0x000200000320ull,
160 },
161};
162
148static const struct snd_ff_spec spec_ff400 = {
149 .name = "Fireface400",
150 .pcm_capture_channels = {18, 14, 10},
151 .pcm_playback_channels = {18, 14, 10},
152 .midi_in_ports = 2,
153 .midi_out_ports = 2,
154 .protocol = &snd_ff_protocol_ff400,
155 .regs = {
156 [SND_FF_REG_TYPE_MIDI_HIGH_ADDR] = 0x0000801003f4ull,
157 },
158};
159
160static const struct ieee1394_device_id snd_ff_id_table[] = {
163static const struct snd_ff_spec spec_ff400 = {
164 .name = "Fireface400",
165 .pcm_capture_channels = {18, 14, 10},
166 .pcm_playback_channels = {18, 14, 10},
167 .midi_in_ports = 2,
168 .midi_out_ports = 2,
169 .protocol = &snd_ff_protocol_ff400,
170 .regs = {
171 [SND_FF_REG_TYPE_MIDI_HIGH_ADDR] = 0x0000801003f4ull,
172 },
173};
174
175static const struct ieee1394_device_id snd_ff_id_table[] = {
176 /* Fireface 800 */
177 {
178 .match_flags = IEEE1394_MATCH_VENDOR_ID |
179 IEEE1394_MATCH_SPECIFIER_ID |
180 IEEE1394_MATCH_VERSION |
181 IEEE1394_MATCH_MODEL_ID,
182 .vendor_id = OUI_RME,
183 .specifier_id = OUI_RME,
184 .version = 0x000001,
185 .model_id = 0x101800,
186 .driver_data = (kernel_ulong_t)&spec_ff800,
187 },
161 /* Fireface 400 */
162 {
163 .match_flags = IEEE1394_MATCH_VENDOR_ID |
164 IEEE1394_MATCH_SPECIFIER_ID |
165 IEEE1394_MATCH_VERSION |
166 IEEE1394_MATCH_MODEL_ID,
167 .vendor_id = OUI_RME,
188 /* Fireface 400 */
189 {
190 .match_flags = IEEE1394_MATCH_VENDOR_ID |
191 IEEE1394_MATCH_SPECIFIER_ID |
192 IEEE1394_MATCH_VERSION |
193 IEEE1394_MATCH_MODEL_ID,
194 .vendor_id = OUI_RME,
168 .specifier_id = 0x000a35,
195 .specifier_id = OUI_RME,
169 .version = 0x000002,
170 .model_id = 0x101800,
171 .driver_data = (kernel_ulong_t)&spec_ff400,
172 },
173 {}
174};
175MODULE_DEVICE_TABLE(ieee1394, snd_ff_id_table);
176

--- 24 unchanged lines hidden ---
196 .version = 0x000002,
197 .model_id = 0x101800,
198 .driver_data = (kernel_ulong_t)&spec_ff400,
199 },
200 {}
201};
202MODULE_DEVICE_TABLE(ieee1394, snd_ff_id_table);
203

--- 24 unchanged lines hidden ---