summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/gp106/therm_gp106.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/gp106/therm_gp106.c')
-rw-r--r--drivers/gpu/nvgpu/gp106/therm_gp106.c21
1 files changed, 17 insertions, 4 deletions
diff --git a/drivers/gpu/nvgpu/gp106/therm_gp106.c b/drivers/gpu/nvgpu/gp106/therm_gp106.c
index a3aa3636..15aff89c 100644
--- a/drivers/gpu/nvgpu/gp106/therm_gp106.c
+++ b/drivers/gpu/nvgpu/gp106/therm_gp106.c
@@ -15,10 +15,8 @@
15#include <linux/debugfs.h> 15#include <linux/debugfs.h>
16#include "hw_therm_gp106.h" 16#include "hw_therm_gp106.h"
17 17
18#ifdef CONFIG_DEBUG_FS 18static int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8)
19static int therm_get_internal_sensor_curr_temp(void *data, u64 *val)
20{ 19{
21 struct gk20a *g = (struct gk20a *)data;
22 int err = 0; 20 int err = 0;
23 u32 readval; 21 u32 readval;
24 22
@@ -38,7 +36,21 @@ static int therm_get_internal_sensor_curr_temp(void *data, u64 *val)
38 // Convert from F9.5 -> F27.5 -> F24.8. 36 // Convert from F9.5 -> F27.5 -> F24.8.
39 readval &= therm_temp_sensor_tsense_fixed_point_m(); 37 readval &= therm_temp_sensor_tsense_fixed_point_m();
40 38
41 *val = readval; 39 *temp_f24_8 = readval;
40
41 return err;
42}
43
44#ifdef CONFIG_DEBUG_FS
45static int therm_get_internal_sensor_curr_temp(void *data, u64 *val)
46{
47 struct gk20a *g = (struct gk20a *)data;
48 u32 readval;
49 int err;
50
51 err = gp106_get_internal_sensor_curr_temp(g, &readval);
52 if (!err)
53 *val = readval;
42 54
43 return err; 55 return err;
44} 56}
@@ -104,4 +116,5 @@ void gp106_init_therm_ops(struct gpu_ops *gops) {
104 gops->therm.therm_debugfs_init = gp106_therm_debugfs_init; 116 gops->therm.therm_debugfs_init = gp106_therm_debugfs_init;
105#endif 117#endif
106 gops->therm.elcg_init_idle_filters = gp106_elcg_init_idle_filters; 118 gops->therm.elcg_init_idle_filters = gp106_elcg_init_idle_filters;
119 gops->therm.get_internal_sensor_curr_temp = gp106_get_internal_sensor_curr_temp;
107} 120}