drm/amd/powerplay: get eclk/vclk/dclk for smu11
authorLikun Gao <Likun.Gao@amd.com>
Mon, 28 Jan 2019 04:04:46 +0000 (12:04 +0800)
committerAlex Deucher <alexander.deucher@amd.com>
Tue, 19 Mar 2019 20:04:01 +0000 (15:04 -0500)
Get eclk, vclk and dclk info from vbios when hw init for smu11.

Signed-off-by: Likun Gao <Likun.Gao@amd.com>
Reviewed-by: Huang Rui <ray.huang@amd.com>
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
drivers/gpu/drm/amd/powerplay/inc/amdgpu_smu.h
drivers/gpu/drm/amd/powerplay/smu_v11_0.c

index 8464fdb3c337f18b274beb19cda92c0b2939dbb1..00ef6f1c9d30920664c0e174a229165b59ccc4ad 100644 (file)
@@ -282,6 +282,9 @@ struct smu_bios_boot_up_values
        uint32_t                        uclk;
        uint32_t                        socclk;
        uint32_t                        dcefclk;
+       uint32_t                        eclk;
+       uint32_t                        vclk;
+       uint32_t                        dclk;
        uint16_t                        vddc;
        uint16_t                        vddci;
        uint16_t                        mvddc;
index 8acfeed1f774cd0e86759b202a601ba3d85c30ce..21490867f40ff46ec6ff605e0fa86022d11ffcff 100644 (file)
@@ -462,6 +462,48 @@ static int smu_v11_0_get_clk_info_from_vbios(struct smu_context *smu)
        output = (struct atom_get_smu_clock_info_output_parameters_v3_1 *)&input;
        smu->smu_table.boot_values.dcefclk = le32_to_cpu(output->atom_smu_outputclkfreq.smu_clock_freq_hz) / 10000;
 
+       memset(&input, 0, sizeof(input));
+       input.clk_id = SMU11_SYSPLL0_ECLK_ID;
+       input.command = GET_SMU_CLOCK_INFO_V3_1_GET_CLOCK_FREQ;
+       index = get_index_into_master_table(atom_master_list_of_command_functions_v2_1,
+                                           getsmuclockinfo);
+
+       ret = amdgpu_atom_execute_table(adev->mode_info.atom_context, index,
+                                       (uint32_t *)&input);
+       if (ret)
+               return -EINVAL;
+
+       output = (struct atom_get_smu_clock_info_output_parameters_v3_1 *)&input;
+       smu->smu_table.boot_values.eclk = le32_to_cpu(output->atom_smu_outputclkfreq.smu_clock_freq_hz) / 10000;
+
+       memset(&input, 0, sizeof(input));
+       input.clk_id = SMU11_SYSPLL0_VCLK_ID;
+       input.command = GET_SMU_CLOCK_INFO_V3_1_GET_CLOCK_FREQ;
+       index = get_index_into_master_table(atom_master_list_of_command_functions_v2_1,
+                                           getsmuclockinfo);
+
+       ret = amdgpu_atom_execute_table(adev->mode_info.atom_context, index,
+                                       (uint32_t *)&input);
+       if (ret)
+               return -EINVAL;
+
+       output = (struct atom_get_smu_clock_info_output_parameters_v3_1 *)&input;
+       smu->smu_table.boot_values.vclk = le32_to_cpu(output->atom_smu_outputclkfreq.smu_clock_freq_hz) / 10000;
+
+       memset(&input, 0, sizeof(input));
+       input.clk_id = SMU11_SYSPLL0_DCLK_ID;
+       input.command = GET_SMU_CLOCK_INFO_V3_1_GET_CLOCK_FREQ;
+       index = get_index_into_master_table(atom_master_list_of_command_functions_v2_1,
+                                           getsmuclockinfo);
+
+       ret = amdgpu_atom_execute_table(adev->mode_info.atom_context, index,
+                                       (uint32_t *)&input);
+       if (ret)
+               return -EINVAL;
+
+       output = (struct atom_get_smu_clock_info_output_parameters_v3_1 *)&input;
+       smu->smu_table.boot_values.dclk = le32_to_cpu(output->atom_smu_outputclkfreq.smu_clock_freq_hz) / 10000;
+
        return 0;
 }