Patch Detail
Show a patch.
GET /api/patches/15873/?format=api
{ "id": 15873, "url": "https://patchwork.libcamera.org/api/patches/15873/?format=api", "web_url": "https://patchwork.libcamera.org/patch/15873/", "project": { "id": 1, "url": "https://patchwork.libcamera.org/api/projects/1/?format=api", "name": "libcamera", "link_name": "libcamera", "list_id": "libcamera_core", "list_email": "libcamera-devel@lists.libcamera.org", "web_url": "", "scm_url": "", "webscm_url": "" }, "msgid": "<20220510115147.19360-34-laurent.pinchart@ideasonboard.com>", "date": "2022-05-10T11:51:30", "name": "[libcamera-devel,33/50] staging: media: imx: imx7-media-csi: Import format helpers", "commit_ref": null, "pull_url": null, "state": "not-applicable", "archived": false, "hash": "47a447874d40f49029fb0001573f89b1d8b0cc51", "submitter": { "id": 2, "url": "https://patchwork.libcamera.org/api/people/2/?format=api", "name": "Laurent Pinchart", "email": "laurent.pinchart@ideasonboard.com" }, "delegate": null, "mbox": "https://patchwork.libcamera.org/patch/15873/mbox/", "series": [ { "id": 3106, "url": "https://patchwork.libcamera.org/api/series/3106/?format=api", "web_url": "https://patchwork.libcamera.org/project/libcamera/list/?series=3106", "date": "2022-05-10T11:50:57", "name": "staging: media: imx: Prepare destaging of imx7-media-csi", "version": 1, "mbox": "https://patchwork.libcamera.org/series/3106/mbox/" } ], "comments": "https://patchwork.libcamera.org/api/patches/15873/comments/", "check": "pending", "checks": "https://patchwork.libcamera.org/api/patches/15873/checks/", "tags": {}, "headers": { "Return-Path": "<libcamera-devel-bounces@lists.libcamera.org>", "X-Original-To": "parsemail@patchwork.libcamera.org", "Delivered-To": "parsemail@patchwork.libcamera.org", "Received": [ "from lancelot.ideasonboard.com (lancelot.ideasonboard.com\n\t[92.243.16.209])\n\tby patchwork.libcamera.org (Postfix) with ESMTPS id 72007C3276\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 10 May 2022 11:52:34 +0000 (UTC)", "from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id 1B852656A7;\n\tTue, 10 May 2022 13:52:34 +0200 (CEST)", "from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[213.167.242.64])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id 4474B65672\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 May 2022 13:52:25 +0200 (CEST)", "from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57])\n\tby perceval.ideasonboard.com (Postfix) with ESMTPSA id 61C09B9A;\n\tTue, 10 May 2022 13:52:24 +0200 (CEST)" ], "DKIM-Signature": [ "v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652183554;\n\tbh=OjRGMuHjDHAG1XZV5zDaeOrnmZ9X52Jw4ZXN1k9DDgM=;\n\th=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe:\n\tList-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc:\n\tFrom;\n\tb=BF8ioNeWzsNYLo8/Hnq7Y4dbF3ndUnjPM47SaZnt46jET6eQhgkzV4X7HYHcAsW0V\n\tiNcXEE4XviNJRRGh54mN/t7NnkCNJ6j0JNwu32wktSpNyGwJwYWb7INkR+ZO0SpvX+\n\t8Mzbaa9QwA8lsISKN26NY60DzLDzv9uUbL950vXk8znb6EZPGf2Mws80//RLiJiMnu\n\tuF0aLuSnMThUEx+JWdYH0Dmdt+ZFjEhkYxw08ECq9gSOQFTrSlA9npaAs0rdYbhzod\n\ttQ4TbYgTiHzZCPA1P/9Sg65ItWKnOQd+vqZL2DbDGw/sJ/9wlrwQ6NAfeYejh0P4Dk\n\tYzypcptPaziaw==", "v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652183545;\n\tbh=OjRGMuHjDHAG1XZV5zDaeOrnmZ9X52Jw4ZXN1k9DDgM=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=vM9e1gqyd9pgXfgNSkNPRgZlfKAMwAp8lHSOuJv2lTyfjv3/5N9pJNR/CFDs3Mdhq\n\t6zYDpYkosqllQI+rrrfNO5RBoLPoJsb9SPVsaD2eKE9E6b++YXVQoULIHrD59gNtpC\n\tk8RB7qUfrZrDDaxyDF+whBVpooPI/b+TlrjNLxk8=" ], "Authentication-Results": "lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"vM9e1gqy\"; dkim-atps=neutral", "To": "libcamera-devel@lists.libcamera.org", "Date": "Tue, 10 May 2022 14:51:30 +0300", "Message-Id": "<20220510115147.19360-34-laurent.pinchart@ideasonboard.com>", "X-Mailer": "git-send-email 2.35.1", "In-Reply-To": "<20220510115147.19360-1-laurent.pinchart@ideasonboard.com>", "References": "<20220510115147.19360-1-laurent.pinchart@ideasonboard.com>", "MIME-Version": "1.0", "Content-Transfer-Encoding": "8bit", "Subject": "[libcamera-devel] [PATCH 33/50] staging: media: imx:\n\timx7-media-csi: Import format helpers", "X-BeenThere": "libcamera-devel@lists.libcamera.org", "X-Mailman-Version": "2.1.29", "Precedence": "list", "List-Id": "<libcamera-devel.lists.libcamera.org>", "List-Unsubscribe": "<https://lists.libcamera.org/options/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=unsubscribe>", "List-Archive": "<https://lists.libcamera.org/pipermail/libcamera-devel/>", "List-Post": "<mailto:libcamera-devel@lists.libcamera.org>", "List-Help": "<mailto:libcamera-devel-request@lists.libcamera.org?subject=help>", "List-Subscribe": "<https://lists.libcamera.org/listinfo/libcamera-devel>,\n\t<mailto:libcamera-devel-request@lists.libcamera.org?subject=subscribe>", "From": "Laurent Pinchart via libcamera-devel\n\t<libcamera-devel@lists.libcamera.org>", "Reply-To": "Laurent Pinchart <laurent.pinchart@ideasonboard.com>", "Cc": "Martin Kepplinger <martin.kepplinger@puri.sm>, kernel@pengutronix.de,\n\tDorota Czaplejewicz <dorota.czaplejewicz@puri.sm>,\n\tAlexander Stein <alexander.stein@ew.tq-group.com>,\n\tRui Miguel Silva <rmfrfs@gmail.com>,\n\tPhilipp Zabel <p.zabel@pengutronix.de>, \n\tSteve Longerbeam <slongerbeam@gmail.com>", "Errors-To": "libcamera-devel-bounces@lists.libcamera.org", "Sender": "\"libcamera-devel\" <libcamera-devel-bounces@lists.libcamera.org>" }, "content": "To prepare for code refactoring, copy the format helpers used by this\ndriver from imx-media-utils.c. Rename structures and functions to avoid\nname clashes, no functional change intended.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n drivers/staging/media/imx/imx7-media-csi.c | 660 +++++++++++++++++++--\n 1 file changed, 615 insertions(+), 45 deletions(-)", "diff": "diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c\nindex e5dc9525fa52..42f1485b3550 100644\n--- a/drivers/staging/media/imx/imx7-media-csi.c\n+++ b/drivers/staging/media/imx/imx7-media-csi.c\n@@ -174,6 +174,23 @@ enum imx_csi_model {\n \tIMX7_CSI_IMX8MQ,\n };\n \n+struct imx7_csi_pixfmt {\n+\t/* the in-memory FourCC pixel format */\n+\tu32 fourcc;\n+\t/*\n+\t * the set of equivalent media bus codes for the fourcc.\n+\t * NOTE! codes pointer is NULL for in-memory-only formats.\n+\t */\n+\tconst u32 *codes;\n+\tint bpp; /* total bpp */\n+\t/* cycles per pixel for generic (bayer) formats for the parallel bus */\n+\tint\tcycles;\n+\tenum ipu_color_space cs;\n+\tbool planar; /* is a planar format */\n+\tbool bayer; /* is a raw bayer format */\n+\tbool ipufmt; /* is one of the IPU internal formats */\n+};\n+\n struct imx7_csi_vb2_buffer {\n \tstruct vb2_v4l2_buffer vbuf;\n \tstruct list_head list;\n@@ -218,14 +235,14 @@ struct imx7_csi {\n \tstruct media_pad pad[IMX7_CSI_PADS_NUM];\n \n \tstruct v4l2_mbus_framefmt format_mbus[IMX7_CSI_PADS_NUM];\n-\tconst struct imx_media_pixfmt *cc[IMX7_CSI_PADS_NUM];\n+\tconst struct imx7_csi_pixfmt *cc[IMX7_CSI_PADS_NUM];\n \n \t/* Video device */\n \tstruct video_device *vdev;\t\t/* Video device */\n \tstruct media_pad vdev_pad;\t\t/* Video device pad */\n \n \tstruct v4l2_pix_format vdev_fmt;\t/* The user format */\n-\tconst struct imx_media_pixfmt *vdev_cc;\n+\tconst struct imx7_csi_pixfmt *vdev_cc;\n \tstruct v4l2_rect vdev_compose;\t\t/* The compose rectangle */\n \n \tstruct mutex vdev_mutex;\t\t/* Protect vdev operations */\n@@ -784,30 +801,518 @@ static irqreturn_t imx7_csi_irq_handler(int irq, void *data)\n \treturn IRQ_HANDLED;\n }\n \n+/* -----------------------------------------------------------------------------\n+ * Format Helpers\n+ */\n+\n+#define IMX_BUS_FMTS(fmt...) (const u32[]) {fmt, 0}\n+\n+enum imx7_csi_pixfmt_sel {\n+\tIMX7_CSI_PIXFMT_SEL_YUV = BIT(0), /* select YUV formats */\n+\tIMX7_CSI_PIXFMT_SEL_RGB = BIT(1), /* select RGB formats */\n+\tIMX7_CSI_PIXFMT_SEL_BAYER = BIT(2), /* select BAYER formats */\n+\tIMX7_CSI_PIXFMT_SEL_IPU = BIT(3), /* select IPU-internal formats */\n+\tIMX7_CSI_PIXFMT_SEL_YUV_RGB = IMX7_CSI_PIXFMT_SEL_YUV\n+\t\t\t\t | IMX7_CSI_PIXFMT_SEL_RGB,\n+\tIMX7_CSI_PIXFMT_SEL_ANY = IMX7_CSI_PIXFMT_SEL_YUV\n+\t\t\t\t| IMX7_CSI_PIXFMT_SEL_RGB\n+\t\t\t\t| IMX7_CSI_PIXFMT_SEL_BAYER,\n+};\n+\n+/*\n+ * List of supported pixel formats for the subdevs.\n+ */\n+static const struct imx7_csi_pixfmt pixel_formats[] = {\n+\t/*** YUV formats start here ***/\n+\t{\n+\t\t.fourcc\t= V4L2_PIX_FMT_UYVY,\n+\t\t.codes = IMX_BUS_FMTS(\n+\t\t\tMEDIA_BUS_FMT_UYVY8_2X8,\n+\t\t\tMEDIA_BUS_FMT_UYVY8_1X16\n+\t\t),\n+\t\t.cs = IPUV3_COLORSPACE_YUV,\n+\t\t.bpp = 16,\n+\t}, {\n+\t\t.fourcc\t= V4L2_PIX_FMT_YUYV,\n+\t\t.codes = IMX_BUS_FMTS(\n+\t\t\tMEDIA_BUS_FMT_YUYV8_2X8,\n+\t\t\tMEDIA_BUS_FMT_YUYV8_1X16\n+\t\t),\n+\t\t.cs = IPUV3_COLORSPACE_YUV,\n+\t\t.bpp = 16,\n+\t}, {\n+\t\t.fourcc\t= V4L2_PIX_FMT_YUV420,\n+\t\t.cs = IPUV3_COLORSPACE_YUV,\n+\t\t.bpp = 12,\n+\t\t.planar = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_YVU420,\n+\t\t.cs = IPUV3_COLORSPACE_YUV,\n+\t\t.bpp = 12,\n+\t\t.planar = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_YUV422P,\n+\t\t.cs = IPUV3_COLORSPACE_YUV,\n+\t\t.bpp = 16,\n+\t\t.planar = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_NV12,\n+\t\t.cs = IPUV3_COLORSPACE_YUV,\n+\t\t.bpp = 12,\n+\t\t.planar = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_NV16,\n+\t\t.cs = IPUV3_COLORSPACE_YUV,\n+\t\t.bpp = 16,\n+\t\t.planar = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_YUV32,\n+\t\t.codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_AYUV8_1X32),\n+\t\t.cs = IPUV3_COLORSPACE_YUV,\n+\t\t.bpp = 32,\n+\t\t.ipufmt = true,\n+\t},\n+\t/*** RGB formats start here ***/\n+\t{\n+\t\t.fourcc\t= V4L2_PIX_FMT_RGB565,\n+\t\t.codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_RGB565_2X8_LE),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 16,\n+\t\t.cycles = 2,\n+\t}, {\n+\t\t.fourcc\t= V4L2_PIX_FMT_RGB24,\n+\t\t.codes = IMX_BUS_FMTS(\n+\t\t\tMEDIA_BUS_FMT_RGB888_1X24,\n+\t\t\tMEDIA_BUS_FMT_RGB888_2X12_LE\n+\t\t),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 24,\n+\t}, {\n+\t\t.fourcc\t= V4L2_PIX_FMT_BGR24,\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 24,\n+\t}, {\n+\t\t.fourcc\t= V4L2_PIX_FMT_XRGB32,\n+\t\t.codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_ARGB8888_1X32),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 32,\n+\t}, {\n+\t\t.fourcc\t= V4L2_PIX_FMT_XRGB32,\n+\t\t.codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_ARGB8888_1X32),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 32,\n+\t\t.ipufmt = true,\n+\t}, {\n+\t\t.fourcc\t= V4L2_PIX_FMT_XBGR32,\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 32,\n+\t}, {\n+\t\t.fourcc\t= V4L2_PIX_FMT_BGRX32,\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 32,\n+\t}, {\n+\t\t.fourcc\t= V4L2_PIX_FMT_RGBX32,\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 32,\n+\t},\n+\t/*** raw bayer and grayscale formats start here ***/\n+\t{\n+\t\t.fourcc = V4L2_PIX_FMT_SBGGR8,\n+\t\t.codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SBGGR8_1X8),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 8,\n+\t\t.bayer = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_SGBRG8,\n+\t\t.codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGBRG8_1X8),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 8,\n+\t\t.bayer = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_SGRBG8,\n+\t\t.codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGRBG8_1X8),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 8,\n+\t\t.bayer = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_SRGGB8,\n+\t\t.codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SRGGB8_1X8),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 8,\n+\t\t.bayer = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_SBGGR16,\n+\t\t.codes = IMX_BUS_FMTS(\n+\t\t\tMEDIA_BUS_FMT_SBGGR10_1X10,\n+\t\t\tMEDIA_BUS_FMT_SBGGR12_1X12,\n+\t\t\tMEDIA_BUS_FMT_SBGGR14_1X14,\n+\t\t\tMEDIA_BUS_FMT_SBGGR16_1X16\n+\t\t),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 16,\n+\t\t.bayer = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_SGBRG16,\n+\t\t.codes = IMX_BUS_FMTS(\n+\t\t\tMEDIA_BUS_FMT_SGBRG10_1X10,\n+\t\t\tMEDIA_BUS_FMT_SGBRG12_1X12,\n+\t\t\tMEDIA_BUS_FMT_SGBRG14_1X14,\n+\t\t\tMEDIA_BUS_FMT_SGBRG16_1X16\n+\t\t),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 16,\n+\t\t.bayer = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_SGRBG16,\n+\t\t.codes = IMX_BUS_FMTS(\n+\t\t\tMEDIA_BUS_FMT_SGRBG10_1X10,\n+\t\t\tMEDIA_BUS_FMT_SGRBG12_1X12,\n+\t\t\tMEDIA_BUS_FMT_SGRBG14_1X14,\n+\t\t\tMEDIA_BUS_FMT_SGRBG16_1X16\n+\t\t),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 16,\n+\t\t.bayer = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_SRGGB16,\n+\t\t.codes = IMX_BUS_FMTS(\n+\t\t\tMEDIA_BUS_FMT_SRGGB10_1X10,\n+\t\t\tMEDIA_BUS_FMT_SRGGB12_1X12,\n+\t\t\tMEDIA_BUS_FMT_SRGGB14_1X14,\n+\t\t\tMEDIA_BUS_FMT_SRGGB16_1X16\n+\t\t),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 16,\n+\t\t.bayer = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_GREY,\n+\t\t.codes = IMX_BUS_FMTS(\n+\t\t\tMEDIA_BUS_FMT_Y8_1X8,\n+\t\t\tMEDIA_BUS_FMT_Y10_1X10,\n+\t\t\tMEDIA_BUS_FMT_Y12_1X12\n+\t\t),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 8,\n+\t\t.bayer = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_Y10,\n+\t\t.codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_Y10_1X10),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 16,\n+\t\t.bayer = true,\n+\t}, {\n+\t\t.fourcc = V4L2_PIX_FMT_Y12,\n+\t\t.codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_Y12_1X12),\n+\t\t.cs = IPUV3_COLORSPACE_RGB,\n+\t\t.bpp = 16,\n+\t\t.bayer = true,\n+\t},\n+};\n+\n+/*\n+ * Search in the pixel_formats[] array for an entry with the given fourcc\n+ * that matches the requested selection criteria and return it.\n+ *\n+ * @fourcc: Search for an entry with the given fourcc pixel format.\n+ * @fmt_sel: Allow entries only with the given selection criteria.\n+ */\n+static const struct imx7_csi_pixfmt *\n+imx7_csi_find_pixel_format(u32 fourcc, enum imx7_csi_pixfmt_sel fmt_sel)\n+{\n+\tbool sel_ipu = fmt_sel & IMX7_CSI_PIXFMT_SEL_IPU;\n+\tunsigned int i;\n+\n+\tfmt_sel &= ~IMX7_CSI_PIXFMT_SEL_IPU;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {\n+\t\tconst struct imx7_csi_pixfmt *fmt = &pixel_formats[i];\n+\t\tenum imx7_csi_pixfmt_sel sel;\n+\n+\t\tif (sel_ipu != fmt->ipufmt)\n+\t\t\tcontinue;\n+\n+\t\tsel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER :\n+\t\t\t((fmt->cs == IPUV3_COLORSPACE_YUV) ?\n+\t\t\t IMX7_CSI_PIXFMT_SEL_YUV : IMX7_CSI_PIXFMT_SEL_RGB);\n+\n+\t\tif ((fmt_sel & sel) && fmt->fourcc == fourcc)\n+\t\t\treturn fmt;\n+\t}\n+\n+\treturn NULL;\n+}\n+\n+/*\n+ * Search in the pixel_formats[] array for an entry with the given media\n+ * bus code that matches the requested selection criteria and return it.\n+ *\n+ * @code: Search for an entry with the given media-bus code.\n+ * @fmt_sel: Allow entries only with the given selection criteria.\n+ */\n+static const struct imx7_csi_pixfmt *\n+imx7_csi_find_mbus_format(u32 code, enum imx7_csi_pixfmt_sel fmt_sel)\n+{\n+\tbool sel_ipu = fmt_sel & IMX7_CSI_PIXFMT_SEL_IPU;\n+\tunsigned int i;\n+\n+\tfmt_sel &= ~IMX7_CSI_PIXFMT_SEL_IPU;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {\n+\t\tconst struct imx7_csi_pixfmt *fmt = &pixel_formats[i];\n+\t\tenum imx7_csi_pixfmt_sel sel;\n+\t\tunsigned int j;\n+\n+\t\tif (sel_ipu != fmt->ipufmt)\n+\t\t\tcontinue;\n+\n+\t\tsel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER :\n+\t\t\t((fmt->cs == IPUV3_COLORSPACE_YUV) ?\n+\t\t\t IMX7_CSI_PIXFMT_SEL_YUV : IMX7_CSI_PIXFMT_SEL_RGB);\n+\n+\t\tif (!(fmt_sel & sel) || !fmt->codes)\n+\t\t\tcontinue;\n+\n+\t\tfor (j = 0; fmt->codes[j]; j++) {\n+\t\t\tif (code == fmt->codes[j])\n+\t\t\t\treturn fmt;\n+\t\t}\n+\t}\n+\n+\treturn NULL;\n+}\n+\n+static inline const struct imx7_csi_pixfmt *\n+imx7_csi_find_ipu_format(u32 code, enum imx7_csi_pixfmt_sel fmt_sel)\n+{\n+\treturn imx7_csi_find_mbus_format(code, fmt_sel | IMX7_CSI_PIXFMT_SEL_IPU);\n+}\n+\n+/*\n+ * Enumerate entries in the pixel_formats[] array that match the\n+ * requested selection criteria. Return the fourcc that matches the\n+ * selection criteria at the requested match index.\n+ *\n+ * @fourcc: The returned fourcc that matches the search criteria at\n+ * the requested match index.\n+ * @index: The requested match index.\n+ * @fmt_sel: Include in the enumeration entries with the given selection\n+ * criteria.\n+ * @code: If non-zero, only include in the enumeration entries matching this\n+ *\tmedia bus code.\n+ */\n+static int imx7_csi_enum_pixel_formats(u32 *fourcc, u32 index,\n+\t\t\t\t enum imx7_csi_pixfmt_sel fmt_sel,\n+\t\t\t\t u32 code)\n+{\n+\tbool sel_ipu = fmt_sel & IMX7_CSI_PIXFMT_SEL_IPU;\n+\tunsigned int i;\n+\n+\tfmt_sel &= ~IMX7_CSI_PIXFMT_SEL_IPU;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {\n+\t\tconst struct imx7_csi_pixfmt *fmt = &pixel_formats[i];\n+\t\tenum imx7_csi_pixfmt_sel sel;\n+\n+\t\tif (sel_ipu != fmt->ipufmt)\n+\t\t\tcontinue;\n+\n+\t\tsel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER :\n+\t\t\t((fmt->cs == IPUV3_COLORSPACE_YUV) ?\n+\t\t\t IMX7_CSI_PIXFMT_SEL_YUV : IMX7_CSI_PIXFMT_SEL_RGB);\n+\n+\t\tif (!(fmt_sel & sel))\n+\t\t\tcontinue;\n+\n+\t\t/*\n+\t\t * If a media bus code is specified, only consider formats that\n+\t\t * match it.\n+\t\t */\n+\t\tif (code) {\n+\t\t\tunsigned int j;\n+\n+\t\t\tif (!fmt->codes)\n+\t\t\t\tcontinue;\n+\n+\t\t\tfor (j = 0; fmt->codes[j]; j++) {\n+\t\t\t\tif (code == fmt->codes[j])\n+\t\t\t\t\tbreak;\n+\t\t\t}\n+\n+\t\t\tif (!fmt->codes[j])\n+\t\t\t\tcontinue;\n+\t\t}\n+\n+\t\tif (index == 0) {\n+\t\t\t*fourcc = fmt->fourcc;\n+\t\t\treturn 0;\n+\t\t}\n+\n+\t\tindex--;\n+\t}\n+\n+\treturn -EINVAL;\n+}\n+\n+/*\n+ * Enumerate entries in the pixel_formats[] array that match the\n+ * requested search criteria. Return the media-bus code that matches\n+ * the search criteria at the requested match index.\n+ *\n+ * @code: The returned media-bus code that matches the search criteria at\n+ * the requested match index.\n+ * @index: The requested match index.\n+ * @fmt_sel: Include in the enumeration entries with the given selection\n+ * criteria.\n+ */\n+static int imx7_csi_enum_mbus_formats(u32 *code, u32 index,\n+\t\t\t\t enum imx7_csi_pixfmt_sel fmt_sel)\n+{\n+\tbool sel_ipu = fmt_sel & IMX7_CSI_PIXFMT_SEL_IPU;\n+\tunsigned int i;\n+\n+\tfmt_sel &= ~IMX7_CSI_PIXFMT_SEL_IPU;\n+\n+\tfor (i = 0; i < ARRAY_SIZE(pixel_formats); i++) {\n+\t\tconst struct imx7_csi_pixfmt *fmt = &pixel_formats[i];\n+\t\tenum imx7_csi_pixfmt_sel sel;\n+\t\tunsigned int j;\n+\n+\t\tif (sel_ipu != fmt->ipufmt)\n+\t\t\tcontinue;\n+\n+\t\tsel = fmt->bayer ? IMX7_CSI_PIXFMT_SEL_BAYER :\n+\t\t\t((fmt->cs == IPUV3_COLORSPACE_YUV) ?\n+\t\t\t IMX7_CSI_PIXFMT_SEL_YUV : IMX7_CSI_PIXFMT_SEL_RGB);\n+\n+\t\tif (!(fmt_sel & sel) || !fmt->codes)\n+\t\t\tcontinue;\n+\n+\t\tfor (j = 0; fmt->codes[j]; j++) {\n+\t\t\tif (index == 0) {\n+\t\t\t\t*code = fmt->codes[j];\n+\t\t\t\treturn 0;\n+\t\t\t}\n+\n+\t\t\tindex--;\n+\t\t}\n+\t}\n+\n+\treturn -EINVAL;\n+}\n+\n+static int imx7_csi_init_mbus_fmt(struct v4l2_mbus_framefmt *mbus,\n+\t\t\t\t u32 width, u32 height, u32 code, u32 field,\n+\t\t\t\t const struct imx7_csi_pixfmt **cc)\n+{\n+\tconst struct imx7_csi_pixfmt *lcc;\n+\n+\tmbus->width = width;\n+\tmbus->height = height;\n+\tmbus->field = field;\n+\n+\tif (code == 0)\n+\t\timx7_csi_enum_mbus_formats(&code, 0, IMX7_CSI_PIXFMT_SEL_YUV);\n+\n+\tlcc = imx7_csi_find_mbus_format(code, IMX7_CSI_PIXFMT_SEL_ANY);\n+\tif (!lcc) {\n+\t\tlcc = imx7_csi_find_ipu_format(code, IMX7_CSI_PIXFMT_SEL_YUV_RGB);\n+\t\tif (!lcc)\n+\t\t\treturn -EINVAL;\n+\t}\n+\n+\tmbus->code = code;\n+\n+\tmbus->colorspace = V4L2_COLORSPACE_SRGB;\n+\tmbus->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(mbus->colorspace);\n+\tmbus->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(mbus->colorspace);\n+\tmbus->quantization =\n+\t\tV4L2_MAP_QUANTIZATION_DEFAULT(lcc->cs == IPUV3_COLORSPACE_RGB,\n+\t\t\t\t\t mbus->colorspace,\n+\t\t\t\t\t mbus->ycbcr_enc);\n+\n+\tif (cc)\n+\t\t*cc = lcc;\n+\n+\treturn 0;\n+}\n+\n+static int imx7_csi_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix,\n+\t\t\t\t\tconst struct v4l2_mbus_framefmt *mbus,\n+\t\t\t\t\tconst struct imx7_csi_pixfmt *cc)\n+{\n+\tu32 width;\n+\tu32 stride;\n+\n+\tif (!cc) {\n+\t\tcc = imx7_csi_find_ipu_format(mbus->code,\n+\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_YUV_RGB);\n+\t\tif (!cc)\n+\t\t\tcc = imx7_csi_find_mbus_format(mbus->code,\n+\t\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY);\n+\t\tif (!cc)\n+\t\t\treturn -EINVAL;\n+\t}\n+\n+\t/*\n+\t * TODO: the IPU currently does not support the AYUV32 format,\n+\t * so until it does convert to a supported YUV format.\n+\t */\n+\tif (cc->ipufmt && cc->cs == IPUV3_COLORSPACE_YUV) {\n+\t\tu32 code;\n+\n+\t\timx7_csi_enum_mbus_formats(&code, 0, IMX7_CSI_PIXFMT_SEL_YUV);\n+\t\tcc = imx7_csi_find_mbus_format(code, IMX7_CSI_PIXFMT_SEL_YUV);\n+\t}\n+\n+\t/* Round up width for minimum burst size */\n+\twidth = round_up(mbus->width, 8);\n+\n+\t/* Round up stride for IDMAC line start address alignment */\n+\tif (cc->planar)\n+\t\tstride = round_up(width, 16);\n+\telse\n+\t\tstride = round_up((width * cc->bpp) >> 3, 8);\n+\n+\tpix->width = width;\n+\tpix->height = mbus->height;\n+\tpix->pixelformat = cc->fourcc;\n+\tpix->colorspace = mbus->colorspace;\n+\tpix->xfer_func = mbus->xfer_func;\n+\tpix->ycbcr_enc = mbus->ycbcr_enc;\n+\tpix->quantization = mbus->quantization;\n+\tpix->field = mbus->field;\n+\tpix->bytesperline = stride;\n+\tpix->sizeimage = cc->planar ? ((stride * pix->height * cc->bpp) >> 3) :\n+\t\t\t stride * pix->height;\n+\n+\treturn 0;\n+}\n+\n /* -----------------------------------------------------------------------------\n * Video Capture Device - IOCTLs\n */\n \n-static const struct imx_media_pixfmt *\n+static const struct imx7_csi_pixfmt *\n imx7_csi_video_find_format(u32 code, u32 fourcc)\n {\n-\tconst struct imx_media_pixfmt *cc;\n+\tconst struct imx7_csi_pixfmt *cc;\n \n-\tcc = imx_media_find_ipu_format(code, PIXFMT_SEL_YUV_RGB);\n+\tcc = imx7_csi_find_ipu_format(code, IMX7_CSI_PIXFMT_SEL_YUV_RGB);\n \tif (cc) {\n-\t\tenum imx_pixfmt_sel fmt_sel = cc->cs == IPUV3_COLORSPACE_YUV\n-\t\t\t\t\t ? PIXFMT_SEL_YUV : PIXFMT_SEL_RGB;\n+\t\tenum imx7_csi_pixfmt_sel fmt_sel = cc->cs == IPUV3_COLORSPACE_YUV\n+\t\t\t\t\t\t ? IMX7_CSI_PIXFMT_SEL_YUV\n+\t\t\t\t\t\t : IMX7_CSI_PIXFMT_SEL_RGB;\n \n-\t\tcc = imx_media_find_pixel_format(fourcc, fmt_sel);\n+\t\tcc = imx7_csi_find_pixel_format(fourcc, fmt_sel);\n \t\tif (!cc) {\n-\t\t\timx_media_enum_pixel_formats(&fourcc, 0, fmt_sel, 0);\n-\t\t\tcc = imx_media_find_pixel_format(fourcc, fmt_sel);\n+\t\t\timx7_csi_enum_pixel_formats(&fourcc, 0, fmt_sel, 0);\n+\t\t\tcc = imx7_csi_find_pixel_format(fourcc, fmt_sel);\n \t\t}\n \n \t\treturn cc;\n \t}\n \n-\treturn imx_media_find_mbus_format(code, PIXFMT_SEL_ANY);\n+\treturn imx7_csi_find_mbus_format(code, IMX7_CSI_PIXFMT_SEL_ANY);\n }\n \n static int imx7_csi_video_querycap(struct file *file, void *fh,\n@@ -826,19 +1331,21 @@ static int imx7_csi_video_querycap(struct file *file, void *fh,\n static int imx7_csi_video_enum_fmt_vid_cap(struct file *file, void *fh,\n \t\t\t\t\t struct v4l2_fmtdesc *f)\n {\n-\treturn imx_media_enum_pixel_formats(&f->pixelformat, f->index,\n-\t\t\t\t\t PIXFMT_SEL_ANY, f->mbus_code);\n+\treturn imx7_csi_enum_pixel_formats(&f->pixelformat, f->index,\n+\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY,\n+\t\t\t\t\t f->mbus_code);\n }\n \n static int imx7_csi_video_enum_framesizes(struct file *file, void *fh,\n \t\t\t\t\t struct v4l2_frmsizeenum *fsize)\n {\n-\tconst struct imx_media_pixfmt *cc;\n+\tconst struct imx7_csi_pixfmt *cc;\n \n \tif (fsize->index > 0)\n \t\treturn -EINVAL;\n \n-\tcc = imx_media_find_pixel_format(fsize->pixel_format, PIXFMT_SEL_ANY);\n+\tcc = imx7_csi_find_pixel_format(fsize->pixel_format,\n+\t\t\t\t\tIMX7_CSI_PIXFMT_SEL_ANY);\n \tif (!cc)\n \t\treturn -EINVAL;\n \n@@ -868,23 +1375,24 @@ static int imx7_csi_video_g_fmt_vid_cap(struct file *file, void *fh,\n \treturn 0;\n }\n \n-static const struct imx_media_pixfmt *\n+static const struct imx7_csi_pixfmt *\n __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,\n \t\t\t struct v4l2_rect *compose)\n {\n \tstruct v4l2_mbus_framefmt fmt_src;\n-\tconst struct imx_media_pixfmt *cc;\n+\tconst struct imx7_csi_pixfmt *cc;\n \n \t/*\n \t * Find the pixel format, default to the first supported format if not\n \t * found.\n \t */\n-\tcc = imx_media_find_pixel_format(pixfmt->pixelformat, PIXFMT_SEL_ANY);\n+\tcc = imx7_csi_find_pixel_format(pixfmt->pixelformat,\n+\t\t\t\t\tIMX7_CSI_PIXFMT_SEL_ANY);\n \tif (!cc) {\n-\t\timx_media_enum_pixel_formats(&pixfmt->pixelformat, 0,\n-\t\t\t\t\t PIXFMT_SEL_ANY, 0);\n-\t\tcc = imx_media_find_pixel_format(pixfmt->pixelformat,\n-\t\t\t\t\t\t PIXFMT_SEL_ANY);\n+\t\timx7_csi_enum_pixel_formats(&pixfmt->pixelformat, 0,\n+\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY, 0);\n+\t\tcc = imx7_csi_find_pixel_format(pixfmt->pixelformat,\n+\t\t\t\t\t\tIMX7_CSI_PIXFMT_SEL_ANY);\n \t}\n \n \t/* Allow IDMAC interweave but enforce field order from source. */\n@@ -902,7 +1410,7 @@ __imx7_csi_video_try_fmt(struct v4l2_pix_format *pixfmt,\n \t}\n \n \tv4l2_fill_mbus_format(&fmt_src, pixfmt, 0);\n-\timx_media_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc);\n+\timx7_csi_mbus_fmt_to_pix_fmt(pixfmt, &fmt_src, cc);\n \n \tif (compose) {\n \t\tcompose->width = fmt_src.width;\n@@ -923,7 +1431,7 @@ static int imx7_csi_video_s_fmt_vid_cap(struct file *file, void *fh,\n \t\t\t\t\tstruct v4l2_format *f)\n {\n \tstruct imx7_csi *csi = video_drvdata(file);\n-\tconst struct imx_media_pixfmt *cc;\n+\tconst struct imx7_csi_pixfmt *cc;\n \n \tif (vb2_is_busy(&csi->q)) {\n \t\tdev_err(csi->dev, \"%s queue busy\\n\", __func__);\n@@ -1084,7 +1592,7 @@ static void imx7_csi_video_buf_queue(struct vb2_buffer *vb)\n static int imx7_csi_video_validate_fmt(struct imx7_csi *csi)\n {\n \tstruct v4l2_subdev_format fmt_src;\n-\tconst struct imx_media_pixfmt *cc;\n+\tconst struct imx7_csi_pixfmt *cc;\n \tint ret;\n \n \t/* Retrieve the media bus format on the source subdev. */\n@@ -1279,12 +1787,12 @@ static int imx7_csi_video_init_format(struct imx7_csi *csi)\n \tfmt_src.format.width = IMX7_CSI_VIDEO_DEF_PIX_WIDTH;\n \tfmt_src.format.height = IMX7_CSI_VIDEO_DEF_PIX_HEIGHT;\n \n-\timx_media_mbus_fmt_to_pix_fmt(&csi->vdev_fmt, &fmt_src.format, NULL);\n+\timx7_csi_mbus_fmt_to_pix_fmt(&csi->vdev_fmt, &fmt_src.format, NULL);\n \tcsi->vdev_compose.width = fmt_src.format.width;\n \tcsi->vdev_compose.height = fmt_src.format.height;\n \n-\tcsi->vdev_cc = imx_media_find_pixel_format(csi->vdev_fmt.pixelformat,\n-\t\t\t\t\t\t PIXFMT_SEL_ANY);\n+\tcsi->vdev_cc = imx7_csi_find_pixel_format(csi->vdev_fmt.pixelformat,\n+\t\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY);\n \n \treturn 0;\n }\n@@ -1466,8 +1974,8 @@ static int imx7_csi_init_cfg(struct v4l2_subdev *sd,\n \t\tstruct v4l2_mbus_framefmt *mf =\n \t\t\timx7_csi_get_format(csi, sd_state, i, which);\n \n-\t\tret = imx_media_init_mbus_fmt(mf, 800, 600, 0, V4L2_FIELD_NONE,\n-\t\t\t\t\t &csi->cc[i]);\n+\t\tret = imx7_csi_init_mbus_fmt(mf, 800, 600, 0, V4L2_FIELD_NONE,\n+\t\t\t\t\t &csi->cc[i]);\n \t\tif (ret < 0)\n \t\t\treturn ret;\n \t}\n@@ -1490,8 +1998,8 @@ static int imx7_csi_enum_mbus_code(struct v4l2_subdev *sd,\n \n \tswitch (code->pad) {\n \tcase IMX7_CSI_PAD_SINK:\n-\t\tret = imx_media_enum_mbus_formats(&code->code, code->index,\n-\t\t\t\t\t\t PIXFMT_SEL_ANY);\n+\t\tret = imx7_csi_enum_mbus_formats(&code->code, code->index,\n+\t\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY);\n \t\tbreak;\n \tcase IMX7_CSI_PAD_SRC:\n \t\tif (code->index != 0) {\n@@ -1536,12 +2044,74 @@ static int imx7_csi_get_fmt(struct v4l2_subdev *sd,\n \treturn ret;\n }\n \n+/*\n+ * Default the colorspace in tryfmt to SRGB if set to an unsupported\n+ * colorspace or not initialized. Then set the remaining colorimetry\n+ * parameters based on the colorspace if they are uninitialized.\n+ *\n+ * tryfmt->code must be set on entry.\n+ *\n+ * If this format is destined to be routed through the Image Converter,\n+ * Y`CbCr encoding must be fixed. The IC supports only BT.601 Y`CbCr\n+ * or Rec.709 Y`CbCr encoding.\n+ */\n+static void imx7_csi_try_colorimetry(struct v4l2_mbus_framefmt *tryfmt,\n+\t\t\t\t bool ic_route)\n+{\n+\tconst struct imx7_csi_pixfmt *cc;\n+\tbool is_rgb = false;\n+\n+\tcc = imx7_csi_find_mbus_format(tryfmt->code, IMX7_CSI_PIXFMT_SEL_ANY);\n+\tif (!cc)\n+\t\tcc = imx7_csi_find_ipu_format(tryfmt->code,\n+\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_YUV_RGB);\n+\n+\tif (cc && cc->cs == IPUV3_COLORSPACE_RGB)\n+\t\tis_rgb = true;\n+\n+\tswitch (tryfmt->colorspace) {\n+\tcase V4L2_COLORSPACE_SMPTE170M:\n+\tcase V4L2_COLORSPACE_REC709:\n+\tcase V4L2_COLORSPACE_JPEG:\n+\tcase V4L2_COLORSPACE_SRGB:\n+\tcase V4L2_COLORSPACE_BT2020:\n+\tcase V4L2_COLORSPACE_OPRGB:\n+\tcase V4L2_COLORSPACE_DCI_P3:\n+\tcase V4L2_COLORSPACE_RAW:\n+\t\tbreak;\n+\tdefault:\n+\t\ttryfmt->colorspace = V4L2_COLORSPACE_SRGB;\n+\t\tbreak;\n+\t}\n+\n+\tif (tryfmt->xfer_func == V4L2_XFER_FUNC_DEFAULT)\n+\t\ttryfmt->xfer_func =\n+\t\t\tV4L2_MAP_XFER_FUNC_DEFAULT(tryfmt->colorspace);\n+\n+\tif (ic_route) {\n+\t\tif (tryfmt->ycbcr_enc != V4L2_YCBCR_ENC_601 &&\n+\t\t tryfmt->ycbcr_enc != V4L2_YCBCR_ENC_709)\n+\t\t\ttryfmt->ycbcr_enc = V4L2_YCBCR_ENC_601;\n+\t} else {\n+\t\tif (tryfmt->ycbcr_enc == V4L2_YCBCR_ENC_DEFAULT) {\n+\t\t\ttryfmt->ycbcr_enc =\n+\t\t\t\tV4L2_MAP_YCBCR_ENC_DEFAULT(tryfmt->colorspace);\n+\t\t}\n+\t}\n+\n+\tif (tryfmt->quantization == V4L2_QUANTIZATION_DEFAULT)\n+\t\ttryfmt->quantization =\n+\t\t\tV4L2_MAP_QUANTIZATION_DEFAULT(is_rgb,\n+\t\t\t\t\t\t tryfmt->colorspace,\n+\t\t\t\t\t\t tryfmt->ycbcr_enc);\n+}\n+\n static int imx7_csi_try_fmt(struct imx7_csi *csi,\n \t\t\t struct v4l2_subdev_state *sd_state,\n \t\t\t struct v4l2_subdev_format *sdformat,\n-\t\t\t const struct imx_media_pixfmt **cc)\n+\t\t\t const struct imx7_csi_pixfmt **cc)\n {\n-\tconst struct imx_media_pixfmt *in_cc;\n+\tconst struct imx7_csi_pixfmt *in_cc;\n \tstruct v4l2_mbus_framefmt *in_fmt;\n \tu32 code;\n \n@@ -1552,8 +2122,8 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi,\n \n \tswitch (sdformat->pad) {\n \tcase IMX7_CSI_PAD_SRC:\n-\t\tin_cc = imx_media_find_mbus_format(in_fmt->code,\n-\t\t\t\t\t\t PIXFMT_SEL_ANY);\n+\t\tin_cc = imx7_csi_find_mbus_format(in_fmt->code,\n+\t\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_ANY);\n \n \t\tsdformat->format.width = in_fmt->width;\n \t\tsdformat->format.height = in_fmt->height;\n@@ -1567,13 +2137,13 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi,\n \t\tsdformat->format.ycbcr_enc = in_fmt->ycbcr_enc;\n \t\tbreak;\n \tcase IMX7_CSI_PAD_SINK:\n-\t\t*cc = imx_media_find_mbus_format(sdformat->format.code,\n-\t\t\t\t\t\t PIXFMT_SEL_ANY);\n+\t\t*cc = imx7_csi_find_mbus_format(sdformat->format.code,\n+\t\t\t\t\t\tIMX7_CSI_PIXFMT_SEL_ANY);\n \t\tif (!*cc) {\n-\t\t\timx_media_enum_mbus_formats(&code, 0,\n-\t\t\t\t\t\t PIXFMT_SEL_YUV_RGB);\n-\t\t\t*cc = imx_media_find_mbus_format(code,\n-\t\t\t\t\t\t\t PIXFMT_SEL_YUV_RGB);\n+\t\t\timx7_csi_enum_mbus_formats(&code, 0,\n+\t\t\t\t\t\t IMX7_CSI_PIXFMT_SEL_YUV_RGB);\n+\t\t\t*cc = imx7_csi_find_mbus_format(code,\n+\t\t\t\t\t\t\tIMX7_CSI_PIXFMT_SEL_YUV_RGB);\n \t\t\tsdformat->format.code = (*cc)->codes[0];\n \t\t}\n \n@@ -1584,7 +2154,7 @@ static int imx7_csi_try_fmt(struct imx7_csi *csi,\n \t\treturn -EINVAL;\n \t}\n \n-\timx_media_try_colorimetry(&sdformat->format, false);\n+\timx7_csi_try_colorimetry(&sdformat->format, false);\n \n \treturn 0;\n }\n@@ -1594,9 +2164,9 @@ static int imx7_csi_set_fmt(struct v4l2_subdev *sd,\n \t\t\t struct v4l2_subdev_format *sdformat)\n {\n \tstruct imx7_csi *csi = v4l2_get_subdevdata(sd);\n-\tconst struct imx_media_pixfmt *outcc;\n+\tconst struct imx7_csi_pixfmt *outcc;\n \tstruct v4l2_mbus_framefmt *outfmt;\n-\tconst struct imx_media_pixfmt *cc;\n+\tconst struct imx7_csi_pixfmt *cc;\n \tstruct v4l2_mbus_framefmt *fmt;\n \tstruct v4l2_subdev_format format;\n \tint ret = 0;\n", "prefixes": [ "libcamera-devel", "33/50" ] }