drm/amd/display: Add functionality to get XGMI SS info
authorLeo Li <sunpeng.li@amd.com>
Wed, 31 Oct 2018 21:07:41 +0000 (17:07 -0400)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 18 Dec 2018 22:39:56 +0000 (17:39 -0500)
[Why]
When XGMI is enabled, the DP reference clock needs to be adjusted
according to the XGMI spread spectrum percentage and mode. But first,
we need the ability to fetch this info.

[How]
Within the BIOS parser, Read from vBIOS when XGMI SS info is requested.

In addition, diags build uses include_legacy/atomfirmware.h for the
smu_info_v3_3 table headers. Update that as well.

Signed-off-by: Leo Li <sunpeng.li@amd.com>
Reviewed-by: Nicholas Kazlauskas <Nicholas.Kazlauskas@amd.com>
Acked-by: Tony Cheng <Tony.Cheng@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/display/dc/bios/bios_parser2.c
drivers/gpu/drm/amd/display/include/bios_parser_types.h

index 751bb614fc0eae6b8b26647bc4f31b0893562431..c513ab6f38435b9281ec0f1799b044d3ed541115 100644 (file)
@@ -638,6 +638,7 @@ static enum bp_result get_ss_info_v4_1(
 {
        enum bp_result result = BP_RESULT_OK;
        struct atom_display_controller_info_v4_1 *disp_cntl_tbl = NULL;
+       struct atom_smu_info_v3_3 *smu_info = NULL;
 
        if (!ss_info)
                return BP_RESULT_BADINPUT;
@@ -650,6 +651,7 @@ static enum bp_result get_ss_info_v4_1(
        if (!disp_cntl_tbl)
                return BP_RESULT_BADBIOSTABLE;
 
+
        ss_info->type.STEP_AND_DELAY_INFO = false;
        ss_info->spread_percentage_divider = 1000;
        /* BIOS no longer uses target clock.  Always enable for now */
@@ -688,6 +690,19 @@ static enum bp_result get_ss_info_v4_1(
                 */
                result = BP_RESULT_UNSUPPORTED;
                break;
+       case AS_SIGNAL_TYPE_XGMI:
+               smu_info =  GET_IMAGE(struct atom_smu_info_v3_3,
+                                     DATA_TABLES(smu_info));
+               if (!smu_info)
+                       return BP_RESULT_BADBIOSTABLE;
+
+               ss_info->spread_spectrum_percentage =
+                               smu_info->waflclk_ss_percentage;
+               ss_info->spread_spectrum_range =
+                               smu_info->gpuclk_ss_rate_10hz * 10;
+               if (smu_info->waflclk_ss_mode & ATOM_SS_CENTRE_SPREAD_MODE)
+                       ss_info->type.CENTER_MODE = true;
+               break;
        default:
                result = BP_RESULT_UNSUPPORTED;
        }
index f8dbfa5b89f2f67f2c2bd07435e9e9c5939384e8..7fd78a696800b50982c8744df5a47bc98240a022 100644 (file)
@@ -41,6 +41,7 @@ enum as_signal_type {
        AS_SIGNAL_TYPE_LVDS,
        AS_SIGNAL_TYPE_DISPLAY_PORT,
        AS_SIGNAL_TYPE_GPU_PLL,
+       AS_SIGNAL_TYPE_XGMI,
        AS_SIGNAL_TYPE_UNKNOWN
 };