Hi Shawn, On Fri, Apr 30, 2021 at 10:05:49PM +0800, Shawnx Tu wrote: > From: Shawn Tu <shawnx.tu@xxxxxxxxx> > > Add a V4L2 sub-device driver for the Sony IMX208 image sensor. > This is a camera sensor using the I2C bus for control and the > CSI-2 bus for data. > > since v1: > -- Update the function media_entity_pads_init for upstreaming. > -- Change the structure name mutex as imx208_mx. > -- Refine the control flow of test pattern function. > -- vflip/hflip control support (will impact the output bayer order) > -- support 4 bayer orders output (via change v/hflip) > - SRGGB10(default), SGRBG10, SGBRG10, SBGGR10 > -- Simplify error handling in the set_stream function. > since v2: > -- Refine coding style. > -- Fix the if statement to use pm_runtime_get_if_in_use(). > -- Print more error log during error handling. > -- Remove mutex_destroy() from imx208_free_controls(). > -- Add more comments. > since v3: > -- Set explicit indices to link frequencies. > since v4: > -- Fix the wrong index in link_freq_menu_items. > since v5: > -- Expose OTP data through a sysfs attribute > -- Enable the DG v4l2 control with integer menu type > since v6: > -- Fix the checkpatch.pl warnings > > Signed-off-by: Ping-Chung Chen <ping-chung.chen@xxxxxxxxx> > Signed-off-by: Yeh, Andy <andy.yeh@xxxxxxxxx> > Signed-off-by: Shawn Tu <shawnx.tu@xxxxxxxxx> > Reviewed-by: Tomasz Figa <tfiga@xxxxxxxxxxxx> I've applied the patch to my tree, with this diff, and removed the changelog from the commit message: diff --git a/drivers/media/i2c/imx208.c b/drivers/media/i2c/imx208.c index 74383aeb1460..9ed261ea7255 100644 --- a/drivers/media/i2c/imx208.c +++ b/drivers/media/i2c/imx208.c @@ -603,8 +603,8 @@ static int imx208_set_pad_format(struct v4l2_subdev *sd, vblank_min = imx208->cur_mode->vts_min - imx208->cur_mode->height; __v4l2_ctrl_modify_range(imx208->vblank, vblank_min, - IMX208_VTS_MAX - imx208->cur_mode->height, 1, - vblank_def); + IMX208_VTS_MAX - imx208->cur_mode->height, + 1, vblank_def); __v4l2_ctrl_s_ctrl(imx208->vblank, vblank_def); h_blank = link_freq_configs[mode->link_freq_index].pixels_per_line @@ -875,18 +875,19 @@ static int imx208_init_controls(struct imx208 *imx208) mutex_init(&imx208->imx208_mx); ctrl_hdlr->lock = &imx208->imx208_mx; - imx208->link_freq = v4l2_ctrl_new_int_menu(ctrl_hdlr, - &imx208_ctrl_ops, - V4L2_CID_LINK_FREQ, - ARRAY_SIZE(link_freq_menu_items) - 1, - 0, link_freq_menu_items); + imx208->link_freq = + v4l2_ctrl_new_int_menu(ctrl_hdlr, + &imx208_ctrl_ops, + V4L2_CID_LINK_FREQ, + ARRAY_SIZE(link_freq_menu_items) - 1, + 0, link_freq_menu_items); if (imx208->link_freq) imx208->link_freq->flags |= V4L2_CTRL_FLAG_READ_ONLY; pixel_rate_max = link_freq_to_pixel_rate(link_freq_menu_items[0]); - pixel_rate_min = link_freq_to_pixel_rate(link_freq_menu_items[ARRAY_SIZE - (link_freq_menu_items) - 1]); + pixel_rate_min = + link_freq_to_pixel_rate(link_freq_menu_items[ARRAY_SIZE(link_freq_menu_items) - 1]); /* By default, PIXEL_RATE is read only */ imx208->pixel_rate = v4l2_ctrl_new_std(ctrl_hdlr, &imx208_ctrl_ops, V4L2_CID_PIXEL_RATE, @@ -895,24 +896,25 @@ static int imx208_init_controls(struct imx208 *imx208) vblank_def = imx208->cur_mode->vts_def - imx208->cur_mode->height; vblank_min = imx208->cur_mode->vts_min - imx208->cur_mode->height; - imx208->vblank = v4l2_ctrl_new_std(ctrl_hdlr, &imx208_ctrl_ops, V4L2_CID_VBLANK, - vblank_min, - IMX208_VTS_MAX - imx208->cur_mode->height, 1, - vblank_def); - - imx208->hblank = v4l2_ctrl_new_std(ctrl_hdlr, - &imx208_ctrl_ops, V4L2_CID_HBLANK, - IMX208_PPL_384MHZ - imx208->cur_mode->width, - IMX208_PPL_384MHZ - imx208->cur_mode->width, - 1, - IMX208_PPL_384MHZ - imx208->cur_mode->width); + imx208->vblank = + v4l2_ctrl_new_std(ctrl_hdlr, &imx208_ctrl_ops, V4L2_CID_VBLANK, + vblank_min, + IMX208_VTS_MAX - imx208->cur_mode->height, 1, + vblank_def); + + imx208->hblank = + v4l2_ctrl_new_std(ctrl_hdlr, &imx208_ctrl_ops, V4L2_CID_HBLANK, + IMX208_PPL_384MHZ - imx208->cur_mode->width, + IMX208_PPL_384MHZ - imx208->cur_mode->width, + 1, + IMX208_PPL_384MHZ - imx208->cur_mode->width); if (imx208->hblank) imx208->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; exposure_max = imx208->cur_mode->vts_def - 8; v4l2_ctrl_new_std(ctrl_hdlr, &imx208_ctrl_ops, V4L2_CID_EXPOSURE, - IMX208_EXPOSURE_MIN, IMX208_EXPOSURE_MAX, + IMX208_EXPOSURE_MIN, exposure_max, IMX208_EXPOSURE_STEP, IMX208_EXPOSURE_DEFAULT); imx208->hflip = v4l2_ctrl_new_std(ctrl_hdlr, &imx208_ctrl_ops, -- Kind regards, Sakari Ailus