diff options
author | Nitin Kumbhar <nkumbhar@nvidia.com> | 2018-08-13 00:39:04 -0400 |
---|---|---|
committer | mobile promotions <svcmobile_promotions@nvidia.com> | 2018-09-05 07:51:43 -0400 |
commit | bcdac829f44afc1b08941c507e691866f3a9cb38 (patch) | |
tree | 12a4e0378a7ea5bed584ee9c87b16d047f943886 /drivers/gpu/nvgpu/os/linux | |
parent | 0406900ca944305f9713905f4d7363fc2d9cbbea (diff) |
gpu: nvgpu: move therm debugfs to linux
Move debugfs related code of therm from common driver to linux
specific part of the driver. gp106_therm_debugfs_init()
is updated to use nvgpu_os_linux_ops.
This also affects gv100 as gp106_therm_debugfs_init is used
for gv100 as well.
JIRA NVGPU-603
Change-Id: Ia293d14599bc0c91fd1e917b5a430bd8f3d96e56
Signed-off-by: Nitin Kumbhar <nkumbhar@nvidia.com>
Reviewed-on: https://git-master.nvidia.com/r/1797906
GVS: Gerrit_Virtual_Submit
Reviewed-by: Vijayakumar Subbu <vsubbu@nvidia.com>
Reviewed-by: mobile promotions <svcmobile_promotions@nvidia.com>
Tested-by: mobile promotions <svcmobile_promotions@nvidia.com>
Diffstat (limited to 'drivers/gpu/nvgpu/os/linux')
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/debug_therm_gp106.c | 49 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/debug_therm_gp106.h | 29 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/module.c | 8 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_linux.h | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_ops.c | 9 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_ops_gp106.c | 5 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/os/linux/os_ops_gv100.c | 5 |
7 files changed, 109 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 | |||
21 | static 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 | } | ||
36 | DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n"); | ||
37 | |||
38 | int 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 | } | ||
diff --git a/drivers/gpu/nvgpu/os/linux/debug_therm_gp106.h b/drivers/gpu/nvgpu/os/linux/debug_therm_gp106.h new file mode 100644 index 00000000..6ebc9f58 --- /dev/null +++ b/drivers/gpu/nvgpu/os/linux/debug_therm_gp106.h | |||
@@ -0,0 +1,29 @@ | |||
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 | #ifndef __DEBUG_THERM_GP106_H | ||
18 | #define __DEBUG_THERM_GP106_H | ||
19 | |||
20 | #ifdef CONFIG_DEBUG_FS | ||
21 | int gp106_therm_init_debugfs(struct gk20a *g); | ||
22 | #else | ||
23 | inline int gp106_therm_init_debugfs(struct gk20a *g) | ||
24 | { | ||
25 | return 0; | ||
26 | } | ||
27 | #endif | ||
28 | |||
29 | #endif | ||
diff --git a/drivers/gpu/nvgpu/os/linux/module.c b/drivers/gpu/nvgpu/os/linux/module.c index 02b0ea5c..169baaf4 100644 --- a/drivers/gpu/nvgpu/os/linux/module.c +++ b/drivers/gpu/nvgpu/os/linux/module.c | |||
@@ -206,6 +206,14 @@ int nvgpu_finalize_poweron_linux(struct nvgpu_os_linux *l) | |||
206 | } | 206 | } |
207 | } | 207 | } |
208 | 208 | ||
209 | if (l->ops.therm.init_debugfs) { | ||
210 | err = l->ops.therm.init_debugfs(g); | ||
211 | if (err) { | ||
212 | nvgpu_err(g, "failed to init linux therm debugfs"); | ||
213 | return err; | ||
214 | } | ||
215 | } | ||
216 | |||
209 | l->init_done = true; | 217 | l->init_done = true; |
210 | 218 | ||
211 | return 0; | 219 | return 0; |
diff --git a/drivers/gpu/nvgpu/os/linux/os_linux.h b/drivers/gpu/nvgpu/os/linux/os_linux.h index 96eff12e..ff871fe5 100644 --- a/drivers/gpu/nvgpu/os/linux/os_linux.h +++ b/drivers/gpu/nvgpu/os/linux/os_linux.h | |||
@@ -42,6 +42,10 @@ struct nvgpu_os_linux_ops { | |||
42 | struct { | 42 | struct { |
43 | int (*init_debugfs)(struct gk20a *g); | 43 | int (*init_debugfs)(struct gk20a *g); |
44 | } clk; | 44 | } clk; |
45 | |||
46 | struct { | ||
47 | int (*init_debugfs)(struct gk20a *g); | ||
48 | } therm; | ||
45 | }; | 49 | }; |
46 | 50 | ||
47 | struct nvgpu_os_linux { | 51 | struct nvgpu_os_linux { |
diff --git a/drivers/gpu/nvgpu/os/linux/os_ops.c b/drivers/gpu/nvgpu/os/linux/os_ops.c index 5fc5beb4..5c2eb25c 100644 --- a/drivers/gpu/nvgpu/os/linux/os_ops.c +++ b/drivers/gpu/nvgpu/os/linux/os_ops.c | |||
@@ -21,6 +21,10 @@ | |||
21 | #include "os_ops_gp106.h" | 21 | #include "os_ops_gp106.h" |
22 | #include "os_ops_gv100.h" | 22 | #include "os_ops_gv100.h" |
23 | 23 | ||
24 | #if defined(CONFIG_TEGRA_GPU_NEXT) | ||
25 | #include "nvgpu_gpuid_next.h" | ||
26 | #endif | ||
27 | |||
24 | int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l) | 28 | int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l) |
25 | { | 29 | { |
26 | struct gk20a *g = &l->g; | 30 | struct gk20a *g = &l->g; |
@@ -40,6 +44,11 @@ int nvgpu_init_os_linux_ops(struct nvgpu_os_linux *l) | |||
40 | case NVGPU_GPUID_GV100: | 44 | case NVGPU_GPUID_GV100: |
41 | nvgpu_gv100_init_os_ops(l); | 45 | nvgpu_gv100_init_os_ops(l); |
42 | break; | 46 | break; |
47 | #if defined(CONFIG_TEGRA_GPU_NEXT) | ||
48 | case NVGPU_GPUID_NEXT: | ||
49 | NVGPU_NEXT_INIT_OS_OPS(l); | ||
50 | break; | ||
51 | #endif | ||
43 | default: | 52 | default: |
44 | break; | 53 | break; |
45 | } | 54 | } |
diff --git a/drivers/gpu/nvgpu/os/linux/os_ops_gp106.c b/drivers/gpu/nvgpu/os/linux/os_ops_gp106.c index 13ce73e6..662f4551 100644 --- a/drivers/gpu/nvgpu/os/linux/os_ops_gp106.c +++ b/drivers/gpu/nvgpu/os/linux/os_ops_gp106.c | |||
@@ -17,14 +17,19 @@ | |||
17 | #include "os_linux.h" | 17 | #include "os_linux.h" |
18 | 18 | ||
19 | #include "debug_clk_gp106.h" | 19 | #include "debug_clk_gp106.h" |
20 | #include "debug_therm_gp106.h" | ||
20 | 21 | ||
21 | static struct nvgpu_os_linux_ops gp106_os_linux_ops = { | 22 | static struct nvgpu_os_linux_ops gp106_os_linux_ops = { |
22 | .clk = { | 23 | .clk = { |
23 | .init_debugfs = gp106_clk_init_debugfs, | 24 | .init_debugfs = gp106_clk_init_debugfs, |
24 | }, | 25 | }, |
26 | .therm = { | ||
27 | .init_debugfs = gp106_therm_init_debugfs, | ||
28 | }, | ||
25 | }; | 29 | }; |
26 | 30 | ||
27 | void nvgpu_gp106_init_os_ops(struct nvgpu_os_linux *l) | 31 | void nvgpu_gp106_init_os_ops(struct nvgpu_os_linux *l) |
28 | { | 32 | { |
29 | l->ops.clk = gp106_os_linux_ops.clk; | 33 | l->ops.clk = gp106_os_linux_ops.clk; |
34 | l->ops.therm = gp106_os_linux_ops.therm; | ||
30 | } | 35 | } |
diff --git a/drivers/gpu/nvgpu/os/linux/os_ops_gv100.c b/drivers/gpu/nvgpu/os/linux/os_ops_gv100.c index 9236286b..7a5174a4 100644 --- a/drivers/gpu/nvgpu/os/linux/os_ops_gv100.c +++ b/drivers/gpu/nvgpu/os/linux/os_ops_gv100.c | |||
@@ -17,14 +17,19 @@ | |||
17 | #include "os_linux.h" | 17 | #include "os_linux.h" |
18 | 18 | ||
19 | #include "debug_clk_gp106.h" | 19 | #include "debug_clk_gp106.h" |
20 | #include "debug_therm_gp106.h" | ||
20 | 21 | ||
21 | static struct nvgpu_os_linux_ops gv100_os_linux_ops = { | 22 | static struct nvgpu_os_linux_ops gv100_os_linux_ops = { |
22 | .clk = { | 23 | .clk = { |
23 | .init_debugfs = gp106_clk_init_debugfs, | 24 | .init_debugfs = gp106_clk_init_debugfs, |
24 | }, | 25 | }, |
26 | .therm = { | ||
27 | .init_debugfs = gp106_therm_init_debugfs, | ||
28 | }, | ||
25 | }; | 29 | }; |
26 | 30 | ||
27 | void nvgpu_gv100_init_os_ops(struct nvgpu_os_linux *l) | 31 | void nvgpu_gv100_init_os_ops(struct nvgpu_os_linux *l) |
28 | { | 32 | { |
29 | l->ops.clk = gv100_os_linux_ops.clk; | 33 | l->ops.clk = gv100_os_linux_ops.clk; |
34 | l->ops.therm = gv100_os_linux_ops.therm; | ||
30 | } | 35 | } |