From patchwork Fri Feb 4 12:15:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12735033 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 72302C43217 for ; Fri, 4 Feb 2022 12:18:56 +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=AqhbleUKqWatLl0POcFx1YSQc2sFBYu0wz8FHBytBOo=; b=gV3bBHUKTFdGJm RwqqkjHbFkDz0Z7ciOrrvOGur/HzUwpOY44ayUs9wzMtZ1iA7n93bwvbZsg2YlYnbsn0j87CXKKxe 5WAPAXhMRtYO9QLFJFPZBiN0aDLnfIWaTtdt3XlxvcDSAm4TMiMN/kSLP0yS4hipX/A4VPIiXmnVm Y7jtpd7UQ5F0IWOuDKQOx5u7zgGPDuED3Cv/0MGQ1rSIeH0W6tMWVQGl+HY9+fVCSJSrfNGT7Bn85 qtQ3du7qIkRQQ+ASDUjD4R/P7J6eK76OC2RjDJFACTDgW90UsQ8jno1CdLPU9w3BBP69mCmo9V+1H //4lwGZpFWoli9CwBoYg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFxWp-004DeY-HE; Fri, 04 Feb 2022 12:17:27 +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 1nFxV1-004CaV-0B for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 12:15:39 +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=1643976935; x=1675512935; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0jzXBJ2fXI0x5vj73g1ujzvH0lAWyzFDAhA3RZ/VINw=; b=aZ3hjl96L4utbYDM6xetwOSMgprohgAm/lm88dTF03Zet5Juczi8lyeF JXqHc/79QaLkYlbff7w2gmVx6n2vdtBihSj88hZgKpjoHNNLLDr7pdMJa Cf47+uu+owKzlVXkCxHqp5TlnWH0alsu/cSOF8kPINwYbCWT/rXCfM7yM sBO+b3Y567EmxfZfwKjrHepkv/3ccU0YByCoql135B+QSCKyb3KhZtOfU aa0ozoNJunuP5Xzmyak6W68DxR2B0Xa2R0/yFjMOC4DEEwzfl8hZvPWd8 YsQ8J8qUOY1nrAfJ0NW7tXQOxe0GvaQCa4kAPAIFxvTiNvwe8fYDyHTRZ w==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903442" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 04 Feb 2022 13:15:30 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 04 Feb 2022 13:15:30 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 04 Feb 2022 13:15:30 +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=1643976930; x=1675512930; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=0jzXBJ2fXI0x5vj73g1ujzvH0lAWyzFDAhA3RZ/VINw=; b=R6gpuAoIf49JVzbVHQPb3QEtmtWLxhWw5u0ePtET9fj7uT5jkAC8Brxk ytKIjqreYVLLi1pZo4iQxcgTq/s/i4FalQBxdaxl6LKBqeKM1TQ/vwEmm +dOvjifaP/4z1XkhQyjYBsUZRwHsPkLBtbKUpra1C1NGkm4rVLPsYiOXI hu66VYjKhCexBE0Gkj0dfxa37LS7XdAxWtYUaYbo5tHFvC3+IydXz342j Me9V0J5akErmJy0PmNsp9oW/3xmMFUsNrR67ety7U6cETSUKb6ss1Chh1 cZd3RGRwr6R38QSPatmhUx9GxGO+KknMYWqMTFF03MQQVQEKknLpwWQXz Q==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903426" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 04 Feb 2022 13:15:24 +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 63E87280075; Fri, 4 Feb 2022 13:15:24 +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 1/8] media: imx: Store the type of hardware implementation Date: Fri, 4 Feb 2022 13:15:07 +0100 Message-Id: <20220204121514.2762676-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204121514.2762676-1-alexander.stein@ew.tq-group.com> References: <20220204121514.2762676-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-20220204_041535_471613_4FE08473 X-CRM114-Status: GOOD ( 15.57 ) 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. Signed-off-by: Dorota Czaplejewicz Signed-off-by: Alexander Stein --- Changes in comparison to original commit from Dorota: * Applied the suggestion from Hans at [1]. [1] https://patchwork.linuxtv.org/project/linux-media/patch/20211104113631.206899-2-dorota.czaplejewicz@puri.sm/ 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 | 3 ++- drivers/staging/media/imx/imx7-media-csi.c | 3 ++- 5 files changed, 12 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..caaaac1a515a 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, + true); 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..b61bf9f8ddf8 100644 --- a/drivers/staging/media/imx/imx-media-capture.c +++ b/drivers/staging/media/imx/imx-media-capture.c @@ -47,6 +47,7 @@ struct capture_priv { struct v4l2_ctrl_handler ctrl_hdlr; /* Controls inherited from subdevs */ bool legacy_api; /* Use the legacy (pre-MC) API */ + bool is_imx56; /* Hardware is i.MX5/i.MX6 */ }; #define to_capture_priv(v) container_of(v, struct capture_priv, vdev) @@ -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, + bool is_imx56) { 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->is_imx56 = is_imx56; 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 bd7f156f2d52..c8f6add00dbb 100644 --- a/drivers/staging/media/imx/imx-media-csi.c +++ b/drivers/staging/media/imx/imx-media-csi.c @@ -1803,7 +1803,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, + true); 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..73e8e6e0d8e8 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -282,7 +282,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, + bool is_imx56); 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 32311fc0e2a4..158d2a736c6d 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1039,7 +1039,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, + false); if (IS_ERR(csi->vdev)) return PTR_ERR(csi->vdev); From patchwork Fri Feb 4 12:15:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12735022 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 CA220C433F5 for ; Fri, 4 Feb 2022 12:18:32 +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=s7RVhJXwcBOkb9g0O4wy3NbMqsMvoQbLMRqCrodiV78=; b=zdMrGukLPXbLdr X2BeYX4H4KbX09EY4tY4Jck+uLFvVzfOxJ1SeN0EU9cxsvZZlyucbZtIFB1yBYdj4T7089vjfUtqs 7/3UBf9rpzdIph4t1C7xTeemAdP6f6PnFr+AQ5b/unGUss+ZdUoUR1jCop8bYjg4fnjhWvsOokmoY go446J9ke7YPKLV3QzBT2cM2v9X5Ng0RKbSRsJ9g3lJq6fIgTxfJYBi/sCNAdnJCfdolT+p3A22zU oNM3xVEOcgjuDHxEGQI6kPrsZCKXLXbIJrkOAsxGDWXrYaGAJZX044t9Y4rwK3gNjABVO1WQj8hRO mgJGx2V/Tzni6rW5RJiQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFxWT-004DRv-9U; Fri, 04 Feb 2022 12:17:05 +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 1nFxV0-004Cai-6J for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 12:15:37 +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=1643976934; x=1675512934; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=taegKBe3B6246OHrJbDhTlLs+K0S36GFwVLsplN0Alo=; b=ZxlYLdPhVzWNb+skbAtUKFl4E23tbK94k0n1t2nQiDfnOW9y5gGK/RjV fB6AnuckrojaeG4XUFlyBKkMAITa4PeA9LdUGOY7dQQoPC+qiZG9DusXx 4l4tZFosqWHYZ9AtF0elSS/HuPPwEdGQ8CIK4aLPUgvRiVKNJ5Dfb2FXR tZj1fOTHoRVqkFC1ZAtMBV32aUP4qC4JBQ5jdz7f3G0TpS9jMn5KdSLKU IUBo/b38O/mevYhGo7JoKaY/lF4osK8BSBBQHzEvLhDhRZdvaJJOPfRgM g4n3zMaGN7htt/1fnXkO+UPd3A67GZZB6f1DREM/Jk+mxNaJXJLLnw69+ g==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903441" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 04 Feb 2022 13:15:30 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 04 Feb 2022 13:15:30 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 04 Feb 2022 13:15:30 +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=1643976930; x=1675512930; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=taegKBe3B6246OHrJbDhTlLs+K0S36GFwVLsplN0Alo=; b=NXPtm3fIYC66UJm/bN5rv2cxL+dSKaNWpWIlkUT2fa+hr52eoAdlol8+ EkerhLLp2+J/6/iRGybkEeJRaFQVZkrhEHw9dfigo97ZKgcnk9c/OhKCv ZGAKMfsmw5pqzCLeMY/otNFxgcNNkWcSG2cvtv3Y/qrDjIjG3vZ9hLYWa 8qMlFAsMUyNJvSYzYQO2XxhMwpiCjrYcKgUIkOjeyJEtlkfHPOWr8Tmnu 0Y7dHv5n0eEFp41Jb9D53d5f+Tb8EjKeeNvNHTJGRs9mj2xpHoHXYUozK jPv3qHvK20QynDXDJsINfWx4MmAWsmj1ZpFb7t34Nd7WCY6101tpPilMD A==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903427" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 04 Feb 2022 13:15:24 +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 ACA3D280065; Fri, 4 Feb 2022 13:15:24 +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 2/8] media: imx: Forward type of hardware implementation Date: Fri, 4 Feb 2022 13:15:08 +0100 Message-Id: <20220204121514.2762676-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204121514.2762676-1-alexander.stein@ew.tq-group.com> References: <20220204121514.2762676-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-20220204_041534_643408_2F79DD79 X-CRM114-Status: GOOD ( 16.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 Pass down the hardware type so imx_media_mbus_fmt_to_pix_fmt can do the actual switch. Signed-off-by: Dorota Czaplejewicz Signed-off-by: Alexander Stein Reviewed-by: Laurent Pinchart --- Changes in comparison to original commit from Dorota: * is_imx56 is used instead of enum 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 b61bf9f8ddf8..8aad6d6d350e 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, + bool is_imx56) { 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, is_imx56); 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->is_imx56); 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->is_imx56); 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->is_imx56); 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->is_imx56); 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..0daa6aad45f4 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, + bool is_imx56) { u32 width; u32 stride; diff --git a/drivers/staging/media/imx/imx-media.h b/drivers/staging/media/imx/imx-media.h index 73e8e6e0d8e8..2be1bc97955c 100644 --- a/drivers/staging/media/imx/imx-media.h +++ b/drivers/staging/media/imx/imx-media.h @@ -198,7 +198,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, + bool is_imx56); void imx_media_grp_id_to_sd_name(char *sd_name, int sz, u32 grp_id, int ipu_id); struct v4l2_subdev * From patchwork Fri Feb 4 12:15:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12735034 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 9821FC433F5 for ; Fri, 4 Feb 2022 12:19:31 +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=lX6LzZZkskd9oAJ9qyGPyRAUs8mp11MT6Mw3BNH5VGs=; b=vBRa9Vbt+C9ATf umlmYlkI8YpKWTMEE7Fry88fvNymuof51HdBNnT3OECulf1KCoenOZO22yOBRMBHB/0thJsAz4Hwy xKHjvhRPiGPP++zQOU8zWxCWMR9zEl25vMUwiU1+V3rs+DWypWsqt+9FzLmZmwA6Zu9sz1j1iBVNJ My6zn1+t+Df9V6Nu/ziWWorlZdfb5VSXEX+LRlOP6bRWjSdnsQDLGNtmTgeBm6AMVOk0KXmCR5ApL 2NbLRyZ5OtJFpgObWC0aSQGQdxiCQXwRL1AzmsMIAPp0xuZ/yshv4VcPjM6bhiwZbiEfEjWZMba+w wkNHRB8Z5z4eotdS+q0A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFxXG-004Dsg-Cc; Fri, 04 Feb 2022 12:17:54 +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 1nFxV3-004CcR-Pu for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 12:15:41 +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=1643976937; x=1675512937; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wxzlrhc4NRiZGi76LZW5C2eEFoWSR5gV+Yrp/AZNDME=; b=YqRbMrCpIUed2EA+C/4eaW+NLl5Edb+F8UifUVzJ3/qjski8Bynt+N+m 5Y3lULYVS1KOHJARVz3OSOmzfrIqxNEch8A/g3npvrD2k0ef8L3HMmP+B A171Nt9ipxtNMxChqhoUPYgwtNWS1dV0qJ5TdbEYYohX47UoKVbxeCCiB 0sFkiVnSoyV4BHt9o6si3EaYzsKeVmp0tI0tmFCFBGBA+D8xAD7EYH4/s 8rSGsqI6hm2WJW3sunGB7LBgnORGdb0HyxGnuB2jRGdaiMMOutQ+QjfX4 /ZKVkS0L9R5dNGq9i84nIigst1aLQIJGjZRaOB2EPropt2e1UJa5aP+1g w==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903444" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 04 Feb 2022 13:15:30 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 04 Feb 2022 13:15:30 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 04 Feb 2022 13:15:30 +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=1643976930; x=1675512930; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=wxzlrhc4NRiZGi76LZW5C2eEFoWSR5gV+Yrp/AZNDME=; b=M2TltVT6lr+eQS8IzKEtkI2FlEQDvXhnt93Q/Kcryg9f/56KiGAY6L+X OO+DeFuvGn7+9h18ih075dR3jETsTCh+J04ULa7a5/px+kKcveZPKjRaH WBKgOhAX9BHBTMyePPbq3gAtTw97728+JAuAg/mRgd5/higVxxtI1I6D7 CzzSx9H61CYy3uryj3vwiUCsp6RLExdaKVwWjSjb/BKo674jFT82b9v8p tjKOlf2OSWPSYm9KtAwSo7uFFKiQJXyrUZW9NRKpgaaASmAf+qnf9UH0M RJbZVG/cjZe3AVauClUzWkTHg5mIOCpEv6kDifd+aZ5VM80EZKrknwTPP A==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903428" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 04 Feb 2022 13:15:25 +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 F12C9280075; Fri, 4 Feb 2022 13:15:24 +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 3/8] media: imx: Use dedicated format handler for i.MX7/8 Date: Fri, 4 Feb 2022 13:15:09 +0100 Message-Id: <20220204121514.2762676-4-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204121514.2762676-1-alexander.stein@ew.tq-group.com> References: <20220204121514.2762676-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-20220204_041538_219804_C1347B08 X-CRM114-Status: GOOD ( 17.72 ) 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 comparison to original commit from Dorota: * is_imx56 is used instead of enum drivers/staging/media/imx/imx-media-utils.c | 56 +++++++++++++++++++-- 1 file changed, 52 insertions(+), 4 deletions(-) diff --git a/drivers/staging/media/imx/imx-media-utils.c b/drivers/staging/media/imx/imx-media-utils.c index 0daa6aad45f4..32aaa2e81bea 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, - bool is_imx56) +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,55 @@ 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) +{ + 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. + */ + ret = v4l2_fill_pixfmt(pix, cc->fourcc, + round_up(mbus->width, 4), mbus->height); + if (ret) + return ret; + + /* 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 (pix->sizeimage % 8 != 0) + ret = v4l2_fill_pixfmt(pix, cc->fourcc, + round_up(mbus->width, 8), mbus->height); + + 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, + bool is_imx56) +{ + if (is_imx56) + return imx56_media_mbus_fmt_to_pix_fmt(pix, mbus, cc); + else + return imx78_media_mbus_fmt_to_pix_fmt(pix, mbus, cc); +} EXPORT_SYMBOL_GPL(imx_media_mbus_fmt_to_pix_fmt); void imx_media_free_dma_buf(struct device *dev, From patchwork Fri Feb 4 12:15:10 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12735021 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 9BD6FC433EF for ; Fri, 4 Feb 2022 12:18:07 +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=k4JPKM5lepT+j/gA8DW3PDt0OYv6hhpl8oL30Sgdjms=; b=DNe9vyviAl+cFx vrumAl6kA7XUPZ7eViCwTgtiboMxUu6fLKmsegYniDj1deE3lfDG5Qov5yn1mOzuy/sYA58Rnxxgz 390d4iRG/SrQaGGDZyKC1lhqNNxmjploeNO8fe44Cj4SgLy7NNyu7Q/T/ByEV11I8uYALLAudnvQG K8UbAnfFZCY0Fp0BPP/e0X+s/JX9ZEXdkoRxO6s17Z4dWk2wKWi+73dP525acG/N+eY/9SSO1/7TN 8BLqqi6p8EVdJECPIYK6je4W/Oyw5vMSreEgOEeuoXtsyMIIDXo4b+fq5GTSDXBgkX2gXGYg34TP/ NwLDcoNs9E+utJ0zcksA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFxW5-004DD5-UU; Fri, 04 Feb 2022 12:16:42 +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 1nFxV1-004CcR-14 for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 12:15:37 +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=1643976935; x=1675512935; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w/GuNznqndIUcAdDbJ2FxtN8SD25HIguOxBaARlAb1E=; b=QppNZkqk9tPaH39bRYActViZ1L+tg2fgH8oXBzTqUFcp07FIK5gFRP57 egG2NcIJNWxUPNwrggG2cyJCr+cMyqz+mLdtD0RCjf5W4pt2KHxLrEjVA hVhourPdFmNhYlxiDSYEyEm1cIz3zj/dD9ygbWSBKZN60Z8qgjUr6czxS 720QYK92/GZBRkz+Jzz5B9mns+4g+5KrqnQ32eO/uD5rc4AgEEguf1nCn a6m7XoLANvc51eeRSO/PYXojSlU13gVFyRviHlKDta7kLKKfHkmZ8rgZ/ oVNT0Z3Q1Fr/n75KpRxYthRncmI6KBRcC99w1CSaA7C4/ovYggRYZMg14 A==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903443" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 04 Feb 2022 13:15:30 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 04 Feb 2022 13:15:30 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 04 Feb 2022 13:15:30 +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=1643976930; x=1675512930; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=w/GuNznqndIUcAdDbJ2FxtN8SD25HIguOxBaARlAb1E=; b=CvwyRAB+K8AiIManazXd7kpO5CcK37/S9oqyR8ayntBF4BeHtHhiOW40 El4mYVm2ttbqNLzcKBFyMjEamqX20DfD1HlikHdXJfygFiRlNjH/R0LRL wO74OboqI8YJKgYD8pOQhjDczptuvAB6t+2Ozy17Xa1kVO3/6RbjdoKPc WZ/NDjaT2KFqGDEdkDLNB8a/kBQm9Mu8clP+Dq5fwDxwpgrv2MSKY36Ho xoSjFpc5nW6B+PKMmxS9blBAlgjqfHXSbuyFaDWtCsQscVzeObkR/jTwP lPJvoxJ4+Y9DcYqUQ99Iytye+qc52ScavL3YVF5Ago3wGc1o8PkzlMOyt Q==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903430" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 04 Feb 2022 13:15:25 +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 43F63280065; Fri, 4 Feb 2022 13:15:25 +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 4/8] media: imx: Fail conversion if pixel format not supported Date: Fri, 4 Feb 2022 13:15:10 +0100 Message-Id: <20220204121514.2762676-5-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204121514.2762676-1-alexander.stein@ew.tq-group.com> References: <20220204121514.2762676-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-20220204_041535_478173_8103A3D7 X-CRM114-Status: GOOD ( 13.39 ) 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 --- 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 32aaa2e81bea..e0a256a08c3b 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 Fri Feb 4 12:15:11 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12735016 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 70C2BC433EF for ; Fri, 4 Feb 2022 12:16:59 +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=goknKx/y0UPEX7zm8G97LiByWI/QUnVGvOlG/2De7Ww=; b=XpQEzJ0U1SP19f lPplMT14mppmd72IAqF2vx7OuwrSPoGrkVwl2hAZmAMDQGRGzF1mnyKCMzCMsHtGhyq0oB4/XwgzQ JsJDjkDuLpg9obAAtZFgZ5zFiJ9/IFVY/bNCylEGHBNhDg2tUa4VGjQwhrclyUXKMkrBSR+9/v3ZL AV0XuDN64ngiJkvTs6MKNctBzwl7rNNB0hqE731wkr24o3GIFPWUpqn0TF6rdaYDcNhfRMGk71uXG +leUGhy7Z2ORcXY2+FUBTFfsxLjnp/lB9gBiftbaYFbEPQv1CmtdawL8S3AjY0QbYBdqFxNuMpzZq 8SFL8uZWZNniJqk8jU2A==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFxUz-004Cdt-P4; Fri, 04 Feb 2022 12:15:34 +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 1nFxUv-004Cai-1b for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 12:15:30 +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=1643976929; x=1675512929; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Bc6AZVTrc7BoI0dNeWm1pc1eWQvq627GTftRErmHl+E=; b=igjD6nxYU1HAXzPhUFObC7nt5A2aqY6R2zCwplvBzKtEnOdvfiW8EN8h 1EhoS4GqLoOM7QdeyoPns338KMfggNJ4j5JDJmoY3M/BU6/r9I6GWiM30 /ButjpzaaK9yRKa71ywsf/31DEE5JFQk2Lwxe4AUiIHxTWuVF6wmt2vey XYzTh8MyWpliNOFenPed310LqFFJSvGY2d55sJl4+lc2qF07Wi/+gQU4x Yz8oJkOmqL8veKvqgdN6o8df4tzW2BG+a8WO4yq7gRML2fQTzKIOO522b dgajDzpPZBj8QRtjj0MIRT+f7QpMWD0O4mksDM8N9tsWOt7LN/0hncttf Q==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903432" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 04 Feb 2022 13:15:25 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 04 Feb 2022 13:15:25 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 04 Feb 2022 13:15:25 +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=1643976925; x=1675512925; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=Bc6AZVTrc7BoI0dNeWm1pc1eWQvq627GTftRErmHl+E=; b=oZSrnE4np0h67rOeQNqUsg/k2MtCG11arHHHzJrh0isXktCOi31itxhU srNAWnbP6WasBHiplUuE0IP9gSbZvg6VVnCKE8dbEc/tf5p9dqDHiaD95 EhRvDjvF+GL/1ryJH1mdFM4qboHbB6LYlqjs1DKg3Yi2HtJWUMfIpoJAR n/ZMVNTOQhFilM9dTp9i0v8qGL8tT+pJYOGQ/9N9oSnx91WN4JXZ2O4xX TwPbLmUtiMJnSark8nSZgmBhA7YfNsz8z/3mbPPFPfEwB9f+yGPLTG+nk NipuHjVlHgq9aBVps6r1urEGkPaeL2XG7/ZFkm0mOi86D+rUB++0paU7B Q==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903431" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 04 Feb 2022 13:15:25 +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 8AF2E280075; Fri, 4 Feb 2022 13:15:25 +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 5/8] media: imx: imx7_mipi_csis: store colorspace in set_fmt as well Date: Fri, 4 Feb 2022 13:15:11 +0100 Message-Id: <20220204121514.2762676-6-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204121514.2762676-1-alexander.stein@ew.tq-group.com> References: <20220204121514.2762676-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-20220204_041529_429602_6653A943 X-CRM114-Status: GOOD ( 11.47 ) 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 default (SMPTE 170M) from init_cfg stays unchanged. Even after configuring 'srgb' colorspace (or 'raw') $ media-ctl -V "'csis-32e30000.mipi-csi':0 [colorspace:srgb]" the colorspace does not change at all: $ media-ctl --get-v4l2 "'csis-32e30000.mipi-csi':0" [fmt:SRGGB10_1X10/1920x1080 field:none colorspace:smpte170m xfer:709 ycbcr:601 quantization:lim-range] Signed-off-by: Alexander Stein --- drivers/staging/media/imx/imx7-mipi-csis.c | 1 + 1 file changed, 1 insertion(+) diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c index a22d0e6b3d44..7b0e57efcf82 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -1062,6 +1062,7 @@ static int mipi_csis_set_fmt(struct v4l2_subdev *sd, fmt->code = csis_fmt->code; fmt->width = sdformat->format.width; fmt->height = sdformat->format.height; + fmt->colorspace = sdformat->format.colorspace; sdformat->format = *fmt; From patchwork Fri Feb 4 12:15:12 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12735018 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 492B9C433EF for ; Fri, 4 Feb 2022 12:17:21 +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=26k2CnGYx6ds+s/GrWjKWHvA8Mu661p0NLCeRWYdxW4=; b=dyyjPz9MgEjzQE h+f7Pu0PJ83Ou/EsNC0JLehYnMEqdSMT6QT6dRlE6L93F/zttcrwLMMp9joumCKTwoc65sz5TYhAV VITzg7VTLK55D+DZfIilc8AlG59Aww60DIInhJmZ44owOO615KIHZgh4nBBR1bA60cwwhJz/Xz/Rc 9bBOFjfS4+x+LmEYOlJgLKuRLldERwp2H50yMugbW84JdCbD0Eh4u1RGRbZZ8VNKoBIOXi79bShal Q+4sIKdG/Ferdlg74Z8zoac0teFW/q3DwCdA2bEXCZhAjR5AczdkeMoq1TqDMr+u259xGj5SYjkuF t/irnI4k2SxulJESoSfQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFxVP-004Ctu-Cj; Fri, 04 Feb 2022 12:15:59 +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 1nFxUx-004Cai-By for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 12:15:33 +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=1643976931; x=1675512931; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9MfQeFSRHHpb33Jz73vY5dhj1TL4KHQ2EhLys86WNF0=; b=QRmSQmmrOE06/jjpkRHt51MwyvcjWwIXrWEPnRWCX+UjPG+S/Fz+NkTB 1Y4RuYYSbX+72cuAuoD6VC7HW92KgLB2Po/vYCnzZyeQGvixdUoGWaquW VNUJYvVjDz/kJKL97ojNpp5BR2n6E2yHAzy1gVw3xdx2yfzSaMeGq8UJv uE7SI8UwruzCRaFih0SUyFrFLzd96hBWoLrRM2QLlPdGH8Wwag6OxQaXO kAKLeQkZtDM8W6G4DeBsnWmGSWNr0ydoudxXHPusEwymosowxo3pVM+u9 quC3jx2K7khv9p4dd4wDWnrjnIXa4lKnkwT0Y5iCvH/C/+69+0wgnrm6M g==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903434" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 04 Feb 2022 13:15:26 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 04 Feb 2022 13:15:26 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 04 Feb 2022 13:15:26 +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=1643976926; x=1675512926; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=9MfQeFSRHHpb33Jz73vY5dhj1TL4KHQ2EhLys86WNF0=; b=Tl/i8ElgbQohSRh9TncCZ2vgP1zO5+V/esxfIspBt8U/htVenhVqpoGW Slh50WGzPJHBnnm8PSYSJznNKr4Z2LMWi8pO9xS5jXS2Ceu0I1gtKt35k So7yO2v9y52+ibEikUCm4y3v5UYafkDz/PHFUAa51GioCi1d7CD9pIqjs oqvjKqXgWIJfAIclqx4zieUTrDC2w39RKvIR/E0A/Jssx7Oe/FPnT+L5/ 2fjiTWbBU+3wIGMzl3b9ANZlSBFAgM6C6xnKF2arkwWwZxoVINKSS2q09 qfXoFatZuhUHzbYZ7kKZCi0fF2joAiuZyB13lXUkCUEh9QGGFDPBaMwxj A==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903433" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 04 Feb 2022 13:15:26 +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 D2359280065; Fri, 4 Feb 2022 13:15:25 +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 6/8] media: imx: imx7_media-csi: Add support for additional Bayer patterns Date: Fri, 4 Feb 2022 13:15:12 +0100 Message-Id: <20220204121514.2762676-7-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204121514.2762676-1-alexander.stein@ew.tq-group.com> References: <20220204121514.2762676-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-20220204_041531_778228_D8F1961C X-CRM114-Status: GOOD ( 13.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 imx7_csi_configure() allows configuring these Bayer patterns when starting a stream. So allow these in link_validate() as well. Signed-off-by: Alexander Stein Reviewed-by: Laurent Pinchart --- I'm wondering if V4L2_PIX_FMT_SBGGR16 (and their variants) is correct in this function. imx7_csi_configure() does not list MEDIA_BUS_FMT_Sxxxx16_1X16. Also I can't find a proper a proper setting in CSI_CR18 of CSI Bridge in IMX8M Mini RM for RAW16. The feature list names a "16-bit data port for Bayer data input", but is it actually supported? I do not know anything about the MIPI CSI data formats though. Maybe someone else can clarify this. 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 158d2a736c6d..7e737221f187 100644 --- a/drivers/staging/media/imx/imx7-media-csi.c +++ b/drivers/staging/media/imx/imx7-media-csi.c @@ -1004,6 +1004,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 Fri Feb 4 12:15:13 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12735020 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 10824C433EF for ; Fri, 4 Feb 2022 12:17:48 +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=JPu44Pkw5I9kjOzbaQMPXls0VNUtpCNo9ZIEbDMp43M=; b=1+DX6t4+eemW+I 63RbP9+eYVWvPAqqCVCM58ofo5zysGEDJvz0Sz5RzyZPi3des8koLDJ9+wQ326v0t+NdEslZoLoTd EQ/NzlRFnYOu3aTaf/3wRBqcqMaEjaozY+iniyAW4PxvTRksTdvIY/srxsMfe/JMD0cMGcabfnRp4 xcGGkw3g+2IsD4+t4DhUuehzFQoghkGSsAt5YhDmPD/T+Wyd+FFM9jJcJ3xYu6JnURQ/mvKM+0r3a d32Vvun7F5RaZPt7LQTByaZV7liA8qvaDfjlFganDonhc2u7fKJqtgIavhGyG3myj++usb4ejlH/k LcGhVYTDufD16T7kLLpQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFxVr-004D6g-3e; Fri, 04 Feb 2022 12:16:27 +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 1nFxUx-004CaV-RC for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 12:15:34 +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=1643976931; x=1675512931; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EEvmELRomxbDMI2VuE/soti3drclybeWHepOSKt/hkw=; b=hgi/6zV0NCJkbAxr1/De77j4VOl772336hLIHiYlqeokMp/+urAPUCs4 HL/F2utAj/A5HdcE8Q8q3OQTLeN0L9bEdnEjvhcxcMWcMQHjY3pY7981I 48alHq6D7+wogsSF6n9Wik2ZWLi35rLF4IhClhvytgf1ogbVVnfdOfFK+ 8H18IJxws5nDBd3iByDTob83QKP/7rUGc3dV731TLVlVT22JO/zkfXAEP U7LXRdavMQ+U/RYvLIxMvNHqMcR11BWbv7kzePwLaDOkP2PFsppppxaN8 E4D/m8/6Ax7cQCTVtRuD3XbIx1lox3cXp8SWQnOiHvxut4dEdhJnDvjJO w==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903436" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 04 Feb 2022 13:15:26 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 04 Feb 2022 13:15:26 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 04 Feb 2022 13:15:26 +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=1643976926; x=1675512926; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=EEvmELRomxbDMI2VuE/soti3drclybeWHepOSKt/hkw=; b=mantmV7PeyQB9YOtQOrEWqyKyg2sh4alMqKOVHPHYkD9vJTbpiUa70Zi gSm1zZbUY6IMr963DNaGPof2a4j8gc3lP9gSyRVZAc/6n/uVczJSpmd4f UxO0z7dd19oFxM+LBXILAvXXEjUQ4h+jzDgnK+SwbY7VWMKkz5Kh81mGu +B7QQiiezLR/QtW7fy1nnMmL42AYbT+2i5PpbMmudCVQQ30MTdRuxd71K KdDEjBaywLTRQWpgIPb759dRn9fKIIMGEDsS6TE7oiVWhXXKE9DLytXgk 9sElGxr15C9ztr1V0seP0ibdqTW3hVVeNpGioRB5GZQyc8CKpjmgYRulz g==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903435" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 04 Feb 2022 13:15:26 +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 26FEC280075; Fri, 4 Feb 2022 13:15:26 +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 7/8] media: imx: utils: Add more Bayer formats Date: Fri, 4 Feb 2022 13:15:13 +0100 Message-Id: <20220204121514.2762676-8-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204121514.2762676-1-alexander.stein@ew.tq-group.com> References: <20220204121514.2762676-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-20220204_041532_237452_E3B9B14E X-CRM114-Status: GOOD ( 12.70 ) 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 as it is not enumerated as supported format. Signed-off-by: Alexander Stein Reviewed-by: Laurent Pinchart --- This adds the following formats to `v4l2-ctl --list-formats` [...] [18]: 'BG10' (10-bit Bayer BGBG/GRGR) [19]: 'GB10' (10-bit Bayer GBGB/RGRG) [20]: 'BA10' (10-bit Bayer GRGR/BGBG) [21]: 'RG10' (10-bit Bayer RGRG/GBGB) [22]: 'BG12' (12-bit Bayer BGBG/GRGR) [23]: 'GB12' (12-bit Bayer GBGB/RGRG) [24]: 'BA12' (12-bit Bayer GRGR/BGBG) [25]: 'RG12' (12-bit Bayer RGRG/GBGB) [26]: 'BG14' (14-bit Bayer BGBG/GRGR) [27]: 'GB14' (14-bit Bayer GBGB/RGRG) [28]: 'GR14' (14-bit Bayer GRGR/BGBG) [29]: 'RG14' (14-bit Bayer RGRG/GBGB) [...] 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 e0a256a08c3b..ea56c82d3b32 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 Fri Feb 4 12:15:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 12735019 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 C8A42C433F5 for ; Fri, 4 Feb 2022 12:17:32 +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=MAnsKKUmgI7gvPkvq0HCqxZ827ELuLvC348eXI1ZEI4=; b=L81bLX+ITJUjiI GUS3js36dpAvig69R2b9bjKpC4V1lmw4RKrhWaZO46nVdL3zB0CltoY+9wc4ns+G7CzcndAPXPDep 3Vkqmw3YF5QFxmKQ00RUNKvgP3C+1/WOVwqgm+etk8j4hCWwfT84+SaRKZdn/BAN7FaHYb/y/2ax8 kl1hLbHBcrsUEkuiWEt5OuDUboCxUwSVPcPfLOkFDGmTrvOMhNFJ/IJmNcU2yar0qfc92ArWs/bBP 4nf5/jZBrdNepOBOXlNPviFh7C4nBPMgm++WXBhNFWo+G834RrbwYuw4h4oZTbEhzHqh0mOeDfQfH 1rpnZVBli3JhAQpEWTyA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nFxVc-004CzR-Lf; Fri, 04 Feb 2022 12:16:12 +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 1nFxUy-004CcR-6F for linux-arm-kernel@lists.infradead.org; Fri, 04 Feb 2022 12:15:34 +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=1643976932; x=1675512932; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WX0S5yywfJteoi/TvV8TssMpvmQJ3W0EAQZbPxU9SAY=; b=XPCFQ2eVV8sDZOxSo+SlgGVuMPo5sBkdpwqIg4a3BFQR/vax7IZ3246e GTTVoX4v+uZP8djQIyRIqjPaB7f35gOPEjtGo99gFRASVyzNuwwPnnWCs PGQfQAZUiYTz9jIg+nCdIwanDH4Yv65IhEhzE7JRRgGdho4vxbOHVms/j Dsn3vImP+yE+n2syLYfrBB7Y3h/uBokQ/woA0GcPgOIZUMn6wWAzMomZy IimZ1Cm9Yta4/bXnEavsbintAo6B088fqY2hbjy00FJmhA/szpovF+5xT vx16ar/CQBMEc2iaNug6gK8YYOJup0wSE1elGpiQJ9jgG9FkUcW37PRR6 A==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903438" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 04 Feb 2022 13:15:26 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 04 Feb 2022 13:15:26 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 04 Feb 2022 13:15:26 +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=1643976926; x=1675512926; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=WX0S5yywfJteoi/TvV8TssMpvmQJ3W0EAQZbPxU9SAY=; b=UNFkcce9q6budxdHMNO+j4l/CwIDPZuVxW1Nz0ysYQ9GbAPUbSlNyFIP VI0OHH3sxX7/zQ7b14VXozFCEqBdqyb+/KRXq7Ng+9CS0dc8xCFdN6JYX h/mK2SQxQ7MqCjov6EXNr5ndPkGfeMcXTRmm+Y8KUg1hqmTpoOy3X7ei6 lui4d6HbmzT4aLSi9LtnW6rz/krFy3wDqa2seirQfvGIqNKH80xehZ7v+ Vrczd38PFJWWMgOzsojS8dstUifJhgTOC+WcSb+yDjL/h6EMU5vCn5xiZ u4vrqwLd2RcuOJuYjUMGxHkcBRPUa+ysiJh5TcQS3X3dzDq+d7kk3w65w A==; X-IronPort-AV: E=Sophos;i="5.88,342,1635199200"; d="scan'208";a="21903437" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 04 Feb 2022 13:15:26 +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 6D5A7280065; Fri, 4 Feb 2022 13:15:26 +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 8/8] [DNI] arm64: dts: tqma8mqml: add IMX327 MIPI-CSI overlay Date: Fri, 4 Feb 2022 13:15:14 +0100 Message-Id: <20220204121514.2762676-9-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220204121514.2762676-1-alexander.stein@ew.tq-group.com> References: <20220204121514.2762676-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-20220204_041532_613140_355FB439 X-CRM114-Status: GOOD ( 15.10 ) 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 --- 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 852615febf9a..5ef8ff05452e 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