diff options
Diffstat (limited to 'sound/firewire/oxfw/oxfw-stream.c')
-rw-r--r-- | sound/firewire/oxfw/oxfw-stream.c | 82 |
1 files changed, 48 insertions, 34 deletions
diff --git a/sound/firewire/oxfw/oxfw-stream.c b/sound/firewire/oxfw/oxfw-stream.c index 501a80094bf7..80c9dc13f1b5 100644 --- a/sound/firewire/oxfw/oxfw-stream.c +++ b/sound/firewire/oxfw/oxfw-stream.c @@ -513,7 +513,7 @@ int snd_oxfw_stream_parse_format(u8 *format, * Level 1: AM824 Compound (0x40) */ if ((format[0] != 0x90) || (format[1] != 0x40)) - return -ENOSYS; + return -ENXIO; /* check the sampling rate */ for (i = 0; i < ARRAY_SIZE(avc_stream_rate_table); i++) { @@ -521,7 +521,7 @@ int snd_oxfw_stream_parse_format(u8 *format, break; } if (i == ARRAY_SIZE(avc_stream_rate_table)) - return -ENOSYS; + return -ENXIO; formation->rate = oxfw_rate_table[i]; @@ -565,13 +565,13 @@ int snd_oxfw_stream_parse_format(u8 *format, /* Don't care */ case 0xff: default: - return -ENOSYS; /* not supported */ + return -ENXIO; /* not supported */ } } if (formation->pcm > AM824_MAX_CHANNELS_FOR_PCM || formation->midi > AM824_MAX_CHANNELS_FOR_MIDI) - return -ENOSYS; + return -ENXIO; return 0; } @@ -656,7 +656,7 @@ static int fill_stream_formats(struct snd_oxfw *oxfw, /* get first entry */ len = AVC_GENERIC_FRAME_MAXIMUM_BYTES; err = avc_stream_get_format_list(oxfw->unit, dir, 0, buf, &len, 0); - if (err == -ENOSYS) { + if (err == -ENXIO) { /* LIST subfunction is not implemented */ len = AVC_GENERIC_FRAME_MAXIMUM_BYTES; err = assume_stream_formats(oxfw, dir, pid, buf, &len, @@ -728,49 +728,63 @@ int snd_oxfw_stream_discover(struct snd_oxfw *oxfw) err); goto end; } else if ((plugs[0] == 0) && (plugs[1] == 0)) { - err = -ENOSYS; + err = -ENXIO; goto end; } /* 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; + + // 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; + } - 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; } } end: |