From patchwork Wed Oct 2 12:22:22 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 13819754 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 824AECF31B4 for ; Wed, 2 Oct 2024 12:25:29 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender:List-Subscribe:List-Help :List-Post:List-Archive:List-Unsubscribe:List-Id:Content-Transfer-Encoding: MIME-Version:References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: Reply-To:Content-Type:Content-ID:Content-Description:Resent-Date:Resent-From: Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=eSX9EU17ASlDm3AgTKh4ubal0EGKVpY/9w9SUmxv4Ak=; b=lh1pxqC5LOhWbFkC2SS0Swkpeh Ky4XR2Dnmc6YOX0ZRA4edZOHLcCwUGZT5FwVG6fau8TZ0zd0DHxGeIMfWoOx3gl4D9HfZmfl9yKuL amCh/FpciB6lTJ/09Bk6EAYnMBsnMfbrr4SCYF1e8+IIP5qS2vzjYp+LcnRsCRvyPOPhpvpiYhuxR W4OCIL1BNZ2zLVKfFgUuNTSGf4q30lrwQJOqbFm6yy7fFyjtGimndO1QF1VQYfo1Gly77pK3LxXLc SoJeiW0oqZ+tAj3YOGgdf606zB86yVEV4LTNJzwoD+ee3xvfZ9HHvfDqWEGOBM2o3t4BMV3Wxiuop yuHUfkGg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.98 #2 (Red Hat Linux)) id 1svyPu-00000005rRs-0yan; Wed, 02 Oct 2024 12:25:18 +0000 Received: from mail-lf1-x134.google.com ([2a00:1450:4864:20::134]) by bombadil.infradead.org with esmtps (Exim 4.98 #2 (Red Hat Linux)) id 1svyNP-00000005qU2-43mf for linux-arm-kernel@lists.infradead.org; Wed, 02 Oct 2024 12:22:45 +0000 Received: by mail-lf1-x134.google.com with SMTP id 2adb3069b0e04-5398ec2f3c3so993930e87.1 for ; Wed, 02 Oct 2024 05:22:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1727871762; x=1728476562; darn=lists.infradead.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=eSX9EU17ASlDm3AgTKh4ubal0EGKVpY/9w9SUmxv4Ak=; b=TwMYst93HIIOgqvWxXNNdRZXvKIor5aL4PF1qbxspXOmhebNETjdImMl8YF4M5LHLQ vVBgygNof+BArI8LzDnf2X4OvURAX+0yMrzToeqeWWLDg/U+5gnnUyzW4DgRq225/hOk PaR62tS+5DGgCEJMlkZ/fZl5sMGeWqV1wKuewdM47LMB7QbztFhcmrjHD8t1PCXSQ9mx X7N33Ugj6+9KNtTnDfDsODHBPREJXvZphJR+5WBdW9/1UN9GmB8YXJO+Af3WjF/K3XRC nHoSEIfYldLwOySxV/XeoLhtTmHZ1F1aUjpZ2AXURY780Xv9f1jSg321mYU7CsrIDK6x YLEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1727871762; x=1728476562; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=eSX9EU17ASlDm3AgTKh4ubal0EGKVpY/9w9SUmxv4Ak=; b=xHTATRzTyoZ/9DDNc0EXhZcGbmbmsDQ2p6jyWe55IRn4HYJqnv34WLEJB32pbLRKod dZS0Hg4tsHhyvBwUmQRlpGzEGyzmXMlWq1kvYWkf+WjwM3XMVhLEMtPCZSG4JvUtoXMh ZL4nT3wx34ZatdIYslKCAMh/kiXc+WuCzg9COzkpUS7t/HTU6kaIoSkdvUfl/u7VGfpY h7/gcg1fV01wiThpd5tg3scou8y13qf6ZYcjJEbcdLW/e0sp+RxSOfbdQ6F0AAfOc/vX kvMh6cgWc07ZUXsmQVTkQJUsHTrjPE42uW+z302Iy3SQdenerv9eMgtJUfAfDfcbUkQ4 Hirw== X-Forwarded-Encrypted: i=1; AJvYcCXF3ht2z03cZRYPjjWgQBr62o17R/5tHoq13Milg++3GcgUOLpSfLBCWb1omr4WvUDNV+3xB42g42mlGG0/lLqP@lists.infradead.org X-Gm-Message-State: AOJu0Yzu681PwN79M4qvBE+q4vlWlAIFuQozETIHTF67fweEoCiCUR03 mOeWaMkBAx6g9h54tuYjVZN6z6L/gQLjnw7v/ziK1t6LpnQX86XmZy9OKhiGYZI= X-Google-Smtp-Source: AGHT+IHEvwRxBb9GrNyhgaRg0+vv+PetyLiU75/JMXFKI6h0PdYDgnClXnPqY2gTN5ud9jelhP1j5g== X-Received: by 2002:a05:6512:280a:b0:530:d088:233f with SMTP id 2adb3069b0e04-539a079f870mr1678944e87.40.1727871762024; Wed, 02 Oct 2024 05:22:42 -0700 (PDT) Received: from uffe-tuxpro14.. (h-178-174-189-39.A498.priv.bahnhof.se. [178.174.189.39]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-538a043204fsm1912659e87.165.2024.10.02.05.22.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 02 Oct 2024 05:22:41 -0700 (PDT) From: Ulf Hansson To: Viresh Kumar , Nishanth Menon , Stephen Boyd Cc: "Rafael J . Wysocki" , Dikshita Agarwal , Vedang Nagar , Bjorn Andersson , Konrad Dybcio , Nikunj Kela , Bryan O'Donoghue , Thierry Reding , Mikko Perttunen , Jonathan Hunter , Stephan Gerhold , Ilia Lin , Stanimir Varbanov , Vikash Garodia , Ulf Hansson , linux-pm@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v4 01/11] Revert "drm/tegra: gr3d: Convert into dev_pm_domain_attach|detach_list()" Date: Wed, 2 Oct 2024 14:22:22 +0200 Message-Id: <20241002122232.194245-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20241002122232.194245-1-ulf.hansson@linaro.org> References: <20241002122232.194245-1-ulf.hansson@linaro.org> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20241002_052244_033231_DE2BFFC2 X-CRM114-Status: GOOD ( 20.33 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org This reverts commit f790b5c09665cab0d51dfcc84832d79d2b1e6c0e. The reverted commit was not ready to be applied due to dependency on other OPP/pmdomain changes that didn't make it for the last release cycle. Let's revert it to fix the behaviour. Signed-off-by: Ulf Hansson --- Changes in v4: - New patch. - Thierry, I intend to queue this via my pmdomain tree as a fix for v6.12. Please let me know, if you have any issues with that. --- drivers/gpu/drm/tegra/gr3d.c | 46 ++++++++++++++++++++++++++---------- 1 file changed, 33 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/tegra/gr3d.c b/drivers/gpu/drm/tegra/gr3d.c index 4de1ea0fc7c0..00c8564520e7 100644 --- a/drivers/gpu/drm/tegra/gr3d.c +++ b/drivers/gpu/drm/tegra/gr3d.c @@ -46,7 +46,6 @@ struct gr3d { unsigned int nclocks; struct reset_control_bulk_data resets[RST_GR3D_MAX]; unsigned int nresets; - struct dev_pm_domain_list *pd_list; DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS); }; @@ -370,12 +369,18 @@ static int gr3d_power_up_legacy_domain(struct device *dev, const char *name, return 0; } +static void gr3d_del_link(void *link) +{ + device_link_del(link); +} + static int gr3d_init_power(struct device *dev, struct gr3d *gr3d) { - struct dev_pm_domain_attach_data pd_data = { - .pd_names = (const char *[]) { "3d0", "3d1" }, - .num_pd_names = 2, - }; + static const char * const opp_genpd_names[] = { "3d0", "3d1", NULL }; + const u32 link_flags = DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME; + struct device **opp_virt_devs, *pd_dev; + struct device_link *link; + unsigned int i; int err; err = of_count_phandle_with_args(dev->of_node, "power-domains", @@ -409,10 +414,29 @@ static int gr3d_init_power(struct device *dev, struct gr3d *gr3d) if (dev->pm_domain) return 0; - err = dev_pm_domain_attach_list(dev, &pd_data, &gr3d->pd_list); - if (err < 0) + err = devm_pm_opp_attach_genpd(dev, opp_genpd_names, &opp_virt_devs); + if (err) return err; + for (i = 0; opp_genpd_names[i]; i++) { + pd_dev = opp_virt_devs[i]; + if (!pd_dev) { + dev_err(dev, "failed to get %s power domain\n", + opp_genpd_names[i]); + return -EINVAL; + } + + link = device_link_add(dev, pd_dev, link_flags); + if (!link) { + dev_err(dev, "failed to link to %s\n", dev_name(pd_dev)); + return -EINVAL; + } + + err = devm_add_action_or_reset(dev, gr3d_del_link, link); + if (err) + return err; + } + return 0; } @@ -503,13 +527,13 @@ static int gr3d_probe(struct platform_device *pdev) err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev); if (err) - goto err; + return err; err = host1x_client_register(&gr3d->client.base); if (err < 0) { dev_err(&pdev->dev, "failed to register host1x client: %d\n", err); - goto err; + return err; } /* initialize address register map */ @@ -517,9 +541,6 @@ static int gr3d_probe(struct platform_device *pdev) set_bit(gr3d_addr_regs[i], gr3d->addr_regs); return 0; -err: - dev_pm_domain_detach_list(gr3d->pd_list); - return err; } static void gr3d_remove(struct platform_device *pdev) @@ -528,7 +549,6 @@ static void gr3d_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); host1x_client_unregister(&gr3d->client.base); - dev_pm_domain_detach_list(gr3d->pd_list); } static int __maybe_unused gr3d_runtime_suspend(struct device *dev)