[PATCH v4 3/5] media: imx: Forward type of hardware implementation

From: Dorota Czaplejewicz
Date: Thu Nov 04 2021 - 07:44:48 EST


Signed-off-by: Dorota Czaplejewicz <dorota.czaplejewicz@xxxxxxx>
---
drivers/staging/media/imx/imx-media-capture.c | 15 +++++++++------
drivers/staging/media/imx/imx-media-utils.c | 3 ++-
drivers/staging/media/imx/imx-media.h | 3 ++-
3 files changed, 13 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c
index 65dc95a48ecc..7a6384b3e5e6 100644
--- a/drivers/staging/media/imx/imx-media-capture.c
+++ b/drivers/staging/media/imx/imx-media-capture.c
@@ -139,7 +139,8 @@ static int capture_g_fmt_vid_cap(struct file *file, void *fh,
}

static const struct imx_media_pixfmt *
-__capture_try_fmt(struct v4l2_pix_format *pixfmt, struct v4l2_rect *compose)
+__capture_try_fmt(struct v4l2_pix_format *pixfmt, struct v4l2_rect *compose,
+ enum imx_media_device_type type)
{
struct v4l2_mbus_framefmt fmt_src;
const struct imx_media_pixfmt *cc;
@@ -171,7 +172,7 @@ __capture_try_fmt(struct v4l2_pix_format *pixfmt, struct v4l2_rect *compose)
}

v4l2_fill_mbus_format(&fmt_src, pixfmt, 0);
- imx_media_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc);
+ imx_media_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc, type);

if (compose) {
compose->width = fmt_src.width;
@@ -184,7 +185,9 @@ __capture_try_fmt(struct v4l2_pix_format *pixfmt, struct v4l2_rect *compose)
static int capture_try_fmt_vid_cap(struct file *file, void *fh,
struct v4l2_format *f)
{
- __capture_try_fmt(&f->fmt.pix, NULL);
+ struct capture_priv *priv = video_drvdata(file);
+
+ __capture_try_fmt(&f->fmt.pix, NULL, priv->type);
return 0;
}

@@ -199,7 +202,7 @@ static int capture_s_fmt_vid_cap(struct file *file, void *fh,
return -EBUSY;
}

- cc = __capture_try_fmt(&f->fmt.pix, &priv->vdev.compose);
+ cc = __capture_try_fmt(&f->fmt.pix, &priv->vdev.compose, priv->type);

priv->vdev.cc = cc;
priv->vdev.fmt = f->fmt.pix;
@@ -418,7 +421,7 @@ __capture_legacy_try_fmt(struct capture_priv *priv,
}
}

- imx_media_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src->format, cc);
+ imx_media_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src->format, cc, priv->type);

return cc;
}
@@ -889,7 +892,7 @@ static int capture_init_format(struct capture_priv *priv)
fmt_src.format.height = IMX_MEDIA_DEF_PIX_HEIGHT;
}

- imx_media_mbus_fmt_to_pix_fmt(&vdev->fmt, &fmt_src.format, NULL);
+ imx_media_mbus_fmt_to_pix_fmt(&vdev->fmt, &fmt_src.format, NULL, priv->type);
vdev->compose.width = fmt_src.format.width;
vdev->compose.height = fmt_src.format.height;

diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c
index afa96e05ea7f..8b5c6bcfd4fa 100644
--- a/drivers/staging/media/imx/imx-media-utils.c
+++ b/drivers/staging/media/imx/imx-media-utils.c
@@ -518,7 +518,8 @@ EXPORT_SYMBOL_GPL(imx_media_try_colorimetry);

int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
const struct v4l2_mbus_framefmt *mbus,
- const struct imx_media_pixfmt *cc)
+ const struct imx_media_pixfmt *cc,
+ enum imx_media_device_type type)
{
u32 width;
u32 stride;
diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h
index 08e0c94e2de1..79adab775739 100644
--- a/drivers/staging/media/imx/imx-media.h
+++ b/drivers/staging/media/imx/imx-media.h
@@ -203,7 +203,8 @@ void imx_media_try_colorimetry(struct v4l2_mbus_framefmt *tryfmt,
bool ic_route);
int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,
const struct v4l2_mbus_framefmt *mbus,
- const struct imx_media_pixfmt *cc);
+ const struct imx_media_pixfmt *cc,
+ enum imx_media_device_type type);
void imx_media_grp_id_to_sd_name(char *sd_name, int sz,
u32 grp_id, int ipu_id);
struct v4l2_subdev *
--
2.31.1

Attachment: pgplpqRfXWSPq.pgp
Description: OpenPGP digital signature