Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/amdgpu: update query ref clk from bios

Handle atom_gfx_info_v3_0 structure.

Signed-off-by: Hawking Zhang <Hawking.Zhang@amd.com>
Reviewed-by: Likun Gao <Likun.Gao@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Hawking Zhang and committed by
Alex Deucher
a8d59943 f5fb30b6

+20 -10
+20 -10
drivers/gpu/drm/amd/amdgpu/amdgpu_atomfirmware.c
··· 558 558 struct atom_smu_info_v3_1 v31; 559 559 }; 560 560 561 + union gfx_info { 562 + struct atom_gfx_info_v2_2 v22; 563 + struct atom_gfx_info_v2_4 v24; 564 + struct atom_gfx_info_v2_7 v27; 565 + struct atom_gfx_info_v3_0 v30; 566 + }; 567 + 561 568 int amdgpu_atomfirmware_get_clock_info(struct amdgpu_device *adev) 562 569 { 563 570 struct amdgpu_mode_info *mode_info = &adev->mode_info; ··· 646 639 gfx_info); 647 640 if (amdgpu_atom_parse_data_header(mode_info->atom_context, index, NULL, 648 641 &frev, &crev, &data_offset)) { 649 - struct atom_gfx_info_v2_2 *gfx_info = (struct atom_gfx_info_v2_2*) 642 + union gfx_info *gfx_info = (union gfx_info *) 650 643 (mode_info->atom_context->bios + data_offset); 651 - if ((frev == 2) && (crev >= 2)) 652 - spll->reference_freq = le32_to_cpu(gfx_info->rlc_gpu_timer_refclk); 653 - ret = 0; 644 + if ((frev == 3) || 645 + (frev == 2 && crev == 6)) { 646 + spll->reference_freq = le32_to_cpu(gfx_info->v30.golden_tsc_count_lower_refclk); 647 + ret = 0; 648 + } else if ((frev == 2) && 649 + (crev >= 2) && 650 + (crev != 6)) { 651 + spll->reference_freq = le32_to_cpu(gfx_info->v22.rlc_gpu_timer_refclk); 652 + ret = 0; 653 + } else { 654 + BUG(); 655 + } 654 656 } 655 657 } 656 658 657 659 return ret; 658 660 } 659 - 660 - union gfx_info { 661 - struct atom_gfx_info_v2_4 v24; 662 - struct atom_gfx_info_v2_7 v27; 663 - struct atom_gfx_info_v3_0 v30; 664 - }; 665 661 666 662 int amdgpu_atomfirmware_get_gfx_info(struct amdgpu_device *adev) 667 663 {