diff options
author | Sunny He <suhe@nvidia.com> | 2017-07-26 21:08:00 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2017-07-27 19:34:45 -0400 |
commit | f391f53c089ec12fcc501c491430380b668e3cbf (patch) | |
tree | cc7dde1ab600dedb48c1b712094c16ceafaf5cdc /drivers/gpu/nvgpu/gp106/therm_gp106.c | |
parent | f0593bb43f3379baffd7bb77b89c9af18842ceef (diff) |
gpu: nvgpu: Reorg therm HAL initialization
Reorganize HAL initialization to remove inheritance and construct
the gpu_ops struct at compile time. This patch only covers the
therm sub-module of the gpu_ops struct.
Perform HAL function assignments in hal_gxxxx.c through the
population of a chip-specific copy of gpu_ops.
Jira NVGPU-74
Change-Id: Ic9d03304d3dcde0365cbf22af2dbe1e7eb0e04bb
Signed-off-by: Sunny He <suhe@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1527422
Reviewed-by: Automatic_Commit_Validation_User
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/gp106/therm_gp106.c')
-rw-r--r-- | drivers/gpu/nvgpu/gp106/therm_gp106.c | 24 |
1 files changed, 8 insertions, 16 deletions
diff --git a/drivers/gpu/nvgpu/gp106/therm_gp106.c b/drivers/gpu/nvgpu/gp106/therm_gp106.c index dacebe93..4be8e6cd 100644 --- a/drivers/gpu/nvgpu/gp106/therm_gp106.c +++ b/drivers/gpu/nvgpu/gp106/therm_gp106.c | |||
@@ -11,6 +11,8 @@ | |||
11 | * more details. | 11 | * more details. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "gk20a/gk20a.h" | ||
15 | |||
14 | #include "therm_gp106.h" | 16 | #include "therm_gp106.h" |
15 | #include "therm/thrmpmu.h" | 17 | #include "therm/thrmpmu.h" |
16 | 18 | ||
@@ -22,13 +24,13 @@ | |||
22 | 24 | ||
23 | #include <nvgpu/hw/gp106/hw_therm_gp106.h> | 25 | #include <nvgpu/hw/gp106/hw_therm_gp106.h> |
24 | 26 | ||
25 | static void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8) | 27 | void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8) |
26 | { | 28 | { |
27 | *max_24_8 = (0x87 << 8); | 29 | *max_24_8 = (0x87 << 8); |
28 | *min_24_8 = ((-216) << 8); | 30 | *min_24_8 = ((-216) << 8); |
29 | } | 31 | } |
30 | 32 | ||
31 | static int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8) | 33 | int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8) |
32 | { | 34 | { |
33 | int err = 0; | 35 | int err = 0; |
34 | u32 readval; | 36 | u32 readval; |
@@ -68,7 +70,8 @@ static int therm_get_internal_sensor_curr_temp(void *data, u64 *val) | |||
68 | } | 70 | } |
69 | DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n"); | 71 | DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n"); |
70 | 72 | ||
71 | static void gp106_therm_debugfs_init(struct gk20a *g) { | 73 | void gp106_therm_debugfs_init(struct gk20a *g) |
74 | { | ||
72 | struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); | 75 | struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); |
73 | struct dentry *dbgentry; | 76 | struct dentry *dbgentry; |
74 | 77 | ||
@@ -79,7 +82,7 @@ static void gp106_therm_debugfs_init(struct gk20a *g) { | |||
79 | } | 82 | } |
80 | #endif | 83 | #endif |
81 | 84 | ||
82 | static int gp106_elcg_init_idle_filters(struct gk20a *g) | 85 | int gp106_elcg_init_idle_filters(struct gk20a *g) |
83 | { | 86 | { |
84 | u32 gate_ctrl, idle_filter; | 87 | u32 gate_ctrl, idle_filter; |
85 | u32 engine_id; | 88 | u32 engine_id; |
@@ -117,7 +120,7 @@ static int gp106_elcg_init_idle_filters(struct gk20a *g) | |||
117 | return 0; | 120 | return 0; |
118 | } | 121 | } |
119 | 122 | ||
120 | static u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp) | 123 | u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp) |
121 | { | 124 | { |
122 | u32 err = 0; | 125 | u32 err = 0; |
123 | 126 | ||
@@ -128,14 +131,3 @@ static u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp) | |||
128 | 131 | ||
129 | return err; | 132 | return err; |
130 | } | 133 | } |
131 | |||
132 | void gp106_init_therm_ops(struct gpu_ops *gops) { | ||
133 | #ifdef CONFIG_DEBUG_FS | ||
134 | gops->therm.therm_debugfs_init = gp106_therm_debugfs_init; | ||
135 | #endif | ||
136 | gops->therm.elcg_init_idle_filters = gp106_elcg_init_idle_filters; | ||
137 | gops->therm.get_internal_sensor_curr_temp = gp106_get_internal_sensor_curr_temp; | ||
138 | gops->therm.get_internal_sensor_limits = | ||
139 | gp106_get_internal_sensor_limits; | ||
140 | gops->therm.configure_therm_alert = gp106_configure_therm_alert; | ||
141 | } | ||