From e27c72446bf09196d6d66f28389f00565273a13f Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 9 Jun 2016 18:46:21 +0530 Subject: 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 Reviewed-on: http://git-master/r/1163216 Reviewed-by: Automatic_Commit_Validation_User GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom --- drivers/gpu/nvgpu/vgpu/vgpu.c | 42 +----------------------------------------- 1 file changed, 1 insertion(+), 41 deletions(-) (limited to 'drivers/gpu/nvgpu/vgpu/vgpu.c') 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: return err; } -static int vgpu_pm_initialise_domain(struct device *dev) -{ - struct gk20a_platform *platform = dev_get_drvdata(dev); - struct dev_power_governor *pm_domain_gov = NULL; - struct gk20a_domain_data *vgpu_pd_data; - struct generic_pm_domain *domain; - - vgpu_pd_data = (struct gk20a_domain_data *)kzalloc - (sizeof(struct gk20a_domain_data), GFP_KERNEL); - - if (!vgpu_pd_data) - return -ENOMEM; - - domain = &vgpu_pd_data->gpd; - vgpu_pd_data->gk20a = platform->g; - - domain->name = "gpu"; - -#ifdef CONFIG_PM - pm_domain_gov = &pm_domain_always_on_gov; -#endif - - pm_genpd_init(domain, pm_domain_gov, true); - - domain->dev_ops.save_state = vgpu_pm_prepare_poweroff; - domain->dev_ops.restore_state = vgpu_pm_finalize_poweron; - - device_set_wakeup_capable(dev, 0); - return pm_genpd_add_device(domain, dev); -} - static int vgpu_pm_init(struct device *dev) { int err = 0; gk20a_dbg_fn(""); - pm_runtime_enable(dev); - - /* genpd will take care of runtime power management if it is enabled */ - if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS)) - err = vgpu_pm_initialise_domain(dev); + __pm_runtime_disable(dev, false); return err; } @@ -567,16 +532,11 @@ int vgpu_remove(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct gk20a *g = get_gk20a(dev); - struct gk20a_domain_data *vgpu_gpd; gk20a_dbg_fn(""); if (g->remove_support) g->remove_support(dev); - vgpu_gpd = container_of(&g, struct gk20a_domain_data, gk20a); - vgpu_gpd->gk20a = NULL; - kfree(vgpu_gpd); - vgpu_comm_deinit(); gk20a_user_deinit(dev, &nvgpu_class); gk20a_get_platform(dev)->g = NULL; -- cgit v1.2.2