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: Inline imx219_update_pad_format() in its caller

The imx219_update_pad_format() is short and called from a single place,
in imx219_set_pad_format(). Inline the code in the caller to keep all
format adjustments grouped in a single place and improve readability.

Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Reviewed-by: Jacopo Mondi <jacopo.mondi@ideasonboard.com>
Reviewed-by: Dave Stevenson <dave.stevenson@raspberrypi.com>
Signed-off-by: Sakari Ailus <sakari.ailus@linux.intel.com>
Signed-off-by: Hans Verkuil <hverkuil+cisco@kernel.org>

authored by

Laurent Pinchart and committed by
Hans Verkuil
59b9548e 0b216f7f

+13 -16
+13 -16
drivers/media/i2c/imx219.c
··· 792 792 return ret; 793 793 } 794 794 795 - static void imx219_update_pad_format(struct imx219 *imx219, 796 - const struct imx219_mode *mode, 797 - struct v4l2_mbus_framefmt *fmt, u32 code) 798 - { 799 - /* Bayer order varies with flips */ 800 - fmt->code = imx219_get_format_code(imx219, code); 801 - fmt->width = mode->width; 802 - fmt->height = mode->height; 803 - fmt->field = V4L2_FIELD_NONE; 804 - fmt->colorspace = V4L2_COLORSPACE_RAW; 805 - fmt->ycbcr_enc = V4L2_YCBCR_ENC_601; 806 - fmt->quantization = V4L2_QUANTIZATION_FULL_RANGE; 807 - fmt->xfer_func = V4L2_XFER_FUNC_NONE; 808 - } 809 - 810 795 static int imx219_enum_mbus_code(struct v4l2_subdev *sd, 811 796 struct v4l2_subdev_state *state, 812 797 struct v4l2_subdev_mbus_code_enum *code) ··· 843 858 format = v4l2_subdev_state_get_format(state, 0); 844 859 prev_line_len = format->width + imx219->hblank->val; 845 860 861 + /* 862 + * Adjust the requested format to match the closest mode. The Bayer 863 + * order varies with flips. 864 + */ 846 865 mode = v4l2_find_nearest_size(supported_modes, 847 866 ARRAY_SIZE(supported_modes), 848 867 width, height, 849 868 fmt->format.width, fmt->format.height); 850 869 851 - imx219_update_pad_format(imx219, mode, &fmt->format, fmt->format.code); 870 + fmt->format.code = imx219_get_format_code(imx219, fmt->format.code); 871 + fmt->format.width = mode->width; 872 + fmt->format.height = mode->height; 873 + fmt->format.field = V4L2_FIELD_NONE; 874 + fmt->format.colorspace = V4L2_COLORSPACE_RAW; 875 + fmt->format.ycbcr_enc = V4L2_YCBCR_ENC_601; 876 + fmt->format.quantization = V4L2_QUANTIZATION_FULL_RANGE; 877 + fmt->format.xfer_func = V4L2_XFER_FUNC_NONE; 878 + 852 879 *format = fmt->format; 853 880 854 881 /*