diff mbox series

ALSA: firewire-tascam: add note for FE-8

Message ID 20190906125544.13800-1-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show
Series ALSA: firewire-tascam: add note for FE-8 | expand

Commit Message

Takashi Sakamoto Sept. 6, 2019, 12:55 p.m. UTC
TASCAM FE-8 is the rest of model in TASCAM FireWire series. This device
has no functionality to process audio signal and MIDI messages. Instead,
it transfers control messages to host system corresponding to operations
for some faders, buttons and knobs on its surface.

Unlike the other devices in this series, the control messages are
transmitted by asynchronous transactions. Some registers of device are
used for registration of destination address for the transaction. The
transaction includes quadlet-aligned data up to 32 quadlets.

Userspace applications can receive the transaction and parse it for
control message via Linux FireWire subsystem, without any support by
ALSA firewire-tascam driver. Therefore the driver gives no support
for it.

This commit removes placeholder for FE-8 and add some comment for its
functionalities as notes.

$ python2 linux-firewire-utils/src/crpp < ~/git/am-config-rom/tascam/tascam-fe8.img
               ROM header and bus information block
               -----------------------------------------------------------------
400  040f4798  bus_info_length 4, crc_length 15, crc 18328 (should be 14256)
404  31333934  bus_name "1394"
408  20ff7002  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256)
40c  00022eff  company_id 00022e     |
410  a094dcb7  device_id ffa094dcb7  | EUI-64 00022effa094dcb7

               root directory
               -----------------------------------------------------------------
414  0004bccc  directory_length 4, crc 48332
418  0300022e  vendor
41c  0c0083c0  node capabilities per IEEE 1394
420  8d000006  --> eui-64 leaf at 438
424  d1000001  --> unit directory at 428

               unit directory at 428
               -----------------------------------------------------------------
428  0003eda4  directory_length 3, crc 60836
42c  1200022e  specifier id
430  13800001  version
434  d4000004  --> dependent info directory at 444

               eui-64 leaf at 438
               -----------------------------------------------------------------
438  0002461e  leaf_length 2, crc 17950
43c  00022eff  company_id 00022e     |
440  a094dcb7  device_id ffa094dcb7  | EUI-64 00022effa094dcb7

               dependent info directory at 444
               -----------------------------------------------------------------
444  0002ae47  directory_length 2, crc 44615
448  81000002  --> descriptor leaf at 450
44c  82000006  --> bus dependent info leaf at 464

               descriptor leaf at 450
               -----------------------------------------------------------------
450  0004a79e  leaf_length 4, crc 42910
454  00000000  textual descriptor
458  00000000  minimal ASCII
45c  54415343  "TASC"
460  414d0000  "AM"

               bus dependent info leaf at 464
               -----------------------------------------------------------------
464  0004a7d8  leaf_length 4, crc 42968
468  00000000
46c  00000000
470  46452d38
474  00000000

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/tascam/tascam.c |  4 +++-
 sound/firewire/tascam/tascam.h | 20 ++++++++++++++++++++
 2 files changed, 23 insertions(+), 1 deletion(-)

Comments

Takashi Iwai Sept. 6, 2019, 1 p.m. UTC | #1
On Fri, 06 Sep 2019 14:55:44 +0200,
Takashi Sakamoto wrote:
> 
> TASCAM FE-8 is the rest of model in TASCAM FireWire series. This device
> has no functionality to process audio signal and MIDI messages. Instead,
> it transfers control messages to host system corresponding to operations
> for some faders, buttons and knobs on its surface.
> 
> Unlike the other devices in this series, the control messages are
> transmitted by asynchronous transactions. Some registers of device are
> used for registration of destination address for the transaction. The
> transaction includes quadlet-aligned data up to 32 quadlets.
> 
> Userspace applications can receive the transaction and parse it for
> control message via Linux FireWire subsystem, without any support by
> ALSA firewire-tascam driver. Therefore the driver gives no support
> for it.
> 
> This commit removes placeholder for FE-8 and add some comment for its
> functionalities as notes.
> 
> $ python2 linux-firewire-utils/src/crpp < ~/git/am-config-rom/tascam/tascam-fe8.img
>                ROM header and bus information block
>                -----------------------------------------------------------------
> 400  040f4798  bus_info_length 4, crc_length 15, crc 18328 (should be 14256)
> 404  31333934  bus_name "1394"
> 408  20ff7002  irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 255, max_rec 7 (256)
> 40c  00022eff  company_id 00022e     |
> 410  a094dcb7  device_id ffa094dcb7  | EUI-64 00022effa094dcb7
> 
>                root directory
>                -----------------------------------------------------------------
> 414  0004bccc  directory_length 4, crc 48332
> 418  0300022e  vendor
> 41c  0c0083c0  node capabilities per IEEE 1394
> 420  8d000006  --> eui-64 leaf at 438
> 424  d1000001  --> unit directory at 428
> 
>                unit directory at 428
>                -----------------------------------------------------------------
> 428  0003eda4  directory_length 3, crc 60836
> 42c  1200022e  specifier id
> 430  13800001  version
> 434  d4000004  --> dependent info directory at 444
> 
>                eui-64 leaf at 438
>                -----------------------------------------------------------------
> 438  0002461e  leaf_length 2, crc 17950
> 43c  00022eff  company_id 00022e     |
> 440  a094dcb7  device_id ffa094dcb7  | EUI-64 00022effa094dcb7
> 
>                dependent info directory at 444
>                -----------------------------------------------------------------
> 444  0002ae47  directory_length 2, crc 44615
> 448  81000002  --> descriptor leaf at 450
> 44c  82000006  --> bus dependent info leaf at 464
> 
>                descriptor leaf at 450
>                -----------------------------------------------------------------
> 450  0004a79e  leaf_length 4, crc 42910
> 454  00000000  textual descriptor
> 458  00000000  minimal ASCII
> 45c  54415343  "TASC"
> 460  414d0000  "AM"
> 
>                bus dependent info leaf at 464
>                -----------------------------------------------------------------
> 464  0004a7d8  leaf_length 4, crc 42968
> 468  00000000
> 46c  00000000
> 470  46452d38
> 474  00000000
> 
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Applied, thanks.


Takashi
Takashi Sakamoto Sept. 6, 2019, 2:18 p.m. UTC | #2
On Fri, Sep 06, 2019 at 09:55:44PM +0900, Takashi Sakamoto wrote:
> Userspace applications can receive the transaction and parse it for
> control message via Linux FireWire subsystem, without any support by
> ALSA firewire-tascam driver. Therefore the driver gives no support
> for it.

For your information, this is a sample Python 3 script to listen the
transactions, utilizing PyGObject to load Hinawa-2.0 g-i.

```
#!/usr/bin/env python3

import gi
gi.require_version('Hinawa', '2.0')
from gi.repository import Hinawa

gi.require_version('GLib', '2.0')
from gi.repository import GLib

from signal import SIGINT
from struct import unpack, pack
from time import sleep

# Allocate address space to receive notification.
class Fe8Responder(Hinawa.FwResp):
    def __init__(self, unit):
        super().__init__()

        # Allocate within private space.
        addr = 0xffffe0000000
        while addr < 0xfffff0000000:
            try:
                self.register(unit, addr, 0x80)
                break
            except:
                addr += 0x80

        self.addr = addr

    def do_requested(self, tcode):
        frames = self.get_req_frame()

        # Just print the event. Practically translate it to general MIDI
        # messages and send the messages to the other processes via IPC such as
        # ALSA Sequencer.
        for i in range(0, len(frames), 4):
            print('{:08x}'.format(unpack('>I', frames[i:i+4])[0]))

        return Hinawa.FwRcode.COMPLETE


# For a case that the device is detected as '/dev/fw1'.
unit = Hinawa.FwUnit()
unit.open('/dev/fw1')
unit.listen()
resp = Fe8Responder(unit)

req = Hinawa.FwReq()

# Register the address.
addr_hi = pack('>H', unit.get_property('local-node-id'))
addr_hi += pack('>H', (resp.addr & 0xffff00000000) >> 32)
addr_lo = pack('>I', resp.addr & 0xffffffff)
req.write(unit, 0xffff00000314, addr_hi)
req.write(unit, 0xffff00000318, addr_lo)

# Enable notification.
req.write(unit, 0xffff00000310, pack('>I', 1))

# Turn on FireWire LED.
data = [0x00, 0x01, 0x00, 0x8e]
req.write(unit, 0xffff00000404, data)

# Wait for events.
def handle_unix_signal(loop):
    loop.quit()
loop = GLib.MainLoop()
GLib.unix_signal_add(GLib.PRIORITY_HIGH, SIGINT, handle_unix_signal, loop)
loop.run()

# Disable notification.
req.write(unit, 0xffff00000310, pack('>I', 0))

# Turn off FireWire LED.
data = [0x00, 0x00, 0x00, 0x8e]
req.write(unit, 0xffff00000404, data)

del req
del resp
del unit
```


Regards

Takashi Sakamoto
diff mbox series

Patch

diff --git a/sound/firewire/tascam/tascam.c b/sound/firewire/tascam/tascam.c
index 231052db5680..addc464503bc 100644
--- a/sound/firewire/tascam/tascam.c
+++ b/sound/firewire/tascam/tascam.c
@@ -39,6 +39,9 @@  static const struct snd_tscm_spec model_specs[] = {
 		.midi_capture_ports = 2,
 		.midi_playback_ports = 4,
 	},
+	// This kernel module doesn't support FE-8 because the most of features
+	// can be implemented in userspace without any specific support of this
+	// module.
 };
 
 static int identify_model(struct snd_tscm *tscm)
@@ -214,7 +217,6 @@  static const struct ieee1394_device_id snd_tscm_id_table[] = {
 		.vendor_id = 0x00022e,
 		.specifier_id = 0x00022e,
 	},
-	/* FE-08 requires reverse-engineering because it just has faders. */
 	{}
 };
 MODULE_DEVICE_TABLE(ieee1394, snd_tscm_id_table);
diff --git a/sound/firewire/tascam/tascam.h b/sound/firewire/tascam/tascam.h
index 64a2e4d2bbfe..15bd335fa07f 100644
--- a/sound/firewire/tascam/tascam.h
+++ b/sound/firewire/tascam/tascam.h
@@ -129,6 +129,26 @@  struct snd_tscm {
 
 #define TSCM_OFFSET_MIDI_RX_QUAD	0x4000
 
+// Although FE-8 supports the above registers, it has no I/O interfaces for
+// audio samples and music messages. Otherwise it supports another notification
+// for status and control message as well as LED brightening. The message
+// consists of quadlet-aligned data up to 32 quadlets. The first byte of message
+// is fixed to 0x40. The second byte is between 0x00 to 0x1f and represent each
+// control:
+//   fader:	0x00-0x07
+//   button:	0x0d, 0x0e
+//   knob:	0x14-0x1b
+//   sensing:	0x0b
+//
+// The rest two bytes represent state of the controls; e.g. current value for
+// fader and knob, bitmasks for button and sensing.
+// Just after turning on, 32 quadlets messages with 0x00-0x1f are immediately
+// sent in one transaction. After, several quadlets are sent in one transaction.
+//
+// TSCM_OFFSET_FE8_CTL_TX_ON		0x0310
+// TSCM_OFFSET_FE8_CTL_TX_ADDR_HI	0x0314
+// TSCM_OFFSET_FE8_CTL_TX_ADDR_LO	0x0318
+
 enum snd_tscm_clock {
 	SND_TSCM_CLOCK_INTERNAL = 0,
 	SND_TSCM_CLOCK_WORD	= 1,