Skip to content

Commit

Permalink
Revert "drm/tegra: gr3d: Convert into dev_pm_domain_attach|detach_lis…
Browse files Browse the repository at this point in the history
…t()"

This reverts commit f790b5c.

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 <ulf.hansson@linaro.org>
Acked-by: Viresh Kumar <viresh.kumar@linaro.org>
Link: https://lore.kernel.org/r/20241002122232.194245-2-ulf.hansson@linaro.org
  • Loading branch information
storulf committed Oct 10, 2024
1 parent 500580c commit fa36b4b
Showing 1 changed file with 33 additions and 13 deletions.
46 changes: 33 additions & 13 deletions drivers/gpu/drm/tegra/gr3d.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
};
Expand Down Expand Up @@ -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",
Expand Down Expand Up @@ -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;
}

Expand Down Expand Up @@ -503,23 +527,20 @@ 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 */
for (i = 0; i < ARRAY_SIZE(gr3d_addr_regs); i++)
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)
Expand All @@ -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)
Expand Down

0 comments on commit fa36b4b

Please sign in to comment.