Skip to content

Commit 09ed6ba

Browse files
Hersen Wualexdeucher
authored andcommitted
drm/amdgpu/display: navi1x copy dcn watermark clock settings to smu resume from s3 (v2)
This interface is for dGPU Navi1x. Linux dc-pplib interface depends on window driver dc implementation. For Navi1x, clock settings of dcn watermarks are fixed. the settings should be passed to smu during boot up and resume from s3. boot up: dc calculate dcn watermark clock settings within dc_create, dcn20_resource_construct, then call pplib functions below to pass the settings to smu: smu_set_watermarks_for_clock_ranges smu_set_watermarks_table navi10_set_watermarks_table smu_write_watermarks_table For Renoir, clock settings of dcn watermark are also fixed values. dc has implemented different flow for window driver: dc_hardware_init / dc_set_power_state dcn10_init_hw notify_wm_ranges set_wm_ranges For Linux smu_set_watermarks_for_clock_ranges renoir_set_watermarks_table smu_write_watermarks_table dc_hardware_init -> amdgpu_dm_init dc_set_power_state --> dm_resume therefore, linux dc-pplib interface of navi10/12/14 is different from that of Renoir. v2: add missing unlock in error case Signed-off-by: Hersen Wu <[email protected]> Reviewed-by: Evan Quan <[email protected]> Signed-off-by: Alex Deucher <[email protected]>
1 parent ab65a37 commit 09ed6ba

File tree

1 file changed

+69
-0
lines changed

1 file changed

+69
-0
lines changed

drivers/gpu/drm/amd/display/amdgpu_dm/amdgpu_dm.c

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1422,6 +1422,73 @@ static void s3_handle_mst(struct drm_device *dev, bool suspend)
14221422
drm_kms_helper_hotplug_event(dev);
14231423
}
14241424

1425+
static int amdgpu_dm_smu_write_watermarks_table(struct amdgpu_device *adev)
1426+
{
1427+
struct smu_context *smu = &adev->smu;
1428+
int ret = 0;
1429+
1430+
if (!is_support_sw_smu(adev))
1431+
return 0;
1432+
1433+
/* This interface is for dGPU Navi1x.Linux dc-pplib interface depends
1434+
* on window driver dc implementation.
1435+
* For Navi1x, clock settings of dcn watermarks are fixed. the settings
1436+
* should be passed to smu during boot up and resume from s3.
1437+
* boot up: dc calculate dcn watermark clock settings within dc_create,
1438+
* dcn20_resource_construct
1439+
* then call pplib functions below to pass the settings to smu:
1440+
* smu_set_watermarks_for_clock_ranges
1441+
* smu_set_watermarks_table
1442+
* navi10_set_watermarks_table
1443+
* smu_write_watermarks_table
1444+
*
1445+
* For Renoir, clock settings of dcn watermark are also fixed values.
1446+
* dc has implemented different flow for window driver:
1447+
* dc_hardware_init / dc_set_power_state
1448+
* dcn10_init_hw
1449+
* notify_wm_ranges
1450+
* set_wm_ranges
1451+
* -- Linux
1452+
* smu_set_watermarks_for_clock_ranges
1453+
* renoir_set_watermarks_table
1454+
* smu_write_watermarks_table
1455+
*
1456+
* For Linux,
1457+
* dc_hardware_init -> amdgpu_dm_init
1458+
* dc_set_power_state --> dm_resume
1459+
*
1460+
* therefore, this function apply to navi10/12/14 but not Renoir
1461+
* *
1462+
*/
1463+
switch(adev->asic_type) {
1464+
case CHIP_NAVI10:
1465+
case CHIP_NAVI14:
1466+
case CHIP_NAVI12:
1467+
break;
1468+
default:
1469+
return 0;
1470+
}
1471+
1472+
mutex_lock(&smu->mutex);
1473+
1474+
/* pass data to smu controller */
1475+
if ((smu->watermarks_bitmap & WATERMARKS_EXIST) &&
1476+
!(smu->watermarks_bitmap & WATERMARKS_LOADED)) {
1477+
ret = smu_write_watermarks_table(smu);
1478+
1479+
if (ret) {
1480+
mutex_unlock(&smu->mutex);
1481+
DRM_ERROR("Failed to update WMTABLE!\n");
1482+
return ret;
1483+
}
1484+
smu->watermarks_bitmap |= WATERMARKS_LOADED;
1485+
}
1486+
1487+
mutex_unlock(&smu->mutex);
1488+
1489+
return 0;
1490+
}
1491+
14251492
/**
14261493
* dm_hw_init() - Initialize DC device
14271494
* @handle: The base driver device containing the amdgpu_dm device.
@@ -1700,6 +1767,8 @@ static int dm_resume(void *handle)
17001767

17011768
amdgpu_dm_irq_resume_late(adev);
17021769

1770+
amdgpu_dm_smu_write_watermarks_table(adev);
1771+
17031772
return 0;
17041773
}
17051774

0 commit comments

Comments
 (0)