Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 124491
b: refs/heads/master
c: 6dc4cff
h: refs/heads/master
i:
  124489: 8bbd522
  124487: 8ee0c95
v: v3
  • Loading branch information
Erik Andrén authored and Mauro Carvalho Chehab committed Dec 30, 2008
1 parent 8f87237 commit 762d0d2
Show file tree
Hide file tree
Showing 7 changed files with 99 additions and 96 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 4b8f393391c0492ebec1277d073203392c90677d
refs/heads/master: 6dc4cff0c391c691dae56486f854534658fdfea8
3 changes: 3 additions & 0 deletions trunk/drivers/media/video/gspca/m5602/m5602_bridge.h
Original file line number Diff line number Diff line change
Expand Up @@ -133,4 +133,7 @@ int m5602_read_bridge(
int m5602_write_bridge(
struct sd *sd, u8 address, u8 i2c_data);

int m5602_write_sensor(struct sd *sd, const u8 address,
u8 *i2c_data, const u8 len);

#endif
22 changes: 11 additions & 11 deletions trunk/drivers/media/video/gspca/m5602/m5602_mt9m111.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ int mt9m111_probe(struct sd *sd)
} else {
data[0] = preinit_mt9m111[i][2];
data[1] = preinit_mt9m111[i][3];
mt9m111_write_sensor(sd,
m5602_write_sensor(sd,
preinit_mt9m111[i][1], data, 2);
}
}
Expand Down Expand Up @@ -84,7 +84,7 @@ int mt9m111_init(struct sd *sd)
} else {
data[0] = init_mt9m111[i][2];
data[1] = init_mt9m111[i][3];
err = mt9m111_write_sensor(sd,
err = m5602_write_sensor(sd,
init_mt9m111[i][1], data, 2);
}
}
Expand Down Expand Up @@ -123,7 +123,7 @@ int mt9m111_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
PDEBUG(D_V4L2, "Set vertical flip to %d", val);

/* Set the correct page map */
err = mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
err = m5602_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
if (err < 0)
goto out;

Expand All @@ -132,7 +132,7 @@ int mt9m111_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
goto out;

data[0] = (data[0] & 0xfe) | val;
err = mt9m111_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B,
err = m5602_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B,
data, 2);
out:
return err;
Expand Down Expand Up @@ -161,7 +161,7 @@ int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
PDEBUG(D_V4L2, "Set horizontal flip to %d", val);

/* Set the correct page map */
err = mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
err = m5602_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
if (err < 0)
goto out;

Expand All @@ -170,7 +170,7 @@ int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
goto out;

data[0] = (data[0] & 0xfd) | ((val << 1) & 0x02);
err = mt9m111_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B,
err = m5602_write_sensor(sd, MT9M111_SC_R_MODE_CONTEXT_B,
data, 2);
out:
return err;
Expand Down Expand Up @@ -202,7 +202,7 @@ int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val)
struct sd *sd = (struct sd *) gspca_dev;

/* Set the correct page map */
err = mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
err = m5602_write_sensor(sd, MT9M111_PAGE_MAP, data, 2);
if (err < 0)
goto out;

Expand All @@ -227,7 +227,7 @@ int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val)
PDEBUG(D_V4L2, "tmp=%d, data[1]=%d, data[0]=%d", tmp,
data[1], data[0]);

err = mt9m111_write_sensor(sd, MT9M111_SC_GLOBAL_GAIN,
err = m5602_write_sensor(sd, MT9M111_SC_GLOBAL_GAIN,
data, 2);
out:
return err;
Expand Down Expand Up @@ -318,7 +318,7 @@ static void mt9m111_dump_registers(struct sd *sd)

info("Dumping the mt9m111 sensor core registers");
value[1] = MT9M111_SENSOR_CORE;
mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, value, 2);
m5602_write_sensor(sd, MT9M111_PAGE_MAP, value, 2);
for (address = 0; address < 0xff; address++) {
mt9m111_read_sensor(sd, address, value, 2);
info("register 0x%x contains 0x%x%x",
Expand All @@ -327,7 +327,7 @@ static void mt9m111_dump_registers(struct sd *sd)

info("Dumping the mt9m111 color pipeline registers");
value[1] = MT9M111_COLORPIPE;
mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, value, 2);
m5602_write_sensor(sd, MT9M111_PAGE_MAP, value, 2);
for (address = 0; address < 0xff; address++) {
mt9m111_read_sensor(sd, address, value, 2);
info("register 0x%x contains 0x%x%x",
Expand All @@ -336,7 +336,7 @@ static void mt9m111_dump_registers(struct sd *sd)

info("Dumping the mt9m111 camera control registers");
value[1] = MT9M111_CAMERA_CONTROL;
mt9m111_write_sensor(sd, MT9M111_PAGE_MAP, value, 2);
m5602_write_sensor(sd, MT9M111_PAGE_MAP, value, 2);
for (address = 0; address < 0xff; address++) {
mt9m111_read_sensor(sd, address, value, 2);
info("register 0x%x contains 0x%x%x",
Expand Down
38 changes: 19 additions & 19 deletions trunk/drivers/media/video/gspca/m5602/m5602_ov9650.c
Original file line number Diff line number Diff line change
Expand Up @@ -166,7 +166,7 @@ int ov9650_probe(struct sd *sd)
for (i = 0; i < ARRAY_SIZE(preinit_ov9650); i++) {
u8 data = preinit_ov9650[i][2];
if (preinit_ov9650[i][0] == SENSOR)
ov9650_write_sensor(sd,
m5602_write_sensor(sd,
preinit_ov9650[i][1], &data, 1);
else
m5602_write_bridge(sd, preinit_ov9650[i][1], data);
Expand Down Expand Up @@ -204,7 +204,7 @@ int ov9650_init(struct sd *sd)
for (i = 0; i < ARRAY_SIZE(init_ov9650) && !err; i++) {
data = init_ov9650[i][2];
if (init_ov9650[i][0] == SENSOR)
err = ov9650_write_sensor(sd, init_ov9650[i][1],
err = m5602_write_sensor(sd, init_ov9650[i][1],
&data, 1);
else
err = m5602_write_bridge(sd, init_ov9650[i][1], data);
Expand All @@ -213,7 +213,7 @@ int ov9650_init(struct sd *sd)
if (dmi_check_system(ov9650_flip_dmi_table) && !err) {
info("vflip quirk active");
data = 0x30;
err = ov9650_write_sensor(sd, OV9650_MVFP, &data, 1);
err = m5602_write_sensor(sd, OV9650_MVFP, &data, 1);
}

return err;
Expand All @@ -225,7 +225,7 @@ int ov9650_power_down(struct sd *sd)
for (i = 0; i < ARRAY_SIZE(power_down_ov9650) && !err; i++) {
u8 data = power_down_ov9650[i][2];
if (power_down_ov9650[i][0] == SENSOR)
err = ov9650_write_sensor(sd,
err = m5602_write_sensor(sd,
power_down_ov9650[i][1], &data, 1);
else
err = m5602_write_bridge(sd, power_down_ov9650[i][1],
Expand Down Expand Up @@ -272,21 +272,21 @@ int ov9650_set_exposure(struct gspca_dev *gspca_dev, __s32 val)

/* The 6 MSBs */
i2c_data = (val >> 10) & 0x3f;
err = ov9650_write_sensor(sd, OV9650_AECHM,
err = m5602_write_sensor(sd, OV9650_AECHM,
&i2c_data, 1);
if (err < 0)
goto out;

/* The 8 middle bits */
i2c_data = (val >> 2) & 0xff;
err = ov9650_write_sensor(sd, OV9650_AECH,
err = m5602_write_sensor(sd, OV9650_AECH,
&i2c_data, 1);
if (err < 0)
goto out;

/* The 2 LSBs */
i2c_data = val & 0x03;
err = ov9650_write_sensor(sd, OV9650_COM1, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_COM1, &i2c_data, 1);

out:
return err;
Expand Down Expand Up @@ -320,11 +320,11 @@ int ov9650_set_gain(struct gspca_dev *gspca_dev, __s32 val)
/* Mask away all uninteresting bits */
i2c_data = ((val & 0x0300) >> 2) |
(i2c_data & 0x3F);
err = ov9650_write_sensor(sd, OV9650_VREF, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_VREF, &i2c_data, 1);

/* The 8 LSBs */
i2c_data = val & 0xff;
err = ov9650_write_sensor(sd, OV9650_GAIN, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_GAIN, &i2c_data, 1);
return err;
}

Expand Down Expand Up @@ -352,7 +352,7 @@ int ov9650_set_red_balance(struct gspca_dev *gspca_dev, __s32 val)
val & 0xff);

i2c_data = val & 0xff;
err = ov9650_write_sensor(sd, OV9650_RED, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_RED, &i2c_data, 1);

return err;
}
Expand Down Expand Up @@ -381,7 +381,7 @@ int ov9650_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val)
val & 0xff);

i2c_data = val & 0xff;
err = ov9650_write_sensor(sd, OV9650_BLUE, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_BLUE, &i2c_data, 1);

return err;
}
Expand Down Expand Up @@ -420,7 +420,7 @@ int ov9650_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
i2c_data = ((i2c_data & 0xdf) |
((val & 0x01) << 5));

err = ov9650_write_sensor(sd, OV9650_MVFP, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_MVFP, &i2c_data, 1);
out:
return err;
}
Expand Down Expand Up @@ -459,7 +459,7 @@ int ov9650_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
i2c_data = ((i2c_data & 0xef) |
((val & 0x01) << 4));

err = ov9650_write_sensor(sd, OV9650_MVFP, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_MVFP, &i2c_data, 1);
out:
return err;
}
Expand Down Expand Up @@ -498,13 +498,13 @@ int ov9650_set_brightness(struct gspca_dev *gspca_dev, __s32 val)

/* Mask away all uninteresting bits */
i2c_data = ((val & 0x0300) >> 2) | (i2c_data & 0x3F);
err = ov9650_write_sensor(sd, OV9650_VREF, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_VREF, &i2c_data, 1);
if (err < 0)
goto out;

/* The 8 LSBs */
i2c_data = val & 0xff;
err = ov9650_write_sensor(sd, OV9650_GAIN, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_GAIN, &i2c_data, 1);

out:
return err;
Expand Down Expand Up @@ -535,7 +535,7 @@ int ov9650_set_auto_white_balance(struct gspca_dev *gspca_dev, __s32 val)
goto out;

i2c_data = ((i2c_data & 0xfd) | ((val & 0x01) << 1));
err = ov9650_write_sensor(sd, OV9650_COM8, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_COM8, &i2c_data, 1);
out:
return err;
}
Expand Down Expand Up @@ -565,7 +565,7 @@ int ov9650_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val)
goto out;

i2c_data = ((i2c_data & 0xfb) | ((val & 0x01) << 2));
err = ov9650_write_sensor(sd, OV9650_COM8, &i2c_data, 1);
err = m5602_write_sensor(sd, OV9650_COM8, &i2c_data, 1);
out:
return err;
}
Expand All @@ -589,7 +589,7 @@ static void ov9650_dump_registers(struct sd *sd)
u8 test_value[2] = {0xff, 0xff};

ov9650_read_sensor(sd, address, &old_value, 1);
ov9650_write_sensor(sd, address, test_value, 1);
m5602_write_sensor(sd, address, test_value, 1);
ov9650_read_sensor(sd, address, &ctrl_value, 1);

if (ctrl_value == test_value[0])
Expand All @@ -598,6 +598,6 @@ static void ov9650_dump_registers(struct sd *sd)
info("register 0x%x is read only", address);

/* Restore original value */
ov9650_write_sensor(sd, address, &old_value, 1);
m5602_write_sensor(sd, address, &old_value, 1);
}
}
24 changes: 12 additions & 12 deletions trunk/drivers/media/video/gspca/m5602/m5602_po1030.c
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ int po1030_probe(struct sd *sd)
for (i = 0; i < ARRAY_SIZE(preinit_po1030); i++) {
u8 data = preinit_po1030[i][2];
if (preinit_po1030[i][0] == SENSOR)
po1030_write_sensor(sd,
m5602_write_sensor(sd,
preinit_po1030[i][1], &data, 1);
else
m5602_write_bridge(sd, preinit_po1030[i][1], data);
Expand Down Expand Up @@ -158,14 +158,14 @@ int po1030_init(struct sd *sd)

case SENSOR:
data[0] = init_po1030[i][2];
err = po1030_write_sensor(sd,
err = m5602_write_sensor(sd,
init_po1030[i][1], data, 1);
break;

case SENSOR_LONG:
data[0] = init_po1030[i][2];
data[1] = init_po1030[i][3];
err = po1030_write_sensor(sd,
err = m5602_write_sensor(sd,
init_po1030[i][1], data, 2);
break;
default:
Expand Down Expand Up @@ -213,15 +213,15 @@ int po1030_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
PDEBUG(D_V4L2, "Set exposure to high byte to 0x%x",
i2c_data);

err = po1030_write_sensor(sd, PO1030_REG_INTEGLINES_H,
err = m5602_write_sensor(sd, PO1030_REG_INTEGLINES_H,
&i2c_data, 1);
if (err < 0)
goto out;

i2c_data = (val & 0xff);
PDEBUG(D_V4L2, "Set exposure to low byte to 0x%x",
i2c_data);
err = po1030_write_sensor(sd, PO1030_REG_INTEGLINES_M,
err = m5602_write_sensor(sd, PO1030_REG_INTEGLINES_M,
&i2c_data, 1);

out:
Expand Down Expand Up @@ -268,7 +268,7 @@ int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val)

i2c_data = (val & 0x01) << 7;

err = po1030_write_sensor(sd, PO1030_REG_CONTROL2,
err = m5602_write_sensor(sd, PO1030_REG_CONTROL2,
&i2c_data, 1);

return err;
Expand Down Expand Up @@ -300,7 +300,7 @@ int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val)

i2c_data = (val & 0x01) << 6;

err = po1030_write_sensor(sd, PO1030_REG_CONTROL2,
err = m5602_write_sensor(sd, PO1030_REG_CONTROL2,
&i2c_data, 1);

return err;
Expand All @@ -314,7 +314,7 @@ int po1030_set_gain(struct gspca_dev *gspca_dev, __s32 val)

i2c_data = val & 0xff;
PDEBUG(D_V4L2, "Set global gain to %d", i2c_data);
err = po1030_write_sensor(sd, PO1030_REG_GLOBALGAIN,
err = m5602_write_sensor(sd, PO1030_REG_GLOBALGAIN,
&i2c_data, 1);
return err;
}
Expand All @@ -340,7 +340,7 @@ int po1030_set_red_balance(struct gspca_dev *gspca_dev, __s32 val)

i2c_data = val & 0xff;
PDEBUG(D_V4L2, "Set red gain to %d", i2c_data);
err = po1030_write_sensor(sd, PO1030_REG_RED_GAIN,
err = m5602_write_sensor(sd, PO1030_REG_RED_GAIN,
&i2c_data, 1);
return err;
}
Expand All @@ -366,7 +366,7 @@ int po1030_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val)
int err;
i2c_data = val & 0xff;
PDEBUG(D_V4L2, "Set blue gain to %d", i2c_data);
err = po1030_write_sensor(sd, PO1030_REG_BLUE_GAIN,
err = m5602_write_sensor(sd, PO1030_REG_BLUE_GAIN,
&i2c_data, 1);

return err;
Expand Down Expand Up @@ -397,7 +397,7 @@ static void po1030_dump_registers(struct sd *sd)
u8 test_value[2] = {0xff, 0xff};

po1030_read_sensor(sd, address, &old_value, 1);
po1030_write_sensor(sd, address, test_value, 1);
m5602_write_sensor(sd, address, test_value, 1);
po1030_read_sensor(sd, address, &ctrl_value, 1);

if (ctrl_value == test_value[0])
Expand All @@ -406,6 +406,6 @@ static void po1030_dump_registers(struct sd *sd)
info("register 0x%x is read only", address);

/* Restore original value */
po1030_write_sensor(sd, address, &old_value, 1);
m5602_write_sensor(sd, address, &old_value, 1);
}
}
Loading

0 comments on commit 762d0d2

Please sign in to comment.