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: imx290: Implement HBLANK and VBLANK controls

Add support for the V4L2_CID_HBLANK and V4L2_CID_VBLANK controls to the
imx290 driver. Make the controls read-only to start with, to report the
values to userspace for timing calculation.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>

authored by

Laurent Pinchart and committed by
Sakari Ailus
0c3b56c9 72c87b7a

+32 -1
+32 -1
drivers/media/i2c/imx290.c
··· 146 146 struct v4l2_ctrl_handler ctrls; 147 147 struct v4l2_ctrl *link_freq; 148 148 struct v4l2_ctrl *pixel_rate; 149 + struct v4l2_ctrl *hblank; 150 + struct v4l2_ctrl *vblank; 149 151 150 152 struct mutex lock; 151 153 }; ··· 644 642 if (imx290->pixel_rate) 645 643 __v4l2_ctrl_s_ctrl_int64(imx290->pixel_rate, 646 644 imx290_calc_pixel_rate(imx290)); 645 + 646 + if (imx290->hblank) { 647 + unsigned int hblank = mode->hmax - mode->width; 648 + 649 + __v4l2_ctrl_modify_range(imx290->hblank, hblank, hblank, 650 + 1, hblank); 651 + } 652 + 653 + if (imx290->vblank) { 654 + unsigned int vblank = IMX290_VMAX_DEFAULT - mode->height; 655 + 656 + __v4l2_ctrl_modify_range(imx290->vblank, vblank, vblank, 657 + 1, vblank); 658 + } 647 659 } 648 660 649 661 *format = fmt->format; ··· 896 880 897 881 static int imx290_ctrl_init(struct imx290 *imx290) 898 882 { 883 + unsigned int blank; 899 884 int ret; 900 885 901 - v4l2_ctrl_handler_init(&imx290->ctrls, 5); 886 + v4l2_ctrl_handler_init(&imx290->ctrls, 7); 902 887 imx290->ctrls.lock = &imx290->lock; 903 888 904 889 /* ··· 939 922 V4L2_CID_TEST_PATTERN, 940 923 ARRAY_SIZE(imx290_test_pattern_menu) - 1, 941 924 0, 0, imx290_test_pattern_menu); 925 + 926 + blank = imx290->current_mode->hmax - imx290->current_mode->width; 927 + imx290->hblank = v4l2_ctrl_new_std(&imx290->ctrls, &imx290_ctrl_ops, 928 + V4L2_CID_HBLANK, blank, blank, 1, 929 + blank); 930 + if (imx290->hblank) 931 + imx290->hblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; 932 + 933 + blank = IMX290_VMAX_DEFAULT - imx290->current_mode->height; 934 + imx290->vblank = v4l2_ctrl_new_std(&imx290->ctrls, &imx290_ctrl_ops, 935 + V4L2_CID_VBLANK, blank, blank, 1, 936 + blank); 937 + if (imx290->vblank) 938 + imx290->vblank->flags |= V4L2_CTRL_FLAG_READ_ONLY; 942 939 943 940 imx290->sd.ctrl_handler = &imx290->ctrls; 944 941