37 #define CX18_DSP0_INTERRUPT_MASK 0xd0004C
50 #define CX18_V4L2_ENC_TS_OFFSET 16
52 #define CX18_V4L2_ENC_PCM_OFFSET 24
54 #define CX18_V4L2_ENC_YUV_OFFSET 32
61 } cx18_stream_info[] = {
121 if ((width < 48) || (height < 32))
124 buf->
vb.size = (width * height * 2);
125 if ((buf->
vb.baddr != 0) && (buf->
vb.bsize < buf->
vb.size))
129 if (buf->
vb.width != width || buf->
vb.height != height ||
148 if ((buf->
vb.baddr != 0) && (buf->
vb.bsize < buf->
vb.size))
151 if (buf->
vb.field == 0)
183 #define VB_MIN_BUFFERS 32
184 #define VB_MIN_BUFSIZE 4147200
192 *size = 2 * cx->
cxhdl.width * cx->
cxhdl.height;
214 return cx18_prepare_buffer(q, s, buf, s->
pixelformat,
240 .buf_setup = buffer_setup,
241 .buf_prepare = buffer_prepare,
242 .buf_queue = buffer_queue,
243 .buf_release = buffer_release,
246 static void cx18_stream_init(
struct cx18 *cx,
int type)
259 s->
name = cx18_stream_info[
type].name;
262 s->
dma = cx18_stream_info[
type].dma;
304 static int cx18_prep_dev(
struct cx18 *cx,
int type)
322 s->
name = cx18_stream_info[
type].name;
337 CX18_INFO(
"Disabled %s device\n", cx18_stream_info[type].
name);
341 cx18_stream_init(cx, type);
348 CX18_ERR(
"Couldn't allocate cx18_dvb structure"
349 " for %s\n", s->
name);
358 if (num_offset == -1)
364 CX18_ERR(
"Couldn't allocate v4l2 video_device for %s\n",
374 s->
video_dev->fops = &cx18_v4l2_enc_fops;
391 ret = cx18_prep_dev(cx, type);
400 if (type == CX18_MAX_STREAMS)
408 static int cx18_reg_dev(
struct cx18 *cx,
int type)
418 CX18_ERR(
"DVB failed to register\n");
433 + cx18_stream_info[
type].num_offset;
438 ret = video_register_device_no_warn(s->
video_dev, vfl_type, num);
440 CX18_ERR(
"Couldn't register v4l2 device for %s (device node number %d)\n",
447 name = video_device_node_name(s->
video_dev);
451 CX18_INFO(
"Registered device %s for %s (%d x %d.%02d kB)\n",
468 CX18_INFO(
"Registered device %s for %s\n",
485 err = cx18_reg_dev(cx, type);
530 if (cx->
streams[type].buffers != 0)
559 int raw = cx18_raw_vbi(cx);
565 cx->
vbi.start[0] = 10;
566 cx->
vbi.start[1] = 273;
569 cx->
vbi.start[0] = 6;
570 cx->
vbi.start[1] = 318;
588 lines = cx->
vbi.count * 2;
604 lines = cx->
is_60hz ? (21 - 4 + 1) * 2 : (23 - 2 + 1) * 2;
609 data[1] = (lines / 2) | ((lines / 2) << 16);
611 data[2] = (raw ? vbi_active_samples
612 : (cx->
is_60hz ? vbi_hblank_samples_60Hz
613 : vbi_hblank_samples_50Hz));
627 data[4] = 0x20602060;
635 data[5] = 0x307090d0;
651 data[4] = 0xB0F0B0F0;
657 data[5] = 0xA0E0A0E0;
661 data[0], data[1], data[2], data[3], data[4], data[5]);
671 if (!cx18_stream_enabled(s))
689 cx18_enqueue(s, mdl, &s->
q_free);
703 return cx18_enqueue(s, mdl, &s->
q_free);
705 q = cx18_enqueue(s, mdl, &s->
q_busy);
709 cx18_mdl_sync_for_device(s, mdl);
717 void _cx18_stream_load_fw_queue(
struct cx18_stream *s)
731 q = _cx18_stream_put_mdl_fw(s, mdl);
741 _cx18_stream_load_fw_queue(s);
744 static void cx18_stream_configure_mdls(
struct cx18_stream *s)
756 s->
mdl_size = 720 * s->
cx->cxhdl.height * 3 / 2;
765 if (cx18_raw_vbi(s->
cx)) {
767 * 2 * vbi_active_samples;
775 ? (21 - 4 + 1) * 2 * vbi_hblank_samples_60Hz
776 : (23 - 2 + 1) * 2 * vbi_hblank_samples_50Hz;
795 if (!cx18_stream_enabled(s))
822 #ifdef CX18_ENCODER_PARSES_SLICED
823 captype = cx18_raw_vbi(cx) ?
833 cx->
vbi.inserted_frame = 0;
835 0,
sizeof(cx->
vbi.sliced_mpeg_size));
892 s->
handle, cx18_stream_enabled(s_idx) ? 7 : 0);
902 if (!cx->
cxhdl.video_mute &&
932 cx18_stream_configure_mdls(s);
933 _cx18_stream_load_fw_queue(s);
972 if (!cx18_stream_enabled(s))
983 if (!cx18_stream_enabled(s))
1001 CX18_INFO(
"ignoring gop_end: not (yet?) supported by the firmware\n");
1055 if (cx18_stream_enabled(s))