aboutsummaryrefslogtreecommitdiffstats
path: root/sound/firewire/amdtp.h
diff options
context:
space:
mode:
authorClemens Ladisch <clemens@ladisch.de>2011-09-04 16:16:10 -0400
committerClemens Ladisch <clemens@ladisch.de>2013-10-20 16:07:57 -0400
commita7304e3bf0489d3fc0260bdb9c1441427a26a38f (patch)
treeb787f526cf2063c9a437166116a9570d19337454 /sound/firewire/amdtp.h
parentcbab328ddc78589233be8be2f1e6a5f9d97b81db (diff)
ALSA: dice: support dual-wire stream format at 192 kHz
Change the AMDTP streaming code to handle the non-standard stream format that DICE devices use at sample rates greater than 96 kHz. Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
Diffstat (limited to 'sound/firewire/amdtp.h')
-rw-r--r--sound/firewire/amdtp.h41
1 files changed, 13 insertions, 28 deletions
diff --git a/sound/firewire/amdtp.h b/sound/firewire/amdtp.h
index 28b1bf5891e6..f3d03dd92c39 100644
--- a/sound/firewire/amdtp.h
+++ b/sound/firewire/amdtp.h
@@ -15,10 +15,15 @@
15 * @CIP_BLOCKING: In blocking mode, each packet contains either zero or 15 * @CIP_BLOCKING: In blocking mode, each packet contains either zero or
16 * SYT_INTERVAL samples, with these two types alternating so that 16 * SYT_INTERVAL samples, with these two types alternating so that
17 * the overall sample rate comes out right. 17 * the overall sample rate comes out right.
18 * @CIP_HI_DUALWIRE: At rates above 96 kHz, pretend that the stream runs
19 * at half the actual sample rate with twice the number of channels;
20 * two samples of a channel are stored consecutively in the packet.
21 * Requires blocking mode and SYT_INTERVAL-aligned PCM buffer size.
18 */ 22 */
19enum cip_out_flags { 23enum cip_out_flags {
20 CIP_NONBLOCKING = 0x00, 24 CIP_NONBLOCKING = 0x00,
21 CIP_BLOCKING = 0x01, 25 CIP_BLOCKING = 0x01,
26 CIP_HI_DUALWIRE = 0x02,
22}; 27};
23 28
24/** 29/**
@@ -32,6 +37,7 @@ enum cip_sfc {
32 CIP_SFC_96000 = 4, 37 CIP_SFC_96000 = 4,
33 CIP_SFC_176400 = 5, 38 CIP_SFC_176400 = 5,
34 CIP_SFC_192000 = 6, 39 CIP_SFC_192000 = 6,
40 CIP_SFC_COUNT
35}; 41};
36 42
37#define AMDTP_OUT_PCM_FORMAT_BITS (SNDRV_PCM_FMTBIT_S16 | \ 43#define AMDTP_OUT_PCM_FORMAT_BITS (SNDRV_PCM_FMTBIT_S16 | \
@@ -48,6 +54,7 @@ struct amdtp_out_stream {
48 struct mutex mutex; 54 struct mutex mutex;
49 55
50 enum cip_sfc sfc; 56 enum cip_sfc sfc;
57 bool dual_wire;
51 unsigned int data_block_quadlets; 58 unsigned int data_block_quadlets;
52 unsigned int pcm_channels; 59 unsigned int pcm_channels;
53 unsigned int midi_ports; 60 unsigned int midi_ports;
@@ -80,7 +87,10 @@ int amdtp_out_stream_init(struct amdtp_out_stream *s, struct fw_unit *unit,
80 enum cip_out_flags flags); 87 enum cip_out_flags flags);
81void amdtp_out_stream_destroy(struct amdtp_out_stream *s); 88void amdtp_out_stream_destroy(struct amdtp_out_stream *s);
82 89
83void amdtp_out_stream_set_rate(struct amdtp_out_stream *s, unsigned int rate); 90void amdtp_out_stream_set_parameters(struct amdtp_out_stream *s,
91 unsigned int rate,
92 unsigned int pcm_channels,
93 unsigned int midi_ports);
84unsigned int amdtp_out_stream_get_max_payload(struct amdtp_out_stream *s); 94unsigned int amdtp_out_stream_get_max_payload(struct amdtp_out_stream *s);
85 95
86int amdtp_out_stream_start(struct amdtp_out_stream *s, int channel, int speed); 96int amdtp_out_stream_start(struct amdtp_out_stream *s, int channel, int speed);
@@ -93,39 +103,14 @@ void amdtp_out_stream_pcm_prepare(struct amdtp_out_stream *s);
93unsigned long amdtp_out_stream_pcm_pointer(struct amdtp_out_stream *s); 103unsigned long amdtp_out_stream_pcm_pointer(struct amdtp_out_stream *s);
94void amdtp_out_stream_pcm_abort(struct amdtp_out_stream *s); 104void amdtp_out_stream_pcm_abort(struct amdtp_out_stream *s);
95 105
106extern unsigned int amdtp_syt_intervals[CIP_SFC_COUNT];
107
96static inline bool amdtp_out_stream_running(struct amdtp_out_stream *s) 108static inline bool amdtp_out_stream_running(struct amdtp_out_stream *s)
97{ 109{
98 return !IS_ERR(s->context); 110 return !IS_ERR(s->context);
99} 111}
100 112
101/** 113/**
102 * amdtp_out_stream_set_pcm - configure format of PCM samples
103 * @s: the AMDTP output stream to be configured
104 * @pcm_channels: the number of PCM samples in each data block, to be encoded
105 * as AM824 multi-bit linear audio
106 *
107 * This function must not be called while the stream is running.
108 */
109static inline void amdtp_out_stream_set_pcm(struct amdtp_out_stream *s,
110 unsigned int pcm_channels)
111{
112 s->pcm_channels = pcm_channels;
113}
114
115/**
116 * amdtp_out_stream_set_midi - configure format of MIDI data
117 * @s: the AMDTP output stream to be configured
118 * @midi_ports: the number of MIDI ports (i.e., MPX-MIDI Data Channels)
119 *
120 * This function must not be called while the stream is running.
121 */
122static inline void amdtp_out_stream_set_midi(struct amdtp_out_stream *s,
123 unsigned int midi_ports)
124{
125 s->midi_ports = midi_ports;
126}
127
128/**
129 * amdtp_out_streaming_error - check for streaming error 114 * amdtp_out_streaming_error - check for streaming error
130 * @s: the AMDTP output stream 115 * @s: the AMDTP output stream
131 * 116 *