1*b843c749SSergey Zigachev /*
2*b843c749SSergey Zigachev  * Copyright 2015 Advanced Micro Devices, Inc.
3*b843c749SSergey Zigachev  *
4*b843c749SSergey Zigachev  * Permission is hereby granted, free of charge, to any person obtaining a
5*b843c749SSergey Zigachev  * copy of this software and associated documentation files (the "Software"),
6*b843c749SSergey Zigachev  * to deal in the Software without restriction, including without limitation
7*b843c749SSergey Zigachev  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8*b843c749SSergey Zigachev  * and/or sell copies of the Software, and to permit persons to whom the
9*b843c749SSergey Zigachev  * Software is furnished to do so, subject to the following conditions:
10*b843c749SSergey Zigachev  *
11*b843c749SSergey Zigachev  * The above copyright notice and this permission notice shall be included in
12*b843c749SSergey Zigachev  * all copies or substantial portions of the Software.
13*b843c749SSergey Zigachev  *
14*b843c749SSergey Zigachev  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15*b843c749SSergey Zigachev  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16*b843c749SSergey Zigachev  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17*b843c749SSergey Zigachev  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18*b843c749SSergey Zigachev  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19*b843c749SSergey Zigachev  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20*b843c749SSergey Zigachev  * OTHER DEALINGS IN THE SOFTWARE.
21*b843c749SSergey Zigachev  *
22*b843c749SSergey Zigachev  */
23*b843c749SSergey Zigachev 
24*b843c749SSergey Zigachev #ifndef _TONGA_SMUMGR_H_
25*b843c749SSergey Zigachev #define _TONGA_SMUMGR_H_
26*b843c749SSergey Zigachev 
27*b843c749SSergey Zigachev #include "smu72_discrete.h"
28*b843c749SSergey Zigachev #include "smu7_smumgr.h"
29*b843c749SSergey Zigachev #include "smu72.h"
30*b843c749SSergey Zigachev 
31*b843c749SSergey Zigachev 
32*b843c749SSergey Zigachev #define ASICID_IS_TONGA_P(wDID, bRID)	 \
33*b843c749SSergey Zigachev 	(((wDID == 0x6930) && ((bRID == 0xF0) || (bRID == 0xF1) || (bRID == 0xFF))) \
34*b843c749SSergey Zigachev 	|| ((wDID == 0x6920) && ((bRID == 0) || (bRID == 1))))
35*b843c749SSergey Zigachev 
36*b843c749SSergey Zigachev struct tonga_pt_defaults {
37*b843c749SSergey Zigachev 	uint8_t   svi_load_line_en;
38*b843c749SSergey Zigachev 	uint8_t   svi_load_line_vddC;
39*b843c749SSergey Zigachev 	uint8_t   tdc_vddc_throttle_release_limit_perc;
40*b843c749SSergey Zigachev 	uint8_t   tdc_mawt;
41*b843c749SSergey Zigachev 	uint8_t   tdc_waterfall_ctl;
42*b843c749SSergey Zigachev 	uint8_t   dte_ambient_temp_base;
43*b843c749SSergey Zigachev 	uint32_t  display_cac;
44*b843c749SSergey Zigachev 	uint32_t  bapm_temp_gradient;
45*b843c749SSergey Zigachev 	uint16_t  bapmti_r[SMU72_DTE_ITERATIONS * SMU72_DTE_SOURCES * SMU72_DTE_SINKS];
46*b843c749SSergey Zigachev 	uint16_t  bapmti_rc[SMU72_DTE_ITERATIONS * SMU72_DTE_SOURCES * SMU72_DTE_SINKS];
47*b843c749SSergey Zigachev };
48*b843c749SSergey Zigachev 
49*b843c749SSergey Zigachev struct tonga_mc_reg_entry {
50*b843c749SSergey Zigachev 	uint32_t mclk_max;
51*b843c749SSergey Zigachev 	uint32_t mc_data[SMU72_DISCRETE_MC_REGISTER_ARRAY_SIZE];
52*b843c749SSergey Zigachev };
53*b843c749SSergey Zigachev 
54*b843c749SSergey Zigachev struct tonga_mc_reg_table {
55*b843c749SSergey Zigachev 	uint8_t   last;               /* number of registers*/
56*b843c749SSergey Zigachev 	uint8_t   num_entries;        /* number of entries in mc_reg_table_entry used*/
57*b843c749SSergey Zigachev 	uint16_t  validflag;          /* indicate the corresponding register is valid or not. 1: valid, 0: invalid. bit0->address[0], bit1->address[1], etc.*/
58*b843c749SSergey Zigachev 	struct tonga_mc_reg_entry    mc_reg_table_entry[MAX_AC_TIMING_ENTRIES];
59*b843c749SSergey Zigachev 	SMU72_Discrete_MCRegisterAddress mc_reg_address[SMU72_DISCRETE_MC_REGISTER_ARRAY_SIZE];
60*b843c749SSergey Zigachev };
61*b843c749SSergey Zigachev 
62*b843c749SSergey Zigachev 
63*b843c749SSergey Zigachev struct tonga_smumgr {
64*b843c749SSergey Zigachev 
65*b843c749SSergey Zigachev 	struct smu7_smumgr                   smu7_data;
66*b843c749SSergey Zigachev 	struct SMU72_Discrete_DpmTable       smc_state_table;
67*b843c749SSergey Zigachev 	struct SMU72_Discrete_Ulv            ulv_setting;
68*b843c749SSergey Zigachev 	struct SMU72_Discrete_PmFuses  power_tune_table;
69*b843c749SSergey Zigachev 	const struct tonga_pt_defaults  *power_tune_defaults;
70*b843c749SSergey Zigachev 	SMU72_Discrete_MCRegisters      mc_regs;
71*b843c749SSergey Zigachev 	struct tonga_mc_reg_table mc_reg_table;
72*b843c749SSergey Zigachev };
73*b843c749SSergey Zigachev 
74*b843c749SSergey Zigachev #endif
75