oxfw: Split stream functionality to a new file and add a header file

To make it easy to work in followed commit.

And this commit remove 'fw_unit_get()/fw_unit_put()' because these
are called by helper functions in 'snd-firewire-lib'.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Split PCM functionality to a new file

To make it easy to work in followed commit.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Split control functionality to a new file

To make it easy to work in followed commit.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Change the way to name card

'struct snd_card' has 4 members for name. They're 'driver', 'shortname',
'longname' and 'mixername'. The 'driver' is used to detect card
Configuration file but the others are not used for important
functionality. So it's OK to name them with the information from config
ROM.

This commit adds 'name_card()' function and change the way to name card.
The 'driver' is still given by 'struct device_info'. The 'shortname' and
'mixername' is given by 'model' and the 'longname' is given by 'vendor'
and 'model'.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Change the way to make PCM rules/constraints

For PCM rules/constrains, drivers need to know stream formation at each
supported sampling rates in advance. This commit adds
'struct snd_oxfw_stream_formation' to save formation information.

According to datasheet of OXFW970/971, they support 32.0kHz to 196.0kHz.
So this commit adds 'rx_stream_formations' member to 'struct snd_oxfw'. It's
an array with 7 elements. Each element corresponds to each sampling rate.

With these data structure, this commit changes the way to make PCM
rules/constraints.

I don't know whether Griffin/LaCie devices supports SINGLE/LIST subfunction
'AV/C Stream Format Information' command. So this commit adds codes to
generate formations for them.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Add proc interface for debugging purpose

The previous commit adds stream formation. This commit adds proc interface
to get information about:
 - stream formation
 - current sampling rate

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Change the way to start stream

In past commit, driver can keep formations for each sampling rate. So its
stream functionality can set its formation when given sampling rate.

But PCM functionality still set it. This commit move some codes to set
stream formation from PCM functionality to stream functionality.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Add some AV/C commands to get stream formation and supported sample rate

OXFW970/971 may supports AV/C Stream Format Information Specification 1.1
Working Draft (Apr 2005, 1394TA). So this driver uses 'EXTENDED STREAM FORMAT
INFORMATION' command.

This command has two subfunctions, 'SINGLE' and 'LIST'. Drivers can use
'SINGLE' subfunction to know current formation of AMDTP stream, Drivers can
use 'LIST' subfunction to know an available formation of AMDTP stream in a
certain sampling rate. Followed commit adds parser for returned information.

This commit adds 'inquiry' version of 'PLUG SIGNAL FORMAT' command. When
device doesn't support 'LIST' subfunction of 'AV/C Stream Format Information
command, this driver uses 'inquiry' command to get supported sampling rates.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Add support for Behringer/Mackie devices

FFADO project have already identified that some devices produced by
Behringer/Mackie are based on OXFW970/971.

Behringer/Mackie devices support capture/playback of PCM-samples and some
of them supports capture/playback of MIDI-messages. Followed commits will
add these functionalities.

They support 'AV/C Stream Format Information' command. But some of them
don't implement 'LIST' subfunction. So this commit uses an assumption
that 'if they don't implement it, they don't change formation of stream
for each sampling rate'.

With this assumption, this driver generate formations for the devices by:
 1.getting current formation by SINGLE subfunction
 2.getting supported sampling rates
 3.applying current formation for all of supported sampling rates

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Add support AMDTP in-stream and PCM capture

Previous commit adds support for some devices which can capture PCM samples.
These devices transmit AMDTP stream in non-blocking mode. The stream from
these devices has a quirk for 'presentation timestamp'.

The sequence of 'presentation timestamp' is invalid even if header of packet
shows 'CIP header with SYT field'. So this driver can't reuse the timestamp
for out stream.

In this reason, this driver handles both streams separately.

These are examples of a sequence of packets transmitted by Behringer F-Control
Audio 202.

When driver gives no out-stream:
Index	Payload	CIP_Header_0	CIP_Header_1
38	14	00020092	900103D1
39	12	00020098	900102FF
40	12	0002009D	9001027F
41	14	000200A2	90010396
42	14	000200A8	900102E8
43	12	000200AE	90010219
44	14	000200B3	90010331
45	12	000200B9	9001025F
46	14	000200BE	90010376
47	12	000200C4	900102A1
00	12	000200C9	9001023E
01	14	000200CE	90010358
02	12	000200D4	90010289
03	16	000200D9	900103A3
04	12	000200E0	900102DD
05	14	000200E5	900103F1
06	12	000200EB	90010335
07	12	000200F0	90010263
08	14	000200F5	9001037C
09	12	000200FB	900102AE

When driver gives out-stream:
Index	Payload	CIP_Header_0	CIP_Header_1
38	12	000200BD	900104A8
39	14	000200C2	900104A8
40	12	000200C8	900104AC
41	14	000200CD	900104A9
42	12	000200D3	900104B1
43	14	000200D8	900104A8
44	12	000200DE	900104AA
45	14	000200E3	900104A9
46	14	000200E9	900104AE
47	12	000200EF	900104A8
00	14	000200F4	900104AD
01	12	000200FA	900104A7
02	14	000200FF	900104A9
03	12	00020005	900104A9
04	14	0002000A	900104B1
05	12	00020010	900104AA
06	14	00020015	900104AD
07	12	0002001B	900104A7
08	14	00020020	900104AC
09	12	00020026	900104A7

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Add support for capture/playback MIDI messages

I assume that 'if the device has MIDI comformant data channels in its
stream formation, the device has one MIDI port'. With this assumption,
this driver create MIDI devices.

When no streams have already started, MIDI functionality starts stream
with current sampling rate.

When MIDI functionality has already starts some streams and PCM
functionality is going to start streams at different sampling rate,
this driver stops streams once and changes sampling rate, then restarts
streams.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
oxfw: Add hwdep interface

This interface is designed for mixer/control application. To use hwdep
interface, the application can get information about firewire node, can
lock/unlock kernel streaming and can get notification at starting/stopping
kernel streaming.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
firewire-lib: Add sorting in-packets for full duplex streams with sync

In full duplex streams with synchronization, consistency of SYT field in
in-packets is important for out-packets. This commit add sorting in-packets
according to the value of dbc.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>