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>
This commit is contained in:
parent
dd9ce84a77
commit
b933d585ba
3 changed files with 56 additions and 1 deletions
|
@ -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)
|
||||
{
|
||||
|
|
|
@ -139,6 +139,7 @@
|
|||
#define PO1030_EXPOSURE_DEFAULT 0x0085
|
||||
#define PO1030_BLUE_GAIN_DEFAULT 0x36
|
||||
#define PO1030_RED_GAIN_DEFAULT 0x36
|
||||
#define PO1030_GREEN_GAIN_DEFAULT 0x40
|
||||
|
||||
/*****************************************************************************/
|
||||
|
||||
|
|
|
@ -21,6 +21,8 @@
|
|||
|
||||
#include "m5602_bridge.h"
|
||||
|
||||
#define M5602_V4L2_CID_GREEN_BALANCE (V4L2_CID_PRIVATE_BASE + 0)
|
||||
|
||||
/* Enumerates all supported sensors */
|
||||
enum sensors {
|
||||
OV9650_SENSOR = 1,
|
||||
|
|
Loading…
Reference in a new issue