Commit 52cb0bf2 authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[media] usbvision: convert // to /* */

Signed-off-by: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 5490a7cb
...@@ -103,10 +103,10 @@ static const int min_imgheight = MIN_FRAME_HEIGHT; ...@@ -103,10 +103,10 @@ static const int min_imgheight = MIN_FRAME_HEIGHT;
* to work with. This setting can be adjusted, but the default value * to work with. This setting can be adjusted, but the default value
* should be OK for most desktop users. * should be OK for most desktop users.
*/ */
#define DEFAULT_SCRATCH_BUF_SIZE (0x20000) // 128kB memory scratch buffer #define DEFAULT_SCRATCH_BUF_SIZE (0x20000) /* 128kB memory scratch buffer */
static const int scratch_buf_size = DEFAULT_SCRATCH_BUF_SIZE; static const int scratch_buf_size = DEFAULT_SCRATCH_BUF_SIZE;
// Function prototypes /* Function prototypes */
static int usbvision_request_intra (struct usb_usbvision *usbvision); static int usbvision_request_intra (struct usb_usbvision *usbvision);
static int usbvision_unrequest_intra (struct usb_usbvision *usbvision); static int usbvision_unrequest_intra (struct usb_usbvision *usbvision);
static int usbvision_adjust_compression (struct usb_usbvision *usbvision); static int usbvision_adjust_compression (struct usb_usbvision *usbvision);
...@@ -183,7 +183,7 @@ static void usbvision_hexdump(const unsigned char *data, int len) ...@@ -183,7 +183,7 @@ static void usbvision_hexdump(const unsigned char *data, int len)
/******************************** /********************************
* scratch ring buffer handling * scratch ring buffer handling
********************************/ ********************************/
static int scratch_len(struct usb_usbvision *usbvision) /*This returns the amount of data actually in the buffer */ static int scratch_len(struct usb_usbvision *usbvision) /* This returns the amount of data actually in the buffer */
{ {
int len = usbvision->scratch_write_ptr - usbvision->scratch_read_ptr; int len = usbvision->scratch_write_ptr - usbvision->scratch_read_ptr;
if (len < 0) { if (len < 0) {
...@@ -287,7 +287,7 @@ static void scratch_set_extra_ptr(struct usb_usbvision *usbvision, int *ptr, ...@@ -287,7 +287,7 @@ static void scratch_set_extra_ptr(struct usb_usbvision *usbvision, int *ptr,
} }
/*This increments the scratch extra read pointer */ /* This increments the scratch extra read pointer */
static void scratch_inc_extra_ptr(int *ptr, int len) static void scratch_inc_extra_ptr(int *ptr, int len)
{ {
*ptr = (*ptr + len) % scratch_buf_size; *ptr = (*ptr + len) % scratch_buf_size;
...@@ -352,7 +352,7 @@ static int scratch_get_header(struct usb_usbvision *usbvision, ...@@ -352,7 +352,7 @@ static int scratch_get_header(struct usb_usbvision *usbvision,
} }
/*This removes len bytes of old data from the buffer */ /* This removes len bytes of old data from the buffer */
static void scratch_rm_old(struct usb_usbvision *usbvision, int len) static void scratch_rm_old(struct usb_usbvision *usbvision, int len)
{ {
...@@ -362,7 +362,7 @@ static void scratch_rm_old(struct usb_usbvision *usbvision, int len) ...@@ -362,7 +362,7 @@ static void scratch_rm_old(struct usb_usbvision *usbvision, int len)
} }
/*This resets the buffer - kills all data in it too */ /* This resets the buffer - kills all data in it too */
static void scratch_reset(struct usb_usbvision *usbvision) static void scratch_reset(struct usb_usbvision *usbvision)
{ {
PDEBUG(DBG_SCRATCH, "\n"); PDEBUG(DBG_SCRATCH, "\n");
...@@ -525,7 +525,7 @@ static enum parse_state usbvision_find_header(struct usb_usbvision *usbvision) ...@@ -525,7 +525,7 @@ static enum parse_state usbvision_find_header(struct usb_usbvision *usbvision)
frame = usbvision->cur_frame; frame = usbvision->cur_frame;
while (scratch_get_header(usbvision, &frame->isoc_header) == USBVISION_HEADER_LENGTH) { while (scratch_get_header(usbvision, &frame->isoc_header) == USBVISION_HEADER_LENGTH) {
// found header in scratch /* found header in scratch */
PDEBUG(DBG_HEADER, "found header: 0x%02x%02x %d %d %d %d %#x 0x%02x %u %u", PDEBUG(DBG_HEADER, "found header: 0x%02x%02x %d %d %d %d %#x 0x%02x %u %u",
frame->isoc_header.magic_2, frame->isoc_header.magic_2,
frame->isoc_header.magic_1, frame->isoc_header.magic_1,
...@@ -541,7 +541,7 @@ static enum parse_state usbvision_find_header(struct usb_usbvision *usbvision) ...@@ -541,7 +541,7 @@ static enum parse_state usbvision_find_header(struct usb_usbvision *usbvision)
if (usbvision->request_intra) { if (usbvision->request_intra) {
if (frame->isoc_header.format_param & 0x80) { if (frame->isoc_header.format_param & 0x80) {
found_header = 1; found_header = 1;
usbvision->last_isoc_frame_num = -1; // do not check for lost frames this time usbvision->last_isoc_frame_num = -1; /* do not check for lost frames this time */
usbvision_unrequest_intra(usbvision); usbvision_unrequest_intra(usbvision);
break; break;
} }
...@@ -557,18 +557,18 @@ static enum parse_state usbvision_find_header(struct usb_usbvision *usbvision) ...@@ -557,18 +557,18 @@ static enum parse_state usbvision_find_header(struct usb_usbvision *usbvision)
frame->frmheight = frame->isoc_header.frame_height * usbvision->stretch_height; frame->frmheight = frame->isoc_header.frame_height * usbvision->stretch_height;
frame->v4l2_linesize = (frame->frmwidth * frame->v4l2_format.depth)>> 3; frame->v4l2_linesize = (frame->frmwidth * frame->v4l2_format.depth)>> 3;
} }
else { // no header found else { /* no header found */
PDEBUG(DBG_HEADER, "skipping scratch data, no header"); PDEBUG(DBG_HEADER, "skipping scratch data, no header");
scratch_reset(usbvision); scratch_reset(usbvision);
return parse_state_end_parse; return parse_state_end_parse;
} }
// found header /* found header */
if (frame->isoc_header.data_format==ISOC_MODE_COMPRESS) { if (frame->isoc_header.data_format==ISOC_MODE_COMPRESS) {
//check isoc_header.frame_num for lost frames /* check isoc_header.frame_num for lost frames */
if (usbvision->last_isoc_frame_num >= 0) { if (usbvision->last_isoc_frame_num >= 0) {
if (((usbvision->last_isoc_frame_num + 1) % 32) != frame->isoc_header.frame_num) { if (((usbvision->last_isoc_frame_num + 1) % 32) != frame->isoc_header.frame_num) {
// unexpected frame drop: need to request new intra frame /* unexpected frame drop: need to request new intra frame */
PDEBUG(DBG_HEADER, "Lost frame before %d on USB", frame->isoc_header.frame_num); PDEBUG(DBG_HEADER, "Lost frame before %d on USB", frame->isoc_header.frame_num);
usbvision_request_intra(usbvision); usbvision_request_intra(usbvision);
return parse_state_next_frame; return parse_state_next_frame;
...@@ -594,8 +594,8 @@ static enum parse_state usbvision_parse_lines_422(struct usb_usbvision *usbvisio ...@@ -594,8 +594,8 @@ static enum parse_state usbvision_parse_lines_422(struct usb_usbvision *usbvisio
unsigned char *f; unsigned char *f;
int len; int len;
int i; int i;
unsigned char yuyv[4]={180, 128, 10, 128}; // YUV components unsigned char yuyv[4]={180, 128, 10, 128}; /* YUV components */
unsigned char rv, gv, bv; // RGB components unsigned char rv, gv, bv; /* RGB components */
int clipmask_index, bytes_per_pixel; int clipmask_index, bytes_per_pixel;
int stretch_bytes, clipmask_add; int stretch_bytes, clipmask_add;
...@@ -623,8 +623,8 @@ static enum parse_state usbvision_parse_lines_422(struct usb_usbvision *usbvisio ...@@ -623,8 +623,8 @@ static enum parse_state usbvision_parse_lines_422(struct usb_usbvision *usbvisio
scratch_get(usbvision, &yuyv[0], 4); scratch_get(usbvision, &yuyv[0], 4);
if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) { if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) {
*f++ = yuyv[0]; // Y *f++ = yuyv[0]; /* Y */
*f++ = yuyv[3]; // U *f++ = yuyv[3]; /* U */
} }
else { else {
...@@ -659,8 +659,8 @@ static enum parse_state usbvision_parse_lines_422(struct usb_usbvision *usbvisio ...@@ -659,8 +659,8 @@ static enum parse_state usbvision_parse_lines_422(struct usb_usbvision *usbvisio
f += stretch_bytes; f += stretch_bytes;
if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) { if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV) {
*f++ = yuyv[2]; // Y *f++ = yuyv[2]; /* Y */
*f++ = yuyv[1]; // V *f++ = yuyv[1]; /* V */
} }
else { else {
...@@ -717,7 +717,7 @@ static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *c ...@@ -717,7 +717,7 @@ static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *c
integrator = 0; integrator = 0;
pos = *start_pos; pos = *start_pos;
block_type_pos = *block_typestart_pos; block_type_pos = *block_typestart_pos;
max_pos = 396; //pos + len; max_pos = 396; /* pos + len; */
extra_pos = pos; extra_pos = pos;
block_len = 0; block_len = 0;
block_byte = 0; block_byte = 0;
...@@ -737,7 +737,7 @@ static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *c ...@@ -737,7 +737,7 @@ static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *c
} }
block_type = (block_type_byte & 0xC0) >> 6; block_type = (block_type_byte & 0xC0) >> 6;
//statistic: /* statistic: */
usbvision->compr_block_types[block_type]++; usbvision->compr_block_types[block_type]++;
pos = extra_pos; pos = extra_pos;
...@@ -769,7 +769,7 @@ static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *c ...@@ -769,7 +769,7 @@ static int usbvision_decompress(struct usb_usbvision *usbvision,unsigned char *c
block_byte = compressed[pos]; block_byte = compressed[pos];
pos++; pos++;
} }
if (block_type == 1) { //inter Block if (block_type == 1) { /* inter Block */
integrator = decompressed[idx]; integrator = decompressed[idx];
} }
switch (block_byte & 0xC0) { switch (block_byte & 0xC0) {
...@@ -823,14 +823,14 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision ...@@ -823,14 +823,14 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
frame = usbvision->cur_frame; frame = usbvision->cur_frame;
image_size = frame->frmwidth * frame->frmheight; image_size = frame->frmwidth * frame->frmheight;
if ( (frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P) || if ( (frame->v4l2_format.format == V4L2_PIX_FMT_YUV422P) ||
(frame->v4l2_format.format == V4L2_PIX_FMT_YVU420) ) { // this is a planar format (frame->v4l2_format.format == V4L2_PIX_FMT_YVU420) ) { /* this is a planar format */
//... v4l2_linesize not used here. /* ... v4l2_linesize not used here. */
f = frame->data + (frame->width * frame->curline); f = frame->data + (frame->width * frame->curline);
} else } else
f = frame->data + (frame->v4l2_linesize * frame->curline); f = frame->data + (frame->v4l2_linesize * frame->curline);
if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV){ //initialise u and v pointers if (frame->v4l2_format.format == V4L2_PIX_FMT_YUYV){ /* initialise u and v pointers */
// get base of u and b planes add halfoffset /* get base of u and b planes add halfoffset */
u = frame->data u = frame->data
+ image_size + image_size
...@@ -851,31 +851,31 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision ...@@ -851,31 +851,31 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
return parse_state_out; return parse_state_out;
} }
//get strip header without changing the scratch_read_ptr /* get strip header without changing the scratch_read_ptr */
scratch_set_extra_ptr(usbvision, &strip_ptr, 0); scratch_set_extra_ptr(usbvision, &strip_ptr, 0);
scratch_get_extra(usbvision, &strip_header[0], &strip_ptr, scratch_get_extra(usbvision, &strip_header[0], &strip_ptr,
USBVISION_STRIP_HEADER_LEN); USBVISION_STRIP_HEADER_LEN);
if (strip_header[0] != USBVISION_STRIP_MAGIC) { if (strip_header[0] != USBVISION_STRIP_MAGIC) {
// wrong strip magic /* wrong strip magic */
usbvision->strip_magic_errors++; usbvision->strip_magic_errors++;
return parse_state_next_frame; return parse_state_next_frame;
} }
if (frame->curline != (int)strip_header[2]) { if (frame->curline != (int)strip_header[2]) {
//line number missmatch error /* line number missmatch error */
usbvision->strip_line_number_errors++; usbvision->strip_line_number_errors++;
} }
strip_len = 2 * (unsigned int)strip_header[1]; strip_len = 2 * (unsigned int)strip_header[1];
if (strip_len > USBVISION_STRIP_LEN_MAX) { if (strip_len > USBVISION_STRIP_LEN_MAX) {
// strip overrun /* strip overrun */
// I think this never happens /* I think this never happens */
usbvision_request_intra(usbvision); usbvision_request_intra(usbvision);
} }
if (scratch_len(usbvision) < strip_len) { if (scratch_len(usbvision) < strip_len) {
//there is not enough data for the strip /* there is not enough data for the strip */
return parse_state_out; return parse_state_out;
} }
...@@ -901,7 +901,7 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision ...@@ -901,7 +901,7 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
usbvision->block_pos = block_pos; usbvision->block_pos = block_pos;
if ((rc = usbvision_decompress(usbvision, strip_data, Y, &block_pos, &block_type_pos, idx_end)) != idx_end) { if ((rc = usbvision_decompress(usbvision, strip_data, Y, &block_pos, &block_type_pos, idx_end)) != idx_end) {
//return parse_state_continue; /* return parse_state_continue; */
} }
if (strip_len > usbvision->max_strip_len) { if (strip_len > usbvision->max_strip_len) {
usbvision->max_strip_len = strip_len; usbvision->max_strip_len = strip_len;
...@@ -909,12 +909,12 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision ...@@ -909,12 +909,12 @@ static enum parse_state usbvision_parse_compress(struct usb_usbvision *usbvision
if (frame->curline%2) { if (frame->curline%2) {
if ((rc = usbvision_decompress(usbvision, strip_data, V, &block_pos, &block_type_pos, idx_end/2)) != idx_end/2) { if ((rc = usbvision_decompress(usbvision, strip_data, V, &block_pos, &block_type_pos, idx_end/2)) != idx_end/2) {
//return parse_state_continue; /* return parse_state_continue; */
} }
} }
else { else {
if ((rc = usbvision_decompress(usbvision, strip_data, U, &block_pos, &block_type_pos, idx_end/2)) != idx_end/2) { if ((rc = usbvision_decompress(usbvision, strip_data, U, &block_pos, &block_type_pos, idx_end/2)) != idx_end/2) {
//return parse_state_continue; /* return parse_state_continue; */
} }
} }
...@@ -1043,7 +1043,7 @@ static enum parse_state usbvision_parse_lines_420(struct usb_usbvision *usbvisio ...@@ -1043,7 +1043,7 @@ static enum parse_state usbvision_parse_lines_420(struct usb_usbvision *usbvisio
pixel_per_line = frame->isoc_header.frame_width; pixel_per_line = frame->isoc_header.frame_width;
if (scratch_len(usbvision) < (int)pixel_per_line * 3) { if (scratch_len(usbvision) < (int)pixel_per_line * 3) {
//printk(KERN_DEBUG "out of data, need %d\n", len); /* printk(KERN_DEBUG "out of data, need %d\n", len); */
return parse_state_out; return parse_state_out;
} }
...@@ -1051,7 +1051,7 @@ static enum parse_state usbvision_parse_lines_420(struct usb_usbvision *usbvisio ...@@ -1051,7 +1051,7 @@ static enum parse_state usbvision_parse_lines_420(struct usb_usbvision *usbvisio
return parse_state_next_frame; return parse_state_next_frame;
} }
block_split = (pixel_per_line%y_block_size) ? 1 : 0; //are some blocks splitted into different lines? block_split = (pixel_per_line%y_block_size) ? 1 : 0; /* are some blocks splitted into different lines? */
y_odd_offset = (pixel_per_line / y_block_size) * (y_block_size + uv_block_size) y_odd_offset = (pixel_per_line / y_block_size) * (y_block_size + uv_block_size)
+ block_split * uv_block_size; + block_split * uv_block_size;
...@@ -1070,7 +1070,7 @@ static enum parse_state usbvision_parse_lines_420(struct usb_usbvision *usbvisio ...@@ -1070,7 +1070,7 @@ static enum parse_state usbvision_parse_lines_420(struct usb_usbvision *usbvisio
scratch_get_extra(usbvision, &u, &u_ptr, 1); scratch_get_extra(usbvision, &u, &u_ptr, 1);
scratch_get_extra(usbvision, &v, &v_ptr, 1); scratch_get_extra(usbvision, &v, &v_ptr, 1);
//I don't use the YUV_TO_RGB macro for better performance /* I don't use the YUV_TO_RGB macro for better performance */
v_ = v - 128; v_ = v - 128;
u_ = u - 128; u_ = u - 128;
vb = 132252 * v_; vb = 132252 * v_;
...@@ -1370,7 +1370,7 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision, ...@@ -1370,7 +1370,7 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision,
packet_data = urb->transfer_buffer + urb->iso_frame_desc[i].offset; packet_data = urb->transfer_buffer + urb->iso_frame_desc[i].offset;
/* Detect and ignore errored packets */ /* Detect and ignore errored packets */
if (packet_stat) { // packet_stat != 0 ????????????? if (packet_stat) { /* packet_stat != 0 ????????????? */
PDEBUG(DBG_ISOC, "data error: [%d] len=%d, status=%X", i, packet_len, packet_stat); PDEBUG(DBG_ISOC, "data error: [%d] len=%d, status=%X", i, packet_len, packet_stat);
usbvision->isoc_err_count++; usbvision->isoc_err_count++;
continue; continue;
...@@ -1396,7 +1396,7 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision, ...@@ -1396,7 +1396,7 @@ static int usbvision_compress_isochronous(struct usb_usbvision *usbvision,
PDEBUG(DBG_ISOC, "packet ok [%d] len=%d", i, packet_len); PDEBUG(DBG_ISOC, "packet ok [%d] len=%d", i, packet_len);
if (usbvision->isocstate==isoc_state_no_frame) { //new frame begins if (usbvision->isocstate==isoc_state_no_frame) { /* new frame begins */
usbvision->isocstate=isoc_state_in_frame; usbvision->isocstate=isoc_state_in_frame;
scratch_mark_header(usbvision); scratch_mark_header(usbvision);
usbvision_measure_bandwidth(usbvision); usbvision_measure_bandwidth(usbvision);
...@@ -1488,7 +1488,7 @@ static void usbvision_isoc_irq(struct urb *urb) ...@@ -1488,7 +1488,7 @@ static void usbvision_isoc_irq(struct urb *urb)
usbvision_parse_data(usbvision); usbvision_parse_data(usbvision);
} }
else { else {
/*If we don't have a frame /* If we don't have a frame
we're current working on, complain */ we're current working on, complain */
PDEBUG(DBG_IRQ, PDEBUG(DBG_IRQ,
"received data, but no one needs it"); "received data, but no one needs it");
...@@ -1623,7 +1623,7 @@ static int usbvision_write_reg_irq(struct usb_usbvision *usbvision,int address, ...@@ -1623,7 +1623,7 @@ static int usbvision_write_reg_irq(struct usb_usbvision *usbvision,int address,
err_code = usb_submit_urb(usbvision->ctrl_urb, GFP_ATOMIC); err_code = usb_submit_urb(usbvision->ctrl_urb, GFP_ATOMIC);
if (err_code < 0) { if (err_code < 0) {
// error in usb_submit_urb() /* error in usb_submit_urb() */
usbvision->ctrl_urb_busy = 0; usbvision->ctrl_urb_busy = 0;
} }
PDEBUG(DBG_IRQ, "submit %d byte: error %d", len, err_code); PDEBUG(DBG_IRQ, "submit %d byte: error %d", len, err_code);
...@@ -1656,7 +1656,7 @@ static int usbvision_measure_bandwidth (struct usb_usbvision *usbvision) ...@@ -1656,7 +1656,7 @@ static int usbvision_measure_bandwidth (struct usb_usbvision *usbvision)
{ {
int err_code = 0; int err_code = 0;
if (usbvision->isoc_measure_bandwidth_count < 2) { // this gives an average bandwidth of 3 frames if (usbvision->isoc_measure_bandwidth_count < 2) { /* this gives an average bandwidth of 3 frames */
usbvision->isoc_measure_bandwidth_count++; usbvision->isoc_measure_bandwidth_count++;
return err_code; return err_code;
} }
...@@ -1684,24 +1684,24 @@ static int usbvision_adjust_compression (struct usb_usbvision *usbvision) ...@@ -1684,24 +1684,24 @@ static int usbvision_adjust_compression (struct usb_usbvision *usbvision)
if (usbvision->compr_level != usbvision->last_compr_level) { if (usbvision->compr_level != usbvision->last_compr_level) {
int distorsion; int distorsion;
if (usbvision->bridge_type == BRIDGE_NT1004 || usbvision->bridge_type == BRIDGE_NT1005) { if (usbvision->bridge_type == BRIDGE_NT1004 || usbvision->bridge_type == BRIDGE_NT1005) {
buffer[0] = (unsigned char)(4 + 16 * usbvision->compr_level / 100); // PCM Threshold 1 buffer[0] = (unsigned char)(4 + 16 * usbvision->compr_level / 100); /* PCM Threshold 1 */
buffer[1] = (unsigned char)(4 + 8 * usbvision->compr_level / 100); // PCM Threshold 2 buffer[1] = (unsigned char)(4 + 8 * usbvision->compr_level / 100); /* PCM Threshold 2 */
distorsion = 7 + 248 * usbvision->compr_level / 100; distorsion = 7 + 248 * usbvision->compr_level / 100;
buffer[2] = (unsigned char)(distorsion & 0xFF); // Average distorsion Threshold (inter) buffer[2] = (unsigned char)(distorsion & 0xFF); /* Average distorsion Threshold (inter) */
buffer[3] = (unsigned char)(distorsion & 0xFF); // Average distorsion Threshold (intra) buffer[3] = (unsigned char)(distorsion & 0xFF); /* Average distorsion Threshold (intra) */
distorsion = 1 + 42 * usbvision->compr_level / 100; distorsion = 1 + 42 * usbvision->compr_level / 100;
buffer[4] = (unsigned char)(distorsion & 0xFF); // Maximum distorsion Threshold (inter) buffer[4] = (unsigned char)(distorsion & 0xFF); /* Maximum distorsion Threshold (inter) */
buffer[5] = (unsigned char)(distorsion & 0xFF); // Maximum distorsion Threshold (intra) buffer[5] = (unsigned char)(distorsion & 0xFF); /* Maximum distorsion Threshold (intra) */
} }
else { //BRIDGE_NT1003 else { /* BRIDGE_NT1003 */
buffer[0] = (unsigned char)(4 + 16 * usbvision->compr_level / 100); // PCM threshold 1 buffer[0] = (unsigned char)(4 + 16 * usbvision->compr_level / 100); /* PCM threshold 1 */
buffer[1] = (unsigned char)(4 + 8 * usbvision->compr_level / 100); // PCM threshold 2 buffer[1] = (unsigned char)(4 + 8 * usbvision->compr_level / 100); /* PCM threshold 2 */
distorsion = 2 + 253 * usbvision->compr_level / 100; distorsion = 2 + 253 * usbvision->compr_level / 100;
buffer[2] = (unsigned char)(distorsion & 0xFF); // distorsion threshold bit0-7 buffer[2] = (unsigned char)(distorsion & 0xFF); /* distorsion threshold bit0-7 */
buffer[3] = 0; //(unsigned char)((distorsion >> 8) & 0x0F); // distorsion threshold bit 8-11 buffer[3] = 0; /* (unsigned char)((distorsion >> 8) & 0x0F); distorsion threshold bit 8-11 */
distorsion = 0 + 43 * usbvision->compr_level / 100; distorsion = 0 + 43 * usbvision->compr_level / 100;
buffer[4] = (unsigned char)(distorsion & 0xFF); // maximum distorsion bit0-7 buffer[4] = (unsigned char)(distorsion & 0xFF); /* maximum distorsion bit0-7 */
buffer[5] = 0; //(unsigned char)((distorsion >> 8) & 0x01); // maximum distorsion bit 8 buffer[5] = 0; /* (unsigned char)((distorsion >> 8) & 0x01); maximum distorsion bit 8 */
} }
err_code = usbvision_write_reg_irq(usbvision, USBVISION_PCM_THR1, buffer, 6); err_code = usbvision_write_reg_irq(usbvision, USBVISION_PCM_THR1, buffer, 6);
if (err_code == 0){ if (err_code == 0){
...@@ -1778,8 +1778,8 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma ...@@ -1778,8 +1778,8 @@ static int usbvision_set_video_format(struct usb_usbvision *usbvision, int forma
format); format);
format = ISOC_MODE_YUV420; format = ISOC_MODE_YUV420;
} }
value[0] = 0x0A; //TODO: See the effect of the filter value[0] = 0x0A; /* TODO: See the effect of the filter */
value[1] = format; // Sets the VO_MODE register which follows FILT_CONT value[1] = format; /* Sets the VO_MODE register which follows FILT_CONT */
rc = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), rc = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1),
USBVISION_OP_CODE, USBVISION_OP_CODE,
USB_DIR_OUT | USB_TYPE_VENDOR | USB_DIR_OUT | USB_TYPE_VENDOR |
...@@ -1840,10 +1840,10 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width, ...@@ -1840,10 +1840,10 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width,
/* I'll not rewrite the same values */ /* I'll not rewrite the same values */
if ((usb_width != usbvision->curwidth) || (usb_height != usbvision->curheight)) { if ((usb_width != usbvision->curwidth) || (usb_height != usbvision->curheight)) {
value[0] = usb_width & 0xff; //LSB value[0] = usb_width & 0xff; /* LSB */
value[1] = (usb_width >> 8) & 0x03; //MSB value[1] = (usb_width >> 8) & 0x03; /* MSB */
value[2] = usb_height & 0xff; //LSB value[2] = usb_height & 0xff; /* LSB */
value[3] = (usb_height >> 8) & 0x03; //MSB value[3] = (usb_height >> 8) & 0x03; /* MSB */
err_code = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1), err_code = usb_control_msg(usbvision->dev, usb_sndctrlpipe(usbvision->dev, 1),
USBVISION_OP_CODE, USBVISION_OP_CODE,
...@@ -1880,7 +1880,7 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width, ...@@ -1880,7 +1880,7 @@ int usbvision_set_output(struct usb_usbvision *usbvision, int width,
PDEBUG(DBG_FUNC, "frame_rate %d fps, frame_drop %d", frame_rate, frame_drop); PDEBUG(DBG_FUNC, "frame_rate %d fps, frame_drop %d", frame_rate, frame_drop);
frame_drop = FRAMERATE_MAX; // We can allow the maximum here, because dropping is controlled frame_drop = FRAMERATE_MAX; /* We can allow the maximum here, because dropping is controlled */
/* frame_drop = 7; => frame_phase = 1, 5, 9, 13, 17, 21, 25, 0, 4, 8, ... /* frame_drop = 7; => frame_phase = 1, 5, 9, 13, 17, 21, 25, 0, 4, 8, ...
=> frame_skip = 4; => frame_skip = 4;
...@@ -1903,7 +1903,7 @@ int usbvision_frames_alloc(struct usb_usbvision *usbvision, int number_of_frames ...@@ -1903,7 +1903,7 @@ int usbvision_frames_alloc(struct usb_usbvision *usbvision, int number_of_frames
{ {
int i; int i;
/*needs to be page aligned cause the buffers can be mapped individually! */ /* needs to be page aligned cause the buffers can be mapped individually! */
usbvision->max_frame_size = PAGE_ALIGN(usbvision->curwidth * usbvision->max_frame_size = PAGE_ALIGN(usbvision->curwidth *
usbvision->curheight * usbvision->curheight *
usbvision->palette.bytes_per_pixel); usbvision->palette.bytes_per_pixel);
...@@ -2002,19 +2002,19 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision) ...@@ -2002,19 +2002,19 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision)
int rc; int rc;
unsigned char value[6]; unsigned char value[6];
value[0] = 0x0F; // Intra-Compression cycle value[0] = 0x0F; /* Intra-Compression cycle */
value[1] = 0x01; // Reg.45 one line per strip value[1] = 0x01; /* Reg.45 one line per strip */
value[2] = 0x00; // Reg.46 Force intra mode on all new frames value[2] = 0x00; /* Reg.46 Force intra mode on all new frames */
value[3] = 0x00; // Reg.47 FORCE_UP <- 0 normal operation (not force) value[3] = 0x00; /* Reg.47 FORCE_UP <- 0 normal operation (not force) */
value[4] = 0xA2; // Reg.48 BUF_THR I'm not sure if this does something in not compressed mode. value[4] = 0xA2; /* Reg.48 BUF_THR I'm not sure if this does something in not compressed mode. */
value[5] = 0x00; // Reg.49 DVI_YUV This has nothing to do with compression value[5] = 0x00; /* Reg.49 DVI_YUV This has nothing to do with compression */
//catched values for NT1004 /* catched values for NT1004 */
// value[0] = 0xFF; // Never apply intra mode automatically /* value[0] = 0xFF; Never apply intra mode automatically */
// value[1] = 0xF1; // Use full frame height for virtual strip width; One line per strip /* value[1] = 0xF1; Use full frame height for virtual strip width; One line per strip */
// value[2] = 0x01; // Force intra mode on all new frames /* value[2] = 0x01; Force intra mode on all new frames */
// value[3] = 0x00; // Strip size 400 Bytes; do not force up /* value[3] = 0x00; Strip size 400 Bytes; do not force up */
// value[4] = 0xA2; // /* value[4] = 0xA2; */
if (!USBVISION_IS_OPERATIONAL(usbvision)) if (!USBVISION_IS_OPERATIONAL(usbvision))
return 0; return 0;
...@@ -2031,20 +2031,20 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision) ...@@ -2031,20 +2031,20 @@ static int usbvision_set_compress_params(struct usb_usbvision *usbvision)
} }
if (usbvision->bridge_type == BRIDGE_NT1004) { if (usbvision->bridge_type == BRIDGE_NT1004) {
value[0] = 20; // PCM Threshold 1 value[0] = 20; /* PCM Threshold 1 */
value[1] = 12; // PCM Threshold 2 value[1] = 12; /* PCM Threshold 2 */
value[2] = 255; // Distorsion Threshold inter value[2] = 255; /* Distorsion Threshold inter */
value[3] = 255; // Distorsion Threshold intra value[3] = 255; /* Distorsion Threshold intra */
value[4] = 43; // Max Distorsion inter value[4] = 43; /* Max Distorsion inter */
value[5] = 43; // Max Distorsion intra value[5] = 43; /* Max Distorsion intra */
} }
else { else {
value[0] = 20; // PCM Threshold 1 value[0] = 20; /* PCM Threshold 1 */
value[1] = 12; // PCM Threshold 2 value[1] = 12; /* PCM Threshold 2 */
value[2] = 255; // Distorsion Threshold d7-d0 value[2] = 255; /* Distorsion Threshold d7-d0 */
value[3] = 0; // Distorsion Threshold d11-d8 value[3] = 0; /* Distorsion Threshold d11-d8 */
value[4] = 43; // Max Distorsion d7-d0 value[4] = 43; /* Max Distorsion d7-d0 */
value[5] = 0; // Max Distorsion d8 value[5] = 0; /* Max Distorsion d8 */
} }
if (!USBVISION_IS_OPERATIONAL(usbvision)) if (!USBVISION_IS_OPERATIONAL(usbvision))
...@@ -2107,31 +2107,31 @@ int usbvision_set_input(struct usb_usbvision *usbvision) ...@@ -2107,31 +2107,31 @@ int usbvision_set_input(struct usb_usbvision *usbvision)
if (usbvision->tvnorm_id & V4L2_STD_PAL) { if (usbvision->tvnorm_id & V4L2_STD_PAL) {
value[0] = 0xC0; value[0] = 0xC0;
value[1] = 0x02; //0x02C0 -> 704 Input video line length value[1] = 0x02; /* 0x02C0 -> 704 Input video line length */
value[2] = 0x20; value[2] = 0x20;
value[3] = 0x01; //0x0120 -> 288 Input video n. of lines value[3] = 0x01; /* 0x0120 -> 288 Input video n. of lines */
value[4] = 0x60; value[4] = 0x60;
value[5] = 0x00; //0x0060 -> 96 Input video h offset value[5] = 0x00; /* 0x0060 -> 96 Input video h offset */
value[6] = 0x16; value[6] = 0x16;
value[7] = 0x00; //0x0016 -> 22 Input video v offset value[7] = 0x00; /* 0x0016 -> 22 Input video v offset */
} else if (usbvision->tvnorm_id & V4L2_STD_SECAM) { } else if (usbvision->tvnorm_id & V4L2_STD_SECAM) {
value[0] = 0xC0; value[0] = 0xC0;
value[1] = 0x02; //0x02C0 -> 704 Input video line length value[1] = 0x02; /* 0x02C0 -> 704 Input video line length */
value[2] = 0x20; value[2] = 0x20;
value[3] = 0x01; //0x0120 -> 288 Input video n. of lines value[3] = 0x01; /* 0x0120 -> 288 Input video n. of lines */
value[4] = 0x01; value[4] = 0x01;
value[5] = 0x00; //0x0001 -> 01 Input video h offset value[5] = 0x00; /* 0x0001 -> 01 Input video h offset */
value[6] = 0x01; value[6] = 0x01;
value[7] = 0x00; //0x0001 -> 01 Input video v offset value[7] = 0x00; /* 0x0001 -> 01 Input video v offset */
} else { /* V4L2_STD_NTSC */ } else { /* V4L2_STD_NTSC */
value[0] = 0xD0; value[0] = 0xD0;
value[1] = 0x02; //0x02D0 -> 720 Input video line length value[1] = 0x02; /* 0x02D0 -> 720 Input video line length */
value[2] = 0xF0; value[2] = 0xF0;
value[3] = 0x00; //0x00F0 -> 240 Input video number of lines value[3] = 0x00; /* 0x00F0 -> 240 Input video number of lines */
value[4] = 0x50; value[4] = 0x50;
value[5] = 0x00; //0x0050 -> 80 Input video h offset value[5] = 0x00; /* 0x0050 -> 80 Input video h offset */
value[6] = 0x10; value[6] = 0x10;
value[7] = 0x00; //0x0010 -> 16 Input video v offset value[7] = 0x00; /* 0x0010 -> 16 Input video v offset */
} }
if (usbvision_device_data[usbvision->dev_model].x_offset >= 0) { if (usbvision_device_data[usbvision->dev_model].x_offset >= 0) {
...@@ -2201,9 +2201,9 @@ static int usbvision_set_dram_settings(struct usb_usbvision *usbvision) ...@@ -2201,9 +2201,9 @@ static int usbvision_set_dram_settings(struct usb_usbvision *usbvision)
value[5] = 0xe0; value[5] = 0xe0;
value[6] = 0x71; value[6] = 0x71;
value[7] = 0xff; value[7] = 0xff;
// UR: 0x0E200-0x3FFFF = 204288 Words (1 Word = 2 Byte) /* UR: 0x0E200-0x3FFFF = 204288 Words (1 Word = 2 Byte) */
// FDL: 0x00000-0x0E099 = 57498 Words /* FDL: 0x00000-0x0E099 = 57498 Words */
// VDW: 0x0E3FF-0x3FFFF /* VDW: 0x0E3FF-0x3FFFF */
} }
else { else {
value[0] = 0x42; value[0] = 0x42;
...@@ -2285,7 +2285,7 @@ int usbvision_power_on(struct usb_usbvision *usbvision) ...@@ -2285,7 +2285,7 @@ int usbvision_power_on(struct usb_usbvision *usbvision)
* usbvision timer stuff * usbvision timer stuff
*/ */
// to call usbvision_power_off from task queue /* to call usbvision_power_off from task queue */
static void call_usbvision_power_off(struct work_struct *work) static void call_usbvision_power_off(struct work_struct *work)
{ {
struct usb_usbvision *usbvision = container_of(work, struct usb_usbvision, power_off_work); struct usb_usbvision *usbvision = container_of(work, struct usb_usbvision, power_off_work);
...@@ -2592,17 +2592,17 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel) ...@@ -2592,17 +2592,17 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel)
/* inputs #1 and #2 are variable for SAA7111 and SAA7113 */ /* inputs #1 and #2 are variable for SAA7111 and SAA7113 */
int mode[4]= {SAA7115_COMPOSITE0, 0, 0, SAA7115_COMPOSITE3}; int mode[4]= {SAA7115_COMPOSITE0, 0, 0, SAA7115_COMPOSITE3};
int audio[]= {1, 0, 0, 0}; int audio[]= {1, 0, 0, 0};
//channel 0 is TV with audiochannel 1 (tuner mono) /* channel 0 is TV with audiochannel 1 (tuner mono) */
//channel 1 is Composite with audio channel 0 (line in) /* channel 1 is Composite with audio channel 0 (line in) */
//channel 2 is S-Video with audio channel 0 (line in) /* channel 2 is S-Video with audio channel 0 (line in) */
//channel 3 is additional video inputs to the device with audio channel 0 (line in) /* channel 3 is additional video inputs to the device with audio channel 0 (line in) */
RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs); RESTRICT_TO_RANGE(channel, 0, usbvision->video_inputs);
usbvision->ctl_input = channel; usbvision->ctl_input = channel;
// set the new channel /* set the new channel */
// Regular USB TV Tuners -> channel: 0 = Television, 1 = Composite, 2 = S-Video /* Regular USB TV Tuners -> channel: 0 = Television, 1 = Composite, 2 = S-Video */
// Four video input devices -> channel: 0 = Chan White, 1 = Chan Green, 2 = Chan Yellow, 3 = Chan Red /* Four video input devices -> channel: 0 = Chan White, 1 = Chan Green, 2 = Chan Yellow, 3 = Chan Red */
switch (usbvision_device_data[usbvision->dev_model].codec) { switch (usbvision_device_data[usbvision->dev_model].codec) {
case CODEC_SAA7113: case CODEC_SAA7113:
......
...@@ -39,7 +39,7 @@ ...@@ -39,7 +39,7 @@
static int i2c_debug; static int i2c_debug;
module_param (i2c_debug, int, 0644); // debug_i2c_usb mode of the device driver module_param (i2c_debug, int, 0644); /* debug_i2c_usb mode of the device driver */
MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
#define PDEBUG(level, fmt, args...) { \ #define PDEBUG(level, fmt, args...) { \
......
...@@ -103,7 +103,7 @@ USBVISION_DRIVER_VERSION_PATCHLEVEL) ...@@ -103,7 +103,7 @@ USBVISION_DRIVER_VERSION_PATCHLEVEL)
#define DBG_PROBE 1<<2 #define DBG_PROBE 1<<2
#define DBG_MMAP 1<<3 #define DBG_MMAP 1<<3
//String operations /* String operations */
#define rmspace(str) while(*str==' ') str++; #define rmspace(str) while(*str==' ') str++;
#define goto2next(str) while(*str!=' ') str++; while(*str==' ') str++; #define goto2next(str) while(*str!=' ') str++; while(*str==' ') str++;
...@@ -118,7 +118,7 @@ static struct usbvision_v4l2_format_st usbvision_v4l2_format[] = { ...@@ -118,7 +118,7 @@ static struct usbvision_v4l2_format_st usbvision_v4l2_format[] = {
{ 1, 4, 32, V4L2_PIX_FMT_RGB32 , "RGB32" }, { 1, 4, 32, V4L2_PIX_FMT_RGB32 , "RGB32" },
{ 1, 2, 16, V4L2_PIX_FMT_RGB555 , "RGB555" }, { 1, 2, 16, V4L2_PIX_FMT_RGB555 , "RGB555" },
{ 1, 2, 16, V4L2_PIX_FMT_YUYV , "YUV422" }, { 1, 2, 16, V4L2_PIX_FMT_YUYV , "YUV422" },
{ 1, 2, 12, V4L2_PIX_FMT_YVU420 , "YUV420P" }, // 1.5 ! { 1, 2, 12, V4L2_PIX_FMT_YVU420 , "YUV420P" }, /* 1.5 ! */
{ 1, 2, 16, V4L2_PIX_FMT_YUV422P , "YUV422P" } { 1, 2, 16, V4L2_PIX_FMT_YUV422P , "YUV422P" }
}; };
...@@ -153,7 +153,7 @@ MODULE_PARM_DESC(video_nr, "Set video device number (/dev/videoX). Default: -1 ...@@ -153,7 +153,7 @@ MODULE_PARM_DESC(video_nr, "Set video device number (/dev/videoX). Default: -1
MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)"); MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)");
// Misc stuff /* Misc stuff */
MODULE_AUTHOR(DRIVER_AUTHOR); MODULE_AUTHOR(DRIVER_AUTHOR);
MODULE_DESCRIPTION(DRIVER_DESC); MODULE_DESCRIPTION(DRIVER_DESC);
MODULE_LICENSE(DRIVER_LICENSE); MODULE_LICENSE(DRIVER_LICENSE);
...@@ -534,7 +534,7 @@ static int vidioc_enum_input (struct file *file, void *priv, ...@@ -534,7 +534,7 @@ static int vidioc_enum_input (struct file *file, void *priv,
if (usbvision->have_tuner) { if (usbvision->have_tuner) {
chan = vi->index; chan = vi->index;
} else { } else {
chan = vi->index + 1; /*skip Television string*/ chan = vi->index + 1; /* skip Television string*/
} }
/* Determine the requested input characteristics /* Determine the requested input characteristics
specific for each usbvision card model */ specific for each usbvision card model */
...@@ -618,7 +618,7 @@ static int vidioc_g_tuner (struct file *file, void *priv, ...@@ -618,7 +618,7 @@ static int vidioc_g_tuner (struct file *file, void *priv,
{ {
struct usb_usbvision *usbvision = video_drvdata(file); struct usb_usbvision *usbvision = video_drvdata(file);
if (!usbvision->have_tuner || vt->index) // Only tuner 0 if (!usbvision->have_tuner || vt->index) /* Only tuner 0 */
return -EINVAL; return -EINVAL;
if(usbvision->radio) { if(usbvision->radio) {
strcpy(vt->name, "Radio"); strcpy(vt->name, "Radio");
...@@ -637,7 +637,7 @@ static int vidioc_s_tuner (struct file *file, void *priv, ...@@ -637,7 +637,7 @@ static int vidioc_s_tuner (struct file *file, void *priv,
{ {
struct usb_usbvision *usbvision = video_drvdata(file); struct usb_usbvision *usbvision = video_drvdata(file);
// Only no or one tuner for now /* Only no or one tuner for now */
if (!usbvision->have_tuner || vt->index) if (!usbvision->have_tuner || vt->index)
return -EINVAL; return -EINVAL;
/* let clients handle this */ /* let clients handle this */
...@@ -651,7 +651,7 @@ static int vidioc_g_frequency (struct file *file, void *priv, ...@@ -651,7 +651,7 @@ static int vidioc_g_frequency (struct file *file, void *priv,
{ {
struct usb_usbvision *usbvision = video_drvdata(file); struct usb_usbvision *usbvision = video_drvdata(file);
freq->tuner = 0; // Only one tuner freq->tuner = 0; /* Only one tuner */
if(usbvision->radio) { if(usbvision->radio) {
freq->type = V4L2_TUNER_RADIO; freq->type = V4L2_TUNER_RADIO;
} else { } else {
...@@ -667,7 +667,7 @@ static int vidioc_s_frequency (struct file *file, void *priv, ...@@ -667,7 +667,7 @@ static int vidioc_s_frequency (struct file *file, void *priv,
{ {
struct usb_usbvision *usbvision = video_drvdata(file); struct usb_usbvision *usbvision = video_drvdata(file);
// Only no or one tuner for now /* Only no or one tuner for now */
if (!usbvision->have_tuner || freq->tuner) if (!usbvision->have_tuner || freq->tuner)
return -EINVAL; return -EINVAL;
...@@ -1069,7 +1069,7 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf, ...@@ -1069,7 +1069,7 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf,
(unsigned long)count, frame->bytes_read); (unsigned long)count, frame->bytes_read);
/* For now, forget the frame if it has not been read in one shot. */ /* For now, forget the frame if it has not been read in one shot. */
/* if (frame->bytes_read >= frame->scanlength) {// All data has been read */ /* if (frame->bytes_read >= frame->scanlength) {*/ /* All data has been read */
frame->bytes_read = 0; frame->bytes_read = 0;
/* Mark it as available to be used again. */ /* Mark it as available to be used again. */
...@@ -1163,7 +1163,7 @@ static int usbvision_radio_open(struct file *file) ...@@ -1163,7 +1163,7 @@ static int usbvision_radio_open(struct file *file)
goto out; goto out;
} }
// If so far no errors then we shall start the radio /* If so far no errors then we shall start the radio */
usbvision->radio = 1; usbvision->radio = 1;
call_all(usbvision, tuner, s_radio); call_all(usbvision, tuner, s_radio);
usbvision_set_audio(usbvision, USBVISION_AUDIO_RADIO); usbvision_set_audio(usbvision, USBVISION_AUDIO_RADIO);
...@@ -1212,11 +1212,9 @@ static int usbvision_radio_close(struct file *file) ...@@ -1212,11 +1212,9 @@ static int usbvision_radio_close(struct file *file)
return err_code; return err_code;
} }
// /* Video registration stuff */
// Video registration stuff
//
// Video template /* Video template */
static const struct v4l2_file_operations usbvision_fops = { static const struct v4l2_file_operations usbvision_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = usbvision_v4l2_open, .open = usbvision_v4l2_open,
...@@ -1268,7 +1266,7 @@ static struct video_device usbvision_video_template = { ...@@ -1268,7 +1266,7 @@ static struct video_device usbvision_video_template = {
}; };
// Radio template /* Radio template */
static const struct v4l2_file_operations usbvision_radio_fops = { static const struct v4l2_file_operations usbvision_radio_fops = {
.owner = THIS_MODULE, .owner = THIS_MODULE,
.open = usbvision_radio_open, .open = usbvision_radio_open,
...@@ -1328,10 +1326,10 @@ static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision, ...@@ -1328,10 +1326,10 @@ static struct video_device *usbvision_vdev_init(struct usb_usbvision *usbvision,
return vdev; return vdev;
} }
// unregister video4linux devices /* unregister video4linux devices */
static void usbvision_unregister_video(struct usb_usbvision *usbvision) static void usbvision_unregister_video(struct usb_usbvision *usbvision)
{ {
// Radio Device: /* Radio Device: */
if (usbvision->rdev) { if (usbvision->rdev) {
PDEBUG(DBG_PROBE, "unregister %s [v4l2]", PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
video_device_node_name(usbvision->rdev)); video_device_node_name(usbvision->rdev));
...@@ -1343,7 +1341,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) ...@@ -1343,7 +1341,7 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
usbvision->rdev = NULL; usbvision->rdev = NULL;
} }
// Video Device: /* Video Device: */
if (usbvision->vdev) { if (usbvision->vdev) {
PDEBUG(DBG_PROBE, "unregister %s [v4l2]", PDEBUG(DBG_PROBE, "unregister %s [v4l2]",
video_device_node_name(usbvision->vdev)); video_device_node_name(usbvision->vdev));
...@@ -1356,10 +1354,10 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision) ...@@ -1356,10 +1354,10 @@ static void usbvision_unregister_video(struct usb_usbvision *usbvision)
} }
} }
// register video4linux devices /* register video4linux devices */
static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) static int __devinit usbvision_register_video(struct usb_usbvision *usbvision)
{ {
// Video Device: /* Video Device: */
usbvision->vdev = usbvision_vdev_init(usbvision, usbvision->vdev = usbvision_vdev_init(usbvision,
&usbvision_video_template, &usbvision_video_template,
"USBVision Video"); "USBVision Video");
...@@ -1374,9 +1372,9 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) ...@@ -1374,9 +1372,9 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision)
printk(KERN_INFO "USBVision[%d]: registered USBVision Video device %s [v4l2]\n", printk(KERN_INFO "USBVision[%d]: registered USBVision Video device %s [v4l2]\n",
usbvision->nr, video_device_node_name(usbvision->vdev)); usbvision->nr, video_device_node_name(usbvision->vdev));
// Radio Device: /* Radio Device: */
if (usbvision_device_data[usbvision->dev_model].radio) { if (usbvision_device_data[usbvision->dev_model].radio) {
// usbvision has radio /* usbvision has radio */
usbvision->rdev = usbvision_vdev_init(usbvision, usbvision->rdev = usbvision_vdev_init(usbvision,
&usbvision_radio_template, &usbvision_radio_template,
"USBVision Radio"); "USBVision Radio");
...@@ -1391,7 +1389,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision) ...@@ -1391,7 +1389,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision)
printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device %s [v4l2]\n", printk(KERN_INFO "USBVision[%d]: registered USBVision Radio device %s [v4l2]\n",
usbvision->nr, video_device_node_name(usbvision->rdev)); usbvision->nr, video_device_node_name(usbvision->rdev));
} }
// all done /* all done */
return 0; return 0;
err_exit: err_exit:
...@@ -1426,7 +1424,7 @@ static struct usb_usbvision *usbvision_alloc(struct usb_device *dev, ...@@ -1426,7 +1424,7 @@ static struct usb_usbvision *usbvision_alloc(struct usb_device *dev,
mutex_init(&usbvision->v4l2_lock); mutex_init(&usbvision->v4l2_lock);
// prepare control urb for control messages during interrupts /* prepare control urb for control messages during interrupts */
usbvision->ctrl_urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL); usbvision->ctrl_urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
if (usbvision->ctrl_urb == NULL) if (usbvision->ctrl_urb == NULL)
goto err_unreg; goto err_unreg;
...@@ -1482,7 +1480,7 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision) ...@@ -1482,7 +1480,7 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision)
return; return;
model = usbvision->dev_model; model = usbvision->dev_model;
usbvision->palette = usbvision_v4l2_format[2]; // V4L2_PIX_FMT_RGB24; usbvision->palette = usbvision_v4l2_format[2]; /* V4L2_PIX_FMT_RGB24; */
if (usbvision_device_data[usbvision->dev_model].vin_reg2_override) { if (usbvision_device_data[usbvision->dev_model].vin_reg2_override) {
usbvision->vin_reg2_preset = usbvision->vin_reg2_preset =
...@@ -1639,7 +1637,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf) ...@@ -1639,7 +1637,7 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf)
mutex_lock(&usbvision->v4l2_lock); mutex_lock(&usbvision->v4l2_lock);
// At this time we ask to cancel outstanding URBs /* At this time we ask to cancel outstanding URBs */
usbvision_stop_isoc(usbvision); usbvision_stop_isoc(usbvision);
v4l2_device_disconnect(&usbvision->v4l2_dev); v4l2_device_disconnect(&usbvision->v4l2_dev);
...@@ -1648,10 +1646,10 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf) ...@@ -1648,10 +1646,10 @@ static void __devexit usbvision_disconnect(struct usb_interface *intf)
usbvision_i2c_unregister(usbvision); usbvision_i2c_unregister(usbvision);
usbvision_power_off(usbvision); usbvision_power_off(usbvision);
} }
usbvision->remove_pending = 1; // Now all ISO data will be ignored usbvision->remove_pending = 1; /* Now all ISO data will be ignored */
usb_put_dev(usbvision->dev); usb_put_dev(usbvision->dev);
usbvision->dev = NULL; // USB device is no more usbvision->dev = NULL; /* USB device is no more */
mutex_unlock(&usbvision->v4l2_lock); mutex_unlock(&usbvision->v4l2_lock);
...@@ -1692,9 +1690,9 @@ static int __init usbvision_init(void) ...@@ -1692,9 +1690,9 @@ static int __init usbvision_init(void)
/* disable planar mode support unless compression enabled */ /* disable planar mode support unless compression enabled */
if (isoc_mode != ISOC_MODE_COMPRESS ) { if (isoc_mode != ISOC_MODE_COMPRESS ) {
// FIXME : not the right way to set supported flag /* FIXME : not the right way to set supported flag */
usbvision_v4l2_format[6].supported = 0; // V4L2_PIX_FMT_YVU420 usbvision_v4l2_format[6].supported = 0; /* V4L2_PIX_FMT_YVU420 */
usbvision_v4l2_format[7].supported = 0; // V4L2_PIX_FMT_YUV422P usbvision_v4l2_format[7].supported = 0; /* V4L2_PIX_FMT_YUV422P */
} }
err_code = usb_register(&usbvision_driver); err_code = usb_register(&usbvision_driver);
......
...@@ -132,15 +132,15 @@ ...@@ -132,15 +132,15 @@
#define MAX_BYTES_PER_PIXEL 4 #define MAX_BYTES_PER_PIXEL 4
#define MIN_FRAME_WIDTH 64 #define MIN_FRAME_WIDTH 64
#define MAX_USB_WIDTH 320 //384 #define MAX_USB_WIDTH 320 /* 384 */
#define MAX_FRAME_WIDTH 320 //384 /*streching sometimes causes crashes*/ #define MAX_FRAME_WIDTH 320 /* 384 */ /* streching sometimes causes crashes*/
#define MIN_FRAME_HEIGHT 48 #define MIN_FRAME_HEIGHT 48
#define MAX_USB_HEIGHT 240 //288 #define MAX_USB_HEIGHT 240 /* 288 */
#define MAX_FRAME_HEIGHT 240 //288 /*Streching sometimes causes crashes*/ #define MAX_FRAME_HEIGHT 240 /* 288 */ /* Streching sometimes causes crashes*/
#define MAX_FRAME_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * MAX_BYTES_PER_PIXEL) #define MAX_FRAME_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT * MAX_BYTES_PER_PIXEL)
#define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) //bytesize of clipmask #define USBVISION_CLIPMASK_SIZE (MAX_FRAME_WIDTH * MAX_FRAME_HEIGHT / 8) /* bytesize of clipmask */
#define USBVISION_URB_FRAMES 32 #define USBVISION_URB_FRAMES 32
...@@ -148,7 +148,7 @@ ...@@ -148,7 +148,7 @@
#define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */ #define USBVISION_NUMFRAMES 3 /* Maximum number of frames an application can get */
#define USBVISION_NUMSBUF 2 /* Dimensioning the USB S buffering */ #define USBVISION_NUMSBUF 2 /* Dimensioning the USB S buffering */
#define USBVISION_POWEROFF_TIME 3 * (HZ) // 3 seconds #define USBVISION_POWEROFF_TIME 3 * (HZ) /* 3 seconds */
#define FRAMERATE_MIN 0 #define FRAMERATE_MIN 0
...@@ -322,7 +322,7 @@ struct usbvision_frame { ...@@ -322,7 +322,7 @@ struct usbvision_frame {
struct usbvision_v4l2_format_st v4l2_format; /* format the user needs*/ struct usbvision_v4l2_format_st v4l2_format; /* format the user needs*/
int v4l2_linesize; /* bytes for one videoline*/ int v4l2_linesize; /* bytes for one videoline*/
struct timeval timestamp; struct timeval timestamp;
int sequence; // How many video frames we send to user int sequence; /* How many video frames we send to user */
}; };
#define CODEC_SAA7113 7113 #define CODEC_SAA7113 7113
...@@ -369,19 +369,19 @@ struct usb_usbvision { ...@@ -369,19 +369,19 @@ struct usb_usbvision {
unsigned char ctrl_urb_buffer[8]; unsigned char ctrl_urb_buffer[8];
int ctrl_urb_busy; int ctrl_urb_busy;
struct usb_ctrlrequest ctrl_urb_setup; struct usb_ctrlrequest ctrl_urb_setup;
wait_queue_head_t ctrl_urb_wq; // Processes waiting wait_queue_head_t ctrl_urb_wq; /* Processes waiting */
/* configuration part */ /* configuration part */
int have_tuner; int have_tuner;
int tuner_type; int tuner_type;
int bridge_type; // NT1003, NT1004, NT1005 int bridge_type; /* NT1003, NT1004, NT1005 */
int radio; int radio;
int video_inputs; // # of inputs int video_inputs; /* # of inputs */
unsigned long freq; unsigned long freq;
int audio_mute; int audio_mute;
int audio_channel; int audio_channel;
int isoc_mode; // format of video data for the usb isoc-transfer int isoc_mode; /* format of video data for the usb isoc-transfer */
unsigned int nr; // Number of the device unsigned int nr; /* Number of the device */
/* Device structure */ /* Device structure */
struct usb_device *dev; struct usb_device *dev;
...@@ -411,10 +411,10 @@ struct usb_usbvision { ...@@ -411,10 +411,10 @@ struct usb_usbvision {
struct list_head inqueue, outqueue; /* queued frame list and ready to dequeue frame list */ struct list_head inqueue, outqueue; /* queued frame list and ready to dequeue frame list */
wait_queue_head_t wait_frame; /* Processes waiting */ wait_queue_head_t wait_frame; /* Processes waiting */
wait_queue_head_t wait_stream; /* Processes waiting */ wait_queue_head_t wait_stream; /* Processes waiting */
struct usbvision_frame *cur_frame; // pointer to current frame, set by usbvision_find_header struct usbvision_frame *cur_frame; /* pointer to current frame, set by usbvision_find_header */
struct usbvision_frame frame[USBVISION_NUMFRAMES]; // frame buffer struct usbvision_frame frame[USBVISION_NUMFRAMES]; /* frame buffer */
int num_frames; // number of frames allocated int num_frames; /* number of frames allocated */
struct usbvision_sbuf sbuf[USBVISION_NUMSBUF]; // S buffering struct usbvision_sbuf sbuf[USBVISION_NUMSBUF]; /* S buffering */
volatile int remove_pending; /* If set then about to exit */ volatile int remove_pending; /* If set then about to exit */
/* Scratch space from the Isochronous Pipe.*/ /* Scratch space from the Isochronous Pipe.*/
...@@ -432,32 +432,32 @@ struct usb_usbvision { ...@@ -432,32 +432,32 @@ struct usb_usbvision {
v4l2_std_id tvnorm_id; /* selected tv norm */ v4l2_std_id tvnorm_id; /* selected tv norm */
unsigned char video_endp; /* 0x82 for USBVISION devices based */ unsigned char video_endp; /* 0x82 for USBVISION devices based */
// Decompression stuff: /* Decompression stuff: */
unsigned char *intra_frame_buffer; /* Buffer for reference frame */ unsigned char *intra_frame_buffer; /* Buffer for reference frame */
int block_pos; //for test only int block_pos; /* for test only */
int request_intra; // 0 = normal; 1 = intra frame is requested; int request_intra; /* 0 = normal; 1 = intra frame is requested; */
int last_isoc_frame_num; // check for lost isoc frames int last_isoc_frame_num; /* check for lost isoc frames */
int isoc_packet_size; // need to calculate used_bandwidth int isoc_packet_size; /* need to calculate used_bandwidth */
int used_bandwidth; // used bandwidth 0-100%, need to set compr_level int used_bandwidth; /* used bandwidth 0-100%, need to set compr_level */
int compr_level; // How strong (100) or weak (0) is compression int compr_level; /* How strong (100) or weak (0) is compression */
int last_compr_level; // How strong (100) or weak (0) was compression int last_compr_level; /* How strong (100) or weak (0) was compression */
int usb_bandwidth; /* Mbit/s */ int usb_bandwidth; /* Mbit/s */
/* Statistics that can be overlayed on the screen */ /* Statistics that can be overlayed on the screen */
unsigned long isoc_urb_count; // How many URBs we received so far unsigned long isoc_urb_count; /* How many URBs we received so far */
unsigned long urb_length; /* Length of last URB */ unsigned long urb_length; /* Length of last URB */
unsigned long isoc_data_count; /* How many bytes we received */ unsigned long isoc_data_count; /* How many bytes we received */
unsigned long header_count; /* How many frame headers we found */ unsigned long header_count; /* How many frame headers we found */
unsigned long scratch_ovf_count; /* How many times we overflowed scratch */ unsigned long scratch_ovf_count; /* How many times we overflowed scratch */
unsigned long isoc_skip_count; /* How many empty ISO packets received */ unsigned long isoc_skip_count; /* How many empty ISO packets received */
unsigned long isoc_err_count; /* How many bad ISO packets received */ unsigned long isoc_err_count; /* How many bad ISO packets received */
unsigned long isoc_packet_count; // How many packets we totally got unsigned long isoc_packet_count; /* How many packets we totally got */
unsigned long time_in_irq; // How long do we need for interrupt unsigned long time_in_irq; /* How long do we need for interrupt */
int isoc_measure_bandwidth_count; int isoc_measure_bandwidth_count;
int frame_num; // How many video frames we send to user int frame_num; /* How many video frames we send to user */
int max_strip_len; // How big is the biggest strip int max_strip_len; /* How big is the biggest strip */
int comprblock_pos; int comprblock_pos;
int strip_len_errors; // How many times was block_pos greater than strip_len int strip_len_errors; /* How many times was block_pos greater than strip_len */
int strip_magic_errors; int strip_magic_errors;
int strip_line_number_errors; int strip_line_number_errors;
int compr_block_types[4]; int compr_block_types[4];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment