Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

media: i2c: imx219: Replace exposure magic value with named constant

Introduce IMX219_EXPOSURE_OFFSET (4) and use it instead of the literal
'4' when computing the maximum coarse exposure. The IMX219 datasheet
specifies the maximum storage time as frame_length_lines - 4.
(Ref: Datasheet section 5-7-1)

Also fix one indentation issue for consistency.

Signed-off-by: Tarang Raval <tarang.raval@siliconsignals.io>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Reviewed-by: Kieran Bingham <kieran.bingham@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Tarang Raval and committed by
Hans Verkuil
9a9ba098 dff10c70

+7 -6
+7 -6
drivers/media/i2c/imx219.c
··· 68 68 #define IMX219_EXPOSURE_STEP 1 69 69 #define IMX219_EXPOSURE_DEFAULT 0x640 70 70 #define IMX219_EXPOSURE_MAX 65535 71 + #define IMX219_EXPOSURE_OFFSET 4 71 72 72 73 /* V_TIMING internal */ 73 74 #define IMX219_REG_FRM_LENGTH_A CCI_REG16(0x0160) ··· 451 450 int exposure_max, exposure_def; 452 451 453 452 /* Update max exposure while meeting expected vblanking */ 454 - exposure_max = format->height + ctrl->val - 4; 453 + exposure_max = format->height + ctrl->val - IMX219_EXPOSURE_OFFSET; 455 454 exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ? 456 - exposure_max : IMX219_EXPOSURE_DEFAULT; 455 + exposure_max : IMX219_EXPOSURE_DEFAULT; 457 456 ret = __v4l2_ctrl_modify_range(imx219->exposure, 458 457 imx219->exposure->minimum, 459 458 exposure_max, ··· 580 579 IMX219_LLP_MIN - mode->width, 581 580 IMX219_LLP_MAX - mode->width, 1, 582 581 IMX219_LLP_MIN - mode->width); 583 - exposure_max = mode->fll_def - 4; 582 + exposure_max = mode->fll_def - IMX219_EXPOSURE_OFFSET; 584 583 exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ? 585 - exposure_max : IMX219_EXPOSURE_DEFAULT; 584 + exposure_max : IMX219_EXPOSURE_DEFAULT; 586 585 imx219->exposure = v4l2_ctrl_new_std(ctrl_hdlr, &imx219_ctrl_ops, 587 586 V4L2_CID_EXPOSURE, 588 587 IMX219_EXPOSURE_MIN, exposure_max, ··· 901 900 return ret; 902 901 903 902 /* Update max exposure while meeting expected vblanking */ 904 - exposure_max = mode->fll_def - 4; 903 + exposure_max = mode->fll_def - IMX219_EXPOSURE_OFFSET; 905 904 exposure_def = (exposure_max < IMX219_EXPOSURE_DEFAULT) ? 906 - exposure_max : IMX219_EXPOSURE_DEFAULT; 905 + exposure_max : IMX219_EXPOSURE_DEFAULT; 907 906 ret = __v4l2_ctrl_modify_range(imx219->exposure, 908 907 imx219->exposure->minimum, 909 908 exposure_max,