diff options
author | Takashi Sakamoto <o-takashi@sakamocchi.jp> | 2014-04-25 22:45:15 +0900 |
---|---|---|
committer | Takashi Iwai <tiwai@suse.de> | 2014-05-26 14:29:29 +0200 |
commit | eb7b3a056cd8130e45c4494fb27de54d53ce9f31 (patch) | |
tree | 13971a8c6d72473e1c53b1a092041a148db176ed /sound/firewire/bebob/bebob.h | |
parent | fd6f4b0dc167c6329a153ceeeb95bc41307156f3 (diff) | |
download | linux-eb7b3a056cd8130e45c4494fb27de54d53ce9f31.tar.gz linux-eb7b3a056cd8130e45c4494fb27de54d53ce9f31.tar.bz2 linux-eb7b3a056cd8130e45c4494fb27de54d53ce9f31.zip |
ALSA: bebob: Add commands and connections/streams management
This commit adds management functionality for connections and streams.
BeBoB uses CMP to manage connections and uses AMDTP for streams.
This commit also adds some BridgeCo's AV/C extension commands. There are some
BridgeCo's AV/C extension commands but this commit just uses below commands
to get device's capability and status:
1.Extended Plug Info commands
- Plug Channel Position Specific Data
- Plug Type Specific Data
- Cluster(Section) Info Specific Data
- Plug Input Specific Data
2.Extended Stream Format Information commands
- Extended Stream Format Information Command - List Request
For Extended Plug Info commands for Cluster Info Specific Data, I pick up
'section' instead of 'cluster' from document to prevent from misunderstanding
because 'cluster' is also used in IEC 61883-6.
Signed-off-by: Takashi Sakamoto <o-takashi@sakamocchi.jp>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Diffstat (limited to 'sound/firewire/bebob/bebob.h')
-rw-r--r-- | sound/firewire/bebob/bebob.h | 114 |
1 files changed, 114 insertions, 0 deletions
diff --git a/sound/firewire/bebob/bebob.h b/sound/firewire/bebob/bebob.h index 862f756ec281..a195c16da41e 100644 --- a/sound/firewire/bebob/bebob.h +++ b/sound/firewire/bebob/bebob.h @@ -23,11 +23,25 @@ #include "../lib.h" #include "../fcp.h" +#include "../packets-buffer.h" +#include "../iso-resources.h" +#include "../amdtp.h" +#include "../cmp.h" /* basic register addresses on DM1000/DM1100/DM1500 */ #define BEBOB_ADDR_REG_INFO 0xffffc8020000 #define BEBOB_ADDR_REG_REQ 0xffffc8021000 +struct snd_bebob; + +#define SND_BEBOB_STRM_FMT_ENTRIES 7 +struct snd_bebob_stream_formation { + unsigned int pcm; + unsigned int midi; +}; +/* this is a lookup table for index of stream formations */ +extern const unsigned int snd_bebob_rate_table[SND_BEBOB_STRM_FMT_ENTRIES]; + struct snd_bebob { struct snd_card *card; struct fw_unit *unit; @@ -35,6 +49,24 @@ struct snd_bebob { struct mutex mutex; spinlock_t lock; + + unsigned int midi_input_ports; + unsigned int midi_output_ports; + + struct amdtp_stream *master; + struct amdtp_stream tx_stream; + struct amdtp_stream rx_stream; + struct cmp_connection out_conn; + struct cmp_connection in_conn; + atomic_t capture_substreams; + atomic_t playback_substreams; + + struct snd_bebob_stream_formation + tx_stream_formations[SND_BEBOB_STRM_FMT_ENTRIES]; + struct snd_bebob_stream_formation + rx_stream_formations[SND_BEBOB_STRM_FMT_ENTRIES]; + + int sync_input_plug; }; static inline int @@ -53,6 +85,88 @@ snd_bebob_read_quad(struct fw_unit *unit, u64 addr, u32 *buf) (void *)buf, sizeof(u32), 0); } +/* + * AVC command extensions, AV/C Unit and Subunit, Revision 17 + * (Nov 2003, BridgeCo) + */ +#define AVC_BRIDGECO_ADDR_BYTES 6 +enum avc_bridgeco_plug_dir { + AVC_BRIDGECO_PLUG_DIR_IN = 0x00, + AVC_BRIDGECO_PLUG_DIR_OUT = 0x01 +}; +enum avc_bridgeco_plug_mode { + AVC_BRIDGECO_PLUG_MODE_UNIT = 0x00, + AVC_BRIDGECO_PLUG_MODE_SUBUNIT = 0x01, + AVC_BRIDGECO_PLUG_MODE_FUNCTION_BLOCK = 0x02 +}; +enum avc_bridgeco_plug_unit { + AVC_BRIDGECO_PLUG_UNIT_ISOC = 0x00, + AVC_BRIDGECO_PLUG_UNIT_EXT = 0x01, + AVC_BRIDGECO_PLUG_UNIT_ASYNC = 0x02 +}; +enum avc_bridgeco_plug_type { + AVC_BRIDGECO_PLUG_TYPE_ISOC = 0x00, + AVC_BRIDGECO_PLUG_TYPE_ASYNC = 0x01, + AVC_BRIDGECO_PLUG_TYPE_MIDI = 0x02, + AVC_BRIDGECO_PLUG_TYPE_SYNC = 0x03, + AVC_BRIDGECO_PLUG_TYPE_ANA = 0x04, + AVC_BRIDGECO_PLUG_TYPE_DIG = 0x05 +}; +static inline void +avc_bridgeco_fill_unit_addr(u8 buf[AVC_BRIDGECO_ADDR_BYTES], + enum avc_bridgeco_plug_dir dir, + enum avc_bridgeco_plug_unit unit, + unsigned int pid) +{ + buf[0] = 0xff; /* Unit */ + buf[1] = dir; + buf[2] = AVC_BRIDGECO_PLUG_MODE_UNIT; + buf[3] = unit; + buf[4] = 0xff & pid; + buf[5] = 0xff; /* reserved */ +} +static inline void +avc_bridgeco_fill_msu_addr(u8 buf[AVC_BRIDGECO_ADDR_BYTES], + enum avc_bridgeco_plug_dir dir, + unsigned int pid) +{ + buf[0] = 0x60; /* Music subunit */ + buf[1] = dir; + buf[2] = AVC_BRIDGECO_PLUG_MODE_SUBUNIT; + buf[3] = 0xff & pid; + buf[4] = 0xff; /* reserved */ + buf[5] = 0xff; /* reserved */ +} +int avc_bridgeco_get_plug_ch_pos(struct fw_unit *unit, + u8 addr[AVC_BRIDGECO_ADDR_BYTES], + u8 *buf, unsigned int len); +int avc_bridgeco_get_plug_type(struct fw_unit *unit, + u8 addr[AVC_BRIDGECO_ADDR_BYTES], + enum avc_bridgeco_plug_type *type); +int avc_bridgeco_get_plug_section_type(struct fw_unit *unit, + u8 addr[AVC_BRIDGECO_ADDR_BYTES], + unsigned int id, u8 *type); +int avc_bridgeco_get_plug_input(struct fw_unit *unit, + u8 addr[AVC_BRIDGECO_ADDR_BYTES], + u8 input[7]); +int avc_bridgeco_get_plug_strm_fmt(struct fw_unit *unit, + u8 addr[AVC_BRIDGECO_ADDR_BYTES], u8 *buf, + unsigned int *len, unsigned int eid); + +/* for AMDTP streaming */ +int snd_bebob_stream_get_rate(struct snd_bebob *bebob, unsigned int *rate); +int snd_bebob_stream_set_rate(struct snd_bebob *bebob, unsigned int rate); +int snd_bebob_stream_check_internal_clock(struct snd_bebob *bebob, + bool *internal); +int snd_bebob_stream_discover(struct snd_bebob *bebob); +int snd_bebob_stream_map(struct snd_bebob *bebob, + struct amdtp_stream *stream); +int snd_bebob_stream_init_duplex(struct snd_bebob *bebob); +int snd_bebob_stream_start_duplex(struct snd_bebob *bebob, int rate); +void snd_bebob_stream_stop_duplex(struct snd_bebob *bebob); +void snd_bebob_stream_update_duplex(struct snd_bebob *bebob); +void snd_bebob_stream_destroy_duplex(struct snd_bebob *bebob); + #define SND_BEBOB_DEV_ENTRY(vendor, model) \ { \ .match_flags = IEEE1394_MATCH_VENDOR_ID | \ |