aboutsummaryrefslogtreecommitdiffstats
path: root/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1058-drm-amd-powerplay-Add-support-functions-for-CI-to-pp.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1058-drm-amd-powerplay-Add-support-functions-for-CI-to-pp.patch')
-rw-r--r--meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1058-drm-amd-powerplay-Add-support-functions-for-CI-to-pp.patch121
1 files changed, 121 insertions, 0 deletions
diff --git a/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1058-drm-amd-powerplay-Add-support-functions-for-CI-to-pp.patch b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1058-drm-amd-powerplay-Add-support-functions-for-CI-to-pp.patch
new file mode 100644
index 00000000..08c8e311
--- /dev/null
+++ b/meta-v1000/recipes-kernel/linux/linux-yocto-4.14.71/1058-drm-amd-powerplay-Add-support-functions-for-CI-to-pp.patch
@@ -0,0 +1,121 @@
+From 524c57fa149675ecfbc66894da3c7a38d47e69c4 Mon Sep 17 00:00:00 2001
+From: Rex Zhu <Rex.Zhu@amd.com>
+Date: Thu, 14 Sep 2017 21:14:59 +0800
+Subject: [PATCH 1058/4131] drm/amd/powerplay: Add support functions for CI to
+ ppatomctrl.c
+
+Change-Id: If4bad106545eb6bf570f617a56bcc96fc075f62b
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Rex Zhu <Rex.Zhu@amd.com>
+---
+ drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c | 80 ++++++++++++++++++++++++
+ drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h | 6 ++
+ 2 files changed, 86 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
+index fa0305e..a129bc5 100644
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.c
+@@ -1418,3 +1418,83 @@ int atomctrl_get_svi2_info(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
+
+ return 0;
+ }
++
++int atomctrl_get_leakage_id_from_efuse(struct pp_hwmgr *hwmgr, uint16_t *virtual_voltage_id)
++{
++ int result;
++ SET_VOLTAGE_PS_ALLOCATION allocation;
++ SET_VOLTAGE_PARAMETERS_V1_3 *voltage_parameters =
++ (SET_VOLTAGE_PARAMETERS_V1_3 *)&allocation.sASICSetVoltage;
++
++ voltage_parameters->ucVoltageMode = ATOM_GET_LEAKAGE_ID;
++
++ result = cgs_atom_exec_cmd_table(hwmgr->device,
++ GetIndexIntoMasterTable(COMMAND, SetVoltage),
++ voltage_parameters);
++
++ *virtual_voltage_id = voltage_parameters->usVoltageLevel;
++
++ return result;
++}
++
++int atomctrl_get_leakage_vddc_base_on_leakage(struct pp_hwmgr *hwmgr,
++ uint16_t *vddc, uint16_t *vddci,
++ uint16_t virtual_voltage_id,
++ uint16_t efuse_voltage_id)
++{
++ int i, j;
++ int ix;
++ u16 *leakage_bin, *vddc_id_buf, *vddc_buf, *vddci_id_buf, *vddci_buf;
++ ATOM_ASIC_PROFILING_INFO_V2_1 *profile;
++
++ *vddc = 0;
++ *vddci = 0;
++
++ ix = GetIndexIntoMasterTable(DATA, ASIC_ProfilingInfo);
++
++ profile = (ATOM_ASIC_PROFILING_INFO_V2_1 *)
++ cgs_atom_get_data_table(hwmgr->device,
++ ix,
++ NULL, NULL, NULL);
++ if (!profile)
++ return -EINVAL;
++
++ if ((profile->asHeader.ucTableFormatRevision >= 2) &&
++ (profile->asHeader.ucTableContentRevision >= 1) &&
++ (profile->asHeader.usStructureSize >= sizeof(ATOM_ASIC_PROFILING_INFO_V2_1))) {
++ leakage_bin = (u16 *)((char *)profile + profile->usLeakageBinArrayOffset);
++ vddc_id_buf = (u16 *)((char *)profile + profile->usElbVDDC_IdArrayOffset);
++ vddc_buf = (u16 *)((char *)profile + profile->usElbVDDC_LevelArrayOffset);
++ if (profile->ucElbVDDC_Num > 0) {
++ for (i = 0; i < profile->ucElbVDDC_Num; i++) {
++ if (vddc_id_buf[i] == virtual_voltage_id) {
++ for (j = 0; j < profile->ucLeakageBinNum; j++) {
++ if (efuse_voltage_id <= leakage_bin[j]) {
++ *vddc = vddc_buf[j * profile->ucElbVDDC_Num + i];
++ break;
++ }
++ }
++ break;
++ }
++ }
++ }
++
++ vddci_id_buf = (u16 *)((char *)profile + profile->usElbVDDCI_IdArrayOffset);
++ vddci_buf = (u16 *)((char *)profile + profile->usElbVDDCI_LevelArrayOffset);
++ if (profile->ucElbVDDCI_Num > 0) {
++ for (i = 0; i < profile->ucElbVDDCI_Num; i++) {
++ if (vddci_id_buf[i] == virtual_voltage_id) {
++ for (j = 0; j < profile->ucLeakageBinNum; j++) {
++ if (efuse_voltage_id <= leakage_bin[j]) {
++ *vddci = vddci_buf[j * profile->ucElbVDDC_Num + i];
++ break;
++ }
++ }
++ break;
++ }
++ }
++ }
++ }
++
++ return 0;
++}
+diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h
+index 8d4188a..c44a920 100644
+--- a/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h
++++ b/drivers/gpu/drm/amd/powerplay/hwmgr/ppatomctrl.h
+@@ -314,5 +314,11 @@ extern int atomctrl_get_avfs_information(struct pp_hwmgr *hwmgr, struct pp_atom_
+ extern int atomctrl_get_svi2_info(struct pp_hwmgr *hwmgr, uint8_t voltage_type,
+ uint8_t *svd_gpio_id, uint8_t *svc_gpio_id,
+ uint16_t *load_line);
++
++extern int atomctrl_get_leakage_vddc_base_on_leakage(struct pp_hwmgr *hwmgr,
++ uint16_t *vddc, uint16_t *vddci,
++ uint16_t virtual_voltage_id,
++ uint16_t efuse_voltage_id);
++extern int atomctrl_get_leakage_id_from_efuse(struct pp_hwmgr *hwmgr, uint16_t *virtual_voltage_id);
+ #endif
+
+--
+2.7.4
+