diff options
Diffstat (limited to 'include/clk/clk_prog.h')
| -rw-r--r-- | include/clk/clk_prog.h | 100 |
1 files changed, 100 insertions, 0 deletions
diff --git a/include/clk/clk_prog.h b/include/clk/clk_prog.h new file mode 100644 index 0000000..af6368f --- /dev/null +++ b/include/clk/clk_prog.h | |||
| @@ -0,0 +1,100 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2016-2018, 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 NVGPU_CLK_PROG_H | ||
| 24 | #define NVGPU_CLK_PROG_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 | |||
| 32 | int clk_prog_sw_setup(struct gk20a *g); | ||
| 33 | int clk_prog_pmu_setup(struct gk20a *g); | ||
| 34 | struct clk_prog_1x_master; | ||
| 35 | |||
| 36 | typedef 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 | |||
| 40 | typedef 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 | |||
| 45 | typedef 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 | |||
| 50 | typedef 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 | |||
| 56 | struct clk_progs { | ||
| 57 | struct boardobjgrp_e255 super; | ||
| 58 | u8 slave_entry_count; | ||
| 59 | u8 vf_entry_count; | ||
| 60 | |||
| 61 | }; | ||
| 62 | |||
| 63 | struct clk_prog { | ||
| 64 | struct boardobj super; | ||
| 65 | }; | ||
| 66 | |||
| 67 | struct 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 | |||
| 74 | struct 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 | |||
| 86 | struct 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 | |||
| 91 | struct 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 /* NVGPU_CLK_PROG_H */ | ||
