From patchwork Fri Feb 11 14:27: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: 541966 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 41388C433FE for ; Fri, 11 Feb 2022 14:28:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350780AbiBKO2H (ORCPT ); Fri, 11 Feb 2022 09:28:07 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59926 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1345315AbiBKO2F (ORCPT ); Fri, 11 Feb 2022 09:28:05 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 16FE6CF; Fri, 11 Feb 2022 06:28:03 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1644589684; x=1676125684; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lNoAxk7CDLU7Uu+yU4S2sx6BWwlzCE6uhHKVHBIsjts=; b=HDqjbJKqto5aXsHr7sKRX3Awhff+/oudetYbRdno03VfV5bp404i7pqM PSjGfxk3eri7hF3zIfI87tkaFKtgyZX7g5e2r7B2VE0iT7CUJ/qhYCeKj SAvUf7PijAZ81+mAhDEI6XK4e08MDBxpG5N16vT6/T6c6wYX19ln2vLSs Io+wPiBmQ7H2qspFD9EAnup1weMaLDh750ABroAKN4A44jnr7qq99PUvb 2IW1HQcRRN/QZvWSfBx0d5eVAPUps67ZdgEqoULxc2TxBUJmuP4ZU03lJ hXYOOCanw4QeZbU3FV2mxHJqadIqGuMtMUlewjJffZdevN3y1bZDM+E1G w==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042279" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 11 Feb 2022 15:28:01 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 11 Feb 2022 15:28:01 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 11 Feb 2022 15:28:01 +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=1644589681; x=1676125681; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=lNoAxk7CDLU7Uu+yU4S2sx6BWwlzCE6uhHKVHBIsjts=; b=pylvtUtRyS/4T7U54VbycEpoi/EYmr+sCWOersQUOp2RRuLZZE9OO2kS xBunpvf578b4OZTCZGZsoH5/HxkFgyCpdzZ8Rex6dxVEa600x04jGOr+W 5JLB8kMCnfBnG8gZfwUK1LvrOqDAOu902QL36f2uMfscISSHVpV0HQO44 yBxZ8xvNRsr15fCW9mR/MvMPhzqnB+F2tDbqmcpnyDNeD5U/sNRTbLbWo UkMucDng1Rnef246HKsp2gqhZFmuYKK1kxbG09T1TOTVbxAF2CQQ8Ljde ab98m1fV038jpDJMSJ3YeWalRXRVZ6Ko/YbgS7bXjhXq63xyiZt1kBD9J w==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042277" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 11 Feb 2022 15:28:00 +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 7B5A6280075; Fri, 11 Feb 2022 15:28:00 +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 v2 1/9] media: imx: Store the type of hardware implementation Date: Fri, 11 Feb 2022 15:27:44 +0100 Message-Id: <20220211142752.779952-2-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> References: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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 v2: * Switch back to using enum 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 bd7f156f2d52..d5557bb4913d 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, + 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 32311fc0e2a4..173dd014c2d6 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, + DEVICE_TYPE_IMX78); if (IS_ERR(csi->vdev)) return PTR_ERR(csi->vdev); From patchwork Fri Feb 11 14:27:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 541965 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 72E3EC433EF for ; Fri, 11 Feb 2022 14:28:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350797AbiBKO2J (ORCPT ); Fri, 11 Feb 2022 09:28:09 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59944 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350782AbiBKO2H (ORCPT ); Fri, 11 Feb 2022 09:28:07 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A6768C7; Fri, 11 Feb 2022 06:28:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1644589686; x=1676125686; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KxUxndkotnH5yr6uUoFqaSWbYhYL9OQrUbXKgdspQi4=; b=FVEh/vrUp3vf6owkslNXqjZDmmAPvLQFuimixj6f2GLjgSxJsPKYSDDk 6rosQWYUiQZucGKhq/T8nOoozT6zEcQWrOt2lmSSFXwL6wzPrscZCNWm2 XvTE9yiQqO46iHYeVHwQNPOjzSb6/iDiqSk5cTtDEqfZym7MrsDGo7XwL SJOeJZiVDoM7JsgUbYP4Nl1lWV/hzMTbDOHF0WOJFqQC/xE6zqswUKgbq dA7KCT4nDiCja10W383u5urocIXIZwd34eTXFk1x5dObOohbvCGkfo4+W McdC56qcOw8oMaY2zlja/HuYo0DpDoNDq6zATHJhlebdf40yXItxj4kbv Q==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042281" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 11 Feb 2022 15:28:01 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 11 Feb 2022 15:28:01 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 11 Feb 2022 15:28:01 +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=1644589681; x=1676125681; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=KxUxndkotnH5yr6uUoFqaSWbYhYL9OQrUbXKgdspQi4=; b=D3VpOMgeHtT8ty9hwXauIOf8XjA6fUGMBTywnpsDafmy0cCQ1ro8gA6L xuQjKG1+aa1NJisJUvNb++EW79iVeVWfzSaZK/5939CW+Y1Om5QsA2RDV Bq6VBTlfsWFCaLNuY2pVrBD6YNPnll7B1D5vP+PdEHhUHMQEfcriSH31Q Gt5RWDNKKXqDZj4/Vyc05LiACE3O49zncMCnzguquoY9zXglX9u9NdKzd ky7WkVq0JqbW0jVYtYT4CNNB9nTypp/9MiSpr5wGLvNT+tHVVElFvDJIb ZzQ2KLng05LNZm3kGW9UCZwgfWGXf7fJNafAf+SkCzk196vgcLMY51NNA A==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042280" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 11 Feb 2022 15:28:01 +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 D084F280078; Fri, 11 Feb 2022 15:28:00 +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 v2 2/9] media: imx: Forward type of hardware implementation Date: Fri, 11 Feb 2022 15:27:45 +0100 Message-Id: <20220211142752.779952-3-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> References: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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 v2: * Switch back to using enum * Added Reviewed-by: Laurent Pinchart 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 Fri Feb 11 14:27:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 541964 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 64628C433EF for ; Fri, 11 Feb 2022 14:28:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350835AbiBKO2S (ORCPT ); Fri, 11 Feb 2022 09:28:18 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:59968 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236678AbiBKO2J (ORCPT ); Fri, 11 Feb 2022 09:28:09 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A295C7; Fri, 11 Feb 2022 06:28:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1644589687; x=1676125687; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jyjqm1guo7eCJ26INStDNcH149noY5F5ukFsurO5hjM=; b=ijElK8zyd2cKjOmSa73n9lPxOhSeZi25Ppd6hRgF4SczvbUdz6oK+fPG /MLEc1Q33ztPD1nNaMi/f0fKW/uCjZtQqZBQzNaE1o+5iOKiOqzfAUJDD oLUM31Gm7IBHvbnLOLFn0M0ASyUrSJxCA/fLEh8zqe0++44EcuzLAH6Yn u55fM9sZvnb85mrl9oDkxEIl4D2XeeKWctZQvOKYre4/q6IYEiPx5RXHJ 6fjJrMh9KUw/ob6si3+GXQYaSVyY4KpAncZSf35JSaCYi7vKws4PJ+Yow H/pydG+xC3zQSmSgV8jceRDt/WK5ywV8Iebi3G+4KrgMSU2wutRApsO9b Q==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042287" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 11 Feb 2022 15:28:02 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 11 Feb 2022 15:28:02 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 11 Feb 2022 15:28:02 +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=1644589682; x=1676125682; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=jyjqm1guo7eCJ26INStDNcH149noY5F5ukFsurO5hjM=; b=jUJbuqe9IzrHR55d/NDW2BudEfLR7S1sHyC8mcxeAipryI/O1JEWUtmM DZTrwwhyqnm4Y8Y2iY2iPmqFKT1iuQfWRz4EfT/Rp9ADL7o9jiu0RK4UD Xm7EtI4fk4An7zG2AKBNxCVi4HIIVnmWi95zNbRf9mAx2BKwwWlwOlSZm YSUtzY5CtMsUoGAzXVKci3hpcGtV/xNkYQRA35Jaf7gJAB/FVboRQAjrM 4jtTgRnbi2LbwHNXu/zO7AtM2E2E70vOltJ3yGOmzoD4DwOTGZJdfteJT cu0fTJV0GM1tBfzzA1SHNXYkc1qxTLTOTf3fBKdEtkp7erkdzhPMi7XLl A==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042286" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 11 Feb 2022 15:28:02 +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 D0D31280078; Fri, 11 Feb 2022 15:28:01 +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 v2 5/9] media: imx: imx7_mipi_csis: store colorspace in set_fmt as well Date: Fri, 11 Feb 2022 15:27:48 +0100 Message-Id: <20220211142752.779952-6-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> References: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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 --- Changes in v2: * Store other colorspace-related fields as well drivers/staging/media/imx/imx7-mipi-csis.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/drivers/staging/media/imx/imx7-mipi-csis.c b/drivers/staging/media/imx/imx7-mipi-csis.c index a22d0e6b3d44..388cfd012212 100644 --- a/drivers/staging/media/imx/imx7-mipi-csis.c +++ b/drivers/staging/media/imx/imx7-mipi-csis.c @@ -1062,6 +1062,10 @@ 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; + fmt->quantization = sdformat->format.quantization; + fmt->xfer_func = sdformat->format.xfer_func; + fmt->ycbcr_enc = sdformat->format.ycbcr_enc; sdformat->format = *fmt; From patchwork Fri Feb 11 14:27:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 541962 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C821C433EF for ; Fri, 11 Feb 2022 14:28:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350820AbiBKO2X (ORCPT ); Fri, 11 Feb 2022 09:28:23 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60138 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350803AbiBKO2P (ORCPT ); Fri, 11 Feb 2022 09:28:15 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D8F4B21F; Fri, 11 Feb 2022 06:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1644589689; x=1676125689; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2YbGiltNp/YE4sAiVmdcESfjGWWvEMo8y3ASodgdy24=; b=ASSIUh4/GBZc//5scbIVr5axhNENCuiYSoyZlMmjqT2GLi6Biw/r7YEl 1QJphKAPdXzIMtQPSMSDBBkDN2dKEctaO87NO3uz3dcSSeyF4N0XrOXh9 FUylGNeSrsPAAhJRFTYdrEMgidaiSt3rnueaTvFzBOgpEA6ExYOjyJcGZ j3BfF9Vmhu5x76Gr0fk01h3e5ENE4+rytdkz739FVWdSW/TS+mJVAYAdl d4zUn4U61dbaY9q4Q6ixiCdYuB+mo9Cl16IApZ12+ek26r3VHAWSCacK/ kwIHctHGosaarootPcGHlKPZZ22mur7l8tLRYFNLiNQeAaapuUN7vjrjB Q==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042291" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 11 Feb 2022 15:28:02 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 11 Feb 2022 15:28:02 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 11 Feb 2022 15:28:02 +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=1644589682; x=1676125682; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=2YbGiltNp/YE4sAiVmdcESfjGWWvEMo8y3ASodgdy24=; b=RVnyBrXpP49Mnw3iSjq5n36YBxv+AjKKAhB8lryGc/V9ZSEJRMZ6uGr5 HgS9tw/9Ax7nz9aSy+8c4PqHcooukytnpx3xl8/kHEZBWCAXYadSgwCGZ pv+i/SP1S2w5575egc6DFYxZbpgdVPZy1MuCDZcAOJFKI+rerBCtTy5nX 9p1BbMAc1s3DgMGOr3v9hJZC9HVHQriaPLWiaQMjpKuA3eHYZHEnoCFBV mbRbnQ7+I7Xkx6NTf84c/SkFyb04QZTkdtt6rQ3etc1hwHraZO7oL5ekg bnZzDkROzk/ZspBfXpmOBE0j1ymFhbLHTHKeGRLbtZOAKkciEl+W33SBE Q==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042290" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 11 Feb 2022 15:28:02 +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 6C212280082; Fri, 11 Feb 2022 15:28:02 +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 v2 7/9] media: imx: utils: Add more Bayer formats Date: Fri, 11 Feb 2022 15:27:50 +0100 Message-Id: <20220211142752.779952-8-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> References: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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 v2: * Added Reviewed-by: Laurent Pinchart 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 e59aaa77172a..57eb1c5897c0 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 11 14:27:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Alexander Stein X-Patchwork-Id: 541963 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9EB19C4332F for ; Fri, 11 Feb 2022 14:28:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1350843AbiBKO2U (ORCPT ); Fri, 11 Feb 2022 09:28:20 -0500 Received: from mxb-00190b01.gslb.pphosted.com ([23.128.96.19]:60184 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1350815AbiBKO2R (ORCPT ); Fri, 11 Feb 2022 09:28:17 -0500 Received: from mx1.tq-group.com (mx1.tq-group.com [93.104.207.81]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 40229381; Fri, 11 Feb 2022 06:28:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=tq-group.com; i=@tq-group.com; q=dns/txt; s=key1; t=1644589689; x=1676125689; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VVwA5iF57xiLgmukQKD1z++wAGAZGsYpQ1hwH3ud7Uo=; b=fB+nkt0BsQWWXlaIkb3Vi9QTN/o7stLxnAZTy94cgLYKM6Y9aq33Plso wSIsE5dTo0IktEsHm9Umgt0YdscC61bbW1xwYJ2M6NwVAafrBUKLwYSlf pHYs0zSJvBzesv1/BKEskrpHO1MEmm4IwGY8DWqjEMnPOaAYhtzooWG1a ezh45OMn/q4CzpPkYa2TrmOJajj+vBf1Npq/0yzL6vcJtkWBwSrktGTyH TjmZAsQ/QDArYFlEFKOHEel1K/K8+0WxkNQYL0FnIl41BC4tFiM6wC+Jz dWt8yQ0pHxAMjF9laVRgc5kW3Vf0EPGzXcPsGnz/P/TPz8aPcOzQ5nakg g==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042293" Received: from unknown (HELO tq-pgp-pr1.tq-net.de) ([192.168.6.15]) by mx1-pgp.tq-group.com with ESMTP; 11 Feb 2022 15:28:03 +0100 Received: from mx1.tq-group.com ([192.168.6.7]) by tq-pgp-pr1.tq-net.de (PGP Universal service); Fri, 11 Feb 2022 15:28:03 +0100 X-PGP-Universal: processed; by tq-pgp-pr1.tq-net.de on Fri, 11 Feb 2022 15:28:03 +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=1644589683; x=1676125683; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=VVwA5iF57xiLgmukQKD1z++wAGAZGsYpQ1hwH3ud7Uo=; b=bwilSwPasSRi2A0rXc1P3ecoRUbBlWFywWx/pFGJ1QJ6+ItLYiHz5jfE a16799MGhdlDrWd9g+g/5Ry813AqSYuEz2Y2bnAc1mqCfrXWKzDlZK6ZI b35CPt1Xlwe3nYKnRttbUGpeeW6qwdSbs5GII7L5wSUmnd+wERY2zUxAH AFAlxucXUE1g9N5tDXtyXVn9+xE+Aqn0ozAoEpI8sfmQhWPv244tDyJ5u KUGOJC/+G8Ii+eksOaC3odXKH2bM+L+vwX2UvNaWGJbxIqeXxszrBAmZd j3sSIa2jyJsfjZAMK0lGbtKOxnHSlMewKdQ7AaEIs770C3JfhV2UvJFbB A==; X-IronPort-AV: E=Sophos;i="5.88,361,1635199200"; d="scan'208";a="22042292" Received: from vtuxmail01.tq-net.de ([10.115.0.20]) by mx1.tq-group.com with ESMTP; 11 Feb 2022 15:28:02 +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 B14CF280084; Fri, 11 Feb 2022 15:28:02 +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 v2 8/9] media: imx: utils: initialize local variable Date: Fri, 11 Feb 2022 15:27:51 +0100 Message-Id: <20220211142752.779952-9-alexander.stein@ew.tq-group.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> References: <20220211142752.779952-1-alexander.stein@ew.tq-group.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-media@vger.kernel.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 v2: * New in v2 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 57eb1c5897c0..025c080c8c9f 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);