From patchwork Tue Apr 18 08:00:49 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Luca Ceresoli X-Patchwork-Id: 84650 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2663893vqo; Tue, 18 Apr 2023 01:04:22 -0700 (PDT) X-Google-Smtp-Source: AKy350Z0kopYhRm5qDgR+gn+thPWAY9sR/whubrf0n95vtLjs0oW9n/fWJdwoLDWat6DUNf/f78a X-Received: by 2002:a17:902:ea05:b0:19a:a520:b203 with SMTP id s5-20020a170902ea0500b0019aa520b203mr1574476plg.25.1681805062629; Tue, 18 Apr 2023 01:04:22 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681805062; cv=none; d=google.com; s=arc-20160816; b=ILuqdsImUHB1aZ1Ne4h/EWoCkNjkjJC68dP4gTWxdCwZ3ltJZkWM/7LRcwfVWG2ZVK JrU3NmWUgl9NXW7t/WWXtDF/BmjCSv6nBeM8UsWgEGejyzlssJt1HnbBvYK4F0Ut8jiA 2uOurLWCy8rBmBHH/vIWA7dUUBo04fKAm2cthO0xX2kQkKdFuKCArh8ryRwMLPob6nGM DCz4C8YBv/9W4aCZmHL8faTt6DQv+5ExtjXTLpdxioTm9jmYreZj60JBX7hec5A1PWYs BAaR47oyVYRoz5GRiATLv9k2O2GHG47EjfPzE233JLw9Ujyh0xR191RBH0L9kLD/Kj9l l5xQ== 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=OjDn7feuOfCx2JjEUm878aYF49HGL6X0Phz44CtOnuQ=; b=JxKuwDEgmdjvVB062+l2fUDviVLktKC5cDbVb37DqpvQhNJ64uvb58sjs7eGrUftoZ tmWBzjj6GQRh8/8bn6hTGuHeIFSGqhg9ukZTA1vnFYF1KnW0f9P5fmnKy1Sc6VXjmGKO SCYQ4VDS/IQBD85IrZ13f6btbAjeL/G/Bp3oVzWHlfyP5WFCHUiIV2Mpc8IZAgJlkjqy 9VPlC3rkn1Ss5guyYREkZSm6Ls9ayffGnjLQ0eZaQcixIm0Du7qtRqtqBz0ltRCp7hTu AkklvEEAY1LzZnYT3BR78TDFayjftv5a/MCv/oSHYKeJf6WrzCYW2bCLGVpxx9iFJQ33 ZP8Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@bootlin.com header.s=gm1 header.b=I7tZjmhH; 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 km3-20020a17090327c300b0019e6d854facsi12777204plb.349.2023.04.18.01.04.10; Tue, 18 Apr 2023 01:04:22 -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=I7tZjmhH; 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 S231533AbjDRIDH (ORCPT + 99 others); Tue, 18 Apr 2023 04:03:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42410 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231378AbjDRICe (ORCPT ); Tue, 18 Apr 2023 04:02:34 -0400 Received: from relay10.mail.gandi.net (relay10.mail.gandi.net [IPv6:2001:4b98:dc4:8::230]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE6A14492; Tue, 18 Apr 2023 01:02:02 -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 78450240003; Tue, 18 Apr 2023 08:01:56 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=bootlin.com; s=gm1; t=1681804919; 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=OjDn7feuOfCx2JjEUm878aYF49HGL6X0Phz44CtOnuQ=; b=I7tZjmhH627GBuHF1wzSyhCZUFSROiN803K5xByz5h/wt2k+vh76TmZaCefebp80x3tKbt 0kpo4QrCalP+dLGNLqxKfbSCCAJm+6bwNHkBQLwEzKBagUNnUGZPxEd8jWtNRK3e+59QaY Tiq9bgDcC3neCV9d6syb1oGzdfrMqs4FkUl0j+lc6Pke91BnkjTVb7xe10tZYr6dDnbLZf zIBUz+rbcZ2D0oSA8IE8pOVTb9vauOgQKOMhQ53snUFlXg2m+oy2KvfcCUeQRmhCHsEPA7 mCfxL1NF8yRAm6lppOViupcDCHjs+CPjo1eGp96jBBk0KBYkZyXgfdD4uy9HrA== 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 15/20] staging: media: tegra-video: add a per-soc enable/disable op Date: Tue, 18 Apr 2023 10:00:49 +0200 Message-Id: <20230418080054.452955-16-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,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?1763500424891448175?= X-GMAIL-MSGID: =?utf-8?q?1763500424891448175?= 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 v6 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);