ALSA: firewire-motu: use 'version' field of unit directory to identify model
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 17 Mar 2019 06:49:29 +0000 (15:49 +0900)
committerTakashi Iwai <tiwai@suse.de>
Sun, 17 Mar 2019 07:07:21 +0000 (08:07 +0100)
Current ALSA firewire-motu driver uses the value of 'model' field
of unit directory in configuration ROM for modalias for MOTU
FireWire models. However, as long as I checked, Pre8 and
828mk3(Hybrid) have the same value for the field (=0x100800).

unit            | version   | model
--------------- | --------- | ----------
828mkII         | 0x000003  | 0x101800
Traveler        | 0x000009  | 0x107800
Pre8            | 0x00000f  | 0x100800 <-
828mk3(FW)      | 0x000015  | 0x106800
AudioExpress    | 0x000033  | 0x104800
828mk3(Hybrid)  | 0x000035  | 0x100800 <-

When updating firmware for MOTU 8pre FireWire from v1.0.0 to v1.0.3,
I got change of the value from 0x100800 to 0x103800. On the other
hand, the value of 'version' field is fixed to 0x00000f. As a quick
glance, the higher 12 bits of the value of 'version' field represent
firmware version, while the lower 12 bits is unknown.

By induction, the value of 'version' field represents actual model.

This commit changes modalias to match the value of 'version' field,
instead of 'model' field. For degug, long name of added sound card
includes hexadecimal value of 'model' field.

Fixes: 6c5e1ac0e144 ("ALSA: firewire-motu: add support for Motu Traveler")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Cc: <stable@vger.kernel.org> # v4.19+
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/motu/motu.c

index 220e619..513291b 100644 (file)
@@ -36,7 +36,7 @@ static void name_card(struct snd_motu *motu)
        fw_csr_iterator_init(&it, motu->unit->directory);
        while (fw_csr_iterator_next(&it, &key, &val)) {
                switch (key) {
-               case CSR_VERSION:
+               case CSR_MODEL:
                        version = val;
                        break;
                }
@@ -46,7 +46,7 @@ static void name_card(struct snd_motu *motu)
        strcpy(motu->card->shortname, motu->spec->name);
        strcpy(motu->card->mixername, motu->spec->name);
        snprintf(motu->card->longname, sizeof(motu->card->longname),
-                "MOTU %s (version:%d), GUID %08x%08x at %s, S%d",
+                "MOTU %s (version:%06x), GUID %08x%08x at %s, S%d",
                 motu->spec->name, version,
                 fw_dev->config_rom[3], fw_dev->config_rom[4],
                 dev_name(&motu->unit->device), 100 << fw_dev->max_speed);
@@ -237,20 +237,20 @@ static const struct snd_motu_spec motu_audio_express = {
 #define SND_MOTU_DEV_ENTRY(model, data)                        \
 {                                                      \
        .match_flags    = IEEE1394_MATCH_VENDOR_ID |    \
-                         IEEE1394_MATCH_MODEL_ID |     \
-                         IEEE1394_MATCH_SPECIFIER_ID,  \
+                         IEEE1394_MATCH_SPECIFIER_ID | \
+                         IEEE1394_MATCH_VERSION,       \
        .vendor_id      = OUI_MOTU,                     \
-       .model_id       = model,                        \
        .specifier_id   = OUI_MOTU,                     \
+       .version        = model,                        \
        .driver_data    = (kernel_ulong_t)data,         \
 }
 
 static const struct ieee1394_device_id motu_id_table[] = {
-       SND_MOTU_DEV_ENTRY(0x101800, &motu_828mk2),
-       SND_MOTU_DEV_ENTRY(0x107800, &snd_motu_spec_traveler),
-       SND_MOTU_DEV_ENTRY(0x106800, &motu_828mk3),     /* FireWire only. */
-       SND_MOTU_DEV_ENTRY(0x100800, &motu_828mk3),     /* Hybrid. */
-       SND_MOTU_DEV_ENTRY(0x104800, &motu_audio_express),
+       SND_MOTU_DEV_ENTRY(0x000003, &motu_828mk2),
+       SND_MOTU_DEV_ENTRY(0x000009, &snd_motu_spec_traveler),
+       SND_MOTU_DEV_ENTRY(0x000015, &motu_828mk3),     /* FireWire only. */
+       SND_MOTU_DEV_ENTRY(0x000035, &motu_828mk3),     /* Hybrid. */
+       SND_MOTU_DEV_ENTRY(0x000033, &motu_audio_express),
        { }
 };
 MODULE_DEVICE_TABLE(ieee1394, motu_id_table);