summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-09-04 15:05:30 +0200
committerLaurent Pinchart <laurent.pinchart@ideasonboard.com>2011-09-04 15:40:09 +0200
commit5a31825953e74c5ff0831b7322d65805248455b2 (patch)
tree9cee0de6bff9e19efbe3f74c444d813dc5f0dcea
parent9cdb623c6ee2d4937729def042b433648d964315 (diff)
controls: Add sensor exposure time and gains controls
Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r--isp/controls.c53
-rw-r--r--isp/omap3isp.h7
2 files changed, 60 insertions, 0 deletions
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);
+}
diff --git a/isp/omap3isp.h b/isp/omap3isp.h
index 6427efc..368fd72 100644
--- a/isp/omap3isp.h
+++ b/isp/omap3isp.h
@@ -77,4 +77,11 @@ int omap3_isp_snapshot_put_buffer(struct omap3_isp_device *isp,
int omap3_isp_preview_set_contrast(struct omap3_isp_device *isp, unsigned int value);
int omap3_isp_preview_set_saturation(struct omap3_isp_device *isp, float value);
+int omap3_isp_sensor_get_exposure(struct omap3_isp_device *isp,
+ unsigned int *exposure);
+int omap3_isp_sensor_set_exposure(struct omap3_isp_device *isp,
+ unsigned int exposure);
+int omap3_isp_sensor_set_gains(struct omap3_isp_device *isp, unsigned int red,
+ unsigned int green, unsigned int blue);
+
#endif