Commit 35d964e9 authored by Martin Kepplinger's avatar Martin Kepplinger
Browse files

hack: media: imx: API backport

parent 0baa18b1
......@@ -441,27 +441,26 @@ unlock:
static struct v4l2_mbus_framefmt *
imx8mq_mipi_csi_get_format(struct csi_state *state,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_pad_config *cfg,
enum v4l2_subdev_format_whence which,
unsigned int pad)
{
if (which == V4L2_SUBDEV_FORMAT_TRY)
return v4l2_subdev_get_try_format(&state->sd, sd_state, pad);
return v4l2_subdev_get_try_format(&state->sd, cfg, pad);
return &state->format_mbus[pad];
}
static int imx8mq_mipi_csi_init_cfg(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state)
struct v4l2_subdev_pad_config *cfg)
{
struct csi_state *state = mipi_sd_to_csi2_state(sd);
struct v4l2_mbus_framefmt *fmt_sink;
struct v4l2_mbus_framefmt *fmt_source;
enum v4l2_subdev_format_whence which;
which = sd_state ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE;
fmt_sink = imx8mq_mipi_csi_get_format(state, sd_state, which,
MIPI_CSI2_PAD_SINK);
which = cfg ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE;
fmt_sink = imx8mq_mipi_csi_get_format(state, cfg, which, MIPI_CSI2_PAD_SINK);
fmt_sink->code = MEDIA_BUS_FMT_SGBRG10_1X10;
fmt_sink->width = MIPI_CSI2_DEF_PIX_WIDTH;
......@@ -475,7 +474,7 @@ static int imx8mq_mipi_csi_init_cfg(struct v4l2_subdev *sd,
V4L2_MAP_QUANTIZATION_DEFAULT(false, fmt_sink->colorspace,
fmt_sink->ycbcr_enc);
fmt_source = imx8mq_mipi_csi_get_format(state, sd_state, which,
fmt_source = imx8mq_mipi_csi_get_format(state, cfg, which,
MIPI_CSI2_PAD_SOURCE);
*fmt_source = *fmt_sink;
......@@ -483,13 +482,13 @@ static int imx8mq_mipi_csi_init_cfg(struct v4l2_subdev *sd,
}
static int imx8mq_mipi_csi_get_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *sdformat)
{
struct csi_state *state = mipi_sd_to_csi2_state(sd);
struct v4l2_mbus_framefmt *fmt;
fmt = imx8mq_mipi_csi_get_format(state, sd_state, sdformat->which,
fmt = imx8mq_mipi_csi_get_format(state, cfg, sdformat->which,
sdformat->pad);
mutex_lock(&state->lock);
......@@ -502,7 +501,7 @@ static int imx8mq_mipi_csi_get_fmt(struct v4l2_subdev *sd,
}
static int imx8mq_mipi_csi_enum_mbus_code(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_mbus_code_enum *code)
{
struct csi_state *state = mipi_sd_to_csi2_state(sd);
......@@ -517,7 +516,7 @@ static int imx8mq_mipi_csi_enum_mbus_code(struct v4l2_subdev *sd,
if (code->index > 0)
return -EINVAL;
fmt = imx8mq_mipi_csi_get_format(state, sd_state, code->which,
fmt = imx8mq_mipi_csi_get_format(state, cfg, code->which,
code->pad);
code->code = fmt->code;
return 0;
......@@ -535,7 +534,7 @@ static int imx8mq_mipi_csi_enum_mbus_code(struct v4l2_subdev *sd,
}
static int imx8mq_mipi_csi_set_fmt(struct v4l2_subdev *sd,
struct v4l2_subdev_state *sd_state,
struct v4l2_subdev_pad_config *cfg,
struct v4l2_subdev_format *sdformat)
{
struct csi_state *state = mipi_sd_to_csi2_state(sd);
......@@ -547,7 +546,7 @@ static int imx8mq_mipi_csi_set_fmt(struct v4l2_subdev *sd,
* modified.
*/
if (sdformat->pad == MIPI_CSI2_PAD_SOURCE)
return imx8mq_mipi_csi_get_fmt(sd, sd_state, sdformat);
return imx8mq_mipi_csi_get_fmt(sd, cfg, sdformat);
if (sdformat->pad != MIPI_CSI2_PAD_SINK)
return -EINVAL;
......@@ -556,7 +555,7 @@ static int imx8mq_mipi_csi_set_fmt(struct v4l2_subdev *sd,
if (!csi2_fmt)
csi2_fmt = &imx8mq_mipi_csi_formats[0];
fmt = imx8mq_mipi_csi_get_format(state, sd_state, sdformat->which,
fmt = imx8mq_mipi_csi_get_format(state, cfg, sdformat->which,
sdformat->pad);
mutex_lock(&state->lock);
......@@ -568,7 +567,7 @@ static int imx8mq_mipi_csi_set_fmt(struct v4l2_subdev *sd,
sdformat->format = *fmt;
/* Propagate the format from sink to source. */
fmt = imx8mq_mipi_csi_get_format(state, sd_state, sdformat->which,
fmt = imx8mq_mipi_csi_get_format(state, cfg, sdformat->which,
MIPI_CSI2_PAD_SOURCE);
*fmt = sdformat->format;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment