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 *