summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/vgpu.c
diff options
context:
space:
mode:
authorDeepak Nibade <dnibade@nvidia.com>2016-06-09 09:16:21 -0400
committerTerje Bergstrom <tbergstrom@nvidia.com>2016-07-08 03:58:53 -0400
commite27c72446bf09196d6d66f28389f00565273a13f (patch)
tree473530a0f10eee8d9dcae29afdc35c72b7a6a0ad /drivers/gpu/nvgpu/vgpu/vgpu.c
parent8417698b519be9dc8c1bd04714fc72ce4e0bc38f (diff)
gpu: nvgpu: simplify power management
We currenlty initialize both runtime PM and pm_domains frameworks and use pm_domain to control runtime power management of NvGPU But since GPU has a separate rail, using pm_domain is not strictly required Hence remove pm_domain support and use runtime PM only for all the power management This also simplifies the code a lot Initialization in gk20a_pm_init() - if railgate_delay is set, set autosuspend delay of runtime PM - try enabling runtime PM - if runtime PM is now enabled, keep GPU railgated - if runtime PM is not enabled, keep GPU unrailgated - if can_railgate = false, disable runtime PM and keep GPU unrailgated Set gk20a_pm_ops with below callbacks for runtime PM static const struct dev_pm_ops gk20a_pm_ops = { .runtime_resume = gk20a_pm_runtime_resume, .runtime_suspend = gk20a_pm_runtime_suspend, .resume = gk20a_pm_resume, .suspend = gk20a_pm_suspend, } Move gk20a_busy() to use runtime checks of pm_runtime_enabled() instead of using compile time checks on CONFIG_PM Clean up some pm_domain related code Remove use of gk20a_pm_enable/disable_clk() since this should be already done in platform specific unrailgate()/ railgate() APIs Fix "railgate_delay" and "railgate_enable" sysfs to use runtime PM calls For VGPU, disable runtime PM during vgpu_pm_init() With this, we will initialize vgpu with vgpu_pm_finalize_poweron() upon first call to gk20a_busy() Jira DNVGPU-57 Change-Id: I6013e33ae9bd28f35c25271af1239942a4fa0919 Signed-off-by: Deepak Nibade <dnibade@nvidia.com> Reviewed-on: http://git-master/r/1163216 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c42
1 files changed, 1 insertions, 41 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index 6393ea50..c28130f2 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -430,48 +430,13 @@ done:
430 return err; 430 return err;
431} 431}
432 432
433static int vgpu_pm_initialise_domain(struct device *dev)
434{
435 struct gk20a_platform *platform = dev_get_drvdata(dev);
436 struct dev_power_governor *pm_domain_gov = NULL;
437 struct gk20a_domain_data *vgpu_pd_data;
438 struct generic_pm_domain *domain;
439
440 vgpu_pd_data = (struct gk20a_domain_data *)kzalloc
441 (sizeof(struct gk20a_domain_data), GFP_KERNEL);
442
443 if (!vgpu_pd_data)
444 return -ENOMEM;
445
446 domain = &vgpu_pd_data->gpd;
447 vgpu_pd_data->gk20a = platform->g;
448
449 domain->name = "gpu";
450
451#ifdef CONFIG_PM
452 pm_domain_gov = &pm_domain_always_on_gov;
453#endif
454
455 pm_genpd_init(domain, pm_domain_gov, true);
456
457 domain->dev_ops.save_state = vgpu_pm_prepare_poweroff;
458 domain->dev_ops.restore_state = vgpu_pm_finalize_poweron;
459
460 device_set_wakeup_capable(dev, 0);
461 return pm_genpd_add_device(domain, dev);
462}
463
464static int vgpu_pm_init(struct device *dev) 433static int vgpu_pm_init(struct device *dev)
465{ 434{
466 int err = 0; 435 int err = 0;
467 436
468 gk20a_dbg_fn(""); 437 gk20a_dbg_fn("");
469 438
470 pm_runtime_enable(dev); 439 __pm_runtime_disable(dev, false);
471
472 /* genpd will take care of runtime power management if it is enabled */
473 if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS))
474 err = vgpu_pm_initialise_domain(dev);
475 440
476 return err; 441 return err;
477} 442}
@@ -567,16 +532,11 @@ int vgpu_remove(struct platform_device *pdev)
567{ 532{
568 struct device *dev = &pdev->dev; 533 struct device *dev = &pdev->dev;
569 struct gk20a *g = get_gk20a(dev); 534 struct gk20a *g = get_gk20a(dev);
570 struct gk20a_domain_data *vgpu_gpd;
571 gk20a_dbg_fn(""); 535 gk20a_dbg_fn("");
572 536
573 if (g->remove_support) 537 if (g->remove_support)
574 g->remove_support(dev); 538 g->remove_support(dev);
575 539
576 vgpu_gpd = container_of(&g, struct gk20a_domain_data, gk20a);
577 vgpu_gpd->gk20a = NULL;
578 kfree(vgpu_gpd);
579
580 vgpu_comm_deinit(); 540 vgpu_comm_deinit();
581 gk20a_user_deinit(dev, &nvgpu_class); 541 gk20a_user_deinit(dev, &nvgpu_class);
582 gk20a_get_platform(dev)->g = NULL; 542 gk20a_get_platform(dev)->g = NULL;