aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/gspca/m5602
diff options
context:
space:
mode:
authorErik Andrén <erik.andren@gmail.com>2008-11-27 11:46:39 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2008-12-30 06:39:54 -0500
commitc061c97e8db75eb5bab808dcfa93df3767c97b5a (patch)
tree22cf692c59fec6f8b38a71208acf2e41b1329fdf /drivers/media/video/gspca/m5602
parentb66503e30e9f4dc137128364277a988f8b40fa80 (diff)
V4L/DVB (10021): m5602: Let the po1030 use the common read_sensor function
Signed-off-by: Erik Andrén <erik.andren@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/m5602')
-rw-r--r--drivers/media/video/gspca/m5602/m5602_po1030.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c
index f52a3cd3343..ae257a9a5e3 100644
--- a/drivers/media/video/gspca/m5602/m5602_po1030.c
+++ b/drivers/media/video/gspca/m5602/m5602_po1030.c
@@ -46,10 +46,10 @@ int po1030_probe(struct sd *sd)
46 m5602_write_bridge(sd, preinit_po1030[i][1], data); 46 m5602_write_bridge(sd, preinit_po1030[i][1], data);
47 } 47 }
48 48
49 if (po1030_read_sensor(sd, 0x3, &prod_id, 1)) 49 if (m5602_read_sensor(sd, 0x3, &prod_id, 1))
50 return -ENODEV; 50 return -ENODEV;
51 51
52 if (po1030_read_sensor(sd, 0x4, &ver_id, 1)) 52 if (m5602_read_sensor(sd, 0x4, &ver_id, 1))
53 return -ENODEV; 53 return -ENODEV;
54 54
55 if ((prod_id == 0x02) && (ver_id == 0xef)) { 55 if ((prod_id == 0x02) && (ver_id == 0xef)) {
@@ -67,7 +67,7 @@ sensor_found:
67} 67}
68 68
69int po1030_read_sensor(struct sd *sd, const u8 address, 69int po1030_read_sensor(struct sd *sd, const u8 address,
70 u8 *i2c_data, const u8 len) 70 u8 *i2c_data, const u8 len)
71{ 71{
72 int err, i; 72 int err, i;
73 73
@@ -144,13 +144,13 @@ int po1030_get_exposure(struct gspca_dev *gspca_dev, __s32 *val)
144 u8 i2c_data; 144 u8 i2c_data;
145 int err; 145 int err;
146 146
147 err = po1030_read_sensor(sd, PO1030_REG_INTEGLINES_H, 147 err = m5602_read_sensor(sd, PO1030_REG_INTEGLINES_H,
148 &i2c_data, 1); 148 &i2c_data, 1);
149 if (err < 0) 149 if (err < 0)
150 goto out; 150 goto out;
151 *val = (i2c_data << 8); 151 *val = (i2c_data << 8);
152 152
153 err = po1030_read_sensor(sd, PO1030_REG_INTEGLINES_M, 153 err = m5602_read_sensor(sd, PO1030_REG_INTEGLINES_M,
154 &i2c_data, 1); 154 &i2c_data, 1);
155 *val |= i2c_data; 155 *val |= i2c_data;
156 156
@@ -192,7 +192,7 @@ int po1030_get_gain(struct gspca_dev *gspca_dev, __s32 *val)
192 u8 i2c_data; 192 u8 i2c_data;
193 int err; 193 int err;
194 194
195 err = po1030_read_sensor(sd, PO1030_REG_GLOBALGAIN, 195 err = m5602_read_sensor(sd, PO1030_REG_GLOBALGAIN,
196 &i2c_data, 1); 196 &i2c_data, 1);
197 *val = i2c_data; 197 *val = i2c_data;
198 PDEBUG(D_V4L2, "Read global gain %d", *val); 198 PDEBUG(D_V4L2, "Read global gain %d", *val);
@@ -206,7 +206,7 @@ int po1030_get_hflip(struct gspca_dev *gspca_dev, __s32 *val)
206 u8 i2c_data; 206 u8 i2c_data;
207 int err; 207 int err;
208 208
209 err = po1030_read_sensor(sd, PO1030_REG_CONTROL2, 209 err = m5602_read_sensor(sd, PO1030_REG_CONTROL2,
210 &i2c_data, 1); 210 &i2c_data, 1);
211 211
212 *val = (i2c_data >> 7) & 0x01 ; 212 *val = (i2c_data >> 7) & 0x01 ;
@@ -238,7 +238,7 @@ int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val)
238 u8 i2c_data; 238 u8 i2c_data;
239 int err; 239 int err;
240 240
241 err = po1030_read_sensor(sd, PO1030_REG_GLOBALGAIN, 241 err = m5602_read_sensor(sd, PO1030_REG_GLOBALGAIN,
242 &i2c_data, 1); 242 &i2c_data, 1);
243 243
244 *val = (i2c_data >> 6) & 0x01; 244 *val = (i2c_data >> 6) & 0x01;
@@ -283,7 +283,7 @@ int po1030_get_red_balance(struct gspca_dev *gspca_dev, __s32 *val)
283 u8 i2c_data; 283 u8 i2c_data;
284 int err; 284 int err;
285 285
286 err = po1030_read_sensor(sd, PO1030_REG_RED_GAIN, 286 err = m5602_read_sensor(sd, PO1030_REG_RED_GAIN,
287 &i2c_data, 1); 287 &i2c_data, 1);
288 *val = i2c_data; 288 *val = i2c_data;
289 PDEBUG(D_V4L2, "Read red gain %d", *val); 289 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 u8 i2c_data; 309 u8 i2c_data;
310 int err; 310 int err;
311 311
312 err = po1030_read_sensor(sd, PO1030_REG_BLUE_GAIN, 312 err = m5602_read_sensor(sd, PO1030_REG_BLUE_GAIN,
313 &i2c_data, 1); 313 &i2c_data, 1);
314 *val = i2c_data; 314 *val = i2c_data;
315 PDEBUG(D_V4L2, "Read blue gain %d", *val); 315 PDEBUG(D_V4L2, "Read blue gain %d", *val);
@@ -342,7 +342,7 @@ static void po1030_dump_registers(struct sd *sd)
342 342
343 info("Dumping the po1030 sensor core registers"); 343 info("Dumping the po1030 sensor core registers");
344 for (address = 0; address < 0x7f; address++) { 344 for (address = 0; address < 0x7f; address++) {
345 po1030_read_sensor(sd, address, &value, 1); 345 m5602_read_sensor(sd, address, &value, 1);
346 info("register 0x%x contains 0x%x", 346 info("register 0x%x contains 0x%x",
347 address, value); 347 address, value);
348 } 348 }
@@ -354,9 +354,9 @@ static void po1030_dump_registers(struct sd *sd)
354 u8 old_value, ctrl_value; 354 u8 old_value, ctrl_value;
355 u8 test_value[2] = {0xff, 0xff}; 355 u8 test_value[2] = {0xff, 0xff};
356 356
357 po1030_read_sensor(sd, address, &old_value, 1); 357 m5602_read_sensor(sd, address, &old_value, 1);
358 m5602_write_sensor(sd, address, test_value, 1); 358 m5602_write_sensor(sd, address, test_value, 1);
359 po1030_read_sensor(sd, address, &ctrl_value, 1); 359 m5602_read_sensor(sd, address, &ctrl_value, 1);
360 360
361 if (ctrl_value == test_value[0]) 361 if (ctrl_value == test_value[0])
362 info("register 0x%x is writeable", address); 362 info("register 0x%x is writeable", address);