[alsa-devel] Old firmware version for Dice II ASIC

Takashi Sakamoto o-takashi at sakamocchi.jp
Wed Apr 18 12:24:18 CEST 2018


Hi Clemens,

Recently I get Alesis Multimix 12 FireWire and work for ALSA dice driver
to support it. This unit uses ASIC of 'WaveFront DICE II STD' and TCAT
extended application protocol is not supported.

Unfortunately, the driver in v4.17-rc1 can't handle this unit, due to
validation of address sections for global space.

$ dmesg
snd_dice fw1.0: Sound card registration failed: -19

(sound/firewire/dice/dice-transaction.c)
265 static int get_subaddrs(struct snd_dice *dice)
266 {
267     static const int min_values[10] = {
268             10, 0x64 / 4,
269             10, 0x18 / 4,
270             10, 0x18 / 4,
271             0, 0,
272             0, 0,
273     };
         ...
290     err = snd_fw_transaction(dice->unit, TCODE_READ_BLOCK_REQUEST,
291                      DICE_PRIVATE_SPACE, pointers,
292                      sizeof(__be32) * ARRAY_SIZE(min_values), 0);
293     if (err < 0)
294         goto end;
295
296     for (i = 0; i < ARRAY_SIZE(min_values); ++i) {
297         data = be32_to_cpu(pointers[i]);
298         if (data < min_values[i] || data >= 0x40000) {
299             err = -ENODEV;
300             goto end;
301         }
302     }

The condition 'data < min_values[i]' is evaluated as true at a second
iteration (i = 1). A quadlet of 0xffffe0000004-7 has 0x000018 and this
is less than 0x19 (= 0x64 / 4) in fact.

$ ./firewire-request /dev/fw1 read 0xffffe0000000 28
result: 000: 00 00 00 0a 00 00 00 18 00 00 00 22 00 00 00 8a
result: 010: 00 00 00 ac 00 00 01 12 00 00 00 00 00 00 00 00
result: 020: 00 00 00 00 00 00 00 00

In line 183 of 'sound/firewire/dice/dice-interface.h', I can see below
comments:

(sound/firewire/dice/dice-interface.h)
175 #define GLOBAL_SAMPLE_RATE              0x05c
...
181 #define GLOBAL_VERSION                  0x060
182
183 /* Some old firmware versions do not have the following global 
registers: */
...
188 #define GLOBAL_CLOCK_CAPABILITIES       0x064

But this is not proper in my case because the maximum offset on global
sub-address space is 0x05c in quadlet unit.

Well, this unit supports 44.1/48.0 kHz and use internal/Rx1 as its
sampling clock source according to user manual. This is what in
'check_clock_caps()'.

(sound/firewire/dice/dice.c)
  96 static int check_clock_caps(struct snd_dice *dice)
  97 {
101     /* some very old firmwares don't tell about their clock support */
102     if (dice->clock_caps > 0) {
         ...
109     } else {
110         /* this should be supported by any device */
111         dice->clock_caps = CLOCK_CAP_RATE_44100 |
112                            CLOCK_CAP_RATE_48000 |
113                            CLOCK_CAP_SOURCE_ARX1 |
114                            CLOCK_CAP_SOURCE_INTERNAL;
115     }

In my opinion, GLOBAL_VERSION offset belongs to global address space for
newer firmware version. Would I request any comment to you for this
idea?


Regards

Takashi Sakamoto


More information about the Alsa-devel mailing list