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

drm/amd/display: Refine the implementation of dm_pp_get_funcs_rv

powerplay/dpm export all interfaces in struct amd_pm_funcs.
so call common exported interfaces instead of powerplay inner interfaces

Also not include header file hwmgr.h

Acked-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Rex Zhu and committed by
Alex Deucher
b0a634ac ea870e44

+40 -40
+40 -40
drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm_pp_smu.c
··· 33 33 #include "amdgpu_dm_irq.h" 34 34 #include "amdgpu_pm.h" 35 35 #include "dm_pp_smu.h" 36 - #include "../../powerplay/inc/hwmgr.h" 37 36 38 37 39 38 bool dm_pp_apply_display_requirements( ··· 451 452 void pp_rv_set_display_requirement(struct pp_smu *pp, 452 453 struct pp_smu_display_requirement_rv *req) 453 454 { 454 - struct amdgpu_device *adev = pp->ctx->driver_context; 455 - struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; 456 - int ret = 0; 457 - if (hwmgr->hwmgr_func->set_deep_sleep_dcefclk) 458 - ret = hwmgr->hwmgr_func->set_deep_sleep_dcefclk(hwmgr, req->hard_min_dcefclk_khz/10); 459 - if (hwmgr->hwmgr_func->set_active_display_count) 460 - ret = hwmgr->hwmgr_func->set_active_display_count(hwmgr, req->display_count); 455 + struct dc_context *ctx = pp->ctx; 456 + struct amdgpu_device *adev = ctx->driver_context; 457 + const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; 461 458 462 - //store_cc6 is not yet implemented in SMU level 459 + if (!pp_funcs || !pp_funcs->display_configuration_changed) 460 + return; 461 + 462 + amdgpu_dpm_display_configuration_changed(adev); 463 463 } 464 464 465 465 void pp_rv_set_wm_ranges(struct pp_smu *pp, 466 466 struct pp_smu_wm_range_sets *ranges) 467 467 { 468 - struct amdgpu_device *adev = pp->ctx->driver_context; 469 - struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; 470 - struct pp_wm_sets_with_clock_ranges_soc15 ranges_soc15 = {0}; 471 - int i = 0; 468 + struct dc_context *ctx = pp->ctx; 469 + struct amdgpu_device *adev = ctx->driver_context; 470 + void *pp_handle = adev->powerplay.pp_handle; 471 + const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; 472 + struct dm_pp_wm_sets_with_clock_ranges_soc15 wm_with_clock_ranges; 473 + struct dm_pp_clock_range_for_dmif_wm_set_soc15 *wm_dce_clocks = wm_with_clock_ranges.wm_dmif_clocks_ranges; 474 + struct dm_pp_clock_range_for_mcif_wm_set_soc15 *wm_soc_clocks = wm_with_clock_ranges.wm_mcif_clocks_ranges; 475 + int32_t i; 472 476 473 - if (!hwmgr->hwmgr_func->set_watermarks_for_clocks_ranges || 474 - !pp || !ranges) 475 - return; 477 + wm_with_clock_ranges.num_wm_dmif_sets = ranges->num_reader_wm_sets; 478 + wm_with_clock_ranges.num_wm_mcif_sets = ranges->num_writer_wm_sets; 476 479 477 - //not entirely sure if thats a correct assignment 478 - ranges_soc15.num_wm_sets_dmif = ranges->num_reader_wm_sets; 479 - ranges_soc15.num_wm_sets_mcif = ranges->num_writer_wm_sets; 480 - 481 - for (i = 0; i < ranges_soc15.num_wm_sets_dmif; i++) { 480 + for (i = 0; i < wm_with_clock_ranges.num_wm_dmif_sets; i++) { 482 481 if (ranges->reader_wm_sets[i].wm_inst > 3) 483 - ranges_soc15.wm_sets_dmif[i].wm_set_id = DC_WM_SET_A; 482 + wm_dce_clocks[i].wm_set_id = WM_SET_A; 484 483 else 485 - ranges_soc15.wm_sets_dmif[i].wm_set_id = 484 + wm_dce_clocks[i].wm_set_id = 486 485 ranges->reader_wm_sets[i].wm_inst; 487 - ranges_soc15.wm_sets_dmif[i].wm_max_dcefclk_in_khz = 486 + wm_dce_clocks[i].wm_max_dcfclk_clk_in_khz = 488 487 ranges->reader_wm_sets[i].max_drain_clk_khz; 489 - ranges_soc15.wm_sets_dmif[i].wm_min_dcefclk_in_khz = 488 + wm_dce_clocks[i].wm_min_dcfclk_clk_in_khz = 490 489 ranges->reader_wm_sets[i].min_drain_clk_khz; 491 - ranges_soc15.wm_sets_dmif[i].wm_max_memclk_in_khz = 490 + wm_dce_clocks[i].wm_max_mem_clk_in_khz = 492 491 ranges->reader_wm_sets[i].max_fill_clk_khz; 493 - ranges_soc15.wm_sets_dmif[i].wm_min_memclk_in_khz = 492 + wm_dce_clocks[i].wm_min_mem_clk_in_khz = 494 493 ranges->reader_wm_sets[i].min_fill_clk_khz; 495 494 } 496 495 497 - for (i = 0; i < ranges_soc15.num_wm_sets_mcif; i++) { 496 + for (i = 0; i < wm_with_clock_ranges.num_wm_mcif_sets; i++) { 498 497 if (ranges->writer_wm_sets[i].wm_inst > 3) 499 - ranges_soc15.wm_sets_dmif[i].wm_set_id = DC_WM_SET_A; 498 + wm_soc_clocks[i].wm_set_id = WM_SET_A; 500 499 else 501 - ranges_soc15.wm_sets_mcif[i].wm_set_id = 500 + wm_soc_clocks[i].wm_set_id = 502 501 ranges->writer_wm_sets[i].wm_inst; 503 - ranges_soc15.wm_sets_mcif[i].wm_max_socclk_in_khz = 502 + wm_soc_clocks[i].wm_max_socclk_clk_in_khz = 504 503 ranges->writer_wm_sets[i].max_fill_clk_khz; 505 - ranges_soc15.wm_sets_mcif[i].wm_min_socclk_in_khz = 504 + wm_soc_clocks[i].wm_min_socclk_clk_in_khz = 506 505 ranges->writer_wm_sets[i].min_fill_clk_khz; 507 - ranges_soc15.wm_sets_mcif[i].wm_max_memclk_in_khz = 506 + wm_soc_clocks[i].wm_max_mem_clk_in_khz = 508 507 ranges->writer_wm_sets[i].max_fill_clk_khz; 509 - ranges_soc15.wm_sets_mcif[i].wm_min_memclk_in_khz = 508 + wm_soc_clocks[i].wm_min_mem_clk_in_khz = 510 509 ranges->writer_wm_sets[i].min_fill_clk_khz; 511 510 } 512 511 513 - hwmgr->hwmgr_func->set_watermarks_for_clocks_ranges(hwmgr, &ranges_soc15); 514 - 512 + pp_funcs->set_watermarks_for_clocks_ranges(pp_handle, &wm_with_clock_ranges); 515 513 } 516 514 517 515 void pp_rv_set_pme_wa_enable(struct pp_smu *pp) 518 516 { 519 - struct amdgpu_device *adev = pp->ctx->driver_context; 520 - struct pp_hwmgr *hwmgr = adev->powerplay.pp_handle; 517 + struct dc_context *ctx = pp->ctx; 518 + struct amdgpu_device *adev = ctx->driver_context; 519 + void *pp_handle = adev->powerplay.pp_handle; 520 + const struct amd_pm_funcs *pp_funcs = adev->powerplay.pp_funcs; 521 521 522 - if (hwmgr->hwmgr_func->smus_notify_pwe) 523 - hwmgr->hwmgr_func->smus_notify_pwe(hwmgr); 522 + if (!pp_funcs || !pp_funcs->notify_smu_enable_pwe) 523 + return; 524 + 525 + pp_funcs->notify_smu_enable_pwe(pp_handle); 524 526 } 525 527 526 528 void dm_pp_get_funcs_rv(