summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/os/linux/debug_therm_gp106.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux/debug_therm_gp106.c')
-rw-r--r--drivers/gpu/nvgpu/os/linux/debug_therm_gp106.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/os/linux/debug_therm_gp106.c b/drivers/gpu/nvgpu/os/linux/debug_therm_gp106.c
new file mode 100644
index 00000000..dfe39461
--- /dev/null
+++ b/drivers/gpu/nvgpu/os/linux/debug_therm_gp106.c
@@ -0,0 +1,49 @@
1/*
2 * Copyright (c) 2018, NVIDIA Corporation. All rights reserved.
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms and conditions of the GNU General Public License,
6 * version 2, as published by the Free Software Foundation.
7 *
8 * This program is distributed in the hope it will be useful, but WITHOUT
9 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
10 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
11 * more details.
12 *
13 * You should have received a copy of the GNU General Public License
14 * along with this program. If not, see <http://www.gnu.org/licenses/>.
15 */
16
17#include <linux/debugfs.h>
18
19#include "os_linux.h"
20
21static int therm_get_internal_sensor_curr_temp(void *data, u64 *val)
22{
23 struct gk20a *g = (struct gk20a *)data;
24 u32 readval;
25 int err;
26
27 if (!g->ops.therm.get_internal_sensor_curr_temp)
28 return -EINVAL;
29
30 err = g->ops.therm.get_internal_sensor_curr_temp(g, &readval);
31 if (!err)
32 *val = readval;
33
34 return err;
35}
36DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n");
37
38int gp106_therm_init_debugfs(struct gk20a *g)
39{
40 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
41 struct dentry *dbgentry;
42
43 dbgentry = debugfs_create_file(
44 "temp", S_IRUGO, l->debugfs, g, &therm_ctrl_fops);
45 if (!dbgentry)
46 nvgpu_err(g, "debugfs entry create failed for therm_curr_temp");
47
48 return 0;
49}