All of lore.kernel.org
 help / color / mirror / Atom feed
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Paul Elder <paul.elder@ideasonboard.com>
Cc: linux-media@vger.kernel.org, dafna@fastmail.com, heiko@sntech.de,
	jeanmichel.hautbois@ideasonboard.com, jacopo@jmondi.org,
	djrscally@gmail.com, helen.koike@collabora.com,
	linux-rockchip@lists.infradead.org
Subject: Re: [PATCH 09/55] media: rkisp1: Make rkisp1_isp_mbus_info common
Date: Thu, 16 Jun 2022 03:50:41 +0300	[thread overview]
Message-ID: <Yqp+YR6Tj+CtOMcz@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220614191127.3420492-10-paul.elder@ideasonboard.com>

Hi Paul,

Thank you for the patch.

On Wed, Jun 15, 2022 at 04:10:41AM +0900, Paul Elder wrote:
> The upcoming CSI receiver split from the ISP to a separate source file
> will need to be able to access the list of formats supported by the
> driver. Move it out of the ISP's header and into the common header, and
> add helper functions for accessing it so that the format list doesn't
> need to be stored in the header.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
>  .../platform/rockchip/rkisp1/rkisp1-common.c  | 148 +++++++++++++++
>  .../platform/rockchip/rkisp1/rkisp1-common.h  |  28 ++-
>  .../platform/rockchip/rkisp1/rkisp1-isp.c     | 168 ++----------------
>  .../platform/rockchip/rkisp1/rkisp1-resizer.c |  14 +-
>  .../platform/rockchip/rkisp1/rkisp1-stats.c   |   2 +-
>  5 files changed, 193 insertions(+), 167 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.c
> index cf889666e166..bb0ea20118e1 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.c
> @@ -5,10 +5,158 @@
>   * Copyright (C) 2019 Collabora, Ltd.
>   */
>  
> +#include <media/mipi-csi2.h>
>  #include <media/v4l2-rect.h>
>  
>  #include "rkisp1-common.h"
>  
> +static const struct rkisp1_mbus_info rkisp1_formats[] = {
> +	{
> +		.mbus_code	= MEDIA_BUS_FMT_YUYV8_2X8,
> +		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> +		.direction	= RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SRGGB10_1X10,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> +		.bayer_pat	= RKISP1_RAW_RGGB,
> +		.bus_width	= 10,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SBGGR10_1X10,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> +		.bayer_pat	= RKISP1_RAW_BGGR,
> +		.bus_width	= 10,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGBRG10_1X10,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> +		.bayer_pat	= RKISP1_RAW_GBRG,
> +		.bus_width	= 10,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGRBG10_1X10,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> +		.bayer_pat	= RKISP1_RAW_GRBG,
> +		.bus_width	= 10,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SRGGB12_1X12,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> +		.bayer_pat	= RKISP1_RAW_RGGB,
> +		.bus_width	= 12,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SBGGR12_1X12,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> +		.bayer_pat	= RKISP1_RAW_BGGR,
> +		.bus_width	= 12,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGBRG12_1X12,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> +		.bayer_pat	= RKISP1_RAW_GBRG,
> +		.bus_width	= 12,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGRBG12_1X12,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> +		.bayer_pat	= RKISP1_RAW_GRBG,
> +		.bus_width	= 12,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SRGGB8_1X8,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> +		.bayer_pat	= RKISP1_RAW_RGGB,
> +		.bus_width	= 8,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SBGGR8_1X8,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> +		.bayer_pat	= RKISP1_RAW_BGGR,
> +		.bus_width	= 8,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGBRG8_1X8,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> +		.bayer_pat	= RKISP1_RAW_GBRG,
> +		.bus_width	= 8,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGRBG8_1X8,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> +		.bayer_pat	= RKISP1_RAW_GRBG,
> +		.bus_width	= 8,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_YUYV8_1X16,
> +		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> +		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> +		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_YCBYCR,
> +		.bus_width	= 16,
> +		.direction	= RKISP1_ISP_SD_SINK,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_YVYU8_1X16,
> +		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> +		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> +		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_YCRYCB,
> +		.bus_width	= 16,
> +		.direction	= RKISP1_ISP_SD_SINK,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_UYVY8_1X16,
> +		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> +		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> +		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_CBYCRY,
> +		.bus_width	= 16,
> +		.direction	= RKISP1_ISP_SD_SINK,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_VYUY8_1X16,
> +		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> +		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> +		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_CRYCBY,
> +		.bus_width	= 16,
> +		.direction	= RKISP1_ISP_SD_SINK,
> +	},
> +};
> +
> +unsigned int rkisp1_mbus_info_length(void)
> +{
> +	return ARRAY_SIZE(rkisp1_formats);
> +}
> +
> +const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_index(unsigned int index)
> +{
> +	if (index >= rkisp1_mbus_info_length())

	if (index >= ARRAY_SIZE(rkisp1_formats))

to match the code below (and see also my comment further down)

> +		return NULL;
> +
> +	return &rkisp1_formats[index];
> +}
> +
> +const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_code(u32 mbus_code)
> +{
> +	unsigned int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(rkisp1_formats); i++) {
> +		const struct rkisp1_mbus_info *fmt = &rkisp1_formats[i];
> +
> +		if (fmt->mbus_code == mbus_code)
> +			return fmt;
> +	}
> +
> +	return NULL;
> +}
> +
>  static const struct v4l2_rect rkisp1_sd_min_crop = {
>  	.width = RKISP1_ISP_MIN_WIDTH,
>  	.height = RKISP1_ISP_MIN_HEIGHT,
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> index 50d31a254b03..c7d5c57607bd 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> @@ -26,7 +26,7 @@
>  struct dentry;
>  
>  /*
> - * flags on the 'direction' field in struct 'rkisp1_isp_mbus_info' that indicate
> + * flags on the 'direction' field in struct rkisp1_mbus_info' that indicate
>   * on which pad the media bus format is supported
>   */
>  #define RKISP1_ISP_SD_SRC			BIT(0)
> @@ -150,8 +150,8 @@ struct rkisp1_isp {
>  	struct v4l2_subdev sd;
>  	struct media_pad pads[RKISP1_ISP_PAD_MAX];
>  	struct v4l2_subdev_pad_config pad_cfg[RKISP1_ISP_PAD_MAX];
> -	const struct rkisp1_isp_mbus_info *sink_fmt;
> -	const struct rkisp1_isp_mbus_info *src_fmt;
> +	const struct rkisp1_mbus_info *sink_fmt;
> +	const struct rkisp1_mbus_info *src_fmt;
>  	struct mutex ops_lock; /* serialize the subdevice ops */
>  	bool is_dphy_errctrl_disabled;
>  	__u32 frame_sequence;
> @@ -438,8 +438,8 @@ struct rkisp1_device {
>  };
>  
>  /*
> - * struct rkisp1_isp_mbus_info - ISP media bus info, Translates media bus code to hardware
> - *				 format values
> + * struct rkisp1_mbus_info - ISP media bus info, Translates media bus code to hardware
> + *			     format values
>   *
>   * @mbus_code: media bus code
>   * @pixel_enc: pixel encoding
> @@ -449,7 +449,7 @@ struct rkisp1_device {
>   * @bayer_pat: bayer pattern
>   * @direction: a bitmask of the flags indicating on which pad the format is supported on
>   */
> -struct rkisp1_isp_mbus_info {
> +struct rkisp1_mbus_info {
>  	u32 mbus_code;
>  	enum v4l2_pixel_encoding pixel_enc;
>  	u32 mipi_dt;
> @@ -481,6 +481,18 @@ static inline u32 rkisp1_read(struct rkisp1_device *rkisp1, unsigned int addr)
>  int rkisp1_cap_enum_mbus_codes(struct rkisp1_capture *cap,
>  			       struct v4l2_subdev_mbus_code_enum *code);
>  
> +/*
> + * rkisp1_mbus_info_length - Return the number of supported mbus codes
> + */
> +unsigned int rkisp1_mbus_info_length(void);
> +
> +/*
> + * rkisp1_mbus_info_get_by_index - Retrieve the ith supported mbus info
> + *
> + * @index: index of the mbus info to fetch
> + */
> +const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_index(unsigned int index);
> +
>  /*
>   * rkisp1_sd_adjust_crop_rect - adjust a rectangle to fit into another rectangle.
>   *
> @@ -500,11 +512,11 @@ void rkisp1_sd_adjust_crop(struct v4l2_rect *crop,
>  			   const struct v4l2_mbus_framefmt *bounds);
>  
>  /*
> - * rkisp1_isp_mbus_info - get the isp info of the media bus code
> + * rkisp1_mbus_info_get_by_code - get the isp info of the media bus code
>   *
>   * @mbus_code: the media bus code
>   */
> -const struct rkisp1_isp_mbus_info *rkisp1_isp_mbus_info_get(u32 mbus_code);
> +const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_code(u32 mbus_code);
>  
>  /* rkisp1_params_configure - configure the params when stream starts.
>   *			     This function is called by the isp entity upon stream starts.
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> index 328e8fec14e9..89577119b571 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> @@ -15,7 +15,6 @@
>  #include <linux/videodev2.h>
>  #include <linux/vmalloc.h>
>  
> -#include <media/mipi-csi2.h>
>  #include <media/v4l2-event.h>
>  
>  #include "rkisp1-common.h"
> @@ -56,144 +55,10 @@
>   * +---------------------------------------------------------+
>   */
>  
> -static const struct rkisp1_isp_mbus_info rkisp1_isp_formats[] = {
> -	{
> -		.mbus_code	= MEDIA_BUS_FMT_YUYV8_2X8,
> -		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> -		.direction	= RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SRGGB10_1X10,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> -		.bayer_pat	= RKISP1_RAW_RGGB,
> -		.bus_width	= 10,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SBGGR10_1X10,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> -		.bayer_pat	= RKISP1_RAW_BGGR,
> -		.bus_width	= 10,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGBRG10_1X10,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> -		.bayer_pat	= RKISP1_RAW_GBRG,
> -		.bus_width	= 10,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGRBG10_1X10,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> -		.bayer_pat	= RKISP1_RAW_GRBG,
> -		.bus_width	= 10,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SRGGB12_1X12,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> -		.bayer_pat	= RKISP1_RAW_RGGB,
> -		.bus_width	= 12,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SBGGR12_1X12,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> -		.bayer_pat	= RKISP1_RAW_BGGR,
> -		.bus_width	= 12,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGBRG12_1X12,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> -		.bayer_pat	= RKISP1_RAW_GBRG,
> -		.bus_width	= 12,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGRBG12_1X12,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> -		.bayer_pat	= RKISP1_RAW_GRBG,
> -		.bus_width	= 12,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SRGGB8_1X8,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> -		.bayer_pat	= RKISP1_RAW_RGGB,
> -		.bus_width	= 8,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SBGGR8_1X8,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> -		.bayer_pat	= RKISP1_RAW_BGGR,
> -		.bus_width	= 8,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGBRG8_1X8,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> -		.bayer_pat	= RKISP1_RAW_GBRG,
> -		.bus_width	= 8,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGRBG8_1X8,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> -		.bayer_pat	= RKISP1_RAW_GRBG,
> -		.bus_width	= 8,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_YUYV8_1X16,
> -		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> -		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> -		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_YCBYCR,
> -		.bus_width	= 16,
> -		.direction	= RKISP1_ISP_SD_SINK,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_YVYU8_1X16,
> -		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> -		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> -		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_YCRYCB,
> -		.bus_width	= 16,
> -		.direction	= RKISP1_ISP_SD_SINK,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_UYVY8_1X16,
> -		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> -		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> -		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_CBYCRY,
> -		.bus_width	= 16,
> -		.direction	= RKISP1_ISP_SD_SINK,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_VYUY8_1X16,
> -		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> -		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> -		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_CRYCBY,
> -		.bus_width	= 16,
> -		.direction	= RKISP1_ISP_SD_SINK,
> -	},
> -};
> -
>  /* ----------------------------------------------------------------------------
>   * Helpers
>   */
>  
> -const struct rkisp1_isp_mbus_info *rkisp1_isp_mbus_info_get(u32 mbus_code)
> -{
> -	unsigned int i;
> -
> -	for (i = 0; i < ARRAY_SIZE(rkisp1_isp_formats); i++) {
> -		const struct rkisp1_isp_mbus_info *fmt = &rkisp1_isp_formats[i];
> -
> -		if (fmt->mbus_code == mbus_code)
> -			return fmt;
> -	}
> -
> -	return NULL;
> -}
> -
>  static struct v4l2_subdev *rkisp1_get_remote_sensor(struct v4l2_subdev *sd)
>  {
>  	struct media_pad *local, *remote;
> @@ -275,7 +140,7 @@ static void rkisp1_config_ism(struct rkisp1_device *rkisp1)
>  static int rkisp1_config_isp(struct rkisp1_device *rkisp1)
>  {
>  	u32 isp_ctrl = 0, irq_mask = 0, acq_mult = 0, signal = 0;
> -	const struct rkisp1_isp_mbus_info *src_fmt, *sink_fmt;
> +	const struct rkisp1_mbus_info *src_fmt, *sink_fmt;
>  	struct rkisp1_sensor_async *sensor;
>  	struct v4l2_mbus_framefmt *sink_frm;
>  	struct v4l2_rect *sink_crop;
> @@ -376,7 +241,7 @@ static int rkisp1_config_isp(struct rkisp1_device *rkisp1)
>  
>  static int rkisp1_config_dvp(struct rkisp1_device *rkisp1)
>  {
> -	const struct rkisp1_isp_mbus_info *sink_fmt = rkisp1->isp.sink_fmt;
> +	const struct rkisp1_mbus_info *sink_fmt = rkisp1->isp.sink_fmt;
>  	u32 val, input_sel;
>  
>  	switch (sink_fmt->bus_width) {
> @@ -402,7 +267,7 @@ static int rkisp1_config_dvp(struct rkisp1_device *rkisp1)
>  
>  static int rkisp1_config_mipi(struct rkisp1_device *rkisp1)
>  {
> -	const struct rkisp1_isp_mbus_info *sink_fmt = rkisp1->isp.sink_fmt;
> +	const struct rkisp1_mbus_info *sink_fmt = rkisp1->isp.sink_fmt;
>  	unsigned int lanes = rkisp1->active_sensor->lanes;
>  	u32 mipi_ctrl;
>  
> @@ -593,11 +458,12 @@ static int rkisp1_isp_enum_mbus_code(struct v4l2_subdev *sd,
>  		return 0;
>  	}
>  
> -	if (code->index >= ARRAY_SIZE(rkisp1_isp_formats))
> +	if (code->index >= rkisp1_mbus_info_length())
>  		return -EINVAL;
>  
> -	for (i = 0; i < ARRAY_SIZE(rkisp1_isp_formats); i++) {
> -		const struct rkisp1_isp_mbus_info *fmt = &rkisp1_isp_formats[i];
> +	for (i = 0; i < rkisp1_mbus_info_length(); i++) {
> +		const struct rkisp1_mbus_info *fmt =
> +			rkisp1_mbus_info_get_by_index(i);

You could write this as

	for (i = 0; ; i++) {
		const struct rkisp1_mbus_info *fmt =
			rkisp1_mbus_info_get_by_index(i);

		if (!fmt)
			return -EINVAL;

and drop the rkisp1_mbus_info_length() function. Up to you. Either way,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  
>  		if (fmt->direction & dir)
>  			pos++;
> @@ -619,7 +485,7 @@ static int rkisp1_isp_enum_frame_size(struct v4l2_subdev *sd,
>  				      struct v4l2_subdev_state *sd_state,
>  				      struct v4l2_subdev_frame_size_enum *fse)
>  {
> -	const struct rkisp1_isp_mbus_info *mbus_info;
> +	const struct rkisp1_mbus_info *mbus_info;
>  
>  	if (fse->pad == RKISP1_ISP_PAD_SINK_PARAMS ||
>  	    fse->pad == RKISP1_ISP_PAD_SOURCE_STATS)
> @@ -628,7 +494,7 @@ static int rkisp1_isp_enum_frame_size(struct v4l2_subdev *sd,
>  	if (fse->index > 0)
>  		return -EINVAL;
>  
> -	mbus_info = rkisp1_isp_mbus_info_get(fse->code);
> +	mbus_info = rkisp1_mbus_info_get_by_code(fse->code);
>  	if (!mbus_info)
>  		return -EINVAL;
>  
> @@ -695,7 +561,7 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
>  				   struct v4l2_mbus_framefmt *format,
>  				   unsigned int which)
>  {
> -	const struct rkisp1_isp_mbus_info *mbus_info;
> +	const struct rkisp1_mbus_info *mbus_info;
>  	struct v4l2_mbus_framefmt *src_fmt;
>  	const struct v4l2_rect *src_crop;
>  
> @@ -705,10 +571,10 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
>  					   RKISP1_ISP_PAD_SOURCE_VIDEO, which);
>  
>  	src_fmt->code = format->code;
> -	mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code);
> +	mbus_info = rkisp1_mbus_info_get_by_code(src_fmt->code);
>  	if (!mbus_info || !(mbus_info->direction & RKISP1_ISP_SD_SRC)) {
>  		src_fmt->code = RKISP1_DEF_SRC_PAD_FMT;
> -		mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code);
> +		mbus_info = rkisp1_mbus_info_get_by_code(src_fmt->code);
>  	}
>  	if (which == V4L2_SUBDEV_FORMAT_ACTIVE)
>  		isp->src_fmt = mbus_info;
> @@ -793,7 +659,7 @@ static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp,
>  				    struct v4l2_mbus_framefmt *format,
>  				    unsigned int which)
>  {
> -	const struct rkisp1_isp_mbus_info *mbus_info;
> +	const struct rkisp1_mbus_info *mbus_info;
>  	struct v4l2_mbus_framefmt *sink_fmt;
>  	struct v4l2_rect *sink_crop;
>  
> @@ -801,10 +667,10 @@ static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp,
>  					  RKISP1_ISP_PAD_SINK_VIDEO,
>  					  which);
>  	sink_fmt->code = format->code;
> -	mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +	mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  	if (!mbus_info || !(mbus_info->direction & RKISP1_ISP_SD_SINK)) {
>  		sink_fmt->code = RKISP1_DEF_SINK_PAD_FMT;
> -		mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +		mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  	}
>  	if (which == V4L2_SUBDEV_FORMAT_ACTIVE)
>  		isp->sink_fmt = mbus_info;
> @@ -1080,8 +946,8 @@ int rkisp1_isp_register(struct rkisp1_device *rkisp1)
>  	pads[RKISP1_ISP_PAD_SOURCE_VIDEO].flags = MEDIA_PAD_FL_SOURCE;
>  	pads[RKISP1_ISP_PAD_SOURCE_STATS].flags = MEDIA_PAD_FL_SOURCE;
>  
> -	isp->sink_fmt = rkisp1_isp_mbus_info_get(RKISP1_DEF_SINK_PAD_FMT);
> -	isp->src_fmt = rkisp1_isp_mbus_info_get(RKISP1_DEF_SRC_PAD_FMT);
> +	isp->sink_fmt = rkisp1_mbus_info_get_by_code(RKISP1_DEF_SINK_PAD_FMT);
> +	isp->src_fmt = rkisp1_mbus_info_get_by_code(RKISP1_DEF_SRC_PAD_FMT);
>  
>  	mutex_init(&isp->ops_lock);
>  	ret = media_entity_pads_init(&sd->entity, RKISP1_ISP_PAD_MAX, pads);
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> index 1c07985c810d..f4caa8f684aa 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> @@ -433,14 +433,14 @@ static void rkisp1_rsz_set_src_fmt(struct rkisp1_resizer *rsz,
>  				   struct v4l2_mbus_framefmt *format,
>  				   unsigned int which)
>  {
> -	const struct rkisp1_isp_mbus_info *sink_mbus_info;
> +	const struct rkisp1_mbus_info *sink_mbus_info;
>  	struct v4l2_mbus_framefmt *src_fmt, *sink_fmt;
>  
>  	sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, sd_state, RKISP1_RSZ_PAD_SINK,
>  					  which);
>  	src_fmt = rkisp1_rsz_get_pad_fmt(rsz, sd_state, RKISP1_RSZ_PAD_SRC,
>  					 which);
> -	sink_mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +	sink_mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  
>  	/* for YUV formats, userspace can change the mbus code on the src pad if it is supported */
>  	if (sink_mbus_info->pixel_enc == V4L2_PIXEL_ENC_YUV &&
> @@ -462,7 +462,7 @@ static void rkisp1_rsz_set_sink_crop(struct rkisp1_resizer *rsz,
>  				     struct v4l2_rect *r,
>  				     unsigned int which)
>  {
> -	const struct rkisp1_isp_mbus_info *mbus_info;
> +	const struct rkisp1_mbus_info *mbus_info;
>  	struct v4l2_mbus_framefmt *sink_fmt;
>  	struct v4l2_rect *sink_crop;
>  
> @@ -473,7 +473,7 @@ static void rkisp1_rsz_set_sink_crop(struct rkisp1_resizer *rsz,
>  					    which);
>  
>  	/* Not crop for MP bayer raw data */
> -	mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +	mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  
>  	if (rsz->id == RKISP1_MAINPATH &&
>  	    mbus_info->pixel_enc == V4L2_PIXEL_ENC_BAYER) {
> @@ -500,7 +500,7 @@ static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz,
>  				    struct v4l2_mbus_framefmt *format,
>  				    unsigned int which)
>  {
> -	const struct rkisp1_isp_mbus_info *mbus_info;
> +	const struct rkisp1_mbus_info *mbus_info;
>  	struct v4l2_mbus_framefmt *sink_fmt, *src_fmt;
>  	struct v4l2_rect *sink_crop;
>  
> @@ -516,10 +516,10 @@ static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz,
>  	else
>  		sink_fmt->code = format->code;
>  
> -	mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +	mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  	if (!mbus_info || !(mbus_info->direction & RKISP1_ISP_SD_SRC)) {
>  		sink_fmt->code = RKISP1_DEF_FMT;
> -		mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +		mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  	}
>  	if (which == V4L2_SUBDEV_FORMAT_ACTIVE)
>  		rsz->pixel_enc = mbus_info->pixel_enc;
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
> index 7d82356b5345..2795eef91bdd 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
> @@ -305,7 +305,7 @@ static void rkisp1_stats_get_bls_meas(struct rkisp1_stats *stats,
>  				      struct rkisp1_stat_buffer *pbuf)
>  {
>  	struct rkisp1_device *rkisp1 = stats->rkisp1;
> -	const struct rkisp1_isp_mbus_info *in_fmt = rkisp1->isp.sink_fmt;
> +	const struct rkisp1_mbus_info *in_fmt = rkisp1->isp.sink_fmt;
>  	struct rkisp1_cif_isp_bls_meas_val *bls_val;
>  
>  	bls_val = &pbuf->params.ae.bls_val;

-- 
Regards,

Laurent Pinchart

WARNING: multiple messages have this Message-ID (diff)
From: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
To: Paul Elder <paul.elder@ideasonboard.com>
Cc: linux-media@vger.kernel.org, dafna@fastmail.com, heiko@sntech.de,
	jeanmichel.hautbois@ideasonboard.com, jacopo@jmondi.org,
	djrscally@gmail.com, helen.koike@collabora.com,
	linux-rockchip@lists.infradead.org
Subject: Re: [PATCH 09/55] media: rkisp1: Make rkisp1_isp_mbus_info common
Date: Thu, 16 Jun 2022 03:50:41 +0300	[thread overview]
Message-ID: <Yqp+YR6Tj+CtOMcz@pendragon.ideasonboard.com> (raw)
In-Reply-To: <20220614191127.3420492-10-paul.elder@ideasonboard.com>

Hi Paul,

Thank you for the patch.

On Wed, Jun 15, 2022 at 04:10:41AM +0900, Paul Elder wrote:
> The upcoming CSI receiver split from the ISP to a separate source file
> will need to be able to access the list of formats supported by the
> driver. Move it out of the ISP's header and into the common header, and
> add helper functions for accessing it so that the format list doesn't
> need to be stored in the header.
> 
> Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
> ---
>  .../platform/rockchip/rkisp1/rkisp1-common.c  | 148 +++++++++++++++
>  .../platform/rockchip/rkisp1/rkisp1-common.h  |  28 ++-
>  .../platform/rockchip/rkisp1/rkisp1-isp.c     | 168 ++----------------
>  .../platform/rockchip/rkisp1/rkisp1-resizer.c |  14 +-
>  .../platform/rockchip/rkisp1/rkisp1-stats.c   |   2 +-
>  5 files changed, 193 insertions(+), 167 deletions(-)
> 
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.c
> index cf889666e166..bb0ea20118e1 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.c
> @@ -5,10 +5,158 @@
>   * Copyright (C) 2019 Collabora, Ltd.
>   */
>  
> +#include <media/mipi-csi2.h>
>  #include <media/v4l2-rect.h>
>  
>  #include "rkisp1-common.h"
>  
> +static const struct rkisp1_mbus_info rkisp1_formats[] = {
> +	{
> +		.mbus_code	= MEDIA_BUS_FMT_YUYV8_2X8,
> +		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> +		.direction	= RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SRGGB10_1X10,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> +		.bayer_pat	= RKISP1_RAW_RGGB,
> +		.bus_width	= 10,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SBGGR10_1X10,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> +		.bayer_pat	= RKISP1_RAW_BGGR,
> +		.bus_width	= 10,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGBRG10_1X10,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> +		.bayer_pat	= RKISP1_RAW_GBRG,
> +		.bus_width	= 10,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGRBG10_1X10,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> +		.bayer_pat	= RKISP1_RAW_GRBG,
> +		.bus_width	= 10,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SRGGB12_1X12,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> +		.bayer_pat	= RKISP1_RAW_RGGB,
> +		.bus_width	= 12,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SBGGR12_1X12,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> +		.bayer_pat	= RKISP1_RAW_BGGR,
> +		.bus_width	= 12,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGBRG12_1X12,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> +		.bayer_pat	= RKISP1_RAW_GBRG,
> +		.bus_width	= 12,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGRBG12_1X12,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> +		.bayer_pat	= RKISP1_RAW_GRBG,
> +		.bus_width	= 12,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SRGGB8_1X8,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> +		.bayer_pat	= RKISP1_RAW_RGGB,
> +		.bus_width	= 8,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SBGGR8_1X8,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> +		.bayer_pat	= RKISP1_RAW_BGGR,
> +		.bus_width	= 8,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGBRG8_1X8,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> +		.bayer_pat	= RKISP1_RAW_GBRG,
> +		.bus_width	= 8,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_SGRBG8_1X8,
> +		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> +		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> +		.bayer_pat	= RKISP1_RAW_GRBG,
> +		.bus_width	= 8,
> +		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_YUYV8_1X16,
> +		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> +		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> +		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_YCBYCR,
> +		.bus_width	= 16,
> +		.direction	= RKISP1_ISP_SD_SINK,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_YVYU8_1X16,
> +		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> +		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> +		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_YCRYCB,
> +		.bus_width	= 16,
> +		.direction	= RKISP1_ISP_SD_SINK,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_UYVY8_1X16,
> +		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> +		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> +		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_CBYCRY,
> +		.bus_width	= 16,
> +		.direction	= RKISP1_ISP_SD_SINK,
> +	}, {
> +		.mbus_code	= MEDIA_BUS_FMT_VYUY8_1X16,
> +		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> +		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> +		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_CRYCBY,
> +		.bus_width	= 16,
> +		.direction	= RKISP1_ISP_SD_SINK,
> +	},
> +};
> +
> +unsigned int rkisp1_mbus_info_length(void)
> +{
> +	return ARRAY_SIZE(rkisp1_formats);
> +}
> +
> +const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_index(unsigned int index)
> +{
> +	if (index >= rkisp1_mbus_info_length())

	if (index >= ARRAY_SIZE(rkisp1_formats))

to match the code below (and see also my comment further down)

> +		return NULL;
> +
> +	return &rkisp1_formats[index];
> +}
> +
> +const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_code(u32 mbus_code)
> +{
> +	unsigned int i;
> +
> +	for (i = 0; i < ARRAY_SIZE(rkisp1_formats); i++) {
> +		const struct rkisp1_mbus_info *fmt = &rkisp1_formats[i];
> +
> +		if (fmt->mbus_code == mbus_code)
> +			return fmt;
> +	}
> +
> +	return NULL;
> +}
> +
>  static const struct v4l2_rect rkisp1_sd_min_crop = {
>  	.width = RKISP1_ISP_MIN_WIDTH,
>  	.height = RKISP1_ISP_MIN_HEIGHT,
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> index 50d31a254b03..c7d5c57607bd 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-common.h
> @@ -26,7 +26,7 @@
>  struct dentry;
>  
>  /*
> - * flags on the 'direction' field in struct 'rkisp1_isp_mbus_info' that indicate
> + * flags on the 'direction' field in struct rkisp1_mbus_info' that indicate
>   * on which pad the media bus format is supported
>   */
>  #define RKISP1_ISP_SD_SRC			BIT(0)
> @@ -150,8 +150,8 @@ struct rkisp1_isp {
>  	struct v4l2_subdev sd;
>  	struct media_pad pads[RKISP1_ISP_PAD_MAX];
>  	struct v4l2_subdev_pad_config pad_cfg[RKISP1_ISP_PAD_MAX];
> -	const struct rkisp1_isp_mbus_info *sink_fmt;
> -	const struct rkisp1_isp_mbus_info *src_fmt;
> +	const struct rkisp1_mbus_info *sink_fmt;
> +	const struct rkisp1_mbus_info *src_fmt;
>  	struct mutex ops_lock; /* serialize the subdevice ops */
>  	bool is_dphy_errctrl_disabled;
>  	__u32 frame_sequence;
> @@ -438,8 +438,8 @@ struct rkisp1_device {
>  };
>  
>  /*
> - * struct rkisp1_isp_mbus_info - ISP media bus info, Translates media bus code to hardware
> - *				 format values
> + * struct rkisp1_mbus_info - ISP media bus info, Translates media bus code to hardware
> + *			     format values
>   *
>   * @mbus_code: media bus code
>   * @pixel_enc: pixel encoding
> @@ -449,7 +449,7 @@ struct rkisp1_device {
>   * @bayer_pat: bayer pattern
>   * @direction: a bitmask of the flags indicating on which pad the format is supported on
>   */
> -struct rkisp1_isp_mbus_info {
> +struct rkisp1_mbus_info {
>  	u32 mbus_code;
>  	enum v4l2_pixel_encoding pixel_enc;
>  	u32 mipi_dt;
> @@ -481,6 +481,18 @@ static inline u32 rkisp1_read(struct rkisp1_device *rkisp1, unsigned int addr)
>  int rkisp1_cap_enum_mbus_codes(struct rkisp1_capture *cap,
>  			       struct v4l2_subdev_mbus_code_enum *code);
>  
> +/*
> + * rkisp1_mbus_info_length - Return the number of supported mbus codes
> + */
> +unsigned int rkisp1_mbus_info_length(void);
> +
> +/*
> + * rkisp1_mbus_info_get_by_index - Retrieve the ith supported mbus info
> + *
> + * @index: index of the mbus info to fetch
> + */
> +const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_index(unsigned int index);
> +
>  /*
>   * rkisp1_sd_adjust_crop_rect - adjust a rectangle to fit into another rectangle.
>   *
> @@ -500,11 +512,11 @@ void rkisp1_sd_adjust_crop(struct v4l2_rect *crop,
>  			   const struct v4l2_mbus_framefmt *bounds);
>  
>  /*
> - * rkisp1_isp_mbus_info - get the isp info of the media bus code
> + * rkisp1_mbus_info_get_by_code - get the isp info of the media bus code
>   *
>   * @mbus_code: the media bus code
>   */
> -const struct rkisp1_isp_mbus_info *rkisp1_isp_mbus_info_get(u32 mbus_code);
> +const struct rkisp1_mbus_info *rkisp1_mbus_info_get_by_code(u32 mbus_code);
>  
>  /* rkisp1_params_configure - configure the params when stream starts.
>   *			     This function is called by the isp entity upon stream starts.
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> index 328e8fec14e9..89577119b571 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-isp.c
> @@ -15,7 +15,6 @@
>  #include <linux/videodev2.h>
>  #include <linux/vmalloc.h>
>  
> -#include <media/mipi-csi2.h>
>  #include <media/v4l2-event.h>
>  
>  #include "rkisp1-common.h"
> @@ -56,144 +55,10 @@
>   * +---------------------------------------------------------+
>   */
>  
> -static const struct rkisp1_isp_mbus_info rkisp1_isp_formats[] = {
> -	{
> -		.mbus_code	= MEDIA_BUS_FMT_YUYV8_2X8,
> -		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> -		.direction	= RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SRGGB10_1X10,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> -		.bayer_pat	= RKISP1_RAW_RGGB,
> -		.bus_width	= 10,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SBGGR10_1X10,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> -		.bayer_pat	= RKISP1_RAW_BGGR,
> -		.bus_width	= 10,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGBRG10_1X10,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> -		.bayer_pat	= RKISP1_RAW_GBRG,
> -		.bus_width	= 10,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGRBG10_1X10,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW10,
> -		.bayer_pat	= RKISP1_RAW_GRBG,
> -		.bus_width	= 10,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SRGGB12_1X12,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> -		.bayer_pat	= RKISP1_RAW_RGGB,
> -		.bus_width	= 12,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SBGGR12_1X12,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> -		.bayer_pat	= RKISP1_RAW_BGGR,
> -		.bus_width	= 12,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGBRG12_1X12,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> -		.bayer_pat	= RKISP1_RAW_GBRG,
> -		.bus_width	= 12,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGRBG12_1X12,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW12,
> -		.bayer_pat	= RKISP1_RAW_GRBG,
> -		.bus_width	= 12,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SRGGB8_1X8,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> -		.bayer_pat	= RKISP1_RAW_RGGB,
> -		.bus_width	= 8,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SBGGR8_1X8,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> -		.bayer_pat	= RKISP1_RAW_BGGR,
> -		.bus_width	= 8,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGBRG8_1X8,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> -		.bayer_pat	= RKISP1_RAW_GBRG,
> -		.bus_width	= 8,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_SGRBG8_1X8,
> -		.pixel_enc	= V4L2_PIXEL_ENC_BAYER,
> -		.mipi_dt	= MIPI_CSI2_DT_RAW8,
> -		.bayer_pat	= RKISP1_RAW_GRBG,
> -		.bus_width	= 8,
> -		.direction	= RKISP1_ISP_SD_SINK | RKISP1_ISP_SD_SRC,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_YUYV8_1X16,
> -		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> -		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> -		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_YCBYCR,
> -		.bus_width	= 16,
> -		.direction	= RKISP1_ISP_SD_SINK,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_YVYU8_1X16,
> -		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> -		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> -		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_YCRYCB,
> -		.bus_width	= 16,
> -		.direction	= RKISP1_ISP_SD_SINK,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_UYVY8_1X16,
> -		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> -		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> -		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_CBYCRY,
> -		.bus_width	= 16,
> -		.direction	= RKISP1_ISP_SD_SINK,
> -	}, {
> -		.mbus_code	= MEDIA_BUS_FMT_VYUY8_1X16,
> -		.pixel_enc	= V4L2_PIXEL_ENC_YUV,
> -		.mipi_dt	= MIPI_CSI2_DT_YUV422_8B,
> -		.yuv_seq	= RKISP1_CIF_ISP_ACQ_PROP_CRYCBY,
> -		.bus_width	= 16,
> -		.direction	= RKISP1_ISP_SD_SINK,
> -	},
> -};
> -
>  /* ----------------------------------------------------------------------------
>   * Helpers
>   */
>  
> -const struct rkisp1_isp_mbus_info *rkisp1_isp_mbus_info_get(u32 mbus_code)
> -{
> -	unsigned int i;
> -
> -	for (i = 0; i < ARRAY_SIZE(rkisp1_isp_formats); i++) {
> -		const struct rkisp1_isp_mbus_info *fmt = &rkisp1_isp_formats[i];
> -
> -		if (fmt->mbus_code == mbus_code)
> -			return fmt;
> -	}
> -
> -	return NULL;
> -}
> -
>  static struct v4l2_subdev *rkisp1_get_remote_sensor(struct v4l2_subdev *sd)
>  {
>  	struct media_pad *local, *remote;
> @@ -275,7 +140,7 @@ static void rkisp1_config_ism(struct rkisp1_device *rkisp1)
>  static int rkisp1_config_isp(struct rkisp1_device *rkisp1)
>  {
>  	u32 isp_ctrl = 0, irq_mask = 0, acq_mult = 0, signal = 0;
> -	const struct rkisp1_isp_mbus_info *src_fmt, *sink_fmt;
> +	const struct rkisp1_mbus_info *src_fmt, *sink_fmt;
>  	struct rkisp1_sensor_async *sensor;
>  	struct v4l2_mbus_framefmt *sink_frm;
>  	struct v4l2_rect *sink_crop;
> @@ -376,7 +241,7 @@ static int rkisp1_config_isp(struct rkisp1_device *rkisp1)
>  
>  static int rkisp1_config_dvp(struct rkisp1_device *rkisp1)
>  {
> -	const struct rkisp1_isp_mbus_info *sink_fmt = rkisp1->isp.sink_fmt;
> +	const struct rkisp1_mbus_info *sink_fmt = rkisp1->isp.sink_fmt;
>  	u32 val, input_sel;
>  
>  	switch (sink_fmt->bus_width) {
> @@ -402,7 +267,7 @@ static int rkisp1_config_dvp(struct rkisp1_device *rkisp1)
>  
>  static int rkisp1_config_mipi(struct rkisp1_device *rkisp1)
>  {
> -	const struct rkisp1_isp_mbus_info *sink_fmt = rkisp1->isp.sink_fmt;
> +	const struct rkisp1_mbus_info *sink_fmt = rkisp1->isp.sink_fmt;
>  	unsigned int lanes = rkisp1->active_sensor->lanes;
>  	u32 mipi_ctrl;
>  
> @@ -593,11 +458,12 @@ static int rkisp1_isp_enum_mbus_code(struct v4l2_subdev *sd,
>  		return 0;
>  	}
>  
> -	if (code->index >= ARRAY_SIZE(rkisp1_isp_formats))
> +	if (code->index >= rkisp1_mbus_info_length())
>  		return -EINVAL;
>  
> -	for (i = 0; i < ARRAY_SIZE(rkisp1_isp_formats); i++) {
> -		const struct rkisp1_isp_mbus_info *fmt = &rkisp1_isp_formats[i];
> +	for (i = 0; i < rkisp1_mbus_info_length(); i++) {
> +		const struct rkisp1_mbus_info *fmt =
> +			rkisp1_mbus_info_get_by_index(i);

You could write this as

	for (i = 0; ; i++) {
		const struct rkisp1_mbus_info *fmt =
			rkisp1_mbus_info_get_by_index(i);

		if (!fmt)
			return -EINVAL;

and drop the rkisp1_mbus_info_length() function. Up to you. Either way,

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

>  
>  		if (fmt->direction & dir)
>  			pos++;
> @@ -619,7 +485,7 @@ static int rkisp1_isp_enum_frame_size(struct v4l2_subdev *sd,
>  				      struct v4l2_subdev_state *sd_state,
>  				      struct v4l2_subdev_frame_size_enum *fse)
>  {
> -	const struct rkisp1_isp_mbus_info *mbus_info;
> +	const struct rkisp1_mbus_info *mbus_info;
>  
>  	if (fse->pad == RKISP1_ISP_PAD_SINK_PARAMS ||
>  	    fse->pad == RKISP1_ISP_PAD_SOURCE_STATS)
> @@ -628,7 +494,7 @@ static int rkisp1_isp_enum_frame_size(struct v4l2_subdev *sd,
>  	if (fse->index > 0)
>  		return -EINVAL;
>  
> -	mbus_info = rkisp1_isp_mbus_info_get(fse->code);
> +	mbus_info = rkisp1_mbus_info_get_by_code(fse->code);
>  	if (!mbus_info)
>  		return -EINVAL;
>  
> @@ -695,7 +561,7 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
>  				   struct v4l2_mbus_framefmt *format,
>  				   unsigned int which)
>  {
> -	const struct rkisp1_isp_mbus_info *mbus_info;
> +	const struct rkisp1_mbus_info *mbus_info;
>  	struct v4l2_mbus_framefmt *src_fmt;
>  	const struct v4l2_rect *src_crop;
>  
> @@ -705,10 +571,10 @@ static void rkisp1_isp_set_src_fmt(struct rkisp1_isp *isp,
>  					   RKISP1_ISP_PAD_SOURCE_VIDEO, which);
>  
>  	src_fmt->code = format->code;
> -	mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code);
> +	mbus_info = rkisp1_mbus_info_get_by_code(src_fmt->code);
>  	if (!mbus_info || !(mbus_info->direction & RKISP1_ISP_SD_SRC)) {
>  		src_fmt->code = RKISP1_DEF_SRC_PAD_FMT;
> -		mbus_info = rkisp1_isp_mbus_info_get(src_fmt->code);
> +		mbus_info = rkisp1_mbus_info_get_by_code(src_fmt->code);
>  	}
>  	if (which == V4L2_SUBDEV_FORMAT_ACTIVE)
>  		isp->src_fmt = mbus_info;
> @@ -793,7 +659,7 @@ static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp,
>  				    struct v4l2_mbus_framefmt *format,
>  				    unsigned int which)
>  {
> -	const struct rkisp1_isp_mbus_info *mbus_info;
> +	const struct rkisp1_mbus_info *mbus_info;
>  	struct v4l2_mbus_framefmt *sink_fmt;
>  	struct v4l2_rect *sink_crop;
>  
> @@ -801,10 +667,10 @@ static void rkisp1_isp_set_sink_fmt(struct rkisp1_isp *isp,
>  					  RKISP1_ISP_PAD_SINK_VIDEO,
>  					  which);
>  	sink_fmt->code = format->code;
> -	mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +	mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  	if (!mbus_info || !(mbus_info->direction & RKISP1_ISP_SD_SINK)) {
>  		sink_fmt->code = RKISP1_DEF_SINK_PAD_FMT;
> -		mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +		mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  	}
>  	if (which == V4L2_SUBDEV_FORMAT_ACTIVE)
>  		isp->sink_fmt = mbus_info;
> @@ -1080,8 +946,8 @@ int rkisp1_isp_register(struct rkisp1_device *rkisp1)
>  	pads[RKISP1_ISP_PAD_SOURCE_VIDEO].flags = MEDIA_PAD_FL_SOURCE;
>  	pads[RKISP1_ISP_PAD_SOURCE_STATS].flags = MEDIA_PAD_FL_SOURCE;
>  
> -	isp->sink_fmt = rkisp1_isp_mbus_info_get(RKISP1_DEF_SINK_PAD_FMT);
> -	isp->src_fmt = rkisp1_isp_mbus_info_get(RKISP1_DEF_SRC_PAD_FMT);
> +	isp->sink_fmt = rkisp1_mbus_info_get_by_code(RKISP1_DEF_SINK_PAD_FMT);
> +	isp->src_fmt = rkisp1_mbus_info_get_by_code(RKISP1_DEF_SRC_PAD_FMT);
>  
>  	mutex_init(&isp->ops_lock);
>  	ret = media_entity_pads_init(&sd->entity, RKISP1_ISP_PAD_MAX, pads);
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> index 1c07985c810d..f4caa8f684aa 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-resizer.c
> @@ -433,14 +433,14 @@ static void rkisp1_rsz_set_src_fmt(struct rkisp1_resizer *rsz,
>  				   struct v4l2_mbus_framefmt *format,
>  				   unsigned int which)
>  {
> -	const struct rkisp1_isp_mbus_info *sink_mbus_info;
> +	const struct rkisp1_mbus_info *sink_mbus_info;
>  	struct v4l2_mbus_framefmt *src_fmt, *sink_fmt;
>  
>  	sink_fmt = rkisp1_rsz_get_pad_fmt(rsz, sd_state, RKISP1_RSZ_PAD_SINK,
>  					  which);
>  	src_fmt = rkisp1_rsz_get_pad_fmt(rsz, sd_state, RKISP1_RSZ_PAD_SRC,
>  					 which);
> -	sink_mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +	sink_mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  
>  	/* for YUV formats, userspace can change the mbus code on the src pad if it is supported */
>  	if (sink_mbus_info->pixel_enc == V4L2_PIXEL_ENC_YUV &&
> @@ -462,7 +462,7 @@ static void rkisp1_rsz_set_sink_crop(struct rkisp1_resizer *rsz,
>  				     struct v4l2_rect *r,
>  				     unsigned int which)
>  {
> -	const struct rkisp1_isp_mbus_info *mbus_info;
> +	const struct rkisp1_mbus_info *mbus_info;
>  	struct v4l2_mbus_framefmt *sink_fmt;
>  	struct v4l2_rect *sink_crop;
>  
> @@ -473,7 +473,7 @@ static void rkisp1_rsz_set_sink_crop(struct rkisp1_resizer *rsz,
>  					    which);
>  
>  	/* Not crop for MP bayer raw data */
> -	mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +	mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  
>  	if (rsz->id == RKISP1_MAINPATH &&
>  	    mbus_info->pixel_enc == V4L2_PIXEL_ENC_BAYER) {
> @@ -500,7 +500,7 @@ static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz,
>  				    struct v4l2_mbus_framefmt *format,
>  				    unsigned int which)
>  {
> -	const struct rkisp1_isp_mbus_info *mbus_info;
> +	const struct rkisp1_mbus_info *mbus_info;
>  	struct v4l2_mbus_framefmt *sink_fmt, *src_fmt;
>  	struct v4l2_rect *sink_crop;
>  
> @@ -516,10 +516,10 @@ static void rkisp1_rsz_set_sink_fmt(struct rkisp1_resizer *rsz,
>  	else
>  		sink_fmt->code = format->code;
>  
> -	mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +	mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  	if (!mbus_info || !(mbus_info->direction & RKISP1_ISP_SD_SRC)) {
>  		sink_fmt->code = RKISP1_DEF_FMT;
> -		mbus_info = rkisp1_isp_mbus_info_get(sink_fmt->code);
> +		mbus_info = rkisp1_mbus_info_get_by_code(sink_fmt->code);
>  	}
>  	if (which == V4L2_SUBDEV_FORMAT_ACTIVE)
>  		rsz->pixel_enc = mbus_info->pixel_enc;
> diff --git a/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c b/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
> index 7d82356b5345..2795eef91bdd 100644
> --- a/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
> +++ b/drivers/media/platform/rockchip/rkisp1/rkisp1-stats.c
> @@ -305,7 +305,7 @@ static void rkisp1_stats_get_bls_meas(struct rkisp1_stats *stats,
>  				      struct rkisp1_stat_buffer *pbuf)
>  {
>  	struct rkisp1_device *rkisp1 = stats->rkisp1;
> -	const struct rkisp1_isp_mbus_info *in_fmt = rkisp1->isp.sink_fmt;
> +	const struct rkisp1_mbus_info *in_fmt = rkisp1->isp.sink_fmt;
>  	struct rkisp1_cif_isp_bls_meas_val *bls_val;
>  
>  	bls_val = &pbuf->params.ae.bls_val;

-- 
Regards,

Laurent Pinchart

_______________________________________________
Linux-rockchip mailing list
Linux-rockchip@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-rockchip

  reply	other threads:[~2022-06-16  0:50 UTC|newest]

Thread overview: 298+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-06-14 19:10 [PATCH 00/55] media: rkisp1: Cleanups and add support for i.MX8MP Paul Elder
2022-06-14 19:10 ` Paul Elder
2022-06-14 19:10 ` [PATCH 01/55] media: rkisp1: debug: Add dump file in debugfs for MI buffer registers Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-15 22:41   ` Laurent Pinchart
2022-06-15 22:41     ` Laurent Pinchart
2022-06-25 17:59     ` Laurent Pinchart
2022-06-25 17:59       ` Laurent Pinchart
2022-07-04  3:46       ` paul.elder
2022-07-04  3:46         ` paul.elder
2022-06-14 19:10 ` [PATCH 02/55] media: rkisp1: Enable compilation on ARCH_MXC Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 14:17   ` Dafna Hirschfeld
2022-06-24 14:17     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 03/55] media: rkisp1: debug: Add debugfs files to monitor MI and ISP interrupts Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-16  0:44   ` Laurent Pinchart
2022-06-16  0:44     ` Laurent Pinchart
2022-07-04  3:47     ` paul.elder
2022-07-04  3:47       ` paul.elder
2022-06-14 19:10 ` [PATCH 04/55] media: rkisp1: Disable runtime PM in probe error path Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 14:21   ` Dafna Hirschfeld
2022-06-24 14:21     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 05/55] media: rkisp1: Read the ID register at probe time instead of streamon Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 14:26   ` Dafna Hirschfeld
2022-06-24 14:26     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 06/55] media: rkisp1: Rename rkisp1_match_data to rkisp1_info Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 14:29   ` Dafna Hirschfeld
2022-06-24 14:29     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 07/55] media: rkisp1: Save info pointer in rkisp1_device Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 14:34   ` Dafna Hirschfeld
2022-06-24 14:34     ` Dafna Hirschfeld
2022-06-24 14:47     ` Laurent Pinchart
2022-06-24 14:47       ` Laurent Pinchart
2022-06-30 21:28       ` Dafna Hirschfeld
2022-06-30 21:28         ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 08/55] media: rkisp1: Access ISP version from info pointer Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 14:35   ` Dafna Hirschfeld
2022-06-24 14:35     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 09/55] media: rkisp1: Make rkisp1_isp_mbus_info common Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-16  0:50   ` Laurent Pinchart [this message]
2022-06-16  0:50     ` Laurent Pinchart
2022-06-24 14:54   ` Dafna Hirschfeld
2022-06-24 14:54     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 10/55] media: rkisp1: cap: Print debug message on failed link validation Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-16  7:32   ` (EXT) " Alexander Stein
2022-06-16  7:32     ` Alexander Stein
2022-06-16  7:41     ` Laurent Pinchart
2022-06-16  7:41       ` Laurent Pinchart
2022-06-16  7:59       ` (EXT) " Alexander Stein
2022-06-16  7:59         ` Alexander Stein
2022-06-24 15:00   ` Dafna Hirschfeld
2022-06-24 15:00     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 11/55] media: rkisp1: Move sensor .s_stream() call to ISP Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 15:14   ` Dafna Hirschfeld
2022-06-24 15:14     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 12/55] media: rkisp1: Reject sensors without pixel rate control at bound time Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 18:20   ` Dafna Hirschfeld
2022-06-24 18:20     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 13/55] media: rkisp1: Create link from sensor to ISP at notifier " Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 18:40   ` Dafna Hirschfeld
2022-06-24 18:40     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 14/55] media: rkisp1: Create internal links at probe time Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 18:43   ` Dafna Hirschfeld
2022-06-24 18:43     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 15/55] media: rkisp1: Rename rkisp1_subdev_notifier() to rkisp1_subdev_notifier_register() Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-24 18:44   ` Dafna Hirschfeld
2022-06-24 18:44     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 16/55] media: v4l2-async: Add notifier operation to destroy asd instances Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-15 22:36   ` Laurent Pinchart
2022-06-15 22:36     ` Laurent Pinchart
2022-06-20 14:27   ` Hans Verkuil
2022-06-20 14:27     ` Hans Verkuil
2022-06-14 19:10 ` [PATCH 17/55] media: rkisp1: Fix sensor source pad retrieval at bound time Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-07-01  4:36   ` Dafna Hirschfeld
2022-07-01  4:36     ` Dafna Hirschfeld
2022-07-01 11:29     ` Laurent Pinchart
2022-07-01 11:29       ` Laurent Pinchart
2022-06-14 19:10 ` [PATCH 18/55] media: rkisp1: Split CSI handling to separate file Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-25  3:48   ` Dafna Hirschfeld
2022-06-25  3:48     ` Dafna Hirschfeld
2022-06-25 10:18     ` Laurent Pinchart
2022-06-25 10:18       ` Laurent Pinchart
2022-06-14 19:10 ` [PATCH 19/55] media: rkisp1: isp: Start CSI-2 receiver before ISP Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-25  3:51   ` Dafna Hirschfeld
2022-06-25  3:51     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 20/55] media: rkisp1: csi: Handle CSI-2 RX configuration fully in rkisp1-csi.c Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-25  4:00   ` Dafna Hirschfeld
2022-06-25  4:00     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 21/55] media: rkisp1: csi: Rename CSI functions with a common rkisp1_csi prefix Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-25  4:03   ` Dafna Hirschfeld
2022-06-25  4:03     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 22/55] media: rkisp1: csi: Move start delay to rkisp1_csi_start() Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-25  4:05   ` Dafna Hirschfeld
2022-06-25  4:05     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 23/55] media: rkisp1: csi: Pass sensor pointer to rkisp1_csi_config() Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-25  4:28   ` Dafna Hirschfeld
2022-06-25  4:28     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 24/55] media: rkisp1: csi: Constify argument to rkisp1_csi_start() Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-25  4:29   ` Dafna Hirschfeld
2022-06-25  4:29     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 25/55] media: rkisp1: isp: Don't initialize ret to 0 in rkisp1_isp_s_stream() Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-25  4:46   ` Dafna Hirschfeld
2022-06-25  4:46     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 26/55] media: rkisp1: isp: Pass mbus type and flags to rkisp1_config_cif() Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-25  4:32   ` Dafna Hirschfeld
2022-06-25  4:32     ` Dafna Hirschfeld
2022-06-14 19:10 ` [PATCH 27/55] media: rkisp1: isp: Rename rkisp1_device.active_sensor to source Paul Elder
2022-06-14 19:10   ` Paul Elder
2022-06-30 21:57   ` Dafna Hirschfeld
2022-06-30 21:57     ` Dafna Hirschfeld
2022-07-01  4:42   ` Dafna Hirschfeld
2022-07-01  4:42     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 28/55] media: rkisp1: isp: Add container_of wrapper to cast subdev to rkisp1_isp Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-25  4:48   ` Dafna Hirschfeld
2022-06-25  4:48     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 29/55] media: rkisp1: isp: Add rkisp1_device backpointer " Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-25  4:50   ` Dafna Hirschfeld
2022-06-25  4:50     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 30/55] media: rkisp1: isp: Pass rkisp1_isp pointer to internal ISP functions Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-25  4:52   ` Dafna Hirschfeld
2022-06-25  4:52     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 31/55] media: rkisp1: isp: Move input configuration to rkisp1_config_isp() Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-25  5:00   ` Dafna Hirschfeld
2022-06-25  5:00     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 32/55] media: rkisp1: isp: Merge ISP_ACQ_PROP configuration in single variable Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-25  5:03   ` Dafna Hirschfeld
2022-06-25  5:03     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 33/55] media: rkisp1: isp: Initialize some variables at declaration time Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-25  5:04   ` Dafna Hirschfeld
2022-06-25  5:04     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 34/55] media: rkisp1: isp: Fix whitespace issues Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-25  5:05   ` Dafna Hirschfeld
2022-06-25  5:05     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 35/55] media: rkisp1: isp: Constify various local variables Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-25  5:07   ` Dafna Hirschfeld
2022-06-25  5:07     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 36/55] media: rkisp1: isp: Rename rkisp1_get_remote_source() Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-25  5:09   ` Dafna Hirschfeld
2022-06-25  5:09     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 37/55] media: mc-entity: Add a new helper function to get a remote pad Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-15 22:38   ` Laurent Pinchart
2022-06-15 22:38     ` Laurent Pinchart
2022-06-17 11:38   ` Hans Verkuil
2022-06-17 11:38     ` Hans Verkuil
2022-06-17 11:48   ` Hans Verkuil
2022-06-17 11:48     ` Hans Verkuil
2022-06-25 17:00     ` Laurent Pinchart
2022-06-25 17:00       ` Laurent Pinchart
2022-06-25 17:28       ` Laurent Pinchart
2022-06-25 17:28         ` Laurent Pinchart
2022-07-07  6:52       ` Hans Verkuil
2022-07-07  6:52         ` Hans Verkuil
2022-07-07 11:50         ` Laurent Pinchart
2022-07-07 11:50           ` Laurent Pinchart
2022-06-17 21:34   ` Daniel Scally
2022-06-17 21:34     ` Daniel Scally
2022-06-17 22:33     ` Daniel Scally
2022-06-17 22:33       ` Daniel Scally
2022-06-17 22:40       ` Laurent Pinchart
2022-06-17 22:40         ` Laurent Pinchart
2022-06-18  9:35         ` Daniel Scally
2022-06-18  9:35           ` Daniel Scally
2022-06-25 17:34           ` Laurent Pinchart
2022-06-25 17:34             ` Laurent Pinchart
2022-06-14 19:11 ` [PATCH 38/55] media: mc-entity: Add a new helper function to get a remote pad for a pad Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-15 22:38   ` Laurent Pinchart
2022-06-15 22:38     ` Laurent Pinchart
2022-06-17 11:41   ` Hans Verkuil
2022-06-17 11:41     ` Hans Verkuil
2022-06-17 11:48     ` Laurent Pinchart
2022-06-17 11:48       ` Laurent Pinchart
2022-06-14 19:11 ` [PATCH 39/55] media: rkisp1: isp: Disallow multiple active sources Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-14 19:11 ` [PATCH 40/55] media: rkisp1: csi: Implement a V4L2 subdev for the CSI receiver Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-25  7:00   ` Dafna Hirschfeld
2022-06-25  7:00     ` Dafna Hirschfeld
2022-06-25 11:03     ` Laurent Pinchart
2022-06-25 11:03       ` Laurent Pinchart
2022-07-01  4:48       ` Dafna Hirschfeld
2022-07-01  4:48         ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 41/55] media: rkisp1: csi: Plumb the CSI RX subdev Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-15 23:10   ` Laurent Pinchart
2022-06-15 23:10     ` Laurent Pinchart
2022-06-25  7:45   ` Dafna Hirschfeld
2022-06-25  7:45     ` Dafna Hirschfeld
2022-06-25 16:07     ` Laurent Pinchart
2022-06-25 16:07       ` Laurent Pinchart
2022-06-14 19:11 ` [PATCH 42/55] media: rkisp1: Use fwnode_graph_for_each_endpoint Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-17 22:56   ` Laurent Pinchart
2022-06-17 22:56     ` Laurent Pinchart
2022-06-14 19:11 ` [PATCH 43/55] dt-bindings: media: rkisp1: Add port for parallel interface Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-17 23:13   ` Laurent Pinchart
2022-06-17 23:13     ` Laurent Pinchart
2022-07-01  5:22   ` Dafna Hirschfeld
2022-07-01  5:22     ` Dafna Hirschfeld
2022-07-01  9:19     ` Laurent Pinchart
2022-07-01  9:19       ` Laurent Pinchart
2022-06-14 19:11 ` [PATCH 44/55] media: rkisp1: Support the ISP parallel input Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-14 19:11 ` [PATCH 45/55] media: rkisp1: Add infrastructure to support ISP features Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-14 19:11 ` [PATCH 46/55] media: rkisp1: Make the internal CSI-2 receiver optional Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-14 19:11 ` [PATCH 47/55] dt-bindings: media: rkisp1: Add i.MX8MP ISP to compatible Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-17 23:14   ` Laurent Pinchart
2022-06-17 23:14     ` Laurent Pinchart
2022-06-14 19:11 ` [PATCH 48/55] media: rkisp1: Add match data for i.MX8MP ISP Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-17 23:26   ` Laurent Pinchart
2022-06-17 23:26     ` Laurent Pinchart
2022-06-26  4:05     ` Dafna Hirschfeld
2022-06-26  4:05       ` Dafna Hirschfeld
2022-06-26 11:07       ` Laurent Pinchart
2022-06-26 11:07         ` Laurent Pinchart
2022-07-04 10:36         ` paul.elder
2022-07-04 10:36           ` paul.elder
2022-06-14 19:11 ` [PATCH 49/55] media: rkisp1: Configure gasket on i.MX8MP Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-14 19:11 ` [PATCH 50/55] media: rkisp1: Add and set registers for crop for i.MX8MP Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-26 11:59   ` Laurent Pinchart
2022-06-26 11:59     ` Laurent Pinchart
2022-07-04 10:37     ` paul.elder
2022-07-04 10:37       ` paul.elder
2022-07-01  5:37   ` Dafna Hirschfeld
2022-07-01  5:37     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 51/55] media: rkisp1: Add and set registers for output size config on i.MX8MP Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-26 11:46   ` Laurent Pinchart
2022-06-26 11:46     ` Laurent Pinchart
2022-07-01  5:40   ` Dafna Hirschfeld
2022-07-01  5:40     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 52/55] media: rkisp1: Add i.MX8MP-specific registers for MI and resizer Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-07-01  5:45   ` Dafna Hirschfeld
2022-07-01  5:45     ` Dafna Hirschfeld
2022-06-14 19:11 ` [PATCH 53/55] media: rkisp1: Shift DMA buffer addresses on i.MX8MP Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-26 11:38   ` Laurent Pinchart
2022-06-26 11:38     ` Laurent Pinchart
2022-07-01  5:53     ` Dafna Hirschfeld
2022-07-01  5:53       ` Dafna Hirschfeld
2022-07-01  8:38       ` Laurent Pinchart
2022-07-01  8:38         ` Laurent Pinchart
2022-06-14 19:11 ` [PATCH 54/55] media: rkisp1: Add register definitions for the test pattern generator Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-14 19:11 ` [PATCH 55/55] media: rkisp1: Fix RSZ_CTRL bits for i.MX8MP Paul Elder
2022-06-14 19:11   ` Paul Elder
2022-06-16  8:05   ` (EXT) " Alexander Stein
2022-06-16  8:05     ` Alexander Stein
2022-06-17 23:03     ` Laurent Pinchart
2022-06-17 23:03       ` Laurent Pinchart
2022-06-26 11:40       ` Laurent Pinchart
2022-06-26 11:40         ` Laurent Pinchart
2022-07-04 10:40       ` paul.elder
2022-07-04 10:40         ` paul.elder
2022-06-16  0:19 ` [PATCH 00/55] media: rkisp1: Cleanups and add support " Laurent Pinchart
2022-06-16  0:19   ` Laurent Pinchart

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=Yqp+YR6Tj+CtOMcz@pendragon.ideasonboard.com \
    --to=laurent.pinchart@ideasonboard.com \
    --cc=dafna@fastmail.com \
    --cc=djrscally@gmail.com \
    --cc=heiko@sntech.de \
    --cc=helen.koike@collabora.com \
    --cc=jacopo@jmondi.org \
    --cc=jeanmichel.hautbois@ideasonboard.com \
    --cc=linux-media@vger.kernel.org \
    --cc=linux-rockchip@lists.infradead.org \
    --cc=paul.elder@ideasonboard.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.