summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/nvgpu/clk/clk_prog.h
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/nvgpu/clk/clk_prog.h')
-rw-r--r--drivers/gpu/nvgpu/clk/clk_prog.h100
1 files changed, 100 insertions, 0 deletions
diff --git a/drivers/gpu/nvgpu/clk/clk_prog.h b/drivers/gpu/nvgpu/clk/clk_prog.h
new file mode 100644
index 00000000..64cb1b51
--- /dev/null
+++ b/drivers/gpu/nvgpu/clk/clk_prog.h
@@ -0,0 +1,100 @@
1/*
2* Copyright (c) 2016-2017, 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#ifndef _CLKPROG_H_
24#define _CLKPROG_H_
25#include "ctrl/ctrlclk.h"
26#include "ctrl/ctrlboardobj.h"
27#include <nvgpu/pmuif/nvgpu_gpmu_cmdif.h>
28#include "boardobj/boardobjgrp_e32.h"
29#include "boardobj/boardobjgrp_e255.h"
30#include "boardobj/boardobjgrpmask.h"
31
32u32 clk_prog_sw_setup(struct gk20a *g);
33u32 clk_prog_pmu_setup(struct gk20a *g);
34struct clk_prog_1x_master;
35
36typedef u32 vf_flatten(struct gk20a *g, struct clk_pmupstate *pclk,
37 struct clk_prog_1x_master *p1xmaster,
38 u8 clk_domain_idx, u16 *pfreqmaxlastmhz);
39
40typedef u32 vf_lookup(struct gk20a *g, struct clk_pmupstate *pclk,
41 struct clk_prog_1x_master *p1xmaster,
42 u8 *slave_clk_domain_idx, u16 *pclkmhz,
43 u32 *pvoltuv, u8 rail);
44
45typedef int get_slaveclk(struct gk20a *g, struct clk_pmupstate *pclk,
46 struct clk_prog_1x_master *p1xmaster,
47 u8 slave_clk_domain_idx, u16 *pclkmhz,
48 u16 masterclkmhz);
49
50typedef u32 get_fpoints(struct gk20a *g, struct clk_pmupstate *pclk,
51 struct clk_prog_1x_master *p1xmaster,
52 u32 *pfpointscount,
53 u16 **ppfreqpointsinmhz, u8 rail);
54
55
56struct clk_progs {
57 struct boardobjgrp_e255 super;
58 u8 slave_entry_count;
59 u8 vf_entry_count;
60
61};
62
63struct clk_prog {
64 struct boardobj super;
65};
66
67struct clk_prog_1x {
68 struct clk_prog super;
69 u8 source;
70 u16 freq_max_mhz;
71 union ctrl_clk_clk_prog_1x_source_data source_data;
72};
73
74struct clk_prog_1x_master {
75 struct clk_prog_1x super;
76 bool b_o_c_o_v_enabled;
77 struct ctrl_clk_clk_prog_1x_master_vf_entry *p_vf_entries;
78 struct ctrl_clk_clk_delta deltas;
79 union ctrl_clk_clk_prog_1x_master_source_data source_data;
80 vf_flatten *vfflatten;
81 vf_lookup *vflookup;
82 get_fpoints *getfpoints;
83 get_slaveclk *getslaveclk;
84};
85
86struct clk_prog_1x_master_ratio {
87 struct clk_prog_1x_master super;
88 struct ctrl_clk_clk_prog_1x_master_ratio_slave_entry *p_slave_entries;
89};
90
91struct clk_prog_1x_master_table {
92 struct clk_prog_1x_master super;
93 struct ctrl_clk_clk_prog_1x_master_table_slave_entry *p_slave_entries;
94};
95
96#define CLK_CLK_PROG_GET(pclk, idx) \
97 ((struct clk_prog *)BOARDOBJGRP_OBJ_GET_BY_IDX( \
98 &pclk->clk_progobjs.super.super, (u8)(idx)))
99
100#endif