Commit 68a13be8 authored by Mark W. McClelland's avatar Mark W. McClelland Committed by Greg Kroah-Hartman

[PATCH] USB: ov511 1.61 for 2.5.25

Update ov511 driver to version 1.61:

- Remove kernel I2C support and related TV tuner code. It will
  be reimplemented correctly in the 2.x driver series
- Fix warnings when compiling without procfs support
- Fix reg_r() debug message (was printing wrong values)
- Fix printing of hex values
- Fix bogus error handling in ov51x_v4l_open()
- Improve definition of unit_video module param
- Eliminate trailing whitespace, and other code cleanups
- Remove documentation of obsolete module params
parent 7fc26a9e
...@@ -128,16 +128,6 @@ MODULE PARAMETERS: ...@@ -128,16 +128,6 @@ MODULE PARAMETERS:
programs that expect RGB data (e.g. gqcam) to work with this driver. If programs that expect RGB data (e.g. gqcam) to work with this driver. If
your colors look VERY wrong, you may want to change this. your colors look VERY wrong, you may want to change this.
NAME: buf_timeout (Temporarily disabled. Memory is deallocated immediately)
TYPE: integer
DEFAULT: 5 (seconds)
DESC: Number of seconds before unused frame buffers are deallocated.
Previously, memory was allocated upon open() and deallocated upon
close(). Deallocation now occurs only if the driver is closed and this
timeout is reached. If you are capturing frames less frequently than
the default timeout, increase this. This will not make any difference
with programs that capture multiple frames during an open/close cycle.
NAME: cams NAME: cams
TYPE: integer (1-4 for OV511, 1-31 for OV511+) TYPE: integer (1-4 for OV511, 1-31 for OV511+)
DEFAULT: 1 DEFAULT: 1
...@@ -161,13 +151,6 @@ MODULE PARAMETERS: ...@@ -161,13 +151,6 @@ MODULE PARAMETERS:
DESC: This configures the camera's sensor to transmit a colored test-pattern DESC: This configures the camera's sensor to transmit a colored test-pattern
instead of an image. This does not work correctly yet. instead of an image. This does not work correctly yet.
NAME: sensor_gbr (*** TEMPORARILY DISABLED ***)
TYPE: integer (Boolean)
DEFAULT: 0
DESC: This makes the sensor output GBR422 instead of YUV420. This saves the
driver the trouble of converting YUV to RGB, but it currently does not
work very well (the colors are not quite right)
NAME: dumppix NAME: dumppix
TYPE: integer (0-2) TYPE: integer (0-2)
DEFAULT: 0 DEFAULT: 0
...@@ -259,14 +242,6 @@ MODULE PARAMETERS: ...@@ -259,14 +242,6 @@ MODULE PARAMETERS:
13 VIDEO_PALETTE_YUV422P (YUV 4:2:2 Planar) 13 VIDEO_PALETTE_YUV422P (YUV 4:2:2 Planar)
15 VIDEO_PALETTE_YUV420P (YUV 4:2:0 Planar, same as 10) 15 VIDEO_PALETTE_YUV420P (YUV 4:2:0 Planar, same as 10)
NAME: tuner
TYPE: integer
DEFAULT: -1 (autodetect)
DESC: This sets the exact type of the tuner module in a device. This is set
automatically based on the custom ID of the OV511 device. In cases
where this fails, you can override this auto-detection. Please see
linux/drivers/media/video/tuner.h for a complete list.
NAME: backlight NAME: backlight
TYPE: integer (Boolean) TYPE: integer (Boolean)
DEFAULT: 0 (off) DEFAULT: 0 (off)
......
...@@ -9,7 +9,6 @@ ...@@ -9,7 +9,6 @@
* OV7620 fixes by Charl P. Botha <cpbotha@ieee.org> * OV7620 fixes by Charl P. Botha <cpbotha@ieee.org>
* Changes by Claudio Matsuoka <claudio@conectiva.com> * Changes by Claudio Matsuoka <claudio@conectiva.com>
* Original SAA7111A code by Dave Perks <dperks@ibm.net> * Original SAA7111A code by Dave Perks <dperks@ibm.net>
* Kernel I2C interface adapted from nt1003 driver
* URB error messages from pwc driver by Nemosoft * URB error messages from pwc driver by Nemosoft
* generic_ioctl() code from videodev.c by Gerd Knorr and Alan Cox * generic_ioctl() code from videodev.c by Gerd Knorr and Alan Cox
* Memory management (rvmalloc) code from bttv driver, by Gerd Knorr and others * Memory management (rvmalloc) code from bttv driver, by Gerd Knorr and others
...@@ -61,7 +60,7 @@ ...@@ -61,7 +60,7 @@
/* /*
* Version Information * Version Information
*/ */
#define DRIVER_VERSION "v1.60a for Linux 2.5" #define DRIVER_VERSION "v1.61 for Linux 2.5"
#define EMAIL "mmcclell@bigfoot.com" #define EMAIL "mmcclell@bigfoot.com"
#define DRIVER_AUTHOR "Mark McClelland <mmcclell@bigfoot.com> & Bret Wallach \ #define DRIVER_AUTHOR "Mark McClelland <mmcclell@bigfoot.com> & Bret Wallach \
& Orion Sky Lawlor <olawlor@acm.org> & Kevin Moore & Charl P. Botha \ & Orion Sky Lawlor <olawlor@acm.org> & Kevin Moore & Charl P. Botha \
...@@ -72,7 +71,6 @@ ...@@ -72,7 +71,6 @@
#define ENABLE_Y_QUANTABLE 1 #define ENABLE_Y_QUANTABLE 1
#define ENABLE_UV_QUANTABLE 1 #define ENABLE_UV_QUANTABLE 1
/* If you change this, you must also change the MODULE_PARM definition */
#define OV511_MAX_UNIT_VIDEO 16 #define OV511_MAX_UNIT_VIDEO 16
/* Pixel count * bytes per YUV420 pixel (1.5) */ /* Pixel count * bytes per YUV420 pixel (1.5) */
...@@ -127,7 +125,6 @@ static int framedrop = -1; ...@@ -127,7 +125,6 @@ static int framedrop = -1;
static int fastset; static int fastset;
static int force_palette; static int force_palette;
static int tuner = -1;
static int backlight; static int backlight;
static int unit_video[OV511_MAX_UNIT_VIDEO]; static int unit_video[OV511_MAX_UNIT_VIDEO];
static int remove_zeros; static int remove_zeros;
...@@ -194,11 +191,9 @@ MODULE_PARM(fastset, "i"); ...@@ -194,11 +191,9 @@ MODULE_PARM(fastset, "i");
MODULE_PARM_DESC(fastset, "Allows picture settings to take effect immediately"); MODULE_PARM_DESC(fastset, "Allows picture settings to take effect immediately");
MODULE_PARM(force_palette, "i"); MODULE_PARM(force_palette, "i");
MODULE_PARM_DESC(force_palette, "Force the palette to a specific value"); MODULE_PARM_DESC(force_palette, "Force the palette to a specific value");
MODULE_PARM(tuner, "i");
MODULE_PARM_DESC(tuner, "Set tuner type, if not autodetected");
MODULE_PARM(backlight, "i"); MODULE_PARM(backlight, "i");
MODULE_PARM_DESC(backlight, "For objects that are lit from behind"); MODULE_PARM_DESC(backlight, "For objects that are lit from behind");
MODULE_PARM(unit_video, "0-16i"); MODULE_PARM(unit_video, "1-" __MODULE_STRING(OV511_MAX_UNIT_VIDEO) "i");
MODULE_PARM_DESC(unit_video, MODULE_PARM_DESC(unit_video,
"Force use of specific minor number(s). 0 is not allowed."); "Force use of specific minor number(s). 0 is not allowed.");
MODULE_PARM(remove_zeros, "i"); MODULE_PARM(remove_zeros, "i");
...@@ -337,12 +332,14 @@ static struct symbolic_list urb_errlist[] = { ...@@ -337,12 +332,14 @@ static struct symbolic_list urb_errlist[] = {
**********************************************************************/ **********************************************************************/
static void ov51x_clear_snapshot(struct usb_ov511 *); static void ov51x_clear_snapshot(struct usb_ov511 *);
static int ov51x_check_snapshot(struct usb_ov511 *); static inline int sensor_get_picture(struct usb_ov511 *,
static inline int sensor_get_picture(struct usb_ov511 *,
struct video_picture *); struct video_picture *);
#if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS)
static int sensor_get_exposure(struct usb_ov511 *, unsigned char *); static int sensor_get_exposure(struct usb_ov511 *, unsigned char *);
static int ov51x_control_ioctl(struct inode *, struct file *, unsigned int, static int ov51x_control_ioctl(struct inode *, struct file *, unsigned int,
unsigned long); unsigned long);
static int ov51x_check_snapshot(struct usb_ov511 *);
#endif
/********************************************************************** /**********************************************************************
* Memory management * Memory management
...@@ -351,7 +348,7 @@ static int ov51x_control_ioctl(struct inode *, struct file *, unsigned int, ...@@ -351,7 +348,7 @@ static int ov51x_control_ioctl(struct inode *, struct file *, unsigned int,
/* Here we want the physical address of the memory. /* Here we want the physical address of the memory.
* This is used when initializing the contents of the area. * This is used when initializing the contents of the area.
*/ */
static inline unsigned long static inline unsigned long
kvirt_to_pa(unsigned long adr) kvirt_to_pa(unsigned long adr)
{ {
unsigned long kva, ret; unsigned long kva, ret;
...@@ -384,7 +381,7 @@ rvmalloc(unsigned long size) ...@@ -384,7 +381,7 @@ rvmalloc(unsigned long size)
return mem; return mem;
} }
static void static void
rvfree(void *mem, unsigned long size) rvfree(void *mem, unsigned long size)
{ {
unsigned long adr; unsigned long adr;
...@@ -418,7 +415,7 @@ static struct file_operations ov511_control_fops = { ...@@ -418,7 +415,7 @@ static struct file_operations ov511_control_fops = {
#define YES_NO(x) ((x) ? "yes" : "no") #define YES_NO(x) ((x) ? "yes" : "no")
/* /proc/video/ov511/<minor#>/info */ /* /proc/video/ov511/<minor#>/info */
static int static int
ov511_read_proc_info(char *page, char **start, off_t off, int count, int *eof, ov511_read_proc_info(char *page, char **start, off_t off, int count, int *eof,
void *data) void *data)
{ {
...@@ -490,13 +487,13 @@ ov511_read_proc_info(char *page, char **start, off_t off, int count, int *eof, ...@@ -490,13 +487,13 @@ ov511_read_proc_info(char *page, char **start, off_t off, int count, int *eof,
* When the camera's button is pressed, the output of this will change from a * When the camera's button is pressed, the output of this will change from a
* 0 to a 1 (ASCII). It will retain this value until it is read, after which * 0 to a 1 (ASCII). It will retain this value until it is read, after which
* it will reset to zero. * it will reset to zero.
* *
* SECURITY NOTE: Since reading this file can change the state of the snapshot * SECURITY NOTE: Since reading this file can change the state of the snapshot
* status, it is important for applications that open it to keep it locked * status, it is important for applications that open it to keep it locked
* against access by other processes, using flock() or a similar mechanism. No * against access by other processes, using flock() or a similar mechanism. No
* locking is provided by this driver. * locking is provided by this driver.
*/ */
static int static int
ov511_read_proc_button(char *page, char **start, off_t off, int count, int *eof, ov511_read_proc_button(char *page, char **start, off_t off, int count, int *eof,
void *data) void *data)
{ {
...@@ -528,7 +525,7 @@ ov511_read_proc_button(char *page, char **start, off_t off, int count, int *eof, ...@@ -528,7 +525,7 @@ ov511_read_proc_button(char *page, char **start, off_t off, int count, int *eof,
return len; return len;
} }
static void static void
create_proc_ov511_cam(struct usb_ov511 *ov) create_proc_ov511_cam(struct usb_ov511 *ov)
{ {
char dirname[10]; char dirname[10];
...@@ -579,11 +576,11 @@ create_proc_ov511_cam(struct usb_ov511 *ov) ...@@ -579,11 +576,11 @@ create_proc_ov511_cam(struct usb_ov511 *ov)
unlock_kernel(); unlock_kernel();
} }
static void static void
destroy_proc_ov511_cam(struct usb_ov511 *ov) destroy_proc_ov511_cam(struct usb_ov511 *ov)
{ {
char dirname[10]; char dirname[10];
if (!ov || !ov->proc_devdir) if (!ov || !ov->proc_devdir)
return; return;
...@@ -616,7 +613,7 @@ destroy_proc_ov511_cam(struct usb_ov511 *ov) ...@@ -616,7 +613,7 @@ destroy_proc_ov511_cam(struct usb_ov511 *ov)
ov->proc_devdir = NULL; ov->proc_devdir = NULL;
} }
static void static void
proc_ov511_create(void) proc_ov511_create(void)
{ {
/* No current standard here. Alan prefers /proc/video/ as it keeps /* No current standard here. Alan prefers /proc/video/ as it keeps
...@@ -637,7 +634,7 @@ proc_ov511_create(void) ...@@ -637,7 +634,7 @@ proc_ov511_create(void)
err("Unable to create /proc/video/ov511"); err("Unable to create /proc/video/ov511");
} }
static void static void
proc_ov511_destroy(void) proc_ov511_destroy(void)
{ {
PDEBUG(3, "removing /proc/video/ov511"); PDEBUG(3, "removing /proc/video/ov511");
...@@ -656,7 +653,7 @@ proc_ov511_destroy(void) ...@@ -656,7 +653,7 @@ proc_ov511_destroy(void)
**********************************************************************/ **********************************************************************/
/* Write an OV51x register */ /* Write an OV51x register */
static int static int
reg_w(struct usb_ov511 *ov, unsigned char reg, unsigned char value) reg_w(struct usb_ov511 *ov, unsigned char reg, unsigned char value)
{ {
int rc; int rc;
...@@ -669,7 +666,7 @@ reg_w(struct usb_ov511 *ov, unsigned char reg, unsigned char value) ...@@ -669,7 +666,7 @@ reg_w(struct usb_ov511 *ov, unsigned char reg, unsigned char value)
usb_sndctrlpipe(ov->dev, 0), usb_sndctrlpipe(ov->dev, 0),
(ov->bclass == BCL_OV518)?1:2 /* REG_IO */, (ov->bclass == BCL_OV518)?1:2 /* REG_IO */,
USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, (__u16)reg, &ov->cbuf[0], 1, HZ); 0, (__u16)reg, &ov->cbuf[0], 1, HZ);
up(&ov->cbuf_lock); up(&ov->cbuf_lock);
if (rc < 0) if (rc < 0)
...@@ -680,7 +677,7 @@ reg_w(struct usb_ov511 *ov, unsigned char reg, unsigned char value) ...@@ -680,7 +677,7 @@ reg_w(struct usb_ov511 *ov, unsigned char reg, unsigned char value)
/* Read from an OV51x register */ /* Read from an OV51x register */
/* returns: negative is error, pos or zero is data */ /* returns: negative is error, pos or zero is data */
static int static int
reg_r(struct usb_ov511 *ov, unsigned char reg) reg_r(struct usb_ov511 *ov, unsigned char reg)
{ {
int rc; int rc;
...@@ -691,13 +688,13 @@ reg_r(struct usb_ov511 *ov, unsigned char reg) ...@@ -691,13 +688,13 @@ reg_r(struct usb_ov511 *ov, unsigned char reg)
(ov->bclass == BCL_OV518)?1:3 /* REG_IO */, (ov->bclass == BCL_OV518)?1:3 /* REG_IO */,
USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE, USB_DIR_IN | USB_TYPE_VENDOR | USB_RECIP_DEVICE,
0, (__u16)reg, &ov->cbuf[0], 1, HZ); 0, (__u16)reg, &ov->cbuf[0], 1, HZ);
PDEBUG(5, "0x%02X:0x%02X", reg, ov->cbuf[0]); if (rc < 0) {
if (rc < 0)
err("reg read: error %d: %s", rc, symbolic(urb_errlist, rc)); err("reg read: error %d: %s", rc, symbolic(urb_errlist, rc));
else } else {
rc = ov->cbuf[0]; rc = ov->cbuf[0];
PDEBUG(5, "0x%02X:0x%02X", reg, ov->cbuf[0]);
}
up(&ov->cbuf_lock); up(&ov->cbuf_lock);
...@@ -707,10 +704,10 @@ reg_r(struct usb_ov511 *ov, unsigned char reg) ...@@ -707,10 +704,10 @@ reg_r(struct usb_ov511 *ov, unsigned char reg)
/* /*
* Writes bits at positions specified by mask to an OV51x reg. Bits that are in * Writes bits at positions specified by mask to an OV51x reg. Bits that are in
* the same position as 1's in "mask" are cleared and set to "value". Bits * the same position as 1's in "mask" are cleared and set to "value". Bits
* that are in the same position as 0's in "mask" are preserved, regardless * that are in the same position as 0's in "mask" are preserved, regardless
* of their respective state in "value". * of their respective state in "value".
*/ */
static int static int
reg_w_mask(struct usb_ov511 *ov, reg_w_mask(struct usb_ov511 *ov,
unsigned char reg, unsigned char reg,
unsigned char value, unsigned char value,
...@@ -735,7 +732,7 @@ reg_w_mask(struct usb_ov511 *ov, ...@@ -735,7 +732,7 @@ reg_w_mask(struct usb_ov511 *ov,
* Writes multiple (n) byte value to a single register. Only valid with certain * Writes multiple (n) byte value to a single register. Only valid with certain
* registers (0x30 and 0xc4 - 0xce). * registers (0x30 and 0xc4 - 0xce).
*/ */
static int static int
ov518_reg_w32(struct usb_ov511 *ov, unsigned char reg, u32 val, int n) ov518_reg_w32(struct usb_ov511 *ov, unsigned char reg, u32 val, int n)
{ {
int rc; int rc;
...@@ -760,7 +757,7 @@ ov518_reg_w32(struct usb_ov511 *ov, unsigned char reg, u32 val, int n) ...@@ -760,7 +757,7 @@ ov518_reg_w32(struct usb_ov511 *ov, unsigned char reg, u32 val, int n)
return rc; return rc;
} }
static int static int
ov511_upload_quan_tables(struct usb_ov511 *ov) ov511_upload_quan_tables(struct usb_ov511 *ov)
{ {
unsigned char *pYTable = yQuanTable511; unsigned char *pYTable = yQuanTable511;
...@@ -770,10 +767,8 @@ ov511_upload_quan_tables(struct usb_ov511 *ov) ...@@ -770,10 +767,8 @@ ov511_upload_quan_tables(struct usb_ov511 *ov)
PDEBUG(4, "Uploading quantization tables"); PDEBUG(4, "Uploading quantization tables");
for (i = 0; i < OV511_QUANTABLESIZE / 2; i++) for (i = 0; i < OV511_QUANTABLESIZE / 2; i++) {
{ if (ENABLE_Y_QUANTABLE) {
if (ENABLE_Y_QUANTABLE)
{
val0 = *pYTable++; val0 = *pYTable++;
val1 = *pYTable++; val1 = *pYTable++;
val0 &= 0x0f; val0 &= 0x0f;
...@@ -784,8 +779,7 @@ ov511_upload_quan_tables(struct usb_ov511 *ov) ...@@ -784,8 +779,7 @@ ov511_upload_quan_tables(struct usb_ov511 *ov)
return rc; return rc;
} }
if (ENABLE_UV_QUANTABLE) if (ENABLE_UV_QUANTABLE) {
{
val0 = *pUVTable++; val0 = *pUVTable++;
val1 = *pUVTable++; val1 = *pUVTable++;
val0 &= 0x0f; val0 &= 0x0f;
...@@ -803,7 +797,7 @@ ov511_upload_quan_tables(struct usb_ov511 *ov) ...@@ -803,7 +797,7 @@ ov511_upload_quan_tables(struct usb_ov511 *ov)
} }
/* OV518 quantization tables are 8x4 (instead of 8x8) */ /* OV518 quantization tables are 8x4 (instead of 8x8) */
static int static int
ov518_upload_quan_tables(struct usb_ov511 *ov) ov518_upload_quan_tables(struct usb_ov511 *ov)
{ {
unsigned char *pYTable = yQuanTable518; unsigned char *pYTable = yQuanTable518;
...@@ -813,10 +807,8 @@ ov518_upload_quan_tables(struct usb_ov511 *ov) ...@@ -813,10 +807,8 @@ ov518_upload_quan_tables(struct usb_ov511 *ov)
PDEBUG(4, "Uploading quantization tables"); PDEBUG(4, "Uploading quantization tables");
for (i = 0; i < OV518_QUANTABLESIZE / 2; i++) for (i = 0; i < OV518_QUANTABLESIZE / 2; i++) {
{ if (ENABLE_Y_QUANTABLE) {
if (ENABLE_Y_QUANTABLE)
{
val0 = *pYTable++; val0 = *pYTable++;
val1 = *pYTable++; val1 = *pYTable++;
val0 &= 0x0f; val0 &= 0x0f;
...@@ -827,8 +819,7 @@ ov518_upload_quan_tables(struct usb_ov511 *ov) ...@@ -827,8 +819,7 @@ ov518_upload_quan_tables(struct usb_ov511 *ov)
return rc; return rc;
} }
if (ENABLE_UV_QUANTABLE) if (ENABLE_UV_QUANTABLE) {
{
val0 = *pUVTable++; val0 = *pUVTable++;
val1 = *pUVTable++; val1 = *pUVTable++;
val0 &= 0x0f; val0 &= 0x0f;
...@@ -845,16 +836,16 @@ ov518_upload_quan_tables(struct usb_ov511 *ov) ...@@ -845,16 +836,16 @@ ov518_upload_quan_tables(struct usb_ov511 *ov)
return 0; return 0;
} }
static int static int
ov51x_reset(struct usb_ov511 *ov, unsigned char reset_type) ov51x_reset(struct usb_ov511 *ov, unsigned char reset_type)
{ {
int rc; int rc;
/* Setting bit 0 not allowed on 518/518Plus */ /* Setting bit 0 not allowed on 518/518Plus */
if (ov->bclass == BCL_OV518) if (ov->bclass == BCL_OV518)
reset_type &= 0xfe; reset_type &= 0xfe;
PDEBUG(4, "Reset: type=0x%X", reset_type); PDEBUG(4, "Reset: type=0x%02X", reset_type);
rc = reg_w(ov, R51x_SYS_RESET, reset_type); rc = reg_w(ov, R51x_SYS_RESET, reset_type);
rc = reg_w(ov, R51x_SYS_RESET, 0); rc = reg_w(ov, R51x_SYS_RESET, 0);
...@@ -876,7 +867,7 @@ ov51x_reset(struct usb_ov511 *ov, unsigned char reset_type) ...@@ -876,7 +867,7 @@ ov51x_reset(struct usb_ov511 *ov, unsigned char reset_type)
* This is normally only called from i2c_w(). Note that this function * This is normally only called from i2c_w(). Note that this function
* always succeeds regardless of whether the sensor is present and working. * always succeeds regardless of whether the sensor is present and working.
*/ */
static int static int
ov518_i2c_write_internal(struct usb_ov511 *ov, ov518_i2c_write_internal(struct usb_ov511 *ov,
unsigned char reg, unsigned char reg,
unsigned char value) unsigned char value)
...@@ -901,7 +892,7 @@ ov518_i2c_write_internal(struct usb_ov511 *ov, ...@@ -901,7 +892,7 @@ ov518_i2c_write_internal(struct usb_ov511 *ov,
} }
/* NOTE: Do not call this function directly! */ /* NOTE: Do not call this function directly! */
static int static int
ov511_i2c_write_internal(struct usb_ov511 *ov, ov511_i2c_write_internal(struct usb_ov511 *ov,
unsigned char reg, unsigned char reg,
unsigned char value) unsigned char value)
...@@ -917,7 +908,7 @@ ov511_i2c_write_internal(struct usb_ov511 *ov, ...@@ -917,7 +908,7 @@ ov511_i2c_write_internal(struct usb_ov511 *ov,
if (rc < 0) return rc; if (rc < 0) return rc;
/* Write "value" to I2C data port of OV511 */ /* Write "value" to I2C data port of OV511 */
rc = reg_w(ov, R51x_I2C_DATA, value); rc = reg_w(ov, R51x_I2C_DATA, value);
if (rc < 0) return rc; if (rc < 0) return rc;
/* Initiate 3-byte write cycle */ /* Initiate 3-byte write cycle */
...@@ -931,7 +922,7 @@ ov511_i2c_write_internal(struct usb_ov511 *ov, ...@@ -931,7 +922,7 @@ ov511_i2c_write_internal(struct usb_ov511 *ov,
if ((rc&2) == 0) /* Ack? */ if ((rc&2) == 0) /* Ack? */
break; break;
#if 0 #if 0
/* I2C abort */ /* I2C abort */
reg_w(ov, R511_I2C_CTL, 0x10); reg_w(ov, R511_I2C_CTL, 0x10);
#endif #endif
if (--retries < 0) { if (--retries < 0) {
...@@ -948,7 +939,7 @@ ov511_i2c_write_internal(struct usb_ov511 *ov, ...@@ -948,7 +939,7 @@ ov511_i2c_write_internal(struct usb_ov511 *ov,
* This is normally only called from i2c_r(). Note that this function * This is normally only called from i2c_r(). Note that this function
* always succeeds regardless of whether the sensor is present and working. * always succeeds regardless of whether the sensor is present and working.
*/ */
static int static int
ov518_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg) ov518_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg)
{ {
int rc, value; int rc, value;
...@@ -974,7 +965,7 @@ ov518_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg) ...@@ -974,7 +965,7 @@ ov518_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg)
/* NOTE: Do not call this function directly! /* NOTE: Do not call this function directly!
* returns: negative is error, pos or zero is data */ * returns: negative is error, pos or zero is data */
static int static int
ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg) ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg)
{ {
int rc, value, retries; int rc, value, retries;
...@@ -996,7 +987,7 @@ ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg) ...@@ -996,7 +987,7 @@ ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg)
if ((rc&2) == 0) /* Ack? */ if ((rc&2) == 0) /* Ack? */
break; break;
/* I2C abort */ /* I2C abort */
reg_w(ov, R511_I2C_CTL, 0x10); reg_w(ov, R511_I2C_CTL, 0x10);
if (--retries < 0) { if (--retries < 0) {
...@@ -1018,7 +1009,7 @@ ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg) ...@@ -1018,7 +1009,7 @@ ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg)
if ((rc&2) == 0) /* Ack? */ if ((rc&2) == 0) /* Ack? */
break; break;
/* I2C abort */ /* I2C abort */
rc = reg_w(ov, R511_I2C_CTL, 0x10); rc = reg_w(ov, R511_I2C_CTL, 0x10);
if (rc < 0) return rc; if (rc < 0) return rc;
...@@ -1031,17 +1022,17 @@ ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg) ...@@ -1031,17 +1022,17 @@ ov511_i2c_read_internal(struct usb_ov511 *ov, unsigned char reg)
value = reg_r(ov, R51x_I2C_DATA); value = reg_r(ov, R51x_I2C_DATA);
PDEBUG(5, "0x%02X:0x%02X", reg, value); PDEBUG(5, "0x%02X:0x%02X", reg, value);
/* This is needed to make i2c_w() work */ /* This is needed to make i2c_w() work */
rc = reg_w(ov, R511_I2C_CTL, 0x05); rc = reg_w(ov, R511_I2C_CTL, 0x05);
if (rc < 0) if (rc < 0)
return rc; return rc;
return value; return value;
} }
/* returns: negative is error, pos or zero is data */ /* returns: negative is error, pos or zero is data */
static int static int
i2c_r(struct usb_ov511 *ov, unsigned char reg) i2c_r(struct usb_ov511 *ov, unsigned char reg)
{ {
int rc; int rc;
...@@ -1058,7 +1049,7 @@ i2c_r(struct usb_ov511 *ov, unsigned char reg) ...@@ -1058,7 +1049,7 @@ i2c_r(struct usb_ov511 *ov, unsigned char reg)
return rc; return rc;
} }
static int static int
i2c_w(struct usb_ov511 *ov, unsigned char reg, unsigned char value) i2c_w(struct usb_ov511 *ov, unsigned char reg, unsigned char value)
{ {
int rc; int rc;
...@@ -1076,7 +1067,7 @@ i2c_w(struct usb_ov511 *ov, unsigned char reg, unsigned char value) ...@@ -1076,7 +1067,7 @@ i2c_w(struct usb_ov511 *ov, unsigned char reg, unsigned char value)
} }
/* Do not call this function directly! */ /* Do not call this function directly! */
static int static int
ov51x_i2c_write_mask_internal(struct usb_ov511 *ov, ov51x_i2c_write_mask_internal(struct usb_ov511 *ov,
unsigned char reg, unsigned char reg,
unsigned char value, unsigned char value,
...@@ -1109,10 +1100,10 @@ ov51x_i2c_write_mask_internal(struct usb_ov511 *ov, ...@@ -1109,10 +1100,10 @@ ov51x_i2c_write_mask_internal(struct usb_ov511 *ov,
/* Writes bits at positions specified by mask to an I2C reg. Bits that are in /* Writes bits at positions specified by mask to an I2C reg. Bits that are in
* the same position as 1's in "mask" are cleared and set to "value". Bits * the same position as 1's in "mask" are cleared and set to "value". Bits
* that are in the same position as 0's in "mask" are preserved, regardless * that are in the same position as 0's in "mask" are preserved, regardless
* of their respective state in "value". * of their respective state in "value".
*/ */
static int static int
i2c_w_mask(struct usb_ov511 *ov, i2c_w_mask(struct usb_ov511 *ov,
unsigned char reg, unsigned char reg,
unsigned char value, unsigned char value,
...@@ -1132,7 +1123,7 @@ i2c_w_mask(struct usb_ov511 *ov, ...@@ -1132,7 +1123,7 @@ i2c_w_mask(struct usb_ov511 *ov,
* when calling this. This should not be called from outside the i2c I/O * when calling this. This should not be called from outside the i2c I/O
* functions. * functions.
*/ */
static inline int static inline int
i2c_set_slave_internal(struct usb_ov511 *ov, unsigned char slave) i2c_set_slave_internal(struct usb_ov511 *ov, unsigned char slave)
{ {
int rc; int rc;
...@@ -1146,8 +1137,10 @@ i2c_set_slave_internal(struct usb_ov511 *ov, unsigned char slave) ...@@ -1146,8 +1137,10 @@ i2c_set_slave_internal(struct usb_ov511 *ov, unsigned char slave)
return 0; return 0;
} }
#if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS)
/* Write to a specific I2C slave ID and register, using the specified mask */ /* Write to a specific I2C slave ID and register, using the specified mask */
static int static int
i2c_w_slave(struct usb_ov511 *ov, i2c_w_slave(struct usb_ov511 *ov,
unsigned char slave, unsigned char slave,
unsigned char reg, unsigned char reg,
...@@ -1166,7 +1159,7 @@ i2c_w_slave(struct usb_ov511 *ov, ...@@ -1166,7 +1159,7 @@ i2c_w_slave(struct usb_ov511 *ov,
out: out:
/* Restore primary IDs */ /* Restore primary IDs */
if (i2c_set_slave_internal(ov, ov->primary_i2c_slave) < 0) if (i2c_set_slave_internal(ov, ov->primary_i2c_slave) < 0)
err("Couldn't restore primary I2C slave"); err("Couldn't restore primary I2C slave");
up(&ov->i2c_lock); up(&ov->i2c_lock);
...@@ -1174,7 +1167,7 @@ i2c_w_slave(struct usb_ov511 *ov, ...@@ -1174,7 +1167,7 @@ i2c_w_slave(struct usb_ov511 *ov,
} }
/* Read from a specific I2C slave ID and register */ /* Read from a specific I2C slave ID and register */
static int static int
i2c_r_slave(struct usb_ov511 *ov, i2c_r_slave(struct usb_ov511 *ov,
unsigned char slave, unsigned char slave,
unsigned char reg) unsigned char reg)
...@@ -1194,15 +1187,17 @@ i2c_r_slave(struct usb_ov511 *ov, ...@@ -1194,15 +1187,17 @@ i2c_r_slave(struct usb_ov511 *ov,
out: out:
/* Restore primary IDs */ /* Restore primary IDs */
if (i2c_set_slave_internal(ov, ov->primary_i2c_slave) < 0) if (i2c_set_slave_internal(ov, ov->primary_i2c_slave) < 0)
err("Couldn't restore primary I2C slave"); err("Couldn't restore primary I2C slave");
up(&ov->i2c_lock); up(&ov->i2c_lock);
return rc; return rc;
} }
#endif /* defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS) */
/* Sets I2C read and write slave IDs. Returns <0 for error */ /* Sets I2C read and write slave IDs. Returns <0 for error */
static int static int
ov51x_set_slave_ids(struct usb_ov511 *ov, unsigned char sid) ov51x_set_slave_ids(struct usb_ov511 *ov, unsigned char sid)
{ {
int rc; int rc;
...@@ -1221,7 +1216,7 @@ ov51x_set_slave_ids(struct usb_ov511 *ov, unsigned char sid) ...@@ -1221,7 +1216,7 @@ ov51x_set_slave_ids(struct usb_ov511 *ov, unsigned char sid)
return rc; return rc;
} }
static int static int
write_regvals(struct usb_ov511 *ov, struct ov511_regvals * pRegvals) write_regvals(struct usb_ov511 *ov, struct ov511_regvals * pRegvals)
{ {
int rc; int rc;
...@@ -1242,8 +1237,8 @@ write_regvals(struct usb_ov511 *ov, struct ov511_regvals * pRegvals) ...@@ -1242,8 +1237,8 @@ write_regvals(struct usb_ov511 *ov, struct ov511_regvals * pRegvals)
return 0; return 0;
} }
#ifdef OV511_DEBUG #ifdef OV511_DEBUG
static void static void
dump_i2c_range(struct usb_ov511 *ov, int reg1, int regn) dump_i2c_range(struct usb_ov511 *ov, int reg1, int regn)
{ {
int i; int i;
...@@ -1251,18 +1246,18 @@ dump_i2c_range(struct usb_ov511 *ov, int reg1, int regn) ...@@ -1251,18 +1246,18 @@ dump_i2c_range(struct usb_ov511 *ov, int reg1, int regn)
for (i = reg1; i <= regn; i++) { for (i = reg1; i <= regn; i++) {
rc = i2c_r(ov, i); rc = i2c_r(ov, i);
info("Sensor[0x%X] = 0x%X", i, rc); info("Sensor[0x%02X] = 0x%02X", i, rc);
} }
} }
static void static void
dump_i2c_regs(struct usb_ov511 *ov) dump_i2c_regs(struct usb_ov511 *ov)
{ {
info("I2C REGS"); info("I2C REGS");
dump_i2c_range(ov, 0x00, 0x7C); dump_i2c_range(ov, 0x00, 0x7C);
} }
static void static void
dump_reg_range(struct usb_ov511 *ov, int reg1, int regn) dump_reg_range(struct usb_ov511 *ov, int reg1, int regn)
{ {
int i; int i;
...@@ -1270,12 +1265,12 @@ dump_reg_range(struct usb_ov511 *ov, int reg1, int regn) ...@@ -1270,12 +1265,12 @@ dump_reg_range(struct usb_ov511 *ov, int reg1, int regn)
for (i = reg1; i <= regn; i++) { for (i = reg1; i <= regn; i++) {
rc = reg_r(ov, i); rc = reg_r(ov, i);
info("OV511[0x%X] = 0x%X", i, rc); info("OV511[0x%02X] = 0x%02X", i, rc);
} }
} }
/* FIXME: Should there be an OV518 version of this? */ /* FIXME: Should there be an OV518 version of this? */
static void static void
ov511_dump_regs(struct usb_ov511 *ov) ov511_dump_regs(struct usb_ov511 *ov)
{ {
info("CAMERA INTERFACE REGS"); info("CAMERA INTERFACE REGS");
...@@ -1302,29 +1297,15 @@ ov511_dump_regs(struct usb_ov511 *ov) ...@@ -1302,29 +1297,15 @@ ov511_dump_regs(struct usb_ov511 *ov)
} }
#endif #endif
/**********************************************************************
*
* Kernel I2C Interface (not supported with OV518/OV518+)
*
**********************************************************************/
/* For as-yet unimplemented I2C interface */
static void
call_i2c_clients(struct usb_ov511 *ov, unsigned int cmd,
void *arg)
{
/* Do nothing */
}
/*****************************************************************************/ /*****************************************************************************/
/* Temporarily stops OV511 from functioning. Must do this before changing /* Temporarily stops OV511 from functioning. Must do this before changing
* registers while the camera is streaming */ * registers while the camera is streaming */
static inline int static inline int
ov51x_stop(struct usb_ov511 *ov) ov51x_stop(struct usb_ov511 *ov)
{ {
PDEBUG(4, "stopping"); PDEBUG(4, "stopping");
ov->stopped = 1; ov->stopped = 1;
if (ov->bclass == BCL_OV518) if (ov->bclass == BCL_OV518)
return (reg_w_mask(ov, R51x_SYS_RESET, 0x3a, 0x3a)); return (reg_w_mask(ov, R51x_SYS_RESET, 0x3a, 0x3a));
else else
...@@ -1333,12 +1314,12 @@ ov51x_stop(struct usb_ov511 *ov) ...@@ -1333,12 +1314,12 @@ ov51x_stop(struct usb_ov511 *ov)
/* Restarts OV511 after ov511_stop() is called. Has no effect if it is not /* Restarts OV511 after ov511_stop() is called. Has no effect if it is not
* actually stopped (for performance). */ * actually stopped (for performance). */
static inline int static inline int
ov51x_restart(struct usb_ov511 *ov) ov51x_restart(struct usb_ov511 *ov)
{ {
if (ov->stopped) { if (ov->stopped) {
PDEBUG(4, "restarting"); PDEBUG(4, "restarting");
ov->stopped = 0; ov->stopped = 0;
/* Reinitialize the stream */ /* Reinitialize the stream */
if (ov->bclass == BCL_OV518) if (ov->bclass == BCL_OV518)
...@@ -1351,7 +1332,7 @@ ov51x_restart(struct usb_ov511 *ov) ...@@ -1351,7 +1332,7 @@ ov51x_restart(struct usb_ov511 *ov)
} }
/* Resets the hardware snapshot button */ /* Resets the hardware snapshot button */
static void static void
ov51x_clear_snapshot(struct usb_ov511 *ov) ov51x_clear_snapshot(struct usb_ov511 *ov)
{ {
if (ov->bclass == BCL_OV511) { if (ov->bclass == BCL_OV511) {
...@@ -1363,12 +1344,12 @@ ov51x_clear_snapshot(struct usb_ov511 *ov) ...@@ -1363,12 +1344,12 @@ ov51x_clear_snapshot(struct usb_ov511 *ov)
} else { } else {
err("clear snap: invalid bridge type"); err("clear snap: invalid bridge type");
} }
} }
#if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS)
/* Checks the status of the snapshot button. Returns 1 if it was pressed since /* Checks the status of the snapshot button. Returns 1 if it was pressed since
* it was last cleared, and zero in all other cases (including errors) */ * it was last cleared, and zero in all other cases (including errors) */
static int static int
ov51x_check_snapshot(struct usb_ov511 *ov) ov51x_check_snapshot(struct usb_ov511 *ov)
{ {
int ret, status = 0; int ret, status = 0;
...@@ -1388,19 +1369,20 @@ ov51x_check_snapshot(struct usb_ov511 *ov) ...@@ -1388,19 +1369,20 @@ ov51x_check_snapshot(struct usb_ov511 *ov)
return status; return status;
} }
#endif
/* This does an initial reset of an OmniVision sensor and ensures that I2C /* This does an initial reset of an OmniVision sensor and ensures that I2C
* is synchronized. Returns <0 for failure. * is synchronized. Returns <0 for failure.
*/ */
static int static int
init_ov_sensor(struct usb_ov511 *ov) init_ov_sensor(struct usb_ov511 *ov)
{ {
int i, success; int i, success;
/* Reset the sensor */ /* Reset the sensor */
if (i2c_w(ov, 0x12, 0x80) < 0) return -EIO; if (i2c_w(ov, 0x12, 0x80) < 0) return -EIO;
/* Wait for it to initialize */ /* Wait for it to initialize */
schedule_timeout (1 + 150 * HZ / 1000); schedule_timeout (1 + 150 * HZ / 1000);
for (i = 0, success = 0; i < i2c_detect_tries && !success; i++) { for (i = 0, success = 0; i < i2c_detect_tries && !success; i++) {
...@@ -1410,9 +1392,9 @@ init_ov_sensor(struct usb_ov511 *ov) ...@@ -1410,9 +1392,9 @@ init_ov_sensor(struct usb_ov511 *ov)
continue; continue;
} }
/* Reset the sensor */ /* Reset the sensor */
if (i2c_w(ov, 0x12, 0x80) < 0) return -EIO; if (i2c_w(ov, 0x12, 0x80) < 0) return -EIO;
/* Wait for it to initialize */ /* Wait for it to initialize */
schedule_timeout(1 + 150 * HZ / 1000); schedule_timeout(1 + 150 * HZ / 1000);
/* Dummy read to sync I2C */ /* Dummy read to sync I2C */
if (i2c_r(ov, 0x00) < 0) return -EIO; if (i2c_r(ov, 0x00) < 0) return -EIO;
...@@ -1420,13 +1402,13 @@ init_ov_sensor(struct usb_ov511 *ov) ...@@ -1420,13 +1402,13 @@ init_ov_sensor(struct usb_ov511 *ov)
if (!success) if (!success)
return -EIO; return -EIO;
PDEBUG(1, "I2C synced in %d attempt(s)", i); PDEBUG(1, "I2C synced in %d attempt(s)", i);
return 0; return 0;
} }
static int static int
ov511_set_packet_size(struct usb_ov511 *ov, int size) ov511_set_packet_size(struct usb_ov511 *ov, int size)
{ {
int alt, mult; int alt, mult;
...@@ -1468,7 +1450,7 @@ ov511_set_packet_size(struct usb_ov511 *ov, int size) ...@@ -1468,7 +1450,7 @@ ov511_set_packet_size(struct usb_ov511 *ov, int size)
if (reg_w(ov, R51x_FIFO_PSIZE, mult) < 0) if (reg_w(ov, R51x_FIFO_PSIZE, mult) < 0)
return -EIO; return -EIO;
if (usb_set_interface(ov->dev, ov->iface, alt) < 0) { if (usb_set_interface(ov->dev, ov->iface, alt) < 0) {
err("Set packet size: set interface error"); err("Set packet size: set interface error");
return -EBUSY; return -EBUSY;
...@@ -1488,7 +1470,7 @@ ov511_set_packet_size(struct usb_ov511 *ov, int size) ...@@ -1488,7 +1470,7 @@ ov511_set_packet_size(struct usb_ov511 *ov, int size)
/* Note: Unlike the OV511/OV511+, the size argument does NOT include the /* Note: Unlike the OV511/OV511+, the size argument does NOT include the
* optional packet number byte. The actual size *is* stored in ov->packet_size, * optional packet number byte. The actual size *is* stored in ov->packet_size,
* though. */ * though. */
static int static int
ov518_set_packet_size(struct usb_ov511 *ov, int size) ov518_set_packet_size(struct usb_ov511 *ov, int size)
{ {
int alt; int alt;
...@@ -1550,7 +1532,6 @@ ov511_init_compression(struct usb_ov511 *ov) ...@@ -1550,7 +1532,6 @@ ov511_init_compression(struct usb_ov511 *ov)
int rc = 0; int rc = 0;
if (!ov->compress_inited) { if (!ov->compress_inited) {
reg_w(ov, 0x70, phy); reg_w(ov, 0x70, phy);
reg_w(ov, 0x71, phuv); reg_w(ov, 0x71, phuv);
reg_w(ov, 0x72, pvy); reg_w(ov, 0x72, pvy);
...@@ -1568,7 +1549,7 @@ ov511_init_compression(struct usb_ov511 *ov) ...@@ -1568,7 +1549,7 @@ ov511_init_compression(struct usb_ov511 *ov)
} }
ov->compress_inited = 1; ov->compress_inited = 1;
out: out:
return rc; return rc;
} }
...@@ -1579,7 +1560,6 @@ ov518_init_compression(struct usb_ov511 *ov) ...@@ -1579,7 +1560,6 @@ ov518_init_compression(struct usb_ov511 *ov)
int rc = 0; int rc = 0;
if (!ov->compress_inited) { if (!ov->compress_inited) {
if (ov518_upload_quan_tables(ov) < 0) { if (ov518_upload_quan_tables(ov) < 0) {
err("Error uploading quantization tables"); err("Error uploading quantization tables");
rc = -EIO; rc = -EIO;
...@@ -1588,7 +1568,7 @@ ov518_init_compression(struct usb_ov511 *ov) ...@@ -1588,7 +1568,7 @@ ov518_init_compression(struct usb_ov511 *ov)
} }
ov->compress_inited = 1; ov->compress_inited = 1;
out: out:
return rc; return rc;
} }
...@@ -2130,7 +2110,7 @@ sensor_get_exposure(struct usb_ov511 *ov, unsigned char *val) ...@@ -2130,7 +2110,7 @@ sensor_get_exposure(struct usb_ov511 *ov, unsigned char *val)
#endif /* CONFIG_PROC_FS && CONFIG_VIDEO_PROC_FS */ #endif /* CONFIG_PROC_FS && CONFIG_VIDEO_PROC_FS */
/* Turns on or off the LED. Only has an effect with OV511+/OV518(+) */ /* Turns on or off the LED. Only has an effect with OV511+/OV518(+) */
static inline void static inline void
ov51x_led_control(struct usb_ov511 *ov, int enable) ov51x_led_control(struct usb_ov511 *ov, int enable)
{ {
PDEBUG(4, " (%s)", enable ? "turn on" : "turn off"); PDEBUG(4, " (%s)", enable ? "turn on" : "turn off");
...@@ -2181,7 +2161,7 @@ sensor_set_light_freq(struct usb_ov511 *ov, int freq) ...@@ -2181,7 +2161,7 @@ sensor_set_light_freq(struct usb_ov511 *ov, int freq)
i2c_w_mask(ov, 0x2a, sixty?0x00:0x80, 0x80); i2c_w_mask(ov, 0x2a, sixty?0x00:0x80, 0x80);
i2c_w(ov, 0x2b, sixty?0x00:0xac); i2c_w(ov, 0x2b, sixty?0x00:0xac);
i2c_w_mask(ov, 0x76, 0x01, 0x01); i2c_w_mask(ov, 0x76, 0x01, 0x01);
break; break;
case SEN_OV6620: case SEN_OV6620:
case SEN_OV6630: case SEN_OV6630:
i2c_w(ov, 0x2b, sixty?0xa8:0x28); i2c_w(ov, 0x2b, sixty?0xa8:0x28);
...@@ -2269,7 +2249,7 @@ sensor_set_auto_brightness(struct usb_ov511 *ov, int enable) ...@@ -2269,7 +2249,7 @@ sensor_set_auto_brightness(struct usb_ov511 *ov, int enable)
*/ */
static inline int static inline int
sensor_set_auto_exposure(struct usb_ov511 *ov, int enable) sensor_set_auto_exposure(struct usb_ov511 *ov, int enable)
{ {
PDEBUG(4, " (%s)", enable ? "turn on" : "turn off"); PDEBUG(4, " (%s)", enable ? "turn on" : "turn off");
switch (ov->sensor) { switch (ov->sensor) {
...@@ -2281,7 +2261,7 @@ sensor_set_auto_exposure(struct usb_ov511 *ov, int enable) ...@@ -2281,7 +2261,7 @@ sensor_set_auto_exposure(struct usb_ov511 *ov, int enable)
case SEN_OV76BE: case SEN_OV76BE:
case SEN_OV8600: case SEN_OV8600:
i2c_w_mask(ov, 0x13, enable?0x01:0x00, 0x01); i2c_w_mask(ov, 0x13, enable?0x01:0x00, 0x01);
break; break;
case SEN_OV6630: case SEN_OV6630:
i2c_w_mask(ov, 0x28, enable?0x00:0x10, 0x10); i2c_w_mask(ov, 0x28, enable?0x00:0x10, 0x10);
break; break;
...@@ -2318,7 +2298,7 @@ sensor_set_backlight(struct usb_ov511 *ov, int enable) ...@@ -2318,7 +2298,7 @@ sensor_set_backlight(struct usb_ov511 *ov, int enable)
i2c_w_mask(ov, 0x68, enable?0xe0:0xc0, 0xe0); i2c_w_mask(ov, 0x68, enable?0xe0:0xc0, 0xe0);
i2c_w_mask(ov, 0x29, enable?0x08:0x00, 0x08); i2c_w_mask(ov, 0x29, enable?0x08:0x00, 0x08);
i2c_w_mask(ov, 0x28, enable?0x02:0x00, 0x02); i2c_w_mask(ov, 0x28, enable?0x02:0x00, 0x02);
break; break;
case SEN_OV6620: case SEN_OV6620:
i2c_w_mask(ov, 0x4e, enable?0xe0:0xc0, 0xe0); i2c_w_mask(ov, 0x4e, enable?0xe0:0xc0, 0xe0);
i2c_w_mask(ov, 0x29, enable?0x08:0x00, 0x08); i2c_w_mask(ov, 0x29, enable?0x08:0x00, 0x08);
...@@ -2378,7 +2358,7 @@ sensor_set_mirror(struct usb_ov511 *ov, int enable) ...@@ -2378,7 +2358,7 @@ sensor_set_mirror(struct usb_ov511 *ov, int enable)
/* Returns number of bits per pixel (regardless of where they are located; /* Returns number of bits per pixel (regardless of where they are located;
* planar or not), or zero for unsupported format. * planar or not), or zero for unsupported format.
*/ */
static inline int static inline int
get_depth(int palette) get_depth(int palette)
{ {
switch (palette) { switch (palette) {
...@@ -2390,7 +2370,7 @@ get_depth(int palette) ...@@ -2390,7 +2370,7 @@ get_depth(int palette)
} }
/* Bytes per frame. Used by read(). Return of 0 indicates error */ /* Bytes per frame. Used by read(). Return of 0 indicates error */
static inline long int static inline long int
get_frame_length(struct ov511_frame *frame) get_frame_length(struct ov511_frame *frame)
{ {
if (!frame) if (!frame)
...@@ -2785,12 +2765,12 @@ ov518_mode_init_regs(struct usb_ov511 *ov, ...@@ -2785,12 +2765,12 @@ ov518_mode_init_regs(struct usb_ov511 *ov,
return -EINVAL; return -EINVAL;
} else { } else {
hi_res = 0; hi_res = 0;
} }
if (ov51x_stop(ov) < 0) if (ov51x_stop(ov) < 0)
return -EIO; return -EIO;
/******** Set the mode ********/ /******** Set the mode ********/
reg_w(ov, 0x2b, 0); reg_w(ov, 0x2b, 0);
reg_w(ov, 0x2c, 0); reg_w(ov, 0x2c, 0);
...@@ -2906,10 +2886,10 @@ mode_init_regs(struct usb_ov511 *ov, ...@@ -2906,10 +2886,10 @@ mode_init_regs(struct usb_ov511 *ov,
rc = -EINVAL; rc = -EINVAL;
break; break;
case SEN_SAA7111A: case SEN_SAA7111A:
// rc = mode_init_saa_sensor_regs(ov, width, height, mode, // rc = mode_init_saa_sensor_regs(ov, width, height, mode,
// sub_flag); // sub_flag);
PDEBUG(1, "SAA status = 0X%x", i2c_r(ov, 0x1f)); PDEBUG(1, "SAA status = 0x%02X", i2c_r(ov, 0x1f));
break; break;
default: default:
err("Unknown sensor"); err("Unknown sensor");
...@@ -2952,7 +2932,7 @@ mode_init_regs(struct usb_ov511 *ov, ...@@ -2952,7 +2932,7 @@ mode_init_regs(struct usb_ov511 *ov,
/* This sets the default image parameters. This is useful for apps that use /* This sets the default image parameters. This is useful for apps that use
* read() and do not set these. * read() and do not set these.
*/ */
static int static int
ov51x_set_default_params(struct usb_ov511 *ov) ov51x_set_default_params(struct usb_ov511 *ov)
{ {
int i; int i;
...@@ -2988,7 +2968,7 @@ ov51x_set_default_params(struct usb_ov511 *ov) ...@@ -2988,7 +2968,7 @@ ov51x_set_default_params(struct usb_ov511 *ov)
**********************************************************************/ **********************************************************************/
/* Set analog input port of decoder */ /* Set analog input port of decoder */
static int static int
decoder_set_input(struct usb_ov511 *ov, int input) decoder_set_input(struct usb_ov511 *ov, int input)
{ {
PDEBUG(4, "port %d", input); PDEBUG(4, "port %d", input);
...@@ -3010,7 +2990,7 @@ decoder_set_input(struct usb_ov511 *ov, int input) ...@@ -3010,7 +2990,7 @@ decoder_set_input(struct usb_ov511 *ov, int input)
} }
/* Get ASCII name of video input */ /* Get ASCII name of video input */
static int static int
decoder_get_input_name(struct usb_ov511 *ov, int input, char *name) decoder_get_input_name(struct usb_ov511 *ov, int input, char *name)
{ {
switch (ov->sensor) { switch (ov->sensor) {
...@@ -3022,7 +3002,6 @@ decoder_get_input_name(struct usb_ov511 *ov, int input, char *name) ...@@ -3022,7 +3002,6 @@ decoder_get_input_name(struct usb_ov511 *ov, int input, char *name)
sprintf(name, "CVBS-%d", input); sprintf(name, "CVBS-%d", input);
else // if (input < 8) else // if (input < 8)
sprintf(name, "S-Video-%d", input - 4); sprintf(name, "S-Video-%d", input - 4);
break; break;
} }
default: default:
...@@ -3033,7 +3012,7 @@ decoder_get_input_name(struct usb_ov511 *ov, int input, char *name) ...@@ -3033,7 +3012,7 @@ decoder_get_input_name(struct usb_ov511 *ov, int input, char *name)
} }
/* Set norm (NTSC, PAL, SECAM, AUTO) */ /* Set norm (NTSC, PAL, SECAM, AUTO) */
static int static int
decoder_set_norm(struct usb_ov511 *ov, int norm) decoder_set_norm(struct usb_ov511 *ov, int norm)
{ {
PDEBUG(4, "%d", norm); PDEBUG(4, "%d", norm);
...@@ -3048,7 +3027,7 @@ decoder_set_norm(struct usb_ov511 *ov, int norm) ...@@ -3048,7 +3027,7 @@ decoder_set_norm(struct usb_ov511 *ov, int norm)
reg_e = 0x00; /* NTSC M / PAL BGHI */ reg_e = 0x00; /* NTSC M / PAL BGHI */
} else if (norm == VIDEO_MODE_PAL) { } else if (norm == VIDEO_MODE_PAL) {
reg_8 = 0x00; /* 50 Hz */ reg_8 = 0x00; /* 50 Hz */
reg_e = 0x00; /* NTSC M / PAL BGHI */ reg_e = 0x00; /* NTSC M / PAL BGHI */
} else if (norm == VIDEO_MODE_AUTO) { } else if (norm == VIDEO_MODE_AUTO) {
reg_8 = 0x80; /* Auto field detect */ reg_8 = 0x80; /* Auto field detect */
reg_e = 0x00; /* NTSC M / PAL BGHI */ reg_e = 0x00; /* NTSC M / PAL BGHI */
...@@ -3079,7 +3058,7 @@ decoder_set_norm(struct usb_ov511 *ov, int norm) ...@@ -3079,7 +3058,7 @@ decoder_set_norm(struct usb_ov511 *ov, int norm)
/* Copies a 64-byte segment at pIn to an 8x8 block at pOut. The width of the /* Copies a 64-byte segment at pIn to an 8x8 block at pOut. The width of the
* image at pOut is specified by w. * image at pOut is specified by w.
*/ */
static inline void static inline void
make_8x8(unsigned char *pIn, unsigned char *pOut, int w) make_8x8(unsigned char *pIn, unsigned char *pOut, int w)
{ {
unsigned char *pOut1 = pOut; unsigned char *pOut1 = pOut;
...@@ -3092,7 +3071,6 @@ make_8x8(unsigned char *pIn, unsigned char *pOut, int w) ...@@ -3092,7 +3071,6 @@ make_8x8(unsigned char *pIn, unsigned char *pOut, int w)
} }
pOut += w; pOut += w;
} }
} }
/* /*
...@@ -3214,7 +3192,7 @@ yuv420raw_to_yuv420p(struct ov511_frame *frame, ...@@ -3214,7 +3192,7 @@ yuv420raw_to_yuv420p(struct ov511_frame *frame,
* accordingly. Returns -ENXIO if decompressor is not available, otherwise * accordingly. Returns -ENXIO if decompressor is not available, otherwise
* returns 0 if no other error. * returns 0 if no other error.
*/ */
static int static int
request_decompressor(struct usb_ov511 *ov) request_decompressor(struct usb_ov511 *ov)
{ {
if (!ov) if (!ov)
...@@ -3270,7 +3248,7 @@ request_decompressor(struct usb_ov511 *ov) ...@@ -3270,7 +3248,7 @@ request_decompressor(struct usb_ov511 *ov)
/* Unlocks decompression module and nulls ov->decomp_ops. Safe to call even /* Unlocks decompression module and nulls ov->decomp_ops. Safe to call even
* if ov->decomp_ops is NULL. * if ov->decomp_ops is NULL.
*/ */
static void static void
release_decompressor(struct usb_ov511 *ov) release_decompressor(struct usb_ov511 *ov)
{ {
int released = 0; /* Did we actually do anything? */ int released = 0; /* Did we actually do anything? */
...@@ -3286,14 +3264,14 @@ release_decompressor(struct usb_ov511 *ov) ...@@ -3286,14 +3264,14 @@ release_decompressor(struct usb_ov511 *ov)
} }
ov->decomp_ops = NULL; ov->decomp_ops = NULL;
unlock_kernel(); unlock_kernel();
if (released) if (released)
PDEBUG(3, "Decompressor released"); PDEBUG(3, "Decompressor released");
} }
static void static void
decompress(struct usb_ov511 *ov, struct ov511_frame *frame, decompress(struct usb_ov511 *ov, struct ov511_frame *frame,
unsigned char *pIn0, unsigned char *pOut0) unsigned char *pIn0, unsigned char *pOut0)
{ {
...@@ -3303,7 +3281,7 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame, ...@@ -3303,7 +3281,7 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame,
PDEBUG(4, "Decompressing %d bytes", frame->bytes_recvd); PDEBUG(4, "Decompressing %d bytes", frame->bytes_recvd);
if (frame->format == VIDEO_PALETTE_GREY if (frame->format == VIDEO_PALETTE_GREY
&& ov->decomp_ops->decomp_400) { && ov->decomp_ops->decomp_400) {
int ret = ov->decomp_ops->decomp_400( int ret = ov->decomp_ops->decomp_400(
pIn0, pIn0,
...@@ -3313,7 +3291,7 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame, ...@@ -3313,7 +3291,7 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame,
frame->rawheight, frame->rawheight,
frame->bytes_recvd); frame->bytes_recvd);
PDEBUG(4, "DEBUG: decomp_400 returned %d", ret); PDEBUG(4, "DEBUG: decomp_400 returned %d", ret);
} else if (frame->format != VIDEO_PALETTE_GREY } else if (frame->format != VIDEO_PALETTE_GREY
&& ov->decomp_ops->decomp_420) { && ov->decomp_ops->decomp_420) {
int ret = ov->decomp_ops->decomp_420( int ret = ov->decomp_ops->decomp_420(
pIn0, pIn0,
...@@ -3328,6 +3306,12 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame, ...@@ -3328,6 +3306,12 @@ decompress(struct usb_ov511 *ov, struct ov511_frame *frame,
} }
} }
/**********************************************************************
*
* Format conversion
*
**********************************************************************/
/* Fuses even and odd fields together, and doubles width. /* Fuses even and odd fields together, and doubles width.
* INPUT: an odd field followed by an even field at pIn0, in YUV planar format * INPUT: an odd field followed by an even field at pIn0, in YUV planar format
* OUTPUT: a normal YUV planar image, with correct aspect ratio * OUTPUT: a normal YUV planar image, with correct aspect ratio
...@@ -3432,7 +3416,7 @@ ov51x_postprocess_yuv420(struct usb_ov511 *ov, struct ov511_frame *frame) ...@@ -3432,7 +3416,7 @@ ov51x_postprocess_yuv420(struct usb_ov511 *ov, struct ov511_frame *frame)
if (frame->compressed) if (frame->compressed)
decompress(ov, frame, frame->rawdata, frame->tempdata); decompress(ov, frame, frame->rawdata, frame->tempdata);
else else
yuv420raw_to_yuv420p(frame, frame->rawdata, yuv420raw_to_yuv420p(frame, frame->rawdata,
frame->tempdata); frame->tempdata);
deinterlace(frame, RAWFMT_YUV420, frame->tempdata, deinterlace(frame, RAWFMT_YUV420, frame->tempdata,
...@@ -3452,11 +3436,11 @@ ov51x_postprocess_yuv420(struct usb_ov511 *ov, struct ov511_frame *frame) ...@@ -3452,11 +3436,11 @@ ov51x_postprocess_yuv420(struct usb_ov511 *ov, struct ov511_frame *frame)
* 3. Convert from YUV planar to destination format, if necessary * 3. Convert from YUV planar to destination format, if necessary
* 4. Fix the RGB offset, if necessary * 4. Fix the RGB offset, if necessary
*/ */
static void static void
ov51x_postprocess(struct usb_ov511 *ov, struct ov511_frame *frame) ov51x_postprocess(struct usb_ov511 *ov, struct ov511_frame *frame)
{ {
if (dumppix) { if (dumppix) {
memset(frame->data, 0, memset(frame->data, 0,
MAX_DATA_SIZE(ov->maxwidth, ov->maxheight)); MAX_DATA_SIZE(ov->maxwidth, ov->maxheight));
PDEBUG(4, "Dumping %d bytes", frame->bytes_recvd); PDEBUG(4, "Dumping %d bytes", frame->bytes_recvd);
memcpy(frame->data, frame->rawdata, frame->bytes_recvd); memcpy(frame->data, frame->rawdata, frame->bytes_recvd);
...@@ -3482,7 +3466,7 @@ ov51x_postprocess(struct usb_ov511 *ov, struct ov511_frame *frame) ...@@ -3482,7 +3466,7 @@ ov51x_postprocess(struct usb_ov511 *ov, struct ov511_frame *frame)
* *
**********************************************************************/ **********************************************************************/
static inline void static inline void
ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n) ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n)
{ {
int num, offset; int num, offset;
...@@ -3518,7 +3502,7 @@ ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n) ...@@ -3518,7 +3502,7 @@ ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n)
/* Frame end */ /* Frame end */
if (in[8] & 0x80) { if (in[8] & 0x80) {
ts = (struct timeval *)(frame->data ts = (struct timeval *)(frame->data
+ MAX_FRAME_SIZE(ov->maxwidth, ov->maxheight)); + MAX_FRAME_SIZE(ov->maxwidth, ov->maxheight));
do_gettimeofday(ts); do_gettimeofday(ts);
...@@ -3656,7 +3640,7 @@ ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n) ...@@ -3656,7 +3640,7 @@ ov511_move_data(struct usb_ov511 *ov, unsigned char *in, int n)
} }
} }
static inline void static inline void
ov518_move_data(struct usb_ov511 *ov, unsigned char *in, int n) ov518_move_data(struct usb_ov511 *ov, unsigned char *in, int n)
{ {
int max_raw = MAX_RAW_DATA_SIZE(ov->maxwidth, ov->maxheight); int max_raw = MAX_RAW_DATA_SIZE(ov->maxwidth, ov->maxheight);
...@@ -3796,7 +3780,7 @@ ov518_move_data(struct usb_ov511 *ov, unsigned char *in, int n) ...@@ -3796,7 +3780,7 @@ ov518_move_data(struct usb_ov511 *ov, unsigned char *in, int n)
} else { } else {
if (frame->bytes_recvd + copied + 8 <= max_raw) if (frame->bytes_recvd + copied + 8 <= max_raw)
{ {
memcpy(frame->rawdata memcpy(frame->rawdata
+ frame->bytes_recvd + copied, + frame->bytes_recvd + copied,
in + read, 8); in + read, 8);
copied += 8; copied += 8;
...@@ -3810,7 +3794,7 @@ ov518_move_data(struct usb_ov511 *ov, unsigned char *in, int n) ...@@ -3810,7 +3794,7 @@ ov518_move_data(struct usb_ov511 *ov, unsigned char *in, int n)
} }
} }
static void static void
ov51x_isoc_irq(struct urb *urb) ov51x_isoc_irq(struct urb *urb)
{ {
int i; int i;
...@@ -3896,7 +3880,7 @@ ov51x_isoc_irq(struct urb *urb) ...@@ -3896,7 +3880,7 @@ ov51x_isoc_irq(struct urb *urb)
* *
***************************************************************************/ ***************************************************************************/
static int static int
ov51x_init_isoc(struct usb_ov511 *ov) ov51x_init_isoc(struct usb_ov511 *ov)
{ {
struct urb *urb; struct urb *urb;
...@@ -3991,7 +3975,7 @@ ov51x_init_isoc(struct usb_ov511 *ov) ...@@ -3991,7 +3975,7 @@ ov51x_init_isoc(struct usb_ov511 *ov)
return 0; return 0;
} }
static void static void
ov51x_unlink_isoc(struct usb_ov511 *ov) ov51x_unlink_isoc(struct usb_ov511 *ov)
{ {
int n; int n;
...@@ -4006,7 +3990,7 @@ ov51x_unlink_isoc(struct usb_ov511 *ov) ...@@ -4006,7 +3990,7 @@ ov51x_unlink_isoc(struct usb_ov511 *ov)
} }
} }
static void static void
ov51x_stop_isoc(struct usb_ov511 *ov) ov51x_stop_isoc(struct usb_ov511 *ov)
{ {
if (!ov->streaming || !ov->dev) if (!ov->streaming || !ov->dev)
...@@ -4024,7 +4008,7 @@ ov51x_stop_isoc(struct usb_ov511 *ov) ...@@ -4024,7 +4008,7 @@ ov51x_stop_isoc(struct usb_ov511 *ov)
ov51x_unlink_isoc(ov); ov51x_unlink_isoc(ov);
} }
static int static int
ov51x_new_frame(struct usb_ov511 *ov, int framenum) ov51x_new_frame(struct usb_ov511 *ov, int framenum)
{ {
struct ov511_frame *frame; struct ov511_frame *frame;
...@@ -4046,7 +4030,7 @@ ov51x_new_frame(struct usb_ov511 *ov, int framenum) ...@@ -4046,7 +4030,7 @@ ov51x_new_frame(struct usb_ov511 *ov, int framenum)
frame = &ov->frame[framenum]; frame = &ov->frame[framenum];
PDEBUG(4, "framenum = %d, width = %d, height = %d", framenum, PDEBUG(4, "framenum = %d, width = %d, height = %d", framenum,
frame->width, frame->height); frame->width, frame->height);
frame->grabstate = FRAME_GRABBING; frame->grabstate = FRAME_GRABBING;
...@@ -4075,12 +4059,12 @@ ov51x_new_frame(struct usb_ov511 *ov, int framenum) ...@@ -4075,12 +4059,12 @@ ov51x_new_frame(struct usb_ov511 *ov, int framenum)
* *
***************************************************************************/ ***************************************************************************/
/* /*
* - You must acquire buf_lock before entering this function. * - You must acquire buf_lock before entering this function.
* - Because this code will free any non-null pointer, you must be sure to null * - Because this code will free any non-null pointer, you must be sure to null
* them if you explicitly free them somewhere else! * them if you explicitly free them somewhere else!
*/ */
static void static void
ov51x_do_dealloc(struct usb_ov511 *ov) ov51x_do_dealloc(struct usb_ov511 *ov)
{ {
int i; int i;
...@@ -4124,7 +4108,7 @@ ov51x_do_dealloc(struct usb_ov511 *ov) ...@@ -4124,7 +4108,7 @@ ov51x_do_dealloc(struct usb_ov511 *ov)
PDEBUG(4, "leaving"); PDEBUG(4, "leaving");
} }
static int static int
ov51x_alloc(struct usb_ov511 *ov) ov51x_alloc(struct usb_ov511 *ov)
{ {
int i; int i;
...@@ -4171,12 +4155,12 @@ ov51x_alloc(struct usb_ov511 *ov) ...@@ -4171,12 +4155,12 @@ ov51x_alloc(struct usb_ov511 *ov)
for (i = 0; i < OV511_NUMFRAMES; i++) { for (i = 0; i < OV511_NUMFRAMES; i++) {
ov->frame[i].data = ov->fbuf + i * MAX_DATA_SIZE(w, h); ov->frame[i].data = ov->fbuf + i * MAX_DATA_SIZE(w, h);
ov->frame[i].rawdata = ov->rawfbuf ov->frame[i].rawdata = ov->rawfbuf
+ i * MAX_RAW_DATA_SIZE(w, h); + i * MAX_RAW_DATA_SIZE(w, h);
ov->frame[i].tempdata = ov->tempfbuf ov->frame[i].tempdata = ov->tempfbuf
+ i * MAX_RAW_DATA_SIZE(w, h); + i * MAX_RAW_DATA_SIZE(w, h);
ov->frame[i].compbuf = ov->frame[i].compbuf =
(unsigned char *) __get_free_page(GFP_KERNEL); (unsigned char *) __get_free_page(GFP_KERNEL);
if (!ov->frame[i].compbuf) if (!ov->frame[i].compbuf)
goto error; goto error;
...@@ -4196,7 +4180,7 @@ ov51x_alloc(struct usb_ov511 *ov) ...@@ -4196,7 +4180,7 @@ ov51x_alloc(struct usb_ov511 *ov)
return -ENOMEM; return -ENOMEM;
} }
static void static void
ov51x_dealloc(struct usb_ov511 *ov, int now) ov51x_dealloc(struct usb_ov511 *ov, int now)
{ {
PDEBUG(4, "entered"); PDEBUG(4, "entered");
...@@ -4212,7 +4196,7 @@ ov51x_dealloc(struct usb_ov511 *ov, int now) ...@@ -4212,7 +4196,7 @@ ov51x_dealloc(struct usb_ov511 *ov, int now)
* *
***************************************************************************/ ***************************************************************************/
static int static int
ov51x_v4l1_open(struct inode *inode, struct file *file) ov51x_v4l1_open(struct inode *inode, struct file *file)
{ {
struct video_device *vdev = video_devdata(file); struct video_device *vdev = video_devdata(file);
...@@ -4224,17 +4208,18 @@ ov51x_v4l1_open(struct inode *inode, struct file *file) ...@@ -4224,17 +4208,18 @@ ov51x_v4l1_open(struct inode *inode, struct file *file)
down(&ov->lock); down(&ov->lock);
err = -EBUSY; err = -EBUSY;
if (ov->user) if (ov->user)
goto out; goto out;
err = -ENOMEM; err = ov51x_alloc(ov);
if (ov51x_alloc(ov)) if (err < 0)
goto out; goto out;
ov->sub_flag = 0; ov->sub_flag = 0;
/* In case app doesn't set them... */ /* In case app doesn't set them... */
if (ov51x_set_default_params(ov) < 0) err = ov51x_set_default_params(ov);
if (err < 0)
goto out; goto out;
/* Make sure frames are reset */ /* Make sure frames are reset */
...@@ -4243,7 +4228,7 @@ ov51x_v4l1_open(struct inode *inode, struct file *file) ...@@ -4243,7 +4228,7 @@ ov51x_v4l1_open(struct inode *inode, struct file *file)
ov->frame[i].bytes_read = 0; ov->frame[i].bytes_read = 0;
} }
/* If compression is on, make sure now that a /* If compression is on, make sure now that a
* decompressor can be loaded */ * decompressor can be loaded */
if (ov->compress && !ov->decomp_ops) { if (ov->compress && !ov->decomp_ops) {
err = request_decompressor(ov); err = request_decompressor(ov);
...@@ -4268,14 +4253,14 @@ ov51x_v4l1_open(struct inode *inode, struct file *file) ...@@ -4268,14 +4253,14 @@ ov51x_v4l1_open(struct inode *inode, struct file *file)
return err; return err;
} }
static int static int
ov51x_v4l1_close(struct inode *inode, struct file *file) ov51x_v4l1_close(struct inode *inode, struct file *file)
{ {
struct video_device *vdev = file->private_data; struct video_device *vdev = file->private_data;
struct usb_ov511 *ov = vdev->priv; struct usb_ov511 *ov = vdev->priv;
PDEBUG(4, "ov511_close"); PDEBUG(4, "ov511_close");
down(&ov->lock); down(&ov->lock);
ov->user--; ov->user--;
...@@ -4303,6 +4288,7 @@ ov51x_v4l1_close(struct inode *inode, struct file *file) ...@@ -4303,6 +4288,7 @@ ov51x_v4l1_close(struct inode *inode, struct file *file)
kfree(ov); kfree(ov);
ov = NULL; ov = NULL;
} }
file->private_data = NULL; file->private_data = NULL;
return 0; return 0;
...@@ -4318,7 +4304,7 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file, ...@@ -4318,7 +4304,7 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file,
PDEBUG(5, "IOCtl: 0x%X", cmd); PDEBUG(5, "IOCtl: 0x%X", cmd);
if (!ov->dev) if (!ov->dev)
return -EIO; return -EIO;
switch (cmd) { switch (cmd) {
case VIDIOCGCAP: case VIDIOCGCAP:
...@@ -4331,10 +4317,8 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file, ...@@ -4331,10 +4317,8 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file,
sprintf(b->name, "%s USB Camera", sprintf(b->name, "%s USB Camera",
symbolic(brglist, ov->bridge)); symbolic(brglist, ov->bridge));
b->type = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE; b->type = VID_TYPE_CAPTURE | VID_TYPE_SUBCAPTURE;
if (ov->has_tuner)
b->type |= VID_TYPE_TUNER;
b->channels = ov->num_inputs; b->channels = ov->num_inputs;
b->audios = ov->has_audio_proc ? 1:0; b->audios = 0;
b->maxwidth = ov->maxwidth; b->maxwidth = ov->maxwidth;
b->maxheight = ov->maxheight; b->maxheight = ov->maxheight;
b->minwidth = ov->minwidth; b->minwidth = ov->minwidth;
...@@ -4354,11 +4338,10 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file, ...@@ -4354,11 +4338,10 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file,
} }
v->norm = ov->norm; v->norm = ov->norm;
v->type = (ov->has_tuner) ? VIDEO_TYPE_TV : VIDEO_TYPE_CAMERA; v->type = VIDEO_TYPE_CAMERA;
v->flags = (ov->has_tuner) ? VIDEO_VC_TUNER : 0; v->flags = 0;
v->flags |= (ov->has_audio_proc) ? VIDEO_VC_AUDIO : 0;
// v->flags |= (ov->has_decoder) ? VIDEO_VC_NORM : 0; // v->flags |= (ov->has_decoder) ? VIDEO_VC_NORM : 0;
v->tuners = (ov->has_tuner) ? 1:0; v->tuners = 0;
decoder_get_input_name(ov, v->channel, v->name); decoder_get_input_name(ov, v->channel, v->name);
return 0; return 0;
...@@ -4585,7 +4568,7 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file, ...@@ -4585,7 +4568,7 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file,
return -EINVAL; return -EINVAL;
} }
if (vm->width > ov->maxwidth if (vm->width > ov->maxwidth
|| vm->height > ov->maxheight) { || vm->height > ov->maxheight) {
err("VIDIOCMCAPTURE: requested dimensions too big"); err("VIDIOCMCAPTURE: requested dimensions too big");
return -EINVAL; return -EINVAL;
...@@ -4641,7 +4624,6 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file, ...@@ -4641,7 +4624,6 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file,
struct ov511_frame *frame; struct ov511_frame *frame;
int rc; int rc;
if (fnum >= OV511_NUMFRAMES) { if (fnum >= OV511_NUMFRAMES) {
err("VIDIOCSYNC: invalid frame (%d)", fnum); err("VIDIOCSYNC: invalid frame (%d)", fnum);
return -EINVAL; return -EINVAL;
...@@ -4676,7 +4658,7 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file, ...@@ -4676,7 +4658,7 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file,
return ret; return ret;
goto redo; goto redo;
} }
/* Fall through */ /* Fall through */
case FRAME_DONE: case FRAME_DONE:
if (ov->snap_enabled && !frame->snapshot) { if (ov->snap_enabled && !frame->snapshot) {
int ret; int ret;
...@@ -4728,92 +4710,6 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file, ...@@ -4728,92 +4710,6 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file,
return 0; return 0;
} }
case VIDIOCGTUNER:
{
struct video_tuner *v = arg;
PDEBUG(4, "VIDIOCGTUNER");
if (!ov->has_tuner || v->tuner) // Only tuner 0
return -EINVAL;
strcpy(v->name, "Television");
// FIXME: Need a way to get the real values
v->rangelow = 0;
v->rangehigh = ~0;
v->flags = VIDEO_TUNER_PAL | VIDEO_TUNER_NTSC
| VIDEO_TUNER_SECAM;
v->mode = 0; /* FIXME: Not sure what this is yet */
v->signal = 0xFFFF; /* unknown */
call_i2c_clients(ov, cmd, v);
return 0;
}
case VIDIOCSTUNER:
{
struct video_tuner *v = arg;
int err;
PDEBUG(4, "VIDIOCSTUNER");
/* Only no or one tuner for now */
if (!ov->has_tuner || v->tuner)
return -EINVAL;
/* and it only has certain valid modes */
if (v->mode != VIDEO_MODE_PAL &&
v->mode != VIDEO_MODE_NTSC &&
v->mode != VIDEO_MODE_SECAM)
return -EOPNOTSUPP;
/* Is this right/necessary? */
err = decoder_set_norm(ov, v->mode);
if (err)
return err;
call_i2c_clients(ov, cmd, v);
return 0;
}
case VIDIOCGFREQ:
{
unsigned long v = *((unsigned long *) arg);
PDEBUG(4, "VIDIOCGFREQ");
if (!ov->has_tuner)
return -EINVAL;
v = ov->freq;
#if 0
/* FIXME: this is necessary for testing */
v = 46*16;
#endif
return 0;
}
case VIDIOCSFREQ:
{
unsigned long v = *((unsigned long *) arg);
PDEBUG(4, "VIDIOCSFREQ: %lx", v);
if (!ov->has_tuner)
return -EINVAL;
ov->freq = v;
call_i2c_clients(ov, cmd, &v);
return 0;
}
case VIDIOCGAUDIO:
case VIDIOCSAUDIO:
{
/* FIXME: Implement this... */
return 0;
}
default: default:
PDEBUG(3, "Unsupported IOCtl: 0x%X", cmd); PDEBUG(3, "Unsupported IOCtl: 0x%X", cmd);
return -ENOIOCTLCMD; return -ENOIOCTLCMD;
...@@ -4822,7 +4718,7 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file, ...@@ -4822,7 +4718,7 @@ ov51x_v4l1_ioctl_internal(struct inode *inode, struct file *file,
return 0; return 0;
} }
static int static int
ov51x_v4l1_ioctl(struct inode *inode, struct file *file, ov51x_v4l1_ioctl(struct inode *inode, struct file *file,
unsigned int cmd, unsigned long arg) unsigned int cmd, unsigned long arg)
{ {
...@@ -4839,7 +4735,7 @@ ov51x_v4l1_ioctl(struct inode *inode, struct file *file, ...@@ -4839,7 +4735,7 @@ ov51x_v4l1_ioctl(struct inode *inode, struct file *file,
return rc; return rc;
} }
static inline int static inline int
ov51x_v4l1_read(struct file *file, char *buf, size_t cnt, loff_t *ppos) ov51x_v4l1_read(struct file *file, char *buf, size_t cnt, loff_t *ppos)
{ {
struct video_device *vdev = file->private_data; struct video_device *vdev = file->private_data;
...@@ -4904,7 +4800,7 @@ ov51x_v4l1_read(struct file *file, char *buf, size_t cnt, loff_t *ppos) ...@@ -4904,7 +4800,7 @@ ov51x_v4l1_read(struct file *file, char *buf, size_t cnt, loff_t *ppos)
/* Wait while we're grabbing the image */ /* Wait while we're grabbing the image */
PDEBUG(4, "Waiting image grabbing"); PDEBUG(4, "Waiting image grabbing");
rc = wait_event_interruptible(frame->wq, rc = wait_event_interruptible(frame->wq,
(frame->grabstate == FRAME_DONE) (frame->grabstate == FRAME_DONE)
|| (frame->grabstate == FRAME_ERROR)); || (frame->grabstate == FRAME_ERROR));
...@@ -4951,7 +4847,7 @@ ov51x_v4l1_read(struct file *file, char *buf, size_t cnt, loff_t *ppos) ...@@ -4951,7 +4847,7 @@ ov51x_v4l1_read(struct file *file, char *buf, size_t cnt, loff_t *ppos)
get_frame_length(frame)); get_frame_length(frame));
/* copy bytes to user space; we allow for partials reads */ /* copy bytes to user space; we allow for partials reads */
// if ((count + frame->bytes_read) // if ((count + frame->bytes_read)
// > get_frame_length((struct ov511_frame *)frame)) // > get_frame_length((struct ov511_frame *)frame))
// count = frame->scanlength - frame->bytes_read; // count = frame->scanlength - frame->bytes_read;
...@@ -5054,7 +4950,7 @@ static struct video_device vdev_template = { ...@@ -5054,7 +4950,7 @@ static struct video_device vdev_template = {
}; };
#if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS) #if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS)
static int static int
ov51x_control_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ov51x_control_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
unsigned long ularg) unsigned long ularg)
{ {
...@@ -5278,7 +5174,7 @@ ov51x_control_ioctl(struct inode *inode, struct file *file, unsigned int cmd, ...@@ -5278,7 +5174,7 @@ ov51x_control_ioctl(struct inode *inode, struct file *file, unsigned int cmd,
/* This initializes the OV7610, OV7620, or OV76BE sensor. The OV76BE uses /* This initializes the OV7610, OV7620, or OV76BE sensor. The OV76BE uses
* the same register settings as the OV7610, since they are very similar. * the same register settings as the OV7610, since they are very similar.
*/ */
static int static int
ov7xx0_configure(struct usb_ov511 *ov) ov7xx0_configure(struct usb_ov511 *ov)
{ {
int i, success; int i, success;
...@@ -5429,7 +5325,7 @@ ov7xx0_configure(struct usb_ov511 *ov) ...@@ -5429,7 +5325,7 @@ ov7xx0_configure(struct usb_ov511 *ov)
err("this to " EMAIL); err("this to " EMAIL);
err("This is only a warning. You can attempt to use"); err("This is only a warning. You can attempt to use");
err("your camera anyway"); err("your camera anyway");
// Only issue a warning for now // Only issue a warning for now
// return -1; // return -1;
} else { } else {
PDEBUG(1, "OV7xx0 initialized (method 2, %dx)", i+1); PDEBUG(1, "OV7xx0 initialized (method 2, %dx)", i+1);
...@@ -5449,8 +5345,6 @@ ov7xx0_configure(struct usb_ov511 *ov) ...@@ -5449,8 +5345,6 @@ ov7xx0_configure(struct usb_ov511 *ov)
/* I don't know what's different about the 76BE yet. */ /* I don't know what's different about the 76BE yet. */
if (i2c_r(ov, 0x15) & 1) { if (i2c_r(ov, 0x15) & 1) {
info("Sensor is an OV7620AE"); info("Sensor is an OV7620AE");
info("PLEASE REPORT THE EXISTENCE OF THIS SENSOR TO");
info("THE DRIVER AUTHOR");
} else { } else {
info("Sensor is an OV76BE"); info("Sensor is an OV76BE");
} }
...@@ -5498,7 +5392,7 @@ ov7xx0_configure(struct usb_ov511 *ov) ...@@ -5498,7 +5392,7 @@ ov7xx0_configure(struct usb_ov511 *ov)
} }
/* This initializes the OV6620, OV6630, OV6630AE, or OV6630AF sensor. */ /* This initializes the OV6620, OV6630, OV6630AE, or OV6630AF sensor. */
static int static int
ov6xx0_configure(struct usb_ov511 *ov) ov6xx0_configure(struct usb_ov511 *ov)
{ {
int rc; int rc;
...@@ -5513,7 +5407,7 @@ ov6xx0_configure(struct usb_ov511 *ov) ...@@ -5513,7 +5407,7 @@ ov6xx0_configure(struct usb_ov511 *ov)
{ OV511_I2C_BUS, 0x0c, 0x24 }, { OV511_I2C_BUS, 0x0c, 0x24 },
{ OV511_I2C_BUS, 0x0d, 0x24 }, { OV511_I2C_BUS, 0x0d, 0x24 },
{ OV511_I2C_BUS, 0x0f, 0x15 }, /* COMS */ { OV511_I2C_BUS, 0x0f, 0x15 }, /* COMS */
{ OV511_I2C_BUS, 0x10, 0x75 }, /* AEC Exposure time */ { OV511_I2C_BUS, 0x10, 0x75 }, /* AEC Exposure time */
{ OV511_I2C_BUS, 0x12, 0x24 }, /* Enable AGC */ { OV511_I2C_BUS, 0x12, 0x24 }, /* Enable AGC */
{ OV511_I2C_BUS, 0x14, 0x04 }, { OV511_I2C_BUS, 0x14, 0x04 },
/* 0x16: 0x06 helps frame stability with moving objects */ /* 0x16: 0x06 helps frame stability with moving objects */
...@@ -5525,11 +5419,11 @@ ov6xx0_configure(struct usb_ov511 *ov) ...@@ -5525,11 +5419,11 @@ ov6xx0_configure(struct usb_ov511 *ov)
{ OV511_I2C_BUS, 0x2a, 0x04 }, /* Disable framerate adjust */ { OV511_I2C_BUS, 0x2a, 0x04 }, /* Disable framerate adjust */
// { OV511_I2C_BUS, 0x2b, 0xac }, /* Framerate; Set 2a[7] first */ // { OV511_I2C_BUS, 0x2b, 0xac }, /* Framerate; Set 2a[7] first */
{ OV511_I2C_BUS, 0x2d, 0x99 }, { OV511_I2C_BUS, 0x2d, 0x99 },
{ OV511_I2C_BUS, 0x33, 0xa0 }, /* Color Procesing Parameter */ { OV511_I2C_BUS, 0x33, 0xa0 }, /* Color Procesing Parameter */
{ OV511_I2C_BUS, 0x34, 0xd2 }, /* Max A/D range */ { OV511_I2C_BUS, 0x34, 0xd2 }, /* Max A/D range */
{ OV511_I2C_BUS, 0x38, 0x8b }, { OV511_I2C_BUS, 0x38, 0x8b },
{ OV511_I2C_BUS, 0x39, 0x40 }, { OV511_I2C_BUS, 0x39, 0x40 },
{ OV511_I2C_BUS, 0x3c, 0x39 }, /* Enable AEC mode changing */ { OV511_I2C_BUS, 0x3c, 0x39 }, /* Enable AEC mode changing */
{ OV511_I2C_BUS, 0x3c, 0x3c }, /* Change AEC mode */ { OV511_I2C_BUS, 0x3c, 0x3c }, /* Change AEC mode */
{ OV511_I2C_BUS, 0x3c, 0x24 }, /* Disable AEC mode changing */ { OV511_I2C_BUS, 0x3c, 0x24 }, /* Disable AEC mode changing */
...@@ -5609,7 +5503,7 @@ ov6xx0_configure(struct usb_ov511 *ov) ...@@ -5609,7 +5503,7 @@ ov6xx0_configure(struct usb_ov511 *ov)
* control the color balance */ * control the color balance */
// /*OK?*/ { OV511_I2C_BUS, 0x4a, 0x80 }, // Check these // /*OK?*/ { OV511_I2C_BUS, 0x4a, 0x80 }, // Check these
// /*OK?*/ { OV511_I2C_BUS, 0x4b, 0x80 }, // /*OK?*/ { OV511_I2C_BUS, 0x4b, 0x80 },
// /*U*/ { OV511_I2C_BUS, 0x4c, 0xd0 }, // /*U*/ { OV511_I2C_BUS, 0x4c, 0xd0 },
/*d2?*/ { OV511_I2C_BUS, 0x4d, 0x10 }, /* This reduces noise a bit */ /*d2?*/ { OV511_I2C_BUS, 0x4d, 0x10 }, /* This reduces noise a bit */
/*c1?*/ { OV511_I2C_BUS, 0x4e, 0x40 }, /*c1?*/ { OV511_I2C_BUS, 0x4e, 0x40 },
/*04?*/ { OV511_I2C_BUS, 0x4f, 0x07 }, /*04?*/ { OV511_I2C_BUS, 0x4f, 0x07 },
...@@ -5627,7 +5521,7 @@ ov6xx0_configure(struct usb_ov511 *ov) ...@@ -5627,7 +5521,7 @@ ov6xx0_configure(struct usb_ov511 *ov)
}; };
PDEBUG(4, "starting sensor configuration"); PDEBUG(4, "starting sensor configuration");
if (init_ov_sensor(ov) < 0) { if (init_ov_sensor(ov) < 0) {
err("Failed to read sensor ID. You might not have an OV6xx0,"); err("Failed to read sensor ID. You might not have an OV6xx0,");
err("or it may be not responding. Report this to " EMAIL); err("or it may be not responding. Report this to " EMAIL);
...@@ -5642,7 +5536,7 @@ ov6xx0_configure(struct usb_ov511 *ov) ...@@ -5642,7 +5536,7 @@ ov6xx0_configure(struct usb_ov511 *ov)
if (rc < 0) { if (rc < 0) {
err("Error detecting sensor type"); err("Error detecting sensor type");
return -1; return -1;
} }
if ((rc & 3) == 0) if ((rc & 3) == 0)
ov->sensor = SEN_OV6630; ov->sensor = SEN_OV6630;
...@@ -5676,7 +5570,7 @@ ov6xx0_configure(struct usb_ov511 *ov) ...@@ -5676,7 +5570,7 @@ ov6xx0_configure(struct usb_ov511 *ov)
if (write_regvals(ov, aRegvalsNorm6x30)) if (write_regvals(ov, aRegvalsNorm6x30))
return -1; return -1;
} }
return 0; return 0;
} }
...@@ -5738,7 +5632,7 @@ ks0127_configure(struct usb_ov511 *ov) ...@@ -5738,7 +5632,7 @@ ks0127_configure(struct usb_ov511 *ov)
} }
/* This initializes the SAA7111A video decoder. */ /* This initializes the SAA7111A video decoder. */
static int static int
saa7111a_configure(struct usb_ov511 *ov) saa7111a_configure(struct usb_ov511 *ov)
{ {
int rc; int rc;
...@@ -5890,12 +5784,8 @@ ov511_configure(struct usb_ov511 *ov) ...@@ -5890,12 +5784,8 @@ ov511_configure(struct usb_ov511 *ov)
err("Also include the output of the detection process."); err("Also include the output of the detection process.");
} }
if (ov->customid == 6) { /* USB Life TV (NTSC) */ if (ov->customid == 70) /* USB Life TV (PAL/SECAM) */
ov->tuner_type = 8; /* Temic 4036FY5 3X 1981 */
} else if (ov->customid == 70) { /* USB Life TV (PAL/SECAM) */
ov->tuner_type = 3; /* Philips FI1216MF */
ov->pal = 1; ov->pal = 1;
}
if (write_regvals(ov, aRegvalsInit511)) goto error; if (write_regvals(ov, aRegvalsInit511)) goto error;
...@@ -5917,7 +5807,7 @@ ov511_configure(struct usb_ov511 *ov) ...@@ -5917,7 +5807,7 @@ ov511_configure(struct usb_ov511 *ov)
ov->packet_numbering = 1; ov->packet_numbering = 1;
ov511_set_packet_size(ov, 0); ov511_set_packet_size(ov, 0);
ov->snap_enabled = snapshot; ov->snap_enabled = snapshot;
/* Test for 7xx0 */ /* Test for 7xx0 */
PDEBUG(3, "Testing for 0V7xx0"); PDEBUG(3, "Testing for 0V7xx0");
...@@ -5994,7 +5884,7 @@ ov511_configure(struct usb_ov511 *ov) ...@@ -5994,7 +5884,7 @@ ov511_configure(struct usb_ov511 *ov)
} }
/* This initializes the OV518/OV518+ and the sensor */ /* This initializes the OV518/OV518+ and the sensor */
static int static int
ov518_configure(struct usb_ov511 *ov) ov518_configure(struct usb_ov511 *ov)
{ {
/* For 518 and 518+ */ /* For 518 and 518+ */
...@@ -6190,7 +6080,6 @@ ov51x_probe(struct usb_device *dev, unsigned int ifnum, ...@@ -6190,7 +6080,6 @@ ov51x_probe(struct usb_device *dev, unsigned int ifnum,
ov->lightfreq = lightfreq; ov->lightfreq = lightfreq;
ov->num_inputs = 1; /* Video decoder init functs. change this */ ov->num_inputs = 1; /* Video decoder init functs. change this */
ov->stop_during_set = !fastset; ov->stop_during_set = !fastset;
ov->tuner_type = tuner;
ov->backlight = backlight; ov->backlight = backlight;
ov->mirror = mirror; ov->mirror = mirror;
ov->auto_brt = autobright; ov->auto_brt = autobright;
...@@ -6221,7 +6110,7 @@ ov51x_probe(struct usb_device *dev, unsigned int ifnum, ...@@ -6221,7 +6110,7 @@ ov51x_probe(struct usb_device *dev, unsigned int ifnum,
ov->bclass = BCL_OV511; ov->bclass = BCL_OV511;
break; break;
default: default:
err("Unknown product ID 0x%x", dev->descriptor.idProduct); err("Unknown product ID 0x%04x", dev->descriptor.idProduct);
goto error_dealloc; goto error_dealloc;
} }
...@@ -6388,7 +6277,7 @@ static struct usb_driver ov511_driver = { ...@@ -6388,7 +6277,7 @@ static struct usb_driver ov511_driver = {
***************************************************************************/ ***************************************************************************/
/* Returns 0 for success */ /* Returns 0 for success */
int int
ov511_register_decomp_module(int ver, struct ov51x_decomp_ops *ops, int ov518, ov511_register_decomp_module(int ver, struct ov51x_decomp_ops *ops, int ov518,
int mmx) int mmx)
{ {
...@@ -6445,7 +6334,7 @@ ov511_register_decomp_module(int ver, struct ov51x_decomp_ops *ops, int ov518, ...@@ -6445,7 +6334,7 @@ ov511_register_decomp_module(int ver, struct ov51x_decomp_ops *ops, int ov518,
return -EBUSY; return -EBUSY;
} }
void void
ov511_deregister_decomp_module(int ov518, int mmx) ov511_deregister_decomp_module(int ov518, int mmx)
{ {
lock_kernel(); lock_kernel();
...@@ -6461,13 +6350,13 @@ ov511_deregister_decomp_module(int ov518, int mmx) ...@@ -6461,13 +6350,13 @@ ov511_deregister_decomp_module(int ov518, int mmx)
else else
ov511_decomp_ops = NULL; ov511_decomp_ops = NULL;
} }
MOD_DEC_USE_COUNT; MOD_DEC_USE_COUNT;
unlock_kernel(); unlock_kernel();
} }
static int __init static int __init
usb_ov511_init(void) usb_ov511_init(void)
{ {
#if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS) #if defined(CONFIG_PROC_FS) && defined(CONFIG_VIDEO_PROC_FS)
...@@ -6482,7 +6371,7 @@ usb_ov511_init(void) ...@@ -6482,7 +6371,7 @@ usb_ov511_init(void)
return 0; return 0;
} }
static void __exit static void __exit
usb_ov511_exit(void) usb_ov511_exit(void)
{ {
usb_deregister(&ov511_driver); usb_deregister(&ov511_driver);
......
...@@ -551,17 +551,11 @@ struct usb_ov511 { ...@@ -551,17 +551,11 @@ struct usb_ov511 {
int num_inputs; /* Number of inputs */ int num_inputs; /* Number of inputs */
int norm; /* NTSC / PAL / SECAM */ int norm; /* NTSC / PAL / SECAM */
int has_decoder; /* Device has a video decoder */ int has_decoder; /* Device has a video decoder */
int has_tuner; /* Device has a TV tuner */
int has_audio_proc; /* Device has an audio processor */
int freq; /* Current tuner frequency */
int tuner_type; /* Specific tuner model */
int pal; /* Device is designed for PAL resolution */ int pal; /* Device is designed for PAL resolution */
/* I2C interface to kernel */ /* I2C interface */
struct semaphore i2c_lock; /* Protect I2C controller regs */ struct semaphore i2c_lock; /* Protect I2C controller regs */
unsigned char primary_i2c_slave; /* I2C write id of sensor */ unsigned char primary_i2c_slave; /* I2C write id of sensor */
unsigned char tuner_i2c_slave; /* I2C write id of tuner */
unsigned char audio_i2c_slave; /* I2C write id of audio processor */
/* Control transaction stuff */ /* Control transaction stuff */
unsigned char *cbuf; /* Buffer for payload */ unsigned char *cbuf; /* Buffer for payload */
......
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