Commit b9255176 authored by Sri Deevi's avatar Sri Deevi Committed by Mauro Carvalho Chehab

V4L/DVB (10957): cx231xx: Fix CodingStyle

Fixes several CodingStyle issues on the driver.
Signed-off-by: default avatarSrinivasa Deevi <srinivasa.deevi@conexant.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 818fdf34
...@@ -132,12 +132,16 @@ static void cx231xx_audio_isocirq(struct urb *urb) ...@@ -132,12 +132,16 @@ static void cx231xx_audio_isocirq(struct urb *urb)
snd_pcm_stream_lock(substream); snd_pcm_stream_lock(substream);
dev->adev.hwptr_done_capture += length; dev->adev.hwptr_done_capture += length;
if (dev->adev.hwptr_done_capture >= runtime->buffer_size) if (dev->adev.hwptr_done_capture >=
dev->adev.hwptr_done_capture -= runtime->buffer_size; runtime->buffer_size)
dev->adev.hwptr_done_capture -=
runtime->buffer_size;
dev->adev.capture_transfer_done += length; dev->adev.capture_transfer_done += length;
if (dev->adev.capture_transfer_done >= runtime->period_size) { if (dev->adev.capture_transfer_done >=
dev->adev.capture_transfer_done -= runtime->period_size; runtime->period_size) {
dev->adev.capture_transfer_done -=
runtime->period_size;
period_elapsed = 1; period_elapsed = 1;
} }
snd_pcm_stream_unlock(substream); snd_pcm_stream_unlock(substream);
...@@ -185,7 +189,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) ...@@ -185,7 +189,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
urb->dev = dev->udev; urb->dev = dev->udev;
urb->context = dev; urb->context = dev;
urb->pipe = usb_rcvisocpipe(dev->udev, dev->adev.end_point_addr); urb->pipe = usb_rcvisocpipe(dev->udev,
dev->adev.end_point_addr);
urb->transfer_flags = URB_ISO_ASAP; urb->transfer_flags = URB_ISO_ASAP;
urb->transfer_buffer = dev->adev.transfer_buffer[i]; urb->transfer_buffer = dev->adev.transfer_buffer[i];
urb->interval = 1; urb->interval = 1;
...@@ -193,7 +198,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev) ...@@ -193,7 +198,8 @@ static int cx231xx_init_audio_isoc(struct cx231xx *dev)
urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS; urb->number_of_packets = CX231XX_NUM_AUDIO_PACKETS;
urb->transfer_buffer_length = sb_size; urb->transfer_buffer_length = sb_size;
for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS; j++, k += dev->adev.max_pkt_size) { for (j = k = 0; j < CX231XX_NUM_AUDIO_PACKETS;
j++, k += dev->adev.max_pkt_size) {
urb->iso_frame_desc[j].offset = k; urb->iso_frame_desc[j].offset = k;
urb->iso_frame_desc[j].length = dev->adev.max_pkt_size; urb->iso_frame_desc[j].length = dev->adev.max_pkt_size;
} }
...@@ -293,7 +299,8 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream) ...@@ -293,7 +299,8 @@ static int snd_cx231xx_capture_open(struct snd_pcm_substream *substream)
dev->mute = 0; dev->mute = 0;
/* set alternate setting for audio interface */ /* set alternate setting for audio interface */
ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1); /* 1 - 48000 samples per sec */ /* 1 - 48000 samples per sec */
ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 1);
if (ret < 0) { if (ret < 0) {
cx231xx_errdev("failed to set alternate setting !\n"); cx231xx_errdev("failed to set alternate setting !\n");
...@@ -324,7 +331,8 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream) ...@@ -324,7 +331,8 @@ static int snd_cx231xx_pcm_close(struct snd_pcm_substream *substream)
dprintk("closing device\n"); dprintk("closing device\n");
/* set alternate setting for audio interface */ /* set alternate setting for audio interface */
ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0); /* 1 - 48000 samples per sec */ /* 1 - 48000 samples per sec */
ret = cx231xx_set_alt_setting(dev, INDEX_AUDIO, 0);
if (ret < 0) { if (ret < 0) {
cx231xx_errdev("failed to set alternate setting !\n"); cx231xx_errdev("failed to set alternate setting !\n");
......
/* /*
cx231xx-cards.c - driver for Conexant Cx23100/101/102 USB video capture devices cx231xx-cards.c - driver for Conexant Cx23100/101/102
USB video capture devices
Copyright (C) 2008 <srinivasa.deevi at conexant dot com> Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
Based on em28xx driver Based on em28xx driver
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -85,7 +86,7 @@ struct cx231xx_board cx231xx_boards[] = { ...@@ -85,7 +86,7 @@ struct cx231xx_board cx231xx_boards[] = {
.amux = .amux =
CX231XX_AMUX_LINE_IN, CX231XX_AMUX_LINE_IN,
.gpio = 0, .gpio = 0,
}}, } },
}, },
[CX231XX_BOARD_CNXT_RDE_250] = { [CX231XX_BOARD_CNXT_RDE_250] = {
...@@ -132,7 +133,7 @@ struct cx231xx_board cx231xx_boards[] = { ...@@ -132,7 +133,7 @@ struct cx231xx_board cx231xx_boards[] = {
.amux = .amux =
CX231XX_AMUX_LINE_IN, CX231XX_AMUX_LINE_IN,
.gpio = 0, .gpio = 0,
}}, } },
}, },
[CX231XX_BOARD_CNXT_RDU_250] = { [CX231XX_BOARD_CNXT_RDU_250] = {
...@@ -179,7 +180,7 @@ struct cx231xx_board cx231xx_boards[] = { ...@@ -179,7 +180,7 @@ struct cx231xx_board cx231xx_boards[] = {
.amux = .amux =
CX231XX_AMUX_LINE_IN, CX231XX_AMUX_LINE_IN,
.gpio = 0, .gpio = 0,
}}, } },
}, },
}; };
const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards); const unsigned int cx231xx_bcount = ARRAY_SIZE(cx231xx_boards);
...@@ -209,9 +210,8 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg) ...@@ -209,9 +210,8 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg)
if (dev->tuner_type == TUNER_XC5000) { if (dev->tuner_type == TUNER_XC5000) {
if (command == XC5000_TUNER_RESET) { if (command == XC5000_TUNER_RESET) {
cx231xx_info cx231xx_info
("Tuner Call back : RESET : command %d : tuner type %d \n", ("Tuner CB: RESET: cmd %d : tuner type %d \n",
command, dev->tuner_type); command, dev->tuner_type);
cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit, cx231xx_set_gpio_value(dev, dev->board.tuner_gpio->bit,
1); 1);
msleep(10); msleep(10);
...@@ -225,10 +225,9 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg) ...@@ -225,10 +225,9 @@ int cx231xx_tuner_callback(void *ptr, int component, int command, int arg)
} }
return rc; return rc;
} }
EXPORT_SYMBOL_GPL(cx231xx_tuner_callback); EXPORT_SYMBOL_GPL(cx231xx_tuner_callback);
static void inline cx231xx_set_model(struct cx231xx *dev) static inline void cx231xx_set_model(struct cx231xx *dev)
{ {
memcpy(&dev->board, &cx231xx_boards[dev->model], sizeof(dev->board)); memcpy(&dev->board, &cx231xx_boards[dev->model], sizeof(dev->board));
} }
...@@ -542,7 +541,7 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev, ...@@ -542,7 +541,7 @@ static int cx231xx_init_dev(struct cx231xx **devhandle, struct usb_device *udev,
return 0; return 0;
fail_reg_devices: fail_reg_devices:
mutex_unlock(&dev->lock); mutex_unlock(&dev->lock);
return retval; return retval;
} }
...@@ -628,12 +627,13 @@ static int cx231xx_usb_probe(struct usb_interface *interface, ...@@ -628,12 +627,13 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
dev->has_alsa_audio = 1; dev->has_alsa_audio = 1;
dev->power_mode = -1; dev->power_mode = -1;
dev->vbi_or_sliced_cc_mode = 0; /* 0 - vbi ; 1 -sliced cc mode */ /* 0 - vbi ; 1 -sliced cc mode */
dev->vbi_or_sliced_cc_mode = 0;
/* get maximum no.of IAD interfaces */ /* get maximum no.of IAD interfaces */
assoc_desc = udev->actconfig->intf_assoc[0]; assoc_desc = udev->actconfig->intf_assoc[0];
dev->max_iad_interface_count = assoc_desc->bInterfaceCount; dev->max_iad_interface_count = assoc_desc->bInterfaceCount;
cx231xx_info(": Found IAD interface count %d\n", cx231xx_info("Found IAD interface count %d\n",
dev->max_iad_interface_count); dev->max_iad_interface_count);
/* init CIR module TBD */ /* init CIR module TBD */
...@@ -662,10 +662,9 @@ static int cx231xx_usb_probe(struct usb_interface *interface, ...@@ -662,10 +662,9 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
assoc_desc = udev->actconfig->intf_assoc[0]; assoc_desc = udev->actconfig->intf_assoc[0];
if (assoc_desc->bFirstInterface == ifnum) { if (assoc_desc->bFirstInterface == ifnum) {
cx231xx_info cx231xx_info
(": Found IAD interface match: AV Descriptor Start!! \n"); ("Found IAD interface match: AV Desc Start!! \n");
} else { } else {
cx231xx_err(DRIVER_NAME cx231xx_err(" Not found matching interface\n");
" Not found matching interface\n");
return -ENODEV; return -ENODEV;
} }
...@@ -691,7 +690,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface, ...@@ -691,7 +690,7 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
skip_interface = 1; /* set skipping */ skip_interface = 1; /* set skipping */
else { else {
cx231xx_info cx231xx_info
(": Found IAD interface number match with AV Device number!! \n"); ("Found IAD interface no. match with AV Device no.!\n");
} }
} }
......
This diff is collapsed.
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
DVB device driver for cx231xx DVB device driver for cx231xx
Copyright (C) 2008 <srinivasa.deevi at conexant dot com> Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
Based on em28xx driver Based on em28xx driver
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -395,20 +395,20 @@ static int register_dvb(struct cx231xx_dvb *dvb, ...@@ -395,20 +395,20 @@ static int register_dvb(struct cx231xx_dvb *dvb,
dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx); dvb_net_init(&dvb->adapter, &dvb->net, &dvb->demux.dmx);
return 0; return 0;
fail_fe_conn: fail_fe_conn:
dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem); dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_mem);
fail_fe_mem: fail_fe_mem:
dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw); dvb->demux.dmx.remove_frontend(&dvb->demux.dmx, &dvb->fe_hw);
fail_fe_hw: fail_fe_hw:
dvb_dmxdev_release(&dvb->dmxdev); dvb_dmxdev_release(&dvb->dmxdev);
fail_dmxdev: fail_dmxdev:
dvb_dmx_release(&dvb->demux); dvb_dmx_release(&dvb->demux);
fail_dmx: fail_dmx:
dvb_unregister_frontend(dvb->frontend); dvb_unregister_frontend(dvb->frontend);
fail_frontend: fail_frontend:
dvb_frontend_detach(dvb->frontend); dvb_frontend_detach(dvb->frontend);
dvb_unregister_adapter(&dvb->adapter); dvb_unregister_adapter(&dvb->adapter);
fail_adapter: fail_adapter:
return result; return result;
} }
...@@ -516,7 +516,7 @@ static int dvb_init(struct cx231xx *dev) ...@@ -516,7 +516,7 @@ static int dvb_init(struct cx231xx *dev)
printk(KERN_INFO "Successfully loaded cx231xx-dvb\n"); printk(KERN_INFO "Successfully loaded cx231xx-dvb\n");
return 0; return 0;
out_free: out_free:
cx231xx_set_mode(dev, CX231XX_SUSPEND); cx231xx_set_mode(dev, CX231XX_SUSPEND);
kfree(dvb); kfree(dvb);
dev->dvb = NULL; dev->dvb = NULL;
......
...@@ -2,8 +2,8 @@ ...@@ -2,8 +2,8 @@
cx231xx-i2c.c - driver for Conexant Cx23100/101/102 USB video capture devices cx231xx-i2c.c - driver for Conexant Cx23100/101/102 USB video capture devices
Copyright (C) 2008 <srinivasa.deevi at conexant dot com> Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
Based on em28xx driver Based on em28xx driver
Based on Cx23885 driver Based on Cx23885 driver
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -42,8 +42,8 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]"); ...@@ -42,8 +42,8 @@ MODULE_PARM_DESC(i2c_debug, "enable debug messages [i2c]");
#define dprintk1(lvl, fmt, args...) \ #define dprintk1(lvl, fmt, args...) \
do { \ do { \
if (i2c_debug >= lvl) { \ if (i2c_debug >= lvl) { \
printk(fmt, ##args); \ printk(fmt, ##args); \
} \ } \
} while (0) } while (0)
#define dprintk2(lvl, fmt, args...) \ #define dprintk2(lvl, fmt, args...) \
...@@ -78,8 +78,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, ...@@ -78,8 +78,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap,
if (size == 2) { /* register write sub addr */ if (size == 2) { /* register write sub addr */
/* Just writing sub address will cause problem to XC5000 /* Just writing sub address will cause problem to XC5000
So ignore the request */ So ignore the request */
return 0; return 0;
} else if (size == 4) { /* register write with sub addr */ } else if (size == 4) { /* register write with sub addr */
...@@ -92,7 +92,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, ...@@ -92,7 +92,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap,
switch (saddr) { switch (saddr) {
case 0x0000: /* start tuner calibration mode */ case 0x0000: /* start tuner calibration mode */
need_gpio = 1; need_gpio = 1;
dev->xc_fw_load_done = 1; /* FW Loading is done */ /* FW Loading is done */
dev->xc_fw_load_done = 1;
break; break;
case 0x000D: /* Set signal source */ case 0x000D: /* Set signal source */
case 0x0001: /* Set TV standard - Video */ case 0x0001: /* Set TV standard - Video */
...@@ -108,8 +109,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap, ...@@ -108,8 +109,8 @@ int cx231xx_i2c_send_bytes(struct i2c_adapter *i2c_adap,
if (need_gpio) { if (need_gpio) {
dprintk1(1, dprintk1(1,
" GPIO W R I T E : addr 0x%x, len %d, saddr 0x%x\n", "GPIO WRITE: addr 0x%x, len %d, saddr 0x%x\n",
msg->addr, msg->len, saddr); msg->addr, msg->len, saddr);
return dev->cx231xx_gpio_i2c_write(dev, return dev->cx231xx_gpio_i2c_write(dev,
msg->addr, msg->addr,
...@@ -196,8 +197,8 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap, ...@@ -196,8 +197,8 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap,
switch (saddr) { switch (saddr) {
case 0x0009: /* BUSY check */ case 0x0009: /* BUSY check */
dprintk1(1, dprintk1(1,
" GPIO R E A D : Special case BUSY check \n"); "GPIO R E A D: Special case BUSY check \n");
/* Try to read BUSY register, just set it to zero */ /*Try read BUSY register, just set it to zero*/
msg->buf[0] = 0; msg->buf[0] = 0;
if (msg->len == 2) if (msg->len == 2)
msg->buf[1] = 0; msg->buf[1] = 0;
...@@ -209,12 +210,14 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap, ...@@ -209,12 +210,14 @@ static int cx231xx_i2c_recv_bytes(struct i2c_adapter *i2c_adap,
} }
if (need_gpio) { if (need_gpio) {
/* this is a special case to handle Xceive tuner clock stretch issue /* this is a special case to handle Xceive tuner
with gpio based I2C interface */ clock stretch issue with gpio based I2C */
dprintk1(1, dprintk1(1,
" GPIO R E A D : addr 0x%x, len %d, saddr 0x%x\n", "GPIO R E A D: addr 0x%x, len %d, saddr 0x%x\n",
msg->addr, msg->len, msg->addr, msg->len,
msg->buf[0] << 8 | msg->buf[1]); msg->buf[0] << 8 | msg->buf[1]);
status = status =
dev->cx231xx_gpio_i2c_write(dev, msg->addr, dev->cx231xx_gpio_i2c_write(dev, msg->addr,
msg->buf, msg->buf,
...@@ -281,8 +284,8 @@ static int cx231xx_i2c_recv_bytes_with_saddr(struct i2c_adapter *i2c_adap, ...@@ -281,8 +284,8 @@ static int cx231xx_i2c_recv_bytes_with_saddr(struct i2c_adapter *i2c_adap,
if ((msg2->len < 16)) { if ((msg2->len < 16)) {
dprintk1(1, dprintk1(1,
" i2c_read : addr 0x%x, len %d, subaddr 0x%x, leng %d\n", "i2c_read: addr 0x%x, len %d, saddr 0x%x, len %d\n",
msg2->addr, msg2->len, saddr, msg1->len); msg2->addr, msg2->len, saddr, msg1->len);
switch (saddr) { switch (saddr) {
case 0x0008: /* read FW load status */ case 0x0008: /* read FW load status */
...@@ -368,7 +371,8 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap, ...@@ -368,7 +371,8 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
dprintk2(2, "%s %s addr=%x len=%d:", dprintk2(2, "%s %s addr=%x len=%d:",
(msgs[i].flags & I2C_M_RD) ? "read" : "write", (msgs[i].flags & I2C_M_RD) ? "read" : "write",
i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len); i == num - 1 ? "stop" : "nonstop", addr, msgs[i].len);
if (!msgs[i].len) { /* no len: check only for device presence */ if (!msgs[i].len) {
/* no len: check only for device presence */
rc = cx231xx_i2c_check_for_device(i2c_adap, &msgs[i]); rc = cx231xx_i2c_check_for_device(i2c_adap, &msgs[i]);
if (rc < 0) { if (rc < 0) {
dprintk2(2, " no device\n"); dprintk2(2, " no device\n");
...@@ -409,7 +413,7 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap, ...@@ -409,7 +413,7 @@ static int cx231xx_i2c_xfer(struct i2c_adapter *i2c_adap,
} }
return num; return num;
err: err:
dprintk2(2, " ERROR: %i\n", rc); dprintk2(2, " ERROR: %i\n", rc);
return rc; return rc;
} }
......
...@@ -2,9 +2,9 @@ ...@@ -2,9 +2,9 @@
handle cx231xx IR remotes via linux kernel input layer. handle cx231xx IR remotes via linux kernel input layer.
Copyright (C) 2008 <srinivasa.deevi at conexant dot com> Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
Based on em28xx driver Based on em28xx driver
< This is a place holder for IR now.> < This is a place holder for IR now.>
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -219,10 +219,10 @@ int cx231xx_ir_init(struct cx231xx *dev) ...@@ -219,10 +219,10 @@ int cx231xx_ir_init(struct cx231xx *dev)
goto err_out_stop; goto err_out_stop;
return 0; return 0;
err_out_stop: err_out_stop:
cx231xx_ir_stop(ir); cx231xx_ir_stop(ir);
dev->ir = NULL; dev->ir = NULL;
err_out_free: err_out_free:
input_free_device(input_dev); input_free_device(input_dev);
kfree(ir); kfree(ir);
return err; return err;
......
/* /*
cx231xx-reg.h - driver for Conexant Cx23100/101/102 USB video capture devices cx231xx-reg.h - driver for Conexant Cx23100/101/102
USB video capture devices
Copyright (C) 2008 <srinivasa.deevi at conexant dot com> Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
...@@ -22,7 +23,7 @@ ...@@ -22,7 +23,7 @@
#define _CX231XX_REG_H #define _CX231XX_REG_H
/***************************************************************************** /*****************************************************************************
* VBI codes * * VBI codes *
*****************************************************************************/ *****************************************************************************/
#define SAV_ACTIVE_VIDEO_FIELD1 0x80 #define SAV_ACTIVE_VIDEO_FIELD1 0x80
...@@ -1533,13 +1534,13 @@ ...@@ -1533,13 +1534,13 @@
#define INPUT_MODE_YC2_2 2 /* INPUT_MODE_VALUE(2) */ #define INPUT_MODE_YC2_2 2 /* INPUT_MODE_VALUE(2) */
#define INPUT_MODE_YUV_3 3 /* INPUT_MODE_VALUE(3) */ #define INPUT_MODE_YUV_3 3 /* INPUT_MODE_VALUE(3) */
#define LUMA_LPF_LOW_BANDPASS 0 /* 0.6Mhz lowpass filter bandwidth */ #define LUMA_LPF_LOW_BANDPASS 0 /* 0.6Mhz LPF BW */
#define LUMA_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz lowpass filter bandwidth */ #define LUMA_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz LPF BW */
#define LUMA_LPF_HIGH_BANDPASS 2 /* 1.5Mhz lowpass filter bandwidth */ #define LUMA_LPF_HIGH_BANDPASS 2 /* 1.5Mhz LPF BW */
#define UV_LPF_LOW_BANDPASS 0 /* 0.6Mhz lowpass filter bandwidth */ #define UV_LPF_LOW_BANDPASS 0 /* 0.6Mhz LPF BW */
#define UV_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz lowpass filter bandwidth */ #define UV_LPF_MEDIUM_BANDPASS 1 /* 1.0Mhz LPF BW */
#define UV_LPF_HIGH_BANDPASS 2 /* 1.5Mhz lowpass filter bandwidth */ #define UV_LPF_HIGH_BANDPASS 2 /* 1.5Mhz LPF BW */
#define TWO_TAP_FILT 0 #define TWO_TAP_FILT 0
#define THREE_TAP_FILT 1 #define THREE_TAP_FILT 1
......
...@@ -140,23 +140,24 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb) ...@@ -140,23 +140,24 @@ static inline int cx231xx_isoc_vbi_copy(struct cx231xx *dev, struct urb *urb)
while (bytes_parsed < buffer_size) { while (bytes_parsed < buffer_size) {
u32 bytes_used = 0; u32 bytes_used = 0;
sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ sav_eav = cx231xx_find_next_SAV_EAV(
buffer_size - bytes_parsed, /* buffer size */ p_buffer + bytes_parsed, /* p_buffer */
&bytes_used); /* Receives bytes used to get SAV/EAV */ buffer_size - bytes_parsed, /* buffer size */
&bytes_used); /* bytes used to get SAV/EAV */
bytes_parsed += bytes_used; bytes_parsed += bytes_used;
sav_eav &= 0xF0; sav_eav &= 0xF0;
if (sav_eav && (bytes_parsed < buffer_size)) { if (sav_eav && (bytes_parsed < buffer_size)) {
bytes_parsed += cx231xx_get_vbi_line(dev, bytes_parsed += cx231xx_get_vbi_line(dev,
dma_q, sav_eav, /* SAV/EAV */ dma_q, sav_eav, /* SAV/EAV */
p_buffer + bytes_parsed, /* p_buffer */ p_buffer+bytes_parsed, /* p_buffer */
buffer_size - bytes_parsed); /* buffer size */ buffer_size-bytes_parsed);/*buf size*/
} }
} }
/* Save the last four bytes of the buffer so we can check the buffer boundary /* Save the last four bytes of the buffer so we can
condition next time */ check the buffer boundary condition next time */
memcpy(dma_q->partial_buf, p_buffer + buffer_size - 4, 4); memcpy(dma_q->partial_buf, p_buffer + buffer_size - 4, 4);
bytes_parsed = 0; bytes_parsed = 0;
} }
......
...@@ -2,7 +2,7 @@ ...@@ -2,7 +2,7 @@
cx231xx_vbi.h - driver for Conexant Cx23100/101/102 USB video capture devices cx231xx_vbi.h - driver for Conexant Cx23100/101/102 USB video capture devices
Copyright (C) 2008 <srinivasa.deevi at conexant dot com> Copyright (C) 2008 <srinivasa.deevi at conexant dot com>
Based on cx88 driver Based on cx88 driver
This program is free software; you can redistribute it and/or modify This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by it under the terms of the GNU General Public License as published by
...@@ -24,16 +24,16 @@ ...@@ -24,16 +24,16 @@
extern struct videobuf_queue_ops cx231xx_vbi_qops; extern struct videobuf_queue_ops cx231xx_vbi_qops;
#define NTSC_VBI_START_LINE 10 /* line 10 - 21 */ #define NTSC_VBI_START_LINE 10 /* line 10 - 21 */
#define NTSC_VBI_END_LINE 21 #define NTSC_VBI_END_LINE 21
#define NTSC_VBI_LINES (NTSC_VBI_END_LINE - NTSC_VBI_START_LINE + 1) #define NTSC_VBI_LINES (NTSC_VBI_END_LINE-NTSC_VBI_START_LINE+1)
#define PAL_VBI_START_LINE 6 #define PAL_VBI_START_LINE 6
#define PAL_VBI_END_LINE 23 #define PAL_VBI_END_LINE 23
#define PAL_VBI_LINES (PAL_VBI_END_LINE - PAL_VBI_START_LINE + 1) #define PAL_VBI_LINES (PAL_VBI_END_LINE-PAL_VBI_START_LINE+1)
#define VBI_STRIDE 1440 #define VBI_STRIDE 1440
#define VBI_SAMPLES_PER_LINE 1440 #define VBI_SAMPLES_PER_LINE 1440
#define CX231XX_NUM_VBI_PACKETS 4 #define CX231XX_NUM_VBI_PACKETS 4
#define CX231XX_NUM_VBI_BUFS 5 #define CX231XX_NUM_VBI_BUFS 5
...@@ -41,21 +41,23 @@ extern struct videobuf_queue_ops cx231xx_vbi_qops; ...@@ -41,21 +41,23 @@ extern struct videobuf_queue_ops cx231xx_vbi_qops;
/* stream functions */ /* stream functions */
int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets, int cx231xx_init_vbi_isoc(struct cx231xx *dev, int max_packets,
int num_bufs, int max_pkt_size, int num_bufs, int max_pkt_size,
int (*isoc_copy) (struct cx231xx * dev, int (*isoc_copy) (struct cx231xx *dev,
struct urb * urb)); struct urb *urb));
void cx231xx_uninit_vbi_isoc(struct cx231xx *dev); void cx231xx_uninit_vbi_isoc(struct cx231xx *dev);
/* vbi data copy functions */ /* vbi data copy functions */
u32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, u32 cx231xx_get_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 sav_eav, u8 * p_buffer, u32 buffer_size); u8 sav_eav, u8 *p_buffer, u32 buffer_size);
u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, u32 cx231xx_copy_vbi_line(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_line, u32 length, int field_number); u8 *p_line, u32 length, int field_number);
void cx231xx_reset_vbi_buffer(struct cx231xx *dev, void cx231xx_reset_vbi_buffer(struct cx231xx *dev,
struct cx231xx_dmaqueue *dma_q); struct cx231xx_dmaqueue *dma_q);
int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q, int cx231xx_do_vbi_copy(struct cx231xx *dev, struct cx231xx_dmaqueue *dma_q,
u8 * p_buffer, u32 bytes_to_copy); u8 *p_buffer, u32 bytes_to_copy);
u8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev, u8 cx231xx_is_vbi_buffer_done(struct cx231xx *dev,
struct cx231xx_dmaqueue *dma_q); struct cx231xx_dmaqueue *dma_q);
......
...@@ -365,10 +365,11 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) ...@@ -365,10 +365,11 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb)
bytes_parsed = 0; bytes_parsed = 0;
if (dma_q->is_partial_line) { if (dma_q->is_partial_line) {
/* Handle the case where we were working on a partial line */ /* Handle the case of a partial line */
sav_eav = dma_q->last_sav; sav_eav = dma_q->last_sav;
} else { } else {
/* Check for a SAV/EAV overlapping the buffer boundary */ /* Check for a SAV/EAV overlapping
the buffer boundary */
sav_eav = sav_eav =
cx231xx_find_boundary_SAV_EAV(p_buffer, cx231xx_find_boundary_SAV_EAV(p_buffer,
dma_q->partial_buf, dma_q->partial_buf,
...@@ -380,9 +381,9 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) ...@@ -380,9 +381,9 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb)
the last buffer or a partial line */ the last buffer or a partial line */
if (sav_eav) { if (sav_eav) {
bytes_parsed += cx231xx_get_video_line(dev, dma_q, bytes_parsed += cx231xx_get_video_line(dev, dma_q,
sav_eav, /* SAV/EAV */ sav_eav, /* SAV/EAV */
p_buffer + bytes_parsed, /* p_buffer */ p_buffer + bytes_parsed, /* p_buffer */
buffer_size - bytes_parsed); /* buffer size */ buffer_size - bytes_parsed);/* buf size */
} }
/* Now parse data that is completely in this buffer */ /* Now parse data that is completely in this buffer */
...@@ -391,18 +392,19 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb) ...@@ -391,18 +392,19 @@ static inline int cx231xx_isoc_copy(struct cx231xx *dev, struct urb *urb)
while (bytes_parsed < buffer_size) { while (bytes_parsed < buffer_size) {
u32 bytes_used = 0; u32 bytes_used = 0;
sav_eav = cx231xx_find_next_SAV_EAV(p_buffer + bytes_parsed, /* p_buffer */ sav_eav = cx231xx_find_next_SAV_EAV(
buffer_size - bytes_parsed, /* buffer size */ p_buffer + bytes_parsed, /* p_buffer */
&bytes_used); /* Receives bytes used to get SAV/EAV */ buffer_size - bytes_parsed, /* buf size */
&bytes_used);/* bytes used to get SAV/EAV */
bytes_parsed += bytes_used; bytes_parsed += bytes_used;
sav_eav &= 0xF0; sav_eav &= 0xF0;
if (sav_eav && (bytes_parsed < buffer_size)) { if (sav_eav && (bytes_parsed < buffer_size)) {
bytes_parsed += cx231xx_get_video_line(dev, bytes_parsed += cx231xx_get_video_line(dev,
dma_q, sav_eav, /* SAV/EAV */ dma_q, sav_eav, /* SAV/EAV */
p_buffer + bytes_parsed, /* p_buffer */ p_buffer + bytes_parsed,/* p_buffer */
buffer_size - bytes_parsed); /* buffer size */ buffer_size - bytes_parsed);/*buf size*/
} }
} }
...@@ -1398,9 +1400,11 @@ static int vidioc_s_frequency(struct file *file, void *priv, ...@@ -1398,9 +1400,11 @@ static int vidioc_s_frequency(struct file *file, void *priv,
#ifdef CONFIG_VIDEO_ADV_DEBUG #ifdef CONFIG_VIDEO_ADV_DEBUG
/* /*
-R, --list-registers=type=<host/i2cdrv/i2caddr>,chip=<chip>[,min=<addr>,max=<addr>] -R, --list-registers=type=<host/i2cdrv/i2caddr>,
chip=<chip>[,min=<addr>,max=<addr>]
dump registers from <min> to <max> [VIDIOC_DBG_G_REGISTER] dump registers from <min> to <max> [VIDIOC_DBG_G_REGISTER]
-r, --set-register=type=<host/i2cdrv/i2caddr>,chip=<chip>,reg=<addr>,val=<val> -r, --set-register=type=<host/i2cdrv/i2caddr>,
chip=<chip>,reg=<addr>,val=<val>
set the register [VIDIOC_DBG_S_REGISTER] set the register [VIDIOC_DBG_S_REGISTER]
if type == host, then <chip> is the hosts chip ID (default 0) if type == host, then <chip> is the hosts chip ID (default 0)
...@@ -2332,8 +2336,9 @@ static struct video_device cx231xx_radio_template = { ...@@ -2332,8 +2336,9 @@ static struct video_device cx231xx_radio_template = {
/******************************** usb interface ******************************/ /******************************** usb interface ******************************/
static struct video_device *cx231xx_vdev_init(struct cx231xx *dev, const struct video_device static struct video_device *cx231xx_vdev_init(struct cx231xx *dev,
*template, const char *type_name) const struct video_device
*template, const char *type_name)
{ {
struct video_device *vfd; struct video_device *vfd;
......
...@@ -29,7 +29,8 @@ ...@@ -29,7 +29,8 @@
#include <linux/i2c-algo-bit.h> #include <linux/i2c-algo-bit.h>
#include <linux/mutex.h> #include <linux/mutex.h>
#include <media/ir-kbd-i2c.h> #include <media/ir-kbd-i2c.h>
#if defined(CONFIG_VIDEO_CX231XX_DVB) || defined(CONFIG_VIDEO_CX231XX_DVB_MODULE) #if defined(CONFIG_VIDEO_CX231XX_DVB) || \
defined(CONFIG_VIDEO_CX231XX_DVB_MODULE)
#include <media/videobuf-dvb.h> #include <media/videobuf-dvb.h>
#endif #endif
...@@ -87,7 +88,8 @@ ...@@ -87,7 +88,8 @@
#define CX231XX_INTERLACED_DEFAULT 1 #define CX231XX_INTERLACED_DEFAULT 1
/* time to wait when stopping the isoc transfer */ /* time to wait when stopping the isoc transfer */
#define CX231XX_URB_TIMEOUT msecs_to_jiffies(CX231XX_NUM_BUFS * CX231XX_NUM_PACKETS) #define CX231XX_URB_TIMEOUT \
msecs_to_jiffies(CX231XX_NUM_BUFS * CX231XX_NUM_PACKETS)
enum cx231xx_mode { enum cx231xx_mode {
CX231XX_SUSPEND, CX231XX_SUSPEND,
...@@ -231,12 +233,12 @@ enum cx231xx_decoder { ...@@ -231,12 +233,12 @@ enum cx231xx_decoder {
CX231XX_AVDECODER CX231XX_AVDECODER
}; };
typedef enum _I2C_MASTER_PORT { enum CX231XX_I2C_MASTER_PORT {
I2C_0 = 0, I2C_0 = 0,
I2C_1 = 1, I2C_1 = 1,
I2C_2 = 2, I2C_2 = 2,
I2C_3 = 3 I2C_3 = 3
} CX231XX_I2C_MASTER_PORT; };
struct cx231xx_board { struct cx231xx_board {
char *name; char *name;
...@@ -346,16 +348,20 @@ struct cx231xx_fh { ...@@ -346,16 +348,20 @@ struct cx231xx_fh {
enum v4l2_buf_type type; enum v4l2_buf_type type;
}; };
/**********************************************************************************/ /*****************************************************************/
/* set/get i2c */ /* set/get i2c */
#define I2C_SPEED_1M 0x0 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */
#define I2C_SPEED_400K 0x1 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ #define I2C_SPEED_1M 0x0
#define I2C_SPEED_100K 0x2 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ #define I2C_SPEED_400K 0x1
#define I2C_SPEED_5M 0x3 /* 00--1Mb/s, 01-400kb/s, 10--100kb/s, 11--5Mb/s */ #define I2C_SPEED_100K 0x2
#define I2C_SPEED_5M 0x3
#define I2C_STOP 0x0 /* 0-- STOP transaction */
#define I2C_NOSTOP 0x1 /* 1-- do not transmit STOP at end of transaction */ /* 0-- STOP transaction */
#define I2C_SYNC 0x1 /* 1--alllow slave to insert clock wait states */ #define I2C_STOP 0x0
/* 1-- do not transmit STOP at end of transaction */
#define I2C_NOSTOP 0x1
/* 1--alllow slave to insert clock wait states */
#define I2C_SYNC 0x1
struct cx231xx_i2c { struct cx231xx_i2c {
struct cx231xx *dev; struct cx231xx *dev;
...@@ -383,7 +389,7 @@ struct cx231xx_i2c_xfer_data { ...@@ -383,7 +389,7 @@ struct cx231xx_i2c_xfer_data {
u8 *p_buffer; /* pointer to the buffer */ u8 *p_buffer; /* pointer to the buffer */
}; };
typedef struct _VENDOR_REQUEST_IN { struct VENDOR_REQUEST_IN{
u8 bRequest; u8 bRequest;
u16 wValue; u16 wValue;
u16 wIndex; u16 wIndex;
...@@ -391,7 +397,7 @@ typedef struct _VENDOR_REQUEST_IN { ...@@ -391,7 +397,7 @@ typedef struct _VENDOR_REQUEST_IN {
u8 direction; u8 direction;
u8 bData; u8 bData;
u8 *pBuff; u8 *pBuff;
} VENDOR_REQUEST_IN, *PVENDOR_REQUEST_IN; };
struct cx231xx_ctrl { struct cx231xx_ctrl {
struct v4l2_queryctrl v; struct v4l2_queryctrl v;
...@@ -401,7 +407,7 @@ struct cx231xx_ctrl { ...@@ -401,7 +407,7 @@ struct cx231xx_ctrl {
u32 shift; u32 shift;
}; };
typedef enum { enum TRANSFER_TYPE{
Raw_Video = 0, Raw_Video = 0,
Audio, Audio,
Vbi, /* VANC */ Vbi, /* VANC */
...@@ -409,7 +415,7 @@ typedef enum { ...@@ -409,7 +415,7 @@ typedef enum {
TS1_serial_mode, TS1_serial_mode,
TS2, TS2,
TS1_parallel_mode TS1_parallel_mode
} TRANSFER_TYPE; } ;
struct cx231xx_video_mode { struct cx231xx_video_mode {
/* Isoc control struct */ /* Isoc control struct */
...@@ -500,7 +506,7 @@ struct cx231xx { ...@@ -500,7 +506,7 @@ struct cx231xx {
int (*cx231xx_write_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg, int (*cx231xx_write_ctrl_reg) (struct cx231xx *dev, u8 req, u16 reg,
char *buf, int len); char *buf, int len);
int (*cx231xx_send_usb_command) (struct cx231xx_i2c *i2c_bus, int (*cx231xx_send_usb_command) (struct cx231xx_i2c *i2c_bus,
struct cx231xx_i2c_xfer_data *req_data); struct cx231xx_i2c_xfer_data *req_data);
int (*cx231xx_gpio_i2c_read) (struct cx231xx *dev, u8 dev_addr, int (*cx231xx_gpio_i2c_read) (struct cx231xx *dev, u8 dev_addr,
u8 *buf, u8 len); u8 *buf, u8 len);
int (*cx231xx_gpio_i2c_write) (struct cx231xx *dev, u8 dev_addr, int (*cx231xx_gpio_i2c_write) (struct cx231xx *dev, u8 dev_addr,
...@@ -621,9 +627,10 @@ int cx231xx_write_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg, ...@@ -621,9 +627,10 @@ int cx231xx_write_ctrl_reg(struct cx231xx *dev, u8 req, u16 reg,
char *buf, int len); char *buf, int len);
int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode); int cx231xx_mode_register(struct cx231xx *dev, u16 address, u32 mode);
int cx231xx_send_vendor_cmd(struct cx231xx *dev, VENDOR_REQUEST_IN *ven_req); int cx231xx_send_vendor_cmd(struct cx231xx *dev,
struct VENDOR_REQUEST_IN *ven_req);
int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus, int cx231xx_send_usb_command(struct cx231xx_i2c *i2c_bus,
struct cx231xx_i2c_xfer_data *req_data); struct cx231xx_i2c_xfer_data *req_data);
/* Gpio related functions */ /* Gpio related functions */
int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val, int cx231xx_send_gpio_cmd(struct cx231xx *dev, u32 gpio_bit, u8 *gpio_val,
......
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