diff options
Diffstat (limited to 'drivers/gpu/nvgpu/gk20a/gk20a.c')
-rw-r--r-- | drivers/gpu/nvgpu/gk20a/gk20a.c | 57 |
1 files changed, 36 insertions, 21 deletions
diff --git a/drivers/gpu/nvgpu/gk20a/gk20a.c b/drivers/gpu/nvgpu/gk20a/gk20a.c index 96711c0c..7617c70a 100644 --- a/drivers/gpu/nvgpu/gk20a/gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/gk20a.c | |||
@@ -740,10 +740,10 @@ void gk20a_put_client(struct gk20a *g) | |||
740 | WARN_ON(g->client_refcount < 0); | 740 | WARN_ON(g->client_refcount < 0); |
741 | } | 741 | } |
742 | 742 | ||
743 | static int gk20a_pm_prepare_poweroff(struct device *dev) | 743 | static int gk20a_pm_prepare_poweroff(struct device *_dev) |
744 | { | 744 | { |
745 | struct platform_device *pdev = to_platform_device(dev); | 745 | struct platform_device *dev = to_platform_device(_dev); |
746 | struct gk20a *g = get_gk20a(pdev); | 746 | struct gk20a *g = get_gk20a(dev); |
747 | int ret = 0; | 747 | int ret = 0; |
748 | 748 | ||
749 | gk20a_dbg_fn(""); | 749 | gk20a_dbg_fn(""); |
@@ -770,8 +770,6 @@ static int gk20a_pm_prepare_poweroff(struct device *dev) | |||
770 | 770 | ||
771 | /* Disable GPCPLL */ | 771 | /* Disable GPCPLL */ |
772 | ret |= gk20a_suspend_clk_support(g); | 772 | ret |= gk20a_suspend_clk_support(g); |
773 | |||
774 | gk20a_platform_channel_idle(pdev); | ||
775 | g->power_on = false; | 773 | g->power_on = false; |
776 | 774 | ||
777 | return ret; | 775 | return ret; |
@@ -795,18 +793,14 @@ static void gk20a_detect_chip(struct gk20a *g) | |||
795 | g->gpu_characteristics.rev); | 793 | g->gpu_characteristics.rev); |
796 | } | 794 | } |
797 | 795 | ||
798 | static int gk20a_pm_finalize_poweron(struct device *dev) | 796 | static int gk20a_pm_finalize_poweron(struct device *_dev) |
799 | { | 797 | { |
800 | struct platform_device *pdev = to_platform_device(dev); | 798 | struct platform_device *dev = to_platform_device(_dev); |
801 | struct gk20a *g = get_gk20a(pdev); | 799 | struct gk20a *g = get_gk20a(dev); |
802 | int err, nice_value; | 800 | int err, nice_value; |
803 | 801 | ||
804 | gk20a_dbg_fn(""); | 802 | gk20a_dbg_fn(""); |
805 | 803 | ||
806 | err = gk20a_platform_channel_busy(pdev); | ||
807 | if (err) | ||
808 | return err; | ||
809 | |||
810 | if (g->power_on) | 804 | if (g->power_on) |
811 | return 0; | 805 | return 0; |
812 | 806 | ||
@@ -855,7 +849,7 @@ static int gk20a_pm_finalize_poweron(struct device *dev) | |||
855 | saving features (blcg/slcg) are enabled. For now, do it here. */ | 849 | saving features (blcg/slcg) are enabled. For now, do it here. */ |
856 | err = gk20a_init_clk_support(g); | 850 | err = gk20a_init_clk_support(g); |
857 | if (err) { | 851 | if (err) { |
858 | gk20a_err(dev, "failed to init gk20a clk"); | 852 | gk20a_err(&dev->dev, "failed to init gk20a clk"); |
859 | goto done; | 853 | goto done; |
860 | } | 854 | } |
861 | 855 | ||
@@ -874,7 +868,7 @@ static int gk20a_pm_finalize_poweron(struct device *dev) | |||
874 | 868 | ||
875 | err = gk20a_init_fifo_reset_enable_hw(g); | 869 | err = gk20a_init_fifo_reset_enable_hw(g); |
876 | if (err) { | 870 | if (err) { |
877 | gk20a_err(dev, "failed to reset gk20a fifo"); | 871 | gk20a_err(&dev->dev, "failed to reset gk20a fifo"); |
878 | goto done; | 872 | goto done; |
879 | } | 873 | } |
880 | 874 | ||
@@ -883,43 +877,43 @@ static int gk20a_pm_finalize_poweron(struct device *dev) | |||
883 | 877 | ||
884 | err = gk20a_init_mm_support(g); | 878 | err = gk20a_init_mm_support(g); |
885 | if (err) { | 879 | if (err) { |
886 | gk20a_err(dev, "failed to init gk20a mm"); | 880 | gk20a_err(&dev->dev, "failed to init gk20a mm"); |
887 | goto done; | 881 | goto done; |
888 | } | 882 | } |
889 | 883 | ||
890 | err = gk20a_init_pmu_support(g); | 884 | err = gk20a_init_pmu_support(g); |
891 | if (err) { | 885 | if (err) { |
892 | gk20a_err(dev, "failed to init gk20a pmu"); | 886 | gk20a_err(&dev->dev, "failed to init gk20a pmu"); |
893 | goto done; | 887 | goto done; |
894 | } | 888 | } |
895 | 889 | ||
896 | err = gk20a_init_fifo_support(g); | 890 | err = gk20a_init_fifo_support(g); |
897 | if (err) { | 891 | if (err) { |
898 | gk20a_err(dev, "failed to init gk20a fifo"); | 892 | gk20a_err(&dev->dev, "failed to init gk20a fifo"); |
899 | goto done; | 893 | goto done; |
900 | } | 894 | } |
901 | 895 | ||
902 | err = gk20a_init_gr_support(g); | 896 | err = gk20a_init_gr_support(g); |
903 | if (err) { | 897 | if (err) { |
904 | gk20a_err(dev, "failed to init gk20a gr"); | 898 | gk20a_err(&dev->dev, "failed to init gk20a gr"); |
905 | goto done; | 899 | goto done; |
906 | } | 900 | } |
907 | 901 | ||
908 | err = gk20a_init_pmu_setup_hw2(g); | 902 | err = gk20a_init_pmu_setup_hw2(g); |
909 | if (err) { | 903 | if (err) { |
910 | gk20a_err(dev, "failed to init gk20a pmu_hw2"); | 904 | gk20a_err(&dev->dev, "failed to init gk20a pmu_hw2"); |
911 | goto done; | 905 | goto done; |
912 | } | 906 | } |
913 | 907 | ||
914 | err = gk20a_init_therm_support(g); | 908 | err = gk20a_init_therm_support(g); |
915 | if (err) { | 909 | if (err) { |
916 | gk20a_err(dev, "failed to init gk20a therm"); | 910 | gk20a_err(&dev->dev, "failed to init gk20a therm"); |
917 | goto done; | 911 | goto done; |
918 | } | 912 | } |
919 | 913 | ||
920 | err = gk20a_init_gpu_characteristics(g); | 914 | err = gk20a_init_gpu_characteristics(g); |
921 | if (err) { | 915 | if (err) { |
922 | gk20a_err(dev, "failed to init gk20a gpu characteristics"); | 916 | gk20a_err(&dev->dev, "failed to init gk20a gpu characteristics"); |
923 | goto done; | 917 | goto done; |
924 | } | 918 | } |
925 | 919 | ||
@@ -1546,6 +1540,27 @@ void gk20a_busy_noresume(struct platform_device *pdev) | |||
1546 | pm_runtime_get_noresume(&pdev->dev); | 1540 | pm_runtime_get_noresume(&pdev->dev); |
1547 | } | 1541 | } |
1548 | 1542 | ||
1543 | int gk20a_channel_busy(struct platform_device *pdev) | ||
1544 | { | ||
1545 | int ret = 0; | ||
1546 | |||
1547 | ret = gk20a_platform_channel_busy(pdev); | ||
1548 | if (ret) | ||
1549 | return ret; | ||
1550 | |||
1551 | ret = gk20a_busy(pdev); | ||
1552 | if (ret) | ||
1553 | gk20a_platform_channel_idle(pdev); | ||
1554 | |||
1555 | return ret; | ||
1556 | } | ||
1557 | |||
1558 | void gk20a_channel_idle(struct platform_device *pdev) | ||
1559 | { | ||
1560 | gk20a_idle(pdev); | ||
1561 | gk20a_platform_channel_idle(pdev); | ||
1562 | } | ||
1563 | |||
1549 | int gk20a_busy(struct platform_device *pdev) | 1564 | int gk20a_busy(struct platform_device *pdev) |
1550 | { | 1565 | { |
1551 | int ret = 0; | 1566 | int ret = 0; |