blob: d77a0665ac94c0e46cc56fa325dadb90207d0785 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
|
From df86f873a15819d207e7eb101745fc10e35aef53 Mon Sep 17 00:00:00 2001
From: Huang Rui <ray.huang@amd.com>
Date: Tue, 4 Dec 2018 17:14:41 +0800
Subject: [PATCH 1334/2940] drm/amd/powerplay: add interface to read pptable
from vbios
This patch adds interface to read pptable from vbios for smu.
Signed-off-by: Huang Rui <ray.huang@amd.com>
Acked-by: Alex Deucher <alexander.deucher@amd.com>
---
drivers/gpu/drm/amd/powerplay/amdgpu_smu.c | 19 ++++++++++++++++++-
.../gpu/drm/amd/powerplay/inc/amdgpu_smu.h | 3 +++
2 files changed, 21 insertions(+), 1 deletion(-)
diff --git a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
index b78125207b67..145435f05bc2 100644
--- a/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
+++ b/drivers/gpu/drm/amd/powerplay/amdgpu_smu.c
@@ -87,6 +87,17 @@ static int smu_sw_fini(void *handle)
return 0;
}
+static int smu_smc_table_hw_init(struct smu_context *smu)
+{
+ int ret;
+
+ ret = smu_read_pptable_from_vbios(smu);
+ if (ret)
+ return ret;
+
+ return 0;
+}
+
static int smu_hw_init(void *handle)
{
int ret;
@@ -110,13 +121,19 @@ static int smu_hw_init(void *handle)
mutex_lock(&smu->mutex);
- /* TODO */
+ ret = smu_smc_table_hw_init(smu);
+ if (ret)
+ goto failed;
mutex_unlock(&smu->mutex);
pr_info("SMU is initialized successfully!\n");
return 0;
+
+failed:
+ mutex_unlock(&smu->mutex);
+ return ret;
}
static int smu_hw_fini(void *handle)
diff --git a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
index 923a923d0050..1e5a784398f8 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
@@ -37,6 +37,7 @@ struct smu_funcs
int (*init_microcode)(struct smu_context *smu);
int (*load_microcode)(struct smu_context *smu);
int (*check_fw_status)(struct smu_context *smu);
+ int (*read_pptable_from_vbios)(struct smu_context *smu);
};
#define smu_init_microcode(smu) \
@@ -45,6 +46,8 @@ struct smu_funcs
((smu)->funcs->load_microcode ? (smu)->funcs->load_microcode((smu)) : 0)
#define smu_check_fw_status(smu) \
((smu)->funcs->check_fw_status ? (smu)->funcs->check_fw_status((smu)) : 0)
+#define smu_read_pptable_from_vbios(smu) \
+ ((smu)->funcs->read_pptable_from_vbios ? (smu)->funcs->read_pptable_from_vbios((smu)) : 0)
extern const struct amd_ip_funcs smu_ip_funcs;
--
2.17.1
|