diff options
-rw-r--r-- | isp/controls.c | 53 | ||||
-rw-r--r-- | isp/omap3isp.h | 7 |
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 |