From patchwork Fri Apr 7 13:38: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: 80816 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp297751vqo; Fri, 7 Apr 2023 06:48:30 -0700 (PDT) X-Google-Smtp-Source: AKy350YAUcR8JOVYNyYDGQJSKYNQccjExKSOv6LTeHcooVqch8k0bhwpr2so4KC4wcM55KAEptD2 X-Received: by 2002:a17:906:8489:b0:92f:e40d:1489 with SMTP id m9-20020a170906848900b0092fe40d1489mr2431903ejx.61.1680875310246; Fri, 07 Apr 2023 06:48:30 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1680875310; cv=none; d=google.com; s=arc-20160816; b=gI2nJzpROxl/w4+F4XZbQFIQ4ApoU40icXzVsn81mKD7ZD49MvElYNyzxh6cguT3E7 QADM/9iV6Tw8fXYoCgrUE9YAIthSYmDPA5zP4QluVH8q+dQgwdBjocMbFXpyvKAY7S3O bjNFEDlo+uq2ixkc69VbYkMui8pXeDCoRxxdyuddDKWlnY1oHq/7YNCogNZfoxmuqXoQ e3ZARJ7QiA9wwMPGMGJPQrqEe1YfgsTENRX4lZdSJO9ubPGt+NnlpDBbZV0s33TmSQro pXOtVuUAmWbz/5hbJBwDUvEGfM2kHxaLaYJOVmhB/fDvTmwP/DYHdbwY8by/6afTokJ1 GHWg== 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=Ygf/qeYppzYJXYai+PNpWGQlDNj3snqDrxmgKu6f+TY=; b=jr43O9Z0vjvGI6FPoV24K0ChhCU3W0Y8lPpVNd678mzf/4hH4X3qJ9pLqxVg+xqPEB SgFdeeNOaCfnOd7EH0dpmThzZHHgRde5fPtMg9UsJTxXBDLJrzV8xCKDx/dJT9vQrQVc vXoug8VXRarE7Te52FB+4Cpj/FevJbWC09Psc5ScPu7eq15Y2ix9MlyBK1WGXjNpgTtY FQp7fHJGtSUSgKpa/nwtF/mLTYLYgVjCTViJNcZsrglxwYE5DllRgj9q0kktyVuOOIbX 92ZEkConIzC23ZjssS8hkgF9yT9i1Rik/an25U5YNX9/IPFTQ/9loF9s4BM+Zazm5/Gr o/OQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=ZoV+4C2N; 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 r12-20020a056402034c00b005026a8a0df5si538332edw.254.2023.04.07.06.48.06; Fri, 07 Apr 2023 06:48:30 -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=ZoV+4C2N; 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 S240274AbjDGNnI (ORCPT + 99 others); Fri, 7 Apr 2023 09:43:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:48220 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241022AbjDGNme (ORCPT ); Fri, 7 Apr 2023 09:42:34 -0400 Received: from relay8-d.mail.gandi.net (relay8-d.mail.gandi.net [217.70.183.201]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0997193; Fri, 7 Apr 2023 06:41:01 -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 0868B1BF20F; Fri, 7 Apr 2023 13:40:27 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1680874833; 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=Ygf/qeYppzYJXYai+PNpWGQlDNj3snqDrxmgKu6f+TY=; b=ZoV+4C2NrHMoflsnUkxZuViwSqyyns+Zl9xSgOkcI9axuryGKsBj1umm0153aiN8qNGIX9 9y8YBz0XX2IwCH0w9/sxQKPEo6wmzwb2NKeeCOT+jjnpVzQCDqc49ZnPs5frZWfbXw+Mr0 1srYqOh6IeIKMoKmsbrIA8r2ANOW9RAtS1vWMkBIO7yQs9tD/N3TJXdEbdqi/7NzsQBFvq Iq5R7amvLAxzHN9nao5eCCHWylQdCoG5Kg3IDIxtLB31PIWnx0pDs8t4hslr+xdq7Pkpn9 PKC8PAxhPBo0loUauUSSZnqjiI1FnU2gjmBDBgj/e5pcIUb1gRKd+oz7cbBWJw== 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 v5 15/20] staging: media: tegra-video: add a per-soc enable/disable op Date: Fri, 7 Apr 2023 15:38:47 +0200 Message-Id: <20230407133852.2850145-16-luca.ceresoli@bootlin.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230407133852.2850145-1-luca.ceresoli@bootlin.com> References: <20230407133852.2850145-1-luca.ceresoli@bootlin.com> MIME-Version: 1.0 X-Spam-Status: No, score=-0.9 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_LOW,RCVD_IN_MSPIKE_H2, SPF_HELO_NONE,SPF_PASS autolearn=unavailable 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?1762525509456829351?= X-GMAIL-MSGID: =?utf-8?q?1762525509456829351?= The Tegra20 VI needs an additional operation to enable the VI, add an operation for that. Signed-off-by: Luca Ceresoli Reviewed-by: Dmitry Osipenko --- No changes in v5 Changed in v4: - Added review tags No changes in v3 No changes in v2 --- drivers/staging/media/tegra-video/vi.c | 7 +++++++ drivers/staging/media/tegra-video/vi.h | 4 ++++ 2 files changed, 11 insertions(+) diff --git a/drivers/staging/media/tegra-video/vi.c b/drivers/staging/media/tegra-video/vi.c index c76c2a404889..8df233049c81 100644 --- a/drivers/staging/media/tegra-video/vi.c +++ b/drivers/staging/media/tegra-video/vi.c @@ -1950,6 +1950,9 @@ static int tegra_vi_probe(struct platform_device *pdev) vi->client.ops = &vi_client_ops; vi->client.dev = &pdev->dev; + if (vi->ops->vi_enable) + vi->ops->vi_enable(vi, true); + ret = host1x_client_register(&vi->client); if (ret < 0) { dev_err(&pdev->dev, @@ -1960,6 +1963,8 @@ static int tegra_vi_probe(struct platform_device *pdev) return 0; rpm_disable: + if (vi->ops->vi_enable) + vi->ops->vi_enable(vi, false); pm_runtime_disable(&pdev->dev); return ret; } @@ -1976,6 +1981,8 @@ static int tegra_vi_remove(struct platform_device *pdev) return err; } + if (vi->ops->vi_enable) + vi->ops->vi_enable(vi, false); pm_runtime_disable(&pdev->dev); return 0; diff --git a/drivers/staging/media/tegra-video/vi.h b/drivers/staging/media/tegra-video/vi.h index b424c967c6f2..886b10e7d723 100644 --- a/drivers/staging/media/tegra-video/vi.h +++ b/drivers/staging/media/tegra-video/vi.h @@ -37,8 +37,11 @@ enum tegra_vi_pg_mode { TEGRA_VI_PG_PATCH, }; +struct tegra_vi; + /** * struct tegra_vi_ops - Tegra VI operations + * @vi_enable: soc-specific operations needed to enable/disable the VI peripheral * @vi_fmt_align: modify `pix` to fit the hardware alignment * requirements and fill image geometry * @vi_start_streaming: starts media pipeline, subdevice streaming, sets up @@ -48,6 +51,7 @@ enum tegra_vi_pg_mode { * back any queued buffers. */ struct tegra_vi_ops { + int (*vi_enable)(struct tegra_vi *vi, bool on); void (*vi_fmt_align)(struct v4l2_pix_format *pix, unsigned int bpp); int (*vi_start_streaming)(struct vb2_queue *vq, u32 count); void (*vi_stop_streaming)(struct vb2_queue *vq);