Skip to content

Commit

Permalink
V4L/DVB (10021): m5602: Let the po1030 use the common read_sensor fun…
Browse files Browse the repository at this point in the history
…ction

Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Erik Andrén authored and Mauro Carvalho Chehab committed Dec 30, 2008
1 parent b66503e commit c061c97
Showing 1 changed file with 13 additions and 13 deletions.
26 changes: 13 additions & 13 deletions drivers/media/video/gspca/m5602/m5602_po1030.c
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ int po1030_probe(struct sd *sd)
m5602_write_bridge(sd, preinit_po1030[i][1], data);
}

if (po1030_read_sensor(sd, 0x3, &prod_id, 1))
if (m5602_read_sensor(sd, 0x3, &prod_id, 1))
return -ENODEV;

if (po1030_read_sensor(sd, 0x4, &ver_id, 1))
if (m5602_read_sensor(sd, 0x4, &ver_id, 1))
return -ENODEV;

if ((prod_id == 0x02) && (ver_id == 0xef)) {
Expand All @@ -67,7 +67,7 @@ int po1030_probe(struct sd *sd)
}

int po1030_read_sensor(struct sd *sd, const u8 address,
u8 *i2c_data, const u8 len)
u8 *i2c_data, const u8 len)
{
int err, i;

Expand Down Expand Up @@ -144,13 +144,13 @@ int po1030_get_exposure(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data;
int err;

err = po1030_read_sensor(sd, PO1030_REG_INTEGLINES_H,
err = m5602_read_sensor(sd, PO1030_REG_INTEGLINES_H,
&i2c_data, 1);
if (err < 0)
goto out;
*val = (i2c_data << 8);

err = po1030_read_sensor(sd, PO1030_REG_INTEGLINES_M,
err = m5602_read_sensor(sd, PO1030_REG_INTEGLINES_M,
&i2c_data, 1);
*val |= i2c_data;

Expand Down Expand Up @@ -192,7 +192,7 @@ int po1030_get_gain(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data;
int err;

err = po1030_read_sensor(sd, PO1030_REG_GLOBALGAIN,
err = m5602_read_sensor(sd, PO1030_REG_GLOBALGAIN,
&i2c_data, 1);
*val = i2c_data;
PDEBUG(D_V4L2, "Read global gain %d", *val);
Expand All @@ -206,7 +206,7 @@ int po1030_get_hflip(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data;
int err;

err = po1030_read_sensor(sd, PO1030_REG_CONTROL2,
err = m5602_read_sensor(sd, PO1030_REG_CONTROL2,
&i2c_data, 1);

*val = (i2c_data >> 7) & 0x01 ;
Expand Down Expand Up @@ -238,7 +238,7 @@ int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data;
int err;

err = po1030_read_sensor(sd, PO1030_REG_GLOBALGAIN,
err = m5602_read_sensor(sd, PO1030_REG_GLOBALGAIN,
&i2c_data, 1);

*val = (i2c_data >> 6) & 0x01;
Expand Down Expand Up @@ -283,7 +283,7 @@ int po1030_get_red_balance(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data;
int err;

err = po1030_read_sensor(sd, PO1030_REG_RED_GAIN,
err = m5602_read_sensor(sd, PO1030_REG_RED_GAIN,
&i2c_data, 1);
*val = i2c_data;
PDEBUG(D_V4L2, "Read red gain %d", *val);
Expand All @@ -309,7 +309,7 @@ int po1030_get_blue_balance(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data;
int err;

err = po1030_read_sensor(sd, PO1030_REG_BLUE_GAIN,
err = m5602_read_sensor(sd, PO1030_REG_BLUE_GAIN,
&i2c_data, 1);
*val = i2c_data;
PDEBUG(D_V4L2, "Read blue gain %d", *val);
Expand Down Expand Up @@ -342,7 +342,7 @@ static void po1030_dump_registers(struct sd *sd)

info("Dumping the po1030 sensor core registers");
for (address = 0; address < 0x7f; address++) {
po1030_read_sensor(sd, address, &value, 1);
m5602_read_sensor(sd, address, &value, 1);
info("register 0x%x contains 0x%x",
address, value);
}
Expand All @@ -354,9 +354,9 @@ static void po1030_dump_registers(struct sd *sd)
u8 old_value, ctrl_value;
u8 test_value[2] = {0xff, 0xff};

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

if (ctrl_value == test_value[0])
info("register 0x%x is writeable", address);
Expand Down

0 comments on commit c061c97

Please sign in to comment.