[media] usbvision: get rid of camelCase

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
This commit is contained in:
Hans Verkuil 2010-12-19 20:21:36 -03:00 committed by Mauro Carvalho Chehab
parent c627b9d1f5
commit 5490a7cbe6
5 changed files with 1570 additions and 1570 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -244,7 +244,7 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision)
PDEBUG(DBG_I2C, "i2c bus for %s registered", usbvision->i2c_adap.name);
/* Request the load of the i2c modules we need */
switch (usbvision_device_data[usbvision->DevModel].Codec) {
switch (usbvision_device_data[usbvision->dev_model].codec) {
case CODEC_SAA7113:
case CODEC_SAA7111:
/* Without this delay the detection of the saa711x is
@ -255,7 +255,7 @@ int usbvision_i2c_register(struct usb_usbvision *usbvision)
"saa7115_auto", 0, saa711x_addrs);
break;
}
if (usbvision_device_data[usbvision->DevModel].Tuner == 1) {
if (usbvision_device_data[usbvision->dev_model].tuner == 1) {
struct v4l2_subdev *sd;
enum v4l2_i2c_tuner_type type;
struct tuner_setup tun_setup;
@ -426,18 +426,18 @@ static int usbvision_i2c_write_max4(struct usb_usbvision *usbvision,
static int usbvision_i2c_write(struct usb_usbvision *usbvision, unsigned char addr, char *buf,
short len)
{
char *bufPtr = buf;
char *buf_ptr = buf;
int retval;
int wrcount = 0;
int count;
int maxLen = 4;
int max_len = 4;
while (len > 0) {
count = (len > maxLen) ? maxLen : len;
retval = usbvision_i2c_write_max4(usbvision, addr, bufPtr, count);
count = (len > max_len) ? max_len : len;
retval = usbvision_i2c_write_max4(usbvision, addr, buf_ptr, count);
if (retval > 0) {
len -= count;
bufPtr += count;
buf_ptr += count;
wrcount += count;
} else
return (retval < 0) ? retval : -EFAULT;

View File

@ -127,11 +127,11 @@ static void usbvision_release(struct usb_usbvision *usbvision);
/* Default initialization of device driver parameters */
/* Set the default format for ISOC endpoint */
static int isocMode = ISOC_MODE_COMPRESS;
static int isoc_mode = ISOC_MODE_COMPRESS;
/* Set the default Debug Mode of the device driver */
static int video_debug;
/* Set the default device to power on at startup */
static int PowerOnAtOpen = 1;
static int power_on_at_open = 1;
/* Sequential Number of Video Device */
static int video_nr = -1;
/* Sequential Number of Radio Device */
@ -140,15 +140,15 @@ static int radio_nr = -1;
/* Grab parameters for the device driver */
/* Showing parameters under SYSFS */
module_param(isocMode, int, 0444);
module_param(isoc_mode, int, 0444);
module_param(video_debug, int, 0444);
module_param(PowerOnAtOpen, int, 0444);
module_param(power_on_at_open, int, 0444);
module_param(video_nr, int, 0444);
module_param(radio_nr, int, 0444);
MODULE_PARM_DESC(isocMode, " Set the default format for ISOC endpoint. Default: 0x60 (Compression On)");
MODULE_PARM_DESC(isoc_mode, " Set the default format for ISOC endpoint. Default: 0x60 (Compression On)");
MODULE_PARM_DESC(video_debug, " Set the default Debug Mode of the device driver. Default: 0 (Off)");
MODULE_PARM_DESC(PowerOnAtOpen, " Set the default device to power on when device is opened. Default: 1 (On)");
MODULE_PARM_DESC(power_on_at_open, " Set the default device to power on when device is opened. Default: 1 (On)");
MODULE_PARM_DESC(video_nr, "Set video device number (/dev/videoX). Default: -1 (autodetect)");
MODULE_PARM_DESC(radio_nr, "Set radio device number (/dev/radioX). Default: -1 (autodetect)");
@ -192,7 +192,7 @@ static ssize_t show_model(struct device *cd,
container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%s\n",
usbvision_device_data[usbvision->DevModel].ModelString);
usbvision_device_data[usbvision->dev_model].model_string);
}
static DEVICE_ATTR(model, S_IRUGO, show_model, NULL);
@ -263,7 +263,7 @@ static ssize_t show_streaming(struct device *cd,
container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%s\n",
YES_NO(usbvision->streaming==Stream_On?1:0));
YES_NO(usbvision->streaming==stream_on?1:0));
}
static DEVICE_ATTR(streaming, S_IRUGO, show_streaming, NULL);
@ -274,7 +274,7 @@ static ssize_t show_compression(struct device *cd,
container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%s\n",
YES_NO(usbvision->isocMode==ISOC_MODE_COMPRESS));
YES_NO(usbvision->isoc_mode==ISOC_MODE_COMPRESS));
}
static DEVICE_ATTR(compression, S_IRUGO, show_compression, NULL);
@ -284,7 +284,7 @@ static ssize_t show_device_bridge(struct device *cd,
struct video_device *vdev =
container_of(cd, struct video_device, dev);
struct usb_usbvision *usbvision = video_get_drvdata(vdev);
return sprintf(buf, "%d\n", usbvision->bridgeType);
return sprintf(buf, "%d\n", usbvision->bridge_type);
}
static DEVICE_ATTR(bridge, S_IRUGO, show_device_bridge, NULL);
@ -352,23 +352,23 @@ static void usbvision_remove_sysfs(struct video_device *vdev)
static int usbvision_v4l2_open(struct file *file)
{
struct usb_usbvision *usbvision = video_drvdata(file);
int errCode = 0;
int err_code = 0;
PDEBUG(DBG_IO, "open");
usbvision_reset_powerOffTimer(usbvision);
usbvision_reset_power_off_timer(usbvision);
if (usbvision->user)
errCode = -EBUSY;
err_code = -EBUSY;
else {
/* Allocate memory for the scratch ring buffer */
errCode = usbvision_scratch_alloc(usbvision);
if (isocMode==ISOC_MODE_COMPRESS) {
err_code = usbvision_scratch_alloc(usbvision);
if (isoc_mode==ISOC_MODE_COMPRESS) {
/* Allocate intermediate decompression buffers
only if needed */
errCode = usbvision_decompress_alloc(usbvision);
err_code = usbvision_decompress_alloc(usbvision);
}
if (errCode) {
if (err_code) {
/* Deallocate all buffers if trouble */
usbvision_scratch_free(usbvision);
usbvision_decompress_free(usbvision);
@ -376,7 +376,7 @@ static int usbvision_v4l2_open(struct file *file)
}
/* If so far no errors then we shall start the camera */
if (!errCode) {
if (!err_code) {
if (usbvision->power == 0) {
usbvision_power_on(usbvision);
usbvision_i2c_register(usbvision);
@ -385,21 +385,21 @@ static int usbvision_v4l2_open(struct file *file)
/* Send init sequence only once, it's large! */
if (!usbvision->initialized) {
int setup_ok = 0;
setup_ok = usbvision_setup(usbvision,isocMode);
setup_ok = usbvision_setup(usbvision,isoc_mode);
if (setup_ok)
usbvision->initialized = 1;
else
errCode = -EBUSY;
err_code = -EBUSY;
}
if (!errCode) {
if (!err_code) {
usbvision_begin_streaming(usbvision);
errCode = usbvision_init_isoc(usbvision);
err_code = usbvision_init_isoc(usbvision);
/* device must be initialized before isoc transfer */
usbvision_muxsel(usbvision,0);
usbvision->user++;
} else {
if (PowerOnAtOpen) {
if (power_on_at_open) {
usbvision_i2c_unregister(usbvision);
usbvision_power_off(usbvision);
usbvision->initialized = 0;
@ -411,7 +411,7 @@ static int usbvision_v4l2_open(struct file *file)
usbvision_empty_framequeues(usbvision);
PDEBUG(DBG_IO, "success");
return errCode;
return err_code;
}
/*
@ -439,10 +439,10 @@ static int usbvision_v4l2_close(struct file *file)
usbvision->user--;
if (PowerOnAtOpen) {
if (power_on_at_open) {
/* power off in a little while
to avoid off/on every close/open short sequences */
usbvision_set_powerOffTimer(usbvision);
usbvision_set_power_off_timer(usbvision);
usbvision->initialized = 0;
}
@ -467,19 +467,19 @@ static int vidioc_g_register (struct file *file, void *priv,
struct v4l2_dbg_register *reg)
{
struct usb_usbvision *usbvision = video_drvdata(file);
int errCode;
int err_code;
if (!v4l2_chip_match_host(&reg->match))
return -EINVAL;
/* NT100x has a 8-bit register space */
errCode = usbvision_read_reg(usbvision, reg->reg&0xff);
if (errCode < 0) {
err_code = usbvision_read_reg(usbvision, reg->reg&0xff);
if (err_code < 0) {
dev_err(&usbvision->vdev->dev,
"%s: VIDIOC_DBG_G_REGISTER failed: error %d\n",
__func__, errCode);
return errCode;
__func__, err_code);
return err_code;
}
reg->val = errCode;
reg->val = err_code;
reg->size = 1;
return 0;
}
@ -488,17 +488,17 @@ static int vidioc_s_register (struct file *file, void *priv,
struct v4l2_dbg_register *reg)
{
struct usb_usbvision *usbvision = video_drvdata(file);
int errCode;
int err_code;
if (!v4l2_chip_match_host(&reg->match))
return -EINVAL;
/* NT100x has a 8-bit register space */
errCode = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
if (errCode < 0) {
err_code = usbvision_write_reg(usbvision, reg->reg&0xff, reg->val);
if (err_code < 0) {
dev_err(&usbvision->vdev->dev,
"%s: VIDIOC_DBG_S_REGISTER failed: error %d\n",
__func__, errCode);
return errCode;
__func__, err_code);
return err_code;
}
return 0;
}
@ -511,7 +511,7 @@ static int vidioc_querycap (struct file *file, void *priv,
strlcpy(vc->driver, "USBVision", sizeof(vc->driver));
strlcpy(vc->card,
usbvision_device_data[usbvision->DevModel].ModelString,
usbvision_device_data[usbvision->dev_model].model_string,
sizeof(vc->card));
usb_make_path(usbvision->dev, vc->bus_info, sizeof(vc->bus_info));
vc->version = USBVISION_DRIVER_VERSION;
@ -540,7 +540,7 @@ static int vidioc_enum_input (struct file *file, void *priv,
specific for each usbvision card model */
switch(chan) {
case 0:
if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) {
if (usbvision_device_data[usbvision->dev_model].video_channels == 4) {
strcpy(vi->name, "White Video Input");
} else {
strcpy(vi->name, "Television");
@ -552,7 +552,7 @@ static int vidioc_enum_input (struct file *file, void *priv,
break;
case 1:
vi->type = V4L2_INPUT_TYPE_CAMERA;
if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) {
if (usbvision_device_data[usbvision->dev_model].video_channels == 4) {
strcpy(vi->name, "Green Video Input");
} else {
strcpy(vi->name, "Composite Video Input");
@ -561,7 +561,7 @@ static int vidioc_enum_input (struct file *file, void *priv,
break;
case 2:
vi->type = V4L2_INPUT_TYPE_CAMERA;
if (usbvision_device_data[usbvision->DevModel].VideoChannels == 4) {
if (usbvision_device_data[usbvision->dev_model].video_channels == 4) {
strcpy(vi->name, "Yellow Video Input");
} else {
strcpy(vi->name, "S-Video Input");
@ -604,9 +604,9 @@ static int vidioc_s_std (struct file *file, void *priv, v4l2_std_id *id)
{
struct usb_usbvision *usbvision = video_drvdata(file);
usbvision->tvnormId=*id;
usbvision->tvnorm_id=*id;
call_all(usbvision, core, s_std, usbvision->tvnormId);
call_all(usbvision, core, s_std, usbvision->tvnorm_id);
/* propagate the change to the decoder */
usbvision_muxsel(usbvision, usbvision->ctl_input);
@ -744,7 +744,7 @@ static int vidioc_reqbufs (struct file *file,
if (vr->memory != V4L2_MEMORY_MMAP)
return -EINVAL;
if(usbvision->streaming == Stream_On) {
if(usbvision->streaming == stream_on) {
if ((ret = usbvision_stream_interrupt(usbvision)))
return ret;
}
@ -753,7 +753,7 @@ static int vidioc_reqbufs (struct file *file,
usbvision_empty_framequeues(usbvision);
vr->count = usbvision_frames_alloc(usbvision,vr->count);
usbvision->curFrame = NULL;
usbvision->cur_frame = NULL;
return 0;
}
@ -772,11 +772,11 @@ static int vidioc_querybuf (struct file *file,
/* Updating the corresponding frame state */
vb->flags = 0;
frame = &usbvision->frame[vb->index];
if(frame->grabstate >= FrameState_Ready)
if(frame->grabstate >= frame_state_ready)
vb->flags |= V4L2_BUF_FLAG_QUEUED;
if(frame->grabstate >= FrameState_Done)
if(frame->grabstate >= frame_state_done)
vb->flags |= V4L2_BUF_FLAG_DONE;
if(frame->grabstate == FrameState_Unused)
if(frame->grabstate == frame_state_unused)
vb->flags |= V4L2_BUF_FLAG_MAPPED;
vb->memory = V4L2_MEMORY_MMAP;
@ -805,13 +805,13 @@ static int vidioc_qbuf (struct file *file, void *priv, struct v4l2_buffer *vb)
frame = &usbvision->frame[vb->index];
if (frame->grabstate != FrameState_Unused) {
if (frame->grabstate != frame_state_unused) {
return -EAGAIN;
}
/* Mark it as ready and enqueue frame */
frame->grabstate = FrameState_Ready;
frame->scanstate = ScanState_Scanning;
frame->grabstate = frame_state_ready;
frame->scanstate = scan_state_scanning;
frame->scanlength = 0; /* Accumulated in usbvision_parse_data() */
vb->flags &= ~V4L2_BUF_FLAG_DONE;
@ -834,7 +834,7 @@ static int vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *vb)
unsigned long lock_flags;
if (list_empty(&(usbvision->outqueue))) {
if (usbvision->streaming == Stream_Idle)
if (usbvision->streaming == stream_idle)
return -EINVAL;
ret = wait_event_interruptible
(usbvision->wait_frame,
@ -849,7 +849,7 @@ static int vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *vb)
list_del(usbvision->outqueue.next);
spin_unlock_irqrestore(&usbvision->queue_lock, lock_flags);
f->grabstate = FrameState_Unused;
f->grabstate = frame_state_unused;
vb->memory = V4L2_MEMORY_MMAP;
vb->flags = V4L2_BUF_FLAG_MAPPED |
@ -868,7 +868,7 @@ static int vidioc_streamon(struct file *file, void *priv, enum v4l2_buf_type i)
{
struct usb_usbvision *usbvision = video_drvdata(file);
usbvision->streaming = Stream_On;
usbvision->streaming = stream_on;
call_all(usbvision, video, s_stream, 1);
return 0;
@ -882,7 +882,7 @@ static int vidioc_streamoff(struct file *file,
if (type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
return -EINVAL;
if(usbvision->streaming == Stream_On) {
if(usbvision->streaming == stream_on) {
usbvision_stream_interrupt(usbvision);
/* Stop all video streamings */
call_all(usbvision, video, s_stream, 0);
@ -923,18 +923,18 @@ static int vidioc_try_fmt_vid_cap (struct file *file, void *priv,
struct v4l2_format *vf)
{
struct usb_usbvision *usbvision = video_drvdata(file);
int formatIdx;
int format_idx;
/* Find requested format in available ones */
for(formatIdx=0;formatIdx<USBVISION_SUPPORTED_PALETTES;formatIdx++) {
for(format_idx=0;format_idx<USBVISION_SUPPORTED_PALETTES;format_idx++) {
if(vf->fmt.pix.pixelformat ==
usbvision_v4l2_format[formatIdx].format) {
usbvision->palette = usbvision_v4l2_format[formatIdx];
usbvision_v4l2_format[format_idx].format) {
usbvision->palette = usbvision_v4l2_format[format_idx];
break;
}
}
/* robustness */
if(formatIdx == USBVISION_SUPPORTED_PALETTES) {
if(format_idx == USBVISION_SUPPORTED_PALETTES) {
return -EINVAL;
}
RESTRICT_TO_RANGE(vf->fmt.pix.width, MIN_FRAME_WIDTH, MAX_FRAME_WIDTH);
@ -958,14 +958,14 @@ static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
}
/* stop io in case it is already in progress */
if(usbvision->streaming == Stream_On) {
if(usbvision->streaming == stream_on) {
if ((ret = usbvision_stream_interrupt(usbvision)))
return ret;
}
usbvision_frames_free(usbvision);
usbvision_empty_framequeues(usbvision);
usbvision->curFrame = NULL;
usbvision->cur_frame = NULL;
/* by now we are committed to the new data... */
usbvision_set_output(usbvision, vf->fmt.pix.width, vf->fmt.pix.height);
@ -1000,9 +1000,9 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf,
usbvision_frames_alloc(usbvision,USBVISION_NUMFRAMES);
}
if(usbvision->streaming != Stream_On) {
if(usbvision->streaming != stream_on) {
/* no stream is running, make it running ! */
usbvision->streaming = Stream_On;
usbvision->streaming = stream_on;
call_all(usbvision, video, s_stream, 1);
}
@ -1010,10 +1010,10 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf,
(like a user of VIDIOC_QBUF would do) */
for(i=0;i<usbvision->num_frames;i++) {
frame = &usbvision->frame[i];
if(frame->grabstate == FrameState_Unused) {
if(frame->grabstate == frame_state_unused) {
/* Mark it as ready and enqueue frame */
frame->grabstate = FrameState_Ready;
frame->scanstate = ScanState_Scanning;
frame->grabstate = frame_state_ready;
frame->scanstate = scan_state_scanning;
/* Accumulated in usbvision_parse_data() */
frame->scanlength = 0;
@ -1046,7 +1046,7 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf,
spin_unlock_irqrestore(&usbvision->queue_lock, lock_flags);
/* An error returns an empty frame */
if (frame->grabstate == FrameState_Error) {
if (frame->grabstate == frame_state_error) {
frame->bytes_read = 0;
return 0;
}
@ -1073,7 +1073,7 @@ static ssize_t usbvision_v4l2_read(struct file *file, char __user *buf,
frame->bytes_read = 0;
/* Mark it as available to be used again. */
frame->grabstate = FrameState_Unused;
frame->grabstate = frame_state_unused;
/* } */
return count;
@ -1136,7 +1136,7 @@ static int usbvision_v4l2_mmap(struct file *file, struct vm_area_struct *vma)
static int usbvision_radio_open(struct file *file)
{
struct usb_usbvision *usbvision = video_drvdata(file);
int errCode = 0;
int err_code = 0;
PDEBUG(DBG_IO, "%s:", __func__);
@ -1144,11 +1144,11 @@ static int usbvision_radio_open(struct file *file)
dev_err(&usbvision->rdev->dev,
"%s: Someone tried to open an already opened USBVision Radio!\n",
__func__);
errCode = -EBUSY;
err_code = -EBUSY;
}
else {
if(PowerOnAtOpen) {
usbvision_reset_powerOffTimer(usbvision);
if(power_on_at_open) {
usbvision_reset_power_off_timer(usbvision);
if (usbvision->power == 0) {
usbvision_power_on(usbvision);
usbvision_i2c_register(usbvision);
@ -1156,10 +1156,10 @@ static int usbvision_radio_open(struct file *file)
}
/* Alternate interface 1 is is the biggest frame size */
errCode = usbvision_set_alternate(usbvision);
if (errCode < 0) {
usbvision->last_error = errCode;
errCode = -EBUSY;
err_code = usbvision_set_alternate(usbvision);
if (err_code < 0) {
usbvision->last_error = err_code;
err_code = -EBUSY;
goto out;
}
@ -1170,36 +1170,36 @@ static int usbvision_radio_open(struct file *file)
usbvision->user++;
}
if (errCode) {
if (PowerOnAtOpen) {
if (err_code) {
if (power_on_at_open) {
usbvision_i2c_unregister(usbvision);
usbvision_power_off(usbvision);
usbvision->initialized = 0;
}
}
out:
return errCode;
return err_code;
}
static int usbvision_radio_close(struct file *file)
{
struct usb_usbvision *usbvision = video_drvdata(file);
int errCode = 0;
int err_code = 0;
PDEBUG(DBG_IO, "");
/* Set packet size to 0 */
usbvision->ifaceAlt=0;
errCode = usb_set_interface(usbvision->dev, usbvision->iface,
usbvision->ifaceAlt);
usbvision->iface_alt=0;
err_code = usb_set_interface(usbvision->dev, usbvision->iface,
usbvision->iface_alt);
usbvision_audio_off(usbvision);
usbvision->radio=0;
usbvision->user--;
if (PowerOnAtOpen) {
usbvision_set_powerOffTimer(usbvision);
if (power_on_at_open) {
usbvision_set_power_off_timer(usbvision);
usbvision->initialized = 0;
}
@ -1209,7 +1209,7 @@ static int usbvision_radio_close(struct file *file)
}
PDEBUG(DBG_IO, "success");
return errCode;
return err_code;
}
//
@ -1375,7 +1375,7 @@ static int __devinit usbvision_register_video(struct usb_usbvision *usbvision)
usbvision->nr, video_device_node_name(usbvision->vdev));
// Radio Device:
if (usbvision_device_data[usbvision->DevModel].Radio) {
if (usbvision_device_data[usbvision->dev_model].radio) {
// usbvision has radio
usbvision->rdev = usbvision_vdev_init(usbvision,
&usbvision_radio_template,
@ -1427,12 +1427,12 @@ static struct usb_usbvision *usbvision_alloc(struct usb_device *dev,
mutex_init(&usbvision->v4l2_lock);
// prepare control urb for control messages during interrupts
usbvision->ctrlUrb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
if (usbvision->ctrlUrb == NULL)
usbvision->ctrl_urb = usb_alloc_urb(USBVISION_URB_FRAMES, GFP_KERNEL);
if (usbvision->ctrl_urb == NULL)
goto err_unreg;
init_waitqueue_head(&usbvision->ctrlUrb_wq);
init_waitqueue_head(&usbvision->ctrl_urb_wq);
usbvision_init_powerOffTimer(usbvision);
usbvision_init_power_off_timer(usbvision);
return usbvision;
@ -1454,15 +1454,15 @@ static void usbvision_release(struct usb_usbvision *usbvision)
{
PDEBUG(DBG_PROBE, "");
usbvision_reset_powerOffTimer(usbvision);
usbvision_reset_power_off_timer(usbvision);
usbvision->initialized = 0;
usbvision_remove_sysfs(usbvision->vdev);
usbvision_unregister_video(usbvision);
if (usbvision->ctrlUrb) {
usb_free_urb(usbvision->ctrlUrb);
if (usbvision->ctrl_urb) {
usb_free_urb(usbvision->ctrl_urb);
}
v4l2_device_unregister(&usbvision->v4l2_dev);
@ -1481,25 +1481,25 @@ static void usbvision_configure_video(struct usb_usbvision *usbvision)
if (usbvision == NULL)
return;
model = usbvision->DevModel;
model = usbvision->dev_model;
usbvision->palette = usbvision_v4l2_format[2]; // V4L2_PIX_FMT_RGB24;
if (usbvision_device_data[usbvision->DevModel].Vin_Reg2_override) {
usbvision->Vin_Reg2_Preset =
usbvision_device_data[usbvision->DevModel].Vin_Reg2;
if (usbvision_device_data[usbvision->dev_model].vin_reg2_override) {
usbvision->vin_reg2_preset =
usbvision_device_data[usbvision->dev_model].vin_reg2;
} else {
usbvision->Vin_Reg2_Preset = 0;
usbvision->vin_reg2_preset = 0;
}
usbvision->tvnormId = usbvision_device_data[model].VideoNorm;
usbvision->tvnorm_id = usbvision_device_data[model].video_norm;
usbvision->video_inputs = usbvision_device_data[model].VideoChannels;
usbvision->video_inputs = usbvision_device_data[model].video_channels;
usbvision->ctl_input = 0;
/* This should be here to make i2c clients to be able to register */
/* first switch off audio */
usbvision_audio_off(usbvision);
if (!PowerOnAtOpen) {
if (!power_on_at_open) {
/* and then power up the noisy tuner */
usbvision_power_on(usbvision);
usbvision_i2c_register(usbvision);
@ -1534,10 +1534,10 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
return -ENODEV;
}
printk(KERN_INFO "%s: %s found\n", __func__,
usbvision_device_data[model].ModelString);
usbvision_device_data[model].model_string);
if (usbvision_device_data[model].Interface >= 0) {
interface = &dev->actconfig->interface[usbvision_device_data[model].Interface]->altsetting[0];
if (usbvision_device_data[model].interface >= 0) {
interface = &dev->actconfig->interface[usbvision_device_data[model].interface]->altsetting[0];
} else {
interface = &dev->actconfig->interface[ifnum]->altsetting[0];
}
@ -1562,13 +1562,13 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
}
if (dev->descriptor.bNumConfigurations > 1) {
usbvision->bridgeType = BRIDGE_NT1004;
usbvision->bridge_type = BRIDGE_NT1004;
} else if (model == DAZZLE_DVC_90_REV_1_SECAM) {
usbvision->bridgeType = BRIDGE_NT1005;
usbvision->bridge_type = BRIDGE_NT1005;
} else {
usbvision->bridgeType = BRIDGE_NT1003;
usbvision->bridge_type = BRIDGE_NT1003;
}
PDEBUG(DBG_PROBE, "bridgeType %d", usbvision->bridgeType);
PDEBUG(DBG_PROBE, "bridge_type %d", usbvision->bridge_type);
/* compute alternate max packet sizes */
uif = dev->actconfig->interface[0];
@ -1594,20 +1594,20 @@ static int __devinit usbvision_probe(struct usb_interface *intf,
usbvision->nr = usbvision_nr++;
usbvision->have_tuner = usbvision_device_data[model].Tuner;
usbvision->have_tuner = usbvision_device_data[model].tuner;
if (usbvision->have_tuner) {
usbvision->tuner_type = usbvision_device_data[model].TunerType;
usbvision->tuner_type = usbvision_device_data[model].tuner_type;
}
usbvision->DevModel = model;
usbvision->dev_model = model;
usbvision->remove_pending = 0;
usbvision->iface = ifnum;
usbvision->ifaceAlt = 0;
usbvision->iface_alt = 0;
usbvision->video_endp = endpoint->bEndpointAddress;
usbvision->isocPacketSize = 0;
usbvision->isoc_packet_size = 0;
usbvision->usb_bandwidth = 0;
usbvision->user = 0;
usbvision->streaming = Stream_Off;
usbvision->streaming = stream_off;
usbvision_configure_video(usbvision);
usbvision_register_video(usbvision);
@ -1682,7 +1682,7 @@ static struct usb_driver usbvision_driver = {
*/
static int __init usbvision_init(void)
{
int errCode;
int err_code;
PDEBUG(DBG_PROBE, "");
@ -1691,19 +1691,19 @@ static int __init usbvision_init(void)
PDEBUG(DBG_MMAP, "MMAP debugging is enabled [video]");
/* disable planar mode support unless compression enabled */
if (isocMode != ISOC_MODE_COMPRESS ) {
if (isoc_mode != ISOC_MODE_COMPRESS ) {
// FIXME : not the right way to set supported flag
usbvision_v4l2_format[6].supported = 0; // V4L2_PIX_FMT_YVU420
usbvision_v4l2_format[7].supported = 0; // V4L2_PIX_FMT_YUV422P
}
errCode = usb_register(&usbvision_driver);
err_code = usb_register(&usbvision_driver);
if (errCode == 0) {
if (err_code == 0) {
printk(KERN_INFO DRIVER_DESC " : " USBVISION_VERSION_STRING "\n");
PDEBUG(DBG_PROBE, "success");
}
return errCode;
return err_code;
}
static void __exit usbvision_exit(void)

View File

@ -223,39 +223,39 @@ enum {
/* ----------------------------------------------------------------- */
/* usbvision video structures */
/* ----------------------------------------------------------------- */
enum ScanState {
ScanState_Scanning, /* Scanning for header */
ScanState_Lines /* Parsing lines */
enum scan_state {
scan_state_scanning, /* Scanning for header */
scan_state_lines /* Parsing lines */
};
/* Completion states of the data parser */
enum ParseState {
ParseState_Continue, /* Just parse next item */
ParseState_NextFrame, /* Frame done, send it to V4L */
ParseState_Out, /* Not enough data for frame */
ParseState_EndParse /* End parsing */
enum parse_state {
parse_state_continue, /* Just parse next item */
parse_state_next_frame, /* Frame done, send it to V4L */
parse_state_out, /* Not enough data for frame */
parse_state_end_parse /* End parsing */
};
enum FrameState {
FrameState_Unused, /* Unused (no MCAPTURE) */
FrameState_Ready, /* Ready to start grabbing */
FrameState_Grabbing, /* In the process of being grabbed into */
FrameState_Done, /* Finished grabbing, but not been synced yet */
FrameState_DoneHold, /* Are syncing or reading */
FrameState_Error, /* Something bad happened while processing */
enum frame_state {
frame_state_unused, /* Unused (no MCAPTURE) */
frame_state_ready, /* Ready to start grabbing */
frame_state_grabbing, /* In the process of being grabbed into */
frame_state_done, /* Finished grabbing, but not been synced yet */
frame_state_done_hold, /* Are syncing or reading */
frame_state_error, /* Something bad happened while processing */
};
/* stream states */
enum StreamState {
Stream_Off, /* Driver streaming is completely OFF */
Stream_Idle, /* Driver streaming is ready to be put ON by the application */
Stream_Interrupt, /* Driver streaming must be interrupted */
Stream_On, /* Driver streaming is put ON by the application */
enum stream_state {
stream_off, /* Driver streaming is completely OFF */
stream_idle, /* Driver streaming is ready to be put ON by the application */
stream_interrupt, /* Driver streaming must be interrupted */
stream_on, /* Driver streaming is put ON by the application */
};
enum IsocState {
IsocState_InFrame, /* Isoc packet is member of frame */
IsocState_NoFrame, /* Isoc packet is not member of any frame */
enum isoc_state {
isoc_state_in_frame, /* Isoc packet is member of frame */
isoc_state_no_frame, /* Isoc packet is not member of any frame */
};
struct usb_device;
@ -286,23 +286,23 @@ struct usbvision_v4l2_format_st {
struct usbvision_frame_header {
unsigned char magic_1; /* 0 magic */
unsigned char magic_2; /* 1 magic */
unsigned char headerLength; /* 2 */
unsigned char frameNum; /* 3 */
unsigned char framePhase; /* 4 */
unsigned char frameLatency; /* 5 */
unsigned char dataFormat; /* 6 */
unsigned char formatParam; /* 7 */
unsigned char frameWidthLo; /* 8 */
unsigned char frameWidthHi; /* 9 */
unsigned char frameHeightLo; /* 10 */
unsigned char frameHeightHi; /* 11 */
__u16 frameWidth; /* 8 - 9 after endian correction*/
__u16 frameHeight; /* 10 - 11 after endian correction*/
unsigned char header_length; /* 2 */
unsigned char frame_num; /* 3 */
unsigned char frame_phase; /* 4 */
unsigned char frame_latency; /* 5 */
unsigned char data_format; /* 6 */
unsigned char format_param; /* 7 */
unsigned char frame_width_lo; /* 8 */
unsigned char frame_width_hi; /* 9 */
unsigned char frame_height_lo; /* 10 */
unsigned char frame_height_hi; /* 11 */
__u16 frame_width; /* 8 - 9 after endian correction*/
__u16 frame_height; /* 10 - 11 after endian correction*/
};
struct usbvision_frame {
char *data; /* Frame buffer */
struct usbvision_frame_header isocHeader; /* Header from stream */
struct usbvision_frame_header isoc_header; /* Header from stream */
int width; /* Width application is expecting */
int height; /* Height */
@ -332,24 +332,24 @@ struct usbvision_frame {
#define BRIDGE_NT1005 1005
struct usbvision_device_data_st {
__u64 VideoNorm;
const char *ModelString;
int Interface; /* to handle special interface number like BELKIN and Hauppauge WinTV-USB II */
__u16 Codec;
unsigned VideoChannels:3;
unsigned AudioChannels:2;
unsigned Radio:1;
__u64 video_norm;
const char *model_string;
int interface; /* to handle special interface number like BELKIN and Hauppauge WinTV-USB II */
__u16 codec;
unsigned video_channels:3;
unsigned audio_channels:2;
unsigned radio:1;
unsigned vbi:1;
unsigned Tuner:1;
unsigned Vin_Reg1_override:1; /* Override default value with */
unsigned Vin_Reg2_override:1; /* Vin_Reg1, Vin_Reg2, etc. */
unsigned Dvi_yuv_override:1;
__u8 Vin_Reg1;
__u8 Vin_Reg2;
__u8 Dvi_yuv;
__u8 TunerType;
__s16 X_Offset;
__s16 Y_Offset;
unsigned tuner:1;
unsigned vin_reg1_override:1; /* Override default value with */
unsigned vin_reg2_override:1; /* vin_reg1, vin_reg2, etc. */
unsigned dvi_yuv_override:1;
__u8 vin_reg1;
__u8 vin_reg2;
__u8 dvi_yuv;
__u8 tuner_type;
__s16 x_offset;
__s16 y_offset;
};
/* Declared on usbvision-cards.c */
@ -365,40 +365,40 @@ struct usb_usbvision {
struct i2c_adapter i2c_adap;
int registered_i2c;
struct urb *ctrlUrb;
unsigned char ctrlUrbBuffer[8];
int ctrlUrbBusy;
struct usb_ctrlrequest ctrlUrbSetup;
wait_queue_head_t ctrlUrb_wq; // Processes waiting
struct urb *ctrl_urb;
unsigned char ctrl_urb_buffer[8];
int ctrl_urb_busy;
struct usb_ctrlrequest ctrl_urb_setup;
wait_queue_head_t ctrl_urb_wq; // Processes waiting
/* configuration part */
int have_tuner;
int tuner_type;
int bridgeType; // NT1003, NT1004, NT1005
int bridge_type; // NT1003, NT1004, NT1005
int radio;
int video_inputs; // # of inputs
unsigned long freq;
int AudioMute;
int AudioChannel;
int isocMode; // format of video data for the usb isoc-transfer
int audio_mute;
int audio_channel;
int isoc_mode; // format of video data for the usb isoc-transfer
unsigned int nr; // Number of the device
/* Device structure */
struct usb_device *dev;
/* usb transfer */
int num_alt; /* Number of alternative settings */
unsigned int *alt_max_pkt_size; /* array of wMaxPacketSize */
unsigned int *alt_max_pkt_size; /* array of max_packet_size */
unsigned char iface; /* Video interface number */
unsigned char ifaceAlt; /* Alt settings */
unsigned char Vin_Reg2_Preset;
unsigned char iface_alt; /* Alt settings */
unsigned char vin_reg2_preset;
struct mutex v4l2_lock;
struct timer_list powerOffTimer;
struct work_struct powerOffWork;
struct timer_list power_off_timer;
struct work_struct power_off_work;
int power; /* is the device powered on? */
int user; /* user count for exclusive use */
int initialized; /* Had we already sent init sequence? */
int DevModel; /* What type of USBVISION device we got? */
enum StreamState streaming; /* Are we streaming Isochronous? */
int dev_model; /* What type of USBVISION device we got? */
enum stream_state streaming; /* Are we streaming Isochronous? */
int last_error; /* What calamity struck us? */
int curwidth; /* width of the frame the device is currently set to*/
int curheight; /* height of the frame the device is currently set to*/
@ -411,7 +411,7 @@ struct usb_usbvision {
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_stream; /* Processes waiting */
struct usbvision_frame *curFrame; // 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
int num_frames; // number of frames allocated
struct usbvision_sbuf sbuf[USBVISION_NUMSBUF]; // S buffering
@ -424,43 +424,43 @@ struct usb_usbvision {
int scratch_headermarker[USBVISION_NUM_HEADERMARKER];
int scratch_headermarker_read_ptr;
int scratch_headermarker_write_ptr;
enum IsocState isocstate;
enum isoc_state isocstate;
struct usbvision_v4l2_format_st palette;
struct v4l2_capability vcap; /* Video capabilities */
unsigned int ctl_input; /* selected input */
v4l2_std_id tvnormId; /* selected tv norm */
v4l2_std_id tvnorm_id; /* selected tv norm */
unsigned char video_endp; /* 0x82 for USBVISION devices based */
// Decompression stuff:
unsigned char *IntraFrameBuffer; /* Buffer for reference frame */
int BlockPos; //for test only
int requestIntra; // 0 = normal; 1 = intra frame is requested;
int lastIsocFrameNum; // check for lost isoc frames
int isocPacketSize; // need to calculate usedBandwidth
int usedBandwidth; // used bandwidth 0-100%, need to set comprLevel
int comprLevel; // How strong (100) or weak (0) is compression
int lastComprLevel; // How strong (100) or weak (0) was compression
unsigned char *intra_frame_buffer; /* Buffer for reference frame */
int block_pos; //for test only
int request_intra; // 0 = normal; 1 = intra frame is requested;
int last_isoc_frame_num; // check for lost isoc frames
int isoc_packet_size; // need to calculate used_bandwidth
int used_bandwidth; // used bandwidth 0-100%, need to set compr_level
int compr_level; // How strong (100) or weak (0) is compression
int last_compr_level; // How strong (100) or weak (0) was compression
int usb_bandwidth; /* Mbit/s */
/* Statistics that can be overlayed on the screen */
unsigned long isocUrbCount; // 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 isocDataCount; /* 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 scratch_ovf_count; /* How many times we overflowed scratch */
unsigned long isocSkipCount; /* How many empty ISO packets received */
unsigned long isocErrCount; /* How many bad ISO packets received */
unsigned long isocPacketCount; // How many packets we totally got
unsigned long timeInIrq; // How long do we need for interrupt
int isocMeasureBandwidthCount;
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_packet_count; // How many packets we totally got
unsigned long time_in_irq; // How long do we need for interrupt
int isoc_measure_bandwidth_count;
int frame_num; // How many video frames we send to user
int maxStripLen; // How big is the biggest strip
int comprBlockPos;
int stripLenErrors; // How many times was BlockPos greater than StripLen
int stripMagicErrors;
int stripLineNumberErrors;
int ComprBlockTypes[4];
int max_strip_len; // How big is the biggest strip
int comprblock_pos;
int strip_len_errors; // How many times was block_pos greater than strip_len
int strip_magic_errors;
int strip_line_number_errors;
int compr_block_types[4];
};
static inline struct usb_usbvision *to_usbvision(struct v4l2_device *v4l2_dev)
@ -500,7 +500,7 @@ int usbvision_restart_isoc(struct usb_usbvision *usbvision);
void usbvision_stop_isoc(struct usb_usbvision *usbvision);
int usbvision_set_alternate(struct usb_usbvision *dev);
int usbvision_set_audio(struct usb_usbvision *usbvision, int AudioChannel);
int usbvision_set_audio(struct usb_usbvision *usbvision, int audio_channel);
int usbvision_audio_off(struct usb_usbvision *usbvision);
int usbvision_begin_streaming(struct usb_usbvision *usbvision);
@ -511,9 +511,9 @@ int usbvision_muxsel(struct usb_usbvision *usbvision, int channel);
int usbvision_set_input(struct usb_usbvision *usbvision);
int usbvision_set_output(struct usb_usbvision *usbvision, int width, int height);
void usbvision_init_powerOffTimer(struct usb_usbvision *usbvision);
void usbvision_set_powerOffTimer(struct usb_usbvision *usbvision);
void usbvision_reset_powerOffTimer(struct usb_usbvision *usbvision);
void usbvision_init_power_off_timer(struct usb_usbvision *usbvision);
void usbvision_set_power_off_timer(struct usb_usbvision *usbvision);
void usbvision_reset_power_off_timer(struct usb_usbvision *usbvision);
int usbvision_power_off(struct usb_usbvision *usbvision);
int usbvision_power_on(struct usb_usbvision *usbvision);