From patchwork Mon Nov 28 15:23:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 26833 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:adf:f944:0:0:0:0:0 with SMTP id q4csp5750800wrr; Mon, 28 Nov 2022 07:29:00 -0800 (PST) X-Google-Smtp-Source: AA0mqf739KXsAucOO73meE7iHbs/sBOawcz+d/09Yhg+6LlqiABnkZej7sjOONgJE6cWGM17cAnK X-Received: by 2002:a17:906:3510:b0:781:b7f2:bce9 with SMTP id r16-20020a170906351000b00781b7f2bce9mr44780815eja.269.1669649340436; Mon, 28 Nov 2022 07:29:00 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1669649340; cv=none; d=google.com; s=arc-20160816; b=uE1+0m9NjbA/3dLGyYAlls/VKI0IyZPQHnLJOp/zScGXVPJQ2ZKlcPVNlL+4iuLKi6 g1peXxEzOZ1YO+/UZ2PPNl8rpKOGzWIUqbtuyHRNUYeWQBYVgD1FshXy450X680we4Xn 0EZpJGYXQmqmNIWFnpBoGhCov5EibdkoqoZzYUFyGDuRKdb6ZvePkWvLjRbEt92eSM3v UpqP412djlyI/80Xa00MWhU2MXrYKl5P04GQXVGBwwqKLBkqAxVlj7XO//3Dlqrg+wvO mAeXE/M2BPAgENsZrod2Bhy+Iw9/CgiLGHMrEz2C/9VxkpI/JmY5XDkISwYe9MtmPQx9 /OsA== 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=UjvGbhMIPshNH6r+U4pNOMQErXxL1R+/BUmp5ombR6g=; b=lJPGYuU/po3c7VXDNQcmTn3NEK8iKdkClhIRxUUypERBr1MMzgu+982A2AtBBBDDom /wCc+nCj7oHaYfrlCjLa5/N4W7n9+Dye513DKgys8PkdnLOoFsXMbHtvxgoWA5/WY94f kBOaBmlRylOj15bO3rsRak3g6C3ydp13YAKWtkjExtVn5LUQkXg6gTja2lVWBnp3Evdn pvMN8F4IMSV92tBFD7IHAK1ew2zo3DpS/Seu3Do7BqgCwyC3Cco+iHMsBI3hRVJOjWqh W5ios9TRiGEtF4r42Wvreg+iYuhn6JxgnzpLQ/XQ80IG4mtDZqbHhUTrPV3QqIPAIx5V ZmVw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=pUno4S6k; 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 hq35-20020a1709073f2300b0079ddb52369bsi11447766ejc.61.2022.11.28.07.28.34; Mon, 28 Nov 2022 07:29:00 -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=pUno4S6k; 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 S231950AbiK1P12 (ORCPT + 99 others); Mon, 28 Nov 2022 10:27:28 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33456 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232191AbiK1P1C (ORCPT ); Mon, 28 Nov 2022 10:27:02 -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 9D47925EA8; Mon, 28 Nov 2022 07:25:20 -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 AD58F100007; Mon, 28 Nov 2022 15:25:14 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1669649119; 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=UjvGbhMIPshNH6r+U4pNOMQErXxL1R+/BUmp5ombR6g=; b=pUno4S6koP2DDFvf1tyavj8bIjzBQKJ9UhviqdzkeKljSy1SYXaxgh9n4q+ZrFyx5KXhv0 mbLWxIN00431CfuZ0Q8CT6iCCKCOUjrWQ6JnuFYFCueA6mqVoszHjbDLYPvqj2TW6CDI0O bj6I9fTW1t3VbFBhJO2XoKxjFo0sobjnTB3KqFGj6mv7of1nVxmuOlIllQudrtp8cZH7uY UBYY2XzYzywcAlX3SuZymw9JB/K4cjKfFCnDJYlaJGFdiM5JBG0IgUpexZK6dYxIZkewPb ioNdaCTTJvdw1GPQoNUQk+oKJynjdTSK0gJ6Zv4igUvI5s9QkuTZDgNSdAbalg== From: Luca Ceresoli To: David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , 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 v2 13/21] staging: media: tegra-video: move default format to soc-specific data Date: Mon, 28 Nov 2022 16:23:28 +0100 Message-Id: <20221128152336.133953-14-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20221128152336.133953-1-luca.ceresoli@bootlin.com> References: <20221128152336.133953-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?1750754227023944698?= X-GMAIL-MSGID: =?utf-8?q?1750754227023944698?= 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 --- 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 12c2fa760c81..8b6cf50e1eae 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;