Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

Revert "drm/tegra: gr3d: Convert into dev_pm_domain_attach|detach_list()"

This reverts commit f790b5c09665cab0d51dfcc84832d79d2b1e6c0e. An updated
version of patch was applied to the PM tree. Sorry for the mixup.

Acked-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Thierry Reding <treding@nvidia.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20240829090916.1288854-1-thierry.reding@gmail.com

+33 -13
+33 -13
drivers/gpu/drm/tegra/gr3d.c
··· 46 46 unsigned int nclocks; 47 47 struct reset_control_bulk_data resets[RST_GR3D_MAX]; 48 48 unsigned int nresets; 49 - struct dev_pm_domain_list *pd_list; 50 49 51 50 DECLARE_BITMAP(addr_regs, GR3D_NUM_REGS); 52 51 }; ··· 369 370 return 0; 370 371 } 371 372 373 + static void gr3d_del_link(void *link) 374 + { 375 + device_link_del(link); 376 + } 377 + 372 378 static int gr3d_init_power(struct device *dev, struct gr3d *gr3d) 373 379 { 374 - struct dev_pm_domain_attach_data pd_data = { 375 - .pd_names = (const char *[]) { "3d0", "3d1" }, 376 - .num_pd_names = 2, 377 - }; 380 + static const char * const opp_genpd_names[] = { "3d0", "3d1", NULL }; 381 + const u32 link_flags = DL_FLAG_STATELESS | DL_FLAG_PM_RUNTIME; 382 + struct device **opp_virt_devs, *pd_dev; 383 + struct device_link *link; 384 + unsigned int i; 378 385 int err; 379 386 380 387 err = of_count_phandle_with_args(dev->of_node, "power-domains", ··· 414 409 if (dev->pm_domain) 415 410 return 0; 416 411 417 - err = dev_pm_domain_attach_list(dev, &pd_data, &gr3d->pd_list); 418 - if (err < 0) 412 + err = devm_pm_opp_attach_genpd(dev, opp_genpd_names, &opp_virt_devs); 413 + if (err) 419 414 return err; 415 + 416 + for (i = 0; opp_genpd_names[i]; i++) { 417 + pd_dev = opp_virt_devs[i]; 418 + if (!pd_dev) { 419 + dev_err(dev, "failed to get %s power domain\n", 420 + opp_genpd_names[i]); 421 + return -EINVAL; 422 + } 423 + 424 + link = device_link_add(dev, pd_dev, link_flags); 425 + if (!link) { 426 + dev_err(dev, "failed to link to %s\n", dev_name(pd_dev)); 427 + return -EINVAL; 428 + } 429 + 430 + err = devm_add_action_or_reset(dev, gr3d_del_link, link); 431 + if (err) 432 + return err; 433 + } 420 434 421 435 return 0; 422 436 } ··· 527 503 528 504 err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev); 529 505 if (err) 530 - goto err; 506 + return err; 531 507 532 508 err = host1x_client_register(&gr3d->client.base); 533 509 if (err < 0) { 534 510 dev_err(&pdev->dev, "failed to register host1x client: %d\n", 535 511 err); 536 - goto err; 512 + return err; 537 513 } 538 514 539 515 /* initialize address register map */ ··· 541 517 set_bit(gr3d_addr_regs[i], gr3d->addr_regs); 542 518 543 519 return 0; 544 - err: 545 - dev_pm_domain_detach_list(gr3d->pd_list); 546 - return err; 547 520 } 548 521 549 522 static void gr3d_remove(struct platform_device *pdev) ··· 549 528 550 529 pm_runtime_disable(&pdev->dev); 551 530 host1x_client_unregister(&gr3d->client.base); 552 - dev_pm_domain_detach_list(gr3d->pd_list); 553 531 } 554 532 555 533 static int __maybe_unused gr3d_runtime_suspend(struct device *dev)