summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gk20a/gk20a.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c')
-rw-r--r--drivers/gpu/nvgpu/gk20a/gk20a.c74
1 files changed, 8 insertions, 66 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c
index a09a0631..98dce955 100644
--- a/drivers/gpu/nvgpu/gk20a/gk20a.c
+++ b/drivers/gpu/nvgpu/gk20a/gk20a.c
@@ -734,72 +734,6 @@ static int gk20a_init_support(struct platform_device *dev)
734 return err; 734 return err;
735} 735}
736 736
737static int gk20a_init_client(struct platform_device *dev)
738{
739 struct gk20a *g = get_gk20a(dev);
740 struct gk20a_platform *platform = gk20a_get_platform(dev);
741 int err;
742
743 gk20a_dbg_fn("");
744
745 if (platform->virtual_dev) {
746 err = vgpu_pm_finalize_poweron(&dev->dev);
747 if (err)
748 return err;
749 }
750
751#ifndef CONFIG_PM_RUNTIME
752 gk20a_pm_finalize_poweron(&dev->dev);
753#endif
754
755 err = gk20a_init_mm_setup_sw(g);
756 if (err)
757 return err;
758
759 if (IS_ENABLED(CONFIG_GK20A_DEVFREQ))
760 gk20a_scale_hw_init(dev);
761 return 0;
762}
763
764static void gk20a_deinit_client(struct platform_device *dev)
765{
766 struct gk20a_platform *platform = gk20a_get_platform(dev);
767
768 gk20a_dbg_fn("");
769
770 if (platform->virtual_dev) {
771 vgpu_pm_prepare_poweroff(&dev->dev);
772 return;
773 }
774
775#ifndef CONFIG_PM_RUNTIME
776 gk20a_pm_prepare_poweroff(&dev->dev);
777#endif
778}
779
780int gk20a_get_client(struct gk20a *g)
781{
782 int err = 0;
783
784 mutex_lock(&g->client_lock);
785 if (g->client_refcount == 0)
786 err = gk20a_init_client(g->dev);
787 if (!err)
788 g->client_refcount++;
789 mutex_unlock(&g->client_lock);
790 return err;
791}
792
793void gk20a_put_client(struct gk20a *g)
794{
795 mutex_lock(&g->client_lock);
796 if (g->client_refcount == 1)
797 gk20a_deinit_client(g->dev);
798 g->client_refcount--;
799 mutex_unlock(&g->client_lock);
800 WARN_ON(g->client_refcount < 0);
801}
802
803static int gk20a_pm_prepare_poweroff(struct device *dev) 737static int gk20a_pm_prepare_poweroff(struct device *dev)
804{ 738{
805 struct platform_device *pdev = to_platform_device(dev); 739 struct platform_device *pdev = to_platform_device(dev);
@@ -1662,6 +1596,14 @@ int gk20a_busy(struct platform_device *pdev)
1662 if (platform->idle) 1596 if (platform->idle)
1663 platform->idle(pdev); 1597 platform->idle(pdev);
1664 } 1598 }
1599#else
1600 if (!g->power_on) {
1601 ret = platform->virtual_dev ?
1602 vgpu_pm_finalize_poweron(&dev->dev)
1603 : gk20a_pm_finalize_poweron(&dev->dev);
1604 if (ret)
1605 goto fail;
1606 }
1665#endif 1607#endif
1666 gk20a_scale_notify_busy(pdev); 1608 gk20a_scale_notify_busy(pdev);
1667 1609