diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 33 |
1 files changed, 18 insertions, 15 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 05599649..44ed4e51 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -696,7 +696,6 @@ static int gk20a_init_support(struct platform_device *dev) | |||
696 | static int gk20a_pm_prepare_poweroff(struct device *dev) | 696 | static int gk20a_pm_prepare_poweroff(struct device *dev) |
697 | { | 697 | { |
698 | struct gk20a *g = get_gk20a(dev); | 698 | struct gk20a *g = get_gk20a(dev); |
699 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
700 | int ret = 0; | 699 | int ret = 0; |
701 | 700 | ||
702 | gk20a_dbg_fn(""); | 701 | gk20a_dbg_fn(""); |
@@ -734,10 +733,6 @@ static int gk20a_pm_prepare_poweroff(struct device *dev) | |||
734 | 733 | ||
735 | g->power_on = false; | 734 | g->power_on = false; |
736 | 735 | ||
737 | /* Decrement platform power refcount */ | ||
738 | if (platform->idle) | ||
739 | platform->idle(dev); | ||
740 | |||
741 | /* Stop CPU from accessing the GPU registers. */ | 736 | /* Stop CPU from accessing the GPU registers. */ |
742 | gk20a_lockout_registers(g); | 737 | gk20a_lockout_registers(g); |
743 | 738 | ||
@@ -784,16 +779,6 @@ int gk20a_pm_finalize_poweron(struct device *dev) | |||
784 | 779 | ||
785 | trace_gk20a_finalize_poweron(dev_name(dev)); | 780 | trace_gk20a_finalize_poweron(dev_name(dev)); |
786 | 781 | ||
787 | /* Increment platform power refcount */ | ||
788 | if (platform->busy) { | ||
789 | err = platform->busy(dev); | ||
790 | if (err < 0) { | ||
791 | dev_err(dev, "%s: failed to poweron platform dependency\n", | ||
792 | __func__); | ||
793 | return err; | ||
794 | } | ||
795 | } | ||
796 | |||
797 | err = gk20a_restore_registers(g); | 782 | err = gk20a_restore_registers(g); |
798 | if (err) | 783 | if (err) |
799 | return err; | 784 | return err; |
@@ -1817,13 +1802,27 @@ int gk20a_busy(struct device *dev) | |||
1817 | { | 1802 | { |
1818 | int ret = 0; | 1803 | int ret = 0; |
1819 | struct gk20a *g = get_gk20a(dev); | 1804 | struct gk20a *g = get_gk20a(dev); |
1805 | #ifdef CONFIG_PM | ||
1806 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
1807 | #endif | ||
1820 | 1808 | ||
1821 | down_read(&g->busy_lock); | 1809 | down_read(&g->busy_lock); |
1822 | 1810 | ||
1823 | #ifdef CONFIG_PM | 1811 | #ifdef CONFIG_PM |
1812 | if (platform->busy) { | ||
1813 | ret = platform->busy(dev); | ||
1814 | if (ret < 0) { | ||
1815 | dev_err(dev, "%s: failed to poweron platform dependency\n", | ||
1816 | __func__); | ||
1817 | goto fail; | ||
1818 | } | ||
1819 | } | ||
1820 | |||
1824 | ret = pm_runtime_get_sync(dev); | 1821 | ret = pm_runtime_get_sync(dev); |
1825 | if (ret < 0) { | 1822 | if (ret < 0) { |
1826 | pm_runtime_put_noidle(dev); | 1823 | pm_runtime_put_noidle(dev); |
1824 | if (platform->idle) | ||
1825 | platform->idle(dev); | ||
1827 | goto fail; | 1826 | goto fail; |
1828 | } | 1827 | } |
1829 | #else | 1828 | #else |
@@ -1846,10 +1845,14 @@ fail: | |||
1846 | void gk20a_idle(struct device *dev) | 1845 | void gk20a_idle(struct device *dev) |
1847 | { | 1846 | { |
1848 | #ifdef CONFIG_PM | 1847 | #ifdef CONFIG_PM |
1848 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
1849 | if (atomic_read(&dev->power.usage_count) == 1) | 1849 | if (atomic_read(&dev->power.usage_count) == 1) |
1850 | gk20a_scale_notify_idle(dev); | 1850 | gk20a_scale_notify_idle(dev); |
1851 | pm_runtime_mark_last_busy(dev); | 1851 | pm_runtime_mark_last_busy(dev); |
1852 | pm_runtime_put_sync_autosuspend(dev); | 1852 | pm_runtime_put_sync_autosuspend(dev); |
1853 | |||
1854 | if (platform->idle) | ||
1855 | platform->idle(dev); | ||
1853 | #else | 1856 | #else |
1854 | gk20a_scale_notify_idle(dev); | 1857 | gk20a_scale_notify_idle(dev); |
1855 | #endif | 1858 | #endif |