summaryrefslogtreecommitdiffstats
path: root/sound/firewire/motu/motu-protocol-v2.c
diff options
context:
space:
mode:
authorTakashi Sakamoto <o-takashi@sakamocchi.jp>2018-06-18 21:07:55 +0900
committerTakashi Iwai <tiwai@suse.de>2018-06-19 20:44:54 +0200
commit6c5e1ac0e144a8560cfa11bed8cdadab9491952f (patch)
treefc81fa115312cde25761858270c9cc4be96a01b4 /sound/firewire/motu/motu-protocol-v2.c
parent191ef57683aab1939d9b7afdc43f9213c21c5e1e (diff)
downloadblackbird-obmc-linux-6c5e1ac0e144a8560cfa11bed8cdadab9491952f.tar.gz
blackbird-obmc-linux-6c5e1ac0e144a8560cfa11bed8cdadab9491952f.zip
ALSA: firewire-motu: add support for Motu Traveler
This commit adds support for MOTU Traveler, launched in 2005, discontinued quite before. As a result, transmission of PCM frame and MIDI messages is available via ALSA PCM and RawMIDI/Sequencer interfaces. This model supports sampling transmission frequency up to 192.0 kHz, and AES/EBU on XLR interface and ADAT on optical interface. Unlike Motu 828MkII, Windows driver can switch fetching mode for DSP, like mute/unmute feature. Although this commit enables high sampling transmission frequency, actual sound from this model is not good. As long as I tested, it's silence at 176.4 kHz, and it includes hissing noise at 192.0 kHz. In my opinion, as I reported at 3526ce7f9ba7 ('ALSA: firewire-motu: add MOTU specific protocol layer'), timestamping on source packet header (SPH) may not still be good for this model as well. $ python2 crpp < /sys/bus/firewire/devices/fw1/config_rom ROM header and bus information block ----------------------------------------------------------------- 400 04106505 bus_info_length 4, crc_length 16, crc 25861 404 31333934 bus_name "1394" 408 20001000 irmc 0, cmc 0, isc 1, bmc 0, cyc_clk_acc 0, max_rec 1 (4) 40c 0001f200 company_id 0001f2 | 410 0001f32f device_id 000001f32f | EUI-64 0001f2000001f32f root directory ----------------------------------------------------------------- 414 0004c65c directory_length 4, crc 50780 418 030001f2 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 00035955 directory_length 3, crc 22869 42c 120001f2 specifier id 430 13000009 version 434 17107800 model eui-64 leaf at 438 ----------------------------------------------------------------- 438 000206b2 leaf_length 2, crc 1714 43c 0001f200 company_id 0001f2 | 440 0001f32f device_id 000001f32f | EUI-64 0001f2000001f32f Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/motu/motu-protocol-v2.c')
-rw-r--r--sound/firewire/motu/motu-protocol-v2.c34
1 files changed, 32 insertions, 2 deletions
diff --git a/sound/firewire/motu/motu-protocol-v2.c b/sound/firewire/motu/motu-protocol-v2.c
index e5bd3ac02300..453fc29fade7 100644
--- a/sound/firewire/motu/motu-protocol-v2.c
+++ b/sound/firewire/motu/motu-protocol-v2.c
@@ -13,6 +13,8 @@
#define V2_CLOCK_RATE_SHIFT 3
#define V2_CLOCK_SRC_MASK 0x00000007
#define V2_CLOCK_SRC_SHIFT 0
+#define V2_CLOCK_TRAVELER_FETCH_DISABLE 0x04000000
+#define V2_CLOCK_TRAVELER_FETCH_ENABLE 0x03000000
#define V2_IN_OUT_CONF_OFFSET 0x0c04
#define V2_OPT_OUT_IFACE_MASK 0x00000c00
@@ -66,6 +68,11 @@ static int v2_set_clock_rate(struct snd_motu *motu, unsigned int rate)
data &= ~V2_CLOCK_RATE_MASK;
data |= i << V2_CLOCK_RATE_SHIFT;
+ if (motu->spec == &snd_motu_spec_traveler) {
+ data &= ~V2_CLOCK_TRAVELER_FETCH_ENABLE;
+ data |= V2_CLOCK_TRAVELER_FETCH_DISABLE;
+ }
+
reg = cpu_to_be32(data);
return snd_motu_transaction_write(motu, V2_CLOCK_STATUS_OFFSET, &reg,
sizeof(reg));
@@ -121,8 +128,31 @@ static int v2_get_clock_source(struct snd_motu *motu,
static int v2_switch_fetching_mode(struct snd_motu *motu, bool enable)
{
- /* V2 protocol doesn't have this feature. */
- return 0;
+ __be32 reg;
+ u32 data;
+ int err = 0;
+
+ if (motu->spec == &snd_motu_spec_traveler) {
+ err = snd_motu_transaction_read(motu, V2_CLOCK_STATUS_OFFSET,
+ &reg, sizeof(reg));
+ if (err < 0)
+ return err;
+ data = be32_to_cpu(reg);
+
+ data &= ~(V2_CLOCK_TRAVELER_FETCH_DISABLE |
+ V2_CLOCK_TRAVELER_FETCH_ENABLE);
+
+ if (enable)
+ data |= V2_CLOCK_TRAVELER_FETCH_ENABLE;
+ else
+ data |= V2_CLOCK_TRAVELER_FETCH_DISABLE;
+
+ reg = cpu_to_be32(data);
+ err = snd_motu_transaction_write(motu, V2_CLOCK_STATUS_OFFSET,
+ &reg, sizeof(reg));
+ }
+
+ return err;
}
static void calculate_fixed_part(struct snd_motu_packet_format *formats,
OpenPOWER on IntegriCloud