Commit c061c97e authored by Erik Andrén's avatar Erik Andrén Committed by Mauro Carvalho Chehab

V4L/DVB (10021): m5602: Let the po1030 use the common read_sensor function

Signed-off-by: default avatarErik Andrén <erik.andren@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent b66503e3
...@@ -46,10 +46,10 @@ int po1030_probe(struct sd *sd) ...@@ -46,10 +46,10 @@ int po1030_probe(struct sd *sd)
m5602_write_bridge(sd, preinit_po1030[i][1], data); 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; return -ENODEV;
if (po1030_read_sensor(sd, 0x4, &ver_id, 1)) if (m5602_read_sensor(sd, 0x4, &ver_id, 1))
return -ENODEV; return -ENODEV;
if ((prod_id == 0x02) && (ver_id == 0xef)) { if ((prod_id == 0x02) && (ver_id == 0xef)) {
...@@ -144,13 +144,13 @@ int po1030_get_exposure(struct gspca_dev *gspca_dev, __s32 *val) ...@@ -144,13 +144,13 @@ int po1030_get_exposure(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data; u8 i2c_data;
int err; int err;
err = po1030_read_sensor(sd, PO1030_REG_INTEGLINES_H, err = m5602_read_sensor(sd, PO1030_REG_INTEGLINES_H,
&i2c_data, 1); &i2c_data, 1);
if (err < 0) if (err < 0)
goto out; goto out;
*val = (i2c_data << 8); *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); &i2c_data, 1);
*val |= i2c_data; *val |= i2c_data;
...@@ -192,7 +192,7 @@ int po1030_get_gain(struct gspca_dev *gspca_dev, __s32 *val) ...@@ -192,7 +192,7 @@ int po1030_get_gain(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data; u8 i2c_data;
int err; int err;
err = po1030_read_sensor(sd, PO1030_REG_GLOBALGAIN, err = m5602_read_sensor(sd, PO1030_REG_GLOBALGAIN,
&i2c_data, 1); &i2c_data, 1);
*val = i2c_data; *val = i2c_data;
PDEBUG(D_V4L2, "Read global gain %d", *val); PDEBUG(D_V4L2, "Read global gain %d", *val);
...@@ -206,7 +206,7 @@ int po1030_get_hflip(struct gspca_dev *gspca_dev, __s32 *val) ...@@ -206,7 +206,7 @@ int po1030_get_hflip(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data; u8 i2c_data;
int err; int err;
err = po1030_read_sensor(sd, PO1030_REG_CONTROL2, err = m5602_read_sensor(sd, PO1030_REG_CONTROL2,
&i2c_data, 1); &i2c_data, 1);
*val = (i2c_data >> 7) & 0x01 ; *val = (i2c_data >> 7) & 0x01 ;
...@@ -238,7 +238,7 @@ int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val) ...@@ -238,7 +238,7 @@ int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data; u8 i2c_data;
int err; int err;
err = po1030_read_sensor(sd, PO1030_REG_GLOBALGAIN, err = m5602_read_sensor(sd, PO1030_REG_GLOBALGAIN,
&i2c_data, 1); &i2c_data, 1);
*val = (i2c_data >> 6) & 0x01; *val = (i2c_data >> 6) & 0x01;
...@@ -283,7 +283,7 @@ int po1030_get_red_balance(struct gspca_dev *gspca_dev, __s32 *val) ...@@ -283,7 +283,7 @@ int po1030_get_red_balance(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data; u8 i2c_data;
int err; int err;
err = po1030_read_sensor(sd, PO1030_REG_RED_GAIN, err = m5602_read_sensor(sd, PO1030_REG_RED_GAIN,
&i2c_data, 1); &i2c_data, 1);
*val = i2c_data; *val = i2c_data;
PDEBUG(D_V4L2, "Read red gain %d", *val); PDEBUG(D_V4L2, "Read red gain %d", *val);
...@@ -309,7 +309,7 @@ int po1030_get_blue_balance(struct gspca_dev *gspca_dev, __s32 *val) ...@@ -309,7 +309,7 @@ int po1030_get_blue_balance(struct gspca_dev *gspca_dev, __s32 *val)
u8 i2c_data; u8 i2c_data;
int err; int err;
err = po1030_read_sensor(sd, PO1030_REG_BLUE_GAIN, err = m5602_read_sensor(sd, PO1030_REG_BLUE_GAIN,
&i2c_data, 1); &i2c_data, 1);
*val = i2c_data; *val = i2c_data;
PDEBUG(D_V4L2, "Read blue gain %d", *val); PDEBUG(D_V4L2, "Read blue gain %d", *val);
...@@ -342,7 +342,7 @@ static void po1030_dump_registers(struct sd *sd) ...@@ -342,7 +342,7 @@ static void po1030_dump_registers(struct sd *sd)
info("Dumping the po1030 sensor core registers"); info("Dumping the po1030 sensor core registers");
for (address = 0; address < 0x7f; address++) { 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", info("register 0x%x contains 0x%x",
address, value); address, value);
} }
...@@ -354,9 +354,9 @@ static void po1030_dump_registers(struct sd *sd) ...@@ -354,9 +354,9 @@ static void po1030_dump_registers(struct sd *sd)
u8 old_value, ctrl_value; u8 old_value, ctrl_value;
u8 test_value[2] = {0xff, 0xff}; 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); 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]) if (ctrl_value == test_value[0])
info("register 0x%x is writeable", address); info("register 0x%x is writeable", address);
......
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