aboutsummaryrefslogtreecommitdiffstats
path: root/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3185-drm-amd-powerplay-support-fan-speed-retrieval-on-arc.patch
diff options
context:
space:
mode:
Diffstat (limited to 'meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3185-drm-amd-powerplay-support-fan-speed-retrieval-on-arc.patch')
-rw-r--r--meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3185-drm-amd-powerplay-support-fan-speed-retrieval-on-arc.patch77
1 files changed, 77 insertions, 0 deletions
diff --git a/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3185-drm-amd-powerplay-support-fan-speed-retrieval-on-arc.patch b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3185-drm-amd-powerplay-support-fan-speed-retrieval-on-arc.patch
new file mode 100644
index 00000000..3b56fc75
--- /dev/null
+++ b/meta-amd-bsp/recipes-kernel/linux/linux-yocto-4.19.8/3185-drm-amd-powerplay-support-fan-speed-retrieval-on-arc.patch
@@ -0,0 +1,77 @@
+From 294dede95546ec7066f5446bf7082f83283d17e1 Mon Sep 17 00:00:00 2001
+From: Evan Quan <evan.quan@amd.com>
+Date: Mon, 22 Jul 2019 12:09:38 +0800
+Subject: [PATCH 3185/4256] drm/amd/powerplay: support fan speed retrieval on
+ arcturus
+
+Support arcturus fan speed retrieval.
+
+Signed-off-by: Evan Quan <evan.quan@amd.com>
+Reviewed-by: Kevin Wang <kevin1.wang@amd.com>
+Reviewed-by: Alex Deucher <alexander.deucher@amd.com>
+Signed-off-by: Alex Deucher <alexander.deucher@amd.com>
+---
+ drivers/gpu/drm/amd/powerplay/arcturus_ppt.c | 40 ++++++++++++++++++++
+ 1 file changed, 40 insertions(+)
+
+diff --git a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+index 6d1691d9ac7c..1bdebb77c55b 100644
+--- a/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
++++ b/drivers/gpu/drm/amd/powerplay/arcturus_ppt.c
+@@ -994,6 +994,44 @@ static int arcturus_read_sensor(struct smu_context *smu,
+ return ret;
+ }
+
++static int arcturus_get_fan_speed_rpm(struct smu_context *smu,
++ uint32_t *speed)
++{
++ SmuMetrics_t metrics;
++ int ret = 0;
++
++ if (!speed)
++ return -EINVAL;
++
++ ret = arcturus_get_metrics_table(smu, &metrics);
++ if (ret)
++ return ret;
++
++ *speed = metrics.CurrFanSpeed;
++
++ return ret;
++}
++
++static int arcturus_get_fan_speed_percent(struct smu_context *smu,
++ uint32_t *speed)
++{
++ PPTable_t *pptable = smu->smu_table.driver_pptable;
++ uint32_t percent, current_rpm;
++ int ret = 0;
++
++ if (!speed)
++ return -EINVAL;
++
++ ret = arcturus_get_fan_speed_rpm(smu, &current_rpm);
++ if (ret)
++ return ret;
++
++ percent = current_rpm * 100 / pptable->FanMaximumRpm;
++ *speed = percent > 100 ? 100 : percent;
++
++ return ret;
++}
++
+ static int arcturus_get_current_clk_freq_by_table(struct smu_context *smu,
+ enum smu_clk_type clk_type,
+ uint32_t *value)
+@@ -1475,6 +1513,8 @@ static const struct pptable_funcs arcturus_ppt_funcs = {
+ .print_clk_levels = arcturus_print_clk_levels,
+ .force_clk_levels = arcturus_force_clk_levels,
+ .read_sensor = arcturus_read_sensor,
++ .get_fan_speed_percent = arcturus_get_fan_speed_percent,
++ .get_fan_speed_rpm = arcturus_get_fan_speed_rpm,
+ /* debug (internal used) */
+ .dump_pptable = arcturus_dump_pptable,
+ };
+--
+2.17.1
+