diff options
author | Erik Andr?n <erik.andren@gmail.com> | 2009-01-13 13:55:52 -0300 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2009-06-16 18:20:32 -0300 |
commit | b933d585baf6f6432ca5dd3f6d415ffa145e2c25 (patch) | |
tree | 0d69ac76c8ac28cef6ce1f6ef35b29c2cb892f9d /drivers/media/video/gspca/m5602/m5602_po1030.c | |
parent | dd9ce84a773f9c9919a3c59291e82ec0e8803ecc (diff) | |
download | blackbird-op-linux-b933d585baf6f6432ca5dd3f6d415ffa145e2c25.tar.gz blackbird-op-linux-b933d585baf6f6432ca5dd3f6d415ffa145e2c25.zip |
V4L/DVB (11523): gspca - m5602-po1030: Add private green balance control
Signed-off-by: Erik Andr?n <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/gspca/m5602/m5602_po1030.c')
-rw-r--r-- | drivers/media/video/gspca/m5602/m5602_po1030.c | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/drivers/media/video/gspca/m5602/m5602_po1030.c b/drivers/media/video/gspca/m5602/m5602_po1030.c index e32d03a2cf94..ee8e496090a2 100644 --- a/drivers/media/video/gspca/m5602/m5602_po1030.c +++ b/drivers/media/video/gspca/m5602/m5602_po1030.c @@ -26,6 +26,8 @@ static int po1030_get_red_balance(struct gspca_dev *gspca_dev, __s32 *val); static int po1030_set_red_balance(struct gspca_dev *gspca_dev, __s32 val); static int po1030_get_blue_balance(struct gspca_dev *gspca_dev, __s32 *val); static int po1030_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val); +static int po1030_get_green_balance(struct gspca_dev *gspca_dev, __s32 *val); +static int po1030_set_green_balance(struct gspca_dev *gspca_dev, __s32 val); static int po1030_get_hflip(struct gspca_dev *gspca_dev, __s32 *val); static int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val); static int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val); @@ -169,7 +171,21 @@ const static struct ctrl po1030_ctrls[] = { .set = po1030_set_auto_exposure, .get = po1030_get_auto_exposure }, - +#define GREEN_BALANCE_IDX 8 + { + { + .id = M5602_V4L2_CID_GREEN_BALANCE, + .type = V4L2_CTRL_TYPE_INTEGER, + .name = "green balance", + .minimum = 0x00, + .maximum = 0xff, + .step = 0x1, + .default_value = PO1030_GREEN_GAIN_DEFAULT, + .flags = V4L2_CTRL_FLAG_SLIDER + }, + .set = po1030_set_green_balance, + .get = po1030_get_green_balance + }, }; static void po1030_dump_registers(struct sd *sd); @@ -288,6 +304,11 @@ int po1030_init(struct sd *sd) if (err < 0) return err; + err = po1030_set_green_balance(&sd->gspca_dev, + sensor_settings[GREEN_BALANCE_IDX]); + if (err < 0) + return err; + err = po1030_set_auto_white_balance(&sd->gspca_dev, sensor_settings[AUTO_WHITE_BALANCE_IDX]); if (err < 0) @@ -499,6 +520,37 @@ static int po1030_set_blue_balance(struct gspca_dev *gspca_dev, __s32 val) return err; } +static int po1030_get_green_balance(struct gspca_dev *gspca_dev, __s32 *val) +{ + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + + *val = sensor_settings[GREEN_BALANCE_IDX]; + PDEBUG(D_V4L2, "Read green gain %d", *val); + + return 0; +} + +static int po1030_set_green_balance(struct gspca_dev *gspca_dev, __s32 val) +{ + struct sd *sd = (struct sd *) gspca_dev; + s32 *sensor_settings = sd->sensor_priv; + u8 i2c_data; + int err; + + sensor_settings[GREEN_BALANCE_IDX] = val; + i2c_data = val & 0xff; + PDEBUG(D_V4L2, "Set green gain to %d", i2c_data); + + err = m5602_write_sensor(sd, PO1030_GREEN_1_GAIN, + &i2c_data, 1); + if (err < 0) + return err; + + return m5602_write_sensor(sd, PO1030_GREEN_2_GAIN, + &i2c_data, 1); +} + static int po1030_get_auto_white_balance(struct gspca_dev *gspca_dev, __s32 *val) { |