xref: /linux/drivers/gpu/drm/amd/include/dm_pp_interface.h (revision b7e1e969c887c897947fdc3754fe9b0c24acb155)
1a2dd023aSEric Huang /*
2a2dd023aSEric Huang  * Copyright 2016 Advanced Micro Devices, Inc.
3a2dd023aSEric Huang  *
4a2dd023aSEric Huang  * Permission is hereby granted, free of charge, to any person obtaining a
5a2dd023aSEric Huang  * copy of this software and associated documentation files (the "Software"),
6a2dd023aSEric Huang  * to deal in the Software without restriction, including without limitation
7a2dd023aSEric Huang  * the rights to use, copy, modify, merge, publish, distribute, sublicense,
8a2dd023aSEric Huang  * and/or sell copies of the Software, and to permit persons to whom the
9a2dd023aSEric Huang  * Software is furnished to do so, subject to the following conditions:
10a2dd023aSEric Huang  *
11a2dd023aSEric Huang  * The above copyright notice and this permission notice shall be included in
12a2dd023aSEric Huang  * all copies or substantial portions of the Software.
13a2dd023aSEric Huang  *
14a2dd023aSEric Huang  * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15a2dd023aSEric Huang  * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16a2dd023aSEric Huang  * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL
17a2dd023aSEric Huang  * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
18a2dd023aSEric Huang  * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
19a2dd023aSEric Huang  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
20a2dd023aSEric Huang  * OTHER DEALINGS IN THE SOFTWARE.
21a2dd023aSEric Huang  *
22a2dd023aSEric Huang  */
23a2dd023aSEric Huang #ifndef _DM_PP_INTERFACE_
24a2dd023aSEric Huang #define _DM_PP_INTERFACE_
25a2dd023aSEric Huang 
2620582319SRex Zhu #include "dm_services_types.h"
2720582319SRex Zhu 
282cac05deSEvan Quan #define PP_MAX_CLOCK_LEVELS 16
29a2dd023aSEric Huang 
302c2b67b4SRex Zhu enum amd_pp_display_config_type {
312c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_None = 0,
322c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_DP54 ,
332c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_DP432 ,
342c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_DP324 ,
352c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_DP27,
362c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_DP243,
372c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_DP216,
382c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_DP162,
392c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_HDMI6G,
402c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_HDMI297,
412c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_HDMI162,
422c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_LVDS,
432c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_DVI,
442c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_WIRELESS,
452c2b67b4SRex Zhu 	AMD_PP_DisplayConfigType_VGA
462c2b67b4SRex Zhu };
472c2b67b4SRex Zhu 
48*eadf484eSchenxuebing struct single_display_configuration {
492c2b67b4SRex Zhu 	uint32_t controller_index;
502c2b67b4SRex Zhu 	uint32_t controller_id;
512c2b67b4SRex Zhu 	uint32_t signal_type;
522c2b67b4SRex Zhu 	uint32_t display_state;
532c2b67b4SRex Zhu 	/* phy id for the primary internal transmitter */
542c2b67b4SRex Zhu 	uint8_t primary_transmitter_phyi_d;
552c2b67b4SRex Zhu 	/* bitmap with the active lanes */
562c2b67b4SRex Zhu 	uint8_t primary_transmitter_active_lanemap;
572c2b67b4SRex Zhu 	/* phy id for the secondary internal transmitter (for dual-link dvi) */
582c2b67b4SRex Zhu 	uint8_t secondary_transmitter_phy_id;
592c2b67b4SRex Zhu 	/* bitmap with the active lanes */
602c2b67b4SRex Zhu 	uint8_t secondary_transmitter_active_lanemap;
612c2b67b4SRex Zhu 	/* misc phy settings for SMU. */
622c2b67b4SRex Zhu 	uint32_t config_flags;
632c2b67b4SRex Zhu 	uint32_t display_type;
642c2b67b4SRex Zhu 	uint32_t view_resolution_cx;
652c2b67b4SRex Zhu 	uint32_t view_resolution_cy;
662c2b67b4SRex Zhu 	enum amd_pp_display_config_type displayconfigtype;
672c2b67b4SRex Zhu 	uint32_t vertical_refresh; /* for active display */
682c2b67b4SRex Zhu };
692c2b67b4SRex Zhu 
702c2b67b4SRex Zhu #define MAX_NUM_DISPLAY 32
712c2b67b4SRex Zhu 
722c2b67b4SRex Zhu struct amd_pp_display_configuration {
732c2b67b4SRex Zhu 	bool nb_pstate_switch_disable;/* controls NB PState switch */
742c2b67b4SRex Zhu 	bool cpu_cc6_disable; /* controls CPU CState switch ( on or off) */
752c2b67b4SRex Zhu 	bool cpu_pstate_disable;
762c2b67b4SRex Zhu 	uint32_t cpu_pstate_separation_time;
772c2b67b4SRex Zhu 
782c2b67b4SRex Zhu 	uint32_t num_display;  /* total number of display*/
792c2b67b4SRex Zhu 	uint32_t num_path_including_non_display;
802c2b67b4SRex Zhu 	uint32_t crossfire_display_index;
812c2b67b4SRex Zhu 	uint32_t min_mem_set_clock;
822c2b67b4SRex Zhu 	uint32_t min_core_set_clock;
832c2b67b4SRex Zhu 	/* unit 10KHz x bit*/
842c2b67b4SRex Zhu 	uint32_t min_bus_bandwidth;
852c2b67b4SRex Zhu 	/* minimum required stutter sclk, in 10khz uint32_t ulMinCoreSetClk;*/
862c2b67b4SRex Zhu 	uint32_t min_core_set_clock_in_sr;
872c2b67b4SRex Zhu 
882c2b67b4SRex Zhu 	struct single_display_configuration displays[MAX_NUM_DISPLAY];
892c2b67b4SRex Zhu 
902c2b67b4SRex Zhu 	uint32_t vrefresh; /* for active display*/
912c2b67b4SRex Zhu 
922c2b67b4SRex Zhu 	uint32_t min_vblank_time; /* for active display*/
932c2b67b4SRex Zhu 	bool multi_monitor_in_sync;
942c2b67b4SRex Zhu 	/* Controller Index of primary display - used in MCLK SMC switching hang
952c2b67b4SRex Zhu 	 * SW Workaround*/
962c2b67b4SRex Zhu 	uint32_t crtc_index;
972c2b67b4SRex Zhu 	/* htotal*1000/pixelclk - used in MCLK SMC switching hang SW Workaround*/
982c2b67b4SRex Zhu 	uint32_t line_time_in_us;
992c2b67b4SRex Zhu 	bool invalid_vblank_time;
1002c2b67b4SRex Zhu 
1012c2b67b4SRex Zhu 	uint32_t display_clk;
1022c2b67b4SRex Zhu 	/*
1032c2b67b4SRex Zhu 	 * for given display configuration if multimonitormnsync == false then
1042c2b67b4SRex Zhu 	 * Memory clock DPMS with this latency or below is allowed, DPMS with
1052c2b67b4SRex Zhu 	 * higher latency not allowed.
1062c2b67b4SRex Zhu 	 */
1072c2b67b4SRex Zhu 	uint32_t dce_tolerable_mclk_in_active_latency;
1082c2b67b4SRex Zhu 	uint32_t min_dcef_set_clk;
1092c2b67b4SRex Zhu 	uint32_t min_dcef_deep_sleep_set_clk;
1102c2b67b4SRex Zhu };
1112c2b67b4SRex Zhu 
1122c2b67b4SRex Zhu struct amd_pp_simple_clock_info {
1132c2b67b4SRex Zhu 	uint32_t	engine_max_clock;
1142c2b67b4SRex Zhu 	uint32_t	memory_max_clock;
1152c2b67b4SRex Zhu 	uint32_t	level;
1162c2b67b4SRex Zhu };
1172c2b67b4SRex Zhu 
1182c2b67b4SRex Zhu enum PP_DAL_POWERLEVEL {
1192c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_INVALID = 0,
1202c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_ULTRALOW,
1212c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_LOW,
1222c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_NOMINAL,
1232c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_PERFORMANCE,
1242c2b67b4SRex Zhu 
1252c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_0 = PP_DAL_POWERLEVEL_ULTRALOW,
1262c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_1 = PP_DAL_POWERLEVEL_LOW,
1272c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_2 = PP_DAL_POWERLEVEL_NOMINAL,
1282c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_3 = PP_DAL_POWERLEVEL_PERFORMANCE,
1292c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_4 = PP_DAL_POWERLEVEL_3+1,
1302c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_5 = PP_DAL_POWERLEVEL_4+1,
1312c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_6 = PP_DAL_POWERLEVEL_5+1,
1322c2b67b4SRex Zhu 	PP_DAL_POWERLEVEL_7 = PP_DAL_POWERLEVEL_6+1,
1332c2b67b4SRex Zhu };
1342c2b67b4SRex Zhu 
1352c2b67b4SRex Zhu struct amd_pp_clock_info {
1362c2b67b4SRex Zhu 	uint32_t min_engine_clock;
1372c2b67b4SRex Zhu 	uint32_t max_engine_clock;
1382c2b67b4SRex Zhu 	uint32_t min_memory_clock;
1392c2b67b4SRex Zhu 	uint32_t max_memory_clock;
1402c2b67b4SRex Zhu 	uint32_t min_bus_bandwidth;
1412c2b67b4SRex Zhu 	uint32_t max_bus_bandwidth;
1422c2b67b4SRex Zhu 	uint32_t max_engine_clock_in_sr;
1432c2b67b4SRex Zhu 	uint32_t min_engine_clock_in_sr;
1442c2b67b4SRex Zhu 	enum PP_DAL_POWERLEVEL max_clocks_state;
1452c2b67b4SRex Zhu };
1462c2b67b4SRex Zhu 
1472c2b67b4SRex Zhu enum amd_pp_clock_type {
1482c2b67b4SRex Zhu 	amd_pp_disp_clock = 1,
1492c2b67b4SRex Zhu 	amd_pp_sys_clock,
1502c2b67b4SRex Zhu 	amd_pp_mem_clock,
1512c2b67b4SRex Zhu 	amd_pp_dcef_clock,
1522c2b67b4SRex Zhu 	amd_pp_soc_clock,
1532c2b67b4SRex Zhu 	amd_pp_pixel_clock,
1542c2b67b4SRex Zhu 	amd_pp_phy_clock,
1552c2b67b4SRex Zhu 	amd_pp_dcf_clock,
1562c2b67b4SRex Zhu 	amd_pp_dpp_clock,
1572c2b67b4SRex Zhu 	amd_pp_f_clock = amd_pp_dcef_clock,
1582c2b67b4SRex Zhu };
1592c2b67b4SRex Zhu 
1602c2b67b4SRex Zhu #define MAX_NUM_CLOCKS 16
1612c2b67b4SRex Zhu 
1622c2b67b4SRex Zhu struct amd_pp_clocks {
1632c2b67b4SRex Zhu 	uint32_t count;
1642c2b67b4SRex Zhu 	uint32_t clock[MAX_NUM_CLOCKS];
1652c2b67b4SRex Zhu 	uint32_t latency[MAX_NUM_CLOCKS];
1662c2b67b4SRex Zhu };
1672c2b67b4SRex Zhu 
168a2dd023aSEric Huang struct pp_clock_with_latency {
169a2dd023aSEric Huang 	uint32_t clocks_in_khz;
170a2dd023aSEric Huang 	uint32_t latency_in_us;
171a2dd023aSEric Huang };
172a2dd023aSEric Huang 
173a2dd023aSEric Huang struct pp_clock_levels_with_latency {
174a2dd023aSEric Huang 	uint32_t num_levels;
175a2dd023aSEric Huang 	struct pp_clock_with_latency data[PP_MAX_CLOCK_LEVELS];
176a2dd023aSEric Huang };
177a2dd023aSEric Huang 
178a2dd023aSEric Huang struct pp_clock_with_voltage {
179a2dd023aSEric Huang 	uint32_t clocks_in_khz;
180a2dd023aSEric Huang 	uint32_t voltage_in_mv;
181a2dd023aSEric Huang };
182a2dd023aSEric Huang 
183a2dd023aSEric Huang struct pp_clock_levels_with_voltage {
184a2dd023aSEric Huang 	uint32_t num_levels;
185a2dd023aSEric Huang 	struct pp_clock_with_voltage data[PP_MAX_CLOCK_LEVELS];
186a2dd023aSEric Huang };
187a2dd023aSEric Huang 
1882c2b67b4SRex Zhu struct pp_display_clock_request {
1892c2b67b4SRex Zhu 	enum amd_pp_clock_type clock_type;
1902c2b67b4SRex Zhu 	uint32_t clock_freq_in_khz;
1912c2b67b4SRex Zhu };
1922c2b67b4SRex Zhu 
193a2dd023aSEric Huang #endif /* _DM_PP_INTERFACE_ */
194