From 849c5317e8509b390da626bcb607e66cc5ef847f Mon Sep 17 00:00:00 2001 From: Thomas Fleury Date: Fri, 21 Oct 2016 16:43:39 -0700 Subject: 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 Reviewed-on: http://git-master/r/1241861 Tested-by: Thomas Fleury GVS: Gerrit_Virtual_Submit Reviewed-by: Terje Bergstrom Reviewed-by: Vijayakumar Subbu Reviewed-on: http://git-master/r/1267122 --- drivers/gpu/nvgpu/gp106/therm_gp106.c | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'drivers/gpu/nvgpu/gp106/therm_gp106.c') 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 @@ #include #include "hw_therm_gp106.h" -#ifdef CONFIG_DEBUG_FS -static int therm_get_internal_sensor_curr_temp(void *data, u64 *val) +static int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8) { - struct gk20a *g = (struct gk20a *)data; int err = 0; u32 readval; @@ -38,7 +36,21 @@ static int therm_get_internal_sensor_curr_temp(void *data, u64 *val) // Convert from F9.5 -> F27.5 -> F24.8. readval &= therm_temp_sensor_tsense_fixed_point_m(); - *val = readval; + *temp_f24_8 = readval; + + return err; +} + +#ifdef CONFIG_DEBUG_FS +static int therm_get_internal_sensor_curr_temp(void *data, u64 *val) +{ + struct gk20a *g = (struct gk20a *)data; + u32 readval; + int err; + + err = gp106_get_internal_sensor_curr_temp(g, &readval); + if (!err) + *val = readval; return err; } @@ -104,4 +116,5 @@ void gp106_init_therm_ops(struct gpu_ops *gops) { gops->therm.therm_debugfs_init = gp106_therm_debugfs_init; #endif gops->therm.elcg_init_idle_filters = gp106_elcg_init_idle_filters; + gops->therm.get_internal_sensor_curr_temp = gp106_get_internal_sensor_curr_temp; } -- cgit v1.2.2