aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-12-19 18:33:51 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-12-30 05:02:02 -0500
commit52cb0bf275debe4ec8950157f11b9d9f14447a88 (patch)
tree6c93b95ebef288b3b8f5c575c818593cfc47b230 /drivers/media
parent5490a7cbe65d63c6ec45f1013287af1e390c95d7 (diff)
[media] usbvision: convert // to /* */
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/usbvision/usbvision-core.c222
-rw-r--r--drivers/media/video/usbvision/usbvision-i2c.c2
-rw-r--r--drivers/media/video/usbvision/usbvision-video.c60
-rw-r--r--drivers/media/video/usbvision/usbvision.h64
4 files changed, 173 insertions, 175 deletions
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c
index 372e21b35ed3..64a913323181 100644
--- a/drivers/media/video/usbvision/usbvision-core.c
+++ b/drivers/media/video/usbvision/usbvision-core.c
@@ -103,10 +103,10 @@ static const int min_imgheight = MIN_FRAME_HEIGHT;
103 * to work with. This setting can be adjusted, but the default value 103 * to work with. This setting can be adjusted, but the default value
104 * should be OK for most desktop users. 104 * should be OK for most desktop users.
105 */ 105 */
106#define DEFAULT_SCRATCH_BUF_SIZE (0x20000) // 128kB memory scratch buffer 106#define DEFAULT_SCRATCH_BUF_SIZE (0x20000) /* 128kB memory scratch buffer */
107static const int scratch_buf_size = DEFAULT_SCRATCH_BUF_SIZE; 107static const int scratch_buf_size = DEFAULT_SCRATCH_BUF_SIZE;
108 108
109// Function prototypes 109/* Function prototypes */
110static int usbvision_request_intra (struct usb_usbvision *usbvision); 110static int usbvision_request_intra (struct usb_usbvision *usbvision);
111static int usbvision_unrequest_intra (struct usb_usbvision *usbvision); 111static int usbvision_unrequest_intra (struct usb_usbvision *usbvision);
112static int usbvision_adjust_compression (struct usb_usbvision *usbvision); 112static int usbvision_adjust_compression (struct usb_usbvision *usbvision);
@@ -183,7 +183,7 @@ static void usbvision_hexdump(const unsigned char *data, int len)
183/******************************** 183/********************************
184 * scratch ring buffer handling 184 * scratch ring buffer handling
185 ********************************/ 185 ********************************/
186static int scratch_len(struct usb_usbvision *usbvision) /*This returns the amount of data actually in the buffer */ 186static int scratch_len(struct usb_usbvision *usbvision) /* This returns the amount of data actually in the buffer */
187{ 187{
188 int len = usbvision->scratch_write_ptr - usbvision->scratch_read_ptr; 188 int len = usbvision->scratch_write_ptr - usbvision->scratch_read_ptr;
189 if (len < 0) { 189 if (len < 0) {
@@ -287,7 +287,7 @@ static void scratch_set_extra_ptr(struct usb_usbvision *usbvision, int *ptr,
287} 287}
288 288
289 289
290/*This increments the scratch extra read pointer */ 290/* This increments the scratch extra read pointer */
291static void scratch_inc_extra_ptr(int *ptr, int len) 291static void scratch_inc_extra_ptr(int *ptr, int len)
292{ 292{
293 *ptr = (*ptr + len) % scratch_buf_size; 293 *ptr = (*ptr + len) % scratch_buf_size;
@@ -352,7 +352,7 @@ static int scratch_get_header(struct usb_usbvision *usbvision,
352} 352}
353 353
354 354
355/*This removes len bytes of old data from the buffer */ 355/* This removes len bytes of old data from the buffer */
356static void scratch_rm_old(struct usb_usbvision *usbvision, int len) 356static void scratch_rm_old(struct usb_usbvision *usbvision, int len)
357{ 357{
358 358
@@ -362,7 +362,7 @@ static void scratch_rm_old(struct usb_usbvision *usbvision, int len)
362} 362}
363 363
364 364
365/*This resets the buffer - kills all data in it too */ 365/* This resets the buffer - kills all data in it too */
366static void scratch_reset(struct usb_usbvision *usbvision) 366static void scratch_reset(struct usb_usbvision *usbvision)
367{ 367{
368 PDEBUG(DBG_SCRATCH, "\n"); 368 PDEBUG(DBG_SCRATCH, "\n");
@@ -525,7 +525,7 @@ static enum parse_state usbvision_find_header(struct usb_usbvision *usbvision)
525 frame = usbvision->cur_frame; 525 frame = usbvision->cur_frame;
526 526
527 while (scratch_get_header(usbvision, &frame->isoc_header) == USBVISION_HEADER_LENGTH) { 527 while (scratch_get_header(usbvision, &frame->isoc_header) == USBVISION_HEADER_LENGTH) {
528 // found header in scratch 528 /* found header in scratch */
529 PDEBUG(DBG_HEADER, "found header: 0x%02x%02x %d %d %d %d %#x 0x%02x %u %u", 529 PDEBUG(DBG_HEADER, "found header: 0x%02x%02x %d %d %d %d %#x 0x%02x %u %u",
530 frame->isoc_header.magic_2, 530 frame->isoc_header.magic_2,
531 frame->isoc_header.magic_1, 531 frame->isoc_header.magic_1,
@@ -541,7 +541,7 @@ static enum parse_state usbvision_find_header(struct usb_usbvision *usbvision)
541 if (usbvision->request_intra) { 541 if (usbvision->request_intra) {
542 if (frame->isoc_header.format_param & 0x80) { 542 if (frame->isoc_header.format_param & 0x80) {
543 found_header = 1; 543 found_header = 1;
544 usbvision->last_isoc_frame_num = -1; // do not check for lost frames this time 544 usbvision->last_isoc_frame_num = -1; /* do not check for lost frames this time */
545 usbvision_unrequest_intra(usbvision); 545 usbvision_unrequest_intra(usbvision);
546 break; 546 break;
547 } 547 }
@@ -557,18 +557,18 @@ static enum parse_state usbvision_find_header(struct usb_usbvision *usbvision)
557 frame->frmheight = frame->isoc_header.frame_height * usbvision->stretch_height; 557 frame->frmheight = frame->isoc_header.frame_height * usbvision->stretch_height;
558 frame->v4l2_linesize = (frame->frmwidth * frame->v4l2_format.depth)>> 3; 558 frame->v4l2_linesize = (frame->frmwidth * frame->v4l2_format.depth)>> 3;
559 } 559 }
560 else { // no header found 560 else { /* no header found */
561 PDEBUG(DBG_HEADER, "skipping scratch data, no header"); 561 PDEBUG(DBG_HEADER, "skipping scratch data, no header");
562 scratch_reset(usbvision); 562 scratch_reset(usbvision);
563 return parse_state_end_parse; 563 return parse_state_end_parse;
564 } 564 }
565 565
566 // found header 566 /* found header */
567 if (frame->isoc_header.data_format==ISOC_MODE_COMPRESS) { 567 if (frame->isoc_header.data_format==ISOC_MODE_COMPRESS) {
568 //check isoc_header.frame_num for lost frames 568 /* check isoc_header.frame_num for lost frames */
569 if (usbvision->last_isoc_frame_num >= 0) { 569 if (usbvision->last_isoc_frame_num >= 0) {
570 if (((usbvision->last_isoc_frame_num + 1) % 32) != frame->isoc_header.frame_num) { 570 if (((usbvision->last_isoc_frame_num + 1) % 32) != frame->isoc_header.frame_num) {
571 // unexpected frame drop: need to request new intra frame 571 /* unexpected frame drop: need to request new intra frame */
572 PDEBUG(DBG_HEADER, "Lost frame before %d on USB", frame->isoc_header.frame_num); 572 PDEBUG(DBG_HEADER, "Lost frame before %d on USB", frame->isoc_header.frame_num);
573 usbvision_request_intra(usbvision); 573 usbvision_request_intra(usbvision);
574 return parse_state_next_frame; 574 return parse_state_next_frame;
@@ -594,8 +594,8 @@ static enum parse_state usbvision_parse_lines_422(struct usb_usbvision *usbvisio
594 unsigned char *f; 594 unsigned char *f;
595 int len; 595 int len;
596 int i; 596 int i;
597 unsigned char yuyv[4]={180, 128, 10, 128}; // YUV components 597 unsigned char yuyv[4]={180, 128, 10, 128}; /* YUV components */
598 unsigned char rv, gv, bv; // RGB components 598 unsigned char rv, gv, bv; /* RGB components */
599 int clipmask_index, bytes_per_pixel; 599 int clipmask_index, bytes_per_pixel;
600 int stretch_bytes, clipmask_add; 600 int stretch_bytes, clipmask_add;
601 601
@@ -623,8 +623,8 @@ static enum parse_state usbvision_parse_lines_422(struct usb_usbvision *usbvisio
623 scratch_get(usbvision, &yuyv[0], 4); 623 scratch_get(usbvision, &yuyv[0], 4);
624 624
625 if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) { 625 if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) {
626 *f++ = yuyv[0]; // Y 626 *f++ = yuyv[0]; /* Y */
627 *f++ = yuyv[3]; // U 627 *f++ = yuyv[3]; /* U */
628 } 628 }
629 else { 629 else {
630 630
@@ -659,8 +659,8 @@ static enum parse_state usbvision_parse_lines_422(struct usb_usbvision *usbvisio
659 f += stretch_bytes; 659 f += stretch_bytes;
660 660
661 if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) { 661 if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) {
662 *f++ = yuyv[2]; // Y 662 *f++ = yuyv[2]; /* Y */
663 *f++ = yuyv[1]; // V 663 *f++ = yuyv[1]; /* V */
664 } 664 }
665 else { 665 else {
666 666
@@ -717,7 +717,7 @@ static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *c
717 integrator = 0; 717 integrator = 0;
718 pos = *start_pos; 718 pos = *start_pos;
719 block_type_pos = *block_typestart_pos; 719 block_type_pos = *block_typestart_pos;
720 max_pos = 396; //pos + len; 720 max_pos = 396; /* pos + len; */
721 extra_pos = pos; 721 extra_pos = pos;
722 block_len = 0; 722 block_len = 0;
723 block_byte = 0; 723 block_byte = 0;
@@ -737,7 +737,7 @@ static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *c
737 } 737 }
738 block_type = (block_type_byte & 0xC0) >> 6; 738 block_type = (block_type_byte & 0xC0) >> 6;
739 739
740 //statistic: 740 /* statistic: */
741 usbvision->compr_block_types[block_type]++; 741 usbvision->compr_block_types[block_type]++;
742 742
743 pos = extra_pos; 743 pos = extra_pos;
@@ -769,7 +769,7 @@ static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *c
769 block_byte = compressed[pos]; 769 block_byte = compressed[pos];
770 pos++; 770 pos++;
771 } 771 }
772 if (block_type == 1) { //inter Block 772 if (block_type == 1) { /* inter Block */
773 integrator = decompressed[idx]; 773 integrator = decompressed[idx];
774 } 774 }
775 switch (block_byte & 0xC0) { 775 switch (block_byte & 0xC0) {
@@ -823,14 +823,14 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
823 frame = usbvision->cur_frame; 823 frame = usbvision->cur_frame;
824 image_size = frame->frmwidth * frame->frmheight; 824 image_size = frame->frmwidth * frame->frmheight;
825 if ( (frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P) || 825 if ( (frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P) ||
826 (frame->v4l2_format.format == V4L2_PIX_FMT_YVU420) ) { // this is a planar format 826 (frame->v4l2_format.format == V4L2_PIX_FMT_YVU420) ) { /* this is a planar format */
827 //... v4l2_linesize not used here. 827 /* ... v4l2_linesize not used here. */
828 f = frame->data + (frame->width * frame->curline); 828 f = frame->data + (frame->width * frame->curline);
829 } else 829 } else
830 f = frame->data + (frame->v4l2_linesize * frame->curline); 830 f = frame->data + (frame->v4l2_linesize * frame->curline);
831 831
832 if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV){ //initialise u and v pointers 832 if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV){ /* initialise u and v pointers */
833 // get base of u and b planes add halfoffset 833 /* get base of u and b planes add halfoffset */
834 834
835 u = frame->data 835 u = frame->data
836 + image_size 836 + image_size
@@ -851,31 +851,31 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
851 return parse_state_out; 851 return parse_state_out;
852 } 852 }
853 853
854 //get strip header without changing the scratch_read_ptr 854 /* get strip header without changing the scratch_read_ptr */
855 scratch_set_extra_ptr(usbvision, &strip_ptr, 0); 855 scratch_set_extra_ptr(usbvision, &strip_ptr, 0);
856 scratch_get_extra(usbvision, &strip_header[0], &strip_ptr, 856 scratch_get_extra(usbvision, &strip_header[0], &strip_ptr,
857 USBVISION_STRIP_HEADER_LEN); 857 USBVISION_STRIP_HEADER_LEN);
858 858
859 if (strip_header[0] != USBVISION_STRIP_MAGIC) { 859 if (strip_header[0] != USBVISION_STRIP_MAGIC) {
860 // wrong strip magic 860 /* wrong strip magic */
861 usbvision->strip_magic_errors++; 861 usbvision->strip_magic_errors++;
862 return parse_state_next_frame; 862 return parse_state_next_frame;
863 } 863 }
864 864
865 if (frame->curline != (int)strip_header[2]) { 865 if (frame->curline != (int)strip_header[2]) {
866 //line number missmatch error 866 /* line number missmatch error */
867 usbvision->strip_line_number_errors++; 867 usbvision->strip_line_number_errors++;
868 } 868 }
869 869
870 strip_len = 2 * (unsigned int)strip_header[1]; 870 strip_len = 2 * (unsigned int)strip_header[1];
871 if (strip_len > USBVISION_STRIP_LEN_MAX) { 871 if (strip_len > USBVISION_STRIP_LEN_MAX) {
872 // strip overrun 872 /* strip overrun */
873 // I think this never happens 873 /* I think this never happens */
874 usbvision_request_intra(usbvision); 874 usbvision_request_intra(usbvision);
875 } 875 }
876 876
877 if (scratch_len(usbvision) < strip_len) { 877 if (scratch_len(usbvision) < strip_len) {
878 //there is not enough data for the strip 878 /* there is not enough data for the strip */
879 return parse_state_out; 879 return parse_state_out;
880 } 880 }
881 881
@@ -901,7 +901,7 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
901 usbvision->block_pos = block_pos; 901 usbvision->block_pos = block_pos;
902 902
903 if ((rc = usbvision_decompress(usbvision, strip_data, Y, &block_pos, &block_type_pos, idx_end)) != idx_end) { 903 if ((rc = usbvision_decompress(usbvision, strip_data, Y, &block_pos, &block_type_pos, idx_end)) != idx_end) {
904 //return parse_state_continue; 904 /* return parse_state_continue; */
905 } 905 }
906 if (strip_len > usbvision->max_strip_len) { 906 if (strip_len > usbvision->max_strip_len) {
907 usbvision->max_strip_len = strip_len; 907 usbvision->max_strip_len = strip_len;
@@ -909,12 +909,12 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
909 909
910 if (frame->curline%2) { 910 if (frame->curline%2) {
911 if ((rc = usbvision_decompress(usbvision, strip_data, V, &block_pos, &block_type_pos, idx_end/2)) != idx_end/2) { 911 if ((rc = usbvision_decompress(usbvision, strip_data, V, &block_pos, &block_type_pos, idx_end/2)) != idx_end/2) {
912 //return parse_state_continue; 912 /* return parse_state_continue; */
913 } 913 }
914 } 914 }
915 else { 915 else {
916 if ((rc = usbvision_decompress(usbvision, strip_data, U, &block_pos, &block_type_pos, idx_end/2)) != idx_end/2) { 916 if ((rc = usbvision_decompress(usbvision, strip_data, U, &block_pos, &block_type_pos, idx_end/2)) != idx_end/2) {
917 //return parse_state_continue; 917 /* return parse_state_continue; */
918 } 918 }
919 } 919 }
920 920
@@ -1043,7 +1043,7 @@ static enum parse_state usbvision_parse_lines_420(struct usb_usbvision *usbvisio
1043 pixel_per_line = frame->isoc_header.frame_width; 1043 pixel_per_line = frame->isoc_header.frame_width;
1044 1044
1045 if (scratch_len(usbvision) < (int)pixel_per_line * 3) { 1045 if (scratch_len(usbvision) < (int)pixel_per_line * 3) {
1046 //printk(KERN_DEBUG "out of data, need %d\n", len); 1046 /* printk(KERN_DEBUG "out of data, need %d\n", len); */
1047 return parse_state_out; 1047 return parse_state_out;
1048 } 1048 }
1049 1049
@@ -1051,7 +1051,7 @@ static enum parse_state usbvision_parse_lines_420(struct usb_usbvision *usbvisio
1051 return parse_state_next_frame; 1051 return parse_state_next_frame;
1052 } 1052 }
1053 1053
1054 block_split = (pixel_per_line%y_block_size) ? 1 : 0; //are some blocks splitted into different lines? 1054 block_split = (pixel_per_line%y_block_size) ? 1 : 0; /* are some blocks splitted into different lines? */
1055 1055
1056 y_odd_offset = (pixel_per_line / y_block_size) * (y_block_size + uv_block_size) 1056 y_odd_offset = (pixel_per_line / y_block_size) * (y_block_size + uv_block_size)
1057 + block_split * uv_block_size; 1057 + block_split * uv_block_size;
@@ -1070,7 +1070,7 @@ static enum parse_state usbvision_parse_lines_420(struct usb_usbvision *usbvisio
1070 scratch_get_extra(usbvision, &u, &u_ptr, 1); 1070 scratch_get_extra(usbvision, &u, &u_ptr, 1);
1071 scratch_get_extra(usbvision, &v, &v_ptr, 1); 1071 scratch_get_extra(usbvision, &v, &v_ptr, 1);
1072 1072
1073 //I don't use the YUV_TO_RGB macro for better performance 1073 /* I don't use the YUV_TO_RGB macro for better performance */
1074 v_ = v - 128; 1074 v_ = v - 128;
1075 u_ = u - 128; 1075 u_ = u - 128;
1076 vb = 132252 * v_; 1076 vb = 132252 * v_;
@@ -1370,7 +1370,7 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision,
1370 packet_data = urb->transfer_buffer + urb->iso_frame_desc[i].offset; 1370 packet_data = urb->transfer_buffer + urb->iso_frame_desc[i].offset;
1371 1371
1372 /* Detect and ignore errored packets */ 1372 /* Detect and ignore errored packets */
1373 if (packet_stat) { // packet_stat != 0 ????????????? 1373 if (packet_stat) { /* packet_stat != 0 ????????????? */
1374 PDEBUG(DBG_ISOC, "data error: [%d] len=%d, status=%X", i, packet_len, packet_stat); 1374 PDEBUG(DBG_ISOC, "data error: [%d] len=%d, status=%X", i, packet_len, packet_stat);
1375 usbvision->isoc_err_count++; 1375 usbvision->isoc_err_count++;
1376 continue; 1376 continue;
@@ -1396,7 +1396,7 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision,
1396 1396
1397 PDEBUG(DBG_ISOC, "packet ok [%d] len=%d", i, packet_len); 1397 PDEBUG(DBG_ISOC, "packet ok [%d] len=%d", i, packet_len);
1398 1398
1399 if (usbvision->isocstate==isoc_state_no_frame) { //new frame begins 1399 if (usbvision->isocstate==isoc_state_no_frame) { /* new frame begins */
1400 usbvision->isocstate=isoc_state_in_frame; 1400 usbvision->isocstate=isoc_state_in_frame;
1401 scratch_mark_header(usbvision); 1401 scratch_mark_header(usbvision);
1402 usbvision_measure_bandwidth(usbvision); 1402 usbvision_measure_bandwidth(usbvision);
@@ -1488,7 +1488,7 @@ static void usbvision_isoc_irq(struct urb *urb)
1488 usbvision_parse_data(usbvision); 1488 usbvision_parse_data(usbvision);
1489 } 1489 }
1490 else { 1490 else {
1491 /*If we don't have a frame 1491 /* If we don't have a frame
1492 we're current working on, complain */ 1492 we're current working on, complain */
1493 PDEBUG(DBG_IRQ, 1493 PDEBUG(DBG_IRQ,
1494 "received data, but no one needs it"); 1494 "received data, but no one needs it");
@@ -1623,7 +1623,7 @@ static int usbvision_write_reg_irq(struct usb_usbvision *usbvision,int address,
1623 1623
1624 err_code = usb_submit_urb(usbvision->ctrl_urb, GFP_ATOMIC); 1624 err_code = usb_submit_urb(usbvision->ctrl_urb, GFP_ATOMIC);
1625 if (err_code < 0) { 1625 if (err_code < 0) {
1626 // error in usb_submit_urb() 1626 /* error in usb_submit_urb() */
1627 usbvision->ctrl_urb_busy = 0; 1627 usbvision->ctrl_urb_busy = 0;
1628 } 1628 }
1629 PDEBUG(DBG_IRQ, "submit %d byte: error %d", len, err_code); 1629 PDEBUG(DBG_IRQ, "submit %d byte: error %d", len, err_code);
@@ -1656,7 +1656,7 @@ static int usbvision_measure_bandwidth (struct usb_usbvision *usbvision)
1656{ 1656{
1657 int err_code = 0; 1657 int err_code = 0;
1658 1658
1659 if (usbvision->isoc_measure_bandwidth_count < 2) { // this gives an average bandwidth of 3 frames 1659 if (usbvision->isoc_measure_bandwidth_count < 2) { /* this gives an average bandwidth of 3 frames */
1660 usbvision->isoc_measure_bandwidth_count++; 1660 usbvision->isoc_measure_bandwidth_count++;
1661 return err_code; 1661 return err_code;
1662 } 1662 }
@@ -1684,24 +1684,24 @@ static int usbvision_adjust_compression (struct usb_usbvision *usbvision)
1684 if (usbvision->compr_level != usbvision->last_compr_level) { 1684 if (usbvision->compr_level != usbvision->last_compr_level) {
1685 int distorsion; 1685 int distorsion;
1686 if (usbvision->bridge_type == BRIDGE_NT1004 || usbvision->bridge_type == BRIDGE_NT1005) { 1686 if (usbvision->bridge_type == BRIDGE_NT1004 || usbvision->bridge_type == BRIDGE_NT1005) {
1687 buffer[0] = (unsigned char)(4 + 16 * usbvision->compr_level / 100); // PCM Threshold 1 1687 buffer[0] = (unsigned char)(4 + 16 * usbvision->compr_level / 100); /* PCM Threshold 1 */
1688 buffer[1] = (unsigned char)(4 + 8 * usbvision->compr_level / 100); // PCM Threshold 2 1688 buffer[1] = (unsigned char)(4 + 8 * usbvision->compr_level / 100); /* PCM Threshold 2 */
1689 distorsion = 7 + 248 * usbvision->compr_level / 100; 1689 distorsion = 7 + 248 * usbvision->compr_level / 100;
1690 buffer[2] = (unsigned char)(distorsion & 0xFF); // Average distorsion Threshold (inter) 1690 buffer[2] = (unsigned char)(distorsion & 0xFF); /* Average distorsion Threshold (inter) */
1691 buffer[3] = (unsigned char)(distorsion & 0xFF); // Average distorsion Threshold (intra) 1691 buffer[3] = (unsigned char)(distorsion & 0xFF); /* Average distorsion Threshold (intra) */
1692 distorsion = 1 + 42 * usbvision->compr_level / 100; 1692 distorsion = 1 + 42 * usbvision->compr_level / 100;
1693 buffer[4] = (unsigned char)(distorsion & 0xFF); // Maximum distorsion Threshold (inter) 1693 buffer[4] = (unsigned char)(distorsion & 0xFF); /* Maximum distorsion Threshold (inter) */
1694 buffer[5] = (unsigned char)(distorsion & 0xFF); // Maximum distorsion Threshold (intra) 1694 buffer[5] = (unsigned char)(distorsion & 0xFF); /* Maximum distorsion Threshold (intra) */
1695 } 1695 }
1696 else { //BRIDGE_NT1003 1696 else { /* BRIDGE_NT1003 */
1697 buffer[0] = (unsigned char)(4 + 16 * usbvision->compr_level / 100); // PCM threshold 1 1697 buffer[0] = (unsigned char)(4 + 16 * usbvision->compr_level / 100); /* PCM threshold 1 */
1698 buffer[1] = (unsigned char)(4 + 8 * usbvision->compr_level / 100); // PCM threshold 2 1698 buffer[1] = (unsigned char)(4 + 8 * usbvision->compr_level / 100); /* PCM threshold 2 */
1699 distorsion = 2 + 253 * usbvision->compr_level / 100; 1699 distorsion = 2 + 253 * usbvision->compr_level / 100;
1700 buffer[2] = (unsigned char)(distorsion & 0xFF); // distorsion threshold bit0-7 1700 buffer[2] = (unsigned char)(distorsion & 0xFF); /* distorsion threshold bit0-7 */
1701 buffer[3] = 0; //(unsigned char)((distorsion >> 8) & 0x0F); // distorsion threshold bit 8-11 1701 buffer[3] = 0; /* (unsigned char)((distorsion >> 8) & 0x0F); distorsion threshold bit 8-11 */
1702 distorsion = 0 + 43 * usbvision->compr_level / 100; 1702 distorsion = 0 + 43 * usbvision->compr_level / 100;
1703 buffer[4] = (unsigned char)(distorsion & 0xFF); // maximum distorsion bit0-7 1703 buffer[4] = (unsigned char)(distorsion & 0xFF); /* maximum distorsion bit0-7 */
1704 buffer[5] = 0; //(unsigned char)((distorsion >> 8) & 0x01); // maximum distorsion bit 8 1704 buffer[5] = 0; /* (unsigned char)((distorsion >> 8) & 0x01); maximum distorsion bit 8 */
1705 } 1705 }
1706 err_code = usbvision_write_reg_irq(usbvision, USBVISION_PCM_THR1, buffer, 6); 1706 err_code = usbvision_write_reg_irq(usbvision, USBVISION_PCM_THR1, buffer, 6);
1707 if (err_code == 0){ 1707 if (err_code == 0){
@@ -1778,8 +1778,8 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma
1778 format); 1778 format);
1779 format = ISOC_MODE_YUV420; 1779 format = ISOC_MODE_YUV420;
1780 } 1780 }
1781 value[0] = 0x0A; //TODO: See the effect of the filter 1781 value[0] = 0x0A; /* TODO: See the effect of the filter */
1782 value[1] = format; // Sets the VO_MODE register which follows FILT_CONT 1782 value[1] = format; /* Sets the VO_MODE register which follows FILT_CONT */
1783 rc = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), 1783 rc = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1),
1784 USBVISION_OP_CODE, 1784 USBVISION_OP_CODE,
1785 USB_DIR_OUT | USB_TYPE_VENDOR | 1785 USB_DIR_OUT | USB_TYPE_VENDOR |
@@ -1840,10 +1840,10 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width,
1840 1840
1841 /* I'll not rewrite the same values */ 1841 /* I'll not rewrite the same values */
1842 if ((usb_width != usbvision->curwidth) || (usb_height != usbvision->curheight)) { 1842 if ((usb_width != usbvision->curwidth) || (usb_height != usbvision->curheight)) {
1843 value[0] = usb_width & 0xff; //LSB 1843 value[0] = usb_width & 0xff; /* LSB */
1844 value[1] = (usb_width >> 8) & 0x03; //MSB 1844 value[1] = (usb_width >> 8) & 0x03; /* MSB */
1845 value[2] = usb_height & 0xff; //LSB 1845 value[2] = usb_height & 0xff; /* LSB */
1846 value[3] = (usb_height >> 8) & 0x03; //MSB 1846 value[3] = (usb_height >> 8) & 0x03; /* MSB */
1847 1847
1848 err_code = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), 1848 err_code = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1),
1849 USBVISION_OP_CODE, 1849 USBVISION_OP_CODE,
@@ -1880,7 +1880,7 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width,
1880 1880
1881 PDEBUG(DBG_FUNC, "frame_rate %d fps, frame_drop %d", frame_rate, frame_drop); 1881 PDEBUG(DBG_FUNC, "frame_rate %d fps, frame_drop %d", frame_rate, frame_drop);
1882 1882
1883 frame_drop = FRAMERATE_MAX; // We can allow the maximum here, because dropping is controlled 1883 frame_drop = FRAMERATE_MAX; /* We can allow the maximum here, because dropping is controlled */
1884 1884
1885 /* frame_drop = 7; => frame_phase = 1, 5, 9, 13, 17, 21, 25, 0, 4, 8, ... 1885 /* frame_drop = 7; => frame_phase = 1, 5, 9, 13, 17, 21, 25, 0, 4, 8, ...
1886 => frame_skip = 4; 1886 => frame_skip = 4;
@@ -1903,7 +1903,7 @@ int usbvision_frames_alloc(struct usb_usbvision *usbvision, int number_of_frames
1903{ 1903{
1904 int i; 1904 int i;
1905 1905
1906 /*needs to be page aligned cause the buffers can be mapped individually! */ 1906 /* needs to be page aligned cause the buffers can be mapped individually! */
1907 usbvision->max_frame_size = PAGE_ALIGN(usbvision->curwidth * 1907 usbvision->max_frame_size = PAGE_ALIGN(usbvision->curwidth *
1908 usbvision->curheight * 1908 usbvision->curheight *
1909 usbvision->palette.bytes_per_pixel); 1909 usbvision->palette.bytes_per_pixel);
@@ -2002,19 +2002,19 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision)
2002 int rc; 2002 int rc;
2003 unsigned char value[6]; 2003 unsigned char value[6];
2004 2004
2005 value[0] = 0x0F; // Intra-Compression cycle 2005 value[0] = 0x0F; /* Intra-Compression cycle */
2006 value[1] = 0x01; // Reg.45 one line per strip 2006 value[1] = 0x01; /* Reg.45 one line per strip */
2007 value[2] = 0x00; // Reg.46 Force intra mode on all new frames 2007 value[2] = 0x00; /* Reg.46 Force intra mode on all new frames */
2008 value[3] = 0x00; // Reg.47 FORCE_UP <- 0 normal operation (not force) 2008 value[3] = 0x00; /* Reg.47 FORCE_UP <- 0 normal operation (not force) */
2009 value[4] = 0xA2; // Reg.48 BUF_THR I'm not sure if this does something in not compressed mode. 2009 value[4] = 0xA2; /* Reg.48 BUF_THR I'm not sure if this does something in not compressed mode. */
2010 value[5] = 0x00; // Reg.49 DVI_YUV This has nothing to do with compression 2010 value[5] = 0x00; /* Reg.49 DVI_YUV This has nothing to do with compression */
2011 2011
2012 //catched values for NT1004 2012 /* catched values for NT1004 */
2013 // value[0] = 0xFF; // Never apply intra mode automatically 2013 /* value[0] = 0xFF; Never apply intra mode automatically */
2014 // value[1] = 0xF1; // Use full frame height for virtual strip width; One line per strip 2014 /* value[1] = 0xF1; Use full frame height for virtual strip width; One line per strip */
2015 // value[2] = 0x01; // Force intra mode on all new frames 2015 /* value[2] = 0x01; Force intra mode on all new frames */
2016 // value[3] = 0x00; // Strip size 400 Bytes; do not force up 2016 /* value[3] = 0x00; Strip size 400 Bytes; do not force up */
2017 // value[4] = 0xA2; // 2017 /* value[4] = 0xA2; */
2018 if (!USBVISION_IS_OPERATIONAL(usbvision)) 2018 if (!USBVISION_IS_OPERATIONAL(usbvision))
2019 return 0; 2019 return 0;
2020 2020
@@ -2031,20 +2031,20 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision)
2031 } 2031 }
2032 2032
2033 if (usbvision->bridge_type == BRIDGE_NT1004) { 2033 if (usbvision->bridge_type == BRIDGE_NT1004) {
2034 value[0] = 20; // PCM Threshold 1 2034 value[0] = 20; /* PCM Threshold 1 */
2035 value[1] = 12; // PCM Threshold 2 2035 value[1] = 12; /* PCM Threshold 2 */
2036 value[2] = 255; // Distorsion Threshold inter 2036 value[2] = 255; /* Distorsion Threshold inter */
2037 value[3] = 255; // Distorsion Threshold intra 2037 value[3] = 255; /* Distorsion Threshold intra */
2038 value[4] = 43; // Max Distorsion inter 2038 value[4] = 43; /* Max Distorsion inter */
2039 value[5] = 43; // Max Distorsion intra 2039 value[5] = 43; /* Max Distorsion intra */
2040 } 2040 }
2041 else { 2041 else {
2042 value[0] = 20; // PCM Threshold 1 2042 value[0] = 20; /* PCM Threshold 1 */
2043 value[1] = 12; // PCM Threshold 2 2043 value[1] = 12; /* PCM Threshold 2 */
2044 value[2] = 255; // Distorsion Threshold d7-d0 2044 value[2] = 255; /* Distorsion Threshold d7-d0 */
2045 value[3] = 0; // Distorsion Threshold d11-d8 2045 value[3] = 0; /* Distorsion Threshold d11-d8 */
2046 value[4] = 43; // Max Distorsion d7-d0 2046 value[4] = 43; /* Max Distorsion d7-d0 */
2047 value[5] = 0; // Max Distorsion d8 2047 value[5] = 0; /* Max Distorsion d8 */
2048 } 2048 }
2049 2049
2050 if (!USBVISION_IS_OPERATIONAL(usbvision)) 2050 if (!USBVISION_IS_OPERATIONAL(usbvision))
@@ -2107,31 +2107,31 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
2107 2107
2108 if (usbvision->tvnorm_id & V4L2_STD_PAL) { 2108 if (usbvision->tvnorm_id & V4L2_STD_PAL) {
2109 value[0] = 0xC0; 2109 value[0] = 0xC0;
2110 value[1] = 0x02; //0x02C0 -> 704 Input video line length 2110 value[1] = 0x02; /* 0x02C0 -> 704 Input video line length */
2111 value[2] = 0x20; 2111 value[2] = 0x20;
2112 value[3] = 0x01; //0x0120 -> 288 Input video n. of lines 2112 value[3] = 0x01; /* 0x0120 -> 288 Input video n. of lines */
2113 value[4] = 0x60; 2113 value[4] = 0x60;
2114 value[5] = 0x00; //0x0060 -> 96 Input video h offset 2114 value[5] = 0x00; /* 0x0060 -> 96 Input video h offset */
2115 value[6] = 0x16; 2115 value[6] = 0x16;
2116 value[7] = 0x00; //0x0016 -> 22 Input video v offset 2116 value[7] = 0x00; /* 0x0016 -> 22 Input video v offset */
2117 } else if (usbvision->tvnorm_id & V4L2_STD_SECAM) { 2117 } else if (usbvision->tvnorm_id & V4L2_STD_SECAM) {
2118 value[0] = 0xC0; 2118 value[0] = 0xC0;
2119 value[1] = 0x02; //0x02C0 -> 704 Input video line length 2119 value[1] = 0x02; /* 0x02C0 -> 704 Input video line length */
2120 value[2] = 0x20; 2120 value[2] = 0x20;
2121 value[3] = 0x01; //0x0120 -> 288 Input video n. of lines 2121 value[3] = 0x01; /* 0x0120 -> 288 Input video n. of lines */
2122 value[4] = 0x01; 2122 value[4] = 0x01;
2123 value[5] = 0x00; //0x0001 -> 01 Input video h offset 2123 value[5] = 0x00; /* 0x0001 -> 01 Input video h offset */
2124 value[6] = 0x01; 2124 value[6] = 0x01;
2125 value[7] = 0x00; //0x0001 -> 01 Input video v offset 2125 value[7] = 0x00; /* 0x0001 -> 01 Input video v offset */
2126 } else { /* V4L2_STD_NTSC */ 2126 } else { /* V4L2_STD_NTSC */
2127 value[0] = 0xD0; 2127 value[0] = 0xD0;
2128 value[1] = 0x02; //0x02D0 -> 720 Input video line length 2128 value[1] = 0x02; /* 0x02D0 -> 720 Input video line length */
2129 value[2] = 0xF0; 2129 value[2] = 0xF0;
2130 value[3] = 0x00; //0x00F0 -> 240 Input video number of lines 2130 value[3] = 0x00; /* 0x00F0 -> 240 Input video number of lines */
2131 value[4] = 0x50; 2131 value[4] = 0x50;
2132 value[5] = 0x00; //0x0050 -> 80 Input video h offset 2132 value[5] = 0x00; /* 0x0050 -> 80 Input video h offset */
2133 value[6] = 0x10; 2133 value[6] = 0x10;
2134 value[7] = 0x00; //0x0010 -> 16 Input video v offset 2134 value[7] = 0x00; /* 0x0010 -> 16 Input video v offset */
2135 } 2135 }
2136 2136
2137 if (usbvision_device_data[usbvision->dev_model].x_offset >= 0) { 2137 if (usbvision_device_data[usbvision->dev_model].x_offset >= 0) {
@@ -2201,9 +2201,9 @@ static int usbvision_set_dram_settings(struct usb_usbvision *usbvision)
2201 value[5] = 0xe0; 2201 value[5] = 0xe0;
2202 value[6] = 0x71; 2202 value[6] = 0x71;
2203 value[7] = 0xff; 2203 value[7] = 0xff;
2204 // UR: 0x0E200-0x3FFFF = 204288 Words (1 Word = 2 Byte) 2204 /* UR: 0x0E200-0x3FFFF = 204288 Words (1 Word = 2 Byte) */
2205 // FDL: 0x00000-0x0E099 = 57498 Words 2205 /* FDL: 0x00000-0x0E099 = 57498 Words */
2206 // VDW: 0x0E3FF-0x3FFFF 2206 /* VDW: 0x0E3FF-0x3FFFF */
2207 } 2207 }
2208 else { 2208 else {
2209 value[0] = 0x42; 2209 value[0] = 0x42;
@@ -2285,7 +2285,7 @@ int usbvision_power_on(struct usb_usbvision *usbvision)
2285 * usbvision timer stuff 2285 * usbvision timer stuff
2286 */ 2286 */
2287 2287
2288// to call usbvision_power_off from task queue 2288/* to call usbvision_power_off from task queue */
2289static void call_usbvision_power_off(struct work_struct *work) 2289static void call_usbvision_power_off(struct work_struct *work)
2290{ 2290{
2291 struct usb_usbvision *usbvision = container_of(work, struct usb_usbvision, power_off_work); 2291 struct usb_usbvision *usbvision = container_of(work, struct usb_usbvision, power_off_work);
@@ -2592,17 +2592,17 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel)
2592 /* inputs #1 and #2 are variable for SAA7111 and SAA7113 */ 2592 /* inputs #1 and #2 are variable for SAA7111 and SAA7113 */
2593 int mode[4]= {SAA7115_COMPOSITE0, 0, 0, SAA7115_COMPOSITE3}; 2593 int mode[4]= {SAA7115_COMPOSITE0, 0, 0, SAA7115_COMPOSITE3};
2594 int audio[]= {1, 0, 0, 0}; 2594 int audio[]= {1, 0, 0, 0};
2595 //channel 0 is TV with audiochannel 1 (tuner mono) 2595 /* channel 0 is TV with audiochannel 1 (tuner mono) */
2596 //channel 1 is Composite with audio channel 0 (line in) 2596 /* channel 1 is Composite with audio channel 0 (line in) */
2597 //channel 2 is S-Video with audio channel 0 (line in) 2597 /* channel 2 is S-Video with audio channel 0 (line in) */
2598 //channel 3 is additional video inputs to the device with audio channel 0 (line in) 2598 /* channel 3 is additional video inputs to the device with audio channel 0 (line in) */
2599 2599
2600 RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs); 2600 RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs);
2601 usbvision->ctl_input = channel; 2601 usbvision->ctl_input = channel;
2602 2602
2603 // set the new channel 2603 /* set the new channel */
2604 // Regular USB TV Tuners -> channel: 0 = Television, 1 = Composite, 2 = S-Video 2604 /* Regular USB TV Tuners -> channel: 0 = Television, 1 = Composite, 2 = S-Video */
2605 // Four video input devices -> channel: 0 = Chan White, 1 = Chan Green, 2 = Chan Yellow, 3 = Chan Red 2605 /* Four video input devices -> channel: 0 = Chan White, 1 = Chan Green, 2 = Chan Yellow, 3 = Chan Red */
2606 2606
2607 switch (usbvision_device_data[usbvision->dev_model].codec) { 2607 switch (usbvision_device_data[usbvision->dev_model].codec) {
2608 case CODEC_SAA7113: 2608 case CODEC_SAA7113:
diff --git a/drivers/media/video/usbvision/usbvision-i2c.c b/drivers/media/video/usbvision/usbvision-i2c.c
index 7b2cd00bf004..cb19c8448c56 100644
--- a/drivers/media/video/usbvision/usbvision-i2c.c
+++ b/drivers/media/video/usbvision/usbvision-i2c.c
@@ -39,7 +39,7 @@
39 39
40static int i2c_debug; 40static int i2c_debug;
41 41
42module_param (i2c_debug, int, 0644); // debug_i2c_usb mode of the device driver 42module_param (i2c_debug, int, 0644); /* debug_i2c_usb mode of the device driver */
43MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); 43MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
44 44
45#define PDEBUG(level, fmt, args...) { \ 45#define PDEBUG(level, fmt, args...) { \
diff --git a/drivers/media/video/usbvision/usbvision-video.c b/drivers/media/video/usbvision/usbvision-video.c
index 4882ea087b92..375355a8fe1c 100644
--- a/drivers/media/video/usbvision/usbvision-video.c
+++ b/drivers/media/video/usbvision/usbvision-video.c
@@ -103,7 +103,7 @@ USBVISION_DRIVER_VERSION_PATCHLEVEL)
103#define DBG_PROBE 1<<2 103#define DBG_PROBE 1<<2
104#define DBG_MMAP 1<<3 104#define DBG_MMAP 1<<3
105 105
106//String operations 106/* String operations */
107#define rmspace(str) while(*str==' ') str++; 107#define rmspace(str) while(*str==' ') str++;
108#define goto2next(str) while(*str!=' ') str++; while(*str==' ') str++; 108#define goto2next(str) while(*str!=' ') str++; while(*str==' ') str++;
109 109
@@ -118,7 +118,7 @@ static struct usbvision_v4l2_format_st usbvision_v4l2_format[] = {
118 { 1, 4, 32, V4L2_PIX_FMT_RGB32 , "RGB32" }, 118 { 1, 4, 32, V4L2_PIX_FMT_RGB32 , "RGB32" },
119 { 1, 2, 16, V4L2_PIX_FMT_RGB555 , "RGB555" }, 119 { 1, 2, 16, V4L2_PIX_FMT_RGB555 , "RGB555" },
120 { 1, 2, 16, V4L2_PIX_FMT_YUYV , "YUV422" }, 120 { 1, 2, 16, V4L2_PIX_FMT_YUYV , "YUV422" },
121 { 1, 2, 12, V4L2_PIX_FMT_YVU420 , "YUV420P" }, // 1.5 ! 121 { 1, 2, 12, V4L2_PIX_FMT_YVU420 , "YUV420P" }, /* 1.5 ! */
122 { 1, 2, 16, V4L2_PIX_FMT_YUV422P , "YUV422P" } 122 { 1, 2, 16, V4L2_PIX_FMT_YUV422P , "YUV422P" }
123}; 123};
124 124
@@ -153,7 +153,7 @@ MODULE_PARM_DESC(video_nr, "Set video device number (/dev/videoX). Default: -1
153MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)"); 153MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)");
154 154
155 155
156// Misc stuff 156/* Misc stuff */
157MODULE_AUTHOR(DRIVER_AUTHOR); 157MODULE_AUTHOR(DRIVER_AUTHOR);
158MODULE_DESCRIPTION(DRIVER_DESC); 158MODULE_DESCRIPTION(DRIVER_DESC);
159MODULE_LICENSE(DRIVER_LICENSE); 159MODULE_LICENSE(DRIVER_LICENSE);
@@ -534,7 +534,7 @@ static int vidioc_enum_input (struct file *file, void *priv,
534 if (usbvision->have_tuner) { 534 if (usbvision->have_tuner) {
535 chan = vi->index; 535 chan = vi->index;
536 } else { 536 } else {
537 chan = vi->index + 1; /*skip Television string*/ 537 chan = vi->index + 1; /* skip Television string*/
538 } 538 }
539 /* Determine the requested input characteristics 539 /* Determine the requested input characteristics
540 specific for each usbvision card model */ 540 specific for each usbvision card model */
@@ -618,7 +618,7 @@ static int vidioc_g_tuner (struct file *file, void *priv,
618{ 618{
619 struct usb_usbvision *usbvision = video_drvdata(file); 619 struct usb_usbvision *usbvision = video_drvdata(file);
620 620
621 if (!usbvision->have_tuner || vt->index) // Only tuner 0 621 if (!usbvision->have_tuner || vt->index) /* Only tuner 0 */
622 return -EINVAL; 622 return -EINVAL;
623 if(usbvision->radio) { 623 if(usbvision->radio) {
624 strcpy(vt->name, "Radio"); 624 strcpy(vt->name, "Radio");
@@ -637,7 +637,7 @@ static int vidioc_s_tuner (struct file *file, void *priv,
637{ 637{
638 struct usb_usbvision *usbvision = video_drvdata(file); 638 struct usb_usbvision *usbvision = video_drvdata(file);
639 639
640 // Only no or one tuner for now 640 /* Only no or one tuner for now */
641 if (!usbvision->have_tuner || vt->index) 641 if (!usbvision->have_tuner || vt->index)
642 return -EINVAL; 642 return -EINVAL;
643 /* let clients handle this */ 643 /* let clients handle this */
@@ -651,7 +651,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
651{ 651{
652 struct usb_usbvision *usbvision = video_drvdata(file); 652 struct usb_usbvision *usbvision = video_drvdata(file);
653 653
654 freq->tuner = 0; // Only one tuner 654 freq->tuner = 0; /* Only one tuner */
655 if(usbvision->radio) { 655 if(usbvision->radio) {
656 freq->type = V4L2_TUNER_RADIO; 656 freq->type = V4L2_TUNER_RADIO;
657 } else { 657 } else {
@@ -667,7 +667,7 @@ static int vidioc_s_frequency (struct file *file, void *priv,
667{ 667{
668 struct usb_usbvision *usbvision = video_drvdata(file); 668 struct usb_usbvision *usbvision = video_drvdata(file);
669 669
670 // Only no or one tuner for now 670 /* Only no or one tuner for now */
671 if (!usbvision->have_tuner || freq->tuner) 671 if (!usbvision->have_tuner || freq->tuner)
672 return -EINVAL; 672 return -EINVAL;
673 673
@@ -1069,7 +1069,7 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf,
1069 (unsigned long)count, frame->bytes_read); 1069 (unsigned long)count, frame->bytes_read);
1070 1070
1071 /* For now, forget the frame if it has not been read in one shot. */ 1071 /* For now, forget the frame if it has not been read in one shot. */
1072/* if (frame->bytes_read >= frame->scanlength) {// All data has been read */ 1072/* if (frame->bytes_read >= frame->scanlength) {*/ /* All data has been read */
1073 frame->bytes_read = 0; 1073 frame->bytes_read = 0;
1074 1074
1075 /* Mark it as available to be used again. */ 1075 /* Mark it as available to be used again. */
@@ -1163,7 +1163,7 @@ static int usbvision_radio_open(struct file *file)
1163 goto out; 1163 goto out;
1164 } 1164 }
1165 1165
1166 // If so far no errors then we shall start the radio 1166 /* If so far no errors then we shall start the radio */
1167 usbvision->radio = 1; 1167 usbvision->radio = 1;
1168 call_all(usbvision, tuner, s_radio); 1168 call_all(usbvision, tuner, s_radio);
1169 usbvision_set_audio(usbvision, USBVISION_AUDIO_RADIO); 1169 usbvision_set_audio(usbvision, USBVISION_AUDIO_RADIO);
@@ -1212,11 +1212,9 @@ static int usbvision_radio_close(struct file *file)
1212 return err_code; 1212 return err_code;
1213} 1213}
1214 1214
1215// 1215/* Video registration stuff */
1216// Video registration stuff
1217//
1218 1216
1219// Video template 1217/* Video template */
1220static const struct v4l2_file_operations usbvision_fops = { 1218static const struct v4l2_file_operations usbvision_fops = {
1221 .owner = THIS_MODULE, 1219 .owner = THIS_MODULE,
1222 .open = usbvision_v4l2_open, 1220 .open = usbvision_v4l2_open,
@@ -1268,7 +1266,7 @@ static struct video_device usbvision_video_template = {
1268}; 1266};
1269 1267
1270 1268
1271// Radio template 1269/* Radio template */
1272static const struct v4l2_file_operations usbvision_radio_fops = { 1270static const struct v4l2_file_operations usbvision_radio_fops = {
1273 .owner = THIS_MODULE, 1271 .owner = THIS_MODULE,
1274 .open = usbvision_radio_open, 1272 .open = usbvision_radio_open,
@@ -1328,10 +1326,10 @@ static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision,
1328 return vdev; 1326 return vdev;
1329} 1327}
1330 1328
1331// unregister video4linux devices 1329/* unregister video4linux devices */
1332static void usbvision_unregister_video(struct usb_usbvision *usbvision) 1330static void usbvision_unregister_video(struct usb_usbvision *usbvision)
1333{ 1331{
1334 // Radio Device: 1332 /* Radio Device: */
1335 if (usbvision->rdev) { 1333 if (usbvision->rdev) {
1336 PDEBUG(DBG_PROBE, "unregister %s [v4l2]", 1334 PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
1337 video_device_node_name(usbvision->rdev)); 1335 video_device_node_name(usbvision->rdev));
@@ -1343,7 +1341,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
1343 usbvision->rdev = NULL; 1341 usbvision->rdev = NULL;
1344 } 1342 }
1345 1343
1346 // Video Device: 1344 /* Video Device: */
1347 if (usbvision->vdev) { 1345 if (usbvision->vdev) {
1348 PDEBUG(DBG_PROBE, "unregister %s [v4l2]", 1346 PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
1349 video_device_node_name(usbvision->vdev)); 1347 video_device_node_name(usbvision->vdev));
@@ -1356,10 +1354,10 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
1356 } 1354 }
1357} 1355}
1358 1356
1359// register video4linux devices 1357/* register video4linux devices */
1360static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) 1358static int __devinit usbvision_register_video(struct usb_usbvision *usbvision)
1361{ 1359{
1362 // Video Device: 1360 /* Video Device: */
1363 usbvision->vdev = usbvision_vdev_init(usbvision, 1361 usbvision->vdev = usbvision_vdev_init(usbvision,
1364 &usbvision_video_template, 1362 &usbvision_video_template,
1365 "USBVision Video"); 1363 "USBVision Video");
@@ -1374,9 +1372,9 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision)
1374 printk(KERN_INFO "USBVision[%d]: registered USBVision Video device %s [v4l2]\n", 1372 printk(KERN_INFO "USBVision[%d]: registered USBVision Video device %s [v4l2]\n",
1375 usbvision->nr, video_device_node_name(usbvision->vdev)); 1373 usbvision->nr, video_device_node_name(usbvision->vdev));
1376 1374
1377 // Radio Device: 1375 /* Radio Device: */
1378 if (usbvision_device_data[usbvision->dev_model].radio) { 1376 if (usbvision_device_data[usbvision->dev_model].radio) {
1379 // usbvision has radio 1377 /* usbvision has radio */
1380 usbvision->rdev = usbvision_vdev_init(usbvision, 1378 usbvision->rdev = usbvision_vdev_init(usbvision,
1381 &usbvision_radio_template, 1379 &usbvision_radio_template,
1382 "USBVision Radio"); 1380 "USBVision Radio");
@@ -1391,7 +1389,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision)
1391 printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device %s [v4l2]\n", 1389 printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device %s [v4l2]\n",
1392 usbvision->nr, video_device_node_name(usbvision->rdev)); 1390 usbvision->nr, video_device_node_name(usbvision->rdev));
1393 } 1391 }
1394 // all done 1392 /* all done */
1395 return 0; 1393 return 0;
1396 1394
1397 err_exit: 1395 err_exit:
@@ -1426,7 +1424,7 @@ static struct usb_usbvision *usbvision_alloc(struct usb_device *dev,
1426 1424
1427 mutex_init(&usbvision->v4l2_lock); 1425 mutex_init(&usbvision->v4l2_lock);
1428 1426
1429 // prepare control urb for control messages during interrupts 1427 /* prepare control urb for control messages during interrupts */
1430 usbvision->ctrl_urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL); 1428 usbvision->ctrl_urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
1431 if (usbvision->ctrl_urb == NULL) 1429 if (usbvision->ctrl_urb == NULL)
1432 goto err_unreg; 1430 goto err_unreg;
@@ -1482,7 +1480,7 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision)
1482 return; 1480 return;
1483 1481
1484 model = usbvision->dev_model; 1482 model = usbvision->dev_model;
1485 usbvision->palette = usbvision_v4l2_format[2]; // V4L2_PIX_FMT_RGB24; 1483 usbvision->palette = usbvision_v4l2_format[2]; /* V4L2_PIX_FMT_RGB24; */
1486 1484
1487 if (usbvision_device_data[usbvision->dev_model].vin_reg2_override) { 1485 if (usbvision_device_data[usbvision->dev_model].vin_reg2_override) {
1488 usbvision->vin_reg2_preset = 1486 usbvision->vin_reg2_preset =
@@ -1639,7 +1637,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf)
1639 1637
1640 mutex_lock(&usbvision->v4l2_lock); 1638 mutex_lock(&usbvision->v4l2_lock);
1641 1639
1642 // At this time we ask to cancel outstanding URBs 1640 /* At this time we ask to cancel outstanding URBs */
1643 usbvision_stop_isoc(usbvision); 1641 usbvision_stop_isoc(usbvision);
1644 1642
1645 v4l2_device_disconnect(&usbvision->v4l2_dev); 1643 v4l2_device_disconnect(&usbvision->v4l2_dev);
@@ -1648,10 +1646,10 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf)
1648 usbvision_i2c_unregister(usbvision); 1646 usbvision_i2c_unregister(usbvision);
1649 usbvision_power_off(usbvision); 1647 usbvision_power_off(usbvision);
1650 } 1648 }
1651 usbvision->remove_pending = 1; // Now all ISO data will be ignored 1649 usbvision->remove_pending = 1; /* Now all ISO data will be ignored */
1652 1650
1653 usb_put_dev(usbvision->dev); 1651 usb_put_dev(usbvision->dev);
1654 usbvision->dev = NULL; // USB device is no more 1652 usbvision->dev = NULL; /* USB device is no more */
1655 1653
1656 mutex_unlock(&usbvision->v4l2_lock); 1654 mutex_unlock(&usbvision->v4l2_lock);
1657 1655
@@ -1692,9 +1690,9 @@ static int __init usbvision_init(void)
1692 1690
1693 /* disable planar mode support unless compression enabled */ 1691 /* disable planar mode support unless compression enabled */
1694 if (isoc_mode != ISOC_MODE_COMPRESS ) { 1692 if (isoc_mode != ISOC_MODE_COMPRESS ) {
1695 // FIXME : not the right way to set supported flag 1693 /* FIXME : not the right way to set supported flag */
1696 usbvision_v4l2_format[6].supported = 0; // V4L2_PIX_FMT_YVU420 1694 usbvision_v4l2_format[6].supported = 0; /* V4L2_PIX_FMT_YVU420 */
1697 usbvision_v4l2_format[7].supported = 0; // V4L2_PIX_FMT_YUV422P 1695 usbvision_v4l2_format[7].supported = 0; /* V4L2_PIX_FMT_YUV422P */
1698 } 1696 }
1699 1697
1700 err_code = usb_register(&usbvision_driver); 1698 err_code = usb_register(&usbvision_driver);
diff --git a/drivers/media/video/usbvision/usbvision.h b/drivers/media/video/usbvision/usbvision.h
index 42189e500143..514115930b4a 100644
--- a/drivers/media/video/usbvision/usbvision.h
+++ b/drivers/media/video/usbvision/usbvision.h
@@ -132,15 +132,15 @@
132#define MAX_BYTES_PER_PIXEL 4 132#define MAX_BYTES_PER_PIXEL 4
133 133
134#define MIN_FRAME_WIDTH 64 134#define MIN_FRAME_WIDTH 64
135#define MAX_USB_WIDTH 320 //384 135#define MAX_USB_WIDTH 320 /* 384 */
136#define MAX_FRAME_WIDTH 320 //384 /*streching sometimes causes crashes*/ 136#define MAX_FRAME_WIDTH 320 /* 384 */ /* streching sometimes causes crashes*/
137 137
138#define MIN_FRAME_HEIGHT 48 138#define MIN_FRAME_HEIGHT 48
139#define MAX_USB_HEIGHT 240 //288 139#define MAX_USB_HEIGHT 240 /* 288 */
140#define MAX_FRAME_HEIGHT 240 //288 /*Streching sometimes causes crashes*/ 140#define MAX_FRAME_HEIGHT 240 /* 288 */ /* Streching sometimes causes crashes*/
141 141
142#define MAX_FRAME_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * MAX_BYTES_PER_PIXEL) 142#define MAX_FRAME_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * MAX_BYTES_PER_PIXEL)
143#define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) //bytesize of clipmask 143#define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) /* bytesize of clipmask */
144 144
145#define USBVISION_URB_FRAMES 32 145#define USBVISION_URB_FRAMES 32
146 146
@@ -148,7 +148,7 @@
148#define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */ 148#define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */
149#define USBVISION_NUMSBUF 2 /* Dimensioning the USB S buffering */ 149#define USBVISION_NUMSBUF 2 /* Dimensioning the USB S buffering */
150 150
151#define USBVISION_POWEROFF_TIME 3 * (HZ) // 3 seconds 151#define USBVISION_POWEROFF_TIME 3 * (HZ) /* 3 seconds */
152 152
153 153
154#define FRAMERATE_MIN 0 154#define FRAMERATE_MIN 0
@@ -287,7 +287,7 @@ struct usbvision_frame_header {
287 unsigned char magic_1; /* 0 magic */ 287 unsigned char magic_1; /* 0 magic */
288 unsigned char magic_2; /* 1 magic */ 288 unsigned char magic_2; /* 1 magic */
289 unsigned char header_length; /* 2 */ 289 unsigned char header_length; /* 2 */
290 unsigned char frame_num; /* 3 */ 290 unsigned char frame_num; /* 3 */
291 unsigned char frame_phase; /* 4 */ 291 unsigned char frame_phase; /* 4 */
292 unsigned char frame_latency; /* 5 */ 292 unsigned char frame_latency; /* 5 */
293 unsigned char data_format; /* 6 */ 293 unsigned char data_format; /* 6 */
@@ -322,7 +322,7 @@ struct usbvision_frame {
322 struct usbvision_v4l2_format_st v4l2_format; /* format the user needs*/ 322 struct usbvision_v4l2_format_st v4l2_format; /* format the user needs*/
323 int v4l2_linesize; /* bytes for one videoline*/ 323 int v4l2_linesize; /* bytes for one videoline*/
324 struct timeval timestamp; 324 struct timeval timestamp;
325 int sequence; // How many video frames we send to user 325 int sequence; /* How many video frames we send to user */
326}; 326};
327 327
328#define CODEC_SAA7113 7113 328#define CODEC_SAA7113 7113
@@ -369,19 +369,19 @@ struct usb_usbvision {
369 unsigned char ctrl_urb_buffer[8]; 369 unsigned char ctrl_urb_buffer[8];
370 int ctrl_urb_busy; 370 int ctrl_urb_busy;
371 struct usb_ctrlrequest ctrl_urb_setup; 371 struct usb_ctrlrequest ctrl_urb_setup;
372 wait_queue_head_t ctrl_urb_wq; // Processes waiting 372 wait_queue_head_t ctrl_urb_wq; /* Processes waiting */
373 373
374 /* configuration part */ 374 /* configuration part */
375 int have_tuner; 375 int have_tuner;
376 int tuner_type; 376 int tuner_type;
377 int bridge_type; // NT1003, NT1004, NT1005 377 int bridge_type; /* NT1003, NT1004, NT1005 */
378 int radio; 378 int radio;
379 int video_inputs; // # of inputs 379 int video_inputs; /* # of inputs */
380 unsigned long freq; 380 unsigned long freq;
381 int audio_mute; 381 int audio_mute;
382 int audio_channel; 382 int audio_channel;
383 int isoc_mode; // format of video data for the usb isoc-transfer 383 int isoc_mode; /* format of video data for the usb isoc-transfer */
384 unsigned int nr; // Number of the device 384 unsigned int nr; /* Number of the device */
385 385
386 /* Device structure */ 386 /* Device structure */
387 struct usb_device *dev; 387 struct usb_device *dev;
@@ -389,7 +389,7 @@ struct usb_usbvision {
389 int num_alt; /* Number of alternative settings */ 389 int num_alt; /* Number of alternative settings */
390 unsigned int *alt_max_pkt_size; /* array of max_packet_size */ 390 unsigned int *alt_max_pkt_size; /* array of max_packet_size */
391 unsigned char iface; /* Video interface number */ 391 unsigned char iface; /* Video interface number */
392 unsigned char iface_alt; /* Alt settings */ 392 unsigned char iface_alt; /* Alt settings */
393 unsigned char vin_reg2_preset; 393 unsigned char vin_reg2_preset;
394 struct mutex v4l2_lock; 394 struct mutex v4l2_lock;
395 struct timer_list power_off_timer; 395 struct timer_list power_off_timer;
@@ -411,10 +411,10 @@ struct usb_usbvision {
411 struct list_head inqueue, outqueue; /* queued frame list and ready to dequeue frame list */ 411 struct list_head inqueue, outqueue; /* queued frame list and ready to dequeue frame list */
412 wait_queue_head_t wait_frame; /* Processes waiting */ 412 wait_queue_head_t wait_frame; /* Processes waiting */
413 wait_queue_head_t wait_stream; /* Processes waiting */ 413 wait_queue_head_t wait_stream; /* Processes waiting */
414 struct usbvision_frame *cur_frame; // pointer to current frame, set by usbvision_find_header 414 struct usbvision_frame *cur_frame; /* pointer to current frame, set by usbvision_find_header */
415 struct usbvision_frame frame[USBVISION_NUMFRAMES]; // frame buffer 415 struct usbvision_frame frame[USBVISION_NUMFRAMES]; /* frame buffer */
416 int num_frames; // number of frames allocated 416 int num_frames; /* number of frames allocated */
417 struct usbvision_sbuf sbuf[USBVISION_NUMSBUF]; // S buffering 417 struct usbvision_sbuf sbuf[USBVISION_NUMSBUF]; /* S buffering */
418 volatile int remove_pending; /* If set then about to exit */ 418 volatile int remove_pending; /* If set then about to exit */
419 419
420 /* Scratch space from the Isochronous Pipe.*/ 420 /* Scratch space from the Isochronous Pipe.*/
@@ -432,32 +432,32 @@ struct usb_usbvision {
432 v4l2_std_id tvnorm_id; /* selected tv norm */ 432 v4l2_std_id tvnorm_id; /* selected tv norm */
433 unsigned char video_endp; /* 0x82 for USBVISION devices based */ 433 unsigned char video_endp; /* 0x82 for USBVISION devices based */
434 434
435 // Decompression stuff: 435 /* Decompression stuff: */
436 unsigned char *intra_frame_buffer; /* Buffer for reference frame */ 436 unsigned char *intra_frame_buffer; /* Buffer for reference frame */
437 int block_pos; //for test only 437 int block_pos; /* for test only */
438 int request_intra; // 0 = normal; 1 = intra frame is requested; 438 int request_intra; /* 0 = normal; 1 = intra frame is requested; */
439 int last_isoc_frame_num; // check for lost isoc frames 439 int last_isoc_frame_num; /* check for lost isoc frames */
440 int isoc_packet_size; // need to calculate used_bandwidth 440 int isoc_packet_size; /* need to calculate used_bandwidth */
441 int used_bandwidth; // used bandwidth 0-100%, need to set compr_level 441 int used_bandwidth; /* used bandwidth 0-100%, need to set compr_level */
442 int compr_level; // How strong (100) or weak (0) is compression 442 int compr_level; /* How strong (100) or weak (0) is compression */
443 int last_compr_level; // How strong (100) or weak (0) was compression 443 int last_compr_level; /* How strong (100) or weak (0) was compression */
444 int usb_bandwidth; /* Mbit/s */ 444 int usb_bandwidth; /* Mbit/s */
445 445
446 /* Statistics that can be overlayed on the screen */ 446 /* Statistics that can be overlayed on the screen */
447 unsigned long isoc_urb_count; // How many URBs we received so far 447 unsigned long isoc_urb_count; /* How many URBs we received so far */
448 unsigned long urb_length; /* Length of last URB */ 448 unsigned long urb_length; /* Length of last URB */
449 unsigned long isoc_data_count; /* How many bytes we received */ 449 unsigned long isoc_data_count; /* How many bytes we received */
450 unsigned long header_count; /* How many frame headers we found */ 450 unsigned long header_count; /* How many frame headers we found */
451 unsigned long scratch_ovf_count; /* How many times we overflowed scratch */ 451 unsigned long scratch_ovf_count; /* How many times we overflowed scratch */
452 unsigned long isoc_skip_count; /* How many empty ISO packets received */ 452 unsigned long isoc_skip_count; /* How many empty ISO packets received */
453 unsigned long isoc_err_count; /* How many bad ISO packets received */ 453 unsigned long isoc_err_count; /* How many bad ISO packets received */
454 unsigned long isoc_packet_count; // How many packets we totally got 454 unsigned long isoc_packet_count; /* How many packets we totally got */
455 unsigned long time_in_irq; // How long do we need for interrupt 455 unsigned long time_in_irq; /* How long do we need for interrupt */
456 int isoc_measure_bandwidth_count; 456 int isoc_measure_bandwidth_count;
457 int frame_num; // How many video frames we send to user 457 int frame_num; /* How many video frames we send to user */
458 int max_strip_len; // How big is the biggest strip 458 int max_strip_len; /* How big is the biggest strip */
459 int comprblock_pos; 459 int comprblock_pos;
460 int strip_len_errors; // How many times was block_pos greater than strip_len 460 int strip_len_errors; /* How many times was block_pos greater than strip_len */
461 int strip_magic_errors; 461 int strip_magic_errors;
462 int strip_line_number_errors; 462 int strip_line_number_errors;
463 int compr_block_types[4]; 463 int compr_block_types[4];