From: Kevin Wang <[email protected]>

add callback function read_sensor for navi10 asic

Signed-off-by: Kevin Wang <[email protected]>
Reviewed-by: Huang Rui <[email protected]>
Signed-off-by: Alex Deucher <[email protected]>
---
 drivers/gpu/drm/amd/powerplay/navi10_ppt.c | 21 +++++++++++++++++++++
 1 file changed, 21 insertions(+)

diff --git a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c 
b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
index eafd6c653162..186c5726580a 100644
--- a/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
+++ b/drivers/gpu/drm/amd/powerplay/navi10_ppt.c
@@ -1170,6 +1170,26 @@ static int navi10_set_watermarks_table(struct 
smu_context *smu,
        return 0;
 }
 
+static int navi10_read_sensor(struct smu_context *smu,
+                                enum amd_pp_sensors sensor,
+                                void *data, uint32_t *size)
+{
+       int ret = 0;
+       struct smu_table_context *table_context = &smu->smu_table;
+       PPTable_t *pptable = table_context->driver_pptable;
+
+       switch (sensor) {
+       case AMDGPU_PP_SENSOR_MAX_FAN_RPM:
+               *(uint32_t *)data = pptable->FanMaximumRpm;
+               *size = 4;
+               break;
+       default:
+               return -EINVAL;
+       }
+
+       return ret;
+}
+
 static const struct pptable_funcs navi10_ppt_funcs = {
        .tables_init = navi10_tables_init,
        .alloc_dpm_context = navi10_allocate_dpm_context,
@@ -1204,6 +1224,7 @@ static const struct pptable_funcs navi10_ppt_funcs = {
        .set_power_profile_mode = navi10_set_power_profile_mode,
        .get_profiling_clk_mask = navi10_get_profiling_clk_mask,
        .set_watermarks_table = navi10_set_watermarks_table,
+       .read_sensor = navi10_read_sensor,
 };
 
 void navi10_set_ppt_funcs(struct smu_context *smu)
-- 
2.20.1

_______________________________________________
amd-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/amd-gfx

Reply via email to