ALSA: fireface: code refactoring to handle model-specific registers
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Sun, 16 Dec 2018 08:32:33 +0000 (17:32 +0900)
committerTakashi Iwai <tiwai@suse.de>
Sun, 16 Dec 2018 09:18:31 +0000 (10:18 +0100)
As a result of investigation for Fireface 800, 'struct snd_ff_spec.regs'
is just for higher address to receive tx asynchronous packets of MIDI
messages, thus it can be simplified.

This commit simplifies it.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
sound/firewire/fireface/ff-transaction.c
sound/firewire/fireface/ff.c
sound/firewire/fireface/ff.h

index d8768348067ba27896d12b2e113bde8a0dff1e5a..5f4ddfd55403a35ae4cb2f29f82ff23ee585292f 100644 (file)
@@ -278,7 +278,7 @@ int snd_ff_transaction_reregister(struct snd_ff *ff)
        addr = (fw_card->node_id << 16) | (ff->async_handler.offset >> 32);
        reg = cpu_to_le32(addr);
        return snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST,
-                                 ff->spec->regs[SND_FF_REG_TYPE_MIDI_HIGH_ADDR],
+                                 ff->spec->midi_high_addr,
                                  &reg, sizeof(reg), 0);
 }
 
@@ -319,7 +319,7 @@ void snd_ff_transaction_unregister(struct snd_ff *ff)
        /* Release higher 4 bytes of address. */
        reg = cpu_to_le32(0x00000000);
        snd_fw_transaction(ff->unit, TCODE_WRITE_QUADLET_REQUEST,
-                          ff->spec->regs[SND_FF_REG_TYPE_MIDI_HIGH_ADDR],
+                          ff->spec->midi_high_addr,
                           &reg, sizeof(reg), 0);
 
        fw_core_remove_address_handler(&ff->async_handler);
index f7a752930060ae1855fc6981fae884ae325e0e4e..36575f4159d13cc0be238ba25704521fb718e711 100644 (file)
@@ -152,9 +152,7 @@ static const struct snd_ff_spec spec_ff800 = {
        .midi_in_ports = 1,
        .midi_out_ports = 1,
        .protocol = &snd_ff_protocol_ff800,
-       .regs = {
-               [SND_FF_REG_TYPE_MIDI_HIGH_ADDR] = 0x000200000320ull,
-       },
+       .midi_high_addr = 0x000200000320ull,
 };
 
 static const struct snd_ff_spec spec_ff400 = {
@@ -164,9 +162,7 @@ static const struct snd_ff_spec spec_ff400 = {
        .midi_in_ports = 2,
        .midi_out_ports = 2,
        .protocol = &snd_ff_protocol_ff400,
-       .regs = {
-               [SND_FF_REG_TYPE_MIDI_HIGH_ADDR] = 0x0000801003f4ull,
-       },
+       .midi_high_addr = 0x0000801003f4ull,
 };
 
 static const struct ieee1394_device_id snd_ff_id_table[] = {
index 9fdda4fbdbba0a50e9a5df6e51d06378ab4f7de5..7dfc7745a9141f2780db3d3ba432ad2c3d2b5b11 100644 (file)
@@ -36,7 +36,7 @@
 #define SND_FF_OUT_MIDI_PORTS          2
 
 #define SND_FF_REG_SYNC_STATUS         0x0000801c0000ull
-/* For block wriet request. */
+/* For block write request. */
 #define SND_FF_REG_FETCH_PCM_FRAMES    0x0000801c0000ull
 #define SND_FF_REG_CLOCK_CONFIG                0x0000801c0004ull
 
@@ -47,11 +47,6 @@ enum snd_ff_stream_mode {
        SND_FF_STREAM_MODE_COUNT,
 };
 
-enum snd_ff_reg_type {
-       SND_FF_REG_TYPE_MIDI_HIGH_ADDR = 0,
-       SND_FF_REG_TYPE_COUNT,
-};
-
 struct snd_ff_protocol;
 struct snd_ff_spec {
        const char *const name;
@@ -63,7 +58,7 @@ struct snd_ff_spec {
        unsigned int midi_out_ports;
 
        const struct snd_ff_protocol *protocol;
-       u64 regs[SND_FF_REG_TYPE_COUNT];
+       u64 midi_high_addr;
 };
 
 struct snd_ff {