From patchwork Tue May 10 11:51:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Laurent Pinchart X-Patchwork-Id: 15883 Return-Path: X-Original-To: parsemail@patchwork.libcamera.org Delivered-To: parsemail@patchwork.libcamera.org Received: from lancelot.ideasonboard.com (lancelot.ideasonboard.com [92.243.16.209]) by patchwork.libcamera.org (Postfix) with ESMTPS id 51892C327B for ; Tue, 10 May 2022 11:52:43 +0000 (UTC) Received: from lancelot.ideasonboard.com (localhost [IPv6:::1]) by lancelot.ideasonboard.com (Postfix) with ESMTP id EB056656BF; Tue, 10 May 2022 13:52:42 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=libcamera.org; s=mail; t=1652183562; bh=5+B/KoFU+IuzuNW1IpTkLULIo3A9NnPGy92kR6s1BuE=; h=To:Date:In-Reply-To:References:Subject:List-Id:List-Unsubscribe: List-Archive:List-Post:List-Help:List-Subscribe:From:Reply-To:Cc: From; b=PDZIbxlv2tIjnh9X5DHN+jg+YQ1QaH1qPNV2Ln+F8+Rhd7i9v3dtv2zNFV1fRAD/M t+3xGf7U2drpgwQbS/9ZXi8EL2ZXHU5HL4LyFyHuRxL3fIGDRe1CqC3+2At7B3+XAs EveLNSHc0uxotzGUSqUapGMWBEewyKqXUULst4C2Kda78XoHcIIlpDrBlxI+/Nyv7+ 0dX/558LLsWlZlZkoFJwnO988+BKlbpU+rdjEA6dH0wE+BFohIzHykEzSrpofCMHwh G89rxgAYB72GRvJ+qwwGcDOk09plOLgRBwXMxF+qcUbi6RLgtoPIB54J5vMfs7Q7Ph z1w5bhEexot2Q== Received: from perceval.ideasonboard.com (perceval.ideasonboard.com [IPv6:2001:4b98:dc2:55:216:3eff:fef7:d647]) by lancelot.ideasonboard.com (Postfix) with ESMTPS id CB861656AB for ; Tue, 10 May 2022 13:52:33 +0200 (CEST) Authentication-Results: lancelot.ideasonboard.com; dkim=pass (1024-bit key; unprotected) header.d=ideasonboard.com header.i=@ideasonboard.com header.b="FSW0S03M"; dkim-atps=neutral Received: from pendragon.lan (62-78-145-57.bb.dnainternet.fi [62.78.145.57]) by perceval.ideasonboard.com (Postfix) with ESMTPSA id DEEDAD18; Tue, 10 May 2022 13:52:32 +0200 (CEST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=ideasonboard.com; s=mail; t=1652183553; bh=5+B/KoFU+IuzuNW1IpTkLULIo3A9NnPGy92kR6s1BuE=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=FSW0S03MW8kpumA6nbL5gMweMoGFF8ioeBHmqH9LMACoLO8iLi6CweyYmXQvlQ964 Y3+6ybjOCLlLt2tFIp6HmvqGKDDSoGmcQo0Bvksp+rC4uzaTMyIxZqWMr+Q7Jj0I0C sog8/+X2Q2N8fFzRoweeEI4ldTA6a2MIRMz91nT8= 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 Subject: [libcamera-devel] [PATCH 43/50] staging: media: imx: imx7-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: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Patchwork-Original-From: Laurent Pinchart via libcamera-devel From: Laurent Pinchart Reply-To: Laurent Pinchart Cc: Martin Kepplinger , kernel@pengutronix.de, Dorota Czaplejewicz , Alexander Stein , Rui Miguel Silva , Philipp Zabel , Steve Longerbeam Errors-To: libcamera-devel-bounces@lists.libcamera.org Sender: "libcamera-devel" Inline the imx7_csi_init_mbus_fmt() function in its only caller. This allows simplifying the code. Signed-off-by: Laurent Pinchart --- drivers/staging/media/imx/imx7-media-csi.c | 54 ++++++---------------- 1 file changed, 15 insertions(+), 39 deletions(-) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index b3fa3e20873b..bc3a87656117 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1022,39 +1022,6 @@ static int imx7_csi_enum_mbus_formats(u32 *code, u32 index) return -EINVAL; } -static int imx7_csi_init_mbus_fmt(struct v4l2_mbus_framefmt *mbus, - u32 width, u32 height, u32 code, u32 field, - const struct imx7_csi_pixfmt **cc) -{ - const struct imx7_csi_pixfmt *lcc; - - mbus->width = width; - mbus->height = height; - mbus->field = field; - - if (code == 0) - code = IMX7_CSI_DEF_MBUS_CODE; - - lcc = imx7_csi_find_mbus_format(code); - if (!lcc) - return -EINVAL; - - mbus->code = code; - - mbus->colorspace = V4L2_COLORSPACE_SRGB; - mbus->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(mbus->colorspace); - mbus->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(mbus->colorspace); - mbus->quantization = - V4L2_MAP_QUANTIZATION_DEFAULT(!lcc->yuv, - mbus->colorspace, - mbus->ycbcr_enc); - - if (cc) - *cc = lcc; - - return 0; -} - static int imx7_csi_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, const struct v4l2_mbus_framefmt *mbus, const struct imx7_csi_pixfmt *cc) @@ -1738,18 +1705,27 @@ static int imx7_csi_init_cfg(struct v4l2_subdev *sd, const enum v4l2_subdev_format_whence which = sd_state ? V4L2_SUBDEV_FORMAT_TRY : V4L2_SUBDEV_FORMAT_ACTIVE; struct imx7_csi *csi = v4l2_get_subdevdata(sd); - int ret; + const struct imx7_csi_pixfmt *cc; int i; + cc = imx7_csi_find_mbus_format(IMX7_CSI_DEF_MBUS_CODE); + for (i = 0; i < IMX7_CSI_PADS_NUM; i++) { struct v4l2_mbus_framefmt *mf = imx7_csi_get_format(csi, sd_state, i, which); - ret = imx7_csi_init_mbus_fmt(mf, IMX7_CSI_DEF_PIX_WIDTH, - IMX7_CSI_DEF_PIX_HEIGHT, 0, - V4L2_FIELD_NONE, &csi->cc[i]); - if (ret < 0) - return ret; + mf->code = IMX7_CSI_DEF_MBUS_CODE; + mf->width = IMX7_CSI_DEF_PIX_WIDTH; + mf->height = IMX7_CSI_DEF_PIX_HEIGHT; + mf->field = V4L2_FIELD_NONE; + + mf->colorspace = V4L2_COLORSPACE_SRGB; + mf->xfer_func = V4L2_MAP_XFER_FUNC_DEFAULT(mf->colorspace); + mf->ycbcr_enc = V4L2_MAP_YCBCR_ENC_DEFAULT(mf->colorspace); + mf->quantization = V4L2_MAP_QUANTIZATION_DEFAULT(!cc->yuv, + mf->colorspace, mf->ycbcr_enc); + + csi->cc[i] = cc; } return 0;