From 0ad7f1d9aa18d959abf3cba6ca4e532fc9246a31 Mon Sep 17 00:00:00 2001 From: Deepak Nibade Date: Thu, 25 May 2017 17:41:38 +0530 Subject: gpu: nvgpu: use nvgpu specific nvhost APIs Remove use of linux specifix header files and and use nvgpu specific header file instead This is needed to remove all Linux dependencies from nvgpu driver Replace all nvhost_*() calls by nvgpu_nvhost_*() calls from new nvgpu library Remove platform device pointer host1x_dev from struct gk20a and add struct nvgpu_nvhost_dev instead Jira NVGPU-29 Change-Id: Ia7af70602cfc16f9ccc380752538c05a9cbb8a67 Signed-off-by: Deepak Nibade Reviewed-on: http://git-master/r/1489726 Reviewed-by: Automatic_Commit_Validation_User Reviewed-by: svccoveritychecker GVS: Gerrit_Virtual_Submit Reviewed-by: Bharat Nihalani --- drivers/gpu/nvgpu/gk20a/fence_gk20a.c | 32 ++++++++++++-------------------- 1 file changed, 12 insertions(+), 20 deletions(-) (limited to 'drivers/gpu/nvgpu/gk20a/fence_gk20a.c') diff --git a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c index 7c5d33c7..5392e77c 100644 --- a/drivers/gpu/nvgpu/gk20a/fence_gk20a.c +++ b/drivers/gpu/nvgpu/gk20a/fence_gk20a.c @@ -21,6 +21,7 @@ #include #include #include +#include #include "gk20a.h" #include "channel_gk20a.h" @@ -30,11 +31,6 @@ #include "../drivers/staging/android/sync.h" #endif -#ifdef CONFIG_TEGRA_GK20A_NVHOST -#include -#include -#endif - struct gk20a_fence_ops { int (*wait)(struct gk20a_fence *, long timeout); bool (*is_expired)(struct gk20a_fence *); @@ -268,8 +264,8 @@ int gk20a_fence_from_semaphore( static int gk20a_syncpt_fence_wait(struct gk20a_fence *f, long timeout) { - return nvhost_syncpt_wait_timeout_ext( - f->host1x_pdev, f->syncpt_id, f->syncpt_value, + return nvgpu_nvhost_syncpt_wait_timeout_ext( + f->nvhost_dev, f->syncpt_id, f->syncpt_value, (u32)timeout, NULL, NULL); } @@ -281,13 +277,14 @@ static bool gk20a_syncpt_fence_is_expired(struct gk20a_fence *f) * syncpt value to be updated. For this case, we force a read * of the value from HW, and then check for expiration. */ - if (!nvhost_syncpt_is_expired_ext(f->host1x_pdev, f->syncpt_id, + if (!nvgpu_nvhost_syncpt_is_expired_ext(f->nvhost_dev, f->syncpt_id, f->syncpt_value)) { u32 val; - if (!nvhost_syncpt_read_ext_check(f->host1x_pdev, + if (!nvgpu_nvhost_syncpt_read_ext_check(f->nvhost_dev, f->syncpt_id, &val)) { - return nvhost_syncpt_is_expired_ext(f->host1x_pdev, + return nvgpu_nvhost_syncpt_is_expired_ext( + f->nvhost_dev, f->syncpt_id, f->syncpt_value); } } @@ -302,7 +299,7 @@ static const struct gk20a_fence_ops gk20a_syncpt_fence_ops = { int gk20a_fence_from_syncpt( struct gk20a_fence *fence_out, - struct platform_device *host1x_pdev, + struct nvgpu_nvhost_dev *nvhost_dev, u32 id, u32 value, bool wfi, bool need_sync_fence) { @@ -310,14 +307,9 @@ int gk20a_fence_from_syncpt( struct sync_fence *sync_fence = NULL; #ifdef CONFIG_SYNC - struct nvhost_ctrl_sync_fence_info pt = { - .id = id, - .thresh = value - }; - if (need_sync_fence) { - sync_fence = nvhost_sync_create_fence(host1x_pdev, &pt, 1, - "fence"); + sync_fence = nvgpu_nvhost_sync_create_fence(nvhost_dev, + id, value, 1, "fence"); if (IS_ERR(sync_fence)) return -1; } @@ -331,7 +323,7 @@ int gk20a_fence_from_syncpt( #endif return -EINVAL; } - f->host1x_pdev = host1x_pdev; + f->nvhost_dev = nvhost_dev; f->syncpt_id = id; f->syncpt_value = value; @@ -344,7 +336,7 @@ int gk20a_fence_from_syncpt( #else int gk20a_fence_from_syncpt( struct gk20a_fence *fence_out, - struct platform_device *host1x_pdev, + struct nvgpu_nvhost_dev *nvhost_dev, u32 id, u32 value, bool wfi, bool need_sync_fence) { -- cgit v1.2.2