V4L/DVB (10013): Convert all sensors to use the unified write sensor function
authorErik Andrén <erik.andren@gmail.com>
Wed, 26 Nov 2008 07:08:10 +0000 (04:08 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Tue, 30 Dec 2008 11:39:51 +0000 (09:39 -0200)
Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/m5602/m5602_bridge.h
drivers/media/video/gspca/m5602/m5602_mt9m111.c
drivers/media/video/gspca/m5602/m5602_ov9650.c
drivers/media/video/gspca/m5602/m5602_po1030.c
drivers/media/video/gspca/m5602/m5602_s5k4aa.c
drivers/media/video/gspca/m5602/m5602_s5k83a.c

index 35db1bb9d576892fa00214485c9f26b7d8ddc5cd..51376e2a902d786cc5656e2af889af330039276b 100644 (file)
@@ -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
index e026e245fb52175adbca283026b1380569657da9..0dedd3102a5c37577bc79db1d012aed9a3e26f00 100644 (file)
@@ -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);
                }
        }
@@ -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);
                }
        }
@@ -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;
 
@@ -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;
@@ -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;
 
@@ -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;
@@ -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;
 
@@ -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;
@@ -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",
@@ -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",
@@ -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",
index cefe108b620ef0f35a3a8a0bd7cc84d7b28e5820..5324397daf8149a0ef0f30129edf0cb932b91130 100644 (file)
@@ -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);
@@ -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);
@@ -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;
@@ -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],
@@ -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;
@@ -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;
 }
 
@@ -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;
 }
@@ -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;
 }
@@ -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;
 }
@@ -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;
 }
@@ -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;
@@ -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;
 }
@@ -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;
 }
@@ -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])
@@ -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);
        }
 }
index 655cc1732adace74aad1687475941f10de3d823f..2c65f0c37ff18524858e61a897e853a4175ef079 100644 (file)
@@ -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);
@@ -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:
@@ -213,7 +213,7 @@ 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;
@@ -221,7 +221,7 @@ int po1030_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
        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:
@@ -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;
@@ -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;
@@ -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;
 }
@@ -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;
 }
@@ -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;
@@ -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])
@@ -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);
        }
 }
index 4824afe67ff2057360c2f209c959bbf7c22e26ef..1c85453463cdcb04d09a5ff277ddda6a7796b618 100644 (file)
@@ -83,7 +83,7 @@ int s5k4aa_probe(struct sd *sd)
 
                case SENSOR:
                        data[0] = preinit_s5k4aa[i][2];
-                       err = s5k4aa_write_sensor(sd,
+                       err = m5602_write_sensor(sd,
                                                  preinit_s5k4aa[i][1],
                                                  data, 1);
                        break;
@@ -91,7 +91,7 @@ int s5k4aa_probe(struct sd *sd)
                case SENSOR_LONG:
                        data[0] = preinit_s5k4aa[i][2];
                        data[1] = preinit_s5k4aa[i][3];
-                       err = s5k4aa_write_sensor(sd,
+                       err = m5602_write_sensor(sd,
                                                  preinit_s5k4aa[i][1],
                                                  data, 2);
                        break;
@@ -219,14 +219,14 @@ int s5k4aa_init(struct sd *sd)
 
                case SENSOR:
                        data[0] = init_s5k4aa[i][2];
-                       err = s5k4aa_write_sensor(sd,
+                       err = m5602_write_sensor(sd,
                                init_s5k4aa[i][1], data, 1);
                        break;
 
                case SENSOR_LONG:
                        data[0] = init_s5k4aa[i][2];
                        data[1] = init_s5k4aa[i][3];
-                       err = s5k4aa_write_sensor(sd,
+                       err = m5602_write_sensor(sd,
                                init_s5k4aa[i][1], data, 2);
                        break;
                default:
@@ -241,21 +241,21 @@ int s5k4aa_init(struct sd *sd)
        if (!err && dmi_check_system(s5k4aa_vflip_dmi_table)) {
                u8 data = 0x02;
                info("vertical flip quirk active");
-               s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
+               m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
                s5k4aa_read_sensor(sd, S5K4AA_READ_MODE, &data, 1);
                data |= S5K4AA_RM_V_FLIP;
                data &= ~S5K4AA_RM_H_FLIP;
-               s5k4aa_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
+               m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
 
                /* Decrement COLSTART to preserve color order (BGGR) */
                s5k4aa_read_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
                data--;
-               s5k4aa_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
+               m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
 
                /* Increment ROWSTART to preserve color order (BGGR) */
                s5k4aa_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
                data++;
-               s5k4aa_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
+               m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
        }
 
        return (err < 0) ? err : 0;
@@ -272,7 +272,7 @@ int s5k4aa_get_exposure(struct gspca_dev *gspca_dev, __s32 *val)
        u8 data = S5K4AA_PAGE_MAP_2;
        int err;
 
-       err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
        if (err < 0)
                goto out;
 
@@ -295,15 +295,15 @@ int s5k4aa_set_exposure(struct gspca_dev *gspca_dev, __s32 val)
        int err;
 
        PDEBUG(D_V4L2, "Set exposure to %d", val);
-       err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
        if (err < 0)
                goto out;
        data = (val >> 8) & 0xff;
-       err = s5k4aa_write_sensor(sd, S5K4AA_EXPOSURE_HI, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_EXPOSURE_HI, &data, 1);
        if (err < 0)
                goto out;
        data = val & 0xff;
-       err = s5k4aa_write_sensor(sd, S5K4AA_EXPOSURE_LO, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_EXPOSURE_LO, &data, 1);
 out:
        return err;
 }
@@ -314,7 +314,7 @@ int s5k4aa_get_vflip(struct gspca_dev *gspca_dev, __s32 *val)
        u8 data = S5K4AA_PAGE_MAP_2;
        int err;
 
-       err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
        if (err < 0)
                goto out;
 
@@ -333,15 +333,15 @@ int s5k4aa_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
        int err;
 
        PDEBUG(D_V4L2, "Set vertical flip to %d", val);
-       err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
        if (err < 0)
                goto out;
-       err = s5k4aa_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
        if (err < 0)
                goto out;
        data = ((data & ~S5K4AA_RM_V_FLIP)
                        | ((val & 0x01) << 7));
-       err = s5k4aa_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
        if (err < 0)
                goto out;
 
@@ -351,14 +351,14 @@ int s5k4aa_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
                        goto out;
 
                data++;
-               err = s5k4aa_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
+               err = m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
        } else {
                err = s5k4aa_read_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
                if (err < 0)
                        goto out;
 
                data--;
-               err = s5k4aa_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
+               err = m5602_write_sensor(sd, S5K4AA_ROWSTART_LO, &data, 1);
        }
 out:
        return err;
@@ -370,7 +370,7 @@ int s5k4aa_get_hflip(struct gspca_dev *gspca_dev, __s32 *val)
        u8 data = S5K4AA_PAGE_MAP_2;
        int err;
 
-       err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
        if (err < 0)
                goto out;
 
@@ -389,15 +389,15 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
 
        PDEBUG(D_V4L2, "Set horizontal flip to %d",
               val);
-       err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
        if (err < 0)
                goto out;
-       err = s5k4aa_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
        if (err < 0)
                goto out;
 
        data = ((data & ~S5K4AA_RM_H_FLIP) | ((val & 0x01) << 6));
-       err = s5k4aa_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_READ_MODE, &data, 1);
        if (err < 0)
                goto out;
 
@@ -406,7 +406,7 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
                if (err < 0)
                        goto out;
                data++;
-               err = s5k4aa_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
+               err = m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
                if (err < 0)
                        goto out;
        } else {
@@ -414,7 +414,7 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
                if (err < 0)
                        goto out;
                data--;
-               err = s5k4aa_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
+               err = m5602_write_sensor(sd, S5K4AA_COLSTART_LO, &data, 1);
        }
 out:
        return err;
@@ -426,7 +426,7 @@ int s5k4aa_get_gain(struct gspca_dev *gspca_dev, __s32 *val)
        u8 data = S5K4AA_PAGE_MAP_2;
        int err;
 
-       err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
        if (err < 0)
                goto out;
 
@@ -445,12 +445,12 @@ int s5k4aa_set_gain(struct gspca_dev *gspca_dev, __s32 val)
        int err;
 
        PDEBUG(D_V4L2, "Set gain to %d", val);
-       err = s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &data, 1);
        if (err < 0)
                goto out;
 
        data = val & 0xff;
-       err = s5k4aa_write_sensor(sd, S5K4AA_GAIN_2, &data, 1);
+       err = m5602_write_sensor(sd, S5K4AA_GAIN_2, &data, 1);
 
 out:
        return err;
@@ -462,7 +462,7 @@ static void s5k4aa_dump_registers(struct sd *sd)
        u8 page, old_page;
        s5k4aa_read_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1);
        for (page = 0; page < 16; page++) {
-               s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1);
+               m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1);
                info("Dumping the s5k4aa register state for page 0x%x", page);
                for (address = 0; address <= 0xff; address++) {
                        u8 value = 0;
@@ -474,14 +474,14 @@ static void s5k4aa_dump_registers(struct sd *sd)
        info("s5k4aa register state dump complete");
 
        for (page = 0; page < 16; page++) {
-               s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1);
+               m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &page, 1);
                info("Probing for which registers that are "
                     "read/write for page 0x%x", page);
                for (address = 0; address <= 0xff; address++) {
                        u8 old_value, ctrl_value, test_value = 0xff;
 
                        s5k4aa_read_sensor(sd, address, &old_value, 1);
-                       s5k4aa_write_sensor(sd, address, &test_value, 1);
+                       m5602_write_sensor(sd, address, &test_value, 1);
                        s5k4aa_read_sensor(sd, address, &ctrl_value, 1);
 
                        if (ctrl_value == test_value)
@@ -490,9 +490,9 @@ static void s5k4aa_dump_registers(struct sd *sd)
                                info("register 0x%x is read only", address);
 
                        /* Restore original value */
-                       s5k4aa_write_sensor(sd, address, &old_value, 1);
+                       m5602_write_sensor(sd, address, &old_value, 1);
                }
        }
        info("Read/write register probing complete");
-       s5k4aa_write_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1);
+       m5602_write_sensor(sd, S5K4AA_PAGE_MAP, &old_page, 1);
 }
index 34b99c000c610d7cd7691c212e4a0af3573361f5..84a648d707c870209907d829eaecf8f8e5dc82b6 100644 (file)
@@ -41,7 +41,7 @@ int s5k83a_probe(struct sd *sd)
        for (i = 0; i < ARRAY_SIZE(preinit_s5k83a) && !err; i++) {
                u8 data[2] = {preinit_s5k83a[i][2], preinit_s5k83a[i][3]};
                if (preinit_s5k83a[i][0] == SENSOR)
-                       err = s5k83a_write_sensor(sd, preinit_s5k83a[i][1],
+                       err = m5602_write_sensor(sd, preinit_s5k83a[i][1],
                                data, 2);
                else
                        err = m5602_write_bridge(sd, preinit_s5k83a[i][1],
@@ -167,14 +167,14 @@ int s5k83a_init(struct sd *sd)
 
                case SENSOR:
                        data[0] = init_s5k83a[i][2];
-                       err = s5k83a_write_sensor(sd,
+                       err = m5602_write_sensor(sd,
                                init_s5k83a[i][1], data, 1);
                        break;
 
                case SENSOR_LONG:
                        data[0] = init_s5k83a[i][2];
                        data[1] = init_s5k83a[i][3];
-                       err = s5k83a_write_sensor(sd,
+                       err = m5602_write_sensor(sd,
                                init_s5k83a[i][1], data, 2);
                        break;
                default:
@@ -201,7 +201,7 @@ void s5k83a_dump_registers(struct sd *sd)
        s5k83a_read_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1);
 
        for (page = 0; page < 16; page++) {
-               s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1);
+               m5602_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1);
                info("Dumping the s5k83a register state for page 0x%x", page);
                for (address = 0; address <= 0xff; address++) {
                        u8 val = 0;
@@ -213,14 +213,14 @@ void s5k83a_dump_registers(struct sd *sd)
        info("s5k83a register state dump complete");
 
        for (page = 0; page < 16; page++) {
-               s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1);
+               m5602_write_sensor(sd, S5K83A_PAGE_MAP, &page, 1);
                info("Probing for which registers that are read/write "
                      "for page 0x%x", page);
                for (address = 0; address <= 0xff; address++) {
                        u8 old_val, ctrl_val, test_val = 0xff;
 
                        s5k83a_read_sensor(sd, address, &old_val, 1);
-                       s5k83a_write_sensor(sd, address, &test_val, 1);
+                       m5602_write_sensor(sd, address, &test_val, 1);
                        s5k83a_read_sensor(sd, address, &ctrl_val, 1);
 
                        if (ctrl_val == test_val)
@@ -229,11 +229,11 @@ void s5k83a_dump_registers(struct sd *sd)
                                info("register 0x%x is read only", address);
 
                        /* Restore original val */
-                       s5k83a_write_sensor(sd, address, &old_val, 1);
+                       m5602_write_sensor(sd, address, &old_val, 1);
                }
        }
        info("Read/write register probing complete");
-       s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1);
+       m5602_write_sensor(sd, S5K83A_PAGE_MAP, &old_page, 1);
 }
 
 int s5k83a_get_brightness(struct gspca_dev *gspca_dev, __s32 *val)
@@ -261,13 +261,13 @@ int s5k83a_set_brightness(struct gspca_dev *gspca_dev, __s32 val)
 
        data[0] = 0x00;
        data[1] = 0x20;
-       err = s5k83a_write_sensor(sd, 0x14, data, 2);
+       err = m5602_write_sensor(sd, 0x14, data, 2);
        if (err < 0)
                goto out;
 
        data[0] = 0x01;
        data[1] = 0x00;
-       err = s5k83a_write_sensor(sd, 0x0d, data, 2);
+       err = m5602_write_sensor(sd, 0x0d, data, 2);
        if (err < 0)
                goto out;
 
@@ -275,7 +275,7 @@ int s5k83a_set_brightness(struct gspca_dev *gspca_dev, __s32 val)
                  of these registers */
        data[0] = val >> 3; /* brightness, high 5 bits */
        data[1] = val >> 1; /* brightness, high 7 bits */
-       err = s5k83a_write_sensor(sd, S5K83A_BRIGHTNESS, data, 2);
+       err = m5602_write_sensor(sd, S5K83A_BRIGHTNESS, data, 2);
 
 out:
        return err;
@@ -304,7 +304,7 @@ int s5k83a_set_whiteness(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        data[0] = val;
-       err = s5k83a_write_sensor(sd, S5K83A_WHITENESS, data, 1);
+       err = m5602_write_sensor(sd, S5K83A_WHITENESS, data, 1);
 
        return err;
 }
@@ -337,7 +337,7 @@ int s5k83a_set_gain(struct gspca_dev *gspca_dev, __s32 val)
 
        data[0] = 0;
        data[1] = val;
-       err = s5k83a_write_sensor(sd, S5K83A_GAIN, data, 2);
+       err = m5602_write_sensor(sd, S5K83A_GAIN, data, 2);
        return err;
 }
 
@@ -348,7 +348,7 @@ int s5k83a_get_vflip(struct gspca_dev *gspca_dev, __s32 *val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        data[0] = 0x05;
-       err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
+       err = m5602_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
        if (err < 0)
                goto out;
 
@@ -366,7 +366,7 @@ int s5k83a_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        data[0] = 0x05;
-       err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
+       err = m5602_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
        if (err < 0)
                goto out;
 
@@ -377,12 +377,12 @@ int s5k83a_set_vflip(struct gspca_dev *gspca_dev, __s32 val)
        /* set or zero six bit, seven is hflip */
        data[0] = (val) ? (data[0] & 0x80) | 0x40 | S5K83A_FLIP_MASK
                        : (data[0] & 0x80) | S5K83A_FLIP_MASK;
-       err = s5k83a_write_sensor(sd, S5K83A_FLIP, data, 1);
+       err = m5602_write_sensor(sd, S5K83A_FLIP, data, 1);
        if (err < 0)
                goto out;
 
        data[0] = (val) ? 0x0b : 0x0a;
-       err = s5k83a_write_sensor(sd, S5K83A_VFLIP_TUNE, data, 1);
+       err = m5602_write_sensor(sd, S5K83A_VFLIP_TUNE, data, 1);
 
 out:
        return err;
@@ -395,7 +395,7 @@ int s5k83a_get_hflip(struct gspca_dev *gspca_dev, __s32 *val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        data[0] = 0x05;
-       err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
+       err = m5602_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
        if (err < 0)
                goto out;
 
@@ -413,7 +413,7 @@ int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
        struct sd *sd = (struct sd *) gspca_dev;
 
        data[0] = 0x05;
-       err = s5k83a_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
+       err = m5602_write_sensor(sd, S5K83A_PAGE_MAP, data, 1);
        if (err < 0)
                goto out;
 
@@ -424,12 +424,12 @@ int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val)
        /* set or zero seven bit, six is vflip */
        data[0] = (val) ? (data[0] & 0x40) | 0x80 | S5K83A_FLIP_MASK
                        : (data[0] & 0x40) | S5K83A_FLIP_MASK;
-       err = s5k83a_write_sensor(sd, S5K83A_FLIP, data, 1);
+       err = m5602_write_sensor(sd, S5K83A_FLIP, data, 1);
        if (err < 0)
                goto out;
 
        data[0] = (val) ? 0x0a : 0x0b;
-       err = s5k83a_write_sensor(sd, S5K83A_HFLIP_TUNE, data, 1);
+       err = m5602_write_sensor(sd, S5K83A_HFLIP_TUNE, data, 1);
 out:
        return err;
 }