From nobody Thu Nov 28 10:48:06 2024 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0D3F61CF7C7 for ; Wed, 2 Oct 2024 12:22:43 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727871765; cv=none; b=YoYB6PXuYD8PDAxzSX9E2zpXItYsDBdaJhKiHzJ4gDueHNbiNTYUuRUCPhZYvExhG0DYFr8KxfWs8gdb/R4Prxo26GSZlcntamhc7wihV9soqzoXlcDGFbbmWwg9m1Gv9ZTVkEr1kf7ZYrzj/y+DqigTgCKyeXHe0/4nCiPHcjk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1727871765; c=relaxed/simple; bh=bHtjzPG/Hb+7ZqaAKxtS3yoYjps3dQcwfj0ujdDPyg4=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=DCYIu3uUJ4RW4zHSzSEQ1UzdMaqwZ0YnmTaqPVR0ln6n7bjV8bniysrXRnmafJusfEHaR5gLfGjqcFOeezleDfMgj04B6MxITsLvJrohtYD5IkEdY1/j4QbwDs1XCtHoFmE3yUebgjNcZ4C2eWhglSjRw6Ywxk+UtEsCeW9EIhA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=OXshoZqi; arc=none smtp.client-ip=209.85.167.45 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OXshoZqi" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-5398a26b64fso5044940e87.3 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=vger.kernel.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=OXshoZqiEfStsTOGcDG8w+vDkCQh0boU7rqDrgyxZIDcJ8S+pnfgSxSFWl5zDK38Ch 7Z3QkM3o2CAeZeXaX5OcjbeHlIhTccy9uM4fy2pDOhfeBeGqVw9i3UFjiJlYIkVUxJoc mgXbQbIb0csjJL1nFWkzYvP1aDVxCwsTJcWcrvTI7lDJJIOv2ZCZW07GvvBPoY/L49/O pQVIMpw65Sa6lUMOBEQYqDhwK8VzPyq/WgV9uhS1CwIvGRLVAiZ7E+uyvpUMdsF8i+Ao FcjrUu5jDX1BJAbkDI6EEnqpTKs9gOi2HuFmLaC2Q0WFOE+3Z1mC5sdqkSByZbhlUlRV Metw== 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=FPwaG8TyKfXui0c/utZ78lvYpyHPCpPQ4SMqeuJJ67obEvE9Rqog2iuKwCjya534Sl 2p1Cb5oTFxJo9QN8igCYNcMkDcwwCVl7rrE3yficoxbQSZVOYZdgCeFTPJXN0RHpLelv TTBwRlDvEXAkx11OFq7X4UjjnLNk+P216eTDXdEf8XBC7ZMIL+P77ja+X0LvdH78PQk3 W2S2ZMkBxHiIXxd8wuK1B5kS8OnL1tb2rPSYCVZ8sKSb8LXTCIuCVXACpduuYuAlByDB 8uqq/s9BykxKDaMSTCyiFDVEgBq2euGzvspPeLTa5txljxpR+99yJxDVJ5NlLFbnM/98 6jyA== X-Forwarded-Encrypted: i=1; AJvYcCVEa/yzYKr2osovOtIU2sPqfPt7Tp7ec4938xt7vQr60MLjGrKNA85Kwi6xZGF/o2IAmhBu6GlenmPCCn4=@vger.kernel.org X-Gm-Message-State: AOJu0YyvkO3xtV7RS7F93P6g2wJxuj2nekZd3tf4M+ko0CMvakKj7lO2 zg4pnh7enb1B7ELGl0/WAqGUlNcskvJqP0aaxKKuL5W/8oOFBI86yHPFqcpIPaU= 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> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" 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; =20 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; } =20 +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 =3D { - .pd_names =3D (const char *[]) { "3d0", "3d1" }, - .num_pd_names =3D 2, - }; + static const char * const opp_genpd_names[] =3D { "3d0", "3d1", NULL }; + const u32 link_flags =3D DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME; + struct device **opp_virt_devs, *pd_dev; + struct device_link *link; + unsigned int i; int err; =20 err =3D 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; =20 - err =3D dev_pm_domain_attach_list(dev, &pd_data, &gr3d->pd_list); - if (err < 0) + err =3D devm_pm_opp_attach_genpd(dev, opp_genpd_names, &opp_virt_devs); + if (err) return err; =20 + for (i =3D 0; opp_genpd_names[i]; i++) { + pd_dev =3D opp_virt_devs[i]; + if (!pd_dev) { + dev_err(dev, "failed to get %s power domain\n", + opp_genpd_names[i]); + return -EINVAL; + } + + link =3D 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 =3D devm_add_action_or_reset(dev, gr3d_del_link, link); + if (err) + return err; + } + return 0; } =20 @@ -503,13 +527,13 @@ static int gr3d_probe(struct platform_device *pdev) =20 err =3D devm_tegra_core_dev_init_opp_table_common(&pdev->dev); if (err) - goto err; + return err; =20 err =3D 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; } =20 /* 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); =20 return 0; -err: - dev_pm_domain_detach_list(gr3d->pd_list); - return err; } =20 static void gr3d_remove(struct platform_device *pdev) @@ -528,7 +549,6 @@ static void gr3d_remove(struct platform_device *pdev) =20 pm_runtime_disable(&pdev->dev); host1x_client_unregister(&gr3d->client.base); - dev_pm_domain_detach_list(gr3d->pd_list); } =20 static int __maybe_unused gr3d_runtime_suspend(struct device *dev) --=20 2.34.1