summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/vgpu/vgpu.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/vgpu/vgpu.c')
-rw-r--r--drivers/gpu/nvgpu/vgpu/vgpu.c26
1 files changed, 26 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/vgpu/vgpu.c b/drivers/gpu/nvgpu/vgpu/vgpu.c
index 84fd6d18..82a0851e 100644
--- a/drivers/gpu/nvgpu/vgpu/vgpu.c
+++ b/drivers/gpu/nvgpu/vgpu/vgpu.c
@@ -304,6 +304,27 @@ done:
304 return err; 304 return err;
305} 305}
306 306
307static int vgpu_pm_initialise_domain(struct platform_device *pdev)
308{
309 struct gk20a_platform *platform = platform_get_drvdata(pdev);
310 struct dev_power_governor *pm_domain_gov = NULL;
311 struct generic_pm_domain *domain = &platform->g->pd;
312
313 domain->name = "gpu";
314
315#ifdef CONFIG_PM_RUNTIME
316 pm_domain_gov = &pm_domain_always_on_gov;
317#endif
318
319 pm_genpd_init(domain, pm_domain_gov, true);
320
321 domain->dev_ops.save_state = vgpu_pm_prepare_poweroff;
322 domain->dev_ops.restore_state = vgpu_pm_finalize_poweron;
323
324 device_set_wakeup_capable(&pdev->dev, 0);
325 return pm_genpd_add_device(domain, &pdev->dev);
326}
327
307static int vgpu_pm_init(struct platform_device *dev) 328static int vgpu_pm_init(struct platform_device *dev)
308{ 329{
309 int err = 0; 330 int err = 0;
@@ -311,6 +332,11 @@ static int vgpu_pm_init(struct platform_device *dev)
311 gk20a_dbg_fn(""); 332 gk20a_dbg_fn("");
312 333
313 pm_runtime_enable(&dev->dev); 334 pm_runtime_enable(&dev->dev);
335
336 /* genpd will take care of runtime power management if it is enabled */
337 if (IS_ENABLED(CONFIG_PM_GENERIC_DOMAINS))
338 err = vgpu_pm_initialise_domain(dev);
339
314 return err; 340 return err;
315} 341}
316 342