diff options
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 60 |
1 files changed, 60 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 2aad3365..a1b0f501 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -1272,6 +1272,7 @@ static int gk20a_pm_resume(struct device *dev) | |||
1272 | return gk20a_pm_finalize_poweron(dev); | 1272 | return gk20a_pm_finalize_poweron(dev); |
1273 | } | 1273 | } |
1274 | 1274 | ||
1275 | #ifdef CONFIG_PM_GENERIC_DOMAINS_OF | ||
1275 | static int gk20a_pm_initialise_domain(struct platform_device *pdev) | 1276 | static int gk20a_pm_initialise_domain(struct platform_device *pdev) |
1276 | { | 1277 | { |
1277 | struct gk20a_platform *platform = platform_get_drvdata(pdev); | 1278 | struct gk20a_platform *platform = platform_get_drvdata(pdev); |
@@ -1291,6 +1292,50 @@ static int gk20a_pm_initialise_domain(struct platform_device *pdev) | |||
1291 | return 0; | 1292 | return 0; |
1292 | } | 1293 | } |
1293 | 1294 | ||
1295 | #else | ||
1296 | static int gk20a_pm_initialise_domain(struct platform_device *pdev) | ||
1297 | { | ||
1298 | struct gk20a_platform *platform = platform_get_drvdata(pdev); | ||
1299 | struct dev_power_governor *pm_domain_gov = NULL; | ||
1300 | struct generic_pm_domain *domain = NULL; | ||
1301 | int ret = 0; | ||
1302 | struct gk20a_domain_data *gpu_gpd_data = (struct gk20a_domain_data *) | ||
1303 | kzalloc(sizeof(struct gk20a_domain_data), GFP_KERNEL); | ||
1304 | |||
1305 | if (!gpu_gpd_data) | ||
1306 | return -ENOMEM; | ||
1307 | |||
1308 | gpu_gpd_data->gk20a = platform->g; | ||
1309 | domain = &gpu_gpd_data->gpd; | ||
1310 | |||
1311 | domain->name = "gpu"; | ||
1312 | |||
1313 | #ifdef CONFIG_PM_RUNTIME | ||
1314 | if (!platform->can_railgate) | ||
1315 | pm_domain_gov = &pm_domain_always_on_gov; | ||
1316 | #endif | ||
1317 | |||
1318 | pm_genpd_init(domain, pm_domain_gov, true); | ||
1319 | |||
1320 | domain->power_off = gk20a_pm_railgate; | ||
1321 | domain->power_on = gk20a_pm_unrailgate; | ||
1322 | domain->dev_ops.start = gk20a_pm_enable_clk; | ||
1323 | domain->dev_ops.stop = gk20a_pm_disable_clk; | ||
1324 | domain->dev_ops.save_state = gk20a_pm_prepare_poweroff; | ||
1325 | domain->dev_ops.restore_state = gk20a_pm_finalize_poweron; | ||
1326 | domain->dev_ops.suspend = gk20a_pm_suspend; | ||
1327 | domain->dev_ops.resume = gk20a_pm_resume; | ||
1328 | |||
1329 | device_set_wakeup_capable(&pdev->dev, 0); | ||
1330 | ret = pm_genpd_add_device(domain, &pdev->dev); | ||
1331 | |||
1332 | if (platform->railgate_delay) | ||
1333 | pm_genpd_set_poweroff_delay(domain, platform->railgate_delay); | ||
1334 | |||
1335 | return ret; | ||
1336 | } | ||
1337 | #endif | ||
1338 | |||
1294 | static int gk20a_pm_init(struct platform_device *dev) | 1339 | static int gk20a_pm_init(struct platform_device *dev) |
1295 | { | 1340 | { |
1296 | struct gk20a_platform *platform = platform_get_drvdata(dev); | 1341 | struct gk20a_platform *platform = platform_get_drvdata(dev); |
@@ -1349,7 +1394,10 @@ static int gk20a_probe(struct platform_device *dev) | |||
1349 | struct gk20a *gk20a; | 1394 | struct gk20a *gk20a; |
1350 | int err; | 1395 | int err; |
1351 | struct gk20a_platform *platform = NULL; | 1396 | struct gk20a_platform *platform = NULL; |
1397 | |||
1398 | #ifdef CONFIG_PM_GENERIC_DOMAINS_OF | ||
1352 | struct gk20a_domain_data *gk20a_domain; | 1399 | struct gk20a_domain_data *gk20a_domain; |
1400 | #endif | ||
1353 | 1401 | ||
1354 | if (dev->dev.of_node) { | 1402 | if (dev->dev.of_node) { |
1355 | const struct of_device_id *match; | 1403 | const struct of_device_id *match; |
@@ -1381,9 +1429,11 @@ static int gk20a_probe(struct platform_device *dev) | |||
1381 | init_waitqueue_head(&gk20a->sw_irq_stall_last_handled_wq); | 1429 | init_waitqueue_head(&gk20a->sw_irq_stall_last_handled_wq); |
1382 | init_waitqueue_head(&gk20a->sw_irq_nonstall_last_handled_wq); | 1430 | init_waitqueue_head(&gk20a->sw_irq_nonstall_last_handled_wq); |
1383 | 1431 | ||
1432 | #ifdef CONFIG_PM_GENERIC_DOMAINS_OF | ||
1384 | gk20a_domain = container_of(dev_to_genpd(&dev->dev), | 1433 | gk20a_domain = container_of(dev_to_genpd(&dev->dev), |
1385 | struct gk20a_domain_data, gpd); | 1434 | struct gk20a_domain_data, gpd); |
1386 | gk20a_domain->gk20a = gk20a; | 1435 | gk20a_domain->gk20a = gk20a; |
1436 | #endif | ||
1387 | 1437 | ||
1388 | set_gk20a(dev, gk20a); | 1438 | set_gk20a(dev, gk20a); |
1389 | gk20a->dev = dev; | 1439 | gk20a->dev = dev; |
@@ -1642,6 +1692,9 @@ static struct platform_driver gk20a_driver = { | |||
1642 | } | 1692 | } |
1643 | }; | 1693 | }; |
1644 | 1694 | ||
1695 | #ifdef CONFIG_PM_GENERIC_DOMAINS_OF | ||
1696 | |||
1697 | |||
1645 | static int _gk20a_init_domain(struct device_node *np, | 1698 | static int _gk20a_init_domain(struct device_node *np, |
1646 | struct generic_pm_domain *gpd) | 1699 | struct generic_pm_domain *gpd) |
1647 | { | 1700 | { |
@@ -1689,6 +1742,13 @@ static int gk20a_domain_init(struct of_device_id *matches) | |||
1689 | 1742 | ||
1690 | return ret; | 1743 | return ret; |
1691 | } | 1744 | } |
1745 | #else | ||
1746 | static int gk20a_domain_init(struct of_device_id *matches) | ||
1747 | { | ||
1748 | return 0; | ||
1749 | } | ||
1750 | #endif | ||
1751 | |||
1692 | 1752 | ||
1693 | static int __init gk20a_init(void) | 1753 | static int __init gk20a_init(void) |
1694 | { | 1754 | { |