diff mbox series

[3/3] ALSA: oxfw: fix for Stanton SCS.1d

Message ID 20200113073418.24622-4-o-takashi@sakamocchi.jp (mailing list archive)
State New, archived
Headers show
Series ALSA: oxfw: fixes for Stanton SCS.1d | expand

Commit Message

Takashi Sakamoto Jan. 13, 2020, 7:34 a.m. UTC
Stanton SCS.1d uses Oxford Semiconductor FW 971 ASIC (FW971) for
communication. Although the unit is bound to ALSA oxfw driver, the instance
of sound card can not be added due to its quirk of plug information. This
bug was added when snd-scs1x is merged into snd-oxfw at commit
9e2004f9cedf ("ALSA: oxfw: obsolete scs1x module").

This commit fixes the driver for the quirk. In cases that the unit returns
NOT IMPLEMENTED for some AV/C commands, the sound card is added without any
PCM/MIDI interfaces for packet streaming. For SCS.1d, model dependent
operation adds MIDI interface and applications can use it to operate
according to HSS1394 protocol from reverse-engineering work by Sean M.
Pappalardo.

Plug Control Register (PCR) has information that the unit has a pair of
plugs for isochronous communication:

(oMPR)
$ ./firewire-request /dev/fw1 read 0xfffff0000900
result: 80ff0001
(iMPR)
$ ./firewire-request /dev/fw1 read 0xfffff0000980
result: 80ff0001

AV/C PLUG INFO also returns information that the unit has a pair of
plugs for isochronous communication.

(AV/C PLUG INFO command)
$ ./firewire-request /dev/fw1 fcp 0x01ff0200ffffffff
response: 000: 0c ff 02 00 01 01 02 02

However, AV/C PLUG SIGNAL INFO command is rejected for both plugs.

(AV/C OUTPUT PLUG SIGNAL INFO command)
$ ./firewire-request /dev/fw1 fcp 0x01ff1800ffffffff
response: 000: 0a ff 18 00 ff ff ff ff
(AV/C INPUT PLUG SIGNAL INFO command)
$ ./firewire-request /dev/fw1 fcp 0x01ff1900ffffffff
response: 000: 0a ff 19 00 ff ff ff ff

Furthermore, AV/C EXTENDED STREAM FORMAT INFO is not implemented.

(AV/C EXTENDED STREAM FORMAT INFO list subfunction for input plug)
$ ./firewire-request /dev/fw1 fcp 0x01ffbfc000000000ffff00ff
response: 000: 08 ff bf c0 00 00 00 00 ff ff 00 ff
(AV/C EXTENDED STREAM FORMAT INFO list subfunction for output plug)
$ ./firewire-request /dev/fw1 fcp 0x01ffbfc001000000ffff00ff
response: 000: 08 ff bf c0 01 00 00 00 ff ff 00 ff
(AV/C EXTENDED STREAM FORMAT INFO single subfunction for input plug)
$ ./firewire-request /dev/fw1 fcp 0x01ffbfc100000000ffffffff
response: 000: 08 ff bf c1 00 00 00 00 ff ff ff ff
(AV/C EXTENDED STREAM FORMAT INFO single subfunction for output plug)
$ ./firewire-request /dev/fw1 fcp 0x01ffbfc101000000ffffffff
response: 000: 08 ff bf c1 01 00 00 00 ff ff ff ff

Reference: https://mailman.alsa-project.org/pipermail/alsa-devel/2012-May/052264.html
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
---
 sound/firewire/oxfw/oxfw-stream.c | 72 ++++++++++++++++++-------------
 1 file changed, 42 insertions(+), 30 deletions(-)

Comments

Takashi Iwai Jan. 13, 2020, 9:46 a.m. UTC | #1
On Mon, 13 Jan 2020 08:34:18 +0100,
Takashi Sakamoto wrote:
> 
> Stanton SCS.1d uses Oxford Semiconductor FW 971 ASIC (FW971) for
> communication. Although the unit is bound to ALSA oxfw driver, the instance
> of sound card can not be added due to its quirk of plug information. This
> bug was added when snd-scs1x is merged into snd-oxfw at commit
> 9e2004f9cedf ("ALSA: oxfw: obsolete scs1x module").
> 
> This commit fixes the driver for the quirk. In cases that the unit returns
> NOT IMPLEMENTED for some AV/C commands, the sound card is added without any
> PCM/MIDI interfaces for packet streaming. For SCS.1d, model dependent
> operation adds MIDI interface and applications can use it to operate
> according to HSS1394 protocol from reverse-engineering work by Sean M.
> Pappalardo.
> 
> Plug Control Register (PCR) has information that the unit has a pair of
> plugs for isochronous communication:
> 
> (oMPR)
> $ ./firewire-request /dev/fw1 read 0xfffff0000900
> result: 80ff0001
> (iMPR)
> $ ./firewire-request /dev/fw1 read 0xfffff0000980
> result: 80ff0001
> 
> AV/C PLUG INFO also returns information that the unit has a pair of
> plugs for isochronous communication.
> 
> (AV/C PLUG INFO command)
> $ ./firewire-request /dev/fw1 fcp 0x01ff0200ffffffff
> response: 000: 0c ff 02 00 01 01 02 02
> 
> However, AV/C PLUG SIGNAL INFO command is rejected for both plugs.
> 
> (AV/C OUTPUT PLUG SIGNAL INFO command)
> $ ./firewire-request /dev/fw1 fcp 0x01ff1800ffffffff
> response: 000: 0a ff 18 00 ff ff ff ff
> (AV/C INPUT PLUG SIGNAL INFO command)
> $ ./firewire-request /dev/fw1 fcp 0x01ff1900ffffffff
> response: 000: 0a ff 19 00 ff ff ff ff
> 
> Furthermore, AV/C EXTENDED STREAM FORMAT INFO is not implemented.
> 
> (AV/C EXTENDED STREAM FORMAT INFO list subfunction for input plug)
> $ ./firewire-request /dev/fw1 fcp 0x01ffbfc000000000ffff00ff
> response: 000: 08 ff bf c0 00 00 00 00 ff ff 00 ff
> (AV/C EXTENDED STREAM FORMAT INFO list subfunction for output plug)
> $ ./firewire-request /dev/fw1 fcp 0x01ffbfc001000000ffff00ff
> response: 000: 08 ff bf c0 01 00 00 00 ff ff 00 ff
> (AV/C EXTENDED STREAM FORMAT INFO single subfunction for input plug)
> $ ./firewire-request /dev/fw1 fcp 0x01ffbfc100000000ffffffff
> response: 000: 08 ff bf c1 00 00 00 00 ff ff ff ff
> (AV/C EXTENDED STREAM FORMAT INFO single subfunction for output plug)
> $ ./firewire-request /dev/fw1 fcp 0x01ffbfc101000000ffffffff
> response: 000: 08 ff bf c1 01 00 00 00 ff ff ff ff
> 
> Reference: https://mailman.alsa-project.org/pipermail/alsa-devel/2012-May/052264.html
> Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>

Applied to for-next branch.  Thanks.


Takashi
diff mbox series

Patch

diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c
index 36c3dd84d189..80c9dc13f1b5 100644
--- a/sound/firewire/oxfw/oxfw-stream.c
+++ b/sound/firewire/oxfw/oxfw-stream.c
@@ -735,45 +735,57 @@  int snd_oxfw_stream_discover(struct snd_oxfw *oxfw)
 	/* use oPCR[0] if exists */
 	if (plugs[1] > 0) {
 		err = fill_stream_formats(oxfw, AVC_GENERAL_PLUG_DIR_OUT, 0);
-		if (err < 0)
-			goto end;
+		if (err < 0) {
+			if (err != -ENXIO)
+				return err;
 
-		for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) {
-			format = oxfw->tx_stream_formats[i];
-			if (format == NULL)
-				continue;
-			err = snd_oxfw_stream_parse_format(format, &formation);
-			if (err < 0)
-				continue;
-
-			/* Add one MIDI port. */
-			if (formation.midi > 0)
-				oxfw->midi_input_ports = 1;
-		}
+			// The oPCR is not available for isoc communication.
+			err = 0;
+		} else {
+			for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) {
+				format = oxfw->tx_stream_formats[i];
+				if (format == NULL)
+					continue;
+				err = snd_oxfw_stream_parse_format(format,
+								   &formation);
+				if (err < 0)
+					continue;
+
+				/* Add one MIDI port. */
+				if (formation.midi > 0)
+					oxfw->midi_input_ports = 1;
+			}
 
-		oxfw->has_output = true;
+			oxfw->has_output = true;
+		}
 	}
 
 	/* use iPCR[0] if exists */
 	if (plugs[0] > 0) {
 		err = fill_stream_formats(oxfw, AVC_GENERAL_PLUG_DIR_IN, 0);
-		if (err < 0)
-			goto end;
+		if (err < 0) {
+			if (err != -ENXIO)
+				return err;
 
-		for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) {
-			format = oxfw->rx_stream_formats[i];
-			if (format == NULL)
-				continue;
-			err = snd_oxfw_stream_parse_format(format, &formation);
-			if (err < 0)
-				continue;
-
-			/* Add one MIDI port. */
-			if (formation.midi > 0)
-				oxfw->midi_output_ports = 1;
-		}
+			// The iPCR is not available for isoc communication.
+			err = 0;
+		} else {
+			for (i = 0; i < SND_OXFW_STREAM_FORMAT_ENTRIES; i++) {
+				format = oxfw->rx_stream_formats[i];
+				if (format == NULL)
+					continue;
+				err = snd_oxfw_stream_parse_format(format,
+								   &formation);
+				if (err < 0)
+					continue;
+
+				/* Add one MIDI port. */
+				if (formation.midi > 0)
+					oxfw->midi_output_ports = 1;
+			}
 
-		oxfw->has_input = true;
+			oxfw->has_input = true;
+		}
 	}
 end:
 	return err;