Skip to content

Commit fa36b4b

Browse files
committed
Revert "drm/tegra: gr3d: Convert into dev_pm_domain_attach|detach_list()"
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 <[email protected]> Acked-by: Viresh Kumar <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 500580c commit fa36b4b

File tree

1 file changed

+33
-13
lines changed

1 file changed

+33
-13
lines changed

drivers/gpu/drm/tegra/gr3d.c

Lines changed: 33 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,6 @@ struct gr3d {
4646
unsigned int nclocks;
4747
struct reset_control_bulk_data resets[RST_GR3D_MAX];
4848
unsigned int nresets;
49-
struct dev_pm_domain_list *pd_list;
5049

5150
DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS);
5251
};
@@ -370,12 +369,18 @@ static int gr3d_power_up_legacy_domain(struct device *dev, const char *name,
370369
return 0;
371370
}
372371

372+
static void gr3d_del_link(void *link)
373+
{
374+
device_link_del(link);
375+
}
376+
373377
static int gr3d_init_power(struct device *dev, struct gr3d *gr3d)
374378
{
375-
struct dev_pm_domain_attach_data pd_data = {
376-
.pd_names = (const char *[]) { "3d0", "3d1" },
377-
.num_pd_names = 2,
378-
};
379+
static const char * const opp_genpd_names[] = { "3d0", "3d1", NULL };
380+
const u32 link_flags = DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME;
381+
struct device **opp_virt_devs, *pd_dev;
382+
struct device_link *link;
383+
unsigned int i;
379384
int err;
380385

381386
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)
409414
if (dev->pm_domain)
410415
return 0;
411416

412-
err = dev_pm_domain_attach_list(dev, &pd_data, &gr3d->pd_list);
413-
if (err < 0)
417+
err = devm_pm_opp_attach_genpd(dev, opp_genpd_names, &opp_virt_devs);
418+
if (err)
414419
return err;
415420

421+
for (i = 0; opp_genpd_names[i]; i++) {
422+
pd_dev = opp_virt_devs[i];
423+
if (!pd_dev) {
424+
dev_err(dev, "failed to get %s power domain\n",
425+
opp_genpd_names[i]);
426+
return -EINVAL;
427+
}
428+
429+
link = device_link_add(dev, pd_dev, link_flags);
430+
if (!link) {
431+
dev_err(dev, "failed to link to %s\n", dev_name(pd_dev));
432+
return -EINVAL;
433+
}
434+
435+
err = devm_add_action_or_reset(dev, gr3d_del_link, link);
436+
if (err)
437+
return err;
438+
}
439+
416440
return 0;
417441
}
418442

@@ -503,23 +527,20 @@ static int gr3d_probe(struct platform_device *pdev)
503527

504528
err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev);
505529
if (err)
506-
goto err;
530+
return err;
507531

508532
err = host1x_client_register(&gr3d->client.base);
509533
if (err < 0) {
510534
dev_err(&pdev->dev, "failed to register host1x client: %d\n",
511535
err);
512-
goto err;
536+
return err;
513537
}
514538

515539
/* initialize address register map */
516540
for (i = 0; i < ARRAY_SIZE(gr3d_addr_regs); i++)
517541
set_bit(gr3d_addr_regs[i], gr3d->addr_regs);
518542

519543
return 0;
520-
err:
521-
dev_pm_domain_detach_list(gr3d->pd_list);
522-
return err;
523544
}
524545

525546
static void gr3d_remove(struct platform_device *pdev)
@@ -528,7 +549,6 @@ static void gr3d_remove(struct platform_device *pdev)
528549

529550
pm_runtime_disable(&pdev->dev);
530551
host1x_client_unregister(&gr3d->client.base);
531-
dev_pm_domain_detach_list(gr3d->pd_list);
532552
}
533553

534554
static int __maybe_unused gr3d_runtime_suspend(struct device *dev)

0 commit comments

Comments
 (0)