[PATCH] drm/amd/pp: Expose new interface to DC to ctrl auto wattman

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Disable AutoWattman (if enabled) when FreeSync is enabled.

Change-Id: I9a531321d7913b8b40e60070c569a01c4f202002
Signed-off-by: Rex Zhu <Rex.Zhu at amd.com>
---
 drivers/gpu/drm/amd/include/kgd_pp_interface.h |  1 +
 drivers/gpu/drm/amd/powerplay/amd_powerplay.c  | 25 +++++++++++++++++++++++++
 2 files changed, 26 insertions(+)

diff --git a/drivers/gpu/drm/amd/include/kgd_pp_interface.h b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
index 22c2fa3..f7bb565 100644
--- a/drivers/gpu/drm/amd/include/kgd_pp_interface.h
+++ b/drivers/gpu/drm/amd/include/kgd_pp_interface.h
@@ -313,6 +313,7 @@ struct amd_pm_funcs {
 	int (*set_power_profile_mode)(void *handle, long *input, uint32_t size);
 	int (*odn_edit_dpm_table)(void *handle, uint32_t type, long *input, uint32_t size);
 	int (*set_mmhub_powergating_by_smu)(void *handle);
+	int (*notify_free_sync_change)(void *handle, bool en);
 };
 
 #endif
diff --git a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
index 376ed2d..d0306b6 100644
--- a/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
+++ b/drivers/gpu/drm/amd/powerplay/amd_powerplay.c
@@ -1555,6 +1555,30 @@ static int pp_set_mmhub_powergating_by_smu(void *handle)
 	return hwmgr->hwmgr_func->set_mmhub_powergating_by_smu(hwmgr);
 }
 
+static int pp_notify_free_sync_change(void *handle, bool en)
+{
+	struct pp_hwmgr *hwmgr;
+	struct pp_instance *pp_handle = (struct pp_instance *)handle;
+	int ret = 0;
+
+	ret = pp_check(pp_handle);
+
+	if (ret)
+		return ret;
+
+	hwmgr = pp_handle->hwmgr;
+
+	mutex_lock(&pp_handle->pp_lock);
+	if (hwmgr->autowattman_enabled) {
+		if (hwmgr->hwmgr_func->start_auto_wattman != NULL) {
+			if (!cancel_delayed_work_sync(&hwmgr->wattman_update_work))
+				hwmgr->hwmgr_func->start_auto_wattman(hwmgr, en);
+		}
+	}
+	mutex_unlock(&pp_handle->pp_lock);
+	return 0;
+}
+
 const struct amd_pm_funcs pp_dpm_funcs = {
 	.load_firmware = pp_dpm_load_fw,
 	.wait_for_fw_loading_complete = pp_dpm_fw_loading_complete,
@@ -1604,4 +1628,5 @@ static int pp_set_mmhub_powergating_by_smu(void *handle)
 	.display_clock_voltage_request = pp_display_clock_voltage_request,
 	.get_display_mode_validation_clocks = pp_get_display_mode_validation_clocks,
 	.set_mmhub_powergating_by_smu = pp_set_mmhub_powergating_by_smu,
+	.notify_free_sync_change = pp_notify_free_sync_change,
 };
-- 
1.9.1



[Index of Archives]     [Linux USB Devel]     [Linux Audio Users]     [Yosemite News]     [Linux Kernel]     [Linux SCSI]

  Powered by Linux