From patchwork Mon Jan 30 14:15:56 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 50316 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:eb09:0:0:0:0:0 with SMTP id s9csp2204161wrn; Mon, 30 Jan 2023 06:19:58 -0800 (PST) X-Google-Smtp-Source: AMrXdXuYpreHr0qVsiCSILC/BMQudUqVtU5shdlNGn2WNn7UJSer8q2ROfEDw2CxOcqCC3Zaj4Tl X-Received: by 2002:a17:906:1e42:b0:86f:763c:2695 with SMTP id i2-20020a1709061e4200b0086f763c2695mr47089508ejj.17.1675088398310; Mon, 30 Jan 2023 06:19:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1675088398; cv=none; d=google.com; s=arc-20160816; b=BD1o3iZYuA3GNRKDyOuYrSZ8slcgLKlxH34gp2vykW9aTHqpetiL2GG3codi9clkMx jaYu+csqwtc85cIru/RdCvd0q7UTL26Ul9p9M/7Gxs7KC/WSKFtkqyNXku3/bYS/hEBS humWpHuNEw+fZM/+Ft2KYNr42CB3/SiGe7VSUu9SGqWWTMxBrzN6mh23Iz0q7XR85dat SnlswreCqMBa4ofo+VYGXMaU/+k+8W5vAJn3gqiIvw346cdLi60N1e33qTa+8ZpMS2FN N1cVnl+5k+lXdTQvpGvMctNpUFO75FYrhy4X3Gs1EnIn2LX3/H7fh/GjA00jtRKgeE3A Cucw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=8x6ANxKmlQRR8yGJcgQ569q5zpdBXVx3vBAjyJdMrk4=; b=DfpE9b22NcphcJC4OG6VGMynGSQDZtWvJBcc8JtPT17qDGPCy6E40ArzgEy8ycbmuD W0dxBLNvmBr3TOzawicFtOlpYjPsPsmEIx5+9bvsn7uz+FX31qrv5trgQJV5L32oTGdK VnFg1Xfr89hJv65cPY2+9U0Sr7CHX0z+Pxf2eldecGBoXKy8TQsopkGMGfx1sTL4O+kx Y9XDoCzCiJoCQN4qCFuhD6a9K1Xwb+gYOU8Nxqx58qsMRgOay/jGHREBzwQHfxYT09SX 6vNDYN1MUWog19BFe3Y+qrjH48dNGxDz5bFjoLHBPAiJJZzDSwRdVt0/ry96+jM3Yr6r 3jXQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=TNgP327G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id y11-20020a170906518b00b00881d41165desi7345647ejk.920.2023.01.30.06.19.34; Mon, 30 Jan 2023 06:19:58 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=TNgP327G; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=bootlin.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S237418AbjA3OTI (ORCPT + 99 others); Mon, 30 Jan 2023 09:19:08 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60644 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S237604AbjA3OSe (ORCPT ); Mon, 30 Jan 2023 09:18:34 -0500 Received: from relay11.mail.gandi.net (relay11.mail.gandi.net [IPv6:2001:4b98:dc4:8::231]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A64E23D089; Mon, 30 Jan 2023 06:17:41 -0800 (PST) Received: from booty.fritz.box (unknown [77.244.183.192]) (Authenticated sender: luca.ceresoli@bootlin.com) by mail.gandi.net (Postfix) with ESMTPA id 0BDA610000B; Mon, 30 Jan 2023 14:17:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1675088251; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=8x6ANxKmlQRR8yGJcgQ569q5zpdBXVx3vBAjyJdMrk4=; b=TNgP327GTC98tUC+BcpTCv9ipYhjJ9ZPTeRziv4Yt6NTRcp/KRDrLHj65SPKvUy87324CJ /jB75ABQkNl+XhOMcSsARGf1ofR5cohyXAkaW6ZUVcG2NLKLt9YHIzi18RFUCr11UDQGAa kEqFGPsYu4N6wlUCyG9vcoFLa+xL6YdKrE0e12ck7xWBdbbZ68kopQXcrvD8JHAWR8151H spZ/06aJY8MTXJFcrKG1z0x1MBWjV6FMyqTQBNCDQxuZ8D3Lc3zersJs4JEHHoa8yl3eyW mI7e5AGTIzWtOOzJbhRij0+vqHW+5xiu6wl6LTtwdHbR57zfMkj1H95vLVISMQ== From: Luca Ceresoli To: Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Mauro Carvalho Chehab , Greg Kroah-Hartman , Dmitry Osipenko , Hans Verkuil Cc: Luca Ceresoli , linux-media@vger.kernel.org, linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Thomas Petazzoni , Paul Kocialkowski , Richard Leitner Subject: [PATCH v4 14/21] staging: media: tegra-video: move default format to soc-specific data Date: Mon, 30 Jan 2023 15:15:56 +0100 Message-Id: <20230130141603.323221-15-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230130141603.323221-1-luca.ceresoli@bootlin.com> References: <20230130141603.323221-1-luca.ceresoli@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-2.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,SPF_HELO_NONE, SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1756457492332129090?= X-GMAIL-MSGID: =?utf-8?q?1756457492332129090?= The tegra_default_format in vi.c is specific to Tegra210 CSI. In preparation for adding Tegra20 VIP support, move the default format to a new field in the soc-specific `struct tegra_vi_soc`. Instead of an entire format struct, only store a pointer to an item in the existing format array. No functional changes. The format pointed to is the same that used to be in vi.c. Signed-off-by: Luca Ceresoli Reviewed-by: Dmitry Osipenko --- Changed in v4: - Added review tags No changes in v3 No changes in v2 --- drivers/staging/media/tegra-video/tegra210.c | 2 ++ drivers/staging/media/tegra-video/vi.c | 11 +---------- drivers/staging/media/tegra-video/vi.h | 2 ++ 3 files changed, 5 insertions(+), 10 deletions(-) diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c index 71483d0c19bf..28d3d05c12c4 100644 --- a/drivers/staging/media/tegra-video/tegra210.c +++ b/drivers/staging/media/tegra-video/tegra210.c @@ -771,8 +771,10 @@ const struct tegra_vi_soc tegra210_vi_soc = { .hw_revision = 3, .vi_max_channels = 6, #if IS_ENABLED(CONFIG_VIDEO_TEGRA_TPG) + .default_video_format = &tegra210_video_formats[0], .vi_max_clk_hz = 499200000, #else + .default_video_format = &tegra210_video_formats[4], .vi_max_clk_hz = 998400000, #endif }; diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c index a76cad0e3026..3762fd273514 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -44,15 +44,6 @@ struct tegra_vi_graph_entity { struct v4l2_subdev *subdev; }; -static const struct tegra_video_format tegra_default_format = { - .img_dt = TEGRA_IMAGE_DT_RAW10, - .bit_width = 10, - .code = MEDIA_BUS_FMT_SRGGB10_1X10, - .bpp = 2, - .img_fmt = TEGRA_IMAGE_FORMAT_DEF, - .fourcc = V4L2_PIX_FMT_SRGGB10, -}; - static inline struct tegra_vi * host1x_client_to_vi(struct host1x_client *client) { @@ -1111,7 +1102,7 @@ static int tegra_channel_init(struct tegra_vi_channel *chan) init_waitqueue_head(&chan->done_wait); /* initialize the video format */ - chan->fmtinfo = &tegra_default_format; + chan->fmtinfo = chan->vi->soc->default_video_format; chan->format.pixelformat = chan->fmtinfo->fourcc; chan->format.colorspace = V4L2_COLORSPACE_SRGB; chan->format.field = V4L2_FIELD_NONE; diff --git a/drivers/staging/media/tegra-video/vi.h b/drivers/staging/media/tegra-video/vi.h index 1021c730b595..879547073371 100644 --- a/drivers/staging/media/tegra-video/vi.h +++ b/drivers/staging/media/tegra-video/vi.h @@ -58,6 +58,7 @@ struct tegra_vi_ops { * * @video_formats: supported video formats * @nformats: total video formats + * @default_video_format: default video format (pointer to a @video_formats item) * @ops: vi operations * @hw_revision: VI hw_revision * @vi_max_channels: supported max streaming channels @@ -66,6 +67,7 @@ struct tegra_vi_ops { struct tegra_vi_soc { const struct tegra_video_format *video_formats; const unsigned int nformats; + const struct tegra_video_format *default_video_format; const struct tegra_vi_ops *ops; u32 hw_revision; unsigned int vi_max_channels;