From patchwork Wed Mar 9 11:41:37 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12774980 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2E3B6C433EF for ; Wed, 9 Mar 2022 11:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=37jy4RHFgV8mSLngJBvo+Caxx1BUQECg+abmOV5UfuQ=; b=yiJftBaMyQKttQ 5OLbDh6moAB18enmUv962oby0J2owV/u8FjbiOZQ/TpoR3bBnGCKgoNKBAnQyP8BEhCuXLrWqTl7v +a9khxFoZUEthLEv2b/QBfCJhIlmTbrY7XwXV4zphDY3nHvrgQ/RYXk4s3zkKEKe+TUg7Pe8gg9jf RhG7KIgnlRmGG6PqtkyrPI4Vs86lIWTUwC8ltrSxGjiNcIejCkmk/eAFq7IIIdcW9BHKOftEIpvKQ kfKq7Lfls0XlJgM5rQ3nLulxrdUu97EdrfISUAOsPeDtvu6/nYFHqiyYwoPtzNoTSS8rGT0GnP20P 5qijYstxXifXJs0k/PAg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuhr-008LHu-Po; Wed, 09 Mar 2022 11:42:16 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuhY-008L7c-1Z for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 11:41:57 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826116; x=1678362116; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iQV1eFvLFnbtYXiohQguMMYHg/6BrzAOmBAwDo+NsSQ=; b=ArFHL16yBP4M1vnEUKkpQmON/61WQzLeuKAiReh0Xnhmz4HblI6l36TC BRwBeFvyGtxzhES2TiWzT972JXn6Elk0ZtMKxvV9OZgG4S9yznnruFrww 67D1VPCBM0xZWicBkL8AXqlXWY4q9QX5h4RiYD6Q75HWUKo0LWLdkfMP0 PugZUXV3z3ICSy1pko7a64bKWpVl17FdTrgX+pSYtcrpbd8PbVhPSUHWg rYwmRFkATrD6wc2/ZegFIKa2oR9G7Tx5X8wucFYbMblRqb74WkcHJdl0z gJ132UgeKzUWopiHrWmV7uc+0gih7hSVkIsE/8a8IBeD8FQe9cgUArv6w Q==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553360" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 09 Mar 2022 12:41:53 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 09 Mar 2022 12:41:53 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 09 Mar 2022 12:41:53 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826113; x=1678362113; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=iQV1eFvLFnbtYXiohQguMMYHg/6BrzAOmBAwDo+NsSQ=; b=A/7CwhzKtDJcGQApxKWf8citvm50Yn1t5luGVtK1LnGFEsHdnPbjSDRZ 8bln4Y+86QzKZloVo0n/rRwgmGICnIhMVzhDpVgnEwirilazQfQyhqWYL X8mg0WYZ+0uqpxa8EucfykF8UZH2oJ3Uo1EwmXeFsmlu8eagTx7qfHVyh h31pLHeZslcRuTdHuMLrNUSxyiylq+f5V6+geOsi/qtxRfnNep+BLEk9J UbtKfLpGJ7F4jGIwT/Ow68L7Trt3JKK9I0yggAEnpvxXdUdJ/BVtKMez/ J7uCwM6Gfuw9xTIYJJfz/fX3ylsZ9EaZ2I3g5y5KEQcpDRK4DOUQ09m5s w==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553359" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 09 Mar 2022 12:41:53 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 35C16280075; Wed, 9 Mar 2022 12:41:53 +0100 (CET) From: Alexander Stein To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Laurent Pinchart , Dorota Czaplejewicz Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexander Stein Subject: [PATCH v3 1/8] media: imx: Store the type of hardware implementation Date: Wed, 9 Mar 2022 12:41:37 +0100 Message-Id: <20220309114144.120643-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> References: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_034156_437031_8FB607C4 X-CRM114-Status: GOOD ( 18.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Dorota Czaplejewicz The driver covers i.MX5/6, as well as i.MX7/8 hardware. Those implementations differ, e.g. in the sizes of buffers they accept. Some functionality should be abstracted, and storing type achieves that. Note: This is a temporary solution until the imx7-media-csi driver gets decoupled from the helpers shared with the i.MX6 implementation, and should be reverted once this happens. Signed-off-by: Dorota Czaplejewicz Signed-off-by: Alexander Stein Reviewed-by: Laurent Pinchart --- Changes in v3: * Added note this change shall be reverted later on * Add R-b Laurent Pinchart drivers/staging/media/imx/imx-ic-prpencvf.c | 3 ++- drivers/staging/media/imx/imx-media-capture.c | 5 ++++- drivers/staging/media/imx/imx-media-csi.c | 3 ++- drivers/staging/media/imx/imx-media.h | 8 +++++++- drivers/staging/media/imx/imx7-media-csi.c | 3 ++- 5 files changed, 17 insertions(+), 5 deletions(-) diff --git a/drivers/staging/media/imx/imx-ic-prpencvf.c b/drivers/staging/media/imx/imx-ic-prpencvf.c index 9b81cfbcd777..671bb9a681aa 100644 --- a/drivers/staging/media/imx/imx-ic-prpencvf.c +++ b/drivers/staging/media/imx/imx-ic-prpencvf.c @@ -1266,7 +1266,8 @@ static int prp_registered(struct v4l2_subdev *sd) priv->vdev = imx_media_capture_device_init(ic_priv->ipu_dev, &ic_priv->sd, - PRPENCVF_SRC_PAD, true); + PRPENCVF_SRC_PAD, true, + DEVICE_TYPE_IMX56); if (IS_ERR(priv->vdev)) return PTR_ERR(priv->vdev); diff --git a/drivers/staging/media/imx/imx-media-capture.c b/drivers/staging/media/imx/imx-media-capture.c index 93ba09236010..65dc95a48ecc 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -34,6 +34,7 @@ struct capture_priv { struct imx_media_video_dev vdev; /* Video device */ struct media_pad vdev_pad; /* Video device pad */ + enum imx_media_device_type type; /* Type of hardware implementation */ struct v4l2_subdev *src_sd; /* Source subdev */ int src_sd_pad; /* Source subdev pad */ @@ -957,7 +958,8 @@ EXPORT_SYMBOL_GPL(imx_media_capture_device_unregister); struct imx_media_video_dev * imx_media_capture_device_init(struct device *dev, struct v4l2_subdev *src_sd, - int pad, bool legacy_api) + int pad, bool legacy_api, + enum imx_media_device_type type) { struct capture_priv *priv; struct video_device *vfd; @@ -972,6 +974,7 @@ imx_media_capture_device_init(struct device *dev, struct v4l2_subdev *src_sd, priv->src_sd_pad = pad; priv->dev = dev; priv->legacy_api = legacy_api; + priv->type = type; mutex_init(&priv->mutex); INIT_LIST_HEAD(&priv->ready_q); diff --git a/drivers/staging/media/imx/imx-media-csi.c b/drivers/staging/media/imx/imx-media-csi.c index b2b1f4dd41d7..0f8943475fa8 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -1804,7 +1804,8 @@ static int csi_registered(struct v4l2_subdev *sd) } priv->vdev = imx_media_capture_device_init(priv->sd.dev, &priv->sd, - CSI_SRC_PAD_IDMAC, true); + CSI_SRC_PAD_IDMAC, true, + DEVICE_TYPE_IMX56); if (IS_ERR(priv->vdev)) { ret = PTR_ERR(priv->vdev); goto free_fim; diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h index f263fc3adbb9..e4c22b3ccd57 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -96,6 +96,11 @@ enum imx_pixfmt_sel { PIXFMT_SEL_ANY = PIXFMT_SEL_YUV | PIXFMT_SEL_RGB | PIXFMT_SEL_BAYER, }; +enum imx_media_device_type { + DEVICE_TYPE_IMX56, + DEVICE_TYPE_IMX78, +}; + struct imx_media_buffer { struct vb2_v4l2_buffer vbuf; /* v4l buffer must be first */ struct list_head list; @@ -282,7 +287,8 @@ int imx_media_ic_unregister(struct v4l2_subdev *sd); /* imx-media-capture.c */ struct imx_media_video_dev * imx_media_capture_device_init(struct device *dev, struct v4l2_subdev *src_sd, - int pad, bool legacy_api); + int pad, bool legacy_api, + enum imx_media_device_type type); void imx_media_capture_device_remove(struct imx_media_video_dev *vdev); int imx_media_capture_device_register(struct imx_media_video_dev *vdev, u32 link_flags); diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index 8467a1491048..cf74960dee84 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1063,7 +1063,8 @@ static int imx7_csi_registered(struct v4l2_subdev *sd) } csi->vdev = imx_media_capture_device_init(csi->sd.dev, &csi->sd, - IMX7_CSI_PAD_SRC, false); + IMX7_CSI_PAD_SRC, false, + DEVICE_TYPE_IMX78); if (IS_ERR(csi->vdev)) return PTR_ERR(csi->vdev); From patchwork Wed Mar 9 11:41:38 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12774979 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4E9D7C433FE for ; Wed, 9 Mar 2022 11:43:37 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=mGGBOiyUq9WEgMEx11uRN6WDE9cu35JgLu9FeiKWg2k=; b=rOjSu1NORMXX4M WDGxsK89VHfm/1FY5NZwLvn8mHvibo5KlcK96rNEdT68jZxMV9CMXt56V6iI9MFs2H8gD/1s06JUr BGoMQlgE5luXaqKbHkmvhsapsKH2JgBFCqdfreH+uC63WudymBhHC9Zya8jRCj4Uh3z6mzTHBmzXl yAoVXUx2spGmIfLIlUdmgqdYJuOumdJd7BM1gVFW71GrEV0ZQoFBxnhLBFz5DnmuHP7O1pk7Ztd4f fdj8qnMpoH5h8td9dWnaZCErWyGUAel68YgJIYCEDb39hOZKoqR2tuAZd3ftkfbmxxPxe8CP/SvkZ 6KukYKqhdD56XwOlhhDA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRui4-008LNC-Cr; Wed, 09 Mar 2022 11:42:28 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuhZ-008L7w-AA for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 11:41:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826117; x=1678362117; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3KJ+O3nYPIihhIJRWVWC0Ti5XvYqw22h8GOfUjQMO6g=; b=RqYeDzGPLAkgSxyfgbrupWLPhlyUmPj2DJtsNaHbyNwSACxHKPlpZpur 82pnpEtCadvk7HaccQS8lRwyG4Qq/b95ILSIJX1NpOxet+E3Z77QK0lYy LxKZgpwegyvfVnV8oDcttm+PkOg0Jp6AwOKMqjgwnNK74d56hvpD9FmB/ BiofGWmhBWU1WN2A/46BTdI8kifYY79/lbnq+kDM0pnAjXIpQ+S0R9Okg jztP58q26MqdVTo1O243U6KE4Uep2vjOUtgdGEzajrkwLCHW911mpsPke Jhk/mDvAyxFS51DGuStwg5gAUbkpJ/In6oJwO66udrHMFrLJXM37AZL2D Q==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553362" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 09 Mar 2022 12:41:53 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 09 Mar 2022 12:41:54 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 09 Mar 2022 12:41:54 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826114; x=1678362114; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=3KJ+O3nYPIihhIJRWVWC0Ti5XvYqw22h8GOfUjQMO6g=; b=MoV0fOnBB/Pbka/c+R3xkAE3pMxhNflkz11Zhv8Vpkxl9MJR96oGmH9f aBI+m2SKAE/Fdsnw16bDxgpVU6pdFtHUUZzPGpuwjb3rBDv4GhwBzyqFF JE0rllsbm88mhnCj1Webz6gISDUtGnnsKtvifpl/ZUDqzQsR1FKtoAtyW 4fc+dtfchXurYZXCKYdVFIgWGv8gGeYy/o0aBvOKXdGudOSYd+K/CU5fl 8GLpttv5K0ILhPbPpaurbusSrSUQwWAnTwNt//Gm+StZpv8uWhMcyWryN +Ff4hLWwXqRILwlpK/DDXbOY4X11ARpsCDONx5dD0LcSJ2KYlsT5c2yIe Q==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553361" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 09 Mar 2022 12:41:53 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 88D4E280065; Wed, 9 Mar 2022 12:41:53 +0100 (CET) From: Alexander Stein To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Laurent Pinchart , Dorota Czaplejewicz Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexander Stein Subject: [PATCH v3 2/8] media: imx: Forward type of hardware implementation Date: Wed, 9 Mar 2022 12:41:38 +0100 Message-Id: <20220309114144.120643-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> References: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_034157_694248_5C0E327D X-CRM114-Status: GOOD ( 16.18 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Dorota Czaplejewicz Pass down the hardware type so imx_media_mbus_fmt_to_pix_fmt can do the actual switch. Signed-off-by: Dorota Czaplejewicz Reviewed-by: Laurent Pinchart Signed-off-by: Alexander Stein --- Changes in v3: * None 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 94bc866ca28c..c42f3da8e3a8 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 e4c22b3ccd57..f59feccb26bf 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 * From patchwork Wed Mar 9 11:41:39 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12774981 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id F417AC433F5 for ; Wed, 9 Mar 2022 11:43:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IbWgf7Utf8FR2lmG0k8FzRw/Qk4BxObXX2LHUflkx+A=; b=BAknWX5uTPVMyc xr419XQ+rYBYmxZgX0Rzko+fkcKusWFDC/1Ap46KPeny6I3sKxB84KTLhM/ygJFvME0aEEfgysWgs zvl2Z3JDrtE/gSMCCmI4Ex8bzhPUWJ1oTK/PPz9yhA3ifu9bwWkQLSleJIeeYcHFLhVO1Wvd82tNr o6ou6TRibugcX7fgRMfea3iU0CQg7MW/fBlSJl9wbsFIrvuHhwH16LYEYQz25NEEwGE6vfHmRVi4d 5AbZJb1wKImuukqsHRY2JjqIaiAKCBfQC99L1893fTIGqRYkyg3mpNCRUzmSUiqhenE1XMknQkRQD mRa8BHmKI0027WNGdrEw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuiF-008LSU-9N; Wed, 09 Mar 2022 11:42:39 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuhZ-008L7T-W6 for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 11:41:59 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826118; x=1678362118; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ph86NPcPjwy0dX+EuR++GKI6JItrpTnVEStlCLpR8Qc=; b=ZH7F3/99L3xHDww82lSBm3mr8FIhmEq1DbkQTu6GNmgios1IX3csgKj9 a8uWuzloPgWqL8/khYi4m0B01wvlfuTfWcn31uP9JP7PD4gSHi4skmMey 3288OYNUvFbDyNrN932LkjrnS3pc4/G3QbGOHgnjmwU98RZmveESZzgZ0 KyF4ZRQhzo/jamGVk1jckEB6bgSrrh29QHatTKHPs8xl7UkFGhKGO+kRG ukrj3n1ZZhZRlJgjRzNFD9g2Lh4PrtwTtikSG+27Z3WUY6aPWq5KOz6H1 eW2IvHws+u6YFdpCJxXoCh2ESl6rLzIgFuHfX8+SEL2Sa1u2lEYOz7fA7 w==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553364" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 09 Mar 2022 12:41:54 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 09 Mar 2022 12:41:54 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 09 Mar 2022 12:41:54 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826114; x=1678362114; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=ph86NPcPjwy0dX+EuR++GKI6JItrpTnVEStlCLpR8Qc=; b=Y+TveUuPEwAHyiHEqma0068gJcoyzzm3LeFBPQ+atB4Tl1msJBzEm7Lz VNXIfUj4RyNf8g9Zp8WZLBAWMlKEgqBYeTtDix5KpZeaLEHgKLqDVkA1X dFmgBx+oRMvzSrCBLEkIrSGvzRpY+vX+TJeK1mYPAULkcdra5DfxBJXyb L2aciMI6iHLWdZrSDQj72yxE2egz3Ib8TAZS+EQIeMR1XrxPrbvj9VYy+ BK2Nj/+1GFYyecoLHv52SHY+3r1u+XWoYRVyjFlTtUTL72oh+Rfy6bmwq hBfZYAmwnRd3vedZKxT7N7i3nFLru6nqGCCjbdWZO4z33eEqF8KynkeTg Q==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553363" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 09 Mar 2022 12:41:54 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id D13A7280075; Wed, 9 Mar 2022 12:41:53 +0100 (CET) From: Alexander Stein To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Laurent Pinchart , Dorota Czaplejewicz Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexander Stein Subject: [PATCH v3 3/8] media: imx: Use dedicated format handler for i.MX7/8 Date: Wed, 9 Mar 2022 12:41:39 +0100 Message-Id: <20220309114144.120643-4-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> References: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_034158_407891_FD93E8B9 X-CRM114-Status: GOOD ( 18.13 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Dorota Czaplejewicz This splits out a format handler which takes into account the capabilities of the i.MX7/8 video device, as opposed to the default handler compatible with both i.MX5/6 and i.MX7/8. Signed-off-by: Dorota Czaplejewicz Signed-off-by: Alexander Stein --- Changes in v3: * Fixed bbp check (This driver uses bits per pixel, not bytes per pixel) drivers/staging/media/imx/imx-media-utils.c | 60 +++++++++++++++++++-- 1 file changed, 56 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index c42f3da8e3a8..0534f7746cb3 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -516,10 +516,9 @@ void imx_media_try_colorimetry(struct v4l2_mbus_framefmt *tryfmt, } 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, - enum imx_media_device_type type) +static int imx56_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, + const struct v4l2_mbus_framefmt *mbus, + const struct imx_media_pixfmt *cc) { u32 width; u32 stride; @@ -568,6 +567,59 @@ int imx_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, return 0; } + +static int imx78_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, + const struct v4l2_mbus_framefmt *mbus, + const struct imx_media_pixfmt *cc) +{ + u32 aligned_width; + int ret; + + if (!cc) + cc = imx_media_find_mbus_format(mbus->code, PIXFMT_SEL_ANY); + + if (!cc) + return -EINVAL; + /* + * The hardware can handle line lengths divisible by 4 pixels + * as long as the whole buffer size ends up divisible by 8 bytes. + * If not, use the value of 8 pixels recommended in the datasheet. + * Only 8bits-per-pixel formats may need to get aligned to 8 pixels, + * because both 10-bit and 16-bit pixels occupy 2 bytes. + * In those, 4-pixel aligmnent is equal to 8-byte alignment. + */ + if (cc->bpp == 8) + aligned_width = round_up(mbus->width, 8); + else + aligned_width = round_up(mbus->width, 4); + + ret = v4l2_fill_pixfmt(pix, cc->fourcc, + aligned_width, mbus->height); + if (ret) + return ret; + + pix->colorspace = mbus->colorspace; + pix->xfer_func = mbus->xfer_func; + pix->ycbcr_enc = mbus->ycbcr_enc; + pix->quantization = mbus->quantization; + pix->field = mbus->field; + + return ret; +} + +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, + enum imx_media_device_type type) +{ + switch (type) { + case DEVICE_TYPE_IMX56: + return imx56_media_mbus_fmt_to_pix_fmt(pix, mbus, cc); + case DEVICE_TYPE_IMX78: + return imx78_media_mbus_fmt_to_pix_fmt(pix, mbus, cc); + } + return -EINVAL; +} EXPORT_SYMBOL_GPL(imx_media_mbus_fmt_to_pix_fmt); void imx_media_free_dma_buf(struct device *dev, From patchwork Wed Mar 9 11:41:40 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12774982 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id CA000C433F5 for ; Wed, 9 Mar 2022 11:44:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=IXTevd7/gJGmksBD9oQh01806OWXpOmHJEyZhpDj/9E=; b=E5vP327Jmw20iv CcL6Cd8R8hGsERiJmLtM0wNx9WJqtAIvygoNCyOIh+qNzu+hyQ2jYhqp3OTr3vivOsRIdAfEk/sfX DahsHRnef8qkWrUikZbZ39Jv29MTLDhugjv+VrDuB2mtEjmQijVnL0EPjcMF3o59Pl2bxo/g/Jn1N 5C2rIc+cdA+mnMMGVKLcUukFK6K9p9stjDa9tYQAdng91Yr/vgLndx1vyLdIqA2LOkyRnlbJ1uvh9 AHRWnPQfF1zG6vgpwHcMAaxuVlEQCDGnHGT0oFEZeIR3F26/uaauC+39Nt+0pIFG8y3efn+qgYlnE 9LeqRQ6enALHFnA4M2JQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuiV-008LYE-E4; Wed, 09 Mar 2022 11:42:55 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuha-008L7c-Cu for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 11:42:00 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826118; x=1678362118; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W7ZlPSFo+FHjKYpXGX7Y0kh08F+NDUeJwlxNFhiBxYg=; b=nYjXJZOpjkAehrCl44VZ+E4T7rAq3WFsjVzx45fVGXhSK4Mf5EJsrm20 dJPYin4+HFnYvezOpxYIh3b3nT3UZ6SxNSnQKS53eU/skeqD7juMhyw/T mufPgQ+AXjRSi9wf96faYq/ruJXPnvevjlFgZzQ8zULgTfRHXCsl74wxf lmQHK/GiURnqFj7Pd2J52YGpgGBg6dIN1TppXte842JU9fjaCQSANB7Nn 1ek32qIa1h1Or4cgAdjtgPy+dlAitu79bcO+ip/soirY0ew9lxPrX7bkU YTxkxLRqbZKInA/VwF1wF543CqnASUU0PutUi4MF8RYLDB/3TKwXdaLzO w==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553366" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 09 Mar 2022 12:41:54 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 09 Mar 2022 12:41:54 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 09 Mar 2022 12:41:54 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826114; x=1678362114; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=W7ZlPSFo+FHjKYpXGX7Y0kh08F+NDUeJwlxNFhiBxYg=; b=TXMtn1w+93cbVArP26iR/6Rr1XuyI0vb4B3lQZ685fIL5jeyx1lsjyW6 FS8z6TF7NVWVMb7zyJdxdvo9DlhQ8YjRaazu/Vs3rzZuld2hn4tDwLMEf bwAqNBNwhQxqzg2TCKX+T1yhhIEXUycJHHw8VqCAooXiE877mfh9mazsb 8dZRgDj4Rh94iSG7dK+KwwIotdg8c/UvuHdyWg7ZeHtsrOPhNBj/2cRGS L5cKGEsvE6hl+rZ8RphatYNdtmEY3rsZb4mrLlurD1fcWGppToo2z0MND TUci5Xg/3Z34wTLNRbN9xQqZr0PTp0r7dgWoAN3A7Te5ILzS+spsPyM9P w==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553365" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 09 Mar 2022 12:41:54 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 3F29C280078; Wed, 9 Mar 2022 12:41:54 +0100 (CET) From: Alexander Stein To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Laurent Pinchart , Dorota Czaplejewicz Cc: linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Alexander Stein Subject: [PATCH v3 4/8] media: imx: Fail conversion if pixel format not supported Date: Wed, 9 Mar 2022 12:41:40 +0100 Message-Id: <20220309114144.120643-5-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> References: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_034158_787383_F17ACAF4 X-CRM114-Status: GOOD ( 14.11 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org From: Dorota Czaplejewicz imx_media_find_mbus_format has NULL as a valid return value, therefore the caller should take it into account. Signed-off-by: Dorota Czaplejewicz Signed-off-by: Alexander Stein Reviewed-by: Laurent Pinchart --- Changes in v3: * Added R-b Laurent Pinchart drivers/staging/media/imx/imx-media-utils.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index 0534f7746cb3..0152bbcc5150 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -544,6 +544,9 @@ static int imx56_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, cc = imx_media_find_mbus_format(code, PIXFMT_SEL_YUV); } + if (!cc) + return -EINVAL; + /* Round up width for minimum burst size */ width = round_up(mbus->width, 8); From patchwork Wed Mar 9 11:41:41 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12774983 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 6C738C433EF for ; Wed, 9 Mar 2022 11:44:41 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=xY6gt4NJC1Rx0mMok5K/BDUK8w8YjI+tmfQOMY3v54o=; b=oRYXXPcfY957li psMS+mV1RLzs+LOdlKRM8g1FuJCk1xAqfC0RqNyUJv6p8raz1XbmL6bqpOOJcoJniTh/gaaBZCz9+ q8WBiblYQBjcN2vwzJ9Xnra0wwAFh4I8Q1YJKKJIGzUin0xs4p786yB2iLA+yddl/HQDbuRAnof3C /rVN3UxdBqMq0LJKkyJSQljPPXORNH0rhkiB5IXmQ78IG9dORYO1Q67UwUs/mkvul6Rs4a+5tisnQ 3zFNCJ7DBv5fN3mg4re9zy9hQlrwxzh91QojQxxoPjvJSXuPqTyvwr7DVuGtCaD+T+JADx+YDTzTC Hw2XzvhfPz7onWvzlacw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuit-008LkD-Oq; Wed, 09 Mar 2022 11:43:20 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuhb-008L7w-So for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 11:42:01 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826119; x=1678362119; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I6uwATuL3tKTw+K0ri808hGGwFUskusS0kkKf0Pf/D4=; b=F0xwruin8SNgAe8HidCUc6gpcUDQES82/XspBBkv9jBKetgxIGtjPvtF piXUdxKUeOdUtrOCsTk45O5hHcqhPzSv4Eu9oSmbpMi3lwL3d/jZdQbFM eyZTGRFKAB4yT+xBexu1/KEPpsbUdGVLI1RI9t5iLUcks8aJYFTkxVlJj IV1dzAeiT6LHejzmXb3vnWgN7OpIGUQMoDaNCOUCc/0GUBXDf6j26oIJ0 2j8pMcqzod5t0IdMyl+Bi8RFATR0D9JM9iuG1XaH9UYEaav2T3FoiAiu5 k60IR4j2gRbKdZoXAw7rihIJEPAtFo6L6WQkvQgVdBhgFtwkWtUzuiGev Q==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553368" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 09 Mar 2022 12:41:55 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 09 Mar 2022 12:41:55 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 09 Mar 2022 12:41:55 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826115; x=1678362115; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=I6uwATuL3tKTw+K0ri808hGGwFUskusS0kkKf0Pf/D4=; b=OSNQsC6dTSk/e0zpm47Utavx3zPN5JAqwnRQCudbItqmXUrtCdnLXIc3 aPjutrvsWGRSBLvthKke3HSP82/CoszxqFemCz9oNrfgnQqZsTILKFXYl LYaxCJyogOCxDGByC7gvpwh/oSg3G0olyIYLDoha7rY5I4/qundmzmk9+ yePakVEnFzbzQuEXNwvcWh1yha3N+HMPT0BxJN/GMNIIL4onAXo9zqJN5 bDD4BeatEocGe7hQVwlOKxR2lsMpX/uU9GcBwOw3gKHSfXjGwMKUaQAMl dLA+LxlUlATwqYh769YQjAxtsRTBrorpfK5Hsg6JKhIo98B4kUwiiRE4p A==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553367" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 09 Mar 2022 12:41:54 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id A8A5C280065; Wed, 9 Mar 2022 12:41:54 +0100 (CET) From: Alexander Stein To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Laurent Pinchart , Dorota Czaplejewicz Cc: Alexander Stein , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 5/8] media: imx: imx7_media-csi: Add support for additional Bayer patterns Date: Wed, 9 Mar 2022 12:41:41 +0100 Message-Id: <20220309114144.120643-6-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> References: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_034200_264874_C8C0A164 X-CRM114-Status: GOOD ( 11.84 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org imx7_csi_configure() allows configuring these Bayer patterns when starting a stream. So allow these in link_validate() as well. Reviewed-by: Laurent Pinchart Signed-off-by: Alexander Stein --- Changes in v3: * None drivers/staging/media/imx/imx7-media-csi.c | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/drivers/staging/media/imx/imx7-media-csi.c b/drivers/staging/media/imx/imx7-media-csi.c index cf74960dee84..82627bd0c9ed 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1028,6 +1028,18 @@ static int imx7_csi_pad_link_validate(struct v4l2_subdev *sd, case V4L2_PIX_FMT_SGBRG8: case V4L2_PIX_FMT_SGRBG8: case V4L2_PIX_FMT_SRGGB8: + case V4L2_PIX_FMT_SBGGR10: + case V4L2_PIX_FMT_SGBRG10: + case V4L2_PIX_FMT_SGRBG10: + case V4L2_PIX_FMT_SRGGB10: + case V4L2_PIX_FMT_SBGGR12: + case V4L2_PIX_FMT_SGBRG12: + case V4L2_PIX_FMT_SGRBG12: + case V4L2_PIX_FMT_SRGGB12: + case V4L2_PIX_FMT_SBGGR14: + case V4L2_PIX_FMT_SGBRG14: + case V4L2_PIX_FMT_SGRBG14: + case V4L2_PIX_FMT_SRGGB14: case V4L2_PIX_FMT_SBGGR16: case V4L2_PIX_FMT_SGBRG16: case V4L2_PIX_FMT_SGRBG16: From patchwork Wed Mar 9 11:41:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12774984 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id EF659C433EF for ; Wed, 9 Mar 2022 11:45:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=bBUAn6lvkBzmCelQQt+dV32mbuZUnWLolEYjmsUiMEA=; b=fu91gQl9GXrg4s eRGchF6DOL20MFsNUNVkvYc/B6933V+2WrfODKD7JGFoRHu+wyZYlZNWpkvm1B+hqYMdp65B/sntv WuR74n4GT+Fli3JoHkbu3SWHjf7t5n0NzV0CG885KkWDzvnqUyBDJjw+RPHHs90n7mPT1IA8MqgEY xes/bGc+VHMkE/tCxL3M9lMHvf8szjBa5lNvrFl0I6EY4lxzPA4KjI4jfgnznVE7S7lqtzj1Fhwpt 3mcim0nM1mfWj3dx1sloMB8fjKfYduuxJXQboh00xh0SXomFt2y9DcNCHA3FAhYKhFqTOgKbez3pP HTNgcHeV5vt/cGTvxl7Q==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRujE-008Lts-HQ; Wed, 09 Mar 2022 11:43:41 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuhc-008L7T-8y for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 11:42:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826120; x=1678362120; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T4YRDfFcrypsN9W2qi4iowIurInzo1YRPeKZxqXyGsk=; b=l3CLAjXYvy5ppUYjzzMBN9i8FkbMS9YBJnVSgZFraqi6+UFS6hFGx5gt a0Cga9ZPsM6+kyb9pka//xeNt3QqBPopVBDghiyMt6TnPp03jFEJSGCMY RD7WzOJRcU48SoCkGGb9jmSAvNYtoPZImWqZJ5OIGLYvpPLaVElKMNKsj X9JKaKHKNGJhoHOa40haiPjK+lRPTBuejCR8s7cPynwXVy2umVBAM3Oyr Vj0VTMnhAPXAdOkT2KFEK+bgW56ubWiks3WMxoxtNy2BYJhYKI8/Ku/C1 lLaD2q+3mTzNob/Lx7CRL89EMIDnAFX9QoXATwQM4mNFvLDY4YsMkxK7z A==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553370" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 09 Mar 2022 12:41:55 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 09 Mar 2022 12:41:55 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 09 Mar 2022 12:41:55 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826115; x=1678362115; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=T4YRDfFcrypsN9W2qi4iowIurInzo1YRPeKZxqXyGsk=; b=MqDLgsmXxGLsVNwFRYxqjIqhXLzhQXFhNu8iTRbdIO7Q0CWTAWTyFjtd 6UkgWXAB04m/ii+1j2tcaWuHp0gqarh5m4UR7s/nXi3AbLIQq+8kIAVBM nZPOpQAkdRCA6DAE1IRGP4rvtA3MyRT73cWt9Nz1SyKmO9UXDGjJFRLWB UY0g/y0bt4GzrAyx+ZTFX8HO0J/QqXQ9LD7OFsS1AReT9BX35yuPzMuAF plkt43XJvJHlYhO+O4ftNdK1DbYTNDsTrjvqnfep8yGcNc/iLm2cHUj6Q 9PRf+q3o+J5rFocoXDGpYvrMTOOu32Ms50Dd3BD/N6nsutlV2QXE28gBE w==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553369" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 09 Mar 2022 12:41:55 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id EF933280075; Wed, 9 Mar 2022 12:41:54 +0100 (CET) From: Alexander Stein To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Laurent Pinchart , Dorota Czaplejewicz Cc: Alexander Stein , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 6/8] media: imx: utils: Add more Bayer formats Date: Wed, 9 Mar 2022 12:41:42 +0100 Message-Id: <20220309114144.120643-7-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> References: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_034200_675149_02BCDAD3 X-CRM114-Status: GOOD ( 13.17 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Without this the ioctl VIDIOC_ENUM_FMT will not list the 10/12/14-Bit Bayer formats. This in return results in "v4l2-ctl --set-fmt-video pixelformat='RG10'" failing to set the pixelformat. Reviewed-by: Laurent Pinchart Signed-off-by: Alexander Stein --- Changes in v3: * None drivers/staging/media/imx/imx-media-utils.c | 72 +++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index 0152bbcc5150..e69bbe0d6c83 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -130,6 +130,78 @@ static const struct imx_media_pixfmt pixel_formats[] = { .cs = IPUV3_COLORSPACE_RGB, .bpp = 8, .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SBGGR10, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SBGGR10_1X10), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 10, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SGBRG10, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGBRG10_1X10), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 10, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SGRBG10, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGRBG10_1X10), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 10, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SRGGB10, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SRGGB10_1X10), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 10, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SBGGR12, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SBGGR12_1X12), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 12, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SGBRG12, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGBRG12_1X12), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 12, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SGRBG12, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGRBG12_1X12), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 12, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SRGGB12, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SRGGB12_1X12), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 12, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SBGGR14, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SBGGR14_1X14), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 14, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SGBRG14, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGBRG14_1X14), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 14, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SGRBG14, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SGRBG14_1X14), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 14, + .bayer = true, + }, { + .fourcc = V4L2_PIX_FMT_SRGGB14, + .codes = IMX_BUS_FMTS(MEDIA_BUS_FMT_SRGGB14_1X14), + .cs = IPUV3_COLORSPACE_RGB, + .bpp = 14, + .bayer = true, }, { .fourcc = V4L2_PIX_FMT_SBGGR16, .codes = IMX_BUS_FMTS( From patchwork Wed Mar 9 11:41:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12774985 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id ED01FC433F5 for ; Wed, 9 Mar 2022 11:45:46 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=XUUwKgEmf4Uf1czvJwcerWOrX62GKnbKL0uTuoV3I9A=; b=2A3AU2vU7Rp6Sx WX9kslC4bZPr6z0cB+VDBoRmf8hWj1EzgJVj420fLoJOUUw6ZR5U/EE0/sYi2rzDqVMPwQT23/BLk z6m6wKAiT5VlgTeE56H3lKij61J0pqLKoLWv8xRbzNMhcBzW24ZrFi5ag41XRvvDKdsAfPJbVevmu JvTPw8WisEsJBFOJYAzR4HYgjl6XeGQRBvJT+w9uRaFtDskwWkN0OOiJOoKKE8q3/FfGp5Z63ejVN lNZRLKESgMgMSbTR5Zj33nFtB2pnnhbhBEynlqt+6dpBy+CaI7m/arzjFrLG8H1aw4vXzOO+tbchw YsJ2VnQryiuibNb8rN6A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRujo-008MBP-O8; Wed, 09 Mar 2022 11:44:18 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuhd-008L7c-24 for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 11:42:02 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826121; x=1678362121; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FnQQsmu2PoAxzjaqNV9WFO09njNrUxb7Lfkd5IwbIUg=; b=eDEyk770e1uTbxsF0hRC7gyHxLdm4Lv+DAsXN13Ee3qt8tBGem87svzK aw/DhjWhwV1d0PVsg/e/Lxxfa4s7HhZ/xAnh5vZCsFJdvKEmTsI57ohOs wlmpjCD0bn9Z8V3r/IlkeXdSPFxOkmbcgpRKNfO6sFWmlr7GIKOnv9rY/ x/s3+lTro/vRlDDKJiFUjM/Wz5HTwXzwfZ1JmFpgUR8N7TTzexLh0WMDX UwbC+ckiNJcPYOrJ5ssgbcugayWmSI2RknYoqbREXZYLaSWv72wIXeRSh 5sVcsOSbxcYXHsFQ8PF3lf/09xJJ88P7I8mtw9KSx57bnCw78eq1niU9p Q==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553373" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 09 Mar 2022 12:41:55 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 09 Mar 2022 12:41:55 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 09 Mar 2022 12:41:55 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826115; x=1678362115; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=FnQQsmu2PoAxzjaqNV9WFO09njNrUxb7Lfkd5IwbIUg=; b=UyG8XPM3anOjIfRU3RwGxQVBFxW2FoEiOO/K1+Hmr5pbbQEghJdK9fR2 a5U6y7R7enKc/2ZNYQArt+2Zp40xNpKMBgTK40N/OeNwDFF4ctetWcWiE MwHzPv1qMaQ446UKUzFvKXLUHEcb3HuiaYtluUE2FQv+PrA5mX6dGmhT2 z3H+eyhuUNxKHU9AF1nKmv86FGU8gPr6poaGswhYsQ8q1npnrCj98pIAN tqaGgegs5F/60xrqd/eJUMw9uJkRsPq3iLicMxzm09FiWPcOogjJmSGbC pbZ/YG2JU6dAYOf75xYaLs4ar7LsjJq1yib9ziqLNNHajH1+nNVy6acnF w==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553372" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 09 Mar 2022 12:41:55 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 429B7280065; Wed, 9 Mar 2022 12:41:55 +0100 (CET) From: Alexander Stein To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Laurent Pinchart , Dorota Czaplejewicz Cc: Alexander Stein , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 7/8] media: imx: utils: initialize local variable Date: Wed, 9 Mar 2022 12:41:43 +0100 Message-Id: <20220309114144.120643-8-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> References: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_034201_445184_EB7DCCBD X-CRM114-Status: GOOD ( 14.62 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org imx_media_enum_mbus_formats might not set code at all, this would result in imx_media_find_mbus_format using an uninitialized variable. Set code to 0 to avoid returning a wrong pixel format. Signed-off-by: Alexander Stein --- Changes in v3: * None drivers/staging/media/imx/imx-media-utils.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index e69bbe0d6c83..1665cbd6b3a5 100644 --- a/drivers/staging/media/imx/imx-media-utils.c +++ b/drivers/staging/media/imx/imx-media-utils.c @@ -610,7 +610,7 @@ static int imx56_media_mbus_fmt_to_pix_fmt(struct v4l2_pix_format *pix, * so until it does convert to a supported YUV format. */ if (cc->ipufmt && cc->cs == IPUV3_COLORSPACE_YUV) { - u32 code; + u32 code = 0; imx_media_enum_mbus_formats(&code, 0, PIXFMT_SEL_YUV); cc = imx_media_find_mbus_format(code, PIXFMT_SEL_YUV); From patchwork Wed Mar 9 11:41:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12774986 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id A559EC433F5 for ; Wed, 9 Mar 2022 11:46:33 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=ePP3s568a6sfZPykfcWzW2XtQX9jXdVI9ubO0sYdmSI=; b=XgSHfg+T2qdqWq LOMpUgJsTzd0COI5sCkQlF5nxaiYiTt4aOFY0aA3f7URJMw7FE9qwShOApheKsCwL1U0Uefk3HOp+ abfGG2f4NTwVnivX6Hb+vmcKLz/yvDZjSCESTNABqjLHGiIK/Cw8Wx0R6Zx1iC83d7USp2oVV/Rho OYFiIA28EDAT5g5IZ2p/rPmfR94UWaPDguIRqRZbaiNf+ksKd/vfGTQv8UIupozntSFEqpTlq0UwE 9OUZR7mjvrCUVgaK0nBV+c/VZZ48N1uebBcxG8fuQ3At8kIGEPyL8BF03HeDL8IHi21H9s9VbcuLa xwKOp/e9kr4QuD9dtHjQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRukb-008MbF-DL; Wed, 09 Mar 2022 11:45:06 +0000 Received: from mx1.tq-group.com ([93.104.207.81]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nRuhd-008L7w-Uh for linux-arm-kernel@lists.infradead.org; Wed, 09 Mar 2022 11:42:03 +0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826122; x=1678362122; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yev62PtTcyJMc3JdaFGquolvb6gHeScWk6sAEYEIg2I=; b=g8DBuT50trYIvG2CT3Nmto0xPXpXSXbaXKpfce3lWxiFvRM/gKvHOL+6 1WNQXpfnwmZcr+lcyeIARhU/phY5SWb6kYjgd0pDQBEsyLWiED+vUmng1 GU9w8fIpxmKdZxGhxhA/8tWUekl2SGIj/W6pDz0nyJofAOes2SydekhnH 66d2gdRUof2OmV/52eZmHkpPRW8pwd35Ut9ea/pytkOf0O8/FXgW+SgJA /i9kqhkV//Es8CkNjVs4b6nUkVs7suZX3qedu/G6TtLmTpmIrXXYZbgZn uR5jfrtFoMGwT1++KR2hVPpFzRYKJYx1n8r+nKLHDOTAC/iukxz85WHI8 Q==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553375" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 09 Mar 2022 12:41:55 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Wed, 09 Mar 2022 12:41:55 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Wed, 09 Mar 2022 12:41:55 +0100 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1646826115; x=1678362115; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yev62PtTcyJMc3JdaFGquolvb6gHeScWk6sAEYEIg2I=; b=NlXklOp/5EsGkMVjcVC+ji5EyEw9hhSIfOuz/hp0iuLRRuMS+07UdWG+ p7ajRUkIDFz0fDkEqltBNJuLI6ie21FENEHOXzbWwEMUkyKwjP2So+0IM 4Vzc0TSXv9FXKC++7vVZfMmCWufXCGc5/1ODajtHQLj/W1yDezG8NzhrY ILMCA7r668IjvuyR/5buXqYZve51u5yZHRykfnkiLV/1s+pcrmswBsOlr 4pb6IZMc6whyAse9cjyfyD9VbUvDu7+nnSWd3Y6irMj3jRRR4er3mNYJ/ UPzZBsV2pt3F+ZSPo9oPYphiTtFU3c8f1zMo6ogWaW0qW9FV03T+v9xPP w==; X-IronPort-AV: E=Sophos;i="5.90,167,1643670000"; d="scan'208";a="22553374" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 09 Mar 2022 12:41:55 +0100 Received: from steina-w.tq-net.de (unknown [10.123.49.12]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) by vtuxmail01.tq-net.de (Postfix) with ESMTPSA id 8963F280078; Wed, 9 Mar 2022 12:41:55 +0100 (CET) From: Alexander Stein To: Steve Longerbeam , Philipp Zabel , Mauro Carvalho Chehab , Greg Kroah-Hartman , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam , NXP Linux Team , Rui Miguel Silva , Laurent Pinchart , Dorota Czaplejewicz Cc: Alexander Stein , linux-media@vger.kernel.org, linux-staging@lists.linux.dev, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v3 8/8] [DNI] arm64: dts: tqma8mqml: add IMX327 MIPI-CSI overlay Date: Wed, 9 Mar 2022 12:41:44 +0100 Message-Id: <20220309114144.120643-9-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> References: <20220309114144.120643-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220309_034202_326106_D3E38A00 X-CRM114-Status: GOOD ( 15.91 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org --- Changes in v3: * None arch/arm64/boot/dts/freescale/Makefile | 4 + .../imx8mm-tqma8mqml-mba8mx-imx327.dts | 95 +++++++++++++++++++ 2 files changed, 99 insertions(+) create mode 100644 arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx-imx327.dts diff --git a/arch/arm64/boot/dts/freescale/Makefile b/arch/arm64/boot/dts/freescale/Makefile index faa01802276d..b27842200d5f 100644 --- a/arch/arm64/boot/dts/freescale/Makefile +++ b/arch/arm64/boot/dts/freescale/Makefile @@ -57,6 +57,10 @@ dtb-$(CONFIG_ARCH_MXC) += imx8mm-icore-mx8mm-edimm2.2.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mm-kontron-n801x-s.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mm-nitrogen-r2.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mm-tqma8mqml-mba8mx.dtb + +tqma8mqml-mba8mx-imx327-dtbs += imx8mm-tqma8mqml-mba8mx.dtb imx8mm-tqma8mqml-mba8mx-imx327.dtbo +dtb-$(CONFIG_ARCH_MXC) += tqma8mqml-mba8mx-imx327.dtb + dtb-$(CONFIG_ARCH_MXC) += imx8mm-var-som-symphony.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw71xx-0x.dtb dtb-$(CONFIG_ARCH_MXC) += imx8mm-venice-gw72xx-0x.dtb diff --git a/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx-imx327.dts b/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx-imx327.dts new file mode 100644 index 000000000000..3f1223d4d73b --- /dev/null +++ b/arch/arm64/boot/dts/freescale/imx8mm-tqma8mqml-mba8mx-imx327.dts @@ -0,0 +1,95 @@ +// SPDX-License-Identifier: (GPL-2.0-or-later OR MIT) +/* + * Copyright 2021 TQ-Systems GmbH + */ + +#include + +/dts-v1/; +/plugin/; + +&{/} { + compatible = "tq,imx8mm-tqma8mqml-mba8mx", "tq,imx8mm-tqma8mqml", "fsl,imx8mm"; + + sensor_clk: sensor-clk { + compatible = "fixed-clock"; + #clock-cells = <0>; + clock-frequency = <37125000>; + }; +}; + +&csi { + status = "okay"; +}; + +&i2c3 { + #address-cells = <1>; + #size-cells = <0>; + + vc_fpga: fpga@10 { + reg = <0x10>; + compatible = "vc,fpga"; + + vc_fpga_reg: regulator { + regulator-name = "CAM_VCC"; + }; + + vc_fpga_reset: reset { + #reset-cells = <0>; + }; + + vc_fpga_gpio: gpio-chip { + gpio-controller; + #gpio-cells = <2>; + }; + }; + + sony_imx327: camera@1a { + #address-cells = <0x1>; + #size-cells = <0x0>; + reg = <0x1a>; + + compatible = "sony,imx327", "sony,imx290"; + + clock-names = "xclk"; + clocks = <&sensor_clk>; + clock-frequency = <37125000>; + + vdd-supply = <&vc_fpga_reg>; + + vdda-supply = <&vc_fpga_reg>; + vddd-supply = <&vc_fpga_reg>; + vdddo-supply = <&vc_fpga_reg>; + + reset-gpios = <&vc_fpga_gpio 0 GPIO_ACTIVE_HIGH>; + + port@0 { + reg = <0>; + + sony_imx327_ep0: endpoint { + remote-endpoint = <&imx8mm_mipi_csi_in>; + data-lanes = <1 2>; + clock-lanes = <0>; + clock-noncontinuous = <1>; + link-frequencies = /bits/ 64 <445500000 297000000>; + }; + }; + }; +}; + +&mipi_csi { + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + port@0 { + reg = <0>; + imx8mm_mipi_csi_in: endpoint { + remote-endpoint = <&sony_imx327_ep0>; + data-lanes = <1 2>; + }; + }; + }; +}; \ No newline at end of file