diff options
author | Thomas Fleury <tfleury@nvidia.com> | 2016-10-21 19:43:39 -0400 |
---|---|---|
committer | Deepak Nibade <dnibade@nvidia.com> | 2016-12-27 04:56:52 -0500 |
commit | 849c5317e8509b390da626bcb607e66cc5ef847f (patch) | |
tree | a50207bd32926991b1a482dd1de5a24c1d44b97f /drivers/gpu/nvgpu/gp106/therm_gp106.c | |
parent | 5ab254c6e84d741f56e9bcc93512f82eb7ce518c (diff) |
gpu: nvgpu: get voltage, current, power and temperature
Add ioctls to retrieve voltage, current, power and temperature.
Add flags in GPU characteristics to indicate if feature is supported.
Jira DNVGPU-166
Change-Id: Ifaafe2efdb6b09d7b28215b641814f28e894151e
Signed-off-by: David Martinez Nieto <dmartineznie@nvidia.com>
Reviewed-on: http://git-master/r/1241861
Tested-by: Thomas Fleury <tfleury@nvidia.com>
GVS: Gerrit_Virtual_Submit
Reviewed-by: Terje Bergstrom <tbergstrom@nvidia.com>
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-on: http://git-master/r/1267122
Diffstat (limited to 'drivers/gpu/nvgpu/gp106/therm_gp106.c')
-rw-r--r-- | drivers/gpu/nvgpu/gp106/therm_gp106.c | 21 |
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 | 18 | static int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8) |
19 | static 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 | ||
45 | static 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 | } |