1*b843c749SSergey Zigachev /* 2*b843c749SSergey Zigachev * Copyright 2016 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 #ifndef _DM_PP_INTERFACE_ 24*b843c749SSergey Zigachev #define _DM_PP_INTERFACE_ 25*b843c749SSergey Zigachev 26*b843c749SSergey Zigachev #include "dm_services_types.h" 27*b843c749SSergey Zigachev 28*b843c749SSergey Zigachev #define PP_MAX_CLOCK_LEVELS 16 29*b843c749SSergey Zigachev 30*b843c749SSergey Zigachev enum amd_pp_display_config_type{ 31*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_None = 0, 32*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_DP54 , 33*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_DP432 , 34*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_DP324 , 35*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_DP27, 36*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_DP243, 37*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_DP216, 38*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_DP162, 39*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_HDMI6G , 40*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_HDMI297 , 41*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_HDMI162, 42*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_LVDS, 43*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_DVI, 44*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_WIRELESS, 45*b843c749SSergey Zigachev AMD_PP_DisplayConfigType_VGA 46*b843c749SSergey Zigachev }; 47*b843c749SSergey Zigachev 48*b843c749SSergey Zigachev struct single_display_configuration 49*b843c749SSergey Zigachev { 50*b843c749SSergey Zigachev uint32_t controller_index; 51*b843c749SSergey Zigachev uint32_t controller_id; 52*b843c749SSergey Zigachev uint32_t signal_type; 53*b843c749SSergey Zigachev uint32_t display_state; 54*b843c749SSergey Zigachev /* phy id for the primary internal transmitter */ 55*b843c749SSergey Zigachev uint8_t primary_transmitter_phyi_d; 56*b843c749SSergey Zigachev /* bitmap with the active lanes */ 57*b843c749SSergey Zigachev uint8_t primary_transmitter_active_lanemap; 58*b843c749SSergey Zigachev /* phy id for the secondary internal transmitter (for dual-link dvi) */ 59*b843c749SSergey Zigachev uint8_t secondary_transmitter_phy_id; 60*b843c749SSergey Zigachev /* bitmap with the active lanes */ 61*b843c749SSergey Zigachev uint8_t secondary_transmitter_active_lanemap; 62*b843c749SSergey Zigachev /* misc phy settings for SMU. */ 63*b843c749SSergey Zigachev uint32_t config_flags; 64*b843c749SSergey Zigachev uint32_t display_type; 65*b843c749SSergey Zigachev uint32_t view_resolution_cx; 66*b843c749SSergey Zigachev uint32_t view_resolution_cy; 67*b843c749SSergey Zigachev enum amd_pp_display_config_type displayconfigtype; 68*b843c749SSergey Zigachev uint32_t vertical_refresh; /* for active display */ 69*b843c749SSergey Zigachev }; 70*b843c749SSergey Zigachev 71*b843c749SSergey Zigachev #define MAX_NUM_DISPLAY 32 72*b843c749SSergey Zigachev 73*b843c749SSergey Zigachev struct amd_pp_display_configuration { 74*b843c749SSergey Zigachev bool nb_pstate_switch_disable;/* controls NB PState switch */ 75*b843c749SSergey Zigachev bool cpu_cc6_disable; /* controls CPU CState switch ( on or off) */ 76*b843c749SSergey Zigachev bool cpu_pstate_disable; 77*b843c749SSergey Zigachev uint32_t cpu_pstate_separation_time; 78*b843c749SSergey Zigachev 79*b843c749SSergey Zigachev uint32_t num_display; /* total number of display*/ 80*b843c749SSergey Zigachev uint32_t num_path_including_non_display; 81*b843c749SSergey Zigachev uint32_t crossfire_display_index; 82*b843c749SSergey Zigachev uint32_t min_mem_set_clock; 83*b843c749SSergey Zigachev uint32_t min_core_set_clock; 84*b843c749SSergey Zigachev /* unit 10KHz x bit*/ 85*b843c749SSergey Zigachev uint32_t min_bus_bandwidth; 86*b843c749SSergey Zigachev /* minimum required stutter sclk, in 10khz uint32_t ulMinCoreSetClk;*/ 87*b843c749SSergey Zigachev uint32_t min_core_set_clock_in_sr; 88*b843c749SSergey Zigachev 89*b843c749SSergey Zigachev struct single_display_configuration displays[MAX_NUM_DISPLAY]; 90*b843c749SSergey Zigachev 91*b843c749SSergey Zigachev uint32_t vrefresh; /* for active display*/ 92*b843c749SSergey Zigachev 93*b843c749SSergey Zigachev uint32_t min_vblank_time; /* for active display*/ 94*b843c749SSergey Zigachev bool multi_monitor_in_sync; 95*b843c749SSergey Zigachev /* Controller Index of primary display - used in MCLK SMC switching hang 96*b843c749SSergey Zigachev * SW Workaround*/ 97*b843c749SSergey Zigachev uint32_t crtc_index; 98*b843c749SSergey Zigachev /* htotal*1000/pixelclk - used in MCLK SMC switching hang SW Workaround*/ 99*b843c749SSergey Zigachev uint32_t line_time_in_us; 100*b843c749SSergey Zigachev bool invalid_vblank_time; 101*b843c749SSergey Zigachev 102*b843c749SSergey Zigachev uint32_t display_clk; 103*b843c749SSergey Zigachev /* 104*b843c749SSergey Zigachev * for given display configuration if multimonitormnsync == false then 105*b843c749SSergey Zigachev * Memory clock DPMS with this latency or below is allowed, DPMS with 106*b843c749SSergey Zigachev * higher latency not allowed. 107*b843c749SSergey Zigachev */ 108*b843c749SSergey Zigachev uint32_t dce_tolerable_mclk_in_active_latency; 109*b843c749SSergey Zigachev uint32_t min_dcef_set_clk; 110*b843c749SSergey Zigachev uint32_t min_dcef_deep_sleep_set_clk; 111*b843c749SSergey Zigachev }; 112*b843c749SSergey Zigachev 113*b843c749SSergey Zigachev struct amd_pp_simple_clock_info { 114*b843c749SSergey Zigachev uint32_t engine_max_clock; 115*b843c749SSergey Zigachev uint32_t memory_max_clock; 116*b843c749SSergey Zigachev uint32_t level; 117*b843c749SSergey Zigachev }; 118*b843c749SSergey Zigachev 119*b843c749SSergey Zigachev enum PP_DAL_POWERLEVEL { 120*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_INVALID = 0, 121*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_ULTRALOW, 122*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_LOW, 123*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_NOMINAL, 124*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_PERFORMANCE, 125*b843c749SSergey Zigachev 126*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_0 = PP_DAL_POWERLEVEL_ULTRALOW, 127*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_1 = PP_DAL_POWERLEVEL_LOW, 128*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_2 = PP_DAL_POWERLEVEL_NOMINAL, 129*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_3 = PP_DAL_POWERLEVEL_PERFORMANCE, 130*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_4 = PP_DAL_POWERLEVEL_3+1, 131*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_5 = PP_DAL_POWERLEVEL_4+1, 132*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_6 = PP_DAL_POWERLEVEL_5+1, 133*b843c749SSergey Zigachev PP_DAL_POWERLEVEL_7 = PP_DAL_POWERLEVEL_6+1, 134*b843c749SSergey Zigachev }; 135*b843c749SSergey Zigachev 136*b843c749SSergey Zigachev struct amd_pp_clock_info { 137*b843c749SSergey Zigachev uint32_t min_engine_clock; 138*b843c749SSergey Zigachev uint32_t max_engine_clock; 139*b843c749SSergey Zigachev uint32_t min_memory_clock; 140*b843c749SSergey Zigachev uint32_t max_memory_clock; 141*b843c749SSergey Zigachev uint32_t min_bus_bandwidth; 142*b843c749SSergey Zigachev uint32_t max_bus_bandwidth; 143*b843c749SSergey Zigachev uint32_t max_engine_clock_in_sr; 144*b843c749SSergey Zigachev uint32_t min_engine_clock_in_sr; 145*b843c749SSergey Zigachev enum PP_DAL_POWERLEVEL max_clocks_state; 146*b843c749SSergey Zigachev }; 147*b843c749SSergey Zigachev 148*b843c749SSergey Zigachev enum amd_pp_clock_type { 149*b843c749SSergey Zigachev amd_pp_disp_clock = 1, 150*b843c749SSergey Zigachev amd_pp_sys_clock, 151*b843c749SSergey Zigachev amd_pp_mem_clock, 152*b843c749SSergey Zigachev amd_pp_dcef_clock, 153*b843c749SSergey Zigachev amd_pp_soc_clock, 154*b843c749SSergey Zigachev amd_pp_pixel_clock, 155*b843c749SSergey Zigachev amd_pp_phy_clock, 156*b843c749SSergey Zigachev amd_pp_dcf_clock, 157*b843c749SSergey Zigachev amd_pp_dpp_clock, 158*b843c749SSergey Zigachev amd_pp_f_clock = amd_pp_dcef_clock, 159*b843c749SSergey Zigachev }; 160*b843c749SSergey Zigachev 161*b843c749SSergey Zigachev #define MAX_NUM_CLOCKS 16 162*b843c749SSergey Zigachev 163*b843c749SSergey Zigachev struct amd_pp_clocks { 164*b843c749SSergey Zigachev uint32_t count; 165*b843c749SSergey Zigachev uint32_t clock[MAX_NUM_CLOCKS]; 166*b843c749SSergey Zigachev uint32_t latency[MAX_NUM_CLOCKS]; 167*b843c749SSergey Zigachev }; 168*b843c749SSergey Zigachev 169*b843c749SSergey Zigachev struct pp_clock_with_latency { 170*b843c749SSergey Zigachev uint32_t clocks_in_khz; 171*b843c749SSergey Zigachev uint32_t latency_in_us; 172*b843c749SSergey Zigachev }; 173*b843c749SSergey Zigachev 174*b843c749SSergey Zigachev struct pp_clock_levels_with_latency { 175*b843c749SSergey Zigachev uint32_t num_levels; 176*b843c749SSergey Zigachev struct pp_clock_with_latency data[PP_MAX_CLOCK_LEVELS]; 177*b843c749SSergey Zigachev }; 178*b843c749SSergey Zigachev 179*b843c749SSergey Zigachev struct pp_clock_with_voltage { 180*b843c749SSergey Zigachev uint32_t clocks_in_khz; 181*b843c749SSergey Zigachev uint32_t voltage_in_mv; 182*b843c749SSergey Zigachev }; 183*b843c749SSergey Zigachev 184*b843c749SSergey Zigachev struct pp_clock_levels_with_voltage { 185*b843c749SSergey Zigachev uint32_t num_levels; 186*b843c749SSergey Zigachev struct pp_clock_with_voltage data[PP_MAX_CLOCK_LEVELS]; 187*b843c749SSergey Zigachev }; 188*b843c749SSergey Zigachev 189*b843c749SSergey Zigachev struct pp_display_clock_request { 190*b843c749SSergey Zigachev enum amd_pp_clock_type clock_type; 191*b843c749SSergey Zigachev uint32_t clock_freq_in_khz; 192*b843c749SSergey Zigachev }; 193*b843c749SSergey Zigachev 194*b843c749SSergey Zigachev #endif /* _DM_PP_INTERFACE_ */ 195