diff options
Diffstat (limited to 'drivers/gpu/nvgpu')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 33 |
1 files changed, 14 insertions, 19 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index bb8cb33f..caa1583e 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -813,6 +813,10 @@ static int gk20a_pm_prepare_poweroff(struct device *dev) | |||
813 | 813 | ||
814 | g->power_on = false; | 814 | g->power_on = false; |
815 | 815 | ||
816 | /* Decrement platform power refcount */ | ||
817 | if (platform->idle) | ||
818 | platform->idle(dev); | ||
819 | |||
816 | /* Stop CPU from accessing the GPU registers. */ | 820 | /* Stop CPU from accessing the GPU registers. */ |
817 | gk20a_lockout_registers(g); | 821 | gk20a_lockout_registers(g); |
818 | 822 | ||
@@ -859,6 +863,16 @@ int gk20a_pm_finalize_poweron(struct device *dev) | |||
859 | 863 | ||
860 | trace_gk20a_finalize_poweron(dev_name(dev)); | 864 | trace_gk20a_finalize_poweron(dev_name(dev)); |
861 | 865 | ||
866 | /* Increment platform power refcount */ | ||
867 | if (platform->busy) { | ||
868 | err = platform->busy(dev); | ||
869 | if (err < 0) { | ||
870 | dev_err(dev, "%s: failed to poweron platform dependency\n", | ||
871 | __func__); | ||
872 | goto done; | ||
873 | } | ||
874 | } | ||
875 | |||
862 | err = gk20a_restore_registers(g); | 876 | err = gk20a_restore_registers(g); |
863 | if (err) | 877 | if (err) |
864 | return err; | 878 | return err; |
@@ -1787,25 +1801,12 @@ int gk20a_busy(struct device *dev) | |||
1787 | { | 1801 | { |
1788 | int ret = 0; | 1802 | int ret = 0; |
1789 | struct gk20a *g = get_gk20a(dev); | 1803 | struct gk20a *g = get_gk20a(dev); |
1790 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
1791 | 1804 | ||
1792 | down_read(&g->busy_lock); | 1805 | down_read(&g->busy_lock); |
1793 | |||
1794 | if (pm_runtime_enabled(dev)) { | 1806 | if (pm_runtime_enabled(dev)) { |
1795 | if (platform->busy) { | ||
1796 | ret = platform->busy(dev); | ||
1797 | if (ret < 0) { | ||
1798 | dev_err(dev, "%s: failed to poweron platform dependency\n", | ||
1799 | __func__); | ||
1800 | goto fail; | ||
1801 | } | ||
1802 | } | ||
1803 | |||
1804 | ret = pm_runtime_get_sync(dev); | 1807 | ret = pm_runtime_get_sync(dev); |
1805 | if (ret < 0) { | 1808 | if (ret < 0) { |
1806 | pm_runtime_put_noidle(dev); | 1809 | pm_runtime_put_noidle(dev); |
1807 | if (platform->idle) | ||
1808 | platform->idle(dev); | ||
1809 | goto fail; | 1810 | goto fail; |
1810 | } | 1811 | } |
1811 | } else { | 1812 | } else { |
@@ -1818,8 +1819,6 @@ int gk20a_busy(struct device *dev) | |||
1818 | } | 1819 | } |
1819 | } | 1820 | } |
1820 | 1821 | ||
1821 | gk20a_scale_notify_busy(dev); | ||
1822 | |||
1823 | fail: | 1822 | fail: |
1824 | up_read(&g->busy_lock); | 1823 | up_read(&g->busy_lock); |
1825 | 1824 | ||
@@ -1828,8 +1827,6 @@ fail: | |||
1828 | 1827 | ||
1829 | void gk20a_idle(struct device *dev) | 1828 | void gk20a_idle(struct device *dev) |
1830 | { | 1829 | { |
1831 | struct gk20a_platform *platform = gk20a_get_platform(dev); | ||
1832 | |||
1833 | if (pm_runtime_enabled(dev)) { | 1830 | if (pm_runtime_enabled(dev)) { |
1834 | #ifdef CONFIG_PM | 1831 | #ifdef CONFIG_PM |
1835 | if (atomic_read(&dev->power.usage_count) == 1) | 1832 | if (atomic_read(&dev->power.usage_count) == 1) |
@@ -1839,8 +1836,6 @@ void gk20a_idle(struct device *dev) | |||
1839 | pm_runtime_mark_last_busy(dev); | 1836 | pm_runtime_mark_last_busy(dev); |
1840 | pm_runtime_put_sync_autosuspend(dev); | 1837 | pm_runtime_put_sync_autosuspend(dev); |
1841 | 1838 | ||
1842 | if (platform->idle) | ||
1843 | platform->idle(dev); | ||
1844 | } else { | 1839 | } else { |
1845 | gk20a_scale_notify_idle(dev); | 1840 | gk20a_scale_notify_idle(dev); |
1846 | } | 1841 | } |