summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/volt/volt_rail.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/volt/volt_rail.h')
-rw-r--r--drivers/gpu/nvgpu/volt/volt_rail.h88
1 files changed, 88 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/volt/volt_rail.h b/drivers/gpu/nvgpu/volt/volt_rail.h
new file mode 100644
index 00000000..9a3fcda0
--- /dev/null
+++ b/drivers/gpu/nvgpu/volt/volt_rail.h
@@ -0,0 +1,88 @@
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
23
24#ifndef _VOLT_RAIL_H_
25#define _VOLT_RAIL_H_
26
27#include "boardobj/boardobj.h"
28#include "boardobj/boardobjgrp.h"
29
30#define CTRL_VOLT_RAIL_VOLT_DELTA_MAX_ENTRIES 0x04
31#define CTRL_PMGR_PWR_EQUATION_INDEX_INVALID 0xFF
32
33#define VOLT_GET_VOLT_RAIL(pvolt, rail_idx) \
34 ((struct voltage_rail *)BOARDOBJGRP_OBJ_GET_BY_IDX( \
35 &((pvolt)->volt_rail_metadata.volt_rails.super), (rail_idx)))
36
37#define VOLT_RAIL_INDEX_IS_VALID(pvolt, rail_idx) \
38 (boardobjgrp_idxisvalid( \
39 &((pvolt)->volt_rail_metadata.volt_rails.super), (rail_idx)))
40
41#define VOLT_RAIL_VOLT_3X_SUPPORTED(pvolt) \
42 (!BOARDOBJGRP_IS_EMPTY(&((pvolt)->volt_rail_metadata.volt_rails.super)))
43
44/*!
45 * extends boardobj providing attributes common to all voltage_rails.
46 */
47struct voltage_rail {
48 struct boardobj super;
49 u32 boot_voltage_uv;
50 u8 rel_limit_vfe_equ_idx;
51 u8 alt_rel_limit_vfe_equ_idx;
52 u8 ov_limit_vfe_equ_idx;
53 u8 pwr_equ_idx;
54 u8 volt_dev_idx_default;
55 u8 boot_volt_vfe_equ_idx;
56 u8 vmin_limit_vfe_equ_idx;
57 u8 volt_margin_limit_vfe_equ_idx;
58 u32 volt_margin_limit_vfe_equ_mon_handle;
59 u32 rel_limit_vfe_equ_mon_handle;
60 u32 alt_rel_limit_vfe_equ_mon_handle;
61 u32 ov_limit_vfe_equ_mon_handle;
62 struct boardobjgrpmask_e32 volt_dev_mask;
63 s32 volt_delta_uv[CTRL_VOLT_RAIL_VOLT_DELTA_MAX_ENTRIES];
64};
65
66/*!
67 * metadata of voltage rail functionality.
68 */
69struct voltage_rail_metadata {
70 u8 volt_domain_hal;
71 u8 pct_delta;
72 u32 ext_rel_delta_uv[CTRL_VOLT_RAIL_VOLT_DELTA_MAX_ENTRIES];
73 u8 logic_rail_idx;
74 u8 sram_rail_idx;
75 struct boardobjgrp_e32 volt_rails;
76};
77
78u8 volt_rail_vbios_volt_domain_convert_to_internal
79 (struct gk20a *g, u8 vbios_volt_domain);
80
81u32 volt_rail_volt_dev_register(struct gk20a *g, struct voltage_rail
82 *pvolt_rail, u8 volt_dev_idx, u8 operation_type);
83
84u8 volt_rail_volt_domain_convert_to_idx(struct gk20a *g, u8 volt_domain);
85
86u32 volt_rail_sw_setup(struct gk20a *g);
87u32 volt_rail_pmu_setup(struct gk20a *g);
88#endif