Skip to content

Commit 0094eba

Browse files
naushirpelwell
authored andcommitted
drivers: media: imx500: Simplify the vblank control init
Set the VBLANK control minimum and default values to IMX500_VBLANK_MIN unconditionally everywhere. Remove the mode specific framerate_default parameter, it is now unused. Signed-off-by: Naushir Patuck <naush@raspberrypi.com>
1 parent d290bef commit 0094eba

File tree

1 file changed

+5
-27
lines changed

1 file changed

+5
-27
lines changed

drivers/media/i2c/imx500.c

Lines changed: 5 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -274,9 +274,6 @@ struct imx500_mode {
274274
/* Analog crop rectangle. */
275275
struct v4l2_rect crop;
276276

277-
/* Default framerate. */
278-
unsigned int framerate_default;
279-
280277
/* Default register values */
281278
struct imx500_reg_list reg_list;
282279
};
@@ -905,7 +902,6 @@ static const struct imx500_mode imx500_supported_modes[] = {
905902
.width = 4056,
906903
.height = 3040,
907904
},
908-
.framerate_default = 10,
909905
.reg_list = {
910906
.num_of_regs = ARRAY_SIZE(mode_4056x3040_regs),
911907
.regs = mode_4056x3040_regs,
@@ -922,7 +918,6 @@ static const struct imx500_mode imx500_supported_modes[] = {
922918
.width = 4056,
923919
.height = 3040,
924920
},
925-
.framerate_default = 30,
926921
.reg_list = {
927922
.num_of_regs = ARRAY_SIZE(mode_2028x1520_regs),
928923
.regs = mode_2028x1520_regs,
@@ -1744,40 +1739,22 @@ static int imx500_get_pad_format(struct v4l2_subdev *sd,
17441739
return 0;
17451740
}
17461741

1747-
static unsigned int imx500_get_frame_length(const struct imx500_mode *mode,
1748-
unsigned int framerate_default)
1749-
{
1750-
u64 frame_length;
1751-
1752-
frame_length = IMX500_PIXEL_RATE;
1753-
do_div(frame_length, (u64)framerate_default * mode->line_length_pix);
1754-
1755-
if (WARN_ON(frame_length > IMX500_FRAME_LENGTH_MAX))
1756-
frame_length = IMX500_FRAME_LENGTH_MAX;
1757-
1758-
return max_t(unsigned int, frame_length, mode->height);
1759-
}
1760-
17611742
static void imx500_set_framing_limits(struct imx500 *imx500)
17621743
{
1763-
unsigned int frm_length_default, hblank_min;
1744+
unsigned int hblank_min;
17641745
const struct imx500_mode *mode = imx500->mode;
17651746

1766-
frm_length_default =
1767-
imx500_get_frame_length(mode, mode->framerate_default);
1768-
17691747
/* Default to no long exposure multiplier. */
17701748
imx500->long_exp_shift = 0;
17711749

17721750
/* Update limits and set FPS to default */
17731751
__v4l2_ctrl_modify_range(
17741752
imx500->vblank, IMX500_VBLANK_MIN,
17751753
((1 << IMX500_LONG_EXP_SHIFT_MAX) * IMX500_FRAME_LENGTH_MAX) -
1776-
mode->height,
1777-
1, frm_length_default - mode->height);
1754+
mode->height, 1, IMX500_VBLANK_MIN);
17781755

17791756
/* Setting this will adjust the exposure limits as well. */
1780-
__v4l2_ctrl_s_ctrl(imx500->vblank, frm_length_default - mode->height);
1757+
__v4l2_ctrl_s_ctrl(imx500->vblank, IMX500_VBLANK_MIN);
17811758

17821759
hblank_min = mode->line_length_pix - mode->width;
17831760
__v4l2_ctrl_modify_range(imx500->hblank, hblank_min, hblank_min, 1,
@@ -2499,7 +2476,8 @@ static int imx500_init_controls(struct imx500 *imx500)
24992476
* in the imx500_set_framing_limits() call below.
25002477
*/
25012478
imx500->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx500_ctrl_ops,
2502-
V4L2_CID_VBLANK, 0, 0xffff, 1, 0);
2479+
V4L2_CID_VBLANK, IMX500_VBLANK_MIN,
2480+
0xffff, 1, IMX500_VBLANK_MIN);
25032481
imx500->hblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx500_ctrl_ops,
25042482
V4L2_CID_HBLANK, 0, 0xffff, 1, 0);
25052483

0 commit comments

Comments
 (0)