/* If possible send 16 extra rows / lines to the ISP as padding */
 #define OV2680_END_MARGIN                      16
 
+/* Max exposure time is VTS - 8 */
+#define OV2680_INTEGRATION_TIME_MARGIN         8
+
 #define OV2680_DEFAULT_WIDTH                   800
 #define OV2680_DEFAULT_HEIGHT                  600
 
        }
 
        switch (ctrl->id) {
-       case V4L2_CID_GAIN:
+       case V4L2_CID_ANALOGUE_GAIN:
                ret = ov2680_gain_set(sensor, ctrl->val);
                break;
        case V4L2_CID_EXPOSURE:
        const struct v4l2_ctrl_ops *ops = &ov2680_ctrl_ops;
        struct ov2680_ctrls *ctrls = &sensor->ctrls;
        struct v4l2_ctrl_handler *hdl = &ctrls->handler;
+       int exp_max = OV2680_LINES_PER_FRAME - OV2680_INTEGRATION_TIME_MARGIN;
        int ret = 0;
 
        v4l2_i2c_subdev_init(&sensor->sd, client, &ov2680_subdev_ops);
                                        0, 0, test_pattern_menu);
 
        ctrls->exposure = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_EXPOSURE,
-                                           0, 32767, 1, 0);
+                                           0, exp_max, 1, exp_max);
 
-       ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_GAIN, 0, 2047, 1, 0);
+       ctrls->gain = v4l2_ctrl_new_std(hdl, ops, V4L2_CID_ANALOGUE_GAIN,
+                                       0, 1023, 1, 250);
 
        if (hdl->error) {
                ret = hdl->error;