[PATCH] drm/amd/pp: Connect display_clock_voltage_request to a function pointer

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

 



Reviewed-by: Alex Deucher <alexander.deucher at amd.com>

________________________________
From: amd-gfx <amd-gfx-bounces@xxxxxxxxxxxxxxxxxxxxx> on behalf of mikita.lipski at amd.com <mikita.lipski at amd.com>
Sent: Tuesday, May 29, 2018 5:51 PM
To: Zhu, Rex; Deucher, Alexander; amd-gfx at lists.freedesktop.org
Cc: Lipski, Mikita; Wu, Hersen; Wentland, Harry
Subject: [PATCH] drm/amd/pp: Connect display_clock_voltage_request to a function pointer

From: Mikita Lipski <mikita.lipski@xxxxxxx>

Get rid of an empty dublicate of smu10_display_clock_voltage_request

Add display_clock_voltage_request to smu10 functions struct so it
can be called from outside the class and connect the pointer to
the function.

That way Display driver can finally apply clock voltage requests
when needed.

Signed-off-by: Mikita Lipski <mikita.lipski at amd.com>
---
 drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c | 63 +++++++++++------------
 1 file changed, 30 insertions(+), 33 deletions(-)

diff --git a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
index e160b05..74136ed 100644
--- a/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
+++ b/drivers/gpu/drm/amd/powerplay/hwmgr/smu10_hwmgr.c
@@ -53,8 +53,36 @@ static const unsigned long SMU10_Magic = (unsigned long) PHM_Rv_Magic;


 static int smu10_display_clock_voltage_request(struct pp_hwmgr *hwmgr,
-               struct pp_display_clock_request *clock_req);
+               struct pp_display_clock_request *clock_req)
+{
+       struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
+       enum amd_pp_clock_type clk_type = clock_req->clock_type;
+       uint32_t clk_freq = clock_req->clock_freq_in_khz / 1000;
+       PPSMC_Msg        msg;
+
+       switch (clk_type) {
+       case amd_pp_dcf_clock:
+               if (clk_freq == smu10_data->dcf_actual_hard_min_freq)
+                       return 0;
+               msg =  PPSMC_MSG_SetHardMinDcefclkByFreq;
+               smu10_data->dcf_actual_hard_min_freq = clk_freq;
+               break;
+       case amd_pp_soc_clock:
+                msg = PPSMC_MSG_SetHardMinSocclkByFreq;
+               break;
+       case amd_pp_f_clock:
+               if (clk_freq == smu10_data->f_actual_hard_min_freq)
+                       return 0;
+               smu10_data->f_actual_hard_min_freq = clk_freq;
+               msg = PPSMC_MSG_SetHardMinFclkByFreq;
+               break;
+       default:
+               return -EINVAL;
+       }
+       smum_send_msg_to_smc_with_parameter(hwmgr, msg, clk_freq);

+       return 0;
+}

 static struct smu10_power_state *cast_smu10_ps(struct pp_hw_power_state *hw_ps)
 {
@@ -1023,39 +1051,7 @@ static int smu10_get_clock_by_type_with_voltage(struct pp_hwmgr *hwmgr,
         return 0;
 }

-static int smu10_display_clock_voltage_request(struct pp_hwmgr *hwmgr,
-               struct pp_display_clock_request *clock_req)
-{
-       struct smu10_hwmgr *smu10_data = (struct smu10_hwmgr *)(hwmgr->backend);
-       enum amd_pp_clock_type clk_type = clock_req->clock_type;
-       uint32_t clk_freq = clock_req->clock_freq_in_khz / 1000;
-       PPSMC_Msg        msg;
-
-       switch (clk_type) {
-       case amd_pp_dcf_clock:
-               if (clk_freq == smu10_data->dcf_actual_hard_min_freq)
-                       return 0;
-               msg =  PPSMC_MSG_SetHardMinDcefclkByFreq;
-               smu10_data->dcf_actual_hard_min_freq = clk_freq;
-               break;
-       case amd_pp_soc_clock:
-                msg = PPSMC_MSG_SetHardMinSocclkByFreq;
-               break;
-       case amd_pp_f_clock:
-               if (clk_freq == smu10_data->f_actual_hard_min_freq)
-                       return 0;
-               smu10_data->f_actual_hard_min_freq = clk_freq;
-               msg = PPSMC_MSG_SetHardMinFclkByFreq;
-               break;
-       default:
-               pr_info("[DisplayClockVoltageRequest]Invalid Clock Type!");
-               return -EINVAL;
-       }
-
-       smum_send_msg_to_smc_with_parameter(hwmgr, msg, clk_freq);

-       return 0;
-}

 static int smu10_get_max_high_clocks(struct pp_hwmgr *hwmgr, struct amd_pp_simple_clock_info *clocks)
 {
@@ -1188,6 +1184,7 @@ static const struct pp_hwmgr_func smu10_hwmgr_funcs = {
         .set_mmhub_powergating_by_smu = smu10_set_mmhub_powergating_by_smu,
         .smus_notify_pwe = smu10_smus_notify_pwe,
         .gfx_off_control = smu10_gfx_off_control,
+       .display_clock_voltage_request = smu10_display_clock_voltage_request,
 };

 int smu10_init_function_pointers(struct pp_hwmgr *hwmgr)
--
2.7.4

_______________________________________________
amd-gfx mailing list
amd-gfx at lists.freedesktop.org
https://lists.freedesktop.org/mailman/listinfo/amd-gfx
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.freedesktop.org/archives/amd-gfx/attachments/20180529/bac748fd/attachment.html>


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

  Powered by Linux