aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx18/cx18-driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/cx18/cx18-driver.c')
-rw-r--r--drivers/media/video/cx18/cx18-driver.c60
1 files changed, 44 insertions, 16 deletions
diff --git a/drivers/media/video/cx18/cx18-driver.c b/drivers/media/video/cx18/cx18-driver.c
index e12082b8a08d..7f65a47f12e1 100644
--- a/drivers/media/video/cx18/cx18-driver.c
+++ b/drivers/media/video/cx18/cx18-driver.c
@@ -87,7 +87,6 @@ static int enc_ts_bufsize = CX18_DEFAULT_ENC_TS_BUFSIZE;
87static int enc_mpg_bufsize = CX18_DEFAULT_ENC_MPG_BUFSIZE; 87static int enc_mpg_bufsize = CX18_DEFAULT_ENC_MPG_BUFSIZE;
88static int enc_idx_bufsize = CX18_DEFAULT_ENC_IDX_BUFSIZE; 88static int enc_idx_bufsize = CX18_DEFAULT_ENC_IDX_BUFSIZE;
89static int enc_yuv_bufsize = CX18_DEFAULT_ENC_YUV_BUFSIZE; 89static int enc_yuv_bufsize = CX18_DEFAULT_ENC_YUV_BUFSIZE;
90/* VBI bufsize based on standards supported by card tuner for now */
91static int enc_pcm_bufsize = CX18_DEFAULT_ENC_PCM_BUFSIZE; 90static int enc_pcm_bufsize = CX18_DEFAULT_ENC_PCM_BUFSIZE;
92 91
93static int enc_ts_bufs = -1; 92static int enc_ts_bufs = -1;
@@ -128,7 +127,6 @@ module_param(enc_ts_bufsize, int, 0644);
128module_param(enc_mpg_bufsize, int, 0644); 127module_param(enc_mpg_bufsize, int, 0644);
129module_param(enc_idx_bufsize, int, 0644); 128module_param(enc_idx_bufsize, int, 0644);
130module_param(enc_yuv_bufsize, int, 0644); 129module_param(enc_yuv_bufsize, int, 0644);
131/* VBI bufsize based on standards supported by card tuner for now */
132module_param(enc_pcm_bufsize, int, 0644); 130module_param(enc_pcm_bufsize, int, 0644);
133 131
134module_param(enc_ts_bufs, int, 0644); 132module_param(enc_ts_bufs, int, 0644);
@@ -211,7 +209,9 @@ MODULE_PARM_DESC(enc_yuv_buffers,
211 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_YUV_BUFFERS)); 209 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_YUV_BUFFERS));
212MODULE_PARM_DESC(enc_yuv_bufsize, 210MODULE_PARM_DESC(enc_yuv_bufsize,
213 "Size of an encoder YUV buffer (kB)\n" 211 "Size of an encoder YUV buffer (kB)\n"
214 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_YUV_BUFSIZE)); 212 "\t\t\tAllowed values are multiples of 33.75 kB rounded up\n"
213 "\t\t\t(multiples of size required for 32 screen lines)\n"
214 "\t\t\tDefault: 102");
215MODULE_PARM_DESC(enc_yuv_bufs, 215MODULE_PARM_DESC(enc_yuv_bufs,
216 "Number of encoder YUV buffers\n" 216 "Number of encoder YUV buffers\n"
217 "\t\t\tDefault is computed from other enc_yuv_* parameters"); 217 "\t\t\tDefault is computed from other enc_yuv_* parameters");
@@ -220,7 +220,7 @@ MODULE_PARM_DESC(enc_vbi_buffers,
220 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_VBI_BUFFERS)); 220 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_VBI_BUFFERS));
221MODULE_PARM_DESC(enc_vbi_bufs, 221MODULE_PARM_DESC(enc_vbi_bufs,
222 "Number of encoder VBI buffers\n" 222 "Number of encoder VBI buffers\n"
223 "\t\t\tDefault is computed from enc_vbi_buffers & tuner std"); 223 "\t\t\tDefault is computed from enc_vbi_buffers");
224MODULE_PARM_DESC(enc_pcm_buffers, 224MODULE_PARM_DESC(enc_pcm_buffers,
225 "Encoder PCM buffer memory (MB). (enc_pcm_bufs can override)\n" 225 "Encoder PCM buffer memory (MB). (enc_pcm_bufs can override)\n"
226 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_PCM_BUFFERS)); 226 "\t\t\tDefault: " __stringify(CX18_DEFAULT_ENC_PCM_BUFFERS));
@@ -499,10 +499,27 @@ static void cx18_process_options(struct cx18 *cx)
499 continue; 499 continue;
500 } 500 }
501 /* 501 /*
502 * YUV is a special case where the stream_buf_size needs to be
503 * an integral multiple of 33.75 kB (storage for 32 screens
504 * lines to maintain alignment in case of lost buffers
505 */
506 if (i == CX18_ENC_STREAM_TYPE_YUV) {
507 cx->stream_buf_size[i] *= 1024;
508 cx->stream_buf_size[i] -=
509 (cx->stream_buf_size[i] % CX18_UNIT_ENC_YUV_BUFSIZE);
510
511 if (cx->stream_buf_size[i] < CX18_UNIT_ENC_YUV_BUFSIZE)
512 cx->stream_buf_size[i] =
513 CX18_UNIT_ENC_YUV_BUFSIZE;
514 }
515 /*
516 * YUV is a special case where the stream_buf_size is
517 * now in bytes.
502 * VBI is a special case where the stream_buf_size is fixed 518 * VBI is a special case where the stream_buf_size is fixed
503 * and already in bytes 519 * and already in bytes
504 */ 520 */
505 if (i == CX18_ENC_STREAM_TYPE_VBI) { 521 if (i == CX18_ENC_STREAM_TYPE_VBI ||
522 i == CX18_ENC_STREAM_TYPE_YUV) {
506 if (cx->stream_buffers[i] < 0) { 523 if (cx->stream_buffers[i] < 0) {
507 cx->stream_buffers[i] = 524 cx->stream_buffers[i] =
508 cx->options.megabytes[i] * 1024 * 1024 525 cx->options.megabytes[i] * 1024 * 1024
@@ -513,18 +530,24 @@ static void cx18_process_options(struct cx18 *cx)
513 cx->stream_buffers[i] 530 cx->stream_buffers[i]
514 * cx->stream_buf_size[i]/(1024 * 1024); 531 * cx->stream_buf_size[i]/(1024 * 1024);
515 } 532 }
516 continue;
517 }
518 /* All other streams have stream_buf_size in kB at this point */
519 if (cx->stream_buffers[i] < 0) {
520 cx->stream_buffers[i] = cx->options.megabytes[i] * 1024
521 / cx->stream_buf_size[i];
522 } else { 533 } else {
523 /* N.B. This might round down to 0 */ 534 /* All other streams have stream_buf_size in kB here */
524 cx->options.megabytes[i] = 535 if (cx->stream_buffers[i] < 0) {
525 cx->stream_buffers[i] * cx->stream_buf_size[i] / 1024; 536 cx->stream_buffers[i] =
537 cx->options.megabytes[i] * 1024
538 / cx->stream_buf_size[i];
539 } else {
540 /* N.B. This might round down to 0 */
541 cx->options.megabytes[i] =
542 cx->stream_buffers[i]
543 * cx->stream_buf_size[i] / 1024;
544 }
545 /* convert from kB to bytes */
546 cx->stream_buf_size[i] *= 1024;
526 } 547 }
527 cx->stream_buf_size[i] *= 1024; /* convert from kB to bytes */ 548 CX18_DEBUG_INFO("Stream type %d options: %d MB, %d buffers, "
549 "%d bytes\n", i, cx->options.megabytes[i],
550 cx->stream_buffers[i], cx->stream_buf_size[i]);
528 } 551 }
529 552
530 cx->options.cardtype = cardtype[cx->instance]; 553 cx->options.cardtype = cardtype[cx->instance];
@@ -669,6 +692,12 @@ static int __devinit cx18_init_struct1(struct cx18 *cx)
669 cx->vbi.in.type = V4L2_BUF_TYPE_VBI_CAPTURE; 692 cx->vbi.in.type = V4L2_BUF_TYPE_VBI_CAPTURE;
670 cx->vbi.sliced_in = &cx->vbi.in.fmt.sliced; 693 cx->vbi.sliced_in = &cx->vbi.in.fmt.sliced;
671 694
695 /* IVTV style VBI insertion into MPEG streams */
696 INIT_LIST_HEAD(&cx->vbi.sliced_mpeg_buf.list);
697 INIT_LIST_HEAD(&cx->vbi.sliced_mpeg_mdl.list);
698 INIT_LIST_HEAD(&cx->vbi.sliced_mpeg_mdl.buf_list);
699 list_add(&cx->vbi.sliced_mpeg_buf.list,
700 &cx->vbi.sliced_mpeg_mdl.buf_list);
672 return 0; 701 return 0;
673} 702}
674 703
@@ -883,7 +912,6 @@ static int __devinit cx18_probe(struct pci_dev *pci_dev,
883 CX18_ERR("Could not register A/V decoder subdevice\n"); 912 CX18_ERR("Could not register A/V decoder subdevice\n");
884 goto free_map; 913 goto free_map;
885 } 914 }
886 cx18_call_hw(cx, CX18_HW_418_AV, core, init, 0);
887 915
888 /* Initialize GPIO Reset Controller to do chip resets during i2c init */ 916 /* Initialize GPIO Reset Controller to do chip resets during i2c init */
889 if (cx->card->hw_all & CX18_HW_GPIO_RESET_CTRL) { 917 if (cx->card->hw_all & CX18_HW_GPIO_RESET_CTRL) {