[Intel-gfx] [PATCH 12/12] drm/i915/cnl: Unify dvfs level selection.
Rodrigo Vivi
rodrigo.vivi at intel.com
Sat Sep 30 00:08:50 UTC 2017
When port clock is zero or undefined we base our
calculation on cdclk. So, same function can be used
for port clock == 0 now that we have the same default "2".
Cc: Mika Kahola <mika.kahola at intel.com>
Cc: Paulo Zanoni <paulo.r.zanoni at intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi at intel.com>
---
drivers/gpu/drm/i915/intel_cdclk.c | 28 +++++++++++++---------------
drivers/gpu/drm/i915/intel_dpll_mgr.c | 25 ++-----------------------
drivers/gpu/drm/i915/intel_drv.h | 1 +
3 files changed, 16 insertions(+), 38 deletions(-)
diff --git a/drivers/gpu/drm/i915/intel_cdclk.c b/drivers/gpu/drm/i915/intel_cdclk.c
index f2629dbec763..b2a1c0c7c938 100644
--- a/drivers/gpu/drm/i915/intel_cdclk.c
+++ b/drivers/gpu/drm/i915/intel_cdclk.c
@@ -1544,12 +1544,22 @@ bool cnl_dvfs_need_change(struct drm_i915_private *dev_priv, int level)
return level != old_level;
}
+int cnl_dvfs_get_level(int cdclk, int portclk)
+{
+ if (cdclk == 168000 && portclk <= 594000)
+ return 0;
+ else if (cdclk == 336000 && portclk <= 594000)
+ return 1;
+ else
+ return 2;
+}
+
static void cnl_set_cdclk(struct drm_i915_private *dev_priv,
const struct intel_cdclk_state *cdclk_state)
{
int cdclk = cdclk_state->cdclk;
int vco = cdclk_state->vco;
- u32 val, divider, pcu_ack;
+ u32 val, divider, level;
if (cnl_dvfs_pre_change(dev_priv))
return;
@@ -1570,19 +1580,6 @@ static void cnl_set_cdclk(struct drm_i915_private *dev_priv,
break;
}
- switch (cdclk) {
- case 168000:
- pcu_ack = 0;
- break;
- case 336000:
- pcu_ack = 1;
- break;
- case 528000:
- default:
- pcu_ack = 2;
- break;
- }
-
if (dev_priv->cdclk.hw.vco != 0 &&
dev_priv->cdclk.hw.vco != vco)
cnl_cdclk_pll_disable(dev_priv);
@@ -1599,7 +1596,8 @@ static void cnl_set_cdclk(struct drm_i915_private *dev_priv,
I915_WRITE(CDCLK_CTL, val);
/* inform PCU of the change */
- cnl_dvfs_post_change(dev_priv, pcu_ack);
+ level = cnl_dvfs_get_level(cdclk, 0);
+ cnl_dvfs_post_change(dev_priv, level);
intel_update_cdclk(dev_priv);
}
diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.c b/drivers/gpu/drm/i915/intel_dpll_mgr.c
index 6bbc3d718e78..1006c2853999 100644
--- a/drivers/gpu/drm/i915/intel_dpll_mgr.c
+++ b/drivers/gpu/drm/i915/intel_dpll_mgr.c
@@ -1966,16 +1966,6 @@ static const struct intel_dpll_mgr bxt_pll_mgr = {
.dump_hw_state = bxt_dump_hw_state,
};
-static int cnl_get_dvfs_level(int cdclk, int portclk)
-{
- if (cdclk == 168000 && portclk <= 594000)
- return 0;
- else if (cdclk == 336000 && portclk <= 594000)
- return 1;
- else
- return 2;
-}
-
static void cnl_ddi_pll_enable(struct drm_i915_private *dev_priv,
struct intel_shared_dpll *pll)
{
@@ -2024,7 +2014,7 @@ static void cnl_ddi_pll_enable(struct drm_i915_private *dev_priv,
*/
cdclk = dev_priv->cdclk.hw.cdclk;
portclk = intel_ddi_port_clock(dev_priv, pll->id);
- level = cnl_get_dvfs_level(cdclk, portclk);
+ level = cnl_dvfs_get_level(cdclk, portclk);
change_level = cnl_dvfs_need_change(dev_priv, level);
if (change_level)
ret = cnl_dvfs_pre_change(dev_priv);
@@ -2075,18 +2065,7 @@ static void cnl_ddi_pll_disable(struct drm_i915_private *dev_priv,
* (DVFS) Sequence Before Frequency Change
*/
cdclk = dev_priv->cdclk.hw.cdclk;
- switch (cdclk) {
- case 168000:
- level = 0;
- break;
- case 336000:
- level = 1;
- break;
- case 528000:
- default:
- level = 2;
- break;
- }
+ level = cnl_dvfs_get_level(cdclk, 0);
change_level = cnl_dvfs_need_change(dev_priv, level);
if (change_level)
ret = cnl_dvfs_pre_change(dev_priv);
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 200061def48e..c1395e8a6ba6 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -1326,6 +1326,7 @@ void cnl_uninit_cdclk(struct drm_i915_private *dev_priv);
int cnl_dvfs_pre_change(struct drm_i915_private *dev_priv);
void cnl_dvfs_post_change(struct drm_i915_private *dev_priv, int level);
bool cnl_dvfs_need_change(struct drm_i915_private *dev_priv, int level);
+int cnl_dvfs_get_level(int cdclk, int portclk);
void bxt_init_cdclk(struct drm_i915_private *dev_priv);
void bxt_uninit_cdclk(struct drm_i915_private *dev_priv);
void intel_init_cdclk_hooks(struct drm_i915_private *dev_priv);
--
2.13.5
More information about the Intel-gfx
mailing list