alsa-devel.alsa-project.org archive mirror
 help / color / mirror / Atom feed
From: Takashi Sakamoto <o-takashi@sakamocchi.jp>
To: tiwai@suse.de
Cc: alsa-devel@alsa-project.org, clemens@ladisch.de
Subject: [PATCH 9/9] ALSA: firewire-motu: fix register handling for 896
Date: Wed, 23 Jun 2021 16:59:41 +0900	[thread overview]
Message-ID: <20210623075941.72562-10-o-takashi@sakamocchi.jp> (raw)
In-Reply-To: <20210623075941.72562-1-o-takashi@sakamocchi.jp>

After further investigation, I find out some mistakes for 896 about its
register. This commit fixes it.

Fixes: b431f16f1685 ("ALSA: firewire-motu: add support for MOTU 896")
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/motu/motu-protocol-v1.c | 33 ++++++++++++++++++--------
 1 file changed, 23 insertions(+), 10 deletions(-)

diff --git a/sound/firewire/motu/motu-protocol-v1.c b/sound/firewire/motu/motu-protocol-v1.c
index 3b766615a9ee..f1d6a326dc07 100644
--- a/sound/firewire/motu/motu-protocol-v1.c
+++ b/sound/firewire/motu/motu-protocol-v1.c
@@ -61,13 +61,21 @@
 
 // Status register for MOTU 896 (0x'ffff'f000'0b14).
 //
-// 0x20000000: fetch PCM frames from communication IC to DAC.
+// 0xf0000000: enable physical and stream input to DAC.
+//   0x80000000: disable
+//   0x40000000: disable
+//   0x20000000: enable (prior to the other bits)
+//   0x10000000: disable
+//   0x00000000: disable
 // 0x08000000: speed of word clock signal output on BNC interface.
-//   0x00000000: follow to system clock.
-//   0x08000000: half of system clock.
-// 0x01000000: Route main output to headphone output.
-// 0x00ffff00: input to monitor.
-//   0x00000000: none
+//   0x00000000: force to low rate (44.1/48.0 kHz).
+//   0x08000000: follow to system clock.
+// 0x04000000: something relevant to clock.
+// 0x03000000: enable output.
+//  0x02000000: enabled irreversibly once standing unless the device voluntarily disables it.
+//  0x01000000: enabled irreversibly once standing unless the device voluntarily disables it.
+// 0x00ffff00: monitor input mode.
+//   0x00000000: disabled
 //   0x00004800: analog-1/2
 //   0x00005a00: analog-3/4
 //   0x00006c00: analog-5/6
@@ -83,7 +91,7 @@
 //   0x00007f00: analog-8
 //   0x00104000: AES/EBU-1
 //   0x00104900: AES/EBU-2
-// 0x00000060: sample rate conversin for AES/EBU input/output.
+// 0x00000060: sample rate conversion for AES/EBU input/output.
 //   0x00000000: None
 //   0x00000020: input signal is converted to system rate
 //   0x00000040: output is slave to input, ignoring system rate
@@ -97,16 +105,18 @@
 //   0x00000000: internal
 //   0x00000001: ADAT on optical interface
 //   0x00000002: AES/EBU on XLR
+//   0x00000003: source packet header (SPH)
 //   0x00000004: word clock on BNC
 //   0x00000005: ADAT on Dsub 9pin
 
 #define CLK_896_STATUS_OFFSET			0x0b14
 #define  CLK_896_STATUS_FLAG_FETCH_ENABLE	0x20000000
-#define  CLK_896_STATUS_FLAG_MAIN_TO_HP		0x01000000
+#define  CLK_896_STATUS_FLAG_OUTPUT_ON		0x03000000
 #define  CLK_896_STATUS_MASK_SRC		0x00000007
 #define   CLK_896_STATUS_FLAG_SRC_INTERNAL	0x00000000
 #define   CLK_896_STATUS_FLAG_SRC_ADAT_ON_OPT	0x00000001
 #define   CLK_896_STATUS_FLAG_SRC_AESEBU	0x00000002
+#define   CLK_896_STATUS_FLAG_SRC_SPH		0x00000003
 #define   CLK_896_STATUS_FLAG_SRC_WORD		0x00000004
 #define   CLK_896_STATUS_FLAG_SRC_ADAT_ON_DSUB	0x00000005
 #define  CLK_896_STATUS_MASK_RATE		0x00000018
@@ -304,6 +314,9 @@ static int get_clock_source_896(struct snd_motu *motu, enum snd_motu_clock_sourc
 	case CLK_896_STATUS_FLAG_SRC_AESEBU:
 		*src = SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR;
 		break;
+	case CLK_896_STATUS_FLAG_SRC_SPH:
+		*src = SND_MOTU_CLOCK_SOURCE_SPH;
+		break;
 	case CLK_896_STATUS_FLAG_SRC_WORD:
 		*src = SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC;
 		break;
@@ -362,9 +375,9 @@ static int switch_fetching_mode_896(struct snd_motu *motu, bool enable)
 		return err;
 	data = be32_to_cpu(reg);
 
-	data &= ~(CLK_896_STATUS_FLAG_FETCH_ENABLE | CLK_896_STATUS_FLAG_MAIN_TO_HP);
+	data &= ~CLK_896_STATUS_FLAG_FETCH_ENABLE;
 	if (enable)
-		data |= (CLK_896_STATUS_FLAG_FETCH_ENABLE | CLK_896_STATUS_FLAG_MAIN_TO_HP);
+		data |= CLK_896_STATUS_FLAG_FETCH_ENABLE | CLK_896_STATUS_FLAG_OUTPUT_ON;
 
 	reg = cpu_to_be32(data);
 	return snd_motu_transaction_write(motu, CLK_896_STATUS_OFFSET, &reg, sizeof(reg));
-- 
2.30.2


  parent reply	other threads:[~2021-06-23  8:03 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-06-23  7:59 [PATCH 0/9] ALSA: firewire-motu: misc fixes and code refactoring Takashi Sakamoto
2021-06-23  7:59 ` [PATCH 1/9] ALSA: firewire-motu: fix detection for S/PDIF source on optical interface in v2 protocol Takashi Sakamoto
2021-06-23  7:59 ` [PATCH 2/9] ALSA: firewire-motu: code refactoring for detection of clock source " Takashi Sakamoto
2021-06-23  7:59 ` [PATCH 3/9] ALSA: firewire-motu: add support for AES/EBU " Takashi Sakamoto
2021-06-23  7:59 ` [PATCH 4/9] ALSA: firewire-motu: use macro instead of magic number for " Takashi Sakamoto
2021-06-23  7:59 ` [PATCH 5/9] ALSA: firewire-motu: code refactoring for packet format detection " Takashi Sakamoto
2021-06-23  7:59 ` [PATCH 6/9] ALSA: firewire-motu: code refactoring for source detection of sampling clock in v3 protocol Takashi Sakamoto
2021-06-23  7:59 ` [PATCH 7/9] ALSA: firewire-motu: use macro instead of magic number for clock source " Takashi Sakamoto
2021-06-23  7:59 ` [PATCH 8/9] ALSA: firewire-motu: fix register handling for 828 Takashi Sakamoto
2021-06-23  7:59 ` Takashi Sakamoto [this message]
2021-06-23  8:54 ` [PATCH 0/9] ALSA: firewire-motu: misc fixes and code refactoring Takashi Iwai

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20210623075941.72562-10-o-takashi@sakamocchi.jp \
    --to=o-takashi@sakamocchi.jp \
    --cc=alsa-devel@alsa-project.org \
    --cc=clemens@ladisch.de \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).