{"id":15883,"url":"https://patchwork.libcamera.org/api/patches/15883/?format=json","web_url":"https://patchwork.libcamera.org/patch/15883/","project":{"id":1,"url":"https://patchwork.libcamera.org/api/projects/1/?format=json","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-44-laurent.pinchart@ideasonboard.com>","date":"2022-05-10T11:51:40","name":"[libcamera-devel,43/50] staging: media: imx: imx7-media-csi: Inline imx7_csi_init_mbus_fmt()","commit_ref":null,"pull_url":null,"state":"not-applicable","archived":false,"hash":"166b6ebd7fb1c254c7c77d0371c1c77424b260c1","submitter":{"id":2,"url":"https://patchwork.libcamera.org/api/people/2/?format=json","name":"Laurent Pinchart","email":"laurent.pinchart@ideasonboard.com"},"delegate":null,"mbox":"https://patchwork.libcamera.org/patch/15883/mbox/","series":[{"id":3106,"url":"https://patchwork.libcamera.org/api/series/3106/?format=json","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/15883/comments/","check":"pending","checks":"https://patchwork.libcamera.org/api/patches/15883/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 51892C327B\n\tfor <parsemail@patchwork.libcamera.org>;\n\tTue, 10 May 2022 11:52:43 +0000 (UTC)","from lancelot.ideasonboard.com (localhost [IPv6:::1])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTP id EB056656BF;\n\tTue, 10 May 2022 13:52:42 +0200 (CEST)","from perceval.ideasonboard.com (perceval.ideasonboard.com\n\t[IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647])\n\tby lancelot.ideasonboard.com (Postfix) with ESMTPS id CB861656AB\n\tfor <libcamera-devel@lists.libcamera.org>;\n\tTue, 10 May 2022 13:52:33 +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 DEEDAD18;\n\tTue, 10 May 2022 13:52:32 +0200 (CEST)"],"DKIM-Signature":["v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org;\n\ts=mail; t=1652183562;\n\tbh=5+B/KoFU+IuzuNW1IpTkLULIo3A9NnPGy92kR6s1BuE=;\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=PDZIbxlv2tIjnh9X5DHN+jg+YQ1QaH1qPNV2Ln+F8+Rhd7i9v3dtv2zNFV1fRAD/M\n\tt+3xGf7U2drpgwQbS/9ZXi8EL2ZXHU5HL4LyFyHuRxL3fIGDRe1CqC3+2At7B3+XAs\n\tEveLNSHc0uxotzGUSqUapGMWBEewyKqXUULst4C2Kda78XoHcIIlpDrBlxI+/Nyv7+\n\t0dX/558LLsWlZlZkoFJwnO988+BKlbpU+rdjEA6dH0wE+BFohIzHykEzSrpofCMHwh\n\tG89rxgAYB72GRvJ+qwwGcDOk09plOLgRBwXMxF+qcUbi6RLgtoPIB54J5vMfs7Q7Ph\n\tz1w5bhEexot2Q==","v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com;\n\ts=mail; t=1652183553;\n\tbh=5+B/KoFU+IuzuNW1IpTkLULIo3A9NnPGy92kR6s1BuE=;\n\th=From:To:Cc:Subject:Date:In-Reply-To:References:From;\n\tb=FSW0S03MW8kpumA6nbL5gMweMoGFF8ioeBHmqH9LMACoLO8iLi6CweyYmXQvlQ964\n\tY3+6ybjOCLlLt2tFIp6HmvqGKDDSoGmcQo0Bvksp+rC4uzaTMyIxZqWMr+Q7Jj0I0C\n\tsog8/+X2Q2N8fFzRoweeEI4ldTA6a2MIRMz91nT8="],"Authentication-Results":"lancelot.ideasonboard.com; dkim=pass (1024-bit key; \n\tunprotected) header.d=ideasonboard.com\n\theader.i=@ideasonboard.com\n\theader.b=\"FSW0S03M\"; dkim-atps=neutral","To":"libcamera-devel@lists.libcamera.org","Date":"Tue, 10 May 2022 14:51:40 +0300","Message-Id":"<20220510115147.19360-44-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 43/50] staging: media: imx:\n\timx7-media-csi: Inline imx7_csi_init_mbus_fmt()","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":"Inline the imx7_csi_init_mbus_fmt() function in its only caller. This\nallows simplifying the code.\n\nSigned-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>\n---\n drivers/staging/media/imx/imx7-media-csi.c | 54 ++++++----------------\n 1 file changed, 15 insertions(+), 39 deletions(-)","diff":"diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c\nindex b3fa3e20873b..bc3a87656117 100644\n--- a/drivers/staging/media/imx/imx7-media-csi.c\n+++ b/drivers/staging/media/imx/imx7-media-csi.c\n@@ -1022,39 +1022,6 @@ static int imx7_csi_enum_mbus_formats(u32 *code, u32 index)\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\tcode = IMX7_CSI_DEF_MBUS_CODE;\n-\n-\tlcc = imx7_csi_find_mbus_format(code);\n-\tif (!lcc)\n-\t\treturn -EINVAL;\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->yuv,\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@@ -1738,18 +1705,27 @@ static int imx7_csi_init_cfg(struct v4l2_subdev *sd,\n \tconst enum v4l2_subdev_format_whence which =\n \t\tsd_state ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE;\n \tstruct imx7_csi *csi = v4l2_get_subdevdata(sd);\n-\tint ret;\n+\tconst struct imx7_csi_pixfmt *cc;\n \tint i;\n \n+\tcc = imx7_csi_find_mbus_format(IMX7_CSI_DEF_MBUS_CODE);\n+\n \tfor (i = 0; i < IMX7_CSI_PADS_NUM; i++) {\n \t\tstruct v4l2_mbus_framefmt *mf =\n \t\t\timx7_csi_get_format(csi, sd_state, i, which);\n \n-\t\tret = imx7_csi_init_mbus_fmt(mf, IMX7_CSI_DEF_PIX_WIDTH,\n-\t\t\t\t\t     IMX7_CSI_DEF_PIX_HEIGHT, 0,\n-\t\t\t\t\t     V4L2_FIELD_NONE, &csi->cc[i]);\n-\t\tif (ret < 0)\n-\t\t\treturn ret;\n+\t\tmf->code = IMX7_CSI_DEF_MBUS_CODE;\n+\t\tmf->width = IMX7_CSI_DEF_PIX_WIDTH;\n+\t\tmf->height = IMX7_CSI_DEF_PIX_HEIGHT;\n+\t\tmf->field = V4L2_FIELD_NONE;\n+\n+\t\tmf->colorspace = V4L2_COLORSPACE_SRGB;\n+\t\tmf->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(mf->colorspace);\n+\t\tmf->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(mf->colorspace);\n+\t\tmf->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(!cc->yuv,\n+\t\t\t\t\tmf->colorspace, mf->ycbcr_enc);\n+\n+\t\tcsi->cc[i] = cc;\n \t}\n \n \treturn 0;\n","prefixes":["libcamera-devel","43/50"]}