ALSA: firewire-tascam: pick up data of state from tx isochronous pakcets
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>
Fri, 23 Nov 2018 04:13:03 +0000 (13:13 +0900)
committerTakashi Iwai <tiwai@suse.de>
Fri, 23 Nov 2018 14:31:08 +0000 (15:31 +0100)
Units of TASCAM FireWire series multiplex PCM frames and state of
control surface into the same tx isochronous packets. One isochronous
packet includes a part of the state in a quadlet data. An image of the
state consists of 64 quadlet data.

This commit demultiplexes the state from tx isochronous packets.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
include/uapi/sound/firewire.h
sound/firewire/tascam/amdtp-tascam.c
sound/firewire/tascam/tascam.h

index f0a547d86679792d8a21a3c9a95e320cee71f3d6..b9bc4bb1756b5a7823aedace751e1ed47a1e06ea 100644 (file)
@@ -88,4 +88,6 @@ struct snd_firewire_get_info {
  * Returns -EBUSY if the driver is already streaming.
  */
 
+#define SNDRV_FIREWIRE_TASCAM_STATE_COUNT      64
+
 #endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */
index ab482423c16545d3161e04d7d8e78f614b3b70ea..516cb931fd5e4cca582bac28559fa5f74e33b0c9 100644 (file)
@@ -117,6 +117,21 @@ int amdtp_tscm_add_pcm_hw_constraints(struct amdtp_stream *s,
        return amdtp_stream_add_pcm_hw_constraints(s, runtime);
 }
 
+static void read_status_messages(struct amdtp_stream *s,
+                                __be32 *buffer, unsigned int data_blocks)
+{
+       struct snd_tscm *tscm = container_of(s, struct snd_tscm, tx_stream);
+       int i;
+
+       for (i = 0; i < data_blocks; i++) {
+               unsigned int index;
+
+               index = be32_to_cpu(buffer[0]) % SNDRV_FIREWIRE_TASCAM_STATE_COUNT;
+               tscm->state[index] = buffer[s->data_block_quadlets - 1];
+               buffer += s->data_block_quadlets;
+       }
+}
+
 static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
                                           __be32 *buffer,
                                           unsigned int data_blocks,
@@ -128,7 +143,7 @@ static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
        if (data_blocks > 0 && pcm)
                read_pcm_s32(s, pcm, buffer, data_blocks);
 
-       /* A place holder for control messages. */
+       read_status_messages(s, buffer, data_blocks);
 
        return data_blocks;
 }
index a5bd167eb5d99232d2e47449ca1030877c23a738..c710496a99cf610318c86bc93ddb9f9ff8602e43 100644 (file)
@@ -89,6 +89,9 @@ struct snd_tscm {
 
        /* For MIDI message outgoing transactions. */
        struct snd_fw_async_midi_port out_ports[TSCM_MIDI_OUT_PORT_MAX];
+
+       // A cache of status information in tx isoc packets.
+       __be32 state[SNDRV_FIREWIRE_TASCAM_STATE_COUNT];
 };
 
 #define TSCM_ADDR_BASE                 0xffff00000000ull