[6/9] drm/amd/powerplay: wrap get evv voltage of fiji and polaris

Submitted by Rex Zhu on Sept. 9, 2016, 1:37 p.m.

Details

Message ID 1473428259-580-7-git-send-email-Rex.Zhu@amd.com
State New
Headers show
Series "misc patches related to powerplay" ( rev: 1 ) in AMD X.Org drivers

Not browsing as part of any series.

Commit Message

Rex Zhu Sept. 9, 2016, 1:37 p.m.
Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c | 17 +++++++++++++++++
 drivers/gpu/drm/amd/powerplay/inc/hwmgr.h   |  3 +++
 2 files changed, 20 insertions(+)

Patch hide | download patch | download mbox

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
index 7f39ce6..f1b1c34 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/hwmgr.c
@@ -733,3 +733,20 @@  int phm_add_voltage(struct pp_hwmgr *hwmgr,
 	return 0;
 }
 
+int phm_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
+				uint32_t sclk, uint16_t id, uint16_t *voltage)
+{
+	uint32_t vol;
+	int ret = 0;
+
+	if (hwmgr->chip_id < CHIP_POLARIS10) {
+		atomctrl_get_voltage_evv_on_sclk(hwmgr, voltage_type, sclk, id, voltage);
+		if (*voltage >= 2000 || *voltage == 0)
+			*voltage = 1150;
+	} else {
+		ret = atomctrl_get_voltage_evv_on_sclk_ai(hwmgr, voltage_type, sclk, id, &vol);
+		*voltage = (uint16_t)vol/100;
+	}
+	return ret;
+}
+
diff --git a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
index c4772d7..08b288f 100644
--- a/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
+++ b/drivers/gpu/drm/amd/powerplay/inc/hwmgr.h
@@ -701,6 +701,9 @@  extern int phm_add_voltage(struct pp_hwmgr *hwmgr,
 	phm_ppt_v1_voltage_lookup_table *look_up_table,
 	phm_ppt_v1_voltage_lookup_record *record);
 
+extern int phm_get_voltage_evv_on_sclk(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
+				uint32_t sclk, uint16_t id, uint16_t *voltage);
+
 #define PHM_ENTIRE_REGISTER_MASK 0xFFFFFFFFU
 
 #define PHM_FIELD_SHIFT(reg, field) reg##__##field##__SHIFT