From: Ville Syrjälä <[email protected]>

Extract the BSW pcode notify stuff to a few small helpers. The
plan is to unify these between all the platforms and turn them
into vfuncs.

Signed-off-by: Ville Syrjälä <[email protected]>
---
 drivers/gpu/drm/i915/display/intel_cdclk.c | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/drivers/gpu/drm/i915/display/intel_cdclk.c 
b/drivers/gpu/drm/i915/display/intel_cdclk.c
index 542724256d0f..041b1fc8b3ee 100644
--- a/drivers/gpu/drm/i915/display/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/display/intel_cdclk.c
@@ -872,6 +872,19 @@ static u32 bdw_cdclk_freq_sel(int cdclk)
        }
 }
 
+static int bdw_cdclk_pcode_pre_notify(struct intel_display *display)
+{
+       return intel_parent_pcode_write(display, 
BDW_PCODE_DISPLAY_FREQ_CHANGE_REQ,
+                                       0x0);
+}
+
+static int bdw_cdclk_pcode_post_notify(struct intel_display *display,
+                                      const struct intel_cdclk_config 
*cdclk_config)
+{
+       return intel_parent_pcode_write(display, HSW_PCODE_DE_WRITE_FREQ_REQ,
+                                       cdclk_config->voltage_level);
+}
+
 static void bdw_set_cdclk(struct intel_display *display,
                          const struct intel_cdclk_config *cdclk_config,
                          enum pipe pipe)
@@ -888,7 +901,7 @@ static void bdw_set_cdclk(struct intel_display *display,
                     "trying to change cdclk frequency with cdclk not 
enabled\n"))
                return;
 
-       ret = intel_parent_pcode_write(display, 
BDW_PCODE_DISPLAY_FREQ_CHANGE_REQ, 0x0);
+       ret = bdw_cdclk_pcode_pre_notify(display);
        if (ret) {
                drm_err(display->drm,
                        "Failed to inform PCODE about start of CDCLK change 
(%d)\n", ret);
@@ -918,8 +931,7 @@ static void bdw_set_cdclk(struct intel_display *display,
        if (ret)
                drm_err(display->drm, "Switching back to LCPLL failed\n");
 
-       ret = intel_parent_pcode_write(display, HSW_PCODE_DE_WRITE_FREQ_REQ,
-                                      cdclk_config->voltage_level);
+       ret = bdw_cdclk_pcode_post_notify(display, cdclk_config);
        if (ret)
                drm_err(display->drm,
                        "Failed to inform PCODE about end of CDCLK change 
(%d)\n", ret);
-- 
2.53.0

Reply via email to