Commit e17cc08c authored by Erik Andr?n's avatar Erik Andr?n Committed by Mauro Carvalho Chehab

V4L/DVB (11414): gspca - m5602-mt9m111: Move v4l2 controls to main sensor file.

Move over the v4l2 controls to the sensor specific source file.
Remove the now redundant sensor struct member.
Signed-off-by: default avatarErik Andrén <erik.andren@gmail.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 74cadfe1
...@@ -31,6 +31,48 @@ static struct v4l2_pix_format mt9m111_modes[] = { ...@@ -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); static void mt9m111_dump_registers(struct sd *sd);
int mt9m111_probe(struct sd *sd) int mt9m111_probe(struct sd *sd)
...@@ -77,7 +119,7 @@ int mt9m111_probe(struct sd *sd) ...@@ -77,7 +119,7 @@ int mt9m111_probe(struct sd *sd)
sensor_found: sensor_found:
sd->gspca_dev.cam.cam_mode = mt9m111_modes; sd->gspca_dev.cam.cam_mode = mt9m111_modes;
sd->gspca_dev.cam.nmodes = ARRAY_SIZE(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); sd->desc->nctrls = ARRAY_SIZE(mt9m111_ctrls);
return 0; return 0;
} }
......
...@@ -94,47 +94,6 @@ int mt9m111_set_hflip(struct gspca_dev *gspca_dev, __s32 val); ...@@ -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_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
int mt9m111_set_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 = { static struct m5602_sensor mt9m111 = {
.name = "MT9M111", .name = "MT9M111",
......
...@@ -68,6 +68,108 @@ static ...@@ -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[] = { static struct v4l2_pix_format ov9650_modes[] = {
{ {
176, 176,
...@@ -154,12 +256,9 @@ int ov9650_probe(struct sd *sd) ...@@ -154,12 +256,9 @@ int ov9650_probe(struct sd *sd)
return -ENODEV; return -ENODEV;
sensor_found: 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.cam_mode = ov9650_modes;
sd->gspca_dev.cam.nmodes = ARRAY_SIZE(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); sd->desc->nctrls = ARRAY_SIZE(ov9650_ctrls);
return 0; return 0;
} }
......
...@@ -156,108 +156,6 @@ int ov9650_set_auto_white_balance(struct gspca_dev *gspca_dev, __s32 val); ...@@ -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_get_auto_gain(struct gspca_dev *gspca_dev, __s32 *val);
int ov9650_set_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 = { static struct m5602_sensor ov9650 = {
.name = "OV9650", .name = "OV9650",
.i2c_slave_id = 0x60, .i2c_slave_id = 0x60,
...@@ -267,7 +165,6 @@ static struct m5602_sensor ov9650 = { ...@@ -267,7 +165,6 @@ static struct m5602_sensor ov9650 = {
.start = ov9650_start, .start = ov9650_start,
.stop = ov9650_stop, .stop = ov9650_stop,
.power_down = ov9650_power_down, .power_down = ov9650_power_down,
.ctrls = ov9650_ctrls
}; };
static const unsigned char preinit_ov9650[][3] = static const unsigned char preinit_ov9650[][3] =
......
...@@ -31,6 +31,86 @@ static struct v4l2_pix_format po1030_modes[] = { ...@@ -31,6 +31,86 @@ static struct v4l2_pix_format po1030_modes[] = {
} }
}; };
const static struct ctrl po1030_ctrls[] = {
{
{
.id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "gain",
.minimum = 0x00,
.maximum = 0x4f,
.step = 0x1,
.default_value = PO1030_GLOBAL_GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = po1030_set_gain,
.get = po1030_get_gain
}, {
{
.id = V4L2_CID_EXPOSURE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "exposure",
.minimum = 0x00,
.maximum = 0x02ff,
.step = 0x1,
.default_value = PO1030_EXPOSURE_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = po1030_set_exposure,
.get = po1030_get_exposure
}, {
{
.id = V4L2_CID_RED_BALANCE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "red balance",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x1,
.default_value = PO1030_RED_GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = po1030_set_red_balance,
.get = po1030_get_red_balance
}, {
{
.id = V4L2_CID_BLUE_BALANCE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "blue balance",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x1,
.default_value = PO1030_BLUE_GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = po1030_set_blue_balance,
.get = po1030_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 = po1030_set_hflip,
.get = po1030_get_hflip
}, {
{
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "vertical flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0,
},
.set = po1030_set_vflip,
.get = po1030_get_vflip
}
};
static void po1030_dump_registers(struct sd *sd); static void po1030_dump_registers(struct sd *sd);
int po1030_probe(struct sd *sd) int po1030_probe(struct sd *sd)
...@@ -74,7 +154,7 @@ int po1030_probe(struct sd *sd) ...@@ -74,7 +154,7 @@ int po1030_probe(struct sd *sd)
sensor_found: sensor_found:
sd->gspca_dev.cam.cam_mode = po1030_modes; sd->gspca_dev.cam.cam_mode = po1030_modes;
sd->gspca_dev.cam.nmodes = ARRAY_SIZE(po1030_modes); sd->gspca_dev.cam.nmodes = ARRAY_SIZE(po1030_modes);
sd->desc->ctrls = po1030.ctrls; sd->desc->ctrls = po1030_ctrls;
sd->desc->nctrls = ARRAY_SIZE(po1030_ctrls); sd->desc->nctrls = ARRAY_SIZE(po1030_ctrls);
return 0; return 0;
} }
......
...@@ -141,86 +141,6 @@ int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val); ...@@ -141,86 +141,6 @@ int po1030_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val); int po1030_get_vflip(struct gspca_dev *gspca_dev, __s32 *val);
int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val); int po1030_set_vflip(struct gspca_dev *gspca_dev, __s32 val);
static struct ctrl po1030_ctrls[] = {
{
{
.id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "gain",
.minimum = 0x00,
.maximum = 0x4f,
.step = 0x1,
.default_value = PO1030_GLOBAL_GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = po1030_set_gain,
.get = po1030_get_gain
}, {
{
.id = V4L2_CID_EXPOSURE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "exposure",
.minimum = 0x00,
.maximum = 0x02ff,
.step = 0x1,
.default_value = PO1030_EXPOSURE_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = po1030_set_exposure,
.get = po1030_get_exposure
}, {
{
.id = V4L2_CID_RED_BALANCE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "red balance",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x1,
.default_value = PO1030_RED_GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = po1030_set_red_balance,
.get = po1030_get_red_balance
}, {
{
.id = V4L2_CID_BLUE_BALANCE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "blue balance",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x1,
.default_value = PO1030_BLUE_GAIN_DEFAULT,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = po1030_set_blue_balance,
.get = po1030_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 = po1030_set_hflip,
.get = po1030_get_hflip
}, {
{
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "vertical flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0,
},
.set = po1030_set_vflip,
.get = po1030_get_vflip
}
};
static struct m5602_sensor po1030 = { static struct m5602_sensor po1030 = {
.name = "PO1030", .name = "PO1030",
...@@ -230,8 +150,6 @@ static struct m5602_sensor po1030 = { ...@@ -230,8 +150,6 @@ static struct m5602_sensor po1030 = {
.probe = po1030_probe, .probe = po1030_probe,
.init = po1030_init, .init = po1030_init,
.power_down = po1030_power_down, .power_down = po1030_power_down,
.ctrls = po1030_ctrls,
}; };
static const unsigned char preinit_po1030[][3] = static const unsigned char preinit_po1030[][3] =
......
...@@ -64,6 +64,62 @@ static struct v4l2_pix_format s5k4aa_modes[] = { ...@@ -64,6 +64,62 @@ static struct v4l2_pix_format s5k4aa_modes[] = {
} }
}; };
const static struct ctrl s5k4aa_ctrls[] = {
{
{
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "vertical flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = s5k4aa_set_vflip,
.get = s5k4aa_get_vflip
}, {
{
.id = V4L2_CID_HFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "horizontal flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = s5k4aa_set_hflip,
.get = s5k4aa_get_hflip
}, {
{
.id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Gain",
.minimum = 0,
.maximum = 127,
.step = 1,
.default_value = 0xa0,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = s5k4aa_set_gain,
.get = s5k4aa_get_gain
}, {
{
.id = V4L2_CID_EXPOSURE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Exposure",
.minimum = 13,
.maximum = 0xfff,
.step = 1,
.default_value = 0x100,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = s5k4aa_set_exposure,
.get = s5k4aa_get_exposure
}
};
static void s5k4aa_dump_registers(struct sd *sd); static void s5k4aa_dump_registers(struct sd *sd);
int s5k4aa_probe(struct sd *sd) int s5k4aa_probe(struct sd *sd)
...@@ -131,7 +187,7 @@ int s5k4aa_probe(struct sd *sd) ...@@ -131,7 +187,7 @@ int s5k4aa_probe(struct sd *sd)
sensor_found: sensor_found:
sd->gspca_dev.cam.cam_mode = s5k4aa_modes; sd->gspca_dev.cam.cam_mode = s5k4aa_modes;
sd->gspca_dev.cam.nmodes = ARRAY_SIZE(s5k4aa_modes); sd->gspca_dev.cam.nmodes = ARRAY_SIZE(s5k4aa_modes);
sd->desc->ctrls = s5k4aa.ctrls; sd->desc->ctrls = s5k4aa_ctrls;
sd->desc->nctrls = ARRAY_SIZE(s5k4aa_ctrls); sd->desc->nctrls = ARRAY_SIZE(s5k4aa_ctrls);
return 0; return 0;
} }
......
...@@ -77,61 +77,6 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val); ...@@ -77,61 +77,6 @@ int s5k4aa_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
int s5k4aa_get_gain(struct gspca_dev *gspca_dev, __s32 *val); int s5k4aa_get_gain(struct gspca_dev *gspca_dev, __s32 *val);
int s5k4aa_set_gain(struct gspca_dev *gspca_dev, __s32 val); int s5k4aa_set_gain(struct gspca_dev *gspca_dev, __s32 val);
static struct ctrl s5k4aa_ctrls[] = {
{
{
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "vertical flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = s5k4aa_set_vflip,
.get = s5k4aa_get_vflip
}, {
{
.id = V4L2_CID_HFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "horizontal flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = s5k4aa_set_hflip,
.get = s5k4aa_get_hflip
}, {
{
.id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Gain",
.minimum = 0,
.maximum = 127,
.step = 1,
.default_value = 0xa0,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = s5k4aa_set_gain,
.get = s5k4aa_get_gain
}, {
{
.id = V4L2_CID_EXPOSURE,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "Exposure",
.minimum = 13,
.maximum = 0xfff,
.step = 1,
.default_value = 0x100,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = s5k4aa_set_exposure,
.get = s5k4aa_get_exposure
}
};
static struct m5602_sensor s5k4aa = { static struct m5602_sensor s5k4aa = {
.name = "S5K4AA", .name = "S5K4AA",
...@@ -141,7 +86,6 @@ static struct m5602_sensor s5k4aa = { ...@@ -141,7 +86,6 @@ static struct m5602_sensor s5k4aa = {
.power_down = s5k4aa_power_down, .power_down = s5k4aa_power_down,
.i2c_slave_id = 0x5a, .i2c_slave_id = 0x5a,
.i2c_regW = 2, .i2c_regW = 2,
.ctrls = s5k4aa_ctrls,
}; };
static const unsigned char preinit_s5k4aa[][4] = static const unsigned char preinit_s5k4aa[][4] =
......
...@@ -32,6 +32,74 @@ static struct v4l2_pix_format s5k83a_modes[] = { ...@@ -32,6 +32,74 @@ static struct v4l2_pix_format s5k83a_modes[] = {
} }
}; };
const static struct ctrl s5k83a_ctrls[] = {
{
{
.id = V4L2_CID_BRIGHTNESS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "brightness",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x01,
.default_value = S5K83A_DEFAULT_BRIGHTNESS,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = s5k83a_set_brightness,
.get = s5k83a_get_brightness
}, {
{
.id = V4L2_CID_WHITENESS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "whiteness",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x01,
.default_value = S5K83A_DEFAULT_WHITENESS,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = s5k83a_set_whiteness,
.get = s5k83a_get_whiteness,
}, {
{
.id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "gain",
.minimum = 0x00,
.maximum = S5K83A_MAXIMUM_GAIN,
.step = 0x01,
.default_value = S5K83A_DEFAULT_GAIN,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = s5k83a_set_gain,
.get = s5k83a_get_gain
}, {
{
.id = V4L2_CID_HFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "horizontal flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = s5k83a_set_hflip,
.get = s5k83a_get_hflip
}, {
{
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "vertical flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = s5k83a_set_vflip,
.get = s5k83a_get_vflip
}
};
static void s5k83a_dump_registers(struct sd *sd); static void s5k83a_dump_registers(struct sd *sd);
int s5k83a_probe(struct sd *sd) int s5k83a_probe(struct sd *sd)
...@@ -79,7 +147,7 @@ int s5k83a_probe(struct sd *sd) ...@@ -79,7 +147,7 @@ int s5k83a_probe(struct sd *sd)
sensor_found: sensor_found:
sd->gspca_dev.cam.cam_mode = s5k83a_modes; sd->gspca_dev.cam.cam_mode = s5k83a_modes;
sd->gspca_dev.cam.nmodes = ARRAY_SIZE(s5k83a_modes); sd->gspca_dev.cam.nmodes = ARRAY_SIZE(s5k83a_modes);
sd->desc->ctrls = s5k83a.ctrls; sd->desc->ctrls = s5k83a_ctrls;
sd->desc->nctrls = ARRAY_SIZE(s5k83a_ctrls); sd->desc->nctrls = ARRAY_SIZE(s5k83a_ctrls);
return 0; return 0;
} }
......
...@@ -61,74 +61,6 @@ int s5k83a_set_vflip(struct gspca_dev *gspca_dev, __s32 val); ...@@ -61,74 +61,6 @@ int s5k83a_set_vflip(struct gspca_dev *gspca_dev, __s32 val);
int s5k83a_get_hflip(struct gspca_dev *gspca_dev, __s32 *val); int s5k83a_get_hflip(struct gspca_dev *gspca_dev, __s32 *val);
int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val); int s5k83a_set_hflip(struct gspca_dev *gspca_dev, __s32 val);
static struct ctrl s5k83a_ctrls[] = {
{
{
.id = V4L2_CID_BRIGHTNESS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "brightness",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x01,
.default_value = S5K83A_DEFAULT_BRIGHTNESS,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = s5k83a_set_brightness,
.get = s5k83a_get_brightness
}, {
{
.id = V4L2_CID_WHITENESS,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "whiteness",
.minimum = 0x00,
.maximum = 0xff,
.step = 0x01,
.default_value = S5K83A_DEFAULT_WHITENESS,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = s5k83a_set_whiteness,
.get = s5k83a_get_whiteness,
}, {
{
.id = V4L2_CID_GAIN,
.type = V4L2_CTRL_TYPE_INTEGER,
.name = "gain",
.minimum = 0x00,
.maximum = S5K83A_MAXIMUM_GAIN,
.step = 0x01,
.default_value = S5K83A_DEFAULT_GAIN,
.flags = V4L2_CTRL_FLAG_SLIDER
},
.set = s5k83a_set_gain,
.get = s5k83a_get_gain
}, {
{
.id = V4L2_CID_HFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "horizontal flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = s5k83a_set_hflip,
.get = s5k83a_get_hflip
}, {
{
.id = V4L2_CID_VFLIP,
.type = V4L2_CTRL_TYPE_BOOLEAN,
.name = "vertical flip",
.minimum = 0,
.maximum = 1,
.step = 1,
.default_value = 0
},
.set = s5k83a_set_vflip,
.get = s5k83a_get_vflip
}
};
static struct m5602_sensor s5k83a = { static struct m5602_sensor s5k83a = {
.name = "S5K83A", .name = "S5K83A",
.probe = s5k83a_probe, .probe = s5k83a_probe,
...@@ -138,7 +70,6 @@ static struct m5602_sensor s5k83a = { ...@@ -138,7 +70,6 @@ static struct m5602_sensor s5k83a = {
.power_down = s5k83a_power_down, .power_down = s5k83a_power_down,
.i2c_slave_id = 0x5a, .i2c_slave_id = 0x5a,
.i2c_regW = 2, .i2c_regW = 2,
.ctrls = s5k83a_ctrls,
}; };
static const unsigned char preinit_s5k83a[][4] = static const unsigned char preinit_s5k83a[][4] =
......
...@@ -64,8 +64,6 @@ struct m5602_sensor { ...@@ -64,8 +64,6 @@ struct m5602_sensor {
/* Performs a power down sequence */ /* Performs a power down sequence */
int (*power_down)(struct sd *sd); int (*power_down)(struct sd *sd);
const struct ctrl *ctrls;
}; };
#endif #endif
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment