From patchwork Tue Apr 18 08:00:47 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 84661 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2670477vqo; Tue, 18 Apr 2023 01:16:32 -0700 (PDT) X-Google-Smtp-Source: AKy350Y+izAx5eqSzY25xFBnH+y4I9TJLnqRUFdWjEP8xxdfxu0BhlyKoj9bXLa74SC5SvkNhHTK X-Received: by 2002:a05:6a00:c93:b0:63d:2d99:2e91 with SMTP id a19-20020a056a000c9300b0063d2d992e91mr5496412pfv.28.1681805792216; Tue, 18 Apr 2023 01:16:32 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681805792; cv=none; d=google.com; s=arc-20160816; b=l+4NHCs7FyuG1nqL7L1GaK5legs4hT5tE1nzpfVORkmQDYYoeK7s6z1t0IkdZ0Qe+y SKj7K69SJcktxlOr55Vu7P1I6ofBmU2wmqbVBbG1izfQ8L+lFHXsyVqBpJdheBCgHWCZ B5KouBvGXk9IUI3k539GgBHe1f9NwV23ep7onx1lqpn1NUrmEEtsNCZVfpgfJ8iexie9 z2grPTWDlV7azQG+uFGogOFuWeiqTBy4XeAgWeadqb0vqMu/8+SwRO7JIv/GrM5gBO3v hwjqDy5X4DEH1QouGreMURMGFTjqumNBRaJGQWiz9TKQE/UIcJms0gluljkytSf9wITV vClQ== 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=WiE3J/ZOXI1J5wUqjC9+bkIXh5jNrN6O4z7mUkMhHyw=; b=sleewKtR5Y/5jK8WYnhBUoBMH4CtNidPP5mgcH5b+aaLP/3zXMxetSWaRLzTKH/qRA 9zBWnUA4KZFcUyRBgFEWIoJgi2NfuhsZasrJcPkzbUsoMRS4dg8tDz1iOASeMgKqUQWb kaPIj3K1jRSvPgTZ1AEVwUmhllcvH4Ap/U9thxVys7mOPs7ChftWr3kwDeVdTNEGNwFu 80FjoBfxpC79W7wQA8YC8o8FMrtNe8Nh/w5yHBr5hmNnVGJy3BcBH2BYyH2OyaMOlGKU QrN48+YL27mcIRxkgpfbe0lYHpLOh1I9svaFujDasMI42rJjtkxB+WYo6V7TIxPfYba7 RQSA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=i5d1jmjf; 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 131-20020a630289000000b00502f0d2abc5si688074pgc.725.2023.04.18.01.16.20; Tue, 18 Apr 2023 01:16:32 -0700 (PDT) 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=i5d1jmjf; 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 S231549AbjDRIEB (ORCPT + 99 others); Tue, 18 Apr 2023 04:04:01 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:41344 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231551AbjDRIDc (ORCPT ); Tue, 18 Apr 2023 04:03:32 -0400 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [217.70.178.230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 54FA47EEB; Tue, 18 Apr 2023 01:02:47 -0700 (PDT) Received: from booty.fritz.box (unknown [77.244.183.192]) (Authenticated sender: luca.ceresoli@bootlin.com) by mail.gandi.net (Postfix) with ESMTPA id 120AB24001A; Tue, 18 Apr 2023 08:01:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1681804912; 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=WiE3J/ZOXI1J5wUqjC9+bkIXh5jNrN6O4z7mUkMhHyw=; b=i5d1jmjfVRl7A7wPSmJJsjHqYz6LwegI32FzADO4J45upyQzkYZj6YmWP0o2TOuZYDg2cm SjxNvdadRt1WocfK0qxLxvjFTTotO6boulfSPfQR689oX5uHrPeOfvSbt9SUh2g442i7rf ISsL0+hjuDb1tl15AeZMvmscZzTfTrlD+p3BGe7krJNfDZtumzaor7kdzPwYP8DG7WNZop oJldGlV87YpdxAbNjJAP7kR3P4wUvYQCPNix6qvdPF67EiIvqPHqvKBA6Jp82f4D6S+pgO j+pWCC2wfvlrSnoRIVcsr3MqLDCMO6mnB6wTvn9zK4FQxi1Yrm37NkqwnRQu7w== From: Luca Ceresoli To: linux-tegra@vger.kernel.org Cc: Luca Ceresoli , Thierry Reding , Jonathan Hunter , Sowjanya Komatineni , David Airlie , Daniel Vetter , Rob Herring , Krzysztof Kozlowski , Mauro Carvalho Chehab , Greg Kroah-Hartman , linux-media@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-staging@lists.linux.dev, Laurent Pinchart , Hans Verkuil , Thomas Petazzoni , Paul Kocialkowski , Richard Leitner , Dmitry Osipenko Subject: [PATCH v6 13/20] staging: media: tegra-video: move default format to soc-specific data Date: Tue, 18 Apr 2023 10:00:47 +0200 Message-Id: <20230418080054.452955-14-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230418080054.452955-1-luca.ceresoli@bootlin.com> References: <20230418080054.452955-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, RCVD_IN_MSPIKE_H2,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE, URIBL_BLOCKED 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?1763501189975273729?= X-GMAIL-MSGID: =?utf-8?q?1763501189975273729?= 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 --- No changes in v6 Changed in v5: - Minor update after removal of "staging: media: tegra-video: fix .vidioc_enum_fmt_vid_cap to return all formats" patch 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 | 13 ++----------- drivers/staging/media/tegra-video/vi.h | 2 ++ 3 files changed, 6 insertions(+), 11 deletions(-) diff --git a/drivers/staging/media/tegra-video/tegra210.c b/drivers/staging/media/tegra-video/tegra210.c index d19ff6b49ae8..b4fcd4e93b8c 100644 --- a/drivers/staging/media/tegra-video/tegra210.c +++ b/drivers/staging/media/tegra-video/tegra210.c @@ -766,8 +766,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 35d7cda1373f..b88532d8d2c9 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -45,15 +45,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) { @@ -1103,7 +1094,7 @@ static int vi_fmts_bitmap_init(struct tegra_vi_channel *chan) * there are no matched formats. */ if (!match_code) { - match_code = tegra_default_format.code; + match_code = chan->vi->soc->default_video_format->code; index = tegra_get_format_idx_by_code(chan->vi, match_code, 0); if (WARN_ON(index < 0)) return -EINVAL; @@ -1200,7 +1191,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 213955c7545d..b424c967c6f2 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;