V4L/DVB (8830): gspca: Move some probe code to the new init function.
authorHans de Goede <j.w.r.degoede@hhs.nl>
Wed, 3 Sep 2008 20:12:19 +0000 (17:12 -0300)
committerMauro Carvalho Chehab <mchehab@redhat.com>
Wed, 3 Sep 2008 21:37:43 +0000 (18:37 -0300)
Signed-off-by: Hans de Goede <j.w.r.degoede@hhs.nl>
Signed-off-by: Jean-Francois Moine <moinejf@free.fr>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
drivers/media/video/gspca/pac7311.c
drivers/media/video/gspca/sonixb.c

index 723219d4964e72751411d7f8f14a44a4bc2c43b3..d4be51843286dccc0f5af80502e96ca89e42eb19 100644 (file)
@@ -245,7 +245,7 @@ static struct v4l2_pix_format vga_mode[] = {
 };
 
 /* pac 7302 */
-static const __u8 probe_7302[] = {
+static const __u8 init_7302[] = {
 /*     index,value */
        0xff, 0x01,             /* page 1 */
        0x78, 0x00,             /* deactivate */
@@ -341,7 +341,7 @@ static const __u8 page3_7302[] = {
 };
 
 /* pac 7311 */
-static const __u8 probe_7311[] = {
+static const __u8 init_7311[] = {
        0x78, 0x40,     /* Bit_0=start stream, Bit_6=LED */
        0x78, 0x40,     /* Bit_0=start stream, Bit_6=LED */
        0x78, 0x44,     /* Bit_0=start stream, Bit_6=LED */
@@ -503,14 +503,10 @@ static int sd_config(struct gspca_dev *gspca_dev,
        sd->sensor = id->driver_info;
        if (sd->sensor == SENSOR_PAC7302) {
                PDEBUG(D_CONF, "Find Sensor PAC7302");
-               reg_w_seq(gspca_dev, probe_7302, sizeof probe_7302);
-
                cam->cam_mode = &vga_mode[2];   /* only 640x480 */
                cam->nmodes = 1;
        } else {
                PDEBUG(D_CONF, "Find Sensor PAC7311");
-               reg_w_seq(gspca_dev, probe_7311, sizeof probe_7311);
-
                cam->cam_mode = vga_mode;
                cam->nmodes = ARRAY_SIZE(vga_mode);
                gspca_dev->ctrl_dis = (1 << BRIGHTNESS_IDX)
@@ -669,6 +665,13 @@ static void sethvflip(struct gspca_dev *gspca_dev)
 /* this function is called at probe and resume time */
 static int sd_init(struct gspca_dev *gspca_dev)
 {
+       struct sd *sd = (struct sd *) gspca_dev;
+
+       if (sd->sensor == SENSOR_PAC7302)
+               reg_w_seq(gspca_dev, init_7302, sizeof init_7302);
+       else
+               reg_w_seq(gspca_dev, init_7311, sizeof init_7311);
+
        return 0;
 }
 
index 162beb3feadb124f54785063e6fb13060e89c88f..602608031247d68142700403b3c2c11914b89cac 100644 (file)
@@ -736,7 +736,6 @@ static int sd_config(struct gspca_dev *gspca_dev,
        struct sd *sd = (struct sd *) gspca_dev;
        struct cam *cam;
        int sif = 0;
-       const __u8 stop = 0x09; /* Disable stream turn of LED */
 
        reg_r(gspca_dev, 0x00);
        if (gspca_dev->usb_buf[0] != 0x10)
@@ -773,15 +772,16 @@ static int sd_config(struct gspca_dev *gspca_dev,
                sd->autogain = AUTOGAIN_DEF;
        sd->freq = FREQ_DEF;
 
-       /* Disable stream turn of LED */
-       reg_w(gspca_dev, 0x01, &stop, 1);
-
        return 0;
 }
 
 /* this function is called at probe and resume time */
 static int sd_init(struct gspca_dev *gspca_dev)
 {
+       const __u8 stop = 0x09; /* Disable stream turn of LED */
+
+       reg_w(gspca_dev, 0x01, &stop, 1);
+
        return 0;
 }