Skip to content

Commit 33b2e14

Browse files
takaswietiwai
authored andcommitted
ALSA: firewire-tascam: pick up data of state from tx isochronous pakcets
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>
1 parent c12faa2 commit 33b2e14

3 files changed

Lines changed: 21 additions & 1 deletion

File tree

‎include/uapi/sound/firewire.h‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,4 +88,6 @@ struct snd_firewire_get_info {
8888
* Returns -EBUSY if the driver is already streaming.
8989
*/
9090

91+
#define SNDRV_FIREWIRE_TASCAM_STATE_COUNT 64
92+
9193
#endif /* _UAPI_SOUND_FIREWIRE_H_INCLUDED */

‎sound/firewire/tascam/amdtp-tascam.c‎

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -117,6 +117,21 @@ int amdtp_tscm_add_pcm_hw_constraints(struct amdtp_stream *s,
117117
return amdtp_stream_add_pcm_hw_constraints(s, runtime);
118118
}
119119

120+
static void read_status_messages(struct amdtp_stream *s,
121+
__be32 *buffer, unsigned int data_blocks)
122+
{
123+
struct snd_tscm *tscm = container_of(s, struct snd_tscm, tx_stream);
124+
int i;
125+
126+
for (i = 0; i < data_blocks; i++) {
127+
unsigned int index;
128+
129+
index = be32_to_cpu(buffer[0]) % SNDRV_FIREWIRE_TASCAM_STATE_COUNT;
130+
tscm->state[index] = buffer[s->data_block_quadlets - 1];
131+
buffer += s->data_block_quadlets;
132+
}
133+
}
134+
120135
static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
121136
__be32 *buffer,
122137
unsigned int data_blocks,
@@ -128,7 +143,7 @@ static unsigned int process_tx_data_blocks(struct amdtp_stream *s,
128143
if (data_blocks > 0 && pcm)
129144
read_pcm_s32(s, pcm, buffer, data_blocks);
130145

131-
/* A place holder for control messages. */
146+
read_status_messages(s, buffer, data_blocks);
132147

133148
return data_blocks;
134149
}

‎sound/firewire/tascam/tascam.h‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -89,6 +89,9 @@ struct snd_tscm {
8989

9090
/* For MIDI message outgoing transactions. */
9191
struct snd_fw_async_midi_port out_ports[TSCM_MIDI_OUT_PORT_MAX];
92+
93+
// A cache of status information in tx isoc packets.
94+
__be32 state[SNDRV_FIREWIRE_TASCAM_STATE_COUNT];
9295
};
9396

9497
#define TSCM_ADDR_BASE 0xffff00000000ull

0 commit comments

Comments
 (0)