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

Configure Feed

Select the types of activity you want to include in your feed.

drm/amd/pm: Move some functions to smu_v13_0.c as generic code

Use generic functions and remove the duplicate code

Signed-off-by: Ma Jun <Jun.Ma2@amd.com>
Reviewed-by: Yang Wang <kevinyang.wang@amd.com>
Signed-off-by: Alex Deucher <alexander.deucher@amd.com>

authored by

Ma Jun and committed by
Alex Deucher
857c838c d8a38137

+32 -78
+28 -10
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0.c
··· 2283 2283 2284 2284 int smu_v13_0_baco_enter(struct smu_context *smu) 2285 2285 { 2286 - int ret = 0; 2286 + struct smu_baco_context *smu_baco = &smu->smu_baco; 2287 + struct amdgpu_device *adev = smu->adev; 2288 + int ret; 2287 2289 2288 - ret = smu_v13_0_baco_set_state(smu, 2289 - SMU_BACO_STATE_ENTER); 2290 - if (ret) 2290 + if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) { 2291 + return smu_v13_0_baco_set_armd3_sequence(smu, 2292 + (smu_baco->maco_support && amdgpu_runtime_pm != 1) ? 2293 + BACO_SEQ_BAMACO : BACO_SEQ_BACO); 2294 + } else { 2295 + ret = smu_v13_0_baco_set_state(smu, SMU_BACO_STATE_ENTER); 2296 + if (!ret) 2297 + usleep_range(10000, 11000); 2298 + 2291 2299 return ret; 2292 - 2293 - msleep(10); 2294 - 2295 - return ret; 2300 + } 2296 2301 } 2297 2302 2298 2303 int smu_v13_0_baco_exit(struct smu_context *smu) 2299 2304 { 2300 - return smu_v13_0_baco_set_state(smu, 2301 - SMU_BACO_STATE_EXIT); 2305 + struct amdgpu_device *adev = smu->adev; 2306 + int ret; 2307 + 2308 + if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) { 2309 + /* Wait for PMFW handling for the Dstate change */ 2310 + usleep_range(10000, 11000); 2311 + ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS); 2312 + } else { 2313 + ret = smu_v13_0_baco_set_state(smu, SMU_BACO_STATE_EXIT); 2314 + } 2315 + 2316 + if (!ret) 2317 + adev->gfx.is_poweron = false; 2318 + 2319 + return ret; 2302 2320 } 2303 2321 2304 2322 int smu_v13_0_set_gfx_power_up_by_imu(struct smu_context *smu)
+2 -34
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_0_ppt.c
··· 2558 2558 NULL); 2559 2559 } 2560 2560 2561 - static int smu_v13_0_0_baco_enter(struct smu_context *smu) 2562 - { 2563 - struct smu_baco_context *smu_baco = &smu->smu_baco; 2564 - struct amdgpu_device *adev = smu->adev; 2565 - 2566 - if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) 2567 - return smu_v13_0_baco_set_armd3_sequence(smu, 2568 - (smu_baco->maco_support && amdgpu_runtime_pm != 1) ? 2569 - BACO_SEQ_BAMACO : BACO_SEQ_BACO); 2570 - else 2571 - return smu_v13_0_baco_enter(smu); 2572 - } 2573 - 2574 - static int smu_v13_0_0_baco_exit(struct smu_context *smu) 2575 - { 2576 - struct amdgpu_device *adev = smu->adev; 2577 - int ret; 2578 - 2579 - if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) { 2580 - /* Wait for PMFW handling for the Dstate change */ 2581 - usleep_range(10000, 11000); 2582 - ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS); 2583 - } else { 2584 - ret = smu_v13_0_baco_exit(smu); 2585 - } 2586 - 2587 - if (!ret) 2588 - adev->gfx.is_poweron = false; 2589 - 2590 - return ret; 2591 - } 2592 - 2593 2561 static bool smu_v13_0_0_is_mode1_reset_supported(struct smu_context *smu) 2594 2562 { 2595 2563 struct amdgpu_device *adev = smu->adev; ··· 3005 3037 .baco_is_support = smu_v13_0_baco_is_support, 3006 3038 .baco_get_state = smu_v13_0_baco_get_state, 3007 3039 .baco_set_state = smu_v13_0_baco_set_state, 3008 - .baco_enter = smu_v13_0_0_baco_enter, 3009 - .baco_exit = smu_v13_0_0_baco_exit, 3040 + .baco_enter = smu_v13_0_baco_enter, 3041 + .baco_exit = smu_v13_0_baco_exit, 3010 3042 .mode1_reset_is_support = smu_v13_0_0_is_mode1_reset_supported, 3011 3043 .mode1_reset = smu_v13_0_0_mode1_reset, 3012 3044 .mode2_reset = smu_v13_0_0_mode2_reset,
+2 -34
drivers/gpu/drm/amd/pm/swsmu/smu13/smu_v13_0_7_ppt.c
··· 2515 2515 return ret; 2516 2516 } 2517 2517 2518 - static int smu_v13_0_7_baco_enter(struct smu_context *smu) 2519 - { 2520 - struct smu_baco_context *smu_baco = &smu->smu_baco; 2521 - struct amdgpu_device *adev = smu->adev; 2522 - 2523 - if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) 2524 - return smu_v13_0_baco_set_armd3_sequence(smu, 2525 - (smu_baco->maco_support && amdgpu_runtime_pm != 1) ? 2526 - BACO_SEQ_BAMACO : BACO_SEQ_BACO); 2527 - else 2528 - return smu_v13_0_baco_enter(smu); 2529 - } 2530 - 2531 - static int smu_v13_0_7_baco_exit(struct smu_context *smu) 2532 - { 2533 - struct amdgpu_device *adev = smu->adev; 2534 - int ret; 2535 - 2536 - if (adev->in_runpm && smu_cmn_is_audio_func_enabled(adev)) { 2537 - /* Wait for PMFW handling for the Dstate change */ 2538 - usleep_range(10000, 11000); 2539 - ret = smu_v13_0_baco_set_armd3_sequence(smu, BACO_SEQ_ULPS); 2540 - } else { 2541 - ret = smu_v13_0_baco_exit(smu); 2542 - } 2543 - 2544 - if (!ret) 2545 - adev->gfx.is_poweron = false; 2546 - 2547 - return ret; 2548 - } 2549 - 2550 2518 static bool smu_v13_0_7_is_mode1_reset_supported(struct smu_context *smu) 2551 2519 { 2552 2520 struct amdgpu_device *adev = smu->adev; ··· 2596 2628 .baco_is_support = smu_v13_0_baco_is_support, 2597 2629 .baco_get_state = smu_v13_0_baco_get_state, 2598 2630 .baco_set_state = smu_v13_0_baco_set_state, 2599 - .baco_enter = smu_v13_0_7_baco_enter, 2600 - .baco_exit = smu_v13_0_7_baco_exit, 2631 + .baco_enter = smu_v13_0_baco_enter, 2632 + .baco_exit = smu_v13_0_baco_exit, 2601 2633 .mode1_reset_is_support = smu_v13_0_7_is_mode1_reset_supported, 2602 2634 .mode1_reset = smu_v13_0_mode1_reset, 2603 2635 .set_mp1_state = smu_v13_0_7_set_mp1_state,