firewire-lib: Rename functions, structure and member for both direction

This patch renames some functions, structure and member to reuse them in both
AMDTP receive/transmit stream.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
firewire-lib: Add macros for fixed value related to AMDTP

This patch adds some macros for fixed value related to AMDTP
in IEC 61883-6. These macros will also be used by followed patches.

This patch also replace existed fixed value to the corresponding macro.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
firewire-lib: Add "direction" member to amdtp_stream structure for AMDTP

To indicate the direction of amdtp stream, this patch adds "direction" member
to amdtp_stream structure. To determine the direction, this patch also adds
"direction" argument to amdtp_stream_init() function. The amdtp_stream_init()
function is exported and used by firewire-speakers and dice so this patch also
affects them.

This patch just add them. Actual implementation will be done by followed
patches.
firewire-lib: Split some codes into functions to reuse in transmitted stream

Some codes can be reused in handling transmitted stream. This commit adds new
functions. To keep naming consistency, this commit also renames some functions.
firewire-lib: Add support for AMDTP transmit stream and PCM capture

For capturing PCM, this commit adds the functionality to handle transmitted
stream.
firewire-lib: Add support for MIDI capture/playback

For capturing/playbacking MIDI message, this commit adds the functionality to
multiplex MIDI streams into AMDTP sream in IEC 61883-6.

IEC 61883-6 refers to AMEI/MMA RP-027 for implementation of MIDI conformant
data. MIDI1.0-2x/3x-SPEED mode is not implemented because I cannot find
specification about 'negotiation procedure' and 'encapsulation details'.
firewire-lib: give syt value from external handle_out_packet()

For duplex streams with synchronization, this driver give 'presentation
timestamp' to out stream. This commit is preparation for this.
firewire-lib: Add support for duplex streams with synchronization

Generally, the devices can synchronize to handle 'presentation timestamp'
in CIP packets. This commit adds the functionality to pick up this timestamp
in packets transmitted by the device, then use it for out stream.

In current implementation, the drivers generated this timestamp. Then it acts
as synchronization master. This commit allows the drivers to act as
synchronization slave.
firewire-lib: Add sort function for transmitted packet

The aim of this commit is to assure the continuity of timestamp in received
packets. Fireworks with firmware version 5.5 or former is a type of device
which transmits packets with a bit disorder.For example,

Index  Payload	CIP header 1  CIP header 2
023    210      3F1100F8      900478E9
024    002      3F1100F8      90FFFFFF
025    210      3F110000      900490E9
026    210      3F110008      9004A4E9
027    210      3F110010      9004B8E9
028    002      3F110010      90FFFFFF
029    210      3F110020      9004E4E8 <-
030    210      3F110018      9004D0E8 <-
031    210      3F110028      9004F8E8
032    002      3F110028      90FFFFFF
033    210      3F110030      900410E8
034    210      3F110038      900424E8
035    210      3F110040      900438E8
036    002      3F110040      90FFFFFF
037    210      3F110050      900464E8 <-
038    210      3F110048      900450E8 <-
039    210      3F110058      900478E8
040    002      3F110058      90FFFFFF
041    210      3F110068      9004A4E8 <-
042    210      3F110060      900490E8 <-
043    210      3F110070      9004B8E8
044    002      3F110070      90FFFFFF
045    210      3F110080      9004E4E7 <-
046    210      3F110078      9004D0E8 <-
firewire-lib: Add transfer delay for duplex streams with synchronization

'Presentation timestamp' is expected time (relative) to play the data in
packet. When the driver handle the timestamp, it's for the data in transmitted
packet. This commit add 'transfer delay' for expected time of out data.
firewire-lib: Add support for channel mapping

Some devices arrange the position of PCM/MIDI data. This commit allows the
drivers to pick up these data correctly.

To be simple, the mapping table is an array with fixed length. Then the number
of channels for PCM/MIDI is restricted.
firewire-lib: rename macros, variables and functions related to CMP plug

Referring to IEC 61883-1, oMPR and iMPR, oPCR and iPCR have some fields with
the same role in the same position. This patch renames some local macros, local
variables and function arguments which has "i" in its prefix to reuse them
between oMPR and iMPR, oPCR and iPCR.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
firewire-lib: Add "direction" member to cmp_connection structure

To indicate the direction of connection, this patch adds "direction" member to
cmp_connection structure. To determine the direction, this patch also adds
"direction" argument to cmp_connection_init() function. The
cmp_connection_init() function is exported and used in snd-firewire-speakers so
this patch also affect it.

This patch just add them. Actual implementation will be done by followed
patches.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
firewire-lib: Add handling CMP output connection

To handle CMP output connection, this patch adds some macros, codes with
condition of direction and new functions. Once cmp_connection_init() is
executed with its direction, CMP input and output connection can be
handled by the same way.

Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
firewire-lib: introduce cmp_connection_check_used() to check others' connection
firewire-lib: Add some AV/C general commands
firewire-lib: Add quirk for BeBoB chipset
firewire-lib: Add quirks for Fireworks chipset