summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJim Qu <Jim.Qu@amd.com>2018-05-14 15:27:23 +0800
committerJim Qu <Jim.Qu@amd.com>2018-05-14 15:27:23 +0800
commit62de3a219b88c4256bb5aea9192a276ca56ecf38 (patch)
treed7e97b819c9c41d173b357828781ad48ae48c10a
parentc1be3d7b402f5e3182b677937fb02d2d2249241b (diff)
drm/amdgpu: add new cgs interface to get amdgpu device
Change-Id: I08637aaa4501be00f0ef99e53df00035dd407bf6 Signed-off-by: Jim Qu <Jim.Qu@amd.com> Reviewed-by: Huang Rui <ray.huang@amd.com>
-rw-r--r--drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c8
-rw-r--r--drivers/gpu/drm/amd/include/cgs_common.h6
2 files changed, 14 insertions, 0 deletions
diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
index 1f2b31ed11bd..a06510213b4b 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_cgs.c
@@ -1199,6 +1199,13 @@ static int amdgpu_cgs_set_temperature_range(struct cgs_device *cgs_device,
return 0;
}
+static void* amdgpu_cgs_get_amdgpu_device(struct cgs_device *cgs_device)
+{
+ CGS_FUNC_ADEV;
+
+ return (void*)adev;
+}
+
static const struct cgs_ops amdgpu_cgs_ops = {
.alloc_gpu_mem = amdgpu_cgs_alloc_gpu_mem,
.free_gpu_mem = amdgpu_cgs_free_gpu_mem,
@@ -1227,6 +1234,7 @@ static const struct cgs_ops amdgpu_cgs_ops = {
.lock_grbm_idx = amdgpu_cgs_lock_grbm_idx,
.register_pp_handle = amdgpu_cgs_register_pp_handle,
.set_temperature_range = amdgpu_cgs_set_temperature_range,
+ .get_amdgpu_devcie = amdgpu_cgs_get_amdgpu_device,
};
static const struct cgs_os_ops amdgpu_cgs_os_ops = {
diff --git a/drivers/gpu/drm/amd/include/cgs_common.h b/drivers/gpu/drm/amd/include/cgs_common.h
index f5c73970ab88..69bda1cd00bc 100644
--- a/drivers/gpu/drm/amd/include/cgs_common.h
+++ b/drivers/gpu/drm/amd/include/cgs_common.h
@@ -430,6 +430,9 @@ typedef void* (*cgs_register_pp_handle)(struct cgs_device *cgs_device,
typedef int (*cgs_set_temperature_range)(struct cgs_device *cgs_device,
int min_temperature,
int max_temperature);
+
+typedef void* (*cgs_get_amdgpu_device)(struct cgs_device *cgs_device);
+
struct cgs_ops {
/* memory management calls (similar to KFD interface) */
cgs_alloc_gpu_mem_t alloc_gpu_mem;
@@ -468,6 +471,7 @@ struct cgs_ops {
cgs_lock_grbm_idx lock_grbm_idx;
cgs_register_pp_handle register_pp_handle;
cgs_set_temperature_range set_temperature_range;
+ cgs_get_amdgpu_device get_amdgpu_devcie;
};
struct cgs_os_ops; /* To be define in OS-specific CGS header */
@@ -552,4 +556,6 @@ struct cgs_device
#define cgs_set_temperature_range(dev, min_temp, max_temp) \
CGS_CALL(set_temperature_range, dev, min_temp, max_temp)
+#define cgs_get_amdgpu_device(dev) \
+ CGS_CALL(get_amdgpu_devcie, dev)
#endif /* _CGS_COMMON_H */