diff options
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/hal_gm20b.c | 7 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/therm_gm20b.c | 10 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gm20b/therm_gm20b.h | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/hal_gp106.c | 12 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/therm_gp106.c | 24 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp106/therm_gp106.h | 13 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/hal_gp10b.c | 6 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/therm_gp10b.c | 4 | ||||
-rw-r--r-- | drivers/gpu/nvgpu/gp10b/therm_gp10b.h | 7 |
9 files changed, 51 insertions, 38 deletions
diff --git a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c index 1a11b11c..407a442a 100644 --- a/drivers/gpu/nvgpu/gm20b/hal_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/hal_gm20b.c | |||
@@ -17,6 +17,7 @@ | |||
17 | #include "gk20a/ce2_gk20a.h" | 17 | #include "gk20a/ce2_gk20a.h" |
18 | #include "gk20a/dbg_gpu_gk20a.h" | 18 | #include "gk20a/dbg_gpu_gk20a.h" |
19 | #include "gk20a/fifo_gk20a.h" | 19 | #include "gk20a/fifo_gk20a.h" |
20 | #include "gk20a/therm_gk20a.h" | ||
20 | #include "gk20a/css_gr_gk20a.h" | 21 | #include "gk20a/css_gr_gk20a.h" |
21 | #include "gk20a/mc_gk20a.h" | 22 | #include "gk20a/mc_gk20a.h" |
22 | #include "gk20a/bus_gk20a.h" | 23 | #include "gk20a/bus_gk20a.h" |
@@ -272,6 +273,10 @@ static const struct gpu_ops gm20b_ops = { | |||
272 | .get_netlist_name = gr_gm20b_get_netlist_name, | 273 | .get_netlist_name = gr_gm20b_get_netlist_name, |
273 | .is_fw_defined = gr_gm20b_is_firmware_defined, | 274 | .is_fw_defined = gr_gm20b_is_firmware_defined, |
274 | }, | 275 | }, |
276 | .therm = { | ||
277 | .init_therm_setup_hw = gm20b_init_therm_setup_hw, | ||
278 | .elcg_init_idle_filters = gk20a_elcg_init_idle_filters, | ||
279 | }, | ||
275 | .mc = { | 280 | .mc = { |
276 | .intr_enable = mc_gk20a_intr_enable, | 281 | .intr_enable = mc_gk20a_intr_enable, |
277 | .intr_unit_config = mc_gk20a_intr_unit_config, | 282 | .intr_unit_config = mc_gk20a_intr_unit_config, |
@@ -344,6 +349,7 @@ int gm20b_init_hal(struct gk20a *g) | |||
344 | gops->clock_gating = gm20b_ops.clock_gating; | 349 | gops->clock_gating = gm20b_ops.clock_gating; |
345 | gops->fifo = gm20b_ops.fifo; | 350 | gops->fifo = gm20b_ops.fifo; |
346 | gops->gr_ctx = gm20b_ops.gr_ctx; | 351 | gops->gr_ctx = gm20b_ops.gr_ctx; |
352 | gops->therm = gm20b_ops.therm; | ||
347 | gops->mc = gm20b_ops.mc; | 353 | gops->mc = gm20b_ops.mc; |
348 | gops->dbg_session_ops = gm20b_ops.dbg_session_ops; | 354 | gops->dbg_session_ops = gm20b_ops.dbg_session_ops; |
349 | gops->debug = gm20b_ops.debug; | 355 | gops->debug = gm20b_ops.debug; |
@@ -399,7 +405,6 @@ int gm20b_init_hal(struct gk20a *g) | |||
399 | gm20b_init_pmu_ops(g); | 405 | gm20b_init_pmu_ops(g); |
400 | gm20b_init_clk_ops(gops); | 406 | gm20b_init_clk_ops(gops); |
401 | gm20b_init_regops(gops); | 407 | gm20b_init_regops(gops); |
402 | gm20b_init_therm_ops(gops); | ||
403 | 408 | ||
404 | g->name = "gm20b"; | 409 | g->name = "gm20b"; |
405 | 410 | ||
diff --git a/drivers/gpu/nvgpu/gm20b/therm_gm20b.c b/drivers/gpu/nvgpu/gm20b/therm_gm20b.c index 84c1a071..a999151f 100644 --- a/drivers/gpu/nvgpu/gm20b/therm_gm20b.c +++ b/drivers/gpu/nvgpu/gm20b/therm_gm20b.c | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GM20B THERMAL | 2 | * GM20B THERMAL |
3 | * | 3 | * |
4 | * Copyright (c) 2015-2016, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -19,7 +19,7 @@ | |||
19 | 19 | ||
20 | #include <nvgpu/hw/gm20b/hw_therm_gm20b.h> | 20 | #include <nvgpu/hw/gm20b/hw_therm_gm20b.h> |
21 | 21 | ||
22 | static int gm20b_init_therm_setup_hw(struct gk20a *g) | 22 | int gm20b_init_therm_setup_hw(struct gk20a *g) |
23 | { | 23 | { |
24 | u32 v; | 24 | u32 v; |
25 | 25 | ||
@@ -67,9 +67,3 @@ static int gm20b_init_therm_setup_hw(struct gk20a *g) | |||
67 | 67 | ||
68 | return 0; | 68 | return 0; |
69 | } | 69 | } |
70 | |||
71 | void gm20b_init_therm_ops(struct gpu_ops *gops) | ||
72 | { | ||
73 | gops->therm.init_therm_setup_hw = gm20b_init_therm_setup_hw; | ||
74 | gops->therm.elcg_init_idle_filters = gk20a_elcg_init_idle_filters; | ||
75 | } | ||
diff --git a/drivers/gpu/nvgpu/gm20b/therm_gm20b.h b/drivers/gpu/nvgpu/gm20b/therm_gm20b.h index c346c4f2..65147a64 100644 --- a/drivers/gpu/nvgpu/gm20b/therm_gm20b.h +++ b/drivers/gpu/nvgpu/gm20b/therm_gm20b.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * GM20B THERMAL | 2 | * GM20B THERMAL |
3 | * | 3 | * |
4 | * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -15,7 +15,7 @@ | |||
15 | #ifndef THERM_GM20B_H | 15 | #ifndef THERM_GM20B_H |
16 | #define THERM_GM20B_H | 16 | #define THERM_GM20B_H |
17 | 17 | ||
18 | struct gpu_ops; | 18 | struct gk20a; |
19 | void gm20b_init_therm_ops(struct gpu_ops *gops); | 19 | int gm20b_init_therm_setup_hw(struct gk20a *g); |
20 | 20 | ||
21 | #endif /* THERM_GM20B_H */ | 21 | #endif /* THERM_GM20B_H */ |
diff --git a/drivers/gpu/nvgpu/gp106/hal_gp106.c b/drivers/gpu/nvgpu/gp106/hal_gp106.c index f9368621..8077c5e1 100644 --- a/drivers/gpu/nvgpu/gp106/hal_gp106.c +++ b/drivers/gpu/nvgpu/gp106/hal_gp106.c | |||
@@ -343,6 +343,16 @@ static const struct gpu_ops gp106_ops = { | |||
343 | .exit = gk20a_pramin_exit, | 343 | .exit = gk20a_pramin_exit, |
344 | .data032_r = pram_data032_r, | 344 | .data032_r = pram_data032_r, |
345 | }, | 345 | }, |
346 | .therm = { | ||
347 | #ifdef CONFIG_DEBUG_FS | ||
348 | .therm_debugfs_init = gp106_therm_debugfs_init, | ||
349 | #endif /* CONFIG_DEBUG_FS */ | ||
350 | .elcg_init_idle_filters = gp106_elcg_init_idle_filters, | ||
351 | .get_internal_sensor_curr_temp = | ||
352 | gp106_get_internal_sensor_curr_temp, | ||
353 | .get_internal_sensor_limits = gp106_get_internal_sensor_limits, | ||
354 | .configure_therm_alert = gp106_configure_therm_alert, | ||
355 | }, | ||
346 | .mc = { | 356 | .mc = { |
347 | .intr_enable = mc_gp10b_intr_enable, | 357 | .intr_enable = mc_gp10b_intr_enable, |
348 | .intr_unit_config = mc_gp10b_intr_unit_config, | 358 | .intr_unit_config = mc_gp10b_intr_unit_config, |
@@ -436,6 +446,7 @@ int gp106_init_hal(struct gk20a *g) | |||
436 | gops->gr_ctx = gp106_ops.gr_ctx; | 446 | gops->gr_ctx = gp106_ops.gr_ctx; |
437 | gops->fecs_trace = gp106_ops.fecs_trace; | 447 | gops->fecs_trace = gp106_ops.fecs_trace; |
438 | gops->pramin = gp106_ops.pramin; | 448 | gops->pramin = gp106_ops.pramin; |
449 | gops->therm = gp106_ops.therm; | ||
439 | gops->mc = gp106_ops.mc; | 450 | gops->mc = gp106_ops.mc; |
440 | gops->debug = gp106_ops.debug; | 451 | gops->debug = gp106_ops.debug; |
441 | gops->dbg_session_ops = gp106_ops.dbg_session_ops; | 452 | gops->dbg_session_ops = gp106_ops.dbg_session_ops; |
@@ -467,7 +478,6 @@ int gp106_init_hal(struct gk20a *g) | |||
467 | gp106_init_clk_ops(gops); | 478 | gp106_init_clk_ops(gops); |
468 | gp106_init_clk_arb_ops(gops); | 479 | gp106_init_clk_arb_ops(gops); |
469 | gp106_init_regops(gops); | 480 | gp106_init_regops(gops); |
470 | gp106_init_therm_ops(gops); | ||
471 | 481 | ||
472 | g->name = "gp10x"; | 482 | g->name = "gp10x"; |
473 | 483 | ||
diff --git a/drivers/gpu/nvgpu/gp106/therm_gp106.c b/drivers/gpu/nvgpu/gp106/therm_gp106.c index dacebe93..4be8e6cd 100644 --- a/drivers/gpu/nvgpu/gp106/therm_gp106.c +++ b/drivers/gpu/nvgpu/gp106/therm_gp106.c | |||
@@ -11,6 +11,8 @@ | |||
11 | * more details. | 11 | * more details. |
12 | */ | 12 | */ |
13 | 13 | ||
14 | #include "gk20a/gk20a.h" | ||
15 | |||
14 | #include "therm_gp106.h" | 16 | #include "therm_gp106.h" |
15 | #include "therm/thrmpmu.h" | 17 | #include "therm/thrmpmu.h" |
16 | 18 | ||
@@ -22,13 +24,13 @@ | |||
22 | 24 | ||
23 | #include <nvgpu/hw/gp106/hw_therm_gp106.h> | 25 | #include <nvgpu/hw/gp106/hw_therm_gp106.h> |
24 | 26 | ||
25 | static void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8) | 27 | void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8) |
26 | { | 28 | { |
27 | *max_24_8 = (0x87 << 8); | 29 | *max_24_8 = (0x87 << 8); |
28 | *min_24_8 = ((-216) << 8); | 30 | *min_24_8 = ((-216) << 8); |
29 | } | 31 | } |
30 | 32 | ||
31 | static int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8) | 33 | int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8) |
32 | { | 34 | { |
33 | int err = 0; | 35 | int err = 0; |
34 | u32 readval; | 36 | u32 readval; |
@@ -68,7 +70,8 @@ static int therm_get_internal_sensor_curr_temp(void *data, u64 *val) | |||
68 | } | 70 | } |
69 | DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n"); | 71 | DEFINE_SIMPLE_ATTRIBUTE(therm_ctrl_fops, therm_get_internal_sensor_curr_temp, NULL, "%llu\n"); |
70 | 72 | ||
71 | static void gp106_therm_debugfs_init(struct gk20a *g) { | 73 | void gp106_therm_debugfs_init(struct gk20a *g) |
74 | { | ||
72 | struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); | 75 | struct gk20a_platform *platform = dev_get_drvdata(dev_from_gk20a(g)); |
73 | struct dentry *dbgentry; | 76 | struct dentry *dbgentry; |
74 | 77 | ||
@@ -79,7 +82,7 @@ static void gp106_therm_debugfs_init(struct gk20a *g) { | |||
79 | } | 82 | } |
80 | #endif | 83 | #endif |
81 | 84 | ||
82 | static int gp106_elcg_init_idle_filters(struct gk20a *g) | 85 | int gp106_elcg_init_idle_filters(struct gk20a *g) |
83 | { | 86 | { |
84 | u32 gate_ctrl, idle_filter; | 87 | u32 gate_ctrl, idle_filter; |
85 | u32 engine_id; | 88 | u32 engine_id; |
@@ -117,7 +120,7 @@ static int gp106_elcg_init_idle_filters(struct gk20a *g) | |||
117 | return 0; | 120 | return 0; |
118 | } | 121 | } |
119 | 122 | ||
120 | static u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp) | 123 | u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp) |
121 | { | 124 | { |
122 | u32 err = 0; | 125 | u32 err = 0; |
123 | 126 | ||
@@ -128,14 +131,3 @@ static u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp) | |||
128 | 131 | ||
129 | return err; | 132 | return err; |
130 | } | 133 | } |
131 | |||
132 | void gp106_init_therm_ops(struct gpu_ops *gops) { | ||
133 | #ifdef CONFIG_DEBUG_FS | ||
134 | gops->therm.therm_debugfs_init = gp106_therm_debugfs_init; | ||
135 | #endif | ||
136 | gops->therm.elcg_init_idle_filters = gp106_elcg_init_idle_filters; | ||
137 | gops->therm.get_internal_sensor_curr_temp = gp106_get_internal_sensor_curr_temp; | ||
138 | gops->therm.get_internal_sensor_limits = | ||
139 | gp106_get_internal_sensor_limits; | ||
140 | gops->therm.configure_therm_alert = gp106_configure_therm_alert; | ||
141 | } | ||
diff --git a/drivers/gpu/nvgpu/gp106/therm_gp106.h b/drivers/gpu/nvgpu/gp106/therm_gp106.h index 6db17c47..2866320b 100644 --- a/drivers/gpu/nvgpu/gp106/therm_gp106.h +++ b/drivers/gpu/nvgpu/gp106/therm_gp106.h | |||
@@ -1,7 +1,7 @@ | |||
1 | /* | 1 | /* |
2 | * general thermal control structures & definitions | 2 | * general thermal control structures & definitions |
3 | * | 3 | * |
4 | * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved. | 4 | * Copyright (c) 2016-2017, NVIDIA CORPORATION. All rights reserved. |
5 | * | 5 | * |
6 | * This program is free software; you can redistribute it and/or modify it | 6 | * This program is free software; you can redistribute it and/or modify it |
7 | * under the terms and conditions of the GNU General Public License, | 7 | * under the terms and conditions of the GNU General Public License, |
@@ -16,7 +16,14 @@ | |||
16 | #ifndef NVGPU_THERM_GP106_H | 16 | #ifndef NVGPU_THERM_GP106_H |
17 | #define NVGPU_THERM_GP106_H | 17 | #define NVGPU_THERM_GP106_H |
18 | 18 | ||
19 | #include "gk20a/gk20a.h" | 19 | struct gk20a; |
20 | |||
21 | void gp106_get_internal_sensor_limits(s32 *max_24_8, s32 *min_24_8); | ||
22 | int gp106_get_internal_sensor_curr_temp(struct gk20a *g, u32 *temp_f24_8); | ||
23 | #ifdef CONFIG_DEBUG_FS | ||
24 | void gp106_therm_debugfs_init(struct gk20a *g); | ||
25 | #endif | ||
26 | int gp106_elcg_init_idle_filters(struct gk20a *g); | ||
27 | u32 gp106_configure_therm_alert(struct gk20a *g, s32 curr_warn_temp); | ||
20 | 28 | ||
21 | void gp106_init_therm_ops(struct gpu_ops *gops); | ||
22 | #endif | 29 | #endif |
diff --git a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c index 3a44f1ef..a2aacd2e 100644 --- a/drivers/gpu/nvgpu/gp10b/hal_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/hal_gp10b.c | |||
@@ -309,6 +309,10 @@ static const struct gpu_ops gp10b_ops = { | |||
309 | .exit = gk20a_pramin_exit, | 309 | .exit = gk20a_pramin_exit, |
310 | .data032_r = pram_data032_r, | 310 | .data032_r = pram_data032_r, |
311 | }, | 311 | }, |
312 | .therm = { | ||
313 | .init_therm_setup_hw = gp10b_init_therm_setup_hw, | ||
314 | .elcg_init_idle_filters = gp10b_elcg_init_idle_filters, | ||
315 | }, | ||
312 | .mc = { | 316 | .mc = { |
313 | .intr_enable = mc_gp10b_intr_enable, | 317 | .intr_enable = mc_gp10b_intr_enable, |
314 | .intr_unit_config = mc_gp10b_intr_unit_config, | 318 | .intr_unit_config = mc_gp10b_intr_unit_config, |
@@ -385,6 +389,7 @@ int gp10b_init_hal(struct gk20a *g) | |||
385 | gops->gr_ctx = gp10b_ops.gr_ctx; | 389 | gops->gr_ctx = gp10b_ops.gr_ctx; |
386 | gops->fecs_trace = gp10b_ops.fecs_trace; | 390 | gops->fecs_trace = gp10b_ops.fecs_trace; |
387 | gops->pramin = gp10b_ops.pramin; | 391 | gops->pramin = gp10b_ops.pramin; |
392 | gops->therm = gp10b_ops.therm; | ||
388 | gops->mc = gp10b_ops.mc; | 393 | gops->mc = gp10b_ops.mc; |
389 | gops->debug = gp10b_ops.debug; | 394 | gops->debug = gp10b_ops.debug; |
390 | gops->dbg_session_ops = gp10b_ops.dbg_session_ops; | 395 | gops->dbg_session_ops = gp10b_ops.dbg_session_ops; |
@@ -448,7 +453,6 @@ int gp10b_init_hal(struct gk20a *g) | |||
448 | gp10b_init_mm(gops); | 453 | gp10b_init_mm(gops); |
449 | gp10b_init_pmu_ops(g); | 454 | gp10b_init_pmu_ops(g); |
450 | gp10b_init_regops(gops); | 455 | gp10b_init_regops(gops); |
451 | gp10b_init_therm_ops(gops); | ||
452 | 456 | ||
453 | g->name = "gp10b"; | 457 | g->name = "gp10b"; |
454 | 458 | ||
diff --git a/drivers/gpu/nvgpu/gp10b/therm_gp10b.c b/drivers/gpu/nvgpu/gp10b/therm_gp10b.c index 925fc69b..43f44c92 100644 --- a/drivers/gpu/nvgpu/gp10b/therm_gp10b.c +++ b/drivers/gpu/nvgpu/gp10b/therm_gp10b.c | |||
@@ -20,7 +20,7 @@ | |||
20 | 20 | ||
21 | #include <nvgpu/hw/gp10b/hw_therm_gp10b.h> | 21 | #include <nvgpu/hw/gp10b/hw_therm_gp10b.h> |
22 | 22 | ||
23 | static int gp10b_init_therm_setup_hw(struct gk20a *g) | 23 | int gp10b_init_therm_setup_hw(struct gk20a *g) |
24 | { | 24 | { |
25 | u32 v; | 25 | u32 v; |
26 | 26 | ||
@@ -80,7 +80,7 @@ static int gp10b_init_therm_setup_hw(struct gk20a *g) | |||
80 | return 0; | 80 | return 0; |
81 | } | 81 | } |
82 | 82 | ||
83 | static int gp10b_elcg_init_idle_filters(struct gk20a *g) | 83 | int gp10b_elcg_init_idle_filters(struct gk20a *g) |
84 | { | 84 | { |
85 | u32 gate_ctrl, idle_filter; | 85 | u32 gate_ctrl, idle_filter; |
86 | u32 engine_id; | 86 | u32 engine_id; |
diff --git a/drivers/gpu/nvgpu/gp10b/therm_gp10b.h b/drivers/gpu/nvgpu/gp10b/therm_gp10b.h index 18c102fe..c9ed01e6 100644 --- a/drivers/gpu/nvgpu/gp10b/therm_gp10b.h +++ b/drivers/gpu/nvgpu/gp10b/therm_gp10b.h | |||
@@ -1,5 +1,5 @@ | |||
1 | /* | 1 | /* |
2 | * Copyright (c) 2015, NVIDIA CORPORATION. All rights reserved. | 2 | * Copyright (c) 2015-2017, NVIDIA CORPORATION. All rights reserved. |
3 | * | 3 | * |
4 | * This program is free software; you can redistribute it and/or modify it | 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, | 5 | * under the terms and conditions of the GNU General Public License, |
@@ -13,7 +13,8 @@ | |||
13 | #ifndef THERM_GP10B_H | 13 | #ifndef THERM_GP10B_H |
14 | #define THERM_GP10B_H | 14 | #define THERM_GP10B_H |
15 | 15 | ||
16 | struct gpu_ops; | 16 | struct gk20a; |
17 | void gp10b_init_therm_ops(struct gpu_ops *gops); | 17 | int gp10b_init_therm_setup_hw(struct gk20a *g); |
18 | int gp10b_elcg_init_idle_filters(struct gk20a *g); | ||
18 | 19 | ||
19 | #endif /* THERM_GP10B_H */ | 20 | #endif /* THERM_GP10B_H */ |