From 5a31825953e74c5ff0831b7322d65805248455b2 Mon Sep 17 00:00:00 2001 From: Laurent Pinchart Date: Sun, 4 Sep 2011 15:05:30 +0200 Subject: controls: Add sensor exposure time and gains controls Signed-off-by: Laurent Pinchart --- isp/controls.c | 53 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 53 insertions(+) (limited to 'isp/controls.c') diff --git a/isp/controls.c b/isp/controls.c index 1c46039..c7ceee2 100644 --- a/isp/controls.c +++ b/isp/controls.c @@ -257,3 +257,56 @@ int omap3_isp_preview_set_saturation(struct omap3_isp_device *isp, float value) return ret; } + +/* ----------------------------------------------------------------------------- + * Sensor parameters configuration + */ + +#define V4L2_CID_GAIN_RED (V4L2_CTRL_CLASS_CAMERA | 0x1001) +#define V4L2_CID_GAIN_GREEN1 (V4L2_CTRL_CLASS_CAMERA | 0x1002) +#define V4L2_CID_GAIN_GREEN2 (V4L2_CTRL_CLASS_CAMERA | 0x1003) +#define V4L2_CID_GAIN_BLUE (V4L2_CTRL_CLASS_CAMERA | 0x1004) + +int omap3_isp_sensor_get_exposure(struct omap3_isp_device *isp, + unsigned int *exposure) +{ + struct v4l2_ext_control ctrls[1]; + int ret; + + ctrls[0].id = V4L2_CID_EXPOSURE; + + ret = v4l2_subdev_set_controls(isp->sensor, ARRAY_SIZE(ctrls), ctrls); + if (ret < 0) + return ret; + + *exposure = ctrls[0].value; + return 0; +} + +int omap3_isp_sensor_set_exposure(struct omap3_isp_device *isp, + unsigned int exposure) +{ + struct v4l2_ext_control ctrls[1]; + + ctrls[0].id = V4L2_CID_EXPOSURE; + ctrls[0].value = exposure; + + return v4l2_subdev_set_controls(isp->sensor, ARRAY_SIZE(ctrls), ctrls); +} + +int omap3_isp_sensor_set_gains(struct omap3_isp_device *isp, unsigned int red, + unsigned int green, unsigned int blue) +{ + struct v4l2_ext_control ctrls[4]; + + ctrls[0].id = V4L2_CID_GAIN_RED; + ctrls[0].value = red; + ctrls[1].id = V4L2_CID_GAIN_GREEN1; + ctrls[1].value = green; + ctrls[2].id = V4L2_CID_GAIN_GREEN2; + ctrls[2].value = green; + ctrls[3].id = V4L2_CID_GAIN_BLUE; + ctrls[3].value = blue; + + return v4l2_subdev_set_controls(isp->sensor, ARRAY_SIZE(ctrls), ctrls); +} -- cgit v1.2.3