提交 794357b2 编写于 作者: N Naushir Patuck 提交者: Zheng Zengkai

media: i2c: imx477: Remove internal v4l2_mbus_framefmt from the state

raspberrypi inclusion
category: feature
bugzilla: 50432

--------------------------------

The only field in this struct that is used is the format code, so
replace the struct with this single field.

Save the format code in imx477_set_pad_format() when setting up a new
mode so that imx477_get_pad_format() performs the right lookup.
Otherwise, this caused a bug where the mode lookup occurred on the
12-bit table rather than the 10-bit table.
Signed-off-by: NNaushir Patuck <naush@raspberrypi.com>
Signed-off-by: NFang Yafen <yafen@iscas.ac.cn>
Signed-off-by: NZheng Zengkai <zhengzengkai@huawei.com>
上级 b40e6d71
...@@ -1073,7 +1073,7 @@ struct imx477 { ...@@ -1073,7 +1073,7 @@ struct imx477 {
struct v4l2_subdev sd; struct v4l2_subdev sd;
struct media_pad pad[NUM_PADS]; struct media_pad pad[NUM_PADS];
struct v4l2_mbus_framefmt fmt; unsigned int fmt_code;
struct clk *xclk; struct clk *xclk;
u32 xclk_freq; u32 xclk_freq;
...@@ -1235,21 +1235,9 @@ static u32 imx477_get_format_code(struct imx477 *imx477, u32 code) ...@@ -1235,21 +1235,9 @@ static u32 imx477_get_format_code(struct imx477 *imx477, u32 code)
static void imx477_set_default_format(struct imx477 *imx477) static void imx477_set_default_format(struct imx477 *imx477)
{ {
struct v4l2_mbus_framefmt *fmt = &imx477->fmt;
/* Set default mode to max resolution */ /* Set default mode to max resolution */
imx477->mode = &supported_modes_12bit[0]; imx477->mode = &supported_modes_12bit[0];
imx477->fmt_code = MEDIA_BUS_FMT_SRGGB12_1X12;
fmt->code = MEDIA_BUS_FMT_SRGGB12_1X12;
fmt->colorspace = V4L2_COLORSPACE_SRGB;
fmt->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(fmt->colorspace);
fmt->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(true,
fmt->colorspace,
fmt->ycbcr_enc);
fmt->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(fmt->colorspace);
fmt->width = imx477->mode->width;
fmt->height = imx477->mode->height;
fmt->field = V4L2_FIELD_NONE;
} }
static int imx477_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh) static int imx477_open(struct v4l2_subdev *sd, struct v4l2_subdev_fh *fh)
...@@ -1520,7 +1508,7 @@ static int imx477_get_pad_format(struct v4l2_subdev *sd, ...@@ -1520,7 +1508,7 @@ static int imx477_get_pad_format(struct v4l2_subdev *sd,
imx477_update_image_pad_format(imx477, imx477->mode, imx477_update_image_pad_format(imx477, imx477->mode,
fmt); fmt);
fmt->format.code = fmt->format.code =
imx477_get_format_code(imx477, imx477->fmt.code); imx477_get_format_code(imx477, imx477->fmt_code);
} else { } else {
imx477_update_metadata_pad_format(fmt); imx477_update_metadata_pad_format(fmt);
} }
...@@ -1611,6 +1599,7 @@ static int imx477_set_pad_format(struct v4l2_subdev *sd, ...@@ -1611,6 +1599,7 @@ static int imx477_set_pad_format(struct v4l2_subdev *sd,
*framefmt = fmt->format; *framefmt = fmt->format;
} else { } else {
imx477->mode = mode; imx477->mode = mode;
imx477->fmt_code = fmt->format.code;
imx477_set_framing_limits(imx477); imx477_set_framing_limits(imx477);
} }
} else { } else {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册