diff options
author | Sakari Ailus <sakari.ailus@linux.intel.com> | 2014-06-11 09:34:35 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <m.chehab@samsung.com> | 2014-08-21 16:25:27 -0400 |
commit | e47a81d8886d0262f9f6a4ecf7aa7e6ba2cb0dfc (patch) | |
tree | ad83755385856ac4198c6c4665e46fc071360835 /drivers/media/i2c | |
parent | f23797b636c4d69b29d2739ba5fc0e36b4e47390 (diff) |
[media] smiapp: Use unlocked __v4l2_ctrl_modify_range()
Instead of modifying the control ranges directly by manipulating struct
v4l2_ctrl, use __v4l2_ctrl_modify_range() for the purpose.
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Mauro Carvalho Chehab <m.chehab@samsung.com>
Diffstat (limited to 'drivers/media/i2c')
-rw-r--r-- | drivers/media/i2c/smiapp/smiapp-core.c | 47 |
1 files changed, 15 insertions, 32 deletions
diff --git a/drivers/media/i2c/smiapp/smiapp-core.c b/drivers/media/i2c/smiapp/smiapp-core.c index 437ec29bdf64..bf8d3380111a 100644 --- a/drivers/media/i2c/smiapp/smiapp-core.c +++ b/drivers/media/i2c/smiapp/smiapp-core.c | |||
@@ -320,13 +320,7 @@ static void __smiapp_update_exposure_limits(struct smiapp_sensor *sensor) | |||
320 | + sensor->vblank->val | 320 | + sensor->vblank->val |
321 | - sensor->limits[SMIAPP_LIMIT_COARSE_INTEGRATION_TIME_MAX_MARGIN]; | 321 | - sensor->limits[SMIAPP_LIMIT_COARSE_INTEGRATION_TIME_MAX_MARGIN]; |
322 | 322 | ||
323 | ctrl->maximum = max; | 323 | __v4l2_ctrl_modify_range(ctrl, ctrl->minimum, max, ctrl->step, max); |
324 | if (ctrl->default_value > max) | ||
325 | ctrl->default_value = max; | ||
326 | if (ctrl->val > max) | ||
327 | ctrl->val = max; | ||
328 | if (ctrl->cur.val > max) | ||
329 | ctrl->cur.val = max; | ||
330 | } | 324 | } |
331 | 325 | ||
332 | /* | 326 | /* |
@@ -834,36 +828,25 @@ static void smiapp_update_blanking(struct smiapp_sensor *sensor) | |||
834 | { | 828 | { |
835 | struct v4l2_ctrl *vblank = sensor->vblank; | 829 | struct v4l2_ctrl *vblank = sensor->vblank; |
836 | struct v4l2_ctrl *hblank = sensor->hblank; | 830 | struct v4l2_ctrl *hblank = sensor->hblank; |
831 | int min, max; | ||
837 | 832 | ||
838 | vblank->minimum = | 833 | min = max_t(int, |
839 | max_t(int, | 834 | sensor->limits[SMIAPP_LIMIT_MIN_FRAME_BLANKING_LINES], |
840 | sensor->limits[SMIAPP_LIMIT_MIN_FRAME_BLANKING_LINES], | 835 | sensor->limits[SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN] - |
841 | sensor->limits[SMIAPP_LIMIT_MIN_FRAME_LENGTH_LINES_BIN] - | 836 | sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height); |
842 | sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height); | 837 | max = sensor->limits[SMIAPP_LIMIT_MAX_FRAME_LENGTH_LINES_BIN] - |
843 | vblank->maximum = | ||
844 | sensor->limits[SMIAPP_LIMIT_MAX_FRAME_LENGTH_LINES_BIN] - | ||
845 | sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height; | 838 | sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].height; |
846 | 839 | ||
847 | vblank->val = clamp_t(int, vblank->val, | 840 | __v4l2_ctrl_modify_range(vblank, min, max, vblank->step, min); |
848 | vblank->minimum, vblank->maximum); | 841 | |
849 | vblank->default_value = vblank->minimum; | 842 | min = max_t(int, |
850 | vblank->val = vblank->val; | 843 | sensor->limits[SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK_BIN] - |
851 | vblank->cur.val = vblank->val; | 844 | sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width, |
852 | 845 | sensor->limits[SMIAPP_LIMIT_MIN_LINE_BLANKING_PCK_BIN]); | |
853 | hblank->minimum = | 846 | max = sensor->limits[SMIAPP_LIMIT_MAX_LINE_LENGTH_PCK_BIN] - |
854 | max_t(int, | ||
855 | sensor->limits[SMIAPP_LIMIT_MIN_LINE_LENGTH_PCK_BIN] - | ||
856 | sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width, | ||
857 | sensor->limits[SMIAPP_LIMIT_MIN_LINE_BLANKING_PCK_BIN]); | ||
858 | hblank->maximum = | ||
859 | sensor->limits[SMIAPP_LIMIT_MAX_LINE_LENGTH_PCK_BIN] - | ||
860 | sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width; | 847 | sensor->pixel_array->crop[SMIAPP_PA_PAD_SRC].width; |
861 | 848 | ||
862 | hblank->val = clamp_t(int, hblank->val, | 849 | __v4l2_ctrl_modify_range(hblank, min, max, hblank->step, min); |
863 | hblank->minimum, hblank->maximum); | ||
864 | hblank->default_value = hblank->minimum; | ||
865 | hblank->val = hblank->val; | ||
866 | hblank->cur.val = hblank->val; | ||
867 | 850 | ||
868 | __smiapp_update_exposure_limits(sensor); | 851 | __smiapp_update_exposure_limits(sensor); |
869 | } | 852 | } |