Skip to content

Commit

Permalink
V4L/DVB (11414): gspca - m5602-mt9m111: Move v4l2 controls to main se…
Browse files Browse the repository at this point in the history
…nsor file.

Move over the v4l2 controls to the sensor specific source file.
Remove the now redundant sensor struct member.

Signed-off-by: Erik Andrén <erik.andren@gmail.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
  • Loading branch information
Erik Andr?n authored and Mauro Carvalho Chehab committed Apr 7, 2009
1 parent 74cadfe commit e17cc08
Show file tree
Hide file tree
Showing 11 changed files with 353 additions and 361 deletions.
44 changes: 43 additions & 1 deletion drivers/media/video/gspca/m5602/m5602_mt9m111.c
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,48 @@ static struct v4l2_pix_format mt9m111_modes[] = {
}
};

const static struct ctrl mt9m111_ctrls[] = {
{
{
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "vertical flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = mt9m111_set_vflip,
.get = mt9m111_get_vflip
}, {
{
.id = V4L2_CID_HFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "horizontal flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = mt9m111_set_hflip,
.get = mt9m111_get_hflip
}, {
{
.id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "gain",
.minimum = 0,
.maximum = (INITIAL_MAX_GAIN - 1) * 2 * 2 * 2,
.step = 1,
.default_value = DEFAULT_GAIN,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = mt9m111_set_gain,
.get = mt9m111_get_gain
}
};


static void mt9m111_dump_registers(struct sd *sd);

int mt9m111_probe(struct sd *sd)
Expand Down Expand Up @@ -77,7 +119,7 @@ int mt9m111_probe(struct sd *sd)
sensor_found:
sd->gspca_dev.cam.cam_mode = mt9m111_modes;
sd->gspca_dev.cam.nmodes = ARRAY_SIZE(mt9m111_modes);
sd->desc->ctrls = mt9m111.ctrls;
sd->desc->ctrls = mt9m111_ctrls;
sd->desc->nctrls = ARRAY_SIZE(mt9m111_ctrls);
return 0;
}
Expand Down
41 changes: 0 additions & 41 deletions drivers/media/video/gspca/m5602/m5602_mt9m111.h
Original file line number Diff line number Diff line change
Expand Up @@ -94,47 +94,6 @@ int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
int mt9m111_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
int mt9m111_set_gain(struct gspca_dev *gspca_dev, __s32 val);

const static struct ctrl mt9m111_ctrls[] = {
{
{
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "vertical flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = mt9m111_set_vflip,
.get = mt9m111_get_vflip
}, {
{
.id = V4L2_CID_HFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "horizontal flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = mt9m111_set_hflip,
.get = mt9m111_get_hflip
}, {
{
.id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "gain",
.minimum = 0,
.maximum = (INITIAL_MAX_GAIN - 1) * 2 * 2 * 2,
.step = 1,
.default_value = DEFAULT_GAIN,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = mt9m111_set_gain,
.get = mt9m111_get_gain
}
};

static struct m5602_sensor mt9m111 = {
.name = "MT9M111",

Expand Down
107 changes: 103 additions & 4 deletions drivers/media/video/gspca/m5602/m5602_ov9650.c
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,108 @@ static
{ }
};

const static struct ctrl ov9650_ctrls[] = {
{
{
.id = V4L2_CID_EXPOSURE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "exposure",
.minimum = 0x00,
.maximum = 0xffff,
.step = 0x1,
.default_value = EXPOSURE_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = ov9650_set_exposure,
.get = ov9650_get_exposure
}, {
{
.id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "gain",
.minimum = 0x00,
.maximum = 0x3ff,
.step = 0x1,
.default_value = GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = ov9650_set_gain,
.get = ov9650_get_gain
}, {
{
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "red balance",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x1,
.default_value = RED_GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = ov9650_set_red_balance,
.get = ov9650_get_red_balance
}, {
{
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "blue balance",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x1,
.default_value = BLUE_GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = ov9650_set_blue_balance,
.get = ov9650_get_blue_balance
}, {
{
.id = V4L2_CID_HFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "horizontal flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = ov9650_set_hflip,
.get = ov9650_get_hflip
}, {
{
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "vertical flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = ov9650_set_vflip,
.get = ov9650_get_vflip
}, {
{
.id = V4L2_CID_AUTO_WHITE_BALANCE,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "auto white balance",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = ov9650_set_auto_white_balance,
.get = ov9650_get_auto_white_balance
}, {
{
.id = V4L2_CID_AUTOGAIN,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "auto gain control",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = ov9650_set_auto_gain,
.get = ov9650_get_auto_gain
}
};

static struct v4l2_pix_format ov9650_modes[] = {
{
176,
Expand Down Expand Up @@ -154,12 +256,9 @@ int ov9650_probe(struct sd *sd)
return -ENODEV;

sensor_found:
// sd->gspca_dev.cam.cam_mode = ov9650.modes;
// sd->gspca_dev.cam.nmodes = ov9650.nmodes;
sd->gspca_dev.cam.cam_mode = ov9650_modes;
sd->gspca_dev.cam.nmodes = ARRAY_SIZE(ov9650_modes);

sd->desc->ctrls = ov9650.ctrls;
sd->desc->ctrls = ov9650_ctrls;
sd->desc->nctrls = ARRAY_SIZE(ov9650_ctrls);
return 0;
}
Expand Down
103 changes: 0 additions & 103 deletions drivers/media/video/gspca/m5602/m5602_ov9650.h
Original file line number Diff line number Diff line change
Expand Up @@ -156,108 +156,6 @@ int ov9650_set_auto_white_balance(struct gspca_dev *gspca_dev, __s32 val);
int ov9650_get_auto_gain(struct gspca_dev *gspca_dev, __s32 *val);
int ov9650_set_auto_gain(struct gspca_dev *gspca_dev, __s32 val);

static struct ctrl ov9650_ctrls[] = {
{
{
.id = V4L2_CID_EXPOSURE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "exposure",
.minimum = 0x00,
.maximum = 0xffff,
.step = 0x1,
.default_value = EXPOSURE_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = ov9650_set_exposure,
.get = ov9650_get_exposure
}, {
{
.id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "gain",
.minimum = 0x00,
.maximum = 0x3ff,
.step = 0x1,
.default_value = GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = ov9650_set_gain,
.get = ov9650_get_gain
}, {
{
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "red balance",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x1,
.default_value = RED_GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = ov9650_set_red_balance,
.get = ov9650_get_red_balance
}, {
{
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "blue balance",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x1,
.default_value = BLUE_GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = ov9650_set_blue_balance,
.get = ov9650_get_blue_balance
}, {
{
.id = V4L2_CID_HFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "horizontal flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = ov9650_set_hflip,
.get = ov9650_get_hflip
}, {
{
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "vertical flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = ov9650_set_vflip,
.get = ov9650_get_vflip
}, {
{
.id = V4L2_CID_AUTO_WHITE_BALANCE,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "auto white balance",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = ov9650_set_auto_white_balance,
.get = ov9650_get_auto_white_balance
}, {
{
.id = V4L2_CID_AUTOGAIN,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "auto gain control",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = ov9650_set_auto_gain,
.get = ov9650_get_auto_gain
}
};

static struct m5602_sensor ov9650 = {
.name = "OV9650",
.i2c_slave_id = 0x60,
Expand All @@ -267,7 +165,6 @@ static struct m5602_sensor ov9650 = {
.start = ov9650_start,
.stop = ov9650_stop,
.power_down = ov9650_power_down,
.ctrls = ov9650_ctrls
};

static const unsigned char preinit_ov9650[][3] =
Expand Down
Loading

0 comments on commit e17cc08

Please sign in to comment.