summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/common/linux/module.c
diff options
context:
space:
mode:
authorTerje Bergstrom <tbergstrom@nvidia.com>2017-09-07 13:43:47 -0400
committermobile promotions <svcmobile_promotions@nvidia.com>2017-09-11 18:10:52 -0400
commitc37c9baae65bcf0ef08a319488c09f57131026cc (patch)
treee3b4252bfff7436574a909dd625de49229d538da /drivers/gpu/nvgpu/common/linux/module.c
parent17451138cf60f5d64eed88cc5defd44981926d9d (diff)
gpu: nvgpu: Move CDE code to Linux module
CDE is only used in Linux platforms, and the code is highly dependent on Linux APIs. Move the common CDE code to Linux module and leave only the chip specific parts to HAL. Change-Id: I507fe7eceaf7607303dfdddcf438449a5f582ea7 Signed-off-by: Terje Bergstrom <tbergstrom@nvidia.com> Reviewed-on: https://git-master.nvidia.com/r/1554755 Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com> Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/common/linux/module.c')
-rw-r--r--drivers/gpu/nvgpu/common/linux/module.c14
1 files changed, 12 insertions, 2 deletions
diff --git a/drivers/gpu/nvgpu/common/linux/module.c b/drivers/gpu/nvgpu/common/linux/module.c
index 6a590baa..509930c7 100644
--- a/drivers/gpu/nvgpu/common/linux/module.c
+++ b/drivers/gpu/nvgpu/common/linux/module.c
@@ -39,6 +39,7 @@
39#include "pci.h" 39#include "pci.h"
40#include "module.h" 40#include "module.h"
41#include "intr.h" 41#include "intr.h"
42#include "cde.h"
42#ifdef CONFIG_TEGRA_19x_GPU 43#ifdef CONFIG_TEGRA_19x_GPU
43#include "nvgpu_gpuid_t19x.h" 44#include "nvgpu_gpuid_t19x.h"
44#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION 45#ifdef CONFIG_TEGRA_GR_VIRTUALIZATION
@@ -185,7 +186,7 @@ int gk20a_pm_finalize_poweron(struct device *dev)
185 gk20a_scale_resume(dev_from_gk20a(g)); 186 gk20a_scale_resume(dev_from_gk20a(g));
186 187
187 if (platform->has_cde) 188 if (platform->has_cde)
188 gk20a_init_cde_support(g); 189 gk20a_init_cde_support(l);
189 190
190done: 191done:
191 if (err) 192 if (err)
@@ -197,6 +198,7 @@ done:
197static int gk20a_pm_prepare_poweroff(struct device *dev) 198static int gk20a_pm_prepare_poweroff(struct device *dev)
198{ 199{
199 struct gk20a *g = get_gk20a(dev); 200 struct gk20a *g = get_gk20a(dev);
201 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
200 int ret = 0; 202 int ret = 0;
201 struct gk20a_platform *platform = gk20a_get_platform(dev); 203 struct gk20a_platform *platform = gk20a_get_platform(dev);
202 204
@@ -207,8 +209,15 @@ static int gk20a_pm_prepare_poweroff(struct device *dev)
207 if (!g->power_on) 209 if (!g->power_on)
208 goto done; 210 goto done;
209 211
212 if (gk20a_fifo_is_engine_busy(g)) {
213 ret = -EBUSY;
214 goto done;
215 }
216
210 gk20a_scale_suspend(dev); 217 gk20a_scale_suspend(dev);
211 218
219 gk20a_cde_suspend(l);
220
212 ret = gk20a_prepare_poweroff(g); 221 ret = gk20a_prepare_poweroff(g);
213 if (ret) 222 if (ret)
214 goto error; 223 goto error;
@@ -974,6 +983,7 @@ static int __exit gk20a_remove(struct platform_device *pdev)
974{ 983{
975 struct device *dev = &pdev->dev; 984 struct device *dev = &pdev->dev;
976 struct gk20a *g = get_gk20a(dev); 985 struct gk20a *g = get_gk20a(dev);
986 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
977 struct gk20a_platform *platform = gk20a_get_platform(dev); 987 struct gk20a_platform *platform = gk20a_get_platform(dev);
978 988
979 gk20a_dbg_fn(""); 989 gk20a_dbg_fn("");
@@ -982,7 +992,7 @@ static int __exit gk20a_remove(struct platform_device *pdev)
982 return vgpu_remove(pdev); 992 return vgpu_remove(pdev);
983 993
984 if (platform->has_cde) 994 if (platform->has_cde)
985 gk20a_cde_destroy(g); 995 gk20a_cde_destroy(l);
986 996
987 gk20a_ctxsw_trace_cleanup(g); 997 gk20a_ctxsw_trace_cleanup(g);
988 998