summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/lpwr/lpwr.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/lpwr/lpwr.h')
-rw-r--r--drivers/gpu/nvgpu/lpwr/lpwr.h101
1 files changed, 101 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/lpwr/lpwr.h b/drivers/gpu/nvgpu/lpwr/lpwr.h
new file mode 100644
index 00000000..98b9769e
--- /dev/null
+++ b/drivers/gpu/nvgpu/lpwr/lpwr.h
@@ -0,0 +1,101 @@
1/*
2 * Copyright (c) 2016, NVIDIA CORPORATION. All rights reserved.
3 *
4 * Permission is hereby granted, free of charge, to any person obtaining a
5 * copy of this software and associated documentation files (the "Software"),
6 * to deal in the Software without restriction, including without limitation
7 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8 * and/or sell copies of the Software, and to permit persons to whom the
9 * Software is furnished to do so, subject to the following conditions:
10 *
11 * The above copyright notice and this permission notice shall be included in
12 * all copies or substantial portions of the Software.
13 *
14 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
17 * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
19 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
20 * DEALINGS IN THE SOFTWARE.
21 */
22#ifndef _MSCG_H_
23#define _MSCG_H_
24
25#define MAX_SWASR_MCLK_FREQ_WITHOUT_WR_TRAINING_MAXWELL_MHZ 540
26
27#define NV_PMU_PG_PARAM_MCLK_CHANGE_MS_SWASR_ENABLED BIT(0x1)
28#define NV_PMU_PG_PARAM_MCLK_CHANGE_GDDR5_WR_TRAINING_ENABLED BIT(0x3)
29
30#define LPWR_ENTRY_COUNT_MAX 0x06
31
32#define LPWR_VBIOS_IDX_ENTRY_COUNT_MAX (LPWR_ENTRY_COUNT_MAX)
33
34#define LPWR_VBIOS_IDX_ENTRY_RSVD \
35 (LPWR_VBIOS_IDX_ENTRY_COUNT_MAX - 1)
36
37#define LPWR_VBIOS_BASE_SAMPLING_PERIOD_DEFAULT (500)
38
39struct nvgpu_lpwr_bios_idx_entry {
40 u8 pcie_idx;
41 u8 gr_idx;
42 u8 ms_idx;
43 u8 di_idx;
44 u8 gc6_idx;
45};
46
47struct nvgpu_lpwr_bios_idx_data {
48 u16 base_sampling_period;
49 struct nvgpu_lpwr_bios_idx_entry entry[LPWR_VBIOS_IDX_ENTRY_COUNT_MAX];
50};
51
52#define LPWR_VBIOS_MS_ENTRY_COUNT_MAX (LPWR_ENTRY_COUNT_MAX)
53
54struct nvgpu_lpwr_bios_ms_entry {
55 bool ms_enabled;
56 u32 feature_mask;
57 u32 asr_efficiency_thresholdl;
58 u16 dynamic_current_logic;
59 u16 dynamic_current_sram;
60};
61
62struct nvgpu_lpwr_bios_ms_data {
63 u8 default_entry_idx;
64 u32 idle_threshold_us;
65 struct nvgpu_lpwr_bios_ms_entry entry[LPWR_VBIOS_MS_ENTRY_COUNT_MAX];
66};
67
68#define LPWR_VBIOS_GR_ENTRY_COUNT_MAX (LPWR_ENTRY_COUNT_MAX)
69
70struct nvgpu_lpwr_bios_gr_entry {
71 bool gr_enabled;
72 u32 feature_mask;
73};
74
75struct nvgpu_lpwr_bios_gr_data {
76 u8 default_entry_idx;
77 u32 idle_threshold_us;
78 u8 adaptive_gr_multiplier;
79 struct nvgpu_lpwr_bios_gr_entry entry[LPWR_VBIOS_GR_ENTRY_COUNT_MAX];
80};
81
82struct nvgpu_lpwr_bios_data {
83 struct nvgpu_lpwr_bios_idx_data idx;
84 struct nvgpu_lpwr_bios_ms_data ms;
85 struct nvgpu_lpwr_bios_gr_data gr;
86};
87
88struct obj_lwpr {
89 struct nvgpu_lpwr_bios_data lwpr_bios_data;
90 u32 mclk_change_cache;
91};
92
93u32 nvgpu_lpwr_pg_setup(struct gk20a *g);
94int nvgpu_lwpr_mclk_change(struct gk20a *g, u32 pstate);
95int nvgpu_lpwr_enable_pg(struct gk20a *g, bool pstate_lock);
96int nvgpu_lpwr_disable_pg(struct gk20a *g, bool pstate_lock);
97u32 nvgpu_lpwr_is_mscg_supported(struct gk20a *g, u32 pstate_num);
98u32 nvgpu_lpwr_is_rppg_supported(struct gk20a *g, u32 pstate_num);
99u32 nvgpu_lpwr_post_init(struct gk20a *g);
100
101#endif