diff mbox series

[2/6] ALSA: fireface: pick up time stamp for request subaction of asynchronous transaction

Message ID 20230112120954.500692-3-o-takashi@sakamocchi.jp
State Accepted
Commit 4bdcb8d28f3af8ea54906d0135f4a93b3dfcb4d5
Headers show
Series ALSA: fireface: support knob control event for Fireface 400 | expand

Commit Message

Takashi Sakamoto Jan. 12, 2023, 12:09 p.m. UTC
The time stamp of isochronous cycle at which asynchronous transaction is
sent is perhaps useful somehow. A commit b2405aa948b9 ("firewire: add
kernel API to access packet structure in request structure for AR context")
adds kernel API to retrieve the time stamp in inner structure of request
subaction.

This commit changes local framework to handle message delivered by the
asynchronous transaction so that time stamp is picked up by the kernel API.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/fireface/ff-protocol-former.c | 4 ++--
 sound/firewire/fireface/ff-protocol-latter.c | 2 +-
 sound/firewire/fireface/ff-transaction.c     | 3 ++-
 sound/firewire/fireface/ff.h                 | 2 +-
 4 files changed, 6 insertions(+), 5 deletions(-)
diff mbox series

Patch

diff --git a/sound/firewire/fireface/ff-protocol-former.c b/sound/firewire/fireface/ff-protocol-former.c
index 16afcb334e3c..22d6aee52de3 100644
--- a/sound/firewire/fireface/ff-protocol-former.c
+++ b/sound/firewire/fireface/ff-protocol-former.c
@@ -403,7 +403,7 @@  static void ff800_finish_session(struct snd_ff *ff)
 // A write transaction to clear registered higher 4 bytes of destination address
 // has an effect to suppress asynchronous transaction from device.
 static void ff800_handle_midi_msg(struct snd_ff *ff, unsigned int offset, const __le32 *buf,
-				  size_t length)
+				  size_t length, u32 tstamp)
 {
 	int i;
 
@@ -554,7 +554,7 @@  static void ff400_finish_session(struct snd_ff *ff)
 // in its lower offset and expects userspace application to configure the
 // register for it.
 static void ff400_handle_msg(struct snd_ff *ff, unsigned int offset, const __le32 *buf,
-			     size_t length)
+			     size_t length, u32 tstamp)
 {
 	int i;
 
diff --git a/sound/firewire/fireface/ff-protocol-latter.c b/sound/firewire/fireface/ff-protocol-latter.c
index e7a066fb1ead..9947e0c2e0aa 100644
--- a/sound/firewire/fireface/ff-protocol-latter.c
+++ b/sound/firewire/fireface/ff-protocol-latter.c
@@ -394,7 +394,7 @@  static void latter_dump_status(struct snd_ff *ff, struct snd_info_buffer *buffer
 // (0x'....'....'0000'0000) and expects userspace application to configure the
 // register for it.
 static void latter_handle_midi_msg(struct snd_ff *ff, unsigned int offset, const __le32 *buf,
-				   size_t length)
+				   size_t length, u32 tstamp)
 {
 	u32 data = le32_to_cpu(*buf);
 	unsigned int index = (data & 0x000000f0) >> 4;
diff --git a/sound/firewire/fireface/ff-transaction.c b/sound/firewire/fireface/ff-transaction.c
index 764c772a0b1e..79f733d8c98b 100644
--- a/sound/firewire/fireface/ff-transaction.c
+++ b/sound/firewire/fireface/ff-transaction.c
@@ -131,11 +131,12 @@  static void handle_msg(struct fw_card *card, struct fw_request *request, int tco
 {
 	struct snd_ff *ff = callback_data;
 	__le32 *buf = data;
+	u32 tstamp = fw_request_get_timestamp(request);
 
 	fw_send_response(card, request, RCODE_COMPLETE);
 
 	offset -= ff->async_handler.offset;
-	ff->spec->protocol->handle_msg(ff, (unsigned int)offset, buf, length);
+	ff->spec->protocol->handle_msg(ff, (unsigned int)offset, buf, length, tstamp);
 }
 
 static int allocate_own_address(struct snd_ff *ff, int i)
diff --git a/sound/firewire/fireface/ff.h b/sound/firewire/fireface/ff.h
index 0358b444bd01..f430ebe157b3 100644
--- a/sound/firewire/fireface/ff.h
+++ b/sound/firewire/fireface/ff.h
@@ -111,7 +111,7 @@  enum snd_ff_clock_src {
 
 struct snd_ff_protocol {
 	void (*handle_msg)(struct snd_ff *ff, unsigned int offset, const __le32 *buf,
-			   size_t length);
+			   size_t length, u32 tstamp);
 	int (*fill_midi_msg)(struct snd_ff *ff,
 			     struct snd_rawmidi_substream *substream,
 			     unsigned int port);