aboutsummaryrefslogtreecommitdiffstats
path: root/include/os/linux/debug_pmgr.c
diff options
context:
space:
mode:
Diffstat (limited to 'include/os/linux/debug_pmgr.c')
-rw-r--r--include/os/linux/debug_pmgr.c104
1 files changed, 0 insertions, 104 deletions
diff --git a/include/os/linux/debug_pmgr.c b/include/os/linux/debug_pmgr.c
deleted file mode 100644
index c264978..0000000
--- a/include/os/linux/debug_pmgr.c
+++ /dev/null
@@ -1,104 +0,0 @@
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
21#include "pmgr/pmgr.h"
22
23static int pmgr_pwr_devices_get_power_u64(void *data, u64 *p)
24{
25 struct gk20a *g = (struct gk20a *)data;
26 int err;
27 u32 val;
28
29 err = pmgr_pwr_devices_get_power(g, &val);
30 *p = val;
31
32 return err;
33}
34
35static int pmgr_pwr_devices_get_current_u64(void *data, u64 *p)
36{
37 struct gk20a *g = (struct gk20a *)data;
38 int err;
39 u32 val;
40
41 err = pmgr_pwr_devices_get_current(g, &val);
42 *p = val;
43
44 return err;
45}
46
47static int pmgr_pwr_devices_get_voltage_u64(void *data, u64 *p)
48{
49 struct gk20a *g = (struct gk20a *)data;
50 int err;
51 u32 val;
52
53 err = pmgr_pwr_devices_get_voltage(g, &val);
54 *p = val;
55
56 return err;
57}
58
59DEFINE_SIMPLE_ATTRIBUTE(
60 pmgr_power_ctrl_fops, pmgr_pwr_devices_get_power_u64, NULL, "%llu\n");
61
62DEFINE_SIMPLE_ATTRIBUTE(
63 pmgr_current_ctrl_fops, pmgr_pwr_devices_get_current_u64, NULL, "%llu\n");
64
65DEFINE_SIMPLE_ATTRIBUTE(
66 pmgr_voltage_ctrl_fops, pmgr_pwr_devices_get_voltage_u64, NULL, "%llu\n");
67
68static void pmgr_debugfs_init(struct gk20a *g)
69{
70 struct nvgpu_os_linux *l = nvgpu_os_linux_from_gk20a(g);
71 struct dentry *dbgentry;
72
73 dbgentry = debugfs_create_file(
74 "power", S_IRUGO, l->debugfs, g, &pmgr_power_ctrl_fops);
75 if (!dbgentry)
76 nvgpu_err(g, "debugfs entry create failed for power");
77
78 dbgentry = debugfs_create_file(
79 "current", S_IRUGO, l->debugfs, g, &pmgr_current_ctrl_fops);
80 if (!dbgentry)
81 nvgpu_err(g, "debugfs entry create failed for current");
82
83 dbgentry = debugfs_create_file(
84 "voltage", S_IRUGO, l->debugfs, g, &pmgr_voltage_ctrl_fops);
85 if (!dbgentry)
86 nvgpu_err(g, "debugfs entry create failed for voltage");
87}
88
89int nvgpu_pmgr_init_debugfs_linux(struct nvgpu_os_linux *l)
90{
91 struct gk20a *g = &l->g;
92 int ret = 0;
93
94 if (!nvgpu_is_enabled(g, NVGPU_PMU_PSTATE))
95 return ret;
96
97 if (!g->ops.clk.support_pmgr_domain)
98 return ret;
99
100 pmgr_debugfs_init(g);
101
102 return ret;
103}
104