diff options
author | Hans Verkuil <hverkuil@xs4all.nl> | 2010-12-19 18:21:36 -0500 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-12-30 05:01:56 -0500 |
commit | 5490a7cbe65d63c6ec45f1013287af1e390c95d7 (patch) | |
tree | bc52247d37c2315a6c3635dabe7f26688c906e9d /drivers/media/video/usbvision/usbvision-core.c | |
parent | c627b9d1f580f26fe99a8045d37a57f91e9aef66 (diff) |
[media] usbvision: get rid of camelCase
Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/usbvision/usbvision-core.c')
-rw-r--r-- | drivers/media/video/usbvision/usbvision-core.c | 984 |
1 files changed, 492 insertions, 492 deletions
diff --git a/drivers/media/video/usbvision/usbvision-core.c b/drivers/media/video/usbvision/usbvision-core.c index de58aa7d9e1d..372e21b35ed3 100644 --- a/drivers/media/video/usbvision/usbvision-core.c +++ b/drivers/media/video/usbvision/usbvision-core.c | |||
@@ -53,23 +53,23 @@ static unsigned int force_testpattern; | |||
53 | module_param(force_testpattern,int,0644); | 53 | module_param(force_testpattern,int,0644); |
54 | MODULE_PARM_DESC(force_testpattern,"enable test pattern display [core]"); | 54 | MODULE_PARM_DESC(force_testpattern,"enable test pattern display [core]"); |
55 | 55 | ||
56 | static int adjustCompression = 1; /* Set the compression to be adaptive */ | 56 | static int adjust_compression = 1; /* Set the compression to be adaptive */ |
57 | module_param(adjustCompression, int, 0444); | 57 | module_param(adjust_compression, int, 0444); |
58 | MODULE_PARM_DESC(adjustCompression, " Set the ADPCM compression for the device. Default: 1 (On)"); | 58 | MODULE_PARM_DESC(adjust_compression, " Set the ADPCM compression for the device. Default: 1 (On)"); |
59 | 59 | ||
60 | /* To help people with Black and White output with using s-video input. | 60 | /* To help people with Black and White output with using s-video input. |
61 | * Some cables and input device are wired differently. */ | 61 | * Some cables and input device are wired differently. */ |
62 | static int SwitchSVideoInput; | 62 | static int switch_svideo_input; |
63 | module_param(SwitchSVideoInput, int, 0444); | 63 | module_param(switch_svideo_input, int, 0444); |
64 | MODULE_PARM_DESC(SwitchSVideoInput, " Set the S-Video input. Some cables and input device are wired differently. Default: 0 (Off)"); | 64 | MODULE_PARM_DESC(switch_svideo_input, " Set the S-Video input. Some cables and input device are wired differently. Default: 0 (Off)"); |
65 | 65 | ||
66 | static unsigned int adjust_X_Offset = -1; | 66 | static unsigned int adjust_x_offset = -1; |
67 | module_param(adjust_X_Offset, int, 0644); | 67 | module_param(adjust_x_offset, int, 0644); |
68 | MODULE_PARM_DESC(adjust_X_Offset, "adjust X offset display [core]"); | 68 | MODULE_PARM_DESC(adjust_x_offset, "adjust X offset display [core]"); |
69 | 69 | ||
70 | static unsigned int adjust_Y_Offset = -1; | 70 | static unsigned int adjust_y_offset = -1; |
71 | module_param(adjust_Y_Offset, int, 0644); | 71 | module_param(adjust_y_offset, int, 0644); |
72 | MODULE_PARM_DESC(adjust_Y_Offset, "adjust Y offset display [core]"); | 72 | MODULE_PARM_DESC(adjust_y_offset, "adjust Y offset display [core]"); |
73 | 73 | ||
74 | 74 | ||
75 | #define ENABLE_HEXDUMP 0 /* Enable if you need it */ | 75 | #define ENABLE_HEXDUMP 0 /* Enable if you need it */ |
@@ -327,7 +327,7 @@ static int scratch_get(struct usb_usbvision *usbvision, unsigned char *data, | |||
327 | static int scratch_get_header(struct usb_usbvision *usbvision, | 327 | static int scratch_get_header(struct usb_usbvision *usbvision, |
328 | struct usbvision_frame_header *header) | 328 | struct usbvision_frame_header *header) |
329 | { | 329 | { |
330 | int errCode = 0; | 330 | int err_code = 0; |
331 | 331 | ||
332 | PDEBUG(DBG_SCRATCH, "from read_ptr=%d", usbvision->scratch_headermarker_read_ptr); | 332 | PDEBUG(DBG_SCRATCH, "from read_ptr=%d", usbvision->scratch_headermarker_read_ptr); |
333 | 333 | ||
@@ -340,15 +340,15 @@ static int scratch_get_header(struct usb_usbvision *usbvision, | |||
340 | scratch_get(usbvision, (unsigned char *)header, USBVISION_HEADER_LENGTH); | 340 | scratch_get(usbvision, (unsigned char *)header, USBVISION_HEADER_LENGTH); |
341 | if ((header->magic_1 == USBVISION_MAGIC_1) | 341 | if ((header->magic_1 == USBVISION_MAGIC_1) |
342 | && (header->magic_2 == USBVISION_MAGIC_2) | 342 | && (header->magic_2 == USBVISION_MAGIC_2) |
343 | && (header->headerLength == USBVISION_HEADER_LENGTH)) { | 343 | && (header->header_length == USBVISION_HEADER_LENGTH)) { |
344 | errCode = USBVISION_HEADER_LENGTH; | 344 | err_code = USBVISION_HEADER_LENGTH; |
345 | header->frameWidth = header->frameWidthLo + (header->frameWidthHi << 8); | 345 | header->frame_width = header->frame_width_lo + (header->frame_width_hi << 8); |
346 | header->frameHeight = header->frameHeightLo + (header->frameHeightHi << 8); | 346 | header->frame_height = header->frame_height_lo + (header->frame_height_hi << 8); |
347 | break; | 347 | break; |
348 | } | 348 | } |
349 | } | 349 | } |
350 | 350 | ||
351 | return errCode; | 351 | return err_code; |
352 | } | 352 | } |
353 | 353 | ||
354 | 354 | ||
@@ -371,7 +371,7 @@ static void scratch_reset(struct usb_usbvision *usbvision) | |||
371 | usbvision->scratch_write_ptr = 0; | 371 | usbvision->scratch_write_ptr = 0; |
372 | usbvision->scratch_headermarker_read_ptr = 0; | 372 | usbvision->scratch_headermarker_read_ptr = 0; |
373 | usbvision->scratch_headermarker_write_ptr = 0; | 373 | usbvision->scratch_headermarker_write_ptr = 0; |
374 | usbvision->isocstate = IsocState_NoFrame; | 374 | usbvision->isocstate = isoc_state_no_frame; |
375 | } | 375 | } |
376 | 376 | ||
377 | int usbvision_scratch_alloc(struct usb_usbvision *usbvision) | 377 | int usbvision_scratch_alloc(struct usb_usbvision *usbvision) |
@@ -420,13 +420,13 @@ static void usbvision_testpattern(struct usb_usbvision *usbvision, | |||
420 | printk(KERN_ERR "%s: usbvision == NULL\n", proc); | 420 | printk(KERN_ERR "%s: usbvision == NULL\n", proc); |
421 | return; | 421 | return; |
422 | } | 422 | } |
423 | if (usbvision->curFrame == NULL) { | 423 | if (usbvision->cur_frame == NULL) { |
424 | printk(KERN_ERR "%s: usbvision->curFrame is NULL.\n", proc); | 424 | printk(KERN_ERR "%s: usbvision->cur_frame is NULL.\n", proc); |
425 | return; | 425 | return; |
426 | } | 426 | } |
427 | 427 | ||
428 | /* Grab the current frame */ | 428 | /* Grab the current frame */ |
429 | frame = usbvision->curFrame; | 429 | frame = usbvision->cur_frame; |
430 | 430 | ||
431 | /* Optionally start at the beginning */ | 431 | /* Optionally start at the beginning */ |
432 | if (fullframe) { | 432 | if (fullframe) { |
@@ -473,7 +473,7 @@ static void usbvision_testpattern(struct usb_usbvision *usbvision, | |||
473 | } | 473 | } |
474 | } | 474 | } |
475 | 475 | ||
476 | frame->grabstate = FrameState_Done; | 476 | frame->grabstate = frame_state_done; |
477 | frame->scanlength += scan_length; | 477 | frame->scanlength += scan_length; |
478 | ++num_pass; | 478 | ++num_pass; |
479 | 479 | ||
@@ -487,8 +487,8 @@ static void usbvision_testpattern(struct usb_usbvision *usbvision, | |||
487 | int usbvision_decompress_alloc(struct usb_usbvision *usbvision) | 487 | int usbvision_decompress_alloc(struct usb_usbvision *usbvision) |
488 | { | 488 | { |
489 | int IFB_size = MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * 3 / 2; | 489 | int IFB_size = MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * 3 / 2; |
490 | usbvision->IntraFrameBuffer = vmalloc_32(IFB_size); | 490 | usbvision->intra_frame_buffer = vmalloc_32(IFB_size); |
491 | if (usbvision->IntraFrameBuffer == NULL) { | 491 | if (usbvision->intra_frame_buffer == NULL) { |
492 | dev_err(&usbvision->dev->dev, | 492 | dev_err(&usbvision->dev->dev, |
493 | "%s: unable to allocate %d for compr. frame buffer\n", | 493 | "%s: unable to allocate %d for compr. frame buffer\n", |
494 | __func__, IFB_size); | 494 | __func__, IFB_size); |
@@ -504,8 +504,8 @@ int usbvision_decompress_alloc(struct usb_usbvision *usbvision) | |||
504 | */ | 504 | */ |
505 | void usbvision_decompress_free(struct usb_usbvision *usbvision) | 505 | void usbvision_decompress_free(struct usb_usbvision *usbvision) |
506 | { | 506 | { |
507 | vfree(usbvision->IntraFrameBuffer); | 507 | vfree(usbvision->intra_frame_buffer); |
508 | usbvision->IntraFrameBuffer = NULL; | 508 | usbvision->intra_frame_buffer = NULL; |
509 | 509 | ||
510 | } | 510 | } |
511 | 511 | ||
@@ -517,77 +517,77 @@ void usbvision_decompress_free(struct usb_usbvision *usbvision) | |||
517 | * | 517 | * |
518 | * Locate one of supported header markers in the scratch buffer. | 518 | * Locate one of supported header markers in the scratch buffer. |
519 | */ | 519 | */ |
520 | static enum ParseState usbvision_find_header(struct usb_usbvision *usbvision) | 520 | static enum parse_state usbvision_find_header(struct usb_usbvision *usbvision) |
521 | { | 521 | { |
522 | struct usbvision_frame *frame; | 522 | struct usbvision_frame *frame; |
523 | int foundHeader = 0; | 523 | int found_header = 0; |
524 | 524 | ||
525 | frame = usbvision->curFrame; | 525 | frame = usbvision->cur_frame; |
526 | 526 | ||
527 | while (scratch_get_header(usbvision, &frame->isocHeader) == 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->isocHeader.magic_2, | 530 | frame->isoc_header.magic_2, |
531 | frame->isocHeader.magic_1, | 531 | frame->isoc_header.magic_1, |
532 | frame->isocHeader.headerLength, | 532 | frame->isoc_header.header_length, |
533 | frame->isocHeader.frameNum, | 533 | frame->isoc_header.frame_num, |
534 | frame->isocHeader.framePhase, | 534 | frame->isoc_header.frame_phase, |
535 | frame->isocHeader.frameLatency, | 535 | frame->isoc_header.frame_latency, |
536 | frame->isocHeader.dataFormat, | 536 | frame->isoc_header.data_format, |
537 | frame->isocHeader.formatParam, | 537 | frame->isoc_header.format_param, |
538 | frame->isocHeader.frameWidth, | 538 | frame->isoc_header.frame_width, |
539 | frame->isocHeader.frameHeight); | 539 | frame->isoc_header.frame_height); |
540 | 540 | ||
541 | if (usbvision->requestIntra) { | 541 | if (usbvision->request_intra) { |
542 | if (frame->isocHeader.formatParam & 0x80) { | 542 | if (frame->isoc_header.format_param & 0x80) { |
543 | foundHeader = 1; | 543 | found_header = 1; |
544 | usbvision->lastIsocFrameNum = -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 | } |
548 | } | 548 | } |
549 | else { | 549 | else { |
550 | foundHeader = 1; | 550 | found_header = 1; |
551 | break; | 551 | break; |
552 | } | 552 | } |
553 | } | 553 | } |
554 | 554 | ||
555 | if (foundHeader) { | 555 | if (found_header) { |
556 | frame->frmwidth = frame->isocHeader.frameWidth * usbvision->stretch_width; | 556 | frame->frmwidth = frame->isoc_header.frame_width * usbvision->stretch_width; |
557 | frame->frmheight = frame->isocHeader.frameHeight * 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 ParseState_EndParse; | 563 | return parse_state_end_parse; |
564 | } | 564 | } |
565 | 565 | ||
566 | // found header | 566 | // found header |
567 | if (frame->isocHeader.dataFormat==ISOC_MODE_COMPRESS) { | 567 | if (frame->isoc_header.data_format==ISOC_MODE_COMPRESS) { |
568 | //check isocHeader.frameNum for lost frames | 568 | //check isoc_header.frame_num for lost frames |
569 | if (usbvision->lastIsocFrameNum >= 0) { | 569 | if (usbvision->last_isoc_frame_num >= 0) { |
570 | if (((usbvision->lastIsocFrameNum + 1) % 32) != frame->isocHeader.frameNum) { | 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->isocHeader.frameNum); | 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 ParseState_NextFrame; | 574 | return parse_state_next_frame; |
575 | } | 575 | } |
576 | } | 576 | } |
577 | usbvision->lastIsocFrameNum = frame->isocHeader.frameNum; | 577 | usbvision->last_isoc_frame_num = frame->isoc_header.frame_num; |
578 | } | 578 | } |
579 | usbvision->header_count++; | 579 | usbvision->header_count++; |
580 | frame->scanstate = ScanState_Lines; | 580 | frame->scanstate = scan_state_lines; |
581 | frame->curline = 0; | 581 | frame->curline = 0; |
582 | 582 | ||
583 | if (force_testpattern) { | 583 | if (force_testpattern) { |
584 | usbvision_testpattern(usbvision, 1, 1); | 584 | usbvision_testpattern(usbvision, 1, 1); |
585 | return ParseState_NextFrame; | 585 | return parse_state_next_frame; |
586 | } | 586 | } |
587 | return ParseState_Continue; | 587 | return parse_state_continue; |
588 | } | 588 | } |
589 | 589 | ||
590 | static enum ParseState usbvision_parse_lines_422(struct usb_usbvision *usbvision, | 590 | static enum parse_state usbvision_parse_lines_422(struct usb_usbvision *usbvision, |
591 | long *pcopylen) | 591 | long *pcopylen) |
592 | { | 592 | { |
593 | volatile struct usbvision_frame *frame; | 593 | volatile struct usbvision_frame *frame; |
@@ -599,18 +599,18 @@ static enum ParseState usbvision_parse_lines_422(struct usb_usbvision *usbvision | |||
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 | ||
602 | frame = usbvision->curFrame; | 602 | frame = usbvision->cur_frame; |
603 | f = frame->data + (frame->v4l2_linesize * frame->curline); | 603 | f = frame->data + (frame->v4l2_linesize * frame->curline); |
604 | 604 | ||
605 | /* Make sure there's enough data for the entire line */ | 605 | /* Make sure there's enough data for the entire line */ |
606 | len = (frame->isocHeader.frameWidth * 2)+5; | 606 | len = (frame->isoc_header.frame_width * 2)+5; |
607 | if (scratch_len(usbvision) < len) { | 607 | if (scratch_len(usbvision) < len) { |
608 | PDEBUG(DBG_PARSE, "out of data in line %d, need %u.\n", frame->curline, len); | 608 | PDEBUG(DBG_PARSE, "out of data in line %d, need %u.\n", frame->curline, len); |
609 | return ParseState_Out; | 609 | return parse_state_out; |
610 | } | 610 | } |
611 | 611 | ||
612 | if ((frame->curline + 1) >= frame->frmheight) { | 612 | if ((frame->curline + 1) >= frame->frmheight) { |
613 | return ParseState_NextFrame; | 613 | return parse_state_next_frame; |
614 | } | 614 | } |
615 | 615 | ||
616 | bytes_per_pixel = frame->v4l2_format.bytes_per_pixel; | 616 | bytes_per_pixel = frame->v4l2_format.bytes_per_pixel; |
@@ -699,99 +699,99 @@ static enum ParseState usbvision_parse_lines_422(struct usb_usbvision *usbvision | |||
699 | *pcopylen += frame->v4l2_linesize * usbvision->stretch_height; | 699 | *pcopylen += frame->v4l2_linesize * usbvision->stretch_height; |
700 | 700 | ||
701 | if (frame->curline >= frame->frmheight) { | 701 | if (frame->curline >= frame->frmheight) { |
702 | return ParseState_NextFrame; | 702 | return parse_state_next_frame; |
703 | } | 703 | } |
704 | else { | 704 | else { |
705 | return ParseState_Continue; | 705 | return parse_state_continue; |
706 | } | 706 | } |
707 | } | 707 | } |
708 | 708 | ||
709 | /* The decompression routine */ | 709 | /* The decompression routine */ |
710 | static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *Compressed, | 710 | static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *compressed, |
711 | unsigned char *Decompressed, int *StartPos, | 711 | unsigned char *decompressed, int *start_pos, |
712 | int *BlockTypeStartPos, int Len) | 712 | int *block_typestart_pos, int len) |
713 | { | 713 | { |
714 | int RestPixel, Idx, MaxPos, Pos, ExtraPos, BlockLen, BlockTypePos, BlockTypeLen; | 714 | int rest_pixel, idx, max_pos, pos, extra_pos, block_len, block_type_pos, block_type_len; |
715 | unsigned char BlockByte, BlockCode, BlockType, BlockTypeByte, Integrator; | 715 | unsigned char block_byte, block_code, block_type, block_type_byte, integrator; |
716 | 716 | ||
717 | Integrator = 0; | 717 | integrator = 0; |
718 | Pos = *StartPos; | 718 | pos = *start_pos; |
719 | BlockTypePos = *BlockTypeStartPos; | 719 | block_type_pos = *block_typestart_pos; |
720 | MaxPos = 396; //Pos + Len; | 720 | max_pos = 396; //pos + len; |
721 | ExtraPos = Pos; | 721 | extra_pos = pos; |
722 | BlockLen = 0; | 722 | block_len = 0; |
723 | BlockByte = 0; | 723 | block_byte = 0; |
724 | BlockCode = 0; | 724 | block_code = 0; |
725 | BlockType = 0; | 725 | block_type = 0; |
726 | BlockTypeByte = 0; | 726 | block_type_byte = 0; |
727 | BlockTypeLen = 0; | 727 | block_type_len = 0; |
728 | RestPixel = Len; | 728 | rest_pixel = len; |
729 | 729 | ||
730 | for (Idx = 0; Idx < Len; Idx++) { | 730 | for (idx = 0; idx < len; idx++) { |
731 | 731 | ||
732 | if (BlockLen == 0) { | 732 | if (block_len == 0) { |
733 | if (BlockTypeLen==0) { | 733 | if (block_type_len==0) { |
734 | BlockTypeByte = Compressed[BlockTypePos]; | 734 | block_type_byte = compressed[block_type_pos]; |
735 | BlockTypePos++; | 735 | block_type_pos++; |
736 | BlockTypeLen = 4; | 736 | block_type_len = 4; |
737 | } | 737 | } |
738 | BlockType = (BlockTypeByte & 0xC0) >> 6; | 738 | block_type = (block_type_byte & 0xC0) >> 6; |
739 | 739 | ||
740 | //statistic: | 740 | //statistic: |
741 | usbvision->ComprBlockTypes[BlockType]++; | 741 | usbvision->compr_block_types[block_type]++; |
742 | 742 | ||
743 | Pos = ExtraPos; | 743 | pos = extra_pos; |
744 | if (BlockType == 0) { | 744 | if (block_type == 0) { |
745 | if(RestPixel >= 24) { | 745 | if(rest_pixel >= 24) { |
746 | Idx += 23; | 746 | idx += 23; |
747 | RestPixel -= 24; | 747 | rest_pixel -= 24; |
748 | Integrator = Decompressed[Idx]; | 748 | integrator = decompressed[idx]; |
749 | } else { | 749 | } else { |
750 | Idx += RestPixel - 1; | 750 | idx += rest_pixel - 1; |
751 | RestPixel = 0; | 751 | rest_pixel = 0; |
752 | } | 752 | } |
753 | } else { | 753 | } else { |
754 | BlockCode = Compressed[Pos]; | 754 | block_code = compressed[pos]; |
755 | Pos++; | 755 | pos++; |
756 | if (RestPixel >= 24) { | 756 | if (rest_pixel >= 24) { |
757 | BlockLen = 24; | 757 | block_len = 24; |
758 | } else { | 758 | } else { |
759 | BlockLen = RestPixel; | 759 | block_len = rest_pixel; |
760 | } | 760 | } |
761 | RestPixel -= BlockLen; | 761 | rest_pixel -= block_len; |
762 | ExtraPos = Pos + (BlockLen / 4); | 762 | extra_pos = pos + (block_len / 4); |
763 | } | 763 | } |
764 | BlockTypeByte <<= 2; | 764 | block_type_byte <<= 2; |
765 | BlockTypeLen -= 1; | 765 | block_type_len -= 1; |
766 | } | 766 | } |
767 | if (BlockLen > 0) { | 767 | if (block_len > 0) { |
768 | if ((BlockLen%4) == 0) { | 768 | if ((block_len%4) == 0) { |
769 | BlockByte = Compressed[Pos]; | 769 | block_byte = compressed[pos]; |
770 | Pos++; | 770 | pos++; |
771 | } | 771 | } |
772 | if (BlockType == 1) { //inter Block | 772 | if (block_type == 1) { //inter Block |
773 | Integrator = Decompressed[Idx]; | 773 | integrator = decompressed[idx]; |
774 | } | 774 | } |
775 | switch (BlockByte & 0xC0) { | 775 | switch (block_byte & 0xC0) { |
776 | case 0x03<<6: | 776 | case 0x03<<6: |
777 | Integrator += Compressed[ExtraPos]; | 777 | integrator += compressed[extra_pos]; |
778 | ExtraPos++; | 778 | extra_pos++; |
779 | break; | 779 | break; |
780 | case 0x02<<6: | 780 | case 0x02<<6: |
781 | Integrator += BlockCode; | 781 | integrator += block_code; |
782 | break; | 782 | break; |
783 | case 0x00: | 783 | case 0x00: |
784 | Integrator -= BlockCode; | 784 | integrator -= block_code; |
785 | break; | 785 | break; |
786 | } | 786 | } |
787 | Decompressed[Idx] = Integrator; | 787 | decompressed[idx] = integrator; |
788 | BlockByte <<= 2; | 788 | block_byte <<= 2; |
789 | BlockLen -= 1; | 789 | block_len -= 1; |
790 | } | 790 | } |
791 | } | 791 | } |
792 | *StartPos = ExtraPos; | 792 | *start_pos = extra_pos; |
793 | *BlockTypeStartPos = BlockTypePos; | 793 | *block_typestart_pos = block_type_pos; |
794 | return Idx; | 794 | return idx; |
795 | } | 795 | } |
796 | 796 | ||
797 | 797 | ||
@@ -803,7 +803,7 @@ static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *C | |||
803 | * number of bytes (RGB) to the *pcopylen. | 803 | * number of bytes (RGB) to the *pcopylen. |
804 | * | 804 | * |
805 | */ | 805 | */ |
806 | static enum ParseState usbvision_parse_compress(struct usb_usbvision *usbvision, | 806 | static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision, |
807 | long *pcopylen) | 807 | long *pcopylen) |
808 | { | 808 | { |
809 | #define USBVISION_STRIP_MAGIC 0x5A | 809 | #define USBVISION_STRIP_MAGIC 0x5A |
@@ -812,16 +812,16 @@ static enum ParseState usbvision_parse_compress(struct usb_usbvision *usbvision, | |||
812 | 812 | ||
813 | struct usbvision_frame *frame; | 813 | struct usbvision_frame *frame; |
814 | unsigned char *f,*u = NULL ,*v = NULL; | 814 | unsigned char *f,*u = NULL ,*v = NULL; |
815 | unsigned char StripData[USBVISION_STRIP_LEN_MAX]; | 815 | unsigned char strip_data[USBVISION_STRIP_LEN_MAX]; |
816 | unsigned char StripHeader[USBVISION_STRIP_HEADER_LEN]; | 816 | unsigned char strip_header[USBVISION_STRIP_HEADER_LEN]; |
817 | int Idx, IdxEnd, StripLen, StripPtr, StartBlockPos, BlockPos, BlockTypePos; | 817 | int idx, idx_end, strip_len, strip_ptr, Startblock_pos, block_pos, block_type_pos; |
818 | int clipmask_index, bytes_per_pixel, rc; | 818 | int clipmask_index, bytes_per_pixel, rc; |
819 | int imageSize; | 819 | int image_size; |
820 | unsigned char rv, gv, bv; | 820 | unsigned char rv, gv, bv; |
821 | static unsigned char *Y, *U, *V; | 821 | static unsigned char *Y, *U, *V; |
822 | 822 | ||
823 | frame = usbvision->curFrame; | 823 | frame = usbvision->cur_frame; |
824 | imageSize = 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. |
@@ -833,14 +833,14 @@ static enum ParseState usbvision_parse_compress(struct usb_usbvision *usbvision, | |||
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 | + imageSize | 836 | + image_size |
837 | + (frame->frmwidth >>1) * frame->curline ; | 837 | + (frame->frmwidth >>1) * frame->curline ; |
838 | v = u + (imageSize >>1 ); | 838 | v = u + (image_size >>1 ); |
839 | 839 | ||
840 | } else if (frame->v4l2_format.format == V4L2_PIX_FMT_YVU420){ | 840 | } else if (frame->v4l2_format.format == V4L2_PIX_FMT_YVU420){ |
841 | 841 | ||
842 | v = frame->data + imageSize + ((frame->curline* (frame->width))>>2) ; | 842 | v = frame->data + image_size + ((frame->curline* (frame->width))>>2) ; |
843 | u = v + (imageSize >>2) ; | 843 | u = v + (image_size >>2) ; |
844 | } | 844 | } |
845 | 845 | ||
846 | if (frame->curline == 0) { | 846 | if (frame->curline == 0) { |
@@ -848,112 +848,112 @@ static enum ParseState usbvision_parse_compress(struct usb_usbvision *usbvision, | |||
848 | } | 848 | } |
849 | 849 | ||
850 | if (scratch_len(usbvision) < USBVISION_STRIP_HEADER_LEN) { | 850 | if (scratch_len(usbvision) < USBVISION_STRIP_HEADER_LEN) { |
851 | return ParseState_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, &StripPtr, 0); | 855 | scratch_set_extra_ptr(usbvision, &strip_ptr, 0); |
856 | scratch_get_extra(usbvision, &StripHeader[0], &StripPtr, | 856 | scratch_get_extra(usbvision, &strip_header[0], &strip_ptr, |
857 | USBVISION_STRIP_HEADER_LEN); | 857 | USBVISION_STRIP_HEADER_LEN); |
858 | 858 | ||
859 | if (StripHeader[0] != USBVISION_STRIP_MAGIC) { | 859 | if (strip_header[0] != USBVISION_STRIP_MAGIC) { |
860 | // wrong strip magic | 860 | // wrong strip magic |
861 | usbvision->stripMagicErrors++; | 861 | usbvision->strip_magic_errors++; |
862 | return ParseState_NextFrame; | 862 | return parse_state_next_frame; |
863 | } | 863 | } |
864 | 864 | ||
865 | if (frame->curline != (int)StripHeader[2]) { | 865 | if (frame->curline != (int)strip_header[2]) { |
866 | //line number missmatch error | 866 | //line number missmatch error |
867 | usbvision->stripLineNumberErrors++; | 867 | usbvision->strip_line_number_errors++; |
868 | } | 868 | } |
869 | 869 | ||
870 | StripLen = 2 * (unsigned int)StripHeader[1]; | 870 | strip_len = 2 * (unsigned int)strip_header[1]; |
871 | if (StripLen > 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) < StripLen) { | 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 ParseState_Out; | 879 | return parse_state_out; |
880 | } | 880 | } |
881 | 881 | ||
882 | if (usbvision->IntraFrameBuffer) { | 882 | if (usbvision->intra_frame_buffer) { |
883 | Y = usbvision->IntraFrameBuffer + frame->frmwidth * frame->curline; | 883 | Y = usbvision->intra_frame_buffer + frame->frmwidth * frame->curline; |
884 | U = usbvision->IntraFrameBuffer + imageSize + (frame->frmwidth / 2) * (frame->curline / 2); | 884 | U = usbvision->intra_frame_buffer + image_size + (frame->frmwidth / 2) * (frame->curline / 2); |
885 | V = usbvision->IntraFrameBuffer + imageSize / 4 * 5 + (frame->frmwidth / 2) * (frame->curline / 2); | 885 | V = usbvision->intra_frame_buffer + image_size / 4 * 5 + (frame->frmwidth / 2) * (frame->curline / 2); |
886 | } | 886 | } |
887 | else { | 887 | else { |
888 | return ParseState_NextFrame; | 888 | return parse_state_next_frame; |
889 | } | 889 | } |
890 | 890 | ||
891 | bytes_per_pixel = frame->v4l2_format.bytes_per_pixel; | 891 | bytes_per_pixel = frame->v4l2_format.bytes_per_pixel; |
892 | clipmask_index = frame->curline * MAX_FRAME_WIDTH; | 892 | clipmask_index = frame->curline * MAX_FRAME_WIDTH; |
893 | 893 | ||
894 | scratch_get(usbvision, StripData, StripLen); | 894 | scratch_get(usbvision, strip_data, strip_len); |
895 | 895 | ||
896 | IdxEnd = frame->frmwidth; | 896 | idx_end = frame->frmwidth; |
897 | BlockTypePos = USBVISION_STRIP_HEADER_LEN; | 897 | block_type_pos = USBVISION_STRIP_HEADER_LEN; |
898 | StartBlockPos = BlockTypePos + (IdxEnd - 1) / 96 + (IdxEnd / 2 - 1) / 96 + 2; | 898 | Startblock_pos = block_type_pos + (idx_end - 1) / 96 + (idx_end / 2 - 1) / 96 + 2; |
899 | BlockPos = StartBlockPos; | 899 | block_pos = Startblock_pos; |
900 | 900 | ||
901 | usbvision->BlockPos = BlockPos; | 901 | usbvision->block_pos = block_pos; |
902 | 902 | ||
903 | if ((rc = usbvision_decompress(usbvision, StripData, Y, &BlockPos, &BlockTypePos, IdxEnd)) != IdxEnd) { | 903 | if ((rc = usbvision_decompress(usbvision, strip_data, Y, &block_pos, &block_type_pos, idx_end)) != idx_end) { |
904 | //return ParseState_Continue; | 904 | //return parse_state_continue; |
905 | } | 905 | } |
906 | if (StripLen > usbvision->maxStripLen) { | 906 | if (strip_len > usbvision->max_strip_len) { |
907 | usbvision->maxStripLen = StripLen; | 907 | usbvision->max_strip_len = strip_len; |
908 | } | 908 | } |
909 | 909 | ||
910 | if (frame->curline%2) { | 910 | if (frame->curline%2) { |
911 | if ((rc = usbvision_decompress(usbvision, StripData, V, &BlockPos, &BlockTypePos, IdxEnd/2)) != IdxEnd/2) { | 911 | if ((rc = usbvision_decompress(usbvision, strip_data, V, &block_pos, &block_type_pos, idx_end/2)) != idx_end/2) { |
912 | //return ParseState_Continue; | 912 | //return parse_state_continue; |
913 | } | 913 | } |
914 | } | 914 | } |
915 | else { | 915 | else { |
916 | if ((rc = usbvision_decompress(usbvision, StripData, U, &BlockPos, &BlockTypePos, IdxEnd/2)) != IdxEnd/2) { | 916 | if ((rc = usbvision_decompress(usbvision, strip_data, U, &block_pos, &block_type_pos, idx_end/2)) != idx_end/2) { |
917 | //return ParseState_Continue; | 917 | //return parse_state_continue; |
918 | } | 918 | } |
919 | } | 919 | } |
920 | 920 | ||
921 | if (BlockPos > usbvision->comprBlockPos) { | 921 | if (block_pos > usbvision->comprblock_pos) { |
922 | usbvision->comprBlockPos = BlockPos; | 922 | usbvision->comprblock_pos = block_pos; |
923 | } | 923 | } |
924 | if (BlockPos > StripLen) { | 924 | if (block_pos > strip_len) { |
925 | usbvision->stripLenErrors++; | 925 | usbvision->strip_len_errors++; |
926 | } | 926 | } |
927 | 927 | ||
928 | for (Idx = 0; Idx < IdxEnd; Idx++) { | 928 | for (idx = 0; idx < idx_end; idx++) { |
929 | if(frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) { | 929 | if(frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) { |
930 | *f++ = Y[Idx]; | 930 | *f++ = Y[idx]; |
931 | *f++ = Idx & 0x01 ? U[Idx/2] : V[Idx/2]; | 931 | *f++ = idx & 0x01 ? U[idx/2] : V[idx/2]; |
932 | } | 932 | } |
933 | else if(frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P) { | 933 | else if(frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P) { |
934 | *f++ = Y[Idx]; | 934 | *f++ = Y[idx]; |
935 | if ( Idx & 0x01) | 935 | if ( idx & 0x01) |
936 | *u++ = U[Idx>>1] ; | 936 | *u++ = U[idx>>1] ; |
937 | else | 937 | else |
938 | *v++ = V[Idx>>1]; | 938 | *v++ = V[idx>>1]; |
939 | } | 939 | } |
940 | else if (frame->v4l2_format.format == V4L2_PIX_FMT_YVU420) { | 940 | else if (frame->v4l2_format.format == V4L2_PIX_FMT_YVU420) { |
941 | *f++ = Y [Idx]; | 941 | *f++ = Y [idx]; |
942 | if ( !(( Idx & 0x01 ) | ( frame->curline & 0x01 )) ){ | 942 | if ( !(( idx & 0x01 ) | ( frame->curline & 0x01 )) ){ |
943 | 943 | ||
944 | /* only need do this for 1 in 4 pixels */ | 944 | /* only need do this for 1 in 4 pixels */ |
945 | /* intraframe buffer is YUV420 format */ | 945 | /* intraframe buffer is YUV420 format */ |
946 | 946 | ||
947 | *u++ = U[Idx >>1]; | 947 | *u++ = U[idx >>1]; |
948 | *v++ = V[Idx >>1]; | 948 | *v++ = V[idx >>1]; |
949 | } | 949 | } |
950 | 950 | ||
951 | } | 951 | } |
952 | else { | 952 | else { |
953 | YUV_TO_RGB_BY_THE_BOOK(Y[Idx], U[Idx/2], V[Idx/2], rv, gv, bv); | 953 | YUV_TO_RGB_BY_THE_BOOK(Y[idx], U[idx/2], V[idx/2], rv, gv, bv); |
954 | switch (frame->v4l2_format.format) { | 954 | switch (frame->v4l2_format.format) { |
955 | case V4L2_PIX_FMT_GREY: | 955 | case V4L2_PIX_FMT_GREY: |
956 | *f++ = Y[Idx]; | 956 | *f++ = Y[idx]; |
957 | break; | 957 | break; |
958 | case V4L2_PIX_FMT_RGB555: | 958 | case V4L2_PIX_FMT_RGB555: |
959 | *f++ = (0x1F & rv) | | 959 | *f++ = (0x1F & rv) | |
@@ -991,10 +991,10 @@ static enum ParseState usbvision_parse_compress(struct usb_usbvision *usbvision, | |||
991 | frame->curline += 1; | 991 | frame->curline += 1; |
992 | 992 | ||
993 | if (frame->curline >= frame->frmheight) { | 993 | if (frame->curline >= frame->frmheight) { |
994 | return ParseState_NextFrame; | 994 | return parse_state_next_frame; |
995 | } | 995 | } |
996 | else { | 996 | else { |
997 | return ParseState_Continue; | 997 | return parse_state_continue; |
998 | } | 998 | } |
999 | 999 | ||
1000 | } | 1000 | } |
@@ -1008,7 +1008,7 @@ static enum ParseState usbvision_parse_compress(struct usb_usbvision *usbvision, | |||
1008 | * number of bytes (RGB) to the *pcopylen. | 1008 | * number of bytes (RGB) to the *pcopylen. |
1009 | * | 1009 | * |
1010 | */ | 1010 | */ |
1011 | static enum ParseState usbvision_parse_lines_420(struct usb_usbvision *usbvision, | 1011 | static enum parse_state usbvision_parse_lines_420(struct usb_usbvision *usbvision, |
1012 | long *pcopylen) | 1012 | long *pcopylen) |
1013 | { | 1013 | { |
1014 | struct usbvision_frame *frame; | 1014 | struct usbvision_frame *frame; |
@@ -1028,7 +1028,7 @@ static enum ParseState usbvision_parse_lines_420(struct usb_usbvision *usbvision | |||
1028 | int clipmask_even_index, clipmask_odd_index, bytes_per_pixel; | 1028 | int clipmask_even_index, clipmask_odd_index, bytes_per_pixel; |
1029 | int clipmask_add, stretch_bytes; | 1029 | int clipmask_add, stretch_bytes; |
1030 | 1030 | ||
1031 | frame = usbvision->curFrame; | 1031 | frame = usbvision->cur_frame; |
1032 | f_even = frame->data + (frame->v4l2_linesize * frame->curline); | 1032 | f_even = frame->data + (frame->v4l2_linesize * frame->curline); |
1033 | f_odd = f_even + frame->v4l2_linesize * usbvision->stretch_height; | 1033 | f_odd = f_even + frame->v4l2_linesize * usbvision->stretch_height; |
1034 | 1034 | ||
@@ -1040,15 +1040,15 @@ static enum ParseState usbvision_parse_lines_420(struct usb_usbvision *usbvision | |||
1040 | clipmask_even_index = frame->curline * MAX_FRAME_WIDTH; | 1040 | clipmask_even_index = frame->curline * MAX_FRAME_WIDTH; |
1041 | clipmask_odd_index = clipmask_even_index + MAX_FRAME_WIDTH; | 1041 | clipmask_odd_index = clipmask_even_index + MAX_FRAME_WIDTH; |
1042 | clipmask_add = usbvision->stretch_width; | 1042 | clipmask_add = usbvision->stretch_width; |
1043 | pixel_per_line = frame->isocHeader.frameWidth; | 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 ParseState_Out; | 1047 | return parse_state_out; |
1048 | } | 1048 | } |
1049 | 1049 | ||
1050 | if ((frame->curline + 1) >= frame->frmheight) { | 1050 | if ((frame->curline + 1) >= frame->frmheight) { |
1051 | return ParseState_NextFrame; | 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? |
@@ -1272,9 +1272,9 @@ static enum ParseState usbvision_parse_lines_420(struct usb_usbvision *usbvision | |||
1272 | *pcopylen += frame->v4l2_linesize * 2 * usbvision->stretch_height; | 1272 | *pcopylen += frame->v4l2_linesize * 2 * usbvision->stretch_height; |
1273 | 1273 | ||
1274 | if (frame->curline >= frame->frmheight) | 1274 | if (frame->curline >= frame->frmheight) |
1275 | return ParseState_NextFrame; | 1275 | return parse_state_next_frame; |
1276 | else | 1276 | else |
1277 | return ParseState_Continue; | 1277 | return parse_state_continue; |
1278 | } | 1278 | } |
1279 | 1279 | ||
1280 | /* | 1280 | /* |
@@ -1288,53 +1288,53 @@ static enum ParseState usbvision_parse_lines_420(struct usb_usbvision *usbvision | |||
1288 | static void usbvision_parse_data(struct usb_usbvision *usbvision) | 1288 | static void usbvision_parse_data(struct usb_usbvision *usbvision) |
1289 | { | 1289 | { |
1290 | struct usbvision_frame *frame; | 1290 | struct usbvision_frame *frame; |
1291 | enum ParseState newstate; | 1291 | enum parse_state newstate; |
1292 | long copylen = 0; | 1292 | long copylen = 0; |
1293 | unsigned long lock_flags; | 1293 | unsigned long lock_flags; |
1294 | 1294 | ||
1295 | frame = usbvision->curFrame; | 1295 | frame = usbvision->cur_frame; |
1296 | 1296 | ||
1297 | PDEBUG(DBG_PARSE, "parsing len=%d\n", scratch_len(usbvision)); | 1297 | PDEBUG(DBG_PARSE, "parsing len=%d\n", scratch_len(usbvision)); |
1298 | 1298 | ||
1299 | while (1) { | 1299 | while (1) { |
1300 | 1300 | ||
1301 | newstate = ParseState_Out; | 1301 | newstate = parse_state_out; |
1302 | if (scratch_len(usbvision)) { | 1302 | if (scratch_len(usbvision)) { |
1303 | if (frame->scanstate == ScanState_Scanning) { | 1303 | if (frame->scanstate == scan_state_scanning) { |
1304 | newstate = usbvision_find_header(usbvision); | 1304 | newstate = usbvision_find_header(usbvision); |
1305 | } | 1305 | } |
1306 | else if (frame->scanstate == ScanState_Lines) { | 1306 | else if (frame->scanstate == scan_state_lines) { |
1307 | if (usbvision->isocMode == ISOC_MODE_YUV420) { | 1307 | if (usbvision->isoc_mode == ISOC_MODE_YUV420) { |
1308 | newstate = usbvision_parse_lines_420(usbvision, ©len); | 1308 | newstate = usbvision_parse_lines_420(usbvision, ©len); |
1309 | } | 1309 | } |
1310 | else if (usbvision->isocMode == ISOC_MODE_YUV422) { | 1310 | else if (usbvision->isoc_mode == ISOC_MODE_YUV422) { |
1311 | newstate = usbvision_parse_lines_422(usbvision, ©len); | 1311 | newstate = usbvision_parse_lines_422(usbvision, ©len); |
1312 | } | 1312 | } |
1313 | else if (usbvision->isocMode == ISOC_MODE_COMPRESS) { | 1313 | else if (usbvision->isoc_mode == ISOC_MODE_COMPRESS) { |
1314 | newstate = usbvision_parse_compress(usbvision, ©len); | 1314 | newstate = usbvision_parse_compress(usbvision, ©len); |
1315 | } | 1315 | } |
1316 | 1316 | ||
1317 | } | 1317 | } |
1318 | } | 1318 | } |
1319 | if (newstate == ParseState_Continue) { | 1319 | if (newstate == parse_state_continue) { |
1320 | continue; | 1320 | continue; |
1321 | } | 1321 | } |
1322 | else if ((newstate == ParseState_NextFrame) || (newstate == ParseState_Out)) { | 1322 | else if ((newstate == parse_state_next_frame) || (newstate == parse_state_out)) { |
1323 | break; | 1323 | break; |
1324 | } | 1324 | } |
1325 | else { | 1325 | else { |
1326 | return; /* ParseState_EndParse */ | 1326 | return; /* parse_state_end_parse */ |
1327 | } | 1327 | } |
1328 | } | 1328 | } |
1329 | 1329 | ||
1330 | if (newstate == ParseState_NextFrame) { | 1330 | if (newstate == parse_state_next_frame) { |
1331 | frame->grabstate = FrameState_Done; | 1331 | frame->grabstate = frame_state_done; |
1332 | do_gettimeofday(&(frame->timestamp)); | 1332 | do_gettimeofday(&(frame->timestamp)); |
1333 | frame->sequence = usbvision->frame_num; | 1333 | frame->sequence = usbvision->frame_num; |
1334 | 1334 | ||
1335 | spin_lock_irqsave(&usbvision->queue_lock, lock_flags); | 1335 | spin_lock_irqsave(&usbvision->queue_lock, lock_flags); |
1336 | list_move_tail(&(frame->frame), &usbvision->outqueue); | 1336 | list_move_tail(&(frame->frame), &usbvision->outqueue); |
1337 | usbvision->curFrame = NULL; | 1337 | usbvision->cur_frame = NULL; |
1338 | spin_unlock_irqrestore(&usbvision->queue_lock, lock_flags); | 1338 | spin_unlock_irqrestore(&usbvision->queue_lock, lock_flags); |
1339 | 1339 | ||
1340 | usbvision->frame_num++; | 1340 | usbvision->frame_num++; |
@@ -1346,7 +1346,7 @@ static void usbvision_parse_data(struct usb_usbvision *usbvision) | |||
1346 | } | 1346 | } |
1347 | } | 1347 | } |
1348 | else | 1348 | else |
1349 | frame->grabstate = FrameState_Grabbing; | 1349 | frame->grabstate = frame_state_grabbing; |
1350 | 1350 | ||
1351 | 1351 | ||
1352 | /* Update the frame's uncompressed length. */ | 1352 | /* Update the frame's uncompressed length. */ |
@@ -1372,32 +1372,32 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision, | |||
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->isocErrCount++; | 1375 | usbvision->isoc_err_count++; |
1376 | continue; | 1376 | continue; |
1377 | } | 1377 | } |
1378 | 1378 | ||
1379 | /* Detect and ignore empty packets */ | 1379 | /* Detect and ignore empty packets */ |
1380 | if (packet_len < 0) { | 1380 | if (packet_len < 0) { |
1381 | PDEBUG(DBG_ISOC, "error packet [%d]", i); | 1381 | PDEBUG(DBG_ISOC, "error packet [%d]", i); |
1382 | usbvision->isocSkipCount++; | 1382 | usbvision->isoc_skip_count++; |
1383 | continue; | 1383 | continue; |
1384 | } | 1384 | } |
1385 | else if (packet_len == 0) { /* Frame end ????? */ | 1385 | else if (packet_len == 0) { /* Frame end ????? */ |
1386 | PDEBUG(DBG_ISOC, "null packet [%d]", i); | 1386 | PDEBUG(DBG_ISOC, "null packet [%d]", i); |
1387 | usbvision->isocstate=IsocState_NoFrame; | 1387 | usbvision->isocstate=isoc_state_no_frame; |
1388 | usbvision->isocSkipCount++; | 1388 | usbvision->isoc_skip_count++; |
1389 | continue; | 1389 | continue; |
1390 | } | 1390 | } |
1391 | else if (packet_len > usbvision->isocPacketSize) { | 1391 | else if (packet_len > usbvision->isoc_packet_size) { |
1392 | PDEBUG(DBG_ISOC, "packet[%d] > isocPacketSize", i); | 1392 | PDEBUG(DBG_ISOC, "packet[%d] > isoc_packet_size", i); |
1393 | usbvision->isocSkipCount++; | 1393 | usbvision->isoc_skip_count++; |
1394 | continue; | 1394 | continue; |
1395 | } | 1395 | } |
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==IsocState_NoFrame) { //new frame begins | 1399 | if (usbvision->isocstate==isoc_state_no_frame) { //new frame begins |
1400 | usbvision->isocstate=IsocState_InFrame; | 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); |
1403 | PDEBUG(DBG_ISOC, "packet with header"); | 1403 | PDEBUG(DBG_ISOC, "packet with header"); |
@@ -1422,8 +1422,8 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision, | |||
1422 | /* Now we know that there is enough room in scratch buffer */ | 1422 | /* Now we know that there is enough room in scratch buffer */ |
1423 | scratch_put(usbvision, packet_data, packet_len); | 1423 | scratch_put(usbvision, packet_data, packet_len); |
1424 | totlen += packet_len; | 1424 | totlen += packet_len; |
1425 | usbvision->isocDataCount += packet_len; | 1425 | usbvision->isoc_data_count += packet_len; |
1426 | usbvision->isocPacketCount++; | 1426 | usbvision->isoc_packet_count++; |
1427 | } | 1427 | } |
1428 | #if ENABLE_HEXDUMP | 1428 | #if ENABLE_HEXDUMP |
1429 | if (totlen > 0) { | 1429 | if (totlen > 0) { |
@@ -1438,13 +1438,13 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision, | |||
1438 | return totlen; | 1438 | return totlen; |
1439 | } | 1439 | } |
1440 | 1440 | ||
1441 | static void usbvision_isocIrq(struct urb *urb) | 1441 | static void usbvision_isoc_irq(struct urb *urb) |
1442 | { | 1442 | { |
1443 | int errCode = 0; | 1443 | int err_code = 0; |
1444 | int len; | 1444 | int len; |
1445 | struct usb_usbvision *usbvision = urb->context; | 1445 | struct usb_usbvision *usbvision = urb->context; |
1446 | int i; | 1446 | int i; |
1447 | unsigned long startTime = jiffies; | 1447 | unsigned long start_time = jiffies; |
1448 | struct usbvision_frame **f; | 1448 | struct usbvision_frame **f; |
1449 | 1449 | ||
1450 | /* We don't want to do anything if we are about to be removed! */ | 1450 | /* We don't want to do anything if we are about to be removed! */ |
@@ -1456,14 +1456,14 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1456 | return; | 1456 | return; |
1457 | } | 1457 | } |
1458 | 1458 | ||
1459 | f = &usbvision->curFrame; | 1459 | f = &usbvision->cur_frame; |
1460 | 1460 | ||
1461 | /* Manage streaming interruption */ | 1461 | /* Manage streaming interruption */ |
1462 | if (usbvision->streaming == Stream_Interrupt) { | 1462 | if (usbvision->streaming == stream_interrupt) { |
1463 | usbvision->streaming = Stream_Idle; | 1463 | usbvision->streaming = stream_idle; |
1464 | if ((*f)) { | 1464 | if ((*f)) { |
1465 | (*f)->grabstate = FrameState_Ready; | 1465 | (*f)->grabstate = frame_state_ready; |
1466 | (*f)->scanstate = ScanState_Scanning; | 1466 | (*f)->scanstate = scan_state_scanning; |
1467 | } | 1467 | } |
1468 | PDEBUG(DBG_IRQ, "stream interrupted"); | 1468 | PDEBUG(DBG_IRQ, "stream interrupted"); |
1469 | wake_up_interruptible(&usbvision->wait_stream); | 1469 | wake_up_interruptible(&usbvision->wait_stream); |
@@ -1472,10 +1472,10 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1472 | /* Copy the data received into our scratch buffer */ | 1472 | /* Copy the data received into our scratch buffer */ |
1473 | len = usbvision_compress_isochronous(usbvision, urb); | 1473 | len = usbvision_compress_isochronous(usbvision, urb); |
1474 | 1474 | ||
1475 | usbvision->isocUrbCount++; | 1475 | usbvision->isoc_urb_count++; |
1476 | usbvision->urb_length = len; | 1476 | usbvision->urb_length = len; |
1477 | 1477 | ||
1478 | if (usbvision->streaming == Stream_On) { | 1478 | if (usbvision->streaming == stream_on) { |
1479 | 1479 | ||
1480 | /* If we collected enough data let's parse! */ | 1480 | /* If we collected enough data let's parse! */ |
1481 | if ((scratch_len(usbvision) > USBVISION_HEADER_LENGTH) && | 1481 | if ((scratch_len(usbvision) > USBVISION_HEADER_LENGTH) && |
@@ -1500,7 +1500,7 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1500 | scratch_reset(usbvision); | 1500 | scratch_reset(usbvision); |
1501 | } | 1501 | } |
1502 | 1502 | ||
1503 | usbvision->timeInIrq += jiffies - startTime; | 1503 | usbvision->time_in_irq += jiffies - start_time; |
1504 | 1504 | ||
1505 | for (i = 0; i < USBVISION_URB_FRAMES; i++) { | 1505 | for (i = 0; i < USBVISION_URB_FRAMES; i++) { |
1506 | urb->iso_frame_desc[i].status = 0; | 1506 | urb->iso_frame_desc[i].status = 0; |
@@ -1509,12 +1509,12 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1509 | 1509 | ||
1510 | urb->status = 0; | 1510 | urb->status = 0; |
1511 | urb->dev = usbvision->dev; | 1511 | urb->dev = usbvision->dev; |
1512 | errCode = usb_submit_urb (urb, GFP_ATOMIC); | 1512 | err_code = usb_submit_urb (urb, GFP_ATOMIC); |
1513 | 1513 | ||
1514 | if(errCode) { | 1514 | if(err_code) { |
1515 | dev_err(&usbvision->dev->dev, | 1515 | dev_err(&usbvision->dev->dev, |
1516 | "%s: usb_submit_urb failed: error %d\n", | 1516 | "%s: usb_submit_urb failed: error %d\n", |
1517 | __func__, errCode); | 1517 | __func__, err_code); |
1518 | } | 1518 | } |
1519 | 1519 | ||
1520 | return; | 1520 | return; |
@@ -1533,21 +1533,21 @@ static void usbvision_isocIrq(struct urb *urb) | |||
1533 | 1533 | ||
1534 | int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg) | 1534 | int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg) |
1535 | { | 1535 | { |
1536 | int errCode = 0; | 1536 | int err_code = 0; |
1537 | unsigned char buffer[1]; | 1537 | unsigned char buffer[1]; |
1538 | 1538 | ||
1539 | if (!USBVISION_IS_OPERATIONAL(usbvision)) | 1539 | if (!USBVISION_IS_OPERATIONAL(usbvision)) |
1540 | return -1; | 1540 | return -1; |
1541 | 1541 | ||
1542 | errCode = usb_control_msg(usbvision->dev, usb_rcvctrlpipe(usbvision->dev, 1), | 1542 | err_code = usb_control_msg(usbvision->dev, usb_rcvctrlpipe(usbvision->dev, 1), |
1543 | USBVISION_OP_CODE, | 1543 | USBVISION_OP_CODE, |
1544 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, | 1544 | USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, |
1545 | 0, (__u16) reg, buffer, 1, HZ); | 1545 | 0, (__u16) reg, buffer, 1, HZ); |
1546 | 1546 | ||
1547 | if (errCode < 0) { | 1547 | if (err_code < 0) { |
1548 | dev_err(&usbvision->dev->dev, | 1548 | dev_err(&usbvision->dev->dev, |
1549 | "%s: failed: error %d\n", __func__, errCode); | 1549 | "%s: failed: error %d\n", __func__, err_code); |
1550 | return errCode; | 1550 | return err_code; |
1551 | } | 1551 | } |
1552 | return buffer[0]; | 1552 | return buffer[0]; |
1553 | } | 1553 | } |
@@ -1563,32 +1563,32 @@ int usbvision_read_reg(struct usb_usbvision *usbvision, unsigned char reg) | |||
1563 | int usbvision_write_reg(struct usb_usbvision *usbvision, unsigned char reg, | 1563 | int usbvision_write_reg(struct usb_usbvision *usbvision, unsigned char reg, |
1564 | unsigned char value) | 1564 | unsigned char value) |
1565 | { | 1565 | { |
1566 | int errCode = 0; | 1566 | int err_code = 0; |
1567 | 1567 | ||
1568 | if (!USBVISION_IS_OPERATIONAL(usbvision)) | 1568 | if (!USBVISION_IS_OPERATIONAL(usbvision)) |
1569 | return 0; | 1569 | return 0; |
1570 | 1570 | ||
1571 | errCode = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), | 1571 | err_code = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), |
1572 | USBVISION_OP_CODE, | 1572 | USBVISION_OP_CODE, |
1573 | USB_DIR_OUT | USB_TYPE_VENDOR | | 1573 | USB_DIR_OUT | USB_TYPE_VENDOR | |
1574 | USB_RECIP_ENDPOINT, 0, (__u16) reg, &value, 1, HZ); | 1574 | USB_RECIP_ENDPOINT, 0, (__u16) reg, &value, 1, HZ); |
1575 | 1575 | ||
1576 | if (errCode < 0) { | 1576 | if (err_code < 0) { |
1577 | dev_err(&usbvision->dev->dev, | 1577 | dev_err(&usbvision->dev->dev, |
1578 | "%s: failed: error %d\n", __func__, errCode); | 1578 | "%s: failed: error %d\n", __func__, err_code); |
1579 | } | 1579 | } |
1580 | return errCode; | 1580 | return err_code; |
1581 | } | 1581 | } |
1582 | 1582 | ||
1583 | 1583 | ||
1584 | static void usbvision_ctrlUrb_complete(struct urb *urb) | 1584 | static void usbvision_ctrl_urb_complete(struct urb *urb) |
1585 | { | 1585 | { |
1586 | struct usb_usbvision *usbvision = (struct usb_usbvision *)urb->context; | 1586 | struct usb_usbvision *usbvision = (struct usb_usbvision *)urb->context; |
1587 | 1587 | ||
1588 | PDEBUG(DBG_IRQ, ""); | 1588 | PDEBUG(DBG_IRQ, ""); |
1589 | usbvision->ctrlUrbBusy = 0; | 1589 | usbvision->ctrl_urb_busy = 0; |
1590 | if (waitqueue_active(&usbvision->ctrlUrb_wq)) { | 1590 | if (waitqueue_active(&usbvision->ctrl_urb_wq)) { |
1591 | wake_up_interruptible(&usbvision->ctrlUrb_wq); | 1591 | wake_up_interruptible(&usbvision->ctrl_urb_wq); |
1592 | } | 1592 | } |
1593 | } | 1593 | } |
1594 | 1594 | ||
@@ -1596,146 +1596,146 @@ static void usbvision_ctrlUrb_complete(struct urb *urb) | |||
1596 | static int usbvision_write_reg_irq(struct usb_usbvision *usbvision,int address, | 1596 | static int usbvision_write_reg_irq(struct usb_usbvision *usbvision,int address, |
1597 | unsigned char *data, int len) | 1597 | unsigned char *data, int len) |
1598 | { | 1598 | { |
1599 | int errCode = 0; | 1599 | int err_code = 0; |
1600 | 1600 | ||
1601 | PDEBUG(DBG_IRQ, ""); | 1601 | PDEBUG(DBG_IRQ, ""); |
1602 | if (len > 8) { | 1602 | if (len > 8) { |
1603 | return -EFAULT; | 1603 | return -EFAULT; |
1604 | } | 1604 | } |
1605 | if (usbvision->ctrlUrbBusy) { | 1605 | if (usbvision->ctrl_urb_busy) { |
1606 | return -EBUSY; | 1606 | return -EBUSY; |
1607 | } | 1607 | } |
1608 | usbvision->ctrlUrbBusy = 1; | 1608 | usbvision->ctrl_urb_busy = 1; |
1609 | 1609 | ||
1610 | usbvision->ctrlUrbSetup.bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT; | 1610 | usbvision->ctrl_urb_setup.bRequestType = USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT; |
1611 | usbvision->ctrlUrbSetup.bRequest = USBVISION_OP_CODE; | 1611 | usbvision->ctrl_urb_setup.bRequest = USBVISION_OP_CODE; |
1612 | usbvision->ctrlUrbSetup.wValue = 0; | 1612 | usbvision->ctrl_urb_setup.wValue = 0; |
1613 | usbvision->ctrlUrbSetup.wIndex = cpu_to_le16(address); | 1613 | usbvision->ctrl_urb_setup.wIndex = cpu_to_le16(address); |
1614 | usbvision->ctrlUrbSetup.wLength = cpu_to_le16(len); | 1614 | usbvision->ctrl_urb_setup.wLength = cpu_to_le16(len); |
1615 | usb_fill_control_urb (usbvision->ctrlUrb, usbvision->dev, | 1615 | usb_fill_control_urb (usbvision->ctrl_urb, usbvision->dev, |
1616 | usb_sndctrlpipe(usbvision->dev, 1), | 1616 | usb_sndctrlpipe(usbvision->dev, 1), |
1617 | (unsigned char *)&usbvision->ctrlUrbSetup, | 1617 | (unsigned char *)&usbvision->ctrl_urb_setup, |
1618 | (void *)usbvision->ctrlUrbBuffer, len, | 1618 | (void *)usbvision->ctrl_urb_buffer, len, |
1619 | usbvision_ctrlUrb_complete, | 1619 | usbvision_ctrl_urb_complete, |
1620 | (void *)usbvision); | 1620 | (void *)usbvision); |
1621 | 1621 | ||
1622 | memcpy(usbvision->ctrlUrbBuffer, data, len); | 1622 | memcpy(usbvision->ctrl_urb_buffer, data, len); |
1623 | 1623 | ||
1624 | errCode = usb_submit_urb(usbvision->ctrlUrb, GFP_ATOMIC); | 1624 | err_code = usb_submit_urb(usbvision->ctrl_urb, GFP_ATOMIC); |
1625 | if (errCode < 0) { | 1625 | if (err_code < 0) { |
1626 | // error in usb_submit_urb() | 1626 | // error in usb_submit_urb() |
1627 | usbvision->ctrlUrbBusy = 0; | 1627 | usbvision->ctrl_urb_busy = 0; |
1628 | } | 1628 | } |
1629 | PDEBUG(DBG_IRQ, "submit %d byte: error %d", len, errCode); | 1629 | PDEBUG(DBG_IRQ, "submit %d byte: error %d", len, err_code); |
1630 | return errCode; | 1630 | return err_code; |
1631 | } | 1631 | } |
1632 | 1632 | ||
1633 | 1633 | ||
1634 | static int usbvision_init_compression(struct usb_usbvision *usbvision) | 1634 | static int usbvision_init_compression(struct usb_usbvision *usbvision) |
1635 | { | 1635 | { |
1636 | int errCode = 0; | 1636 | int err_code = 0; |
1637 | 1637 | ||
1638 | usbvision->lastIsocFrameNum = -1; | 1638 | usbvision->last_isoc_frame_num = -1; |
1639 | usbvision->isocDataCount = 0; | 1639 | usbvision->isoc_data_count = 0; |
1640 | usbvision->isocPacketCount = 0; | 1640 | usbvision->isoc_packet_count = 0; |
1641 | usbvision->isocSkipCount = 0; | 1641 | usbvision->isoc_skip_count = 0; |
1642 | usbvision->comprLevel = 50; | 1642 | usbvision->compr_level = 50; |
1643 | usbvision->lastComprLevel = -1; | 1643 | usbvision->last_compr_level = -1; |
1644 | usbvision->isocUrbCount = 0; | 1644 | usbvision->isoc_urb_count = 0; |
1645 | usbvision->requestIntra = 1; | 1645 | usbvision->request_intra = 1; |
1646 | usbvision->isocMeasureBandwidthCount = 0; | 1646 | usbvision->isoc_measure_bandwidth_count = 0; |
1647 | 1647 | ||
1648 | return errCode; | 1648 | return err_code; |
1649 | } | 1649 | } |
1650 | 1650 | ||
1651 | /* this function measures the used bandwidth since last call | 1651 | /* this function measures the used bandwidth since last call |
1652 | * return: 0 : no error | 1652 | * return: 0 : no error |
1653 | * sets usedBandwidth to 1-100 : 1-100% of full bandwidth resp. to isocPacketSize | 1653 | * sets used_bandwidth to 1-100 : 1-100% of full bandwidth resp. to isoc_packet_size |
1654 | */ | 1654 | */ |
1655 | static int usbvision_measure_bandwidth (struct usb_usbvision *usbvision) | 1655 | static int usbvision_measure_bandwidth (struct usb_usbvision *usbvision) |
1656 | { | 1656 | { |
1657 | int errCode = 0; | 1657 | int err_code = 0; |
1658 | 1658 | ||
1659 | if (usbvision->isocMeasureBandwidthCount < 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->isocMeasureBandwidthCount++; | 1660 | usbvision->isoc_measure_bandwidth_count++; |
1661 | return errCode; | 1661 | return err_code; |
1662 | } | 1662 | } |
1663 | if ((usbvision->isocPacketSize > 0) && (usbvision->isocPacketCount > 0)) { | 1663 | if ((usbvision->isoc_packet_size > 0) && (usbvision->isoc_packet_count > 0)) { |
1664 | usbvision->usedBandwidth = usbvision->isocDataCount / | 1664 | usbvision->used_bandwidth = usbvision->isoc_data_count / |
1665 | (usbvision->isocPacketCount + usbvision->isocSkipCount) * | 1665 | (usbvision->isoc_packet_count + usbvision->isoc_skip_count) * |
1666 | 100 / usbvision->isocPacketSize; | 1666 | 100 / usbvision->isoc_packet_size; |
1667 | } | 1667 | } |
1668 | usbvision->isocMeasureBandwidthCount = 0; | 1668 | usbvision->isoc_measure_bandwidth_count = 0; |
1669 | usbvision->isocDataCount = 0; | 1669 | usbvision->isoc_data_count = 0; |
1670 | usbvision->isocPacketCount = 0; | 1670 | usbvision->isoc_packet_count = 0; |
1671 | usbvision->isocSkipCount = 0; | 1671 | usbvision->isoc_skip_count = 0; |
1672 | return errCode; | 1672 | return err_code; |
1673 | } | 1673 | } |
1674 | 1674 | ||
1675 | static int usbvision_adjust_compression (struct usb_usbvision *usbvision) | 1675 | static int usbvision_adjust_compression (struct usb_usbvision *usbvision) |
1676 | { | 1676 | { |
1677 | int errCode = 0; | 1677 | int err_code = 0; |
1678 | unsigned char buffer[6]; | 1678 | unsigned char buffer[6]; |
1679 | 1679 | ||
1680 | PDEBUG(DBG_IRQ, ""); | 1680 | PDEBUG(DBG_IRQ, ""); |
1681 | if ((adjustCompression) && (usbvision->usedBandwidth > 0)) { | 1681 | if ((adjust_compression) && (usbvision->used_bandwidth > 0)) { |
1682 | usbvision->comprLevel += (usbvision->usedBandwidth - 90) / 2; | 1682 | usbvision->compr_level += (usbvision->used_bandwidth - 90) / 2; |
1683 | RESTRICT_TO_RANGE(usbvision->comprLevel, 0, 100); | 1683 | RESTRICT_TO_RANGE(usbvision->compr_level, 0, 100); |
1684 | if (usbvision->comprLevel != usbvision->lastComprLevel) { | 1684 | if (usbvision->compr_level != usbvision->last_compr_level) { |
1685 | int distorsion; | 1685 | int distorsion; |
1686 | if (usbvision->bridgeType == BRIDGE_NT1004 || usbvision->bridgeType == BRIDGE_NT1005) { | 1686 | if (usbvision->bridge_type == BRIDGE_NT1004 || usbvision->bridge_type == BRIDGE_NT1005) { |
1687 | buffer[0] = (unsigned char)(4 + 16 * usbvision->comprLevel / 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->comprLevel / 100); // PCM Threshold 2 | 1688 | buffer[1] = (unsigned char)(4 + 8 * usbvision->compr_level / 100); // PCM Threshold 2 |
1689 | distorsion = 7 + 248 * usbvision->comprLevel / 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->comprLevel / 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->comprLevel / 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->comprLevel / 100); // PCM threshold 2 | 1698 | buffer[1] = (unsigned char)(4 + 8 * usbvision->compr_level / 100); // PCM threshold 2 |
1699 | distorsion = 2 + 253 * usbvision->comprLevel / 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->comprLevel / 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 | errCode = 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 (errCode == 0){ | 1707 | if (err_code == 0){ |
1708 | PDEBUG(DBG_IRQ, "new compr params %#02x %#02x %#02x %#02x %#02x %#02x", buffer[0], | 1708 | PDEBUG(DBG_IRQ, "new compr params %#02x %#02x %#02x %#02x %#02x %#02x", buffer[0], |
1709 | buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]); | 1709 | buffer[1], buffer[2], buffer[3], buffer[4], buffer[5]); |
1710 | usbvision->lastComprLevel = usbvision->comprLevel; | 1710 | usbvision->last_compr_level = usbvision->compr_level; |
1711 | } | 1711 | } |
1712 | } | 1712 | } |
1713 | } | 1713 | } |
1714 | return errCode; | 1714 | return err_code; |
1715 | } | 1715 | } |
1716 | 1716 | ||
1717 | static int usbvision_request_intra (struct usb_usbvision *usbvision) | 1717 | static int usbvision_request_intra (struct usb_usbvision *usbvision) |
1718 | { | 1718 | { |
1719 | int errCode = 0; | 1719 | int err_code = 0; |
1720 | unsigned char buffer[1]; | 1720 | unsigned char buffer[1]; |
1721 | 1721 | ||
1722 | PDEBUG(DBG_IRQ, ""); | 1722 | PDEBUG(DBG_IRQ, ""); |
1723 | usbvision->requestIntra = 1; | 1723 | usbvision->request_intra = 1; |
1724 | buffer[0] = 1; | 1724 | buffer[0] = 1; |
1725 | usbvision_write_reg_irq(usbvision, USBVISION_FORCE_INTRA, buffer, 1); | 1725 | usbvision_write_reg_irq(usbvision, USBVISION_FORCE_INTRA, buffer, 1); |
1726 | return errCode; | 1726 | return err_code; |
1727 | } | 1727 | } |
1728 | 1728 | ||
1729 | static int usbvision_unrequest_intra (struct usb_usbvision *usbvision) | 1729 | static int usbvision_unrequest_intra (struct usb_usbvision *usbvision) |
1730 | { | 1730 | { |
1731 | int errCode = 0; | 1731 | int err_code = 0; |
1732 | unsigned char buffer[1]; | 1732 | unsigned char buffer[1]; |
1733 | 1733 | ||
1734 | PDEBUG(DBG_IRQ, ""); | 1734 | PDEBUG(DBG_IRQ, ""); |
1735 | usbvision->requestIntra = 0; | 1735 | usbvision->request_intra = 0; |
1736 | buffer[0] = 0; | 1736 | buffer[0] = 0; |
1737 | usbvision_write_reg_irq(usbvision, USBVISION_FORCE_INTRA, buffer, 1); | 1737 | usbvision_write_reg_irq(usbvision, USBVISION_FORCE_INTRA, buffer, 1); |
1738 | return errCode; | 1738 | return err_code; |
1739 | } | 1739 | } |
1740 | 1740 | ||
1741 | /******************************* | 1741 | /******************************* |
@@ -1744,16 +1744,16 @@ static int usbvision_unrequest_intra (struct usb_usbvision *usbvision) | |||
1744 | 1744 | ||
1745 | int usbvision_power_off(struct usb_usbvision *usbvision) | 1745 | int usbvision_power_off(struct usb_usbvision *usbvision) |
1746 | { | 1746 | { |
1747 | int errCode = 0; | 1747 | int err_code = 0; |
1748 | 1748 | ||
1749 | PDEBUG(DBG_FUNC, ""); | 1749 | PDEBUG(DBG_FUNC, ""); |
1750 | 1750 | ||
1751 | errCode = usbvision_write_reg(usbvision, USBVISION_PWR_REG, USBVISION_SSPND_EN); | 1751 | err_code = usbvision_write_reg(usbvision, USBVISION_PWR_REG, USBVISION_SSPND_EN); |
1752 | if (errCode == 1) { | 1752 | if (err_code == 1) { |
1753 | usbvision->power = 0; | 1753 | usbvision->power = 0; |
1754 | } | 1754 | } |
1755 | PDEBUG(DBG_FUNC, "%s: errCode %d", (errCode!=1)?"ERROR":"power is off", errCode); | 1755 | PDEBUG(DBG_FUNC, "%s: err_code %d", (err_code!=1)?"ERROR":"power is off", err_code); |
1756 | return errCode; | 1756 | return err_code; |
1757 | } | 1757 | } |
1758 | 1758 | ||
1759 | /* | 1759 | /* |
@@ -1769,7 +1769,7 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma | |||
1769 | if (!USBVISION_IS_OPERATIONAL(usbvision)) | 1769 | if (!USBVISION_IS_OPERATIONAL(usbvision)) |
1770 | return 0; | 1770 | return 0; |
1771 | 1771 | ||
1772 | PDEBUG(DBG_FUNC, "isocMode %#02x", format); | 1772 | PDEBUG(DBG_FUNC, "isoc_mode %#02x", format); |
1773 | 1773 | ||
1774 | if ((format != ISOC_MODE_YUV422) | 1774 | if ((format != ISOC_MODE_YUV422) |
1775 | && (format != ISOC_MODE_YUV420) | 1775 | && (format != ISOC_MODE_YUV420) |
@@ -1790,7 +1790,7 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma | |||
1790 | printk(KERN_ERR "%s: ERROR=%d. USBVISION stopped - " | 1790 | printk(KERN_ERR "%s: ERROR=%d. USBVISION stopped - " |
1791 | "reconnect or reload driver.\n", proc, rc); | 1791 | "reconnect or reload driver.\n", proc, rc); |
1792 | } | 1792 | } |
1793 | usbvision->isocMode = format; | 1793 | usbvision->isoc_mode = format; |
1794 | return rc; | 1794 | return rc; |
1795 | } | 1795 | } |
1796 | 1796 | ||
@@ -1802,9 +1802,9 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma | |||
1802 | int usbvision_set_output(struct usb_usbvision *usbvision, int width, | 1802 | int usbvision_set_output(struct usb_usbvision *usbvision, int width, |
1803 | int height) | 1803 | int height) |
1804 | { | 1804 | { |
1805 | int errCode = 0; | 1805 | int err_code = 0; |
1806 | int UsbWidth, UsbHeight; | 1806 | int usb_width, usb_height; |
1807 | unsigned int frameRate=0, frameDrop=0; | 1807 | unsigned int frame_rate=0, frame_drop=0; |
1808 | unsigned char value[4]; | 1808 | unsigned char value[4]; |
1809 | 1809 | ||
1810 | if (!USBVISION_IS_OPERATIONAL(usbvision)) { | 1810 | if (!USBVISION_IS_OPERATIONAL(usbvision)) { |
@@ -1812,86 +1812,86 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width, | |||
1812 | } | 1812 | } |
1813 | 1813 | ||
1814 | if (width > MAX_USB_WIDTH) { | 1814 | if (width > MAX_USB_WIDTH) { |
1815 | UsbWidth = width / 2; | 1815 | usb_width = width / 2; |
1816 | usbvision->stretch_width = 2; | 1816 | usbvision->stretch_width = 2; |
1817 | } | 1817 | } |
1818 | else { | 1818 | else { |
1819 | UsbWidth = width; | 1819 | usb_width = width; |
1820 | usbvision->stretch_width = 1; | 1820 | usbvision->stretch_width = 1; |
1821 | } | 1821 | } |
1822 | 1822 | ||
1823 | if (height > MAX_USB_HEIGHT) { | 1823 | if (height > MAX_USB_HEIGHT) { |
1824 | UsbHeight = height / 2; | 1824 | usb_height = height / 2; |
1825 | usbvision->stretch_height = 2; | 1825 | usbvision->stretch_height = 2; |
1826 | } | 1826 | } |
1827 | else { | 1827 | else { |
1828 | UsbHeight = height; | 1828 | usb_height = height; |
1829 | usbvision->stretch_height = 1; | 1829 | usbvision->stretch_height = 1; |
1830 | } | 1830 | } |
1831 | 1831 | ||
1832 | RESTRICT_TO_RANGE(UsbWidth, MIN_FRAME_WIDTH, MAX_USB_WIDTH); | 1832 | RESTRICT_TO_RANGE(usb_width, MIN_FRAME_WIDTH, MAX_USB_WIDTH); |
1833 | UsbWidth &= ~(MIN_FRAME_WIDTH-1); | 1833 | usb_width &= ~(MIN_FRAME_WIDTH-1); |
1834 | RESTRICT_TO_RANGE(UsbHeight, MIN_FRAME_HEIGHT, MAX_USB_HEIGHT); | 1834 | RESTRICT_TO_RANGE(usb_height, MIN_FRAME_HEIGHT, MAX_USB_HEIGHT); |
1835 | UsbHeight &= ~(1); | 1835 | usb_height &= ~(1); |
1836 | 1836 | ||
1837 | PDEBUG(DBG_FUNC, "usb %dx%d; screen %dx%d; stretch %dx%d", | 1837 | PDEBUG(DBG_FUNC, "usb %dx%d; screen %dx%d; stretch %dx%d", |
1838 | UsbWidth, UsbHeight, width, height, | 1838 | usb_width, usb_height, width, height, |
1839 | usbvision->stretch_width, usbvision->stretch_height); | 1839 | usbvision->stretch_width, usbvision->stretch_height); |
1840 | 1840 | ||
1841 | /* I'll not rewrite the same values */ | 1841 | /* I'll not rewrite the same values */ |
1842 | if ((UsbWidth != usbvision->curwidth) || (UsbHeight != usbvision->curheight)) { | 1842 | if ((usb_width != usbvision->curwidth) || (usb_height != usbvision->curheight)) { |
1843 | value[0] = UsbWidth & 0xff; //LSB | 1843 | value[0] = usb_width & 0xff; //LSB |
1844 | value[1] = (UsbWidth >> 8) & 0x03; //MSB | 1844 | value[1] = (usb_width >> 8) & 0x03; //MSB |
1845 | value[2] = UsbHeight & 0xff; //LSB | 1845 | value[2] = usb_height & 0xff; //LSB |
1846 | value[3] = (UsbHeight >> 8) & 0x03; //MSB | 1846 | value[3] = (usb_height >> 8) & 0x03; //MSB |
1847 | 1847 | ||
1848 | errCode = 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, |
1850 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, | 1850 | USB_DIR_OUT | USB_TYPE_VENDOR | USB_RECIP_ENDPOINT, |
1851 | 0, (__u16) USBVISION_LXSIZE_O, value, 4, HZ); | 1851 | 0, (__u16) USBVISION_LXSIZE_O, value, 4, HZ); |
1852 | 1852 | ||
1853 | if (errCode < 0) { | 1853 | if (err_code < 0) { |
1854 | dev_err(&usbvision->dev->dev, | 1854 | dev_err(&usbvision->dev->dev, |
1855 | "%s failed: error %d\n", __func__, errCode); | 1855 | "%s failed: error %d\n", __func__, err_code); |
1856 | return errCode; | 1856 | return err_code; |
1857 | } | 1857 | } |
1858 | usbvision->curwidth = usbvision->stretch_width * UsbWidth; | 1858 | usbvision->curwidth = usbvision->stretch_width * usb_width; |
1859 | usbvision->curheight = usbvision->stretch_height * UsbHeight; | 1859 | usbvision->curheight = usbvision->stretch_height * usb_height; |
1860 | } | 1860 | } |
1861 | 1861 | ||
1862 | if (usbvision->isocMode == ISOC_MODE_YUV422) { | 1862 | if (usbvision->isoc_mode == ISOC_MODE_YUV422) { |
1863 | frameRate = (usbvision->isocPacketSize * 1000) / (UsbWidth * UsbHeight * 2); | 1863 | frame_rate = (usbvision->isoc_packet_size * 1000) / (usb_width * usb_height * 2); |
1864 | } | 1864 | } |
1865 | else if (usbvision->isocMode == ISOC_MODE_YUV420) { | 1865 | else if (usbvision->isoc_mode == ISOC_MODE_YUV420) { |
1866 | frameRate = (usbvision->isocPacketSize * 1000) / ((UsbWidth * UsbHeight * 12) / 8); | 1866 | frame_rate = (usbvision->isoc_packet_size * 1000) / ((usb_width * usb_height * 12) / 8); |
1867 | } | 1867 | } |
1868 | else { | 1868 | else { |
1869 | frameRate = FRAMERATE_MAX; | 1869 | frame_rate = FRAMERATE_MAX; |
1870 | } | 1870 | } |
1871 | 1871 | ||
1872 | if (usbvision->tvnormId & V4L2_STD_625_50) { | 1872 | if (usbvision->tvnorm_id & V4L2_STD_625_50) { |
1873 | frameDrop = frameRate * 32 / 25 - 1; | 1873 | frame_drop = frame_rate * 32 / 25 - 1; |
1874 | } | 1874 | } |
1875 | else if (usbvision->tvnormId & V4L2_STD_525_60) { | 1875 | else if (usbvision->tvnorm_id & V4L2_STD_525_60) { |
1876 | frameDrop = frameRate * 32 / 30 - 1; | 1876 | frame_drop = frame_rate * 32 / 30 - 1; |
1877 | } | 1877 | } |
1878 | 1878 | ||
1879 | RESTRICT_TO_RANGE(frameDrop, FRAMERATE_MIN, FRAMERATE_MAX); | 1879 | RESTRICT_TO_RANGE(frame_drop, FRAMERATE_MIN, FRAMERATE_MAX); |
1880 | 1880 | ||
1881 | PDEBUG(DBG_FUNC, "frameRate %d fps, frameDrop %d", frameRate, frameDrop); | 1881 | PDEBUG(DBG_FUNC, "frame_rate %d fps, frame_drop %d", frame_rate, frame_drop); |
1882 | 1882 | ||
1883 | frameDrop = 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 | /* frameDrop = 7; => framePhase = 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 | => frameSkip = 4; | 1886 | => frame_skip = 4; |
1887 | => frameRate = (7 + 1) * 25 / 32 = 200 / 32 = 6.25; | 1887 | => frame_rate = (7 + 1) * 25 / 32 = 200 / 32 = 6.25; |
1888 | 1888 | ||
1889 | frameDrop = 9; => framePhase = 1, 5, 8, 11, 14, 17, 21, 24, 27, 1, 4, 8, ... | 1889 | frame_drop = 9; => frame_phase = 1, 5, 8, 11, 14, 17, 21, 24, 27, 1, 4, 8, ... |
1890 | => frameSkip = 4, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, ... | 1890 | => frame_skip = 4, 3, 3, 3, 3, 4, 3, 3, 3, 3, 4, ... |
1891 | => frameRate = (9 + 1) * 25 / 32 = 250 / 32 = 7.8125; | 1891 | => frame_rate = (9 + 1) * 25 / 32 = 250 / 32 = 7.8125; |
1892 | */ | 1892 | */ |
1893 | errCode = usbvision_write_reg(usbvision, USBVISION_FRM_RATE, frameDrop); | 1893 | err_code = usbvision_write_reg(usbvision, USBVISION_FRM_RATE, frame_drop); |
1894 | return errCode; | 1894 | return err_code; |
1895 | } | 1895 | } |
1896 | 1896 | ||
1897 | 1897 | ||
@@ -1925,7 +1925,7 @@ int usbvision_frames_alloc(struct usb_usbvision *usbvision, int number_of_frames | |||
1925 | /* Allocate all buffers */ | 1925 | /* Allocate all buffers */ |
1926 | for (i = 0; i < usbvision->num_frames; i++) { | 1926 | for (i = 0; i < usbvision->num_frames; i++) { |
1927 | usbvision->frame[i].index = i; | 1927 | usbvision->frame[i].index = i; |
1928 | usbvision->frame[i].grabstate = FrameState_Unused; | 1928 | usbvision->frame[i].grabstate = frame_state_unused; |
1929 | usbvision->frame[i].data = usbvision->fbuf + | 1929 | usbvision->frame[i].data = usbvision->fbuf + |
1930 | i * usbvision->max_frame_size; | 1930 | i * usbvision->max_frame_size; |
1931 | /* | 1931 | /* |
@@ -1969,7 +1969,7 @@ void usbvision_empty_framequeues(struct usb_usbvision *usbvision) | |||
1969 | INIT_LIST_HEAD(&(usbvision->outqueue)); | 1969 | INIT_LIST_HEAD(&(usbvision->outqueue)); |
1970 | 1970 | ||
1971 | for (i = 0; i < USBVISION_NUMFRAMES; i++) { | 1971 | for (i = 0; i < USBVISION_NUMFRAMES; i++) { |
1972 | usbvision->frame[i].grabstate = FrameState_Unused; | 1972 | usbvision->frame[i].grabstate = frame_state_unused; |
1973 | usbvision->frame[i].bytes_read = 0; | 1973 | usbvision->frame[i].bytes_read = 0; |
1974 | } | 1974 | } |
1975 | } | 1975 | } |
@@ -1984,9 +1984,9 @@ int usbvision_stream_interrupt(struct usb_usbvision *usbvision) | |||
1984 | 1984 | ||
1985 | /* stop reading from the device */ | 1985 | /* stop reading from the device */ |
1986 | 1986 | ||
1987 | usbvision->streaming = Stream_Interrupt; | 1987 | usbvision->streaming = stream_interrupt; |
1988 | ret = wait_event_timeout(usbvision->wait_stream, | 1988 | ret = wait_event_timeout(usbvision->wait_stream, |
1989 | (usbvision->streaming == Stream_Idle), | 1989 | (usbvision->streaming == stream_idle), |
1990 | msecs_to_jiffies(USBVISION_NUMSBUF*USBVISION_URB_FRAMES)); | 1990 | msecs_to_jiffies(USBVISION_NUMSBUF*USBVISION_URB_FRAMES)); |
1991 | return ret; | 1991 | return ret; |
1992 | } | 1992 | } |
@@ -2030,7 +2030,7 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision) | |||
2030 | return rc; | 2030 | return rc; |
2031 | } | 2031 | } |
2032 | 2032 | ||
2033 | if (usbvision->bridgeType == 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 |
@@ -2085,9 +2085,9 @@ int usbvision_set_input(struct usb_usbvision *usbvision) | |||
2085 | return 0; | 2085 | return 0; |
2086 | 2086 | ||
2087 | /* Set input format expected from decoder*/ | 2087 | /* Set input format expected from decoder*/ |
2088 | if (usbvision_device_data[usbvision->DevModel].Vin_Reg1_override) { | 2088 | if (usbvision_device_data[usbvision->dev_model].vin_reg1_override) { |
2089 | value[0] = usbvision_device_data[usbvision->DevModel].Vin_Reg1; | 2089 | value[0] = usbvision_device_data[usbvision->dev_model].vin_reg1; |
2090 | } else if(usbvision_device_data[usbvision->DevModel].Codec == CODEC_SAA7113) { | 2090 | } else if(usbvision_device_data[usbvision->dev_model].codec == CODEC_SAA7113) { |
2091 | /* SAA7113 uses 8 bit output */ | 2091 | /* SAA7113 uses 8 bit output */ |
2092 | value[0] = USBVISION_8_422_SYNC; | 2092 | value[0] = USBVISION_8_422_SYNC; |
2093 | } else { | 2093 | } else { |
@@ -2105,7 +2105,7 @@ int usbvision_set_input(struct usb_usbvision *usbvision) | |||
2105 | } | 2105 | } |
2106 | 2106 | ||
2107 | 2107 | ||
2108 | if (usbvision->tvnormId & 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; |
@@ -2114,7 +2114,7 @@ int usbvision_set_input(struct usb_usbvision *usbvision) | |||
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->tvnormId & 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; |
@@ -2134,24 +2134,24 @@ int usbvision_set_input(struct usb_usbvision *usbvision) | |||
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->DevModel].X_Offset >= 0) { | 2137 | if (usbvision_device_data[usbvision->dev_model].x_offset >= 0) { |
2138 | value[4]=usbvision_device_data[usbvision->DevModel].X_Offset & 0xff; | 2138 | value[4]=usbvision_device_data[usbvision->dev_model].x_offset & 0xff; |
2139 | value[5]=(usbvision_device_data[usbvision->DevModel].X_Offset & 0x0300) >> 8; | 2139 | value[5]=(usbvision_device_data[usbvision->dev_model].x_offset & 0x0300) >> 8; |
2140 | } | 2140 | } |
2141 | 2141 | ||
2142 | if (adjust_X_Offset != -1) { | 2142 | if (adjust_x_offset != -1) { |
2143 | value[4] = adjust_X_Offset & 0xff; | 2143 | value[4] = adjust_x_offset & 0xff; |
2144 | value[5] = (adjust_X_Offset & 0x0300) >> 8; | 2144 | value[5] = (adjust_x_offset & 0x0300) >> 8; |
2145 | } | 2145 | } |
2146 | 2146 | ||
2147 | if (usbvision_device_data[usbvision->DevModel].Y_Offset >= 0) { | 2147 | if (usbvision_device_data[usbvision->dev_model].y_offset >= 0) { |
2148 | value[6]=usbvision_device_data[usbvision->DevModel].Y_Offset & 0xff; | 2148 | value[6]=usbvision_device_data[usbvision->dev_model].y_offset & 0xff; |
2149 | value[7]=(usbvision_device_data[usbvision->DevModel].Y_Offset & 0x0300) >> 8; | 2149 | value[7]=(usbvision_device_data[usbvision->dev_model].y_offset & 0x0300) >> 8; |
2150 | } | 2150 | } |
2151 | 2151 | ||
2152 | if (adjust_Y_Offset != -1) { | 2152 | if (adjust_y_offset != -1) { |
2153 | value[6] = adjust_Y_Offset & 0xff; | 2153 | value[6] = adjust_y_offset & 0xff; |
2154 | value[7] = (adjust_Y_Offset & 0x0300) >> 8; | 2154 | value[7] = (adjust_y_offset & 0x0300) >> 8; |
2155 | } | 2155 | } |
2156 | 2156 | ||
2157 | rc = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), | 2157 | rc = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), |
@@ -2167,10 +2167,10 @@ int usbvision_set_input(struct usb_usbvision *usbvision) | |||
2167 | 2167 | ||
2168 | dvi_yuv_value = 0x00; /* U comes after V, Ya comes after U/V, Yb comes after Yb */ | 2168 | dvi_yuv_value = 0x00; /* U comes after V, Ya comes after U/V, Yb comes after Yb */ |
2169 | 2169 | ||
2170 | if(usbvision_device_data[usbvision->DevModel].Dvi_yuv_override){ | 2170 | if(usbvision_device_data[usbvision->dev_model].dvi_yuv_override){ |
2171 | dvi_yuv_value = usbvision_device_data[usbvision->DevModel].Dvi_yuv; | 2171 | dvi_yuv_value = usbvision_device_data[usbvision->dev_model].dvi_yuv; |
2172 | } | 2172 | } |
2173 | else if(usbvision_device_data[usbvision->DevModel].Codec == CODEC_SAA7113) { | 2173 | else if(usbvision_device_data[usbvision->dev_model].codec == CODEC_SAA7113) { |
2174 | /* This changes as the fine sync control changes. Further investigation necessary */ | 2174 | /* This changes as the fine sync control changes. Further investigation necessary */ |
2175 | dvi_yuv_value = 0x06; | 2175 | dvi_yuv_value = 0x06; |
2176 | } | 2176 | } |
@@ -2192,7 +2192,7 @@ static int usbvision_set_dram_settings(struct usb_usbvision *usbvision) | |||
2192 | int rc; | 2192 | int rc; |
2193 | unsigned char value[8]; | 2193 | unsigned char value[8]; |
2194 | 2194 | ||
2195 | if (usbvision->isocMode == ISOC_MODE_COMPRESS) { | 2195 | if (usbvision->isoc_mode == ISOC_MODE_COMPRESS) { |
2196 | value[0] = 0x42; | 2196 | value[0] = 0x42; |
2197 | value[1] = 0x71; | 2197 | value[1] = 0x71; |
2198 | value[2] = 0xff; | 2198 | value[2] = 0xff; |
@@ -2261,7 +2261,7 @@ static int usbvision_set_dram_settings(struct usb_usbvision *usbvision) | |||
2261 | 2261 | ||
2262 | int usbvision_power_on(struct usb_usbvision *usbvision) | 2262 | int usbvision_power_on(struct usb_usbvision *usbvision) |
2263 | { | 2263 | { |
2264 | int errCode = 0; | 2264 | int err_code = 0; |
2265 | 2265 | ||
2266 | PDEBUG(DBG_FUNC, ""); | 2266 | PDEBUG(DBG_FUNC, ""); |
2267 | 2267 | ||
@@ -2271,13 +2271,13 @@ int usbvision_power_on(struct usb_usbvision *usbvision) | |||
2271 | 2271 | ||
2272 | usbvision_write_reg(usbvision, USBVISION_PWR_REG, | 2272 | usbvision_write_reg(usbvision, USBVISION_PWR_REG, |
2273 | USBVISION_SSPND_EN | USBVISION_PWR_VID); | 2273 | USBVISION_SSPND_EN | USBVISION_PWR_VID); |
2274 | errCode = usbvision_write_reg(usbvision, USBVISION_PWR_REG, | 2274 | err_code = usbvision_write_reg(usbvision, USBVISION_PWR_REG, |
2275 | USBVISION_SSPND_EN | USBVISION_PWR_VID | USBVISION_RES2); | 2275 | USBVISION_SSPND_EN | USBVISION_PWR_VID | USBVISION_RES2); |
2276 | if (errCode == 1) { | 2276 | if (err_code == 1) { |
2277 | usbvision->power = 1; | 2277 | usbvision->power = 1; |
2278 | } | 2278 | } |
2279 | PDEBUG(DBG_FUNC, "%s: errCode %d", (errCode<0)?"ERROR":"power is on", errCode); | 2279 | PDEBUG(DBG_FUNC, "%s: err_code %d", (err_code<0)?"ERROR":"power is on", err_code); |
2280 | return errCode; | 2280 | return err_code; |
2281 | } | 2281 | } |
2282 | 2282 | ||
2283 | 2283 | ||
@@ -2288,7 +2288,7 @@ int usbvision_power_on(struct usb_usbvision *usbvision) | |||
2288 | // to call usbvision_power_off from task queue | 2288 | // to call usbvision_power_off from task queue |
2289 | static void call_usbvision_power_off(struct work_struct *work) | 2289 | static void call_usbvision_power_off(struct work_struct *work) |
2290 | { | 2290 | { |
2291 | struct usb_usbvision *usbvision = container_of(work, struct usb_usbvision, powerOffWork); | 2291 | struct usb_usbvision *usbvision = container_of(work, struct usb_usbvision, power_off_work); |
2292 | 2292 | ||
2293 | PDEBUG(DBG_FUNC, ""); | 2293 | PDEBUG(DBG_FUNC, ""); |
2294 | if (mutex_lock_interruptible(&usbvision->v4l2_lock)) | 2294 | if (mutex_lock_interruptible(&usbvision->v4l2_lock)) |
@@ -2303,32 +2303,32 @@ static void call_usbvision_power_off(struct work_struct *work) | |||
2303 | mutex_unlock(&usbvision->v4l2_lock); | 2303 | mutex_unlock(&usbvision->v4l2_lock); |
2304 | } | 2304 | } |
2305 | 2305 | ||
2306 | static void usbvision_powerOffTimer(unsigned long data) | 2306 | static void usbvision_power_off_timer(unsigned long data) |
2307 | { | 2307 | { |
2308 | struct usb_usbvision *usbvision = (void *) data; | 2308 | struct usb_usbvision *usbvision = (void *) data; |
2309 | 2309 | ||
2310 | PDEBUG(DBG_FUNC, ""); | 2310 | PDEBUG(DBG_FUNC, ""); |
2311 | del_timer(&usbvision->powerOffTimer); | 2311 | del_timer(&usbvision->power_off_timer); |
2312 | INIT_WORK(&usbvision->powerOffWork, call_usbvision_power_off); | 2312 | INIT_WORK(&usbvision->power_off_work, call_usbvision_power_off); |
2313 | (void) schedule_work(&usbvision->powerOffWork); | 2313 | (void) schedule_work(&usbvision->power_off_work); |
2314 | } | 2314 | } |
2315 | 2315 | ||
2316 | void usbvision_init_powerOffTimer(struct usb_usbvision *usbvision) | 2316 | void usbvision_init_power_off_timer(struct usb_usbvision *usbvision) |
2317 | { | 2317 | { |
2318 | init_timer(&usbvision->powerOffTimer); | 2318 | init_timer(&usbvision->power_off_timer); |
2319 | usbvision->powerOffTimer.data = (long) usbvision; | 2319 | usbvision->power_off_timer.data = (long) usbvision; |
2320 | usbvision->powerOffTimer.function = usbvision_powerOffTimer; | 2320 | usbvision->power_off_timer.function = usbvision_power_off_timer; |
2321 | } | 2321 | } |
2322 | 2322 | ||
2323 | void usbvision_set_powerOffTimer(struct usb_usbvision *usbvision) | 2323 | void usbvision_set_power_off_timer(struct usb_usbvision *usbvision) |
2324 | { | 2324 | { |
2325 | mod_timer(&usbvision->powerOffTimer, jiffies + USBVISION_POWEROFF_TIME); | 2325 | mod_timer(&usbvision->power_off_timer, jiffies + USBVISION_POWEROFF_TIME); |
2326 | } | 2326 | } |
2327 | 2327 | ||
2328 | void usbvision_reset_powerOffTimer(struct usb_usbvision *usbvision) | 2328 | void usbvision_reset_power_off_timer(struct usb_usbvision *usbvision) |
2329 | { | 2329 | { |
2330 | if (timer_pending(&usbvision->powerOffTimer)) { | 2330 | if (timer_pending(&usbvision->power_off_timer)) { |
2331 | del_timer(&usbvision->powerOffTimer); | 2331 | del_timer(&usbvision->power_off_timer); |
2332 | } | 2332 | } |
2333 | } | 2333 | } |
2334 | 2334 | ||
@@ -2339,14 +2339,14 @@ void usbvision_reset_powerOffTimer(struct usb_usbvision *usbvision) | |||
2339 | */ | 2339 | */ |
2340 | int usbvision_begin_streaming(struct usb_usbvision *usbvision) | 2340 | int usbvision_begin_streaming(struct usb_usbvision *usbvision) |
2341 | { | 2341 | { |
2342 | int errCode = 0; | 2342 | int err_code = 0; |
2343 | 2343 | ||
2344 | if (usbvision->isocMode == ISOC_MODE_COMPRESS) { | 2344 | if (usbvision->isoc_mode == ISOC_MODE_COMPRESS) { |
2345 | usbvision_init_compression(usbvision); | 2345 | usbvision_init_compression(usbvision); |
2346 | } | 2346 | } |
2347 | errCode = usbvision_write_reg(usbvision, USBVISION_VIN_REG2, USBVISION_NOHVALID | | 2347 | err_code = usbvision_write_reg(usbvision, USBVISION_VIN_REG2, USBVISION_NOHVALID | |
2348 | usbvision->Vin_Reg2_Preset); | 2348 | usbvision->vin_reg2_preset); |
2349 | return errCode; | 2349 | return err_code; |
2350 | } | 2350 | } |
2351 | 2351 | ||
2352 | /* | 2352 | /* |
@@ -2373,7 +2373,7 @@ int usbvision_restart_isoc(struct usb_usbvision *usbvision) | |||
2373 | (ret = | 2373 | (ret = |
2374 | usbvision_write_reg(usbvision, USBVISION_VIN_REG2, | 2374 | usbvision_write_reg(usbvision, USBVISION_VIN_REG2, |
2375 | USBVISION_KEEP_BLANK | USBVISION_NOHVALID | | 2375 | USBVISION_KEEP_BLANK | USBVISION_NOHVALID | |
2376 | usbvision->Vin_Reg2_Preset)) < 0) return ret; | 2376 | usbvision->vin_reg2_preset)) < 0) return ret; |
2377 | 2377 | ||
2378 | /* TODO: schedule timeout */ | 2378 | /* TODO: schedule timeout */ |
2379 | while ((usbvision_read_reg(usbvision, USBVISION_STATUS_REG) & 0x01) != 1); | 2379 | while ((usbvision_read_reg(usbvision, USBVISION_STATUS_REG) & 0x01) != 1); |
@@ -2387,20 +2387,20 @@ int usbvision_audio_off(struct usb_usbvision *usbvision) | |||
2387 | printk(KERN_ERR "usbvision_audio_off: can't wirte reg\n"); | 2387 | printk(KERN_ERR "usbvision_audio_off: can't wirte reg\n"); |
2388 | return -1; | 2388 | return -1; |
2389 | } | 2389 | } |
2390 | usbvision->AudioMute = 0; | 2390 | usbvision->audio_mute = 0; |
2391 | usbvision->AudioChannel = USBVISION_AUDIO_MUTE; | 2391 | usbvision->audio_channel = USBVISION_AUDIO_MUTE; |
2392 | return 0; | 2392 | return 0; |
2393 | } | 2393 | } |
2394 | 2394 | ||
2395 | int usbvision_set_audio(struct usb_usbvision *usbvision, int AudioChannel) | 2395 | int usbvision_set_audio(struct usb_usbvision *usbvision, int audio_channel) |
2396 | { | 2396 | { |
2397 | if (!usbvision->AudioMute) { | 2397 | if (!usbvision->audio_mute) { |
2398 | if (usbvision_write_reg(usbvision, USBVISION_IOPIN_REG, AudioChannel) < 0) { | 2398 | if (usbvision_write_reg(usbvision, USBVISION_IOPIN_REG, audio_channel) < 0) { |
2399 | printk(KERN_ERR "usbvision_set_audio: can't write iopin register for audio switching\n"); | 2399 | printk(KERN_ERR "usbvision_set_audio: can't write iopin register for audio switching\n"); |
2400 | return -1; | 2400 | return -1; |
2401 | } | 2401 | } |
2402 | } | 2402 | } |
2403 | usbvision->AudioChannel = AudioChannel; | 2403 | usbvision->audio_channel = audio_channel; |
2404 | return 0; | 2404 | return 0; |
2405 | } | 2405 | } |
2406 | 2406 | ||
@@ -2419,27 +2419,27 @@ int usbvision_setup(struct usb_usbvision *usbvision,int format) | |||
2419 | 2419 | ||
2420 | int usbvision_set_alternate(struct usb_usbvision *dev) | 2420 | int usbvision_set_alternate(struct usb_usbvision *dev) |
2421 | { | 2421 | { |
2422 | int errCode, prev_alt = dev->ifaceAlt; | 2422 | int err_code, prev_alt = dev->iface_alt; |
2423 | int i; | 2423 | int i; |
2424 | 2424 | ||
2425 | dev->ifaceAlt=0; | 2425 | dev->iface_alt=0; |
2426 | for(i=0;i< dev->num_alt; i++) | 2426 | for(i=0;i< dev->num_alt; i++) |
2427 | if(dev->alt_max_pkt_size[i]>dev->alt_max_pkt_size[dev->ifaceAlt]) | 2427 | if(dev->alt_max_pkt_size[i]>dev->alt_max_pkt_size[dev->iface_alt]) |
2428 | dev->ifaceAlt=i; | 2428 | dev->iface_alt=i; |
2429 | 2429 | ||
2430 | if (dev->ifaceAlt != prev_alt) { | 2430 | if (dev->iface_alt != prev_alt) { |
2431 | dev->isocPacketSize = dev->alt_max_pkt_size[dev->ifaceAlt]; | 2431 | dev->isoc_packet_size = dev->alt_max_pkt_size[dev->iface_alt]; |
2432 | PDEBUG(DBG_FUNC,"setting alternate %d with wMaxPacketSize=%u", dev->ifaceAlt,dev->isocPacketSize); | 2432 | PDEBUG(DBG_FUNC,"setting alternate %d with max_packet_size=%u", dev->iface_alt,dev->isoc_packet_size); |
2433 | errCode = usb_set_interface(dev->dev, dev->iface, dev->ifaceAlt); | 2433 | err_code = usb_set_interface(dev->dev, dev->iface, dev->iface_alt); |
2434 | if (errCode < 0) { | 2434 | if (err_code < 0) { |
2435 | dev_err(&dev->dev->dev, | 2435 | dev_err(&dev->dev->dev, |
2436 | "cannot change alternate number to %d (error=%i)\n", | 2436 | "cannot change alternate number to %d (error=%i)\n", |
2437 | dev->ifaceAlt, errCode); | 2437 | dev->iface_alt, err_code); |
2438 | return errCode; | 2438 | return err_code; |
2439 | } | 2439 | } |
2440 | } | 2440 | } |
2441 | 2441 | ||
2442 | PDEBUG(DBG_ISOC, "ISO Packet Length:%d", dev->isocPacketSize); | 2442 | PDEBUG(DBG_ISOC, "ISO Packet Length:%d", dev->isoc_packet_size); |
2443 | 2443 | ||
2444 | return 0; | 2444 | return 0; |
2445 | } | 2445 | } |
@@ -2451,27 +2451,27 @@ int usbvision_set_alternate(struct usb_usbvision *dev) | |||
2451 | int usbvision_init_isoc(struct usb_usbvision *usbvision) | 2451 | int usbvision_init_isoc(struct usb_usbvision *usbvision) |
2452 | { | 2452 | { |
2453 | struct usb_device *dev = usbvision->dev; | 2453 | struct usb_device *dev = usbvision->dev; |
2454 | int bufIdx, errCode, regValue; | 2454 | int buf_idx, err_code, reg_value; |
2455 | int sb_size; | 2455 | int sb_size; |
2456 | 2456 | ||
2457 | if (!USBVISION_IS_OPERATIONAL(usbvision)) | 2457 | if (!USBVISION_IS_OPERATIONAL(usbvision)) |
2458 | return -EFAULT; | 2458 | return -EFAULT; |
2459 | 2459 | ||
2460 | usbvision->curFrame = NULL; | 2460 | usbvision->cur_frame = NULL; |
2461 | scratch_reset(usbvision); | 2461 | scratch_reset(usbvision); |
2462 | 2462 | ||
2463 | /* Alternate interface 1 is is the biggest frame size */ | 2463 | /* Alternate interface 1 is is the biggest frame size */ |
2464 | errCode = usbvision_set_alternate(usbvision); | 2464 | err_code = usbvision_set_alternate(usbvision); |
2465 | if (errCode < 0) { | 2465 | if (err_code < 0) { |
2466 | usbvision->last_error = errCode; | 2466 | usbvision->last_error = err_code; |
2467 | return -EBUSY; | 2467 | return -EBUSY; |
2468 | } | 2468 | } |
2469 | sb_size = USBVISION_URB_FRAMES * usbvision->isocPacketSize; | 2469 | sb_size = USBVISION_URB_FRAMES * usbvision->isoc_packet_size; |
2470 | 2470 | ||
2471 | regValue = (16 - usbvision_read_reg(usbvision, | 2471 | reg_value = (16 - usbvision_read_reg(usbvision, |
2472 | USBVISION_ALTER_REG)) & 0x0F; | 2472 | USBVISION_ALTER_REG)) & 0x0F; |
2473 | 2473 | ||
2474 | usbvision->usb_bandwidth = regValue >> 1; | 2474 | usbvision->usb_bandwidth = reg_value >> 1; |
2475 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", | 2475 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", |
2476 | usbvision->usb_bandwidth); | 2476 | usbvision->usb_bandwidth); |
2477 | 2477 | ||
@@ -2479,7 +2479,7 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2479 | 2479 | ||
2480 | /* We double buffer the Iso lists */ | 2480 | /* We double buffer the Iso lists */ |
2481 | 2481 | ||
2482 | for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { | 2482 | for (buf_idx = 0; buf_idx < USBVISION_NUMSBUF; buf_idx++) { |
2483 | int j, k; | 2483 | int j, k; |
2484 | struct urb *urb; | 2484 | struct urb *urb; |
2485 | 2485 | ||
@@ -2489,8 +2489,8 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2489 | "%s: usb_alloc_urb() failed\n", __func__); | 2489 | "%s: usb_alloc_urb() failed\n", __func__); |
2490 | return -ENOMEM; | 2490 | return -ENOMEM; |
2491 | } | 2491 | } |
2492 | usbvision->sbuf[bufIdx].urb = urb; | 2492 | usbvision->sbuf[buf_idx].urb = urb; |
2493 | usbvision->sbuf[bufIdx].data = | 2493 | usbvision->sbuf[buf_idx].data = |
2494 | usb_alloc_coherent(usbvision->dev, | 2494 | usb_alloc_coherent(usbvision->dev, |
2495 | sb_size, | 2495 | sb_size, |
2496 | GFP_KERNEL, | 2496 | GFP_KERNEL, |
@@ -2500,31 +2500,31 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2500 | urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); | 2500 | urb->pipe = usb_rcvisocpipe(dev, usbvision->video_endp); |
2501 | urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; | 2501 | urb->transfer_flags = URB_ISO_ASAP | URB_NO_TRANSFER_DMA_MAP; |
2502 | urb->interval = 1; | 2502 | urb->interval = 1; |
2503 | urb->transfer_buffer = usbvision->sbuf[bufIdx].data; | 2503 | urb->transfer_buffer = usbvision->sbuf[buf_idx].data; |
2504 | urb->complete = usbvision_isocIrq; | 2504 | urb->complete = usbvision_isoc_irq; |
2505 | urb->number_of_packets = USBVISION_URB_FRAMES; | 2505 | urb->number_of_packets = USBVISION_URB_FRAMES; |
2506 | urb->transfer_buffer_length = | 2506 | urb->transfer_buffer_length = |
2507 | usbvision->isocPacketSize * USBVISION_URB_FRAMES; | 2507 | usbvision->isoc_packet_size * USBVISION_URB_FRAMES; |
2508 | for (j = k = 0; j < USBVISION_URB_FRAMES; j++, | 2508 | for (j = k = 0; j < USBVISION_URB_FRAMES; j++, |
2509 | k += usbvision->isocPacketSize) { | 2509 | k += usbvision->isoc_packet_size) { |
2510 | urb->iso_frame_desc[j].offset = k; | 2510 | urb->iso_frame_desc[j].offset = k; |
2511 | urb->iso_frame_desc[j].length = | 2511 | urb->iso_frame_desc[j].length = |
2512 | usbvision->isocPacketSize; | 2512 | usbvision->isoc_packet_size; |
2513 | } | 2513 | } |
2514 | } | 2514 | } |
2515 | 2515 | ||
2516 | /* Submit all URBs */ | 2516 | /* Submit all URBs */ |
2517 | for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { | 2517 | for (buf_idx = 0; buf_idx < USBVISION_NUMSBUF; buf_idx++) { |
2518 | errCode = usb_submit_urb(usbvision->sbuf[bufIdx].urb, | 2518 | err_code = usb_submit_urb(usbvision->sbuf[buf_idx].urb, |
2519 | GFP_KERNEL); | 2519 | GFP_KERNEL); |
2520 | if (errCode) { | 2520 | if (err_code) { |
2521 | dev_err(&usbvision->dev->dev, | 2521 | dev_err(&usbvision->dev->dev, |
2522 | "%s: usb_submit_urb(%d) failed: error %d\n", | 2522 | "%s: usb_submit_urb(%d) failed: error %d\n", |
2523 | __func__, bufIdx, errCode); | 2523 | __func__, buf_idx, err_code); |
2524 | } | 2524 | } |
2525 | } | 2525 | } |
2526 | 2526 | ||
2527 | usbvision->streaming = Stream_Idle; | 2527 | usbvision->streaming = stream_idle; |
2528 | PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x", | 2528 | PDEBUG(DBG_ISOC, "%s: streaming=1 usbvision->video_endp=$%02x", |
2529 | __func__, | 2529 | __func__, |
2530 | usbvision->video_endp); | 2530 | usbvision->video_endp); |
@@ -2540,47 +2540,47 @@ int usbvision_init_isoc(struct usb_usbvision *usbvision) | |||
2540 | */ | 2540 | */ |
2541 | void usbvision_stop_isoc(struct usb_usbvision *usbvision) | 2541 | void usbvision_stop_isoc(struct usb_usbvision *usbvision) |
2542 | { | 2542 | { |
2543 | int bufIdx, errCode, regValue; | 2543 | int buf_idx, err_code, reg_value; |
2544 | int sb_size = USBVISION_URB_FRAMES * usbvision->isocPacketSize; | 2544 | int sb_size = USBVISION_URB_FRAMES * usbvision->isoc_packet_size; |
2545 | 2545 | ||
2546 | if ((usbvision->streaming == Stream_Off) || (usbvision->dev == NULL)) | 2546 | if ((usbvision->streaming == stream_off) || (usbvision->dev == NULL)) |
2547 | return; | 2547 | return; |
2548 | 2548 | ||
2549 | /* Unschedule all of the iso td's */ | 2549 | /* Unschedule all of the iso td's */ |
2550 | for (bufIdx = 0; bufIdx < USBVISION_NUMSBUF; bufIdx++) { | 2550 | for (buf_idx = 0; buf_idx < USBVISION_NUMSBUF; buf_idx++) { |
2551 | usb_kill_urb(usbvision->sbuf[bufIdx].urb); | 2551 | usb_kill_urb(usbvision->sbuf[buf_idx].urb); |
2552 | if (usbvision->sbuf[bufIdx].data){ | 2552 | if (usbvision->sbuf[buf_idx].data){ |
2553 | usb_free_coherent(usbvision->dev, | 2553 | usb_free_coherent(usbvision->dev, |
2554 | sb_size, | 2554 | sb_size, |
2555 | usbvision->sbuf[bufIdx].data, | 2555 | usbvision->sbuf[buf_idx].data, |
2556 | usbvision->sbuf[bufIdx].urb->transfer_dma); | 2556 | usbvision->sbuf[buf_idx].urb->transfer_dma); |
2557 | } | 2557 | } |
2558 | usb_free_urb(usbvision->sbuf[bufIdx].urb); | 2558 | usb_free_urb(usbvision->sbuf[buf_idx].urb); |
2559 | usbvision->sbuf[bufIdx].urb = NULL; | 2559 | usbvision->sbuf[buf_idx].urb = NULL; |
2560 | } | 2560 | } |
2561 | 2561 | ||
2562 | PDEBUG(DBG_ISOC, "%s: streaming=Stream_Off\n", __func__); | 2562 | PDEBUG(DBG_ISOC, "%s: streaming=stream_off\n", __func__); |
2563 | usbvision->streaming = Stream_Off; | 2563 | usbvision->streaming = stream_off; |
2564 | 2564 | ||
2565 | if (!usbvision->remove_pending) { | 2565 | if (!usbvision->remove_pending) { |
2566 | 2566 | ||
2567 | /* Set packet size to 0 */ | 2567 | /* Set packet size to 0 */ |
2568 | usbvision->ifaceAlt=0; | 2568 | usbvision->iface_alt=0; |
2569 | errCode = usb_set_interface(usbvision->dev, usbvision->iface, | 2569 | err_code = usb_set_interface(usbvision->dev, usbvision->iface, |
2570 | usbvision->ifaceAlt); | 2570 | usbvision->iface_alt); |
2571 | if (errCode < 0) { | 2571 | if (err_code < 0) { |
2572 | dev_err(&usbvision->dev->dev, | 2572 | dev_err(&usbvision->dev->dev, |
2573 | "%s: usb_set_interface() failed: error %d\n", | 2573 | "%s: usb_set_interface() failed: error %d\n", |
2574 | __func__, errCode); | 2574 | __func__, err_code); |
2575 | usbvision->last_error = errCode; | 2575 | usbvision->last_error = err_code; |
2576 | } | 2576 | } |
2577 | regValue = (16-usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; | 2577 | reg_value = (16-usbvision_read_reg(usbvision, USBVISION_ALTER_REG)) & 0x0F; |
2578 | usbvision->isocPacketSize = | 2578 | usbvision->isoc_packet_size = |
2579 | (regValue == 0) ? 0 : (regValue * 64) - 1; | 2579 | (reg_value == 0) ? 0 : (reg_value * 64) - 1; |
2580 | PDEBUG(DBG_ISOC, "ISO Packet Length:%d", | 2580 | PDEBUG(DBG_ISOC, "ISO Packet Length:%d", |
2581 | usbvision->isocPacketSize); | 2581 | usbvision->isoc_packet_size); |
2582 | 2582 | ||
2583 | usbvision->usb_bandwidth = regValue >> 1; | 2583 | usbvision->usb_bandwidth = reg_value >> 1; |
2584 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", | 2584 | PDEBUG(DBG_ISOC, "USB Bandwidth Usage: %dMbit/Sec", |
2585 | usbvision->usb_bandwidth); | 2585 | usbvision->usb_bandwidth); |
2586 | } | 2586 | } |
@@ -2604,12 +2604,12 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int 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->DevModel].Codec) { | 2607 | switch (usbvision_device_data[usbvision->dev_model].codec) { |
2608 | case CODEC_SAA7113: | 2608 | case CODEC_SAA7113: |
2609 | mode[1] = SAA7115_COMPOSITE2; | 2609 | mode[1] = SAA7115_COMPOSITE2; |
2610 | if (SwitchSVideoInput) { | 2610 | if (switch_svideo_input) { |
2611 | /* To handle problems with S-Video Input for | 2611 | /* To handle problems with S-Video Input for |
2612 | * some devices. Use SwitchSVideoInput | 2612 | * some devices. Use switch_svideo_input |
2613 | * parameter when loading the module.*/ | 2613 | * parameter when loading the module.*/ |
2614 | mode[2] = SAA7115_COMPOSITE1; | 2614 | mode[2] = SAA7115_COMPOSITE1; |
2615 | } | 2615 | } |