diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 55 |
1 files changed, 42 insertions, 13 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 0caef967..2ed7b737 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -84,8 +84,6 @@ u32 gk20a_dbg_ftrace; | |||
84 | 84 | ||
85 | #define GK20A_WAIT_FOR_IDLE_MS 2000 | 85 | #define GK20A_WAIT_FOR_IDLE_MS 2000 |
86 | 86 | ||
87 | static struct gk20a *gk20a_handle; | ||
88 | |||
89 | static int gk20a_pm_finalize_poweron(struct device *dev); | 87 | static int gk20a_pm_finalize_poweron(struct device *dev); |
90 | static int gk20a_pm_prepare_poweroff(struct device *dev); | 88 | static int gk20a_pm_prepare_poweroff(struct device *dev); |
91 | 89 | ||
@@ -1455,7 +1453,6 @@ static int gk20a_probe(struct platform_device *dev) | |||
1455 | 1453 | ||
1456 | set_gk20a(dev, gk20a); | 1454 | set_gk20a(dev, gk20a); |
1457 | gk20a->dev = dev; | 1455 | gk20a->dev = dev; |
1458 | gk20a_handle = gk20a; | ||
1459 | 1456 | ||
1460 | gk20a->irq_stall = platform_get_irq(dev, 0); | 1457 | gk20a->irq_stall = platform_get_irq(dev, 0); |
1461 | gk20a->irq_nonstall = platform_get_irq(dev, 1); | 1458 | gk20a->irq_nonstall = platform_get_irq(dev, 1); |
@@ -1611,7 +1608,6 @@ static int __exit gk20a_remove(struct platform_device *dev) | |||
1611 | 1608 | ||
1612 | gk20a_user_deinit(dev); | 1609 | gk20a_user_deinit(dev); |
1613 | 1610 | ||
1614 | gk20a_handle = NULL; | ||
1615 | set_gk20a(dev, 0); | 1611 | set_gk20a(dev, 0); |
1616 | #ifdef CONFIG_DEBUG_FS | 1612 | #ifdef CONFIG_DEBUG_FS |
1617 | debugfs_remove(g->debugfs_ltc_enabled); | 1613 | debugfs_remove(g->debugfs_ltc_enabled); |
@@ -1754,14 +1750,13 @@ void gk20a_reset(struct gk20a *g, u32 units) | |||
1754 | 1750 | ||
1755 | #ifdef CONFIG_PM_RUNTIME | 1751 | #ifdef CONFIG_PM_RUNTIME |
1756 | /** | 1752 | /** |
1757 | * gk20a_do_idle() - force the GPU to idle and railgate | 1753 | * __gk20a_do_idle() - force the GPU to idle and railgate |
1758 | * | 1754 | * |
1759 | * In success, this call MUST be balanced by caller with gk20a_do_unidle() | 1755 | * In success, this call MUST be balanced by caller with __gk20a_do_unidle() |
1760 | */ | 1756 | */ |
1761 | int gk20a_do_idle(void) | 1757 | int __gk20a_do_idle(struct platform_device *pdev) |
1762 | { | 1758 | { |
1763 | struct gk20a *g = gk20a_handle; | 1759 | struct gk20a *g = get_gk20a(pdev); |
1764 | struct platform_device *pdev = g->dev; | ||
1765 | struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); | 1760 | struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); |
1766 | unsigned long timeout = jiffies + | 1761 | unsigned long timeout = jiffies + |
1767 | msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS); | 1762 | msecs_to_jiffies(GK20A_WAIT_FOR_IDLE_MS); |
@@ -1837,12 +1832,30 @@ fail_timeout: | |||
1837 | } | 1832 | } |
1838 | 1833 | ||
1839 | /** | 1834 | /** |
1840 | * gk20a_do_unidle() - unblock all the tasks blocked by gk20a_do_idle() | 1835 | * gk20a_do_idle() - wrap up for __gk20a_do_idle() to be called |
1836 | * from outside of GPU driver | ||
1837 | * | ||
1838 | * In success, this call MUST be balanced by caller with gk20a_do_unidle() | ||
1841 | */ | 1839 | */ |
1842 | int gk20a_do_unidle(void) | 1840 | int gk20a_do_idle(void) |
1841 | { | ||
1842 | struct device_node *node = | ||
1843 | of_find_matching_node(NULL, tegra_gk20a_of_match); | ||
1844 | struct platform_device *pdev = of_find_device_by_node(node); | ||
1845 | |||
1846 | int ret = __gk20a_do_idle(pdev); | ||
1847 | |||
1848 | of_node_put(node); | ||
1849 | |||
1850 | return ret; | ||
1851 | } | ||
1852 | |||
1853 | /** | ||
1854 | * __gk20a_do_unidle() - unblock all the tasks blocked by __gk20a_do_idle() | ||
1855 | */ | ||
1856 | int __gk20a_do_unidle(struct platform_device *pdev) | ||
1843 | { | 1857 | { |
1844 | struct gk20a *g = gk20a_handle; | 1858 | struct gk20a *g = get_gk20a(pdev); |
1845 | struct platform_device *pdev = g->dev; | ||
1846 | struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); | 1859 | struct gk20a_platform *platform = dev_get_drvdata(&pdev->dev); |
1847 | 1860 | ||
1848 | if (g->forced_reset) { | 1861 | if (g->forced_reset) { |
@@ -1860,6 +1873,22 @@ int gk20a_do_unidle(void) | |||
1860 | 1873 | ||
1861 | return 0; | 1874 | return 0; |
1862 | } | 1875 | } |
1876 | |||
1877 | /** | ||
1878 | * gk20a_do_unidle() - wrap up for __gk20a_do_unidle() | ||
1879 | */ | ||
1880 | int gk20a_do_unidle(void) | ||
1881 | { | ||
1882 | struct device_node *node = | ||
1883 | of_find_matching_node(NULL, tegra_gk20a_of_match); | ||
1884 | struct platform_device *pdev = of_find_device_by_node(node); | ||
1885 | |||
1886 | int ret = __gk20a_do_unidle(pdev); | ||
1887 | |||
1888 | of_node_put(node); | ||
1889 | |||
1890 | return ret; | ||
1891 | } | ||
1863 | #endif | 1892 | #endif |
1864 | 1893 | ||
1865 | int gk20a_init_gpu_characteristics(struct gk20a *g) | 1894 | int gk20a_init_gpu_characteristics(struct gk20a *g) |