diff options
author | Devin Heitmueller <dheitmueller@kernellabs.com> | 2010-01-18 19:29:51 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-02-26 13:10:43 -0500 |
commit | 9972de904216828c9f9f9d638df52206aa2bacd1 (patch) | |
tree | 6f0fdaa8835a32ad348782debbe3d4a68168237b /drivers/media/video/cx18/cx18-mailbox.c | |
parent | 8ef22f794ea5577505bc71e468183585f429afde (diff) |
V4L/DVB: cx18: overhaul ALSA PCM device handling so it works
Add code so that the PCM ALSA device actually works, and update the
cx18-streams mechanism so that it passes the data off to the cx18-alsa module.
This work was sponsored by ONELAN Limited.
Signed-off-by: Devin Heitmueller <dheitmueller@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx18/cx18-mailbox.c')
-rw-r--r-- | drivers/media/video/cx18/cx18-mailbox.c | 46 |
1 files changed, 41 insertions, 5 deletions
diff --git a/drivers/media/video/cx18/cx18-mailbox.c b/drivers/media/video/cx18/cx18-mailbox.c index 0ac0e2c993a5..6dcce297752f 100644 --- a/drivers/media/video/cx18/cx18-mailbox.c +++ b/drivers/media/video/cx18/cx18-mailbox.c | |||
@@ -29,6 +29,7 @@ | |||
29 | #include "cx18-mailbox.h" | 29 | #include "cx18-mailbox.h" |
30 | #include "cx18-queue.h" | 30 | #include "cx18-queue.h" |
31 | #include "cx18-streams.h" | 31 | #include "cx18-streams.h" |
32 | #include "cx18-alsa-pcm.h" /* FIXME make configurable */ | ||
32 | 33 | ||
33 | static const char *rpu_str[] = { "APU", "CPU", "EPU", "HPU" }; | 34 | static const char *rpu_str[] = { "APU", "CPU", "EPU", "HPU" }; |
34 | 35 | ||
@@ -157,6 +158,34 @@ static void cx18_mdl_send_to_dvb(struct cx18_stream *s, struct cx18_mdl *mdl) | |||
157 | } | 158 | } |
158 | } | 159 | } |
159 | 160 | ||
161 | |||
162 | static void cx18_mdl_send_to_alsa(struct cx18 *cx, struct cx18_stream *s, | ||
163 | struct cx18_mdl *mdl) | ||
164 | { | ||
165 | struct cx18_buffer *buf; | ||
166 | |||
167 | if (mdl->bytesused == 0) | ||
168 | return; | ||
169 | |||
170 | /* We ignore mdl and buf readpos accounting here - it doesn't matter */ | ||
171 | |||
172 | /* The likely case */ | ||
173 | if (list_is_singular(&mdl->buf_list)) { | ||
174 | buf = list_first_entry(&mdl->buf_list, struct cx18_buffer, | ||
175 | list); | ||
176 | if (buf->bytesused) | ||
177 | cx->pcm_announce_callback(cx->alsa, buf->buf, | ||
178 | buf->bytesused); | ||
179 | return; | ||
180 | } | ||
181 | |||
182 | list_for_each_entry(buf, &mdl->buf_list, list) { | ||
183 | if (buf->bytesused == 0) | ||
184 | break; | ||
185 | cx->pcm_announce_callback(cx->alsa, buf->buf, buf->bytesused); | ||
186 | } | ||
187 | } | ||
188 | |||
160 | static void epu_dma_done(struct cx18 *cx, struct cx18_in_work_order *order) | 189 | static void epu_dma_done(struct cx18 *cx, struct cx18_in_work_order *order) |
161 | { | 190 | { |
162 | u32 handle, mdl_ack_count, id; | 191 | u32 handle, mdl_ack_count, id; |
@@ -223,15 +252,22 @@ static void epu_dma_done(struct cx18 *cx, struct cx18_in_work_order *order) | |||
223 | CX18_DEBUG_HI_DMA("%s recv bytesused = %d\n", | 252 | CX18_DEBUG_HI_DMA("%s recv bytesused = %d\n", |
224 | s->name, mdl->bytesused); | 253 | s->name, mdl->bytesused); |
225 | 254 | ||
226 | if (s->type != CX18_ENC_STREAM_TYPE_TS) { | 255 | if (s->type == CX18_ENC_STREAM_TYPE_TS) { |
256 | cx18_mdl_send_to_dvb(s, mdl); | ||
257 | cx18_enqueue(s, mdl, &s->q_free); | ||
258 | } else if (s->type == CX18_ENC_STREAM_TYPE_PCM) { | ||
259 | /* Pass the data to cx18-alsa */ | ||
260 | if (cx->pcm_announce_callback != NULL) { | ||
261 | cx18_mdl_send_to_alsa(cx, s, mdl); | ||
262 | cx18_enqueue(s, mdl, &s->q_free); | ||
263 | } else { | ||
264 | cx18_enqueue(s, mdl, &s->q_full); | ||
265 | } | ||
266 | } else { | ||
227 | cx18_enqueue(s, mdl, &s->q_full); | 267 | cx18_enqueue(s, mdl, &s->q_full); |
228 | if (s->type == CX18_ENC_STREAM_TYPE_IDX) | 268 | if (s->type == CX18_ENC_STREAM_TYPE_IDX) |
229 | cx18_stream_rotate_idx_mdls(cx); | 269 | cx18_stream_rotate_idx_mdls(cx); |
230 | } | 270 | } |
231 | else { | ||
232 | cx18_mdl_send_to_dvb(s, mdl); | ||
233 | cx18_enqueue(s, mdl, &s->q_free); | ||
234 | } | ||
235 | } | 271 | } |
236 | /* Put as many MDLs as possible back into fw use */ | 272 | /* Put as many MDLs as possible back into fw use */ |
237 | cx18_stream_load_fw_queue(s); | 273 | cx18_stream_load_fw_queue(s); |