Skip to content

Commit ae44705

Browse files
takaswietiwai
authored andcommitted
ALSA: firewire-motu: fix register handling for 896
After further investigation, I find out some mistakes for 896 about its register. This commit fixes it. Fixes: b431f16 ("ALSA: firewire-motu: add support for MOTU 896") Signed-off-by: Takashi Sakamoto <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Takashi Iwai <[email protected]>
1 parent e949e33 commit ae44705

File tree

1 file changed

+23
-10
lines changed

1 file changed

+23
-10
lines changed

sound/firewire/motu/motu-protocol-v1.c

Lines changed: 23 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -61,13 +61,21 @@
6161

6262
// Status register for MOTU 896 (0x'ffff'f000'0b14).
6363
//
64-
// 0x20000000: fetch PCM frames from communication IC to DAC.
64+
// 0xf0000000: enable physical and stream input to DAC.
65+
// 0x80000000: disable
66+
// 0x40000000: disable
67+
// 0x20000000: enable (prior to the other bits)
68+
// 0x10000000: disable
69+
// 0x00000000: disable
6570
// 0x08000000: speed of word clock signal output on BNC interface.
66-
// 0x00000000: follow to system clock.
67-
// 0x08000000: half of system clock.
68-
// 0x01000000: Route main output to headphone output.
69-
// 0x00ffff00: input to monitor.
70-
// 0x00000000: none
71+
// 0x00000000: force to low rate (44.1/48.0 kHz).
72+
// 0x08000000: follow to system clock.
73+
// 0x04000000: something relevant to clock.
74+
// 0x03000000: enable output.
75+
// 0x02000000: enabled irreversibly once standing unless the device voluntarily disables it.
76+
// 0x01000000: enabled irreversibly once standing unless the device voluntarily disables it.
77+
// 0x00ffff00: monitor input mode.
78+
// 0x00000000: disabled
7179
// 0x00004800: analog-1/2
7280
// 0x00005a00: analog-3/4
7381
// 0x00006c00: analog-5/6
@@ -83,7 +91,7 @@
8391
// 0x00007f00: analog-8
8492
// 0x00104000: AES/EBU-1
8593
// 0x00104900: AES/EBU-2
86-
// 0x00000060: sample rate conversin for AES/EBU input/output.
94+
// 0x00000060: sample rate conversion for AES/EBU input/output.
8795
// 0x00000000: None
8896
// 0x00000020: input signal is converted to system rate
8997
// 0x00000040: output is slave to input, ignoring system rate
@@ -97,16 +105,18 @@
97105
// 0x00000000: internal
98106
// 0x00000001: ADAT on optical interface
99107
// 0x00000002: AES/EBU on XLR
108+
// 0x00000003: source packet header (SPH)
100109
// 0x00000004: word clock on BNC
101110
// 0x00000005: ADAT on Dsub 9pin
102111

103112
#define CLK_896_STATUS_OFFSET 0x0b14
104113
#define CLK_896_STATUS_FLAG_FETCH_ENABLE 0x20000000
105-
#define CLK_896_STATUS_FLAG_MAIN_TO_HP 0x01000000
114+
#define CLK_896_STATUS_FLAG_OUTPUT_ON 0x03000000
106115
#define CLK_896_STATUS_MASK_SRC 0x00000007
107116
#define CLK_896_STATUS_FLAG_SRC_INTERNAL 0x00000000
108117
#define CLK_896_STATUS_FLAG_SRC_ADAT_ON_OPT 0x00000001
109118
#define CLK_896_STATUS_FLAG_SRC_AESEBU 0x00000002
119+
#define CLK_896_STATUS_FLAG_SRC_SPH 0x00000003
110120
#define CLK_896_STATUS_FLAG_SRC_WORD 0x00000004
111121
#define CLK_896_STATUS_FLAG_SRC_ADAT_ON_DSUB 0x00000005
112122
#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
304314
case CLK_896_STATUS_FLAG_SRC_AESEBU:
305315
*src = SND_MOTU_CLOCK_SOURCE_AESEBU_ON_XLR;
306316
break;
317+
case CLK_896_STATUS_FLAG_SRC_SPH:
318+
*src = SND_MOTU_CLOCK_SOURCE_SPH;
319+
break;
307320
case CLK_896_STATUS_FLAG_SRC_WORD:
308321
*src = SND_MOTU_CLOCK_SOURCE_WORD_ON_BNC;
309322
break;
@@ -362,9 +375,9 @@ static int switch_fetching_mode_896(struct snd_motu *motu, bool enable)
362375
return err;
363376
data = be32_to_cpu(reg);
364377

365-
data &= ~(CLK_896_STATUS_FLAG_FETCH_ENABLE | CLK_896_STATUS_FLAG_MAIN_TO_HP);
378+
data &= ~CLK_896_STATUS_FLAG_FETCH_ENABLE;
366379
if (enable)
367-
data |= (CLK_896_STATUS_FLAG_FETCH_ENABLE | CLK_896_STATUS_FLAG_MAIN_TO_HP);
380+
data |= CLK_896_STATUS_FLAG_FETCH_ENABLE | CLK_896_STATUS_FLAG_OUTPUT_ON;
368381

369382
reg = cpu_to_be32(data);
370383
return snd_motu_transaction_write(motu, CLK_896_STATUS_OFFSET, &reg, sizeof(reg));

0 commit comments

Comments
 (0)