Skip to content

Commit 739bdba

Browse files
takaswietiwai
authored andcommitted
ALSA: firewire-motu: remove obsoleted codes
The way to decide CIP payload size by calculation with any flag is now obsoleted. This commit removes the codes. Signed-off-by: Takashi Sakamoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent 88e8f89 commit 739bdba

File tree

3 files changed

+11
-296
lines changed

3 files changed

+11
-296
lines changed

sound/firewire/motu/motu-protocol-v2.c

Lines changed: 5 additions & 122 deletions
Original file line numberDiff line numberDiff line change
@@ -186,86 +186,6 @@ int snd_motu_protocol_v2_switch_fetching_mode(struct snd_motu *motu,
186186
sizeof(reg));
187187
}
188188

189-
static void calculate_fixed_part(struct snd_motu_packet_format *formats,
190-
enum amdtp_stream_direction dir,
191-
enum snd_motu_spec_flags flags,
192-
unsigned char analog_ports)
193-
{
194-
unsigned char pcm_chunks[3] = {0, 0, 0};
195-
196-
pcm_chunks[0] = analog_ports;
197-
pcm_chunks[1] = analog_ports;
198-
if (flags & SND_MOTU_SPEC_SUPPORT_CLOCK_X4)
199-
pcm_chunks[2] = analog_ports;
200-
201-
if (dir == AMDTP_IN_STREAM) {
202-
if (flags & SND_MOTU_SPEC_TX_MICINST_CHUNK) {
203-
pcm_chunks[0] += 2;
204-
pcm_chunks[1] += 2;
205-
}
206-
if (flags & SND_MOTU_SPEC_TX_RETURN_CHUNK) {
207-
pcm_chunks[0] += 2;
208-
pcm_chunks[1] += 2;
209-
}
210-
} else {
211-
if (flags & SND_MOTU_SPEC_RX_SEPARATED_MAIN) {
212-
pcm_chunks[0] += 2;
213-
pcm_chunks[1] += 2;
214-
}
215-
216-
// Packets to v2 units include 2 chunks for phone 1/2, except
217-
// for 176.4/192.0 kHz.
218-
pcm_chunks[0] += 2;
219-
pcm_chunks[1] += 2;
220-
}
221-
222-
if (flags & SND_MOTU_SPEC_HAS_AESEBU_IFACE) {
223-
pcm_chunks[0] += 2;
224-
pcm_chunks[1] += 2;
225-
}
226-
227-
/*
228-
* All of v2 models have a pair of coaxial interfaces for digital in/out
229-
* port. At 44.1/48.0/88.2/96.0 kHz, packets includes PCM from these
230-
* ports.
231-
*/
232-
pcm_chunks[0] += 2;
233-
pcm_chunks[1] += 2;
234-
235-
formats->fixed_part_pcm_chunks[0] = pcm_chunks[0];
236-
formats->fixed_part_pcm_chunks[1] = pcm_chunks[1];
237-
formats->fixed_part_pcm_chunks[2] = pcm_chunks[2];
238-
}
239-
240-
static void calculate_differed_part(struct snd_motu_packet_format *formats,
241-
enum snd_motu_spec_flags flags,
242-
u32 data, u32 mask, u32 shift)
243-
{
244-
unsigned char pcm_chunks[2] = {0, 0};
245-
246-
/*
247-
* When optical interfaces are configured for S/PDIF (TOSLINK),
248-
* the above PCM frames come from them, instead of coaxial
249-
* interfaces.
250-
*/
251-
data = (data & mask) >> shift;
252-
if (data == V2_OPT_IFACE_MODE_ADAT) {
253-
if (flags & SND_MOTU_SPEC_HAS_OPT_IFACE_A) {
254-
pcm_chunks[0] += 8;
255-
pcm_chunks[1] += 4;
256-
}
257-
// 8pre has two sets of optical interface and doesn't reduce
258-
// chunks for ADAT signals.
259-
if (flags & SND_MOTU_SPEC_HAS_OPT_IFACE_B) {
260-
pcm_chunks[1] += 4;
261-
}
262-
}
263-
264-
/* At mode x4, no data chunks are supported in this part. */
265-
formats->differed_part_pcm_chunks[0] = pcm_chunks[0];
266-
formats->differed_part_pcm_chunks[1] = pcm_chunks[1];
267-
}
268-
269189
static int detect_packet_formats_828mk2(struct snd_motu *motu, u32 data)
270190
{
271191
if (((data & V2_OPT_IN_IFACE_MASK) >> V2_OPT_IN_IFACE_SHIFT) ==
@@ -335,16 +255,6 @@ int snd_motu_protocol_v2_cache_packet_formats(struct snd_motu *motu)
335255
return err;
336256
data = be32_to_cpu(reg);
337257

338-
calculate_fixed_part(&motu->tx_packet_formats, AMDTP_IN_STREAM,
339-
motu->spec->flags, motu->spec->analog_in_ports);
340-
calculate_differed_part(&motu->tx_packet_formats, motu->spec->flags,
341-
data, V2_OPT_IN_IFACE_MASK, V2_OPT_IN_IFACE_SHIFT);
342-
343-
calculate_fixed_part(&motu->rx_packet_formats, AMDTP_OUT_STREAM,
344-
motu->spec->flags, motu->spec->analog_out_ports);
345-
calculate_differed_part(&motu->rx_packet_formats, motu->spec->flags,
346-
data, V2_OPT_OUT_IFACE_MASK, V2_OPT_OUT_IFACE_SHIFT);
347-
348258
memcpy(motu->tx_packet_formats.pcm_chunks,
349259
motu->spec->tx_fixed_pcm_chunks,
350260
sizeof(motu->tx_packet_formats.pcm_chunks));
@@ -365,62 +275,35 @@ int snd_motu_protocol_v2_cache_packet_formats(struct snd_motu *motu)
365275
const struct snd_motu_spec snd_motu_spec_828mk2 = {
366276
.name = "828mk2",
367277
.protocol_version = SND_MOTU_PROTOCOL_V2,
368-
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
369-
SND_MOTU_SPEC_TX_MICINST_CHUNK |
370-
SND_MOTU_SPEC_TX_RETURN_CHUNK |
371-
SND_MOTU_SPEC_RX_SEPARATED_MAIN |
372-
SND_MOTU_SPEC_HAS_OPT_IFACE_A |
373-
SND_MOTU_SPEC_RX_MIDI_2ND_Q |
278+
.flags = SND_MOTU_SPEC_RX_MIDI_2ND_Q |
374279
SND_MOTU_SPEC_TX_MIDI_2ND_Q,
375280
.tx_fixed_pcm_chunks = {14, 14, 0},
376281
.rx_fixed_pcm_chunks = {14, 14, 0},
377-
.analog_in_ports = 8,
378-
.analog_out_ports = 8,
379282
};
380283

381284
const struct snd_motu_spec snd_motu_spec_traveler = {
382285
.name = "Traveler",
383286
.protocol_version = SND_MOTU_PROTOCOL_V2,
384-
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
385-
SND_MOTU_SPEC_SUPPORT_CLOCK_X4 |
386-
SND_MOTU_SPEC_TX_RETURN_CHUNK |
387-
SND_MOTU_SPEC_HAS_AESEBU_IFACE |
388-
SND_MOTU_SPEC_HAS_OPT_IFACE_A |
389-
SND_MOTU_SPEC_RX_MIDI_2ND_Q |
287+
.flags = SND_MOTU_SPEC_RX_MIDI_2ND_Q |
390288
SND_MOTU_SPEC_TX_MIDI_2ND_Q,
391289
.tx_fixed_pcm_chunks = {14, 14, 8},
392290
.rx_fixed_pcm_chunks = {14, 14, 8},
393-
.analog_in_ports = 8,
394-
.analog_out_ports = 8,
395291
};
396292

397293
const struct snd_motu_spec snd_motu_spec_ultralite = {
398294
.name = "UltraLite",
399295
.protocol_version = SND_MOTU_PROTOCOL_V2,
400-
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
401-
SND_MOTU_SPEC_TX_MICINST_CHUNK | // padding.
402-
SND_MOTU_SPEC_TX_RETURN_CHUNK |
403-
SND_MOTU_SPEC_RX_MIDI_2ND_Q |
404-
SND_MOTU_SPEC_TX_MIDI_2ND_Q |
405-
SND_MOTU_SPEC_RX_SEPARATED_MAIN,
296+
.flags = SND_MOTU_SPEC_RX_MIDI_2ND_Q |
297+
SND_MOTU_SPEC_TX_MIDI_2ND_Q,
406298
.tx_fixed_pcm_chunks = {14, 14, 0},
407299
.rx_fixed_pcm_chunks = {14, 14, 0},
408-
.analog_in_ports = 8,
409-
.analog_out_ports = 8,
410300
};
411301

412302
const struct snd_motu_spec snd_motu_spec_8pre = {
413303
.name = "8pre",
414304
.protocol_version = SND_MOTU_PROTOCOL_V2,
415-
// In tx, use coax chunks for mix-return 1/2. In rx, use coax chunks for
416-
// dummy 1/2.
417-
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
418-
SND_MOTU_SPEC_HAS_OPT_IFACE_A |
419-
SND_MOTU_SPEC_HAS_OPT_IFACE_B |
420-
SND_MOTU_SPEC_RX_MIDI_2ND_Q |
305+
.flags = SND_MOTU_SPEC_RX_MIDI_2ND_Q |
421306
SND_MOTU_SPEC_TX_MIDI_2ND_Q,
422307
.tx_fixed_pcm_chunks = {10, 6, 0},
423308
.rx_fixed_pcm_chunks = {10, 6, 0},
424-
.analog_in_ports = 8,
425-
.analog_out_ports = 2,
426309
};

sound/firewire/motu/motu-protocol-v3.c

Lines changed: 2 additions & 156 deletions
Original file line numberDiff line numberDiff line change
@@ -158,124 +158,6 @@ int snd_motu_protocol_v3_switch_fetching_mode(struct snd_motu *motu,
158158
sizeof(reg));
159159
}
160160

161-
static void calculate_fixed_part(struct snd_motu_packet_format *formats,
162-
enum amdtp_stream_direction dir,
163-
enum snd_motu_spec_flags flags,
164-
unsigned char analog_ports)
165-
{
166-
unsigned char pcm_chunks[3] = {0, 0, 0};
167-
168-
pcm_chunks[0] = analog_ports;
169-
pcm_chunks[1] = analog_ports;
170-
if (flags & SND_MOTU_SPEC_SUPPORT_CLOCK_X4)
171-
pcm_chunks[2] = analog_ports;
172-
173-
if (dir == AMDTP_IN_STREAM) {
174-
if (flags & SND_MOTU_SPEC_TX_MICINST_CHUNK) {
175-
pcm_chunks[0] += 2;
176-
pcm_chunks[1] += 2;
177-
if (flags & SND_MOTU_SPEC_SUPPORT_CLOCK_X4)
178-
pcm_chunks[2] += 2;
179-
}
180-
181-
if (flags & SND_MOTU_SPEC_TX_RETURN_CHUNK) {
182-
pcm_chunks[0] += 2;
183-
pcm_chunks[1] += 2;
184-
if (flags & SND_MOTU_SPEC_SUPPORT_CLOCK_X4)
185-
pcm_chunks[2] += 2;
186-
}
187-
188-
if (flags & SND_MOTU_SPEC_TX_REVERB_CHUNK) {
189-
pcm_chunks[0] += 2;
190-
pcm_chunks[1] += 2;
191-
}
192-
} else {
193-
if (flags & SND_MOTU_SPEC_RX_SEPARATED_MAIN) {
194-
pcm_chunks[0] += 2;
195-
pcm_chunks[1] += 2;
196-
}
197-
198-
// Packets to v3 units include 2 chunks for phone 1/2, except
199-
// for 176.4/192.0 kHz.
200-
pcm_chunks[0] += 2;
201-
pcm_chunks[1] += 2;
202-
}
203-
204-
if (flags & SND_MOTU_SPEC_HAS_AESEBU_IFACE) {
205-
pcm_chunks[0] += 2;
206-
pcm_chunks[1] += 2;
207-
}
208-
209-
/*
210-
* At least, packets have two data chunks for S/PDIF on coaxial
211-
* interface.
212-
*/
213-
pcm_chunks[0] += 2;
214-
pcm_chunks[1] += 2;
215-
216-
/*
217-
* Fixed part consists of PCM chunks multiple of 4, with msg chunks. As
218-
* a result, this part can includes empty data chunks.
219-
*/
220-
formats->fixed_part_pcm_chunks[0] = round_up(2 + pcm_chunks[0], 4) - 2;
221-
formats->fixed_part_pcm_chunks[1] = round_up(2 + pcm_chunks[1], 4) - 2;
222-
if (flags & SND_MOTU_SPEC_SUPPORT_CLOCK_X4)
223-
formats->fixed_part_pcm_chunks[2] =
224-
round_up(2 + pcm_chunks[2], 4) - 2;
225-
}
226-
227-
static void calculate_differed_part(struct snd_motu_packet_format *formats,
228-
enum snd_motu_spec_flags flags, u32 data,
229-
u32 a_enable_mask, u32 a_no_adat_mask,
230-
u32 b_enable_mask, u32 b_no_adat_mask)
231-
{
232-
unsigned char pcm_chunks[3] = {0, 0, 0};
233-
int i;
234-
235-
if ((flags & SND_MOTU_SPEC_HAS_OPT_IFACE_A) && (data & a_enable_mask)) {
236-
if (data & a_no_adat_mask) {
237-
/*
238-
* Additional two data chunks for S/PDIF on optical
239-
* interface A. This includes empty data chunks.
240-
*/
241-
pcm_chunks[0] += 4;
242-
pcm_chunks[1] += 4;
243-
} else {
244-
/*
245-
* Additional data chunks for ADAT on optical interface
246-
* A.
247-
*/
248-
pcm_chunks[0] += 8;
249-
pcm_chunks[1] += 4;
250-
}
251-
}
252-
253-
if ((flags & SND_MOTU_SPEC_HAS_OPT_IFACE_B) && (data & b_enable_mask)) {
254-
if (data & b_no_adat_mask) {
255-
/*
256-
* Additional two data chunks for S/PDIF on optical
257-
* interface B. This includes empty data chunks.
258-
*/
259-
pcm_chunks[0] += 4;
260-
pcm_chunks[1] += 4;
261-
} else {
262-
/*
263-
* Additional data chunks for ADAT on optical interface
264-
* B.
265-
*/
266-
pcm_chunks[0] += 8;
267-
pcm_chunks[1] += 4;
268-
}
269-
}
270-
271-
for (i = 0; i < 3; ++i) {
272-
if (pcm_chunks[i] > 0)
273-
pcm_chunks[i] = round_up(pcm_chunks[i], 4);
274-
275-
formats->differed_part_pcm_chunks[i] = pcm_chunks[i];
276-
}
277-
}
278-
279161
static int detect_packet_formats_828mk3(struct snd_motu *motu, u32 data)
280162
{
281163
if (data & V3_ENABLE_OPT_IN_IFACE_A) {
@@ -339,20 +221,6 @@ int snd_motu_protocol_v3_cache_packet_formats(struct snd_motu *motu)
339221
return err;
340222
data = be32_to_cpu(reg);
341223

342-
calculate_fixed_part(&motu->tx_packet_formats, AMDTP_IN_STREAM,
343-
motu->spec->flags, motu->spec->analog_in_ports);
344-
calculate_differed_part(&motu->tx_packet_formats,
345-
motu->spec->flags, data,
346-
V3_ENABLE_OPT_IN_IFACE_A, V3_NO_ADAT_OPT_IN_IFACE_A,
347-
V3_ENABLE_OPT_IN_IFACE_B, V3_NO_ADAT_OPT_IN_IFACE_B);
348-
349-
calculate_fixed_part(&motu->rx_packet_formats, AMDTP_OUT_STREAM,
350-
motu->spec->flags, motu->spec->analog_out_ports);
351-
calculate_differed_part(&motu->rx_packet_formats,
352-
motu->spec->flags, data,
353-
V3_ENABLE_OPT_OUT_IFACE_A, V3_NO_ADAT_OPT_OUT_IFACE_A,
354-
V3_ENABLE_OPT_OUT_IFACE_B, V3_NO_ADAT_OPT_OUT_IFACE_B);
355-
356224
memcpy(motu->tx_packet_formats.pcm_chunks,
357225
motu->spec->tx_fixed_pcm_chunks,
358226
sizeof(motu->tx_packet_formats.pcm_chunks));
@@ -370,46 +238,24 @@ int snd_motu_protocol_v3_cache_packet_formats(struct snd_motu *motu)
370238
const struct snd_motu_spec snd_motu_spec_828mk3 = {
371239
.name = "828mk3",
372240
.protocol_version = SND_MOTU_PROTOCOL_V3,
373-
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
374-
SND_MOTU_SPEC_SUPPORT_CLOCK_X4 |
375-
SND_MOTU_SPEC_TX_MICINST_CHUNK |
376-
SND_MOTU_SPEC_TX_RETURN_CHUNK |
377-
SND_MOTU_SPEC_TX_REVERB_CHUNK |
378-
SND_MOTU_SPEC_RX_SEPARATED_MAIN |
379-
SND_MOTU_SPEC_HAS_OPT_IFACE_A |
380-
SND_MOTU_SPEC_HAS_OPT_IFACE_B |
381-
SND_MOTU_SPEC_RX_MIDI_3RD_Q |
241+
.flags = SND_MOTU_SPEC_RX_MIDI_3RD_Q |
382242
SND_MOTU_SPEC_TX_MIDI_3RD_Q,
383243
.tx_fixed_pcm_chunks = {18, 18, 14},
384244
.rx_fixed_pcm_chunks = {14, 14, 10},
385-
.analog_in_ports = 8,
386-
.analog_out_ports = 8,
387245
};
388246

389247
const struct snd_motu_spec snd_motu_spec_audio_express = {
390248
.name = "AudioExpress",
391249
.protocol_version = SND_MOTU_PROTOCOL_V3,
392-
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
393-
SND_MOTU_SPEC_TX_MICINST_CHUNK |
394-
SND_MOTU_SPEC_TX_RETURN_CHUNK |
395-
SND_MOTU_SPEC_RX_SEPARATED_MAIN |
396-
SND_MOTU_SPEC_RX_MIDI_2ND_Q |
250+
.flags = SND_MOTU_SPEC_RX_MIDI_2ND_Q |
397251
SND_MOTU_SPEC_TX_MIDI_3RD_Q,
398252
.tx_fixed_pcm_chunks = {10, 10, 0},
399253
.rx_fixed_pcm_chunks = {10, 10, 0},
400-
.analog_in_ports = 2,
401-
.analog_out_ports = 4,
402254
};
403255

404256
const struct snd_motu_spec snd_motu_spec_4pre = {
405257
.name = "4pre",
406258
.protocol_version = SND_MOTU_PROTOCOL_V3,
407-
.flags = SND_MOTU_SPEC_SUPPORT_CLOCK_X2 |
408-
SND_MOTU_SPEC_TX_MICINST_CHUNK |
409-
SND_MOTU_SPEC_TX_RETURN_CHUNK |
410-
SND_MOTU_SPEC_RX_SEPARATED_MAIN,
411259
.tx_fixed_pcm_chunks = {10, 10, 0},
412260
.rx_fixed_pcm_chunks = {10, 10, 0},
413-
.analog_in_ports = 2,
414-
.analog_out_ports = 2,
415261
};

0 commit comments

Comments
 (0)