From d762428c9dbb0c0ec232dea1d8a9d3cb34c4cfa1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Wed, 17 Jun 2009 08:11:24 +0200 Subject: gspca - m5602-ov7660: Create blue gain control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Hook up a blue gain v4l2 controller Priority: normal Signed-off-by: Erik Andrén --- .../drivers/media/video/gspca/m5602/m5602_ov7660.c | 43 ++++++++++++++++++++++ .../drivers/media/video/gspca/m5602/m5602_ov7660.h | 20 ++++------ 2 files changed, 51 insertions(+), 12 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c index 7aafeb7cf..8125c5b6c 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c @@ -20,6 +20,8 @@ static int ov7660_get_gain(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_gain(struct gspca_dev *gspca_dev, __s32 val); +static int ov7660_get_blue_gain(struct gspca_dev *gspca_dev, __s32 *val); +static int ov7660_set_blue_gain(struct gspca_dev *gspca_dev, __s32 val); const static struct ctrl ov7660_ctrls[] = { #define GAIN_IDX 1 @@ -37,6 +39,22 @@ const static struct ctrl ov7660_ctrls[] = { .set = ov7660_set_gain, .get = ov7660_get_gain }, +#define BLUE_BALANCE_IDX 2 + { + { + .id = V4L2_CID_BLUE_BALANCE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "blue balance", + .minimum = 0x00, + .maximum = 0x7f, + .step = 0x1, + .default_value = OV7660_DEFAULT_BLUE_GAIN, + .flags = V4L2_CTRL_FLAG_SLIDER + }, + .set = ov7660_set_blue_gain, + .get = ov7660_get_blue_gain + }, + }; static struct v4l2_pix_format ov7660_modes[] = { @@ -194,6 +212,31 @@ static int ov7660_set_gain(struct gspca_dev *gspca_dev, __s32 val) return err; } +static int ov7660_get_blue_gain(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + *val = sensor_settings[BLUE_BALANCE_IDX]; + PDEBUG(D_V4L2, "Read blue balance %d", *val); + return 0; +} + +static int ov7660_set_blue_gain(struct gspca_dev *gspca_dev, __s32 val) +{ + int err; + u8 i2c_data; + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + PDEBUG(D_V4L2, "Setting blue balance to %d", val); + + sensor_settings[BLUE_BALANCE_IDX] = val; + + err = m5602_write_sensor(sd, OV7660_BLUE_GAIN, &i2c_data, 1); + return err; +} + static void ov7660_dump_registers(struct sd *sd) { int address; diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h index 3f2c169a9..d2589d654 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h @@ -66,23 +66,23 @@ #define OV7660_RBIAS 0x2c #define OV7660_HREF 0x32 #define OV7660_ADC 0x37 -#define OV7660_OFON 0x39 -#define OV7660_TSLB 0x3a -#define OV7660_COM12 0x3c -#define OV7660_COM13 0x3d +#define OV7660_OFON 0x39 +#define OV7660_TSLB 0x3a +#define OV7660_COM12 0x3c +#define OV7660_COM13 0x3d #define OV7660_LCC1 0x62 #define OV7660_LCC2 0x63 #define OV7660_LCC3 0x64 #define OV7660_LCC4 0x65 #define OV7660_LCC5 0x66 -#define OV7660_HV 0x69 -#define OV7660_RSVDA1 0xa1 +#define OV7660_HV 0x69 +#define OV7660_RSVDA1 0xa1 #define OV7660_DEFAULT_GAIN 0x0e -#define OV7660_DEFAULT_RED_GAIN 0x80 +#define OV7660_DEFAULT_RED_GAIN 0x80 #define OV7660_DEFAULT_BLUE_GAIN 0x80 #define OV7660_DEFAULT_SATURATION 0x00 -#define OV7660_DEFAULT_EXPOSURE 0x20 +#define OV7660_DEFAULT_EXPOSURE 0x20 /* Kernel module parameters */ extern int force_sensor; @@ -199,8 +199,6 @@ static const unsigned char init_ov7660[][4] = {SENSOR, OV7660_COM7, 0x80}, {SENSOR, OV7660_CLKRC, 0x80}, - {SENSOR, OV7660_BLUE_GAIN, 0x80}, - {SENSOR, OV7660_RED_GAIN, 0x80}, {SENSOR, OV7660_COM9, 0x4c}, {SENSOR, OV7660_OFON, 0x43}, {SENSOR, OV7660_COM12, 0x28}, @@ -264,8 +262,6 @@ static const unsigned char init_ov7660[][4] = {SENSOR, OV7660_OFON, 0x0c}, {SENSOR, OV7660_COM2, 0x11}, {SENSOR, OV7660_COM7, 0x05}, - {SENSOR, OV7660_BLUE_GAIN, 0x80}, - {SENSOR, OV7660_RED_GAIN, 0x80}, {BRIDGE, M5602_XB_GPIO_DIR, 0x01}, {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, -- cgit v1.2.3 From fd9d2330d3da07a09a378f54f87283bb8d36a9b7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Wed, 17 Jun 2009 08:14:12 +0200 Subject: gspca - m5602-ov7660: Add red gain control MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Hook up the red gain controller Priority: normal Signed-off-by: Erik Andrén --- .../drivers/media/video/gspca/m5602/m5602_ov7660.c | 43 +++++++++++++++++++++- 1 file changed, 42 insertions(+), 1 deletion(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c index 8125c5b6c..9d0cf2ccd 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c @@ -22,6 +22,8 @@ static int ov7660_get_gain(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_gain(struct gspca_dev *gspca_dev, __s32 val); static int ov7660_get_blue_gain(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_blue_gain(struct gspca_dev *gspca_dev, __s32 val); +static int ov7660_get_red_gain(struct gspca_dev *gspca_dev, __s32 *val); +static int ov7660_set_red_gain(struct gspca_dev *gspca_dev, __s32 val); const static struct ctrl ov7660_ctrls[] = { #define GAIN_IDX 1 @@ -54,7 +56,21 @@ const static struct ctrl ov7660_ctrls[] = { .set = ov7660_set_blue_gain, .get = ov7660_get_blue_gain }, - +#define RED_BALANCE_IDX 3 + { + { + .id = V4L2_CID_RED_BALANCE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "red balance", + .minimum = 0x00, + .maximum = 0x7f, + .step = 0x1, + .default_value = OV7660_DEFAULT_RED_GAIN, + .flags = V4L2_CTRL_FLAG_SLIDER + }, + .set = ov7660_set_red_gain, + .get = ov7660_get_red_gain + }, }; static struct v4l2_pix_format ov7660_modes[] = { @@ -237,6 +253,31 @@ static int ov7660_set_blue_gain(struct gspca_dev *gspca_dev, __s32 val) return err; } +static int ov7660_get_red_gain(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + *val = sensor_settings[RED_BALANCE_IDX]; + PDEBUG(D_V4L2, "Read red balance %d", *val); + return 0; +} + +static int ov7660_set_red_gain(struct gspca_dev *gspca_dev, __s32 val) +{ + int err; + u8 i2c_data; + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + PDEBUG(D_V4L2, "Setting red balance to %d", val); + + sensor_settings[RED_BALANCE_IDX] = val; + + err = m5602_write_sensor(sd, OV7660_RED_GAIN, &i2c_data, 1); + return err; +} + static void ov7660_dump_registers(struct sd *sd) { int address; -- cgit v1.2.3 From 1abedefc954fc378582dc2108680b721512097fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Wed, 17 Jun 2009 18:01:07 +0200 Subject: gspca - m5602-ov7660: Ensure that the default exposure is set MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Ensure that the default exposure value is set at startup Priority: normal Signed-off-by: Erik Andrén --- linux/drivers/media/video/gspca/m5602/m5602_ov7660.h | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h index d2589d654..8027b64b7 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h @@ -218,7 +218,6 @@ static const unsigned char init_ov7660[][4] = {SENSOR, OV7660_RSVD29, 0x98}, {SENSOR, OV7660_RBIAS, 0x98}, {SENSOR, OV7660_COM1, 0x00}, - {SENSOR, OV7660_AECH, 0x00}, {SENSOR, OV7660_AECHH, 0x00}, {SENSOR, OV7660_ADC, 0x04}, {SENSOR, OV7660_COM13, 0x00}, @@ -257,11 +256,10 @@ static const unsigned char init_ov7660[][4] = {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - {SENSOR, OV7660_AECH, 0x20}, {SENSOR, OV7660_COM1, 0x00}, {SENSOR, OV7660_OFON, 0x0c}, - {SENSOR, OV7660_COM2, 0x11}, - {SENSOR, OV7660_COM7, 0x05}, + {SENSOR, OV7660_COM2, 0x11}, /* Soft sleep, 2x Drive */ + {SENSOR, OV7660_COM7, 0x05}, /* Raw RGB */ {BRIDGE, M5602_XB_GPIO_DIR, 0x01}, {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, -- cgit v1.2.3 From 0067fc823b4d7fe4d598f8f9c8f9aa794b5da5c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Sat, 20 Jun 2009 13:01:27 +0200 Subject: gspca - m5602-ov7660: Create auto white balance ctrl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Priority: normal Signed-off-by: Erik Andrén --- .../drivers/media/video/gspca/m5602/m5602_ov7660.c | 54 ++++++++++++++++++++++ 1 file changed, 54 insertions(+) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c index 9d0cf2ccd..00f8365db 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c @@ -24,6 +24,11 @@ static int ov7660_get_blue_gain(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_blue_gain(struct gspca_dev *gspca_dev, __s32 val); static int ov7660_get_red_gain(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_red_gain(struct gspca_dev *gspca_dev, __s32 val); +static int ov7660_get_auto_white_balance(struct gspca_dev *gspca_dev, + __s32 *val); +static int ov7660_set_auto_white_balance(struct gspca_dev *gspca_dev, + __s32 val); + const static struct ctrl ov7660_ctrls[] = { #define GAIN_IDX 1 @@ -71,6 +76,21 @@ const static struct ctrl ov7660_ctrls[] = { .set = ov7660_set_red_gain, .get = ov7660_get_red_gain }, +#define AUTO_WHITE_BALANCE_IDX 4 + { + { + .id = V4L2_CID_AUTO_WHITE_BALANCE, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "auto white balance", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 1 + }, + .set = ov7660_set_auto_white_balance, + .get = ov7660_get_auto_white_balance + }, + }; static struct v4l2_pix_format ov7660_modes[] = { @@ -182,6 +202,9 @@ int ov7660_init(struct sd *sd) if (err < 0) return err; + err = ov7660_set_auto_white_balance(&sd->gspca_dev, + sensor_settings[AUTO_WHITE_BALANCE_IDX]); + return err; } @@ -278,6 +301,37 @@ static int ov7660_set_red_gain(struct gspca_dev *gspca_dev, __s32 val) return err; } +static int ov7660_get_auto_white_balance(struct gspca_dev *gspca_dev, + __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + *val = sensor_settings[AUTO_WHITE_BALANCE_IDX]; + return 0; +} + +static int ov7660_set_auto_white_balance(struct gspca_dev *gspca_dev, + __s32 val) +{ + int err; + u8 i2c_data; + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + PDEBUG(D_V4L2, "Set auto white balance to %d", val); + + sensor_settings[AUTO_WHITE_BALANCE_IDX] = val; + err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); + if (err < 0) + return err; + + i2c_data = ((i2c_data & 0xfd) | ((val & 0x01) << 1)); + err = m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); + + return err; +} + static void ov7660_dump_registers(struct sd *sd) { int address; -- cgit v1.2.3 From 6f1555efdcffb62297e3ca1459e7d4c085c334bb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Sat, 20 Jun 2009 13:11:13 +0200 Subject: gspca - m5602-ov7660: Set blue and red gain at init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Priority: normal Signed-off-by: Erik Andrén --- linux/drivers/media/video/gspca/m5602/m5602_ov7660.c | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c index 00f8365db..7d2af089e 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c @@ -204,6 +204,16 @@ int ov7660_init(struct sd *sd) err = ov7660_set_auto_white_balance(&sd->gspca_dev, sensor_settings[AUTO_WHITE_BALANCE_IDX]); + if (err < 0) + return err; + + err = ov7660_set_blue_gain(&sd->gspca_dev, + sensor_settings[BLUE_BALANCE_IDX]); + if (err < 0) + return err; + + err = ov7660_set_red_gain(&sd->gspca_dev, + sensor_settings[RED_BALANCE_IDX]); return err; } -- cgit v1.2.3 From da6d81648fe7b2b067d427befbca3dfe65c2f4c7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Sat, 20 Jun 2009 14:29:00 +0200 Subject: gspca - m5602-ov7660: Add auto gain ctrl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Priority: normal Signed-off-by: Erik Andrén --- .../drivers/media/video/gspca/m5602/m5602_ov7660.c | 51 +++++++++++++++++++++- 1 file changed, 50 insertions(+), 1 deletion(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c index 7d2af089e..855c058d5 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c @@ -28,6 +28,8 @@ static int ov7660_get_auto_white_balance(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_auto_white_balance(struct gspca_dev *gspca_dev, __s32 val); +static int ov7660_get_auto_gain(struct gspca_dev *gspca_dev, __s32 *val); +static int ov7660_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val); const static struct ctrl ov7660_ctrls[] = { @@ -90,7 +92,20 @@ const static struct ctrl ov7660_ctrls[] = { .set = ov7660_set_auto_white_balance, .get = ov7660_get_auto_white_balance }, - +#define AUTO_GAIN_CTRL_IDX 5 + { + { + .id = V4L2_CID_AUTOGAIN, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "auto gain control", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 1 + }, + .set = ov7660_set_auto_gain, + .get = ov7660_get_auto_gain + }, }; static struct v4l2_pix_format ov7660_modes[] = { @@ -207,6 +222,11 @@ int ov7660_init(struct sd *sd) if (err < 0) return err; + err = ov7660_set_auto_gain(&sd->gspca_dev, + sensor_settings[AUTO_GAIN_CTRL_IDX]); + if (err < 0) + return err; + err = ov7660_set_blue_gain(&sd->gspca_dev, sensor_settings[BLUE_BALANCE_IDX]); if (err < 0) @@ -342,6 +362,35 @@ static int ov7660_set_auto_white_balance(struct gspca_dev *gspca_dev, return err; } +static int ov7660_get_auto_gain(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + *val = sensor_settings[AUTO_GAIN_CTRL_IDX]; + PDEBUG(D_V4L2, "Read auto gain control %d", *val); + return 0; +} + +static int ov7660_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val) +{ + int err; + u8 i2c_data; + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + PDEBUG(D_V4L2, "Set auto gain control to %d", val); + + sensor_settings[AUTO_GAIN_CTRL_IDX] = val; + err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); + if (err < 0) + return err; + + i2c_data = ((i2c_data & 0xfb) | ((val & 0x01) << 2)); + + return m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); +} + static void ov7660_dump_registers(struct sd *sd) { int address; -- cgit v1.2.3 From 66b7d86be8ceb5b99fda232e1f7e146e9b8f37fe Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Sat, 20 Jun 2009 18:58:41 +0200 Subject: gspca - m5602-ov7660: Add auto exposure ctrl MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Priority: normal Signed-off-by: Erik Andrén --- .../drivers/media/video/gspca/m5602/m5602_ov7660.c | 52 +++++++++++++++++++++- 1 file changed, 51 insertions(+), 1 deletion(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c index 855c058d5..80c64caac 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c @@ -30,7 +30,8 @@ static int ov7660_set_auto_white_balance(struct gspca_dev *gspca_dev, __s32 val); static int ov7660_get_auto_gain(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val); - +static int ov7660_get_auto_exposure(struct gspca_dev *gspca_dev, __s32 *val); +static int ov7660_set_auto_exposure(struct gspca_dev *gspca_dev, __s32 val); const static struct ctrl ov7660_ctrls[] = { #define GAIN_IDX 1 @@ -106,6 +107,20 @@ const static struct ctrl ov7660_ctrls[] = { .set = ov7660_set_auto_gain, .get = ov7660_get_auto_gain }, +#define AUTO_EXPOSURE_IDX 6 + { + { + .id = V4L2_CID_EXPOSURE_AUTO, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "auto exposure", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 1 + }, + .set = ov7660_set_auto_exposure, + .get = ov7660_get_auto_exposure + } }; static struct v4l2_pix_format ov7660_modes[] = { @@ -227,6 +242,11 @@ int ov7660_init(struct sd *sd) if (err < 0) return err; + err = ov7660_set_auto_exposure(&sd->gspca_dev, + sensor_settings[AUTO_EXPOSURE_IDX]); + if (err < 0) + return err; + err = ov7660_set_blue_gain(&sd->gspca_dev, sensor_settings[BLUE_BALANCE_IDX]); if (err < 0) @@ -391,6 +411,36 @@ static int ov7660_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val) return m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); } +static int ov7660_get_auto_exposure(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + *val = sensor_settings[AUTO_EXPOSURE_IDX]; + PDEBUG(D_V4L2, "Read auto exposure control %d", *val); + return 0; +} + +static int ov7660_set_auto_exposure(struct gspca_dev *gspca_dev, + __s32 val) +{ + int err; + u8 i2c_data; + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + PDEBUG(D_V4L2, "Set auto exposure control to %d", val); + + sensor_settings[AUTO_EXPOSURE_IDX] = val; + err = m5602_read_sensor(sd, OV7660_COM8, &i2c_data, 1); + if (err < 0) + return err; + + i2c_data = ((i2c_data & 0xfe) | ((val & 0x01) << 0)); + + return m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); +} + static void ov7660_dump_registers(struct sd *sd) { int address; -- cgit v1.2.3 From 14470e03826d3eeb7b01e31999686524025fcb15 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Sun, 21 Jun 2009 19:58:55 +0200 Subject: gspca - m5602-ov7660: Use a new raw init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Priority: normal Signed-off-by: Erik Andrén --- .../drivers/media/video/gspca/m5602/m5602_ov7660.c | 12 +- .../drivers/media/video/gspca/m5602/m5602_ov7660.h | 248 +++++++++++++++++++++ 2 files changed, 254 insertions(+), 6 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c index 80c64caac..f7c050f25 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c @@ -211,17 +211,17 @@ int ov7660_init(struct sd *sd) s32 *sensor_settings = sd->sensor_priv; /* Init the sensor */ - for (i = 0; i < ARRAY_SIZE(init_ov7660); i++) { + for (i = 0; i < ARRAY_SIZE(init2_ov7660); i++) { u8 data[2]; - if (init_ov7660[i][0] == BRIDGE) { + if (init2_ov7660[i][0] == BRIDGE) { err = m5602_write_bridge(sd, - init_ov7660[i][1], - init_ov7660[i][2]); + init2_ov7660[i][1], + init2_ov7660[i][2]); } else { - data[0] = init_ov7660[i][2]; + data[0] = init2_ov7660[i][2]; err = m5602_write_sensor(sd, - init_ov7660[i][1], data, 1); + init2_ov7660[i][1], data, 1); } } diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h index 8027b64b7..eb0b50ed0 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h @@ -270,4 +270,252 @@ static const unsigned char init_ov7660[][4] = {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0} }; +static const unsigned char init2_ov7660[][4] = { + {BRIDGE, 0x13, 0x02}, + {BRIDGE, 0x12, 0xb0}, + {BRIDGE, 0x15, 0x00}, + {BRIDGE, 0x14, 0xb0}, + {BRIDGE, 0x60, 0xc0}, + {BRIDGE, 0x00, 0x0d}, + {BRIDGE, 0x01, 0x00}, + {BRIDGE, 0x77, 0x01}, + {BRIDGE, 0x77, 0x01}, + {BRIDGE, 0x15, 0x00}, + {BRIDGE, 0x14, 0xb0}, + {BRIDGE, 0x60, 0xc0}, + {BRIDGE, 0x00, 0x0c}, + {BRIDGE, 0x77, 0x05}, + {BRIDGE, 0x76, 0x00}, + {BRIDGE, 0x74, 0x06}, + {BRIDGE, 0x75, 0x00}, + {SENSOR, 0x12, 0x80}, + {SENSOR, 0x11, 0x80}, + {SENSOR, 0x01, 0x80}, + {SENSOR, 0x02, 0x80}, + {SENSOR, 0x14, 0x4c}, + {SENSOR, 0x39, 0x43}, + {SENSOR, 0x3c, 0x28}, + {SENSOR, 0x13, 0x00}, + {SENSOR, 0x15, 0x40}, + {SENSOR, 0x17, 0x0c}, + {SENSOR, 0x18, 0x61}, + {SENSOR, 0x32, 0xa4}, + {SENSOR, 0x1b, 0x0b}, + {SENSOR, 0x19, 0x01}, + {SENSOR, 0x1a, 0x7a}, + {SENSOR, 0x03, 0x00}, + {SENSOR, 0x12, 0x05}, + {SENSOR, 0x0f, 0x42}, + {SENSOR, 0x27, 0x94}, + {SENSOR, 0x28, 0x94}, + {SENSOR, 0x29, 0x94}, + {SENSOR, 0x2c, 0x94}, + {SENSOR, 0x04, 0x00}, + {SENSOR, 0x10, 0x00}, + {SENSOR, 0x07, 0x00}, + {SENSOR, 0x37, 0x05}, + {SENSOR, 0x3d, 0x00}, + {SENSOR, 0xa1, 0x23}, + {SENSOR, 0x3a, 0x0d}, + {SENSOR, 0x69, 0x80}, + {SENSOR, 0x62, 0x00}, + {SENSOR, 0x63, 0x00}, + {SENSOR, 0x64, 0x10}, + {SENSOR, 0x65, 0x40}, + {SENSOR, 0x66, 0x01}, + {BRIDGE, 0x15, 0x06}, + {BRIDGE, 0x14, 0xb0}, + {BRIDGE, 0x60, 0xc0}, + {BRIDGE, 0x00, 0x0c}, + {BRIDGE, 0x02, 0x81}, + {BRIDGE, 0x04, 0x82}, + {BRIDGE, 0x0a, 0x01}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x08}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x01}, + {BRIDGE, 0x06, 0xec}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x0a, 0x00}, + {BRIDGE, 0x0a, 0x02}, + {BRIDGE, 0x07, 0x00}, + {BRIDGE, 0x07, 0x27}, + {BRIDGE, 0x07, 0x02}, + {BRIDGE, 0x07, 0xae}, + {BRIDGE, 0x0a, 0x00}, + {SENSOR, 0x01, 0x80}, + {SENSOR, 0x02, 0x80}, + {BRIDGE, 0x15, 0x02}, + {BRIDGE, 0x14, 0xb0}, + {SENSOR, 0x10, 0x20}, + {SENSOR, 0x04, 0x00}, + {SENSOR, 0x00, 0x07}, + {SENSOR, 0x39, 0x0c}, + {SENSOR, 0x09, 0x11}, + {SENSOR, 0x12, 0x05}, + {BRIDGE, 0x77, 0x01}, + {BRIDGE, 0x76, 0x04}, + {BRIDGE, 0x74, 0x06}, + {BRIDGE, 0x72, 0x06}, + {BRIDGE, 0x70, 0x00}, + {BRIDGE, 0x15, 0x08}, + {BRIDGE, 0x14, 0xb0}, + {BRIDGE, 0x15, 0x00}, + {BRIDGE, 0x14, 0xb0}, + {BRIDGE, 0x60, 0xc0}, + {BRIDGE, 0x00, 0x0c}, + {BRIDGE, 0x77, 0x05}, + {BRIDGE, 0x76, 0x00}, + {BRIDGE, 0x74, 0x06}, + {BRIDGE, 0x75, 0x00}, + {SENSOR, 0x12, 0x80}, + {SENSOR, 0x11, 0x80}, + {SENSOR, 0x01, 0x80}, + {SENSOR, 0x02, 0x80}, + {SENSOR, 0x14, 0x4c}, + {SENSOR, 0x39, 0x43}, + {SENSOR, 0x3c, 0x28}, + {SENSOR, 0x13, 0x00}, + {SENSOR, 0x15, 0x40}, + {SENSOR, 0x17, 0x0c}, + {SENSOR, 0x18, 0x61}, + {SENSOR, 0x32, 0xa4}, + {SENSOR, 0x1b, 0x0b}, + {SENSOR, 0x19, 0x01}, + {SENSOR, 0x1a, 0x7a}, + {SENSOR, 0x03, 0x00}, + {SENSOR, 0x12, 0x05}, + {SENSOR, 0x0f, 0x42}, + {SENSOR, 0x27, 0x94}, + {SENSOR, 0x28, 0x94}, + {SENSOR, 0x29, 0x94}, + {SENSOR, 0x2c, 0x94}, + {SENSOR, 0x04, 0x00}, + {SENSOR, 0x10, 0x00}, + {SENSOR, 0x07, 0x00}, + {SENSOR, 0x37, 0x05}, + {SENSOR, 0x3d, 0x00}, + {SENSOR, 0xa1, 0x23}, + {SENSOR, 0x3a, 0x0d}, + {SENSOR, 0x69, 0x80}, + {SENSOR, 0x62, 0x00}, + {SENSOR, 0x63, 0x00}, + {SENSOR, 0x64, 0x10}, + {SENSOR, 0x65, 0x40}, + {SENSOR, 0x66, 0x01}, + {BRIDGE, 0x15, 0x06}, + {BRIDGE, 0x14, 0xb0}, + {BRIDGE, 0x60, 0xc0}, + {BRIDGE, 0x00, 0x0c}, + {BRIDGE, 0x02, 0x81}, + {BRIDGE, 0x04, 0x82}, + {BRIDGE, 0x0a, 0x01}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x08}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x01}, + {BRIDGE, 0x06, 0xec}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x0a, 0x00}, + {BRIDGE, 0x0a, 0x02}, + {BRIDGE, 0x07, 0x00}, + {BRIDGE, 0x07, 0x27}, + {BRIDGE, 0x07, 0x02}, + {BRIDGE, 0x07, 0xae}, + {BRIDGE, 0x0a, 0x00}, + {SENSOR, 0x01, 0x80}, + {SENSOR, 0x02, 0x80}, + {BRIDGE, 0x15, 0x00}, + {BRIDGE, 0x14, 0xb0}, + {SENSOR, 0x10, 0x5f}, + {SENSOR, 0x04, 0x03}, + {SENSOR, 0x00, 0x02}, + {SENSOR, 0x39, 0x0c}, + {SENSOR, 0x09, 0x11}, + {SENSOR, 0x12, 0x05}, + {BRIDGE, 0x77, 0x01}, + {BRIDGE, 0x76, 0x04}, + {BRIDGE, 0x74, 0x06}, + {BRIDGE, 0x72, 0x06}, + {BRIDGE, 0x70, 0x00}, + {BRIDGE, 0x15, 0x08}, + {BRIDGE, 0x14, 0xb0}, + {BRIDGE, 0x15, 0x00}, + {BRIDGE, 0x14, 0xb0}, + {BRIDGE, 0x60, 0xc0}, + {BRIDGE, 0x00, 0x0c}, + {BRIDGE, 0x77, 0x05}, + {BRIDGE, 0x76, 0x00}, + {BRIDGE, 0x74, 0x06}, + {BRIDGE, 0x75, 0x00}, + {SENSOR, 0x12, 0x80}, + {SENSOR, 0x11, 0x80}, + {SENSOR, 0x01, 0x80}, + {SENSOR, 0x02, 0x80}, + {SENSOR, 0x14, 0x4c}, + {SENSOR, 0x39, 0x43}, + {SENSOR, 0x3c, 0x28}, + {SENSOR, 0x13, 0x00}, + {SENSOR, 0x15, 0x40}, + {SENSOR, 0x17, 0x0c}, + {SENSOR, 0x18, 0x61}, + {SENSOR, 0x32, 0xa4}, + {SENSOR, 0x1b, 0x0b}, + {SENSOR, 0x19, 0x01}, + {SENSOR, 0x1a, 0x7a}, + {SENSOR, 0x03, 0x00}, + {SENSOR, 0x12, 0x05}, + {SENSOR, 0x0f, 0x42}, + {SENSOR, 0x27, 0x94}, + {SENSOR, 0x28, 0x94}, + {SENSOR, 0x29, 0x94}, + {SENSOR, 0x2c, 0x94}, + {SENSOR, 0x04, 0x00}, + {SENSOR, 0x10, 0x00}, + {SENSOR, 0x07, 0x00}, + {SENSOR, 0x37, 0x05}, + {SENSOR, 0x3d, 0x00}, + {SENSOR, 0xa1, 0x23}, + {SENSOR, 0x3a, 0x0d}, + {SENSOR, 0x69, 0x80}, + {SENSOR, 0x62, 0x00}, + {SENSOR, 0x63, 0x00}, + {SENSOR, 0x64, 0x10}, + {SENSOR, 0x65, 0x40}, + {SENSOR, 0x66, 0x01}, + {BRIDGE, 0x15, 0x06}, + {BRIDGE, 0x14, 0xb0}, + {BRIDGE, 0x60, 0xc0}, + {BRIDGE, 0x00, 0x0c}, + {BRIDGE, 0x02, 0x81}, + {BRIDGE, 0x04, 0x82}, + {BRIDGE, 0x0a, 0x01}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x08}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x01}, + {BRIDGE, 0x06, 0xec}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x06, 0x00}, + {BRIDGE, 0x0a, 0x00}, + {BRIDGE, 0x0a, 0x02}, + {BRIDGE, 0x07, 0x00}, + {BRIDGE, 0x07, 0x27}, + {BRIDGE, 0x07, 0x02}, + {BRIDGE, 0x07, 0xae}, + {BRIDGE, 0x0a, 0x00}, + {SENSOR, 0x01, 0x80}, + {SENSOR, 0x02, 0x80}, + {BRIDGE, 0x15, 0x00}, + {BRIDGE, 0x14, 0xb0}, + {SENSOR, 0x10, 0x5f}, + {SENSOR, 0x04, 0x03}, + {SENSOR, 0x00, 0x02} +}; + #endif -- cgit v1.2.3 From 75bfabe99f0467eb71f6c1550a6d47c1754ba7d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Tue, 23 Jun 2009 07:57:05 +0200 Subject: gspca - m5602-ov7660: Replace magic constants with defines MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Priority: normal Signed-off-by: Erik Andrén --- .../drivers/media/video/gspca/m5602/m5602_ov7660.h | 413 +++++++++------------ 1 file changed, 168 insertions(+), 245 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h index eb0b50ed0..8fa850c95 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h @@ -271,251 +271,174 @@ static const unsigned char init_ov7660[][4] = }; static const unsigned char init2_ov7660[][4] = { - {BRIDGE, 0x13, 0x02}, - {BRIDGE, 0x12, 0xb0}, - {BRIDGE, 0x15, 0x00}, - {BRIDGE, 0x14, 0xb0}, - {BRIDGE, 0x60, 0xc0}, - {BRIDGE, 0x00, 0x0d}, - {BRIDGE, 0x01, 0x00}, - {BRIDGE, 0x77, 0x01}, - {BRIDGE, 0x77, 0x01}, - {BRIDGE, 0x15, 0x00}, - {BRIDGE, 0x14, 0xb0}, - {BRIDGE, 0x60, 0xc0}, - {BRIDGE, 0x00, 0x0c}, - {BRIDGE, 0x77, 0x05}, - {BRIDGE, 0x76, 0x00}, - {BRIDGE, 0x74, 0x06}, - {BRIDGE, 0x75, 0x00}, - {SENSOR, 0x12, 0x80}, - {SENSOR, 0x11, 0x80}, - {SENSOR, 0x01, 0x80}, - {SENSOR, 0x02, 0x80}, - {SENSOR, 0x14, 0x4c}, - {SENSOR, 0x39, 0x43}, - {SENSOR, 0x3c, 0x28}, - {SENSOR, 0x13, 0x00}, - {SENSOR, 0x15, 0x40}, - {SENSOR, 0x17, 0x0c}, - {SENSOR, 0x18, 0x61}, - {SENSOR, 0x32, 0xa4}, - {SENSOR, 0x1b, 0x0b}, - {SENSOR, 0x19, 0x01}, - {SENSOR, 0x1a, 0x7a}, - {SENSOR, 0x03, 0x00}, - {SENSOR, 0x12, 0x05}, - {SENSOR, 0x0f, 0x42}, - {SENSOR, 0x27, 0x94}, - {SENSOR, 0x28, 0x94}, - {SENSOR, 0x29, 0x94}, - {SENSOR, 0x2c, 0x94}, - {SENSOR, 0x04, 0x00}, - {SENSOR, 0x10, 0x00}, - {SENSOR, 0x07, 0x00}, - {SENSOR, 0x37, 0x05}, - {SENSOR, 0x3d, 0x00}, - {SENSOR, 0xa1, 0x23}, - {SENSOR, 0x3a, 0x0d}, - {SENSOR, 0x69, 0x80}, - {SENSOR, 0x62, 0x00}, - {SENSOR, 0x63, 0x00}, - {SENSOR, 0x64, 0x10}, - {SENSOR, 0x65, 0x40}, - {SENSOR, 0x66, 0x01}, - {BRIDGE, 0x15, 0x06}, - {BRIDGE, 0x14, 0xb0}, - {BRIDGE, 0x60, 0xc0}, - {BRIDGE, 0x00, 0x0c}, - {BRIDGE, 0x02, 0x81}, - {BRIDGE, 0x04, 0x82}, - {BRIDGE, 0x0a, 0x01}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x08}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x01}, - {BRIDGE, 0x06, 0xec}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x0a, 0x00}, - {BRIDGE, 0x0a, 0x02}, - {BRIDGE, 0x07, 0x00}, - {BRIDGE, 0x07, 0x27}, - {BRIDGE, 0x07, 0x02}, - {BRIDGE, 0x07, 0xae}, - {BRIDGE, 0x0a, 0x00}, - {SENSOR, 0x01, 0x80}, - {SENSOR, 0x02, 0x80}, - {BRIDGE, 0x15, 0x02}, - {BRIDGE, 0x14, 0xb0}, - {SENSOR, 0x10, 0x20}, - {SENSOR, 0x04, 0x00}, - {SENSOR, 0x00, 0x07}, - {SENSOR, 0x39, 0x0c}, - {SENSOR, 0x09, 0x11}, - {SENSOR, 0x12, 0x05}, - {BRIDGE, 0x77, 0x01}, - {BRIDGE, 0x76, 0x04}, - {BRIDGE, 0x74, 0x06}, - {BRIDGE, 0x72, 0x06}, - {BRIDGE, 0x70, 0x00}, - {BRIDGE, 0x15, 0x08}, - {BRIDGE, 0x14, 0xb0}, - {BRIDGE, 0x15, 0x00}, - {BRIDGE, 0x14, 0xb0}, - {BRIDGE, 0x60, 0xc0}, - {BRIDGE, 0x00, 0x0c}, - {BRIDGE, 0x77, 0x05}, - {BRIDGE, 0x76, 0x00}, - {BRIDGE, 0x74, 0x06}, - {BRIDGE, 0x75, 0x00}, - {SENSOR, 0x12, 0x80}, - {SENSOR, 0x11, 0x80}, - {SENSOR, 0x01, 0x80}, - {SENSOR, 0x02, 0x80}, - {SENSOR, 0x14, 0x4c}, - {SENSOR, 0x39, 0x43}, - {SENSOR, 0x3c, 0x28}, - {SENSOR, 0x13, 0x00}, - {SENSOR, 0x15, 0x40}, - {SENSOR, 0x17, 0x0c}, - {SENSOR, 0x18, 0x61}, - {SENSOR, 0x32, 0xa4}, - {SENSOR, 0x1b, 0x0b}, - {SENSOR, 0x19, 0x01}, - {SENSOR, 0x1a, 0x7a}, - {SENSOR, 0x03, 0x00}, - {SENSOR, 0x12, 0x05}, - {SENSOR, 0x0f, 0x42}, - {SENSOR, 0x27, 0x94}, - {SENSOR, 0x28, 0x94}, - {SENSOR, 0x29, 0x94}, - {SENSOR, 0x2c, 0x94}, - {SENSOR, 0x04, 0x00}, - {SENSOR, 0x10, 0x00}, - {SENSOR, 0x07, 0x00}, - {SENSOR, 0x37, 0x05}, - {SENSOR, 0x3d, 0x00}, - {SENSOR, 0xa1, 0x23}, - {SENSOR, 0x3a, 0x0d}, - {SENSOR, 0x69, 0x80}, - {SENSOR, 0x62, 0x00}, - {SENSOR, 0x63, 0x00}, - {SENSOR, 0x64, 0x10}, - {SENSOR, 0x65, 0x40}, - {SENSOR, 0x66, 0x01}, - {BRIDGE, 0x15, 0x06}, - {BRIDGE, 0x14, 0xb0}, - {BRIDGE, 0x60, 0xc0}, - {BRIDGE, 0x00, 0x0c}, - {BRIDGE, 0x02, 0x81}, - {BRIDGE, 0x04, 0x82}, - {BRIDGE, 0x0a, 0x01}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x08}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x01}, - {BRIDGE, 0x06, 0xec}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x0a, 0x00}, - {BRIDGE, 0x0a, 0x02}, - {BRIDGE, 0x07, 0x00}, - {BRIDGE, 0x07, 0x27}, - {BRIDGE, 0x07, 0x02}, - {BRIDGE, 0x07, 0xae}, - {BRIDGE, 0x0a, 0x00}, - {SENSOR, 0x01, 0x80}, - {SENSOR, 0x02, 0x80}, - {BRIDGE, 0x15, 0x00}, - {BRIDGE, 0x14, 0xb0}, - {SENSOR, 0x10, 0x5f}, - {SENSOR, 0x04, 0x03}, - {SENSOR, 0x00, 0x02}, - {SENSOR, 0x39, 0x0c}, - {SENSOR, 0x09, 0x11}, - {SENSOR, 0x12, 0x05}, - {BRIDGE, 0x77, 0x01}, - {BRIDGE, 0x76, 0x04}, - {BRIDGE, 0x74, 0x06}, - {BRIDGE, 0x72, 0x06}, - {BRIDGE, 0x70, 0x00}, - {BRIDGE, 0x15, 0x08}, - {BRIDGE, 0x14, 0xb0}, - {BRIDGE, 0x15, 0x00}, - {BRIDGE, 0x14, 0xb0}, - {BRIDGE, 0x60, 0xc0}, - {BRIDGE, 0x00, 0x0c}, - {BRIDGE, 0x77, 0x05}, - {BRIDGE, 0x76, 0x00}, - {BRIDGE, 0x74, 0x06}, - {BRIDGE, 0x75, 0x00}, - {SENSOR, 0x12, 0x80}, - {SENSOR, 0x11, 0x80}, - {SENSOR, 0x01, 0x80}, - {SENSOR, 0x02, 0x80}, - {SENSOR, 0x14, 0x4c}, - {SENSOR, 0x39, 0x43}, - {SENSOR, 0x3c, 0x28}, - {SENSOR, 0x13, 0x00}, - {SENSOR, 0x15, 0x40}, - {SENSOR, 0x17, 0x0c}, - {SENSOR, 0x18, 0x61}, - {SENSOR, 0x32, 0xa4}, - {SENSOR, 0x1b, 0x0b}, - {SENSOR, 0x19, 0x01}, - {SENSOR, 0x1a, 0x7a}, - {SENSOR, 0x03, 0x00}, - {SENSOR, 0x12, 0x05}, - {SENSOR, 0x0f, 0x42}, - {SENSOR, 0x27, 0x94}, - {SENSOR, 0x28, 0x94}, - {SENSOR, 0x29, 0x94}, - {SENSOR, 0x2c, 0x94}, - {SENSOR, 0x04, 0x00}, - {SENSOR, 0x10, 0x00}, - {SENSOR, 0x07, 0x00}, - {SENSOR, 0x37, 0x05}, - {SENSOR, 0x3d, 0x00}, - {SENSOR, 0xa1, 0x23}, - {SENSOR, 0x3a, 0x0d}, - {SENSOR, 0x69, 0x80}, - {SENSOR, 0x62, 0x00}, - {SENSOR, 0x63, 0x00}, - {SENSOR, 0x64, 0x10}, - {SENSOR, 0x65, 0x40}, - {SENSOR, 0x66, 0x01}, - {BRIDGE, 0x15, 0x06}, - {BRIDGE, 0x14, 0xb0}, - {BRIDGE, 0x60, 0xc0}, - {BRIDGE, 0x00, 0x0c}, - {BRIDGE, 0x02, 0x81}, - {BRIDGE, 0x04, 0x82}, - {BRIDGE, 0x0a, 0x01}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x08}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x01}, - {BRIDGE, 0x06, 0xec}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x06, 0x00}, - {BRIDGE, 0x0a, 0x00}, - {BRIDGE, 0x0a, 0x02}, - {BRIDGE, 0x07, 0x00}, - {BRIDGE, 0x07, 0x27}, - {BRIDGE, 0x07, 0x02}, - {BRIDGE, 0x07, 0xae}, - {BRIDGE, 0x0a, 0x00}, - {SENSOR, 0x01, 0x80}, - {SENSOR, 0x02, 0x80}, - {BRIDGE, 0x15, 0x00}, - {BRIDGE, 0x14, 0xb0}, - {SENSOR, 0x10, 0x5f}, - {SENSOR, 0x04, 0x03}, - {SENSOR, 0x00, 0x02} + {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02}, + {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, + {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0d}, + {BRIDGE, M5602_XB_SENSOR_CTRL, 0x00}, + {BRIDGE, M5602_XB_GPIO_DIR, 0x01}, + {BRIDGE, M5602_XB_GPIO_DIR, 0x01}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, + {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, + {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, + {BRIDGE, M5602_XB_GPIO_DAT, 0x00}, + {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, + {BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, + {SENSOR, OV7660_COM7, 0x80}, + {SENSOR, OV7660_CLKRC, 0x80}, + {SENSOR, OV7660_BLUE_GAIN, 0x80}, + {SENSOR, OV7660_RED_GAIN, 0x80}, + {SENSOR, OV7660_COM9, 0x4c}, + {SENSOR, OV7660_OFON, 0x43}, + {SENSOR, OV7660_COM12, 0x28}, + {SENSOR, OV7660_COM8, 0x00}, + {SENSOR, OV7660_COM10, 0x40}, + {SENSOR, OV7660_HSTART, 0x0c}, + {SENSOR, OV7660_HSTOP, 0x61}, + {SENSOR, OV7660_HREF, 0xa4}, + {SENSOR, OV7660_PSHFT, 0x0b}, + {SENSOR, OV7660_VSTART, 0x01}, + {SENSOR, OV7660_VSTOP, 0x7a}, + {SENSOR, OV7660_VSTOP, 0x00}, + {SENSOR, OV7660_COM7, 0x05}, + {SENSOR, OV7660_COM6, 0x42}, + {SENSOR, OV7660_BBIAS, 0x94}, + {SENSOR, OV7660_GbBIAS, 0x94}, + {SENSOR, OV7660_RSVD29, 0x94}, + {SENSOR, OV7660_RBIAS, 0x94}, + {SENSOR, OV7660_COM1, 0x00}, + {SENSOR, OV7660_AECH, 0x00}, + {SENSOR, OV7660_AECHH, 0x00}, + {SENSOR, OV7660_ADC, 0x05}, + {SENSOR, OV7660_COM13, 0x00}, + {SENSOR, OV7660_RSVDA1, 0x23}, + {SENSOR, OV7660_TSLB, 0x0d}, + {SENSOR, OV7660_HV, 0x80}, + {SENSOR, OV7660_LCC1, 0x00}, + {SENSOR, OV7660_LCC2, 0x00}, + {SENSOR, OV7660_LCC3, 0x10}, + {SENSOR, OV7660_LCC4, 0x40}, + {SENSOR, OV7660_LCC5, 0x01}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, + {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, + {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81}, + {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, + {BRIDGE, M5602_XB_SIG_INI, 0x01}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x08}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x01}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0xec}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_SIG_INI, 0x00}, + {BRIDGE, M5602_XB_SIG_INI, 0x02}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0x27}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0xae}, + {BRIDGE, M5602_XB_SIG_INI, 0x00}, + {SENSOR, OV7660_BLUE_GAIN, 0x80}, + {SENSOR, OV7660_RED_GAIN, 0x80}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x02}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {SENSOR, OV7660_AECH, 0x20}, + {SENSOR, OV7660_COM1, 0x00}, + {SENSOR, OV7660_GAIN, 0x07}, + {SENSOR, OV7660_OFON, 0x0c}, + {SENSOR, OV7660_COM2, 0x11}, + {SENSOR, OV7660_COM7, 0x05}, + {BRIDGE, M5602_XB_GPIO_DIR, 0x01}, + {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, + {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, + {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06}, + {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x08}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, + {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, + {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, + {BRIDGE, M5602_XB_GPIO_DAT, 0x00}, + {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, + {BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, + {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, + {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81}, + {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, + {BRIDGE, M5602_XB_SIG_INI, 0x01}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x08}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x01}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0xec}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_SIG_INI, 0x00}, + {BRIDGE, M5602_XB_SIG_INI, 0x02}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0x27}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0xae}, + {BRIDGE, M5602_XB_SIG_INI, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {SENSOR, OV7660_AECH, 0x5f}, + {SENSOR, OV7660_COM1, 0x03}, + {SENSOR, OV7660_GAIN, 0x02}, + {SENSOR, OV7660_OFON, 0x0c}, + {SENSOR, OV7660_COM2, 0x11}, + {SENSOR, OV7660_COM7, 0x05}, + {BRIDGE, M5602_XB_GPIO_DIR, 0x01}, + {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, + {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, + {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06}, + {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x08}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, + {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, + {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, + {BRIDGE, M5602_XB_GPIO_DAT, 0x00}, + {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, + {BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, + {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, + {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81}, + {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, + {BRIDGE, M5602_XB_SIG_INI, 0x01}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x08}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x01}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0xec}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_SIG_INI, 0x00}, + {BRIDGE, M5602_XB_SIG_INI, 0x02}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0x00}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0x27}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0xae}, + {BRIDGE, M5602_XB_SIG_INI, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, }; #endif -- cgit v1.2.3 From bbb672329161d72537787e583fb5a96da838957b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Fri, 26 Jun 2009 09:35:37 +0200 Subject: gspca - m5602-ov7660: Add hflip, vflip controls MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Priority: normal Signed-off-by: Erik Andrén --- .../drivers/media/video/gspca/m5602/m5602_ov7660.c | 109 ++++++++++++++++++++- 1 file changed, 107 insertions(+), 2 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c index f7c050f25..9b5e10532 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c @@ -32,6 +32,10 @@ static int ov7660_get_auto_gain(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val); static int ov7660_get_auto_exposure(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_auto_exposure(struct gspca_dev *gspca_dev, __s32 val); +static int ov7660_get_hflip(struct gspca_dev *gspca_dev, __s32 *val); +static int ov7660_set_hflip(struct gspca_dev *gspca_dev, __s32 val); +static int ov7660_get_vflip(struct gspca_dev *gspca_dev, __s32 *val); +static int ov7660_set_vflip(struct gspca_dev *gspca_dev, __s32 val); const static struct ctrl ov7660_ctrls[] = { #define GAIN_IDX 1 @@ -120,7 +124,36 @@ const static struct ctrl ov7660_ctrls[] = { }, .set = ov7660_set_auto_exposure, .get = ov7660_get_auto_exposure - } + }, +#define HFLIP_IDX 7 + { + { + .id = V4L2_CID_HFLIP, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "horizontal flip", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0 + }, + .set = ov7660_set_hflip, + .get = ov7660_get_hflip + }, +#define VFLIP_IDX 8 + { + { + .id = V4L2_CID_VFLIP, + .type = V4L2_CTRL_TYPE_BOOLEAN, + .name = "vertical flip", + .minimum = 0, + .maximum = 1, + .step = 1, + .default_value = 0 + }, + .set = ov7660_set_vflip, + .get = ov7660_get_vflip + }, + }; static struct v4l2_pix_format ov7660_modes[] = { @@ -221,7 +254,7 @@ int ov7660_init(struct sd *sd) } else { data[0] = init2_ov7660[i][2]; err = m5602_write_sensor(sd, - init2_ov7660[i][1], data, 1); + init2_ov7660[i][1], data, 1); } } @@ -254,6 +287,16 @@ int ov7660_init(struct sd *sd) err = ov7660_set_red_gain(&sd->gspca_dev, sensor_settings[RED_BALANCE_IDX]); + if (err < 0) + return err; + + err = ov7660_set_hflip(&sd->gspca_dev, + sensor_settings[HFLIP_IDX]); + if (err < 0) + return err; + + err = ov7660_set_vflip(&sd->gspca_dev, + sensor_settings[VFLIP_IDX]); return err; } @@ -441,6 +484,68 @@ static int ov7660_set_auto_exposure(struct gspca_dev *gspca_dev, return m5602_write_sensor(sd, OV7660_COM8, &i2c_data, 1); } +static int ov7660_get_hflip(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + *val = sensor_settings[HFLIP_IDX]; + PDEBUG(D_V4L2, "Read horizontal flip %d", *val); + return 0; +} + +static int ov7660_set_hflip(struct gspca_dev *gspca_dev, __s32 val) +{ + int err; + u8 i2c_data; + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + PDEBUG(D_V4L2, "Set horizontal flip to %d", val); + + sensor_settings[HFLIP_IDX] = val; + + i2c_data = ((val & 0x01) << 5) | + (sensor_settings[VFLIP_IDX] << 4); + + err = m5602_write_sensor(sd, OV7660_MVFP, &i2c_data, 1); + + return err; +} + +static int ov7660_get_vflip(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + *val = sensor_settings[VFLIP_IDX]; + PDEBUG(D_V4L2, "Read vertical flip %d", *val); + + return 0; +} + +static int ov7660_set_vflip(struct gspca_dev *gspca_dev, __s32 val) +{ + int err; + u8 i2c_data; + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + PDEBUG(D_V4L2, "Set vertical flip to %d", val); + sensor_settings[VFLIP_IDX] = val; + + i2c_data = ((val & 0x01) << 4) | (sensor_settings[VFLIP_IDX] << 5); + err = m5602_write_sensor(sd, OV7660_MVFP, &i2c_data, 1); + if (err < 0) + return err; + + /* When vflip is toggled we need to readjust the bridge hsync/vsync */ + if (gspca_dev->streaming) + err = ov7660_start(sd); + + return err; +} + static void ov7660_dump_registers(struct sd *sd) { int address; -- cgit v1.2.3 From e14ac22d7554d4ef48fc3a946e270ba1ec02be29 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Fri, 26 Jun 2009 09:45:07 +0200 Subject: gspca - m5602-ov7660: Set the hsync correctly MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Priority: normal Signed-off-by: Erik Andrén --- linux/drivers/media/video/gspca/m5602/m5602_ov7660.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h index 8fa850c95..2ce05039b 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h @@ -435,7 +435,7 @@ static const unsigned char init2_ov7660[][4] = { {BRIDGE, M5602_XB_HSYNC_PARA, 0x00}, {BRIDGE, M5602_XB_HSYNC_PARA, 0x27}, {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, - {BRIDGE, M5602_XB_HSYNC_PARA, 0xae}, + {BRIDGE, M5602_XB_HSYNC_PARA, 0xa7}, {BRIDGE, M5602_XB_SIG_INI, 0x00}, {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, -- cgit v1.2.3 From e57b1c6206737d459429f6a872bd85bd8bd34203 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Fri, 26 Jun 2009 14:20:04 +0200 Subject: gspca - m5602-ov7660: Remove old init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Priority: normal Signed-off-by: Erik Andrén --- .../drivers/media/video/gspca/m5602/m5602_ov7660.c | 12 +- .../drivers/media/video/gspca/m5602/m5602_ov7660.h | 129 --------------------- 2 files changed, 6 insertions(+), 135 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c index 9b5e10532..9648b90ee 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c @@ -244,17 +244,17 @@ int ov7660_init(struct sd *sd) s32 *sensor_settings = sd->sensor_priv; /* Init the sensor */ - for (i = 0; i < ARRAY_SIZE(init2_ov7660); i++) { + for (i = 0; i < ARRAY_SIZE(init_ov7660); i++) { u8 data[2]; - if (init2_ov7660[i][0] == BRIDGE) { + if (init_ov7660[i][0] == BRIDGE) { err = m5602_write_bridge(sd, - init2_ov7660[i][1], - init2_ov7660[i][2]); + init_ov7660[i][1], + init_ov7660[i][2]); } else { - data[0] = init2_ov7660[i][2]; + data[0] = init_ov7660[i][2]; err = m5602_write_sensor(sd, - init2_ov7660[i][1], data, 1); + init_ov7660[i][1], data, 1); } } diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h index 2ce05039b..3360aaec2 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h @@ -142,135 +142,6 @@ static const unsigned char preinit_ov7660[][4] = static const unsigned char init_ov7660[][4] = { - {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02}, - {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0}, - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, - {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0d}, - {BRIDGE, M5602_XB_SENSOR_CTRL, 0x00}, - {BRIDGE, M5602_XB_GPIO_DIR, 0x03}, - {BRIDGE, M5602_XB_GPIO_DIR, 0x03}, - {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, - {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, - - {SENSOR, OV7660_OFON, 0x0c}, - {SENSOR, OV7660_COM2, 0x11}, - {SENSOR, OV7660_COM7, 0x05}, - - {BRIDGE, M5602_XB_GPIO_DIR, 0x01}, - {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, - {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, - {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06}, - {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x08}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, - {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, - {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, - {BRIDGE, M5602_XB_GPIO_DAT, 0x00}, - {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, - {BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, - - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x02}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - - {SENSOR, OV7660_AECH, OV7660_DEFAULT_EXPOSURE}, - {SENSOR, OV7660_COM1, 0x00}, - - {BRIDGE, M5602_XB_GPIO_DIR, 0x01}, - {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, - {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, - {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06}, - {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x08}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, - {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, - {BRIDGE, M5602_XB_GPIO_DIR, 0x05}, - {BRIDGE, M5602_XB_GPIO_DAT, 0x00}, - {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, - {BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, - - {SENSOR, OV7660_COM7, 0x80}, - {SENSOR, OV7660_CLKRC, 0x80}, - {SENSOR, OV7660_COM9, 0x4c}, - {SENSOR, OV7660_OFON, 0x43}, - {SENSOR, OV7660_COM12, 0x28}, - {SENSOR, OV7660_COM8, 0x00}, - {SENSOR, OV7660_COM10, 0x40}, - {SENSOR, OV7660_HSTART, 0x0c}, - {SENSOR, OV7660_HSTOP, 0x61}, - {SENSOR, OV7660_HREF, 0xa4}, - {SENSOR, OV7660_PSHFT, 0x0b}, - {SENSOR, OV7660_VSTART, 0x01}, - {SENSOR, OV7660_VSTOP, 0x7a}, - {SENSOR, OV7660_VREF, 0x00}, - {SENSOR, OV7660_COM7, 0x05}, - {SENSOR, OV7660_COM6, 0x4b}, - {SENSOR, OV7660_BBIAS, 0x98}, - {SENSOR, OV7660_GbBIAS, 0x98}, - {SENSOR, OV7660_RSVD29, 0x98}, - {SENSOR, OV7660_RBIAS, 0x98}, - {SENSOR, OV7660_COM1, 0x00}, - {SENSOR, OV7660_AECHH, 0x00}, - {SENSOR, OV7660_ADC, 0x04}, - {SENSOR, OV7660_COM13, 0x00}, - {SENSOR, OV7660_RSVDA1, 0x23}, - {SENSOR, OV7660_TSLB, 0x0d}, - {SENSOR, OV7660_HV, 0x80}, - {SENSOR, OV7660_LCC1, 0x00}, - {SENSOR, OV7660_LCC2, 0x00}, - {SENSOR, OV7660_LCC3, 0x10}, - {SENSOR, OV7660_LCC4, 0x40}, - {SENSOR, OV7660_LCC5, 0x01}, - - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, - {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, - {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81}, - {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, - {BRIDGE, M5602_XB_SIG_INI, 0x01}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x08}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x01}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0xe0}, /* 480 */ - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_SIG_INI, 0x00}, - {BRIDGE, M5602_XB_SIG_INI, 0x02}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x27}, /* 39 */ - {BRIDGE, M5602_XB_VSYNC_PARA, 0x02}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0xa7}, /* 679 */ - {BRIDGE, M5602_XB_SIG_INI, 0x00}, - - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - - {SENSOR, OV7660_COM1, 0x00}, - {SENSOR, OV7660_OFON, 0x0c}, - {SENSOR, OV7660_COM2, 0x11}, /* Soft sleep, 2x Drive */ - {SENSOR, OV7660_COM7, 0x05}, /* Raw RGB */ - - {BRIDGE, M5602_XB_GPIO_DIR, 0x01}, - {BRIDGE, M5602_XB_GPIO_DAT, 0x04}, - {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, - {BRIDGE, M5602_XB_GPIO_DIR_H, 0x06}, - {BRIDGE, M5602_XB_GPIO_DAT_H, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x08}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0} -}; - -static const unsigned char init2_ov7660[][4] = { {BRIDGE, M5602_XB_MCU_CLK_DIV, 0x02}, {BRIDGE, M5602_XB_MCU_CLK_CTRL, 0xb0}, {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, -- cgit v1.2.3 From 3fa542c1b171cfbdd864bc467e19d03c30b9efd3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Fri, 26 Jun 2009 14:21:46 +0200 Subject: gspca - m5602-ov7660: Don't set gain during init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén We manually set the gain later, no need to do it during init Priority: normal Signed-off-by: Erik Andrén --- linux/drivers/media/video/gspca/m5602/m5602_ov7660.h | 2 -- 1 file changed, 2 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h index 3360aaec2..5434be60e 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h @@ -222,7 +222,6 @@ static const unsigned char init_ov7660[][4] = {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, {SENSOR, OV7660_AECH, 0x20}, {SENSOR, OV7660_COM1, 0x00}, - {SENSOR, OV7660_GAIN, 0x07}, {SENSOR, OV7660_OFON, 0x0c}, {SENSOR, OV7660_COM2, 0x11}, {SENSOR, OV7660_COM7, 0x05}, @@ -267,7 +266,6 @@ static const unsigned char init_ov7660[][4] = {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, {SENSOR, OV7660_AECH, 0x5f}, {SENSOR, OV7660_COM1, 0x03}, - {SENSOR, OV7660_GAIN, 0x02}, {SENSOR, OV7660_OFON, 0x0c}, {SENSOR, OV7660_COM2, 0x11}, {SENSOR, OV7660_COM7, 0x05}, -- cgit v1.2.3 From d825e58ee7d62988f5c63c27d3097db105dd43d1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Fri, 26 Jun 2009 14:22:59 +0200 Subject: gspca - m5602-ov7660: Don't set blue and red gain during init MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Don't set blue and red gain during init as we manuall set it later Priority: normal Signed-off-by: Erik Andrén --- linux/drivers/media/video/gspca/m5602/m5602_ov7660.h | 4 ---- 1 file changed, 4 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h index 5434be60e..ee7c748f1 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h @@ -161,8 +161,6 @@ static const unsigned char init_ov7660[][4] = {BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, {SENSOR, OV7660_COM7, 0x80}, {SENSOR, OV7660_CLKRC, 0x80}, - {SENSOR, OV7660_BLUE_GAIN, 0x80}, - {SENSOR, OV7660_RED_GAIN, 0x80}, {SENSOR, OV7660_COM9, 0x4c}, {SENSOR, OV7660_OFON, 0x43}, {SENSOR, OV7660_COM12, 0x28}, @@ -216,8 +214,6 @@ static const unsigned char init_ov7660[][4] = {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, {BRIDGE, M5602_XB_HSYNC_PARA, 0xae}, {BRIDGE, M5602_XB_SIG_INI, 0x00}, - {SENSOR, OV7660_BLUE_GAIN, 0x80}, - {SENSOR, OV7660_RED_GAIN, 0x80}, {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x02}, {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, {SENSOR, OV7660_AECH, 0x20}, -- cgit v1.2.3 From d3114e784667e62ce369c84e53f8f8431fdc6067 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Fri, 26 Jun 2009 14:30:42 +0200 Subject: gspca - m5602-ov7660: Remove redundant init writes MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Priority: normal Signed-off-by: Erik Andrén --- .../drivers/media/video/gspca/m5602/m5602_ov7660.h | 50 +--------------------- 1 file changed, 2 insertions(+), 48 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h index ee7c748f1..f5588ebe6 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.h @@ -192,30 +192,7 @@ static const unsigned char init_ov7660[][4] = {SENSOR, OV7660_LCC3, 0x10}, {SENSOR, OV7660_LCC4, 0x40}, {SENSOR, OV7660_LCC5, 0x01}, - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, - {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, - {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81}, - {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, - {BRIDGE, M5602_XB_SIG_INI, 0x01}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x08}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x01}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0xec}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_SIG_INI, 0x00}, - {BRIDGE, M5602_XB_SIG_INI, 0x02}, - {BRIDGE, M5602_XB_HSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_HSYNC_PARA, 0x27}, - {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, - {BRIDGE, M5602_XB_HSYNC_PARA, 0xae}, - {BRIDGE, M5602_XB_SIG_INI, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x02}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, + {SENSOR, OV7660_AECH, 0x20}, {SENSOR, OV7660_COM1, 0x00}, {SENSOR, OV7660_OFON, 0x0c}, @@ -236,30 +213,6 @@ static const unsigned char init_ov7660[][4] = {BRIDGE, M5602_XB_GPIO_DAT, 0x00}, {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, {BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, - {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, - {BRIDGE, M5602_XB_SENSOR_TYPE, 0x0c}, - {BRIDGE, M5602_XB_LINE_OF_FRAME_H, 0x81}, - {BRIDGE, M5602_XB_PIX_OF_LINE_H, 0x82}, - {BRIDGE, M5602_XB_SIG_INI, 0x01}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x08}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x01}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0xec}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_VSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_SIG_INI, 0x00}, - {BRIDGE, M5602_XB_SIG_INI, 0x02}, - {BRIDGE, M5602_XB_HSYNC_PARA, 0x00}, - {BRIDGE, M5602_XB_HSYNC_PARA, 0x27}, - {BRIDGE, M5602_XB_HSYNC_PARA, 0x02}, - {BRIDGE, M5602_XB_HSYNC_PARA, 0xae}, - {BRIDGE, M5602_XB_SIG_INI, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x00}, - {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, {SENSOR, OV7660_AECH, 0x5f}, {SENSOR, OV7660_COM1, 0x03}, {SENSOR, OV7660_OFON, 0x0c}, @@ -280,6 +233,7 @@ static const unsigned char init_ov7660[][4] = {BRIDGE, M5602_XB_GPIO_DAT, 0x00}, {BRIDGE, M5602_XB_GPIO_EN_H, 0x06}, {BRIDGE, M5602_XB_GPIO_EN_L, 0x00}, + {BRIDGE, M5602_XB_SEN_CLK_DIV, 0x06}, {BRIDGE, M5602_XB_SEN_CLK_CTRL, 0xb0}, {BRIDGE, M5602_XB_ADC_CTRL, 0xc0}, -- cgit v1.2.3 From 292192340e03288401f283eacc14f07b05f7d018 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Erik=20Andr=C3=A9n?= Date: Mon, 14 Sep 2009 18:14:41 +0200 Subject: gspca - m5602-ov7660: Disable red and blue gain for now MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit From: Erik Andrén Red and blue gain isn't handled in conformance with the v4l2 specification. Disable them for now. Priority: normal Signed-off-by: Erik Andrén --- linux/drivers/media/video/gspca/m5602/m5602_ov7660.c | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c index 9648b90ee..e8e9b0162 100644 --- a/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c +++ b/linux/drivers/media/video/gspca/m5602/m5602_ov7660.c @@ -20,10 +20,12 @@ static int ov7660_get_gain(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_gain(struct gspca_dev *gspca_dev, __s32 val); +#if 0 static int ov7660_get_blue_gain(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_blue_gain(struct gspca_dev *gspca_dev, __s32 val); static int ov7660_get_red_gain(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_red_gain(struct gspca_dev *gspca_dev, __s32 val); +#endif static int ov7660_get_auto_white_balance(struct gspca_dev *gspca_dev, __s32 *val); static int ov7660_set_auto_white_balance(struct gspca_dev *gspca_dev, @@ -54,6 +56,7 @@ const static struct ctrl ov7660_ctrls[] = { .get = ov7660_get_gain }, #define BLUE_BALANCE_IDX 2 +#if 0 { { .id = V4L2_CID_BLUE_BALANCE, @@ -68,7 +71,9 @@ const static struct ctrl ov7660_ctrls[] = { .set = ov7660_set_blue_gain, .get = ov7660_get_blue_gain }, +#endif #define RED_BALANCE_IDX 3 +#if 0 { { .id = V4L2_CID_RED_BALANCE, @@ -83,6 +88,7 @@ const static struct ctrl ov7660_ctrls[] = { .set = ov7660_set_red_gain, .get = ov7660_get_red_gain }, +#endif #define AUTO_WHITE_BALANCE_IDX 4 { { @@ -279,7 +285,7 @@ int ov7660_init(struct sd *sd) sensor_settings[AUTO_EXPOSURE_IDX]); if (err < 0) return err; - +#if 0 err = ov7660_set_blue_gain(&sd->gspca_dev, sensor_settings[BLUE_BALANCE_IDX]); if (err < 0) @@ -289,7 +295,7 @@ int ov7660_init(struct sd *sd) sensor_settings[RED_BALANCE_IDX]); if (err < 0) return err; - +#endif err = ov7660_set_hflip(&sd->gspca_dev, sensor_settings[HFLIP_IDX]); if (err < 0) @@ -344,6 +350,7 @@ static int ov7660_set_gain(struct gspca_dev *gspca_dev, __s32 val) return err; } +#if 0 static int ov7660_get_blue_gain(struct gspca_dev *gspca_dev, __s32 *val) { struct sd *sd = (struct sd *) gspca_dev; @@ -393,6 +400,7 @@ static int ov7660_set_red_gain(struct gspca_dev *gspca_dev, __s32 val) err = m5602_write_sensor(sd, OV7660_RED_GAIN, &i2c_data, 1); return err; } +#endif static int ov7660_get_auto_white_balance(struct gspca_dev *gspca_dev, __s32 *val) -- cgit v1.2.3