1*fb4d8502Sjsg /* 2*fb4d8502Sjsg * Copyright 2016 Advanced Micro Devices, Inc. 3*fb4d8502Sjsg * 4*fb4d8502Sjsg * Permission is hereby granted, free of charge, to any person obtaining a 5*fb4d8502Sjsg * copy of this software and associated documentation files (the "Software"), 6*fb4d8502Sjsg * to deal in the Software without restriction, including without limitation 7*fb4d8502Sjsg * the rights to use, copy, modify, merge, publish, distribute, sublicense, 8*fb4d8502Sjsg * and/or sell copies of the Software, and to permit persons to whom the 9*fb4d8502Sjsg * Software is furnished to do so, subject to the following conditions: 10*fb4d8502Sjsg * 11*fb4d8502Sjsg * The above copyright notice and this permission notice shall be included in 12*fb4d8502Sjsg * all copies or substantial portions of the Software. 13*fb4d8502Sjsg * 14*fb4d8502Sjsg * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 15*fb4d8502Sjsg * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, 16*fb4d8502Sjsg * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL 17*fb4d8502Sjsg * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR 18*fb4d8502Sjsg * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, 19*fb4d8502Sjsg * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR 20*fb4d8502Sjsg * OTHER DEALINGS IN THE SOFTWARE. 21*fb4d8502Sjsg * 22*fb4d8502Sjsg */ 23*fb4d8502Sjsg #ifndef _DM_PP_INTERFACE_ 24*fb4d8502Sjsg #define _DM_PP_INTERFACE_ 25*fb4d8502Sjsg 26*fb4d8502Sjsg #include "dm_services_types.h" 27*fb4d8502Sjsg 28*fb4d8502Sjsg #define PP_MAX_CLOCK_LEVELS 16 29*fb4d8502Sjsg 30*fb4d8502Sjsg enum amd_pp_display_config_type{ 31*fb4d8502Sjsg AMD_PP_DisplayConfigType_None = 0, 32*fb4d8502Sjsg AMD_PP_DisplayConfigType_DP54 , 33*fb4d8502Sjsg AMD_PP_DisplayConfigType_DP432 , 34*fb4d8502Sjsg AMD_PP_DisplayConfigType_DP324 , 35*fb4d8502Sjsg AMD_PP_DisplayConfigType_DP27, 36*fb4d8502Sjsg AMD_PP_DisplayConfigType_DP243, 37*fb4d8502Sjsg AMD_PP_DisplayConfigType_DP216, 38*fb4d8502Sjsg AMD_PP_DisplayConfigType_DP162, 39*fb4d8502Sjsg AMD_PP_DisplayConfigType_HDMI6G , 40*fb4d8502Sjsg AMD_PP_DisplayConfigType_HDMI297 , 41*fb4d8502Sjsg AMD_PP_DisplayConfigType_HDMI162, 42*fb4d8502Sjsg AMD_PP_DisplayConfigType_LVDS, 43*fb4d8502Sjsg AMD_PP_DisplayConfigType_DVI, 44*fb4d8502Sjsg AMD_PP_DisplayConfigType_WIRELESS, 45*fb4d8502Sjsg AMD_PP_DisplayConfigType_VGA 46*fb4d8502Sjsg }; 47*fb4d8502Sjsg 48*fb4d8502Sjsg struct single_display_configuration 49*fb4d8502Sjsg { 50*fb4d8502Sjsg uint32_t controller_index; 51*fb4d8502Sjsg uint32_t controller_id; 52*fb4d8502Sjsg uint32_t signal_type; 53*fb4d8502Sjsg uint32_t display_state; 54*fb4d8502Sjsg /* phy id for the primary internal transmitter */ 55*fb4d8502Sjsg uint8_t primary_transmitter_phyi_d; 56*fb4d8502Sjsg /* bitmap with the active lanes */ 57*fb4d8502Sjsg uint8_t primary_transmitter_active_lanemap; 58*fb4d8502Sjsg /* phy id for the secondary internal transmitter (for dual-link dvi) */ 59*fb4d8502Sjsg uint8_t secondary_transmitter_phy_id; 60*fb4d8502Sjsg /* bitmap with the active lanes */ 61*fb4d8502Sjsg uint8_t secondary_transmitter_active_lanemap; 62*fb4d8502Sjsg /* misc phy settings for SMU. */ 63*fb4d8502Sjsg uint32_t config_flags; 64*fb4d8502Sjsg uint32_t display_type; 65*fb4d8502Sjsg uint32_t view_resolution_cx; 66*fb4d8502Sjsg uint32_t view_resolution_cy; 67*fb4d8502Sjsg enum amd_pp_display_config_type displayconfigtype; 68*fb4d8502Sjsg uint32_t vertical_refresh; /* for active display */ 69*fb4d8502Sjsg }; 70*fb4d8502Sjsg 71*fb4d8502Sjsg #define MAX_NUM_DISPLAY 32 72*fb4d8502Sjsg 73*fb4d8502Sjsg struct amd_pp_display_configuration { 74*fb4d8502Sjsg bool nb_pstate_switch_disable;/* controls NB PState switch */ 75*fb4d8502Sjsg bool cpu_cc6_disable; /* controls CPU CState switch ( on or off) */ 76*fb4d8502Sjsg bool cpu_pstate_disable; 77*fb4d8502Sjsg uint32_t cpu_pstate_separation_time; 78*fb4d8502Sjsg 79*fb4d8502Sjsg uint32_t num_display; /* total number of display*/ 80*fb4d8502Sjsg uint32_t num_path_including_non_display; 81*fb4d8502Sjsg uint32_t crossfire_display_index; 82*fb4d8502Sjsg uint32_t min_mem_set_clock; 83*fb4d8502Sjsg uint32_t min_core_set_clock; 84*fb4d8502Sjsg /* unit 10KHz x bit*/ 85*fb4d8502Sjsg uint32_t min_bus_bandwidth; 86*fb4d8502Sjsg /* minimum required stutter sclk, in 10khz uint32_t ulMinCoreSetClk;*/ 87*fb4d8502Sjsg uint32_t min_core_set_clock_in_sr; 88*fb4d8502Sjsg 89*fb4d8502Sjsg struct single_display_configuration displays[MAX_NUM_DISPLAY]; 90*fb4d8502Sjsg 91*fb4d8502Sjsg uint32_t vrefresh; /* for active display*/ 92*fb4d8502Sjsg 93*fb4d8502Sjsg uint32_t min_vblank_time; /* for active display*/ 94*fb4d8502Sjsg bool multi_monitor_in_sync; 95*fb4d8502Sjsg /* Controller Index of primary display - used in MCLK SMC switching hang 96*fb4d8502Sjsg * SW Workaround*/ 97*fb4d8502Sjsg uint32_t crtc_index; 98*fb4d8502Sjsg /* htotal*1000/pixelclk - used in MCLK SMC switching hang SW Workaround*/ 99*fb4d8502Sjsg uint32_t line_time_in_us; 100*fb4d8502Sjsg bool invalid_vblank_time; 101*fb4d8502Sjsg 102*fb4d8502Sjsg uint32_t display_clk; 103*fb4d8502Sjsg /* 104*fb4d8502Sjsg * for given display configuration if multimonitormnsync == false then 105*fb4d8502Sjsg * Memory clock DPMS with this latency or below is allowed, DPMS with 106*fb4d8502Sjsg * higher latency not allowed. 107*fb4d8502Sjsg */ 108*fb4d8502Sjsg uint32_t dce_tolerable_mclk_in_active_latency; 109*fb4d8502Sjsg uint32_t min_dcef_set_clk; 110*fb4d8502Sjsg uint32_t min_dcef_deep_sleep_set_clk; 111*fb4d8502Sjsg }; 112*fb4d8502Sjsg 113*fb4d8502Sjsg struct amd_pp_simple_clock_info { 114*fb4d8502Sjsg uint32_t engine_max_clock; 115*fb4d8502Sjsg uint32_t memory_max_clock; 116*fb4d8502Sjsg uint32_t level; 117*fb4d8502Sjsg }; 118*fb4d8502Sjsg 119*fb4d8502Sjsg enum PP_DAL_POWERLEVEL { 120*fb4d8502Sjsg PP_DAL_POWERLEVEL_INVALID = 0, 121*fb4d8502Sjsg PP_DAL_POWERLEVEL_ULTRALOW, 122*fb4d8502Sjsg PP_DAL_POWERLEVEL_LOW, 123*fb4d8502Sjsg PP_DAL_POWERLEVEL_NOMINAL, 124*fb4d8502Sjsg PP_DAL_POWERLEVEL_PERFORMANCE, 125*fb4d8502Sjsg 126*fb4d8502Sjsg PP_DAL_POWERLEVEL_0 = PP_DAL_POWERLEVEL_ULTRALOW, 127*fb4d8502Sjsg PP_DAL_POWERLEVEL_1 = PP_DAL_POWERLEVEL_LOW, 128*fb4d8502Sjsg PP_DAL_POWERLEVEL_2 = PP_DAL_POWERLEVEL_NOMINAL, 129*fb4d8502Sjsg PP_DAL_POWERLEVEL_3 = PP_DAL_POWERLEVEL_PERFORMANCE, 130*fb4d8502Sjsg PP_DAL_POWERLEVEL_4 = PP_DAL_POWERLEVEL_3+1, 131*fb4d8502Sjsg PP_DAL_POWERLEVEL_5 = PP_DAL_POWERLEVEL_4+1, 132*fb4d8502Sjsg PP_DAL_POWERLEVEL_6 = PP_DAL_POWERLEVEL_5+1, 133*fb4d8502Sjsg PP_DAL_POWERLEVEL_7 = PP_DAL_POWERLEVEL_6+1, 134*fb4d8502Sjsg }; 135*fb4d8502Sjsg 136*fb4d8502Sjsg struct amd_pp_clock_info { 137*fb4d8502Sjsg uint32_t min_engine_clock; 138*fb4d8502Sjsg uint32_t max_engine_clock; 139*fb4d8502Sjsg uint32_t min_memory_clock; 140*fb4d8502Sjsg uint32_t max_memory_clock; 141*fb4d8502Sjsg uint32_t min_bus_bandwidth; 142*fb4d8502Sjsg uint32_t max_bus_bandwidth; 143*fb4d8502Sjsg uint32_t max_engine_clock_in_sr; 144*fb4d8502Sjsg uint32_t min_engine_clock_in_sr; 145*fb4d8502Sjsg enum PP_DAL_POWERLEVEL max_clocks_state; 146*fb4d8502Sjsg }; 147*fb4d8502Sjsg 148*fb4d8502Sjsg enum amd_pp_clock_type { 149*fb4d8502Sjsg amd_pp_disp_clock = 1, 150*fb4d8502Sjsg amd_pp_sys_clock, 151*fb4d8502Sjsg amd_pp_mem_clock, 152*fb4d8502Sjsg amd_pp_dcef_clock, 153*fb4d8502Sjsg amd_pp_soc_clock, 154*fb4d8502Sjsg amd_pp_pixel_clock, 155*fb4d8502Sjsg amd_pp_phy_clock, 156*fb4d8502Sjsg amd_pp_dcf_clock, 157*fb4d8502Sjsg amd_pp_dpp_clock, 158*fb4d8502Sjsg amd_pp_f_clock = amd_pp_dcef_clock, 159*fb4d8502Sjsg }; 160*fb4d8502Sjsg 161*fb4d8502Sjsg #define MAX_NUM_CLOCKS 16 162*fb4d8502Sjsg 163*fb4d8502Sjsg struct amd_pp_clocks { 164*fb4d8502Sjsg uint32_t count; 165*fb4d8502Sjsg uint32_t clock[MAX_NUM_CLOCKS]; 166*fb4d8502Sjsg uint32_t latency[MAX_NUM_CLOCKS]; 167*fb4d8502Sjsg }; 168*fb4d8502Sjsg 169*fb4d8502Sjsg struct pp_clock_with_latency { 170*fb4d8502Sjsg uint32_t clocks_in_khz; 171*fb4d8502Sjsg uint32_t latency_in_us; 172*fb4d8502Sjsg }; 173*fb4d8502Sjsg 174*fb4d8502Sjsg struct pp_clock_levels_with_latency { 175*fb4d8502Sjsg uint32_t num_levels; 176*fb4d8502Sjsg struct pp_clock_with_latency data[PP_MAX_CLOCK_LEVELS]; 177*fb4d8502Sjsg }; 178*fb4d8502Sjsg 179*fb4d8502Sjsg struct pp_clock_with_voltage { 180*fb4d8502Sjsg uint32_t clocks_in_khz; 181*fb4d8502Sjsg uint32_t voltage_in_mv; 182*fb4d8502Sjsg }; 183*fb4d8502Sjsg 184*fb4d8502Sjsg struct pp_clock_levels_with_voltage { 185*fb4d8502Sjsg uint32_t num_levels; 186*fb4d8502Sjsg struct pp_clock_with_voltage data[PP_MAX_CLOCK_LEVELS]; 187*fb4d8502Sjsg }; 188*fb4d8502Sjsg 189*fb4d8502Sjsg struct pp_display_clock_request { 190*fb4d8502Sjsg enum amd_pp_clock_type clock_type; 191*fb4d8502Sjsg uint32_t clock_freq_in_khz; 192*fb4d8502Sjsg }; 193*fb4d8502Sjsg 194*fb4d8502Sjsg #endif /* _DM_PP_INTERFACE_ */ 195