Commit 87bae740 authored by Jean-François Moine's avatar Jean-François Moine Committed by Mauro Carvalho Chehab

[media] gspca - ov519: Cleanup source

- move hexadecimal value to lowercase
- remove/add empty lines and spaces
- comment unused macros
- change some comments
Signed-off-by: default avatarJean-François Moine <moinejf@free.fr>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 9be1d6cd
......@@ -226,7 +226,7 @@ static const struct ctrl sd_ctrls[] = {
.type = V4L2_CTRL_TYPE_MENU,
.name = "Light frequency filter",
.minimum = 0,
.maximum = 2, /* 0: 0, 1: 50Hz, 2:60Hz */
.maximum = 2, /* 0: no flicker, 1: 50Hz, 2:60Hz, 3: auto */
.step = 1,
.default_value = 0,
},
......@@ -413,7 +413,6 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = {
.priv = 0},
};
/* Registers common to OV511 / OV518 */
#define R51x_FIFO_PSIZE 0x30 /* 2 bytes wide w/ OV518(+) */
#define R51x_SYS_RESET 0x50
......@@ -421,7 +420,7 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = {
#define OV511_RESET_OMNICE 0x08
#define R51x_SYS_INIT 0x53
#define R51x_SYS_SNAP 0x52
#define R51x_SYS_CUST_ID 0x5F
#define R51x_SYS_CUST_ID 0x5f
#define R51x_COMP_LUT_BEGIN 0x80
/* OV511 Camera interface register numbers */
......@@ -436,13 +435,13 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = {
#define R511_CAM_OPTS 0x18
#define R511_SNAP_FRAME 0x19
#define R511_SNAP_PXCNT 0x1A
#define R511_SNAP_LNCNT 0x1B
#define R511_SNAP_PXDIV 0x1C
#define R511_SNAP_LNDIV 0x1D
#define R511_SNAP_UV_EN 0x1E
#define R511_SNAP_UV_EN 0x1E
#define R511_SNAP_OPTS 0x1F
#define R511_SNAP_PXCNT 0x1a
#define R511_SNAP_LNCNT 0x1b
#define R511_SNAP_PXDIV 0x1c
#define R511_SNAP_LNDIV 0x1d
#define R511_SNAP_UV_EN 0x1e
#define R511_SNAP_UV_EN 0x1e
#define R511_SNAP_OPTS 0x1f
#define R511_DRAM_FLOW_CTL 0x20
#define R511_FIFO_OPTS 0x31
......@@ -473,7 +472,7 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = {
#define OV519_GPIO_DATA_OUT0 0x71
#define OV519_GPIO_IO_CTRL0 0x72
#define OV511_ENDPOINT_ADDRESS 1 /* Isoc endpoint number */
/*#define OV511_ENDPOINT_ADDRESS 1 * Isoc endpoint number */
/*
* The FX2 chip does not give us a zero length read at end of frame.
......@@ -533,7 +532,7 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = {
#define OV7670_REG_RED 0x02 /* red gain */
#define OV7670_REG_VREF 0x03 /* Pieces of GAIN, VSTART, VSTOP */
#define OV7670_REG_COM1 0x04 /* Control 1 */
#define OV7670_REG_AECHH 0x07 /* AEC MS 5 bits */
/*#define OV7670_REG_AECHH 0x07 * AEC MS 5 bits */
#define OV7670_REG_COM3 0x0c /* Control 3 */
#define OV7670_REG_COM4 0x0d /* Control 4 */
#define OV7670_REG_COM5 0x0e /* All "reserved" */
......@@ -542,7 +541,7 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = {
#define OV7670_REG_CLKRC 0x11 /* Clock control */
#define OV7670_REG_COM7 0x12 /* Control 7 */
#define OV7670_COM7_FMT_VGA 0x00
#define OV7670_COM7_YUV 0x00 /* YUV */
/*#define OV7670_COM7_YUV 0x00 * YUV */
#define OV7670_COM7_FMT_QVGA 0x10 /* QVGA format */
#define OV7670_COM7_FMT_MASK 0x38
#define OV7670_COM7_RESET 0x80 /* Register reset */
......@@ -577,7 +576,7 @@ static const struct v4l2_pix_format ovfx2_ov3610_mode[] = {
#define OV7670_REG_COM14 0x3e /* Control 14 */
#define OV7670_REG_EDGE 0x3f /* Edge enhancement factor */
#define OV7670_REG_COM15 0x40 /* Control 15 */
#define OV7670_COM15_R00FF 0xc0 /* 00 to FF */
/*#define OV7670_COM15_R00FF 0xc0 * 00 to FF */
#define OV7670_REG_COM16 0x41 /* Control 16 */
#define OV7670_COM16_AWBGAIN 0x08 /* AWB gain enable */
#define OV7670_REG_BRIGHT 0x55 /* Brightness */
......@@ -618,7 +617,6 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* "wait 4096 external clock ... to make sure the sensor is
* stable and ready to access registers" i.e. 160us at 24MHz
*/
{ 0x12, 0x80 }, /* COMH reset */
{ 0x12, 0x00 }, /* QXGA, master */
......@@ -651,7 +649,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* COMI[0] "Exposure control"
* = 0 (0x00) .......0 "Manual"
*/
{ 0x13, 0xC0 },
{ 0x13, 0xc0 },
/*
* 09 COMC "Common Control C"
......@@ -707,7 +705,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* COME[0] "Auto zero circuit select"
* = 1 (0x01) .......1 "On"
*/
{ 0x0d, 0xA1 },
{ 0x0d, 0xa1 },
/*
* 0E COMF "Common Control F"
......@@ -771,7 +769,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* COMJ[0] "Reserved"
* = 0 (0x00) .......0
*/
{ 0x14, 0xC6 },
{ 0x14, 0xc6 },
/*
* 15 COMK "Common Control K"
......@@ -877,7 +875,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* FVOPT[7:0] "Range"
* = 31 (0x1F) 00011111
*/
{ 0x3c, 0x1F },
{ 0x3c, 0x1f },
/*
* 44 Undocumented = 0 (0x00) 00000000
......@@ -926,7 +924,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* 48[7:0] "It's a secret"
* = 192 (0xC0) 11000000
*/
{ 0x48, 0xC0 },
{ 0x48, 0xc0 },
/*
* 49 Undocumented = 25 (0x19) 00011001
......@@ -940,18 +938,18 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* 4B[7:0] "It's a secret"
* = 128 (0x80) 10000000
*/
{ 0x4B, 0x80 },
{ 0x4b, 0x80 },
/*
* 4D Undocumented = 196 (0xC4) 11000100
* 4D[7:0] "It's a secret"
* = 196 (0xC4) 11000100
*/
{ 0x4D, 0xC4 },
{ 0x4d, 0xc4 },
/*
* 35 VREF "Reference Voltage Control"
* = 76 (0x4C) 01001100
* = 76 (0x4c) 01001100
* VREF[7:5] "Column high reference control"
* = 2 (0x02) 010..... "higher voltage"
* VREF[4:2] "Column low reference control"
......@@ -959,21 +957,21 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* VREF[1:0] "Reserved"
* = 0 (0x00) ......00
*/
{ 0x35, 0x4C },
{ 0x35, 0x4c },
/*
* 3D Undocumented = 0 (0x00) 00000000
* 3D[7:0] "It's a secret"
* = 0 (0x00) 00000000
*/
{ 0x3D, 0x00 },
{ 0x3d, 0x00 },
/*
* 3E Undocumented = 0 (0x00) 00000000
* 3E[7:0] "It's a secret"
* = 0 (0x00) 00000000
*/
{ 0x3E, 0x00 },
{ 0x3e, 0x00 },
/*
* 3B FREFB "Internal Reference Adjustment"
......@@ -1013,7 +1011,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* VBLM[3:0] "Sensor current control"
* = 10 (0x0A) ....1010
*/
{ 0x34, 0x5A },
{ 0x34, 0x5a },
/*
* 3B FREFB "Internal Reference Adjustment"
......@@ -1079,7 +1077,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* HREFST[7:0] "Horizontal window start, 8 MSBs"
* = 31 (0x1F) 00011111
*/
{ 0x17, 0x1F },
{ 0x17, 0x1f },
/*
* 18 HREFEND "Horizontal window end"
......@@ -1087,7 +1085,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* HREFEND[7:0] "Horizontal Window End, 8 MSBs"
* = 95 (0x5F) 01011111
*/
{ 0x18, 0x5F },
{ 0x18, 0x5f },
/*
* 19 VSTRT "Vertical window start"
......@@ -1127,7 +1125,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* COMA[1:0] "Vertical window start line control 2 LSBs"
* = 2 (0x02) ......10
*/
{ 0x03, 0x4A },
{ 0x03, 0x4a },
/*
* 11 CLKRC "Clock Rate Control"
......@@ -1184,7 +1182,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* HREFST[7:0] "Horizontal window start, 8 MSBs"
* = 31 (0x1F) 00011111
*/
{ 0x17, 0x1F },
{ 0x17, 0x1f },
/*
* 18 HREFEND "Horizontal window end"
......@@ -1192,7 +1190,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* HREFEND[7:0] "Horizontal Window End, 8 MSBs"
* = 95 (0x5F) 01011111
*/
{ 0x18, 0x5F },
{ 0x18, 0x5f },
/*
* 19 VSTRT "Vertical window start"
......@@ -1232,7 +1230,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* COMA[1:0] "Vertical window start line control 2 LSBs"
* = 2 (0x02) ......10
*/
{ 0x03, 0x4A },
{ 0x03, 0x4a },
/*
* 02 RED "Red Gain Control"
......@@ -1242,7 +1240,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* RED[6:0] "Value"
* = 47 (0x2F) .0101111
*/
{ 0x02, 0xAF },
{ 0x02, 0xaf },
/*
* 2D ADDVSL "VSYNC Pulse Width"
......@@ -1250,7 +1248,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* ADDVSL[7:0] "VSYNC pulse width, LSB"
* = 210 (0xD2) 11010010
*/
{ 0x2d, 0xD2 },
{ 0x2d, 0xd2 },
/*
* 00 GAIN = 24 (0x18) 00011000
......@@ -1273,7 +1271,7 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* BLUE[6:0] "Value"
* = 112 (0x70) .1110000
*/
{ 0x01, 0xF0 },
{ 0x01, 0xf0 },
/*
* 10 AEC "Automatic Exposure Control"
......@@ -1281,14 +1279,14 @@ static const struct ov_i2c_regvals norm_3620b[] = {
* AEC[7:0] "Automatic Exposure Control, 8 MSBs"
* = 10 (0x0A) 00001010
*/
{ 0x10, 0x0A },
{ 0xE1, 0x67 },
{ 0xE3, 0x03 },
{ 0xE4, 0x26 },
{ 0xE5, 0x3E },
{ 0xF8, 0x01 },
{ 0xFF, 0x01 },
{ 0x10, 0x0a },
{ 0xe1, 0x67 },
{ 0xe3, 0x03 },
{ 0xe4, 0x26 },
{ 0xe5, 0x3e },
{ 0xf8, 0x01 },
{ 0xff, 0x01 },
};
static const struct ov_i2c_regvals norm_6x20[] = {
......@@ -2366,6 +2364,7 @@ static int init_ov_sensor(struct sd *sd, u8 slave)
return -EIO;
/* Wait for it to initialize */
msleep(150);
/* Dummy read to sync I2C */
if (i2c_r(sd, 0x00) < 0)
return -EIO;
......@@ -2499,7 +2498,6 @@ static int ov7xx0_configure(struct sd *sd)
{
int rc, high, low;
PDEBUG(D_PROBE, "starting OV7xx0 configuration");
/* Detect sensor (sub)type */
......@@ -2711,7 +2709,6 @@ static int ov51x_upload_quan_tables(struct sd *sd)
6, 6, 6, 6, 7, 7, 7, 8,
7, 7, 6, 7, 7, 7, 8, 8
};
const unsigned char uvQuanTable518[] = {
6, 6, 6, 7, 7, 7, 7, 7,
6, 6, 6, 7, 7, 7, 7, 7,
......@@ -2893,7 +2890,7 @@ static int ov518_configure(struct gspca_dev *gspca_dev)
/* First 5 bits of custom ID reg are a revision ID on OV518 */
PDEBUG(D_PROBE, "Device revision %d",
0x1F & reg_r(sd, R51x_SYS_CUST_ID));
0x1f & reg_r(sd, R51x_SYS_CUST_ID));
rc = write_regvals(sd, init_518, ARRAY_SIZE(init_518));
if (rc < 0)
......@@ -3335,7 +3332,6 @@ static int ov518_mode_init_regs(struct sd *sd)
ov518_reg_w32(sd, R51x_FIFO_PSIZE, packet_size & ~7, 2);
/******** Set the mode ********/
reg_w(sd, 0x2b, 0);
reg_w(sd, 0x2c, 0);
reg_w(sd, 0x2d, 0);
......@@ -3436,7 +3432,6 @@ static int ov518_mode_init_regs(struct sd *sd)
return 0;
}
/* Sets up the OV519 with the given image parameters
*
* OV519 needs a completely different approach, until we can figure out what
......@@ -3609,7 +3604,7 @@ static int mode_init_ov_sensor_regs(struct sd *sd)
u8 v;
gspca_dev = &sd->gspca_dev;
qvga = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv & 1;
qvga = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv & 1;
/******** Mode (VGA/QVGA) and sensor specific regs ********/
switch (sd->sensor) {
......@@ -3777,8 +3772,8 @@ static int set_ov_sensor_window(struct sd *sd)
return mode_init_ov_sensor_regs(sd);
gspca_dev = &sd->gspca_dev;
qvga = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv & 1;
crop = gspca_dev->cam.cam_mode[(int) gspca_dev->curr_mode].priv & 2;
qvga = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv & 1;
crop = gspca_dev->cam.cam_mode[gspca_dev->curr_mode].priv & 2;
/* The different sensor ICs handle setting up of window differently.
* IF YOU SET IT WRONG, YOU WILL GET ALL ZERO ISOC DATA FROM OV51x!! */
......@@ -4479,7 +4474,7 @@ static const __devinitdata struct usb_device_id device_table[] = {
{USB_DEVICE(0x0b62, 0x0059), .driver_info = BRIDGE_OVFX2 },
{USB_DEVICE(0x0e96, 0xc001), .driver_info = BRIDGE_OVFX2 },
{USB_DEVICE(0x1046, 0x9967), .driver_info = BRIDGE_W9968CF },
{USB_DEVICE(0x8020, 0xEF04), .driver_info = BRIDGE_OVFX2 },
{USB_DEVICE(0x8020, 0xef04), .driver_info = BRIDGE_OVFX2 },
{}
};
......
......@@ -150,10 +150,10 @@ static int w9968cf_upload_quantizationtables(struct sd *sd)
ret += reg_w(sd, 0x39, 0x0010); /* JPEG clock enable */
for (i = 0, j = 0; i < 32; i++, j += 2) {
a = Y_QUANTABLE[j] | ((unsigned)(Y_QUANTABLE[j+1]) << 8);
b = UV_QUANTABLE[j] | ((unsigned)(UV_QUANTABLE[j+1]) << 8);
ret += reg_w(sd, 0x40+i, a);
ret += reg_w(sd, 0x60+i, b);
a = Y_QUANTABLE[j] | ((unsigned)(Y_QUANTABLE[j + 1]) << 8);
b = UV_QUANTABLE[j] | ((unsigned)(UV_QUANTABLE[j + 1]) << 8);
reg_w(sd, 0x40 + i, a);
reg_w(sd, 0x60 + i, b);
}
ret += reg_w(sd, 0x39, 0x0012); /* JPEG encoder enable */
......@@ -351,7 +351,6 @@ static int w9968cf_i2c_r(struct sd *sd, u8 reg)
return ret;
}
/*--------------------------------------------------------------------------
Turn on the LED on some webcams. A beep should be heard too.
Return 0 on success, a negative number otherwise.
......@@ -381,11 +380,11 @@ static int w9968cf_init(struct sd *sd)
int ret = 0;
unsigned long hw_bufsize = sd->sif ? (352 * 288 * 2) : (640 * 480 * 2),
y0 = 0x0000,
u0 = y0 + hw_bufsize/2,
v0 = u0 + hw_bufsize/4,
y1 = v0 + hw_bufsize/4,
u1 = y1 + hw_bufsize/2,
v1 = u1 + hw_bufsize/4;
u0 = y0 + hw_bufsize / 2,
v0 = u0 + hw_bufsize / 4,
y1 = v0 + hw_bufsize / 4,
u1 = y1 + hw_bufsize / 2,
v1 = u1 + hw_bufsize / 4;
ret += reg_w(sd, 0x00, 0xff00); /* power off */
ret += reg_w(sd, 0x00, 0xbf10); /* power on */
......@@ -456,8 +455,8 @@ static int w9968cf_set_crop_window(struct sd *sd)
fw = SC(sd->gspca_dev.width) / max_width;
fh = SC(sd->gspca_dev.height) / max_height;
cw = (fw >= fh) ? max_width : SC(sd->gspca_dev.width)/fh;
ch = (fw >= fh) ? SC(sd->gspca_dev.height)/fw : max_height;
cw = (fw >= fh) ? max_width : SC(sd->gspca_dev.width) / fh;
ch = (fw >= fh) ? SC(sd->gspca_dev.height) / fw : max_height;
sd->sensor_width = max_width;
sd->sensor_height = max_height;
......@@ -489,8 +488,8 @@ static int w9968cf_mode_init_regs(struct sd *sd)
/* Y & UV frame buffer strides (in WORD) */
if (w9968cf_vga_mode[sd->gspca_dev.curr_mode].pixelformat ==
V4L2_PIX_FMT_JPEG) {
ret += reg_w(sd, 0x2c, sd->gspca_dev.width/2);
ret += reg_w(sd, 0x2d, sd->gspca_dev.width/4);
ret += reg_w(sd, 0x2c, sd->gspca_dev.width / 2);
ret += reg_w(sd, 0x2d, sd->gspca_dev.width / 4);
} else
ret += reg_w(sd, 0x2c, sd->gspca_dev.width);
......
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