Skip to content

Commit 2f3ee43

Browse files
committed
drm/i915/icl: split combo and tbt pll funcs
Like was done for MG and combo, now finish the per-type split of the vfunc by moving TBT out of the combo functions. Now we can completely remove icl_pll_id_to_enable_reg() since each PLL type passes all the information via arguments. Signed-off-by: Lucas De Marchi <lucas.demarchi@intel.com> Reviewed-by: Ville Syrjälä <ville.syrjala@linux.intel.com> Link: https://patchwork.freedesktop.org/patch/msgid/20190309035727.25389-5-lucas.demarchi@intel.com
1 parent 9be8644 commit 2f3ee43

File tree

1 file changed

+54
-20
lines changed

1 file changed

+54
-20
lines changed

drivers/gpu/drm/i915/intel_dpll_mgr.c

Lines changed: 54 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -2956,16 +2956,6 @@ icl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,
29562956
return pll;
29572957
}
29582958

2959-
static i915_reg_t icl_pll_id_to_enable_reg(enum intel_dpll_id id)
2960-
{
2961-
if (intel_dpll_is_combophy(id))
2962-
return CNL_DPLL_ENABLE(id);
2963-
else if (id == DPLL_ID_ICL_TBTPLL)
2964-
return TBT_PLL_ENABLE;
2965-
2966-
return MG_PLL_ENABLE(icl_pll_id_to_tc_port(id));
2967-
}
2968-
29692959
static bool mg_pll_get_hw_state(struct drm_i915_private *dev_priv,
29702960
struct intel_shared_dpll *pll,
29712961
struct intel_dpll_hw_state *hw_state)
@@ -3030,7 +3020,8 @@ static bool mg_pll_get_hw_state(struct drm_i915_private *dev_priv,
30303020

30313021
static bool icl_pll_get_hw_state(struct drm_i915_private *dev_priv,
30323022
struct intel_shared_dpll *pll,
3033-
struct intel_dpll_hw_state *hw_state)
3023+
struct intel_dpll_hw_state *hw_state,
3024+
i915_reg_t enable_reg)
30343025
{
30353026
const enum intel_dpll_id id = pll->info->id;
30363027
intel_wakeref_t wakeref;
@@ -3042,7 +3033,7 @@ static bool icl_pll_get_hw_state(struct drm_i915_private *dev_priv,
30423033
if (!wakeref)
30433034
return false;
30443035

3045-
val = I915_READ(icl_pll_id_to_enable_reg(id));
3036+
val = I915_READ(enable_reg);
30463037
if (!(val & PLL_ENABLE))
30473038
goto out;
30483039

@@ -3055,6 +3046,21 @@ static bool icl_pll_get_hw_state(struct drm_i915_private *dev_priv,
30553046
return ret;
30563047
}
30573048

3049+
static bool combo_pll_get_hw_state(struct drm_i915_private *dev_priv,
3050+
struct intel_shared_dpll *pll,
3051+
struct intel_dpll_hw_state *hw_state)
3052+
{
3053+
return icl_pll_get_hw_state(dev_priv, pll, hw_state,
3054+
CNL_DPLL_ENABLE(pll->info->id));
3055+
}
3056+
3057+
static bool tbt_pll_get_hw_state(struct drm_i915_private *dev_priv,
3058+
struct intel_shared_dpll *pll,
3059+
struct intel_dpll_hw_state *hw_state)
3060+
{
3061+
return icl_pll_get_hw_state(dev_priv, pll, hw_state, TBT_PLL_ENABLE);
3062+
}
3063+
30583064
static void icl_dpll_write(struct drm_i915_private *dev_priv,
30593065
struct intel_shared_dpll *pll)
30603066
{
@@ -3154,7 +3160,7 @@ static void icl_pll_enable(struct drm_i915_private *dev_priv,
31543160
static void combo_pll_enable(struct drm_i915_private *dev_priv,
31553161
struct intel_shared_dpll *pll)
31563162
{
3157-
i915_reg_t enable_reg = icl_pll_id_to_enable_reg(pll->info->id);
3163+
i915_reg_t enable_reg = CNL_DPLL_ENABLE(pll->info->id);
31583164

31593165
icl_pll_power_enable(dev_priv, pll, enable_reg);
31603166

@@ -3171,6 +3177,24 @@ static void combo_pll_enable(struct drm_i915_private *dev_priv,
31713177
/* DVFS post sequence would be here. See the comment above. */
31723178
}
31733179

3180+
static void tbt_pll_enable(struct drm_i915_private *dev_priv,
3181+
struct intel_shared_dpll *pll)
3182+
{
3183+
icl_pll_power_enable(dev_priv, pll, TBT_PLL_ENABLE);
3184+
3185+
icl_dpll_write(dev_priv, pll);
3186+
3187+
/*
3188+
* DVFS pre sequence would be here, but in our driver the cdclk code
3189+
* paths should already be setting the appropriate voltage, hence we do
3190+
* nothing here.
3191+
*/
3192+
3193+
icl_pll_enable(dev_priv, pll, TBT_PLL_ENABLE);
3194+
3195+
/* DVFS post sequence would be here. See the comment above. */
3196+
}
3197+
31743198
static void mg_pll_enable(struct drm_i915_private *dev_priv,
31753199
struct intel_shared_dpll *pll)
31763200
{
@@ -3232,9 +3256,13 @@ static void icl_pll_disable(struct drm_i915_private *dev_priv,
32323256
static void combo_pll_disable(struct drm_i915_private *dev_priv,
32333257
struct intel_shared_dpll *pll)
32343258
{
3235-
i915_reg_t enable_reg = icl_pll_id_to_enable_reg(pll->info->id);
3259+
icl_pll_disable(dev_priv, pll, CNL_DPLL_ENABLE(pll->info->id));
3260+
}
32363261

3237-
icl_pll_disable(dev_priv, pll, enable_reg);
3262+
static void tbt_pll_disable(struct drm_i915_private *dev_priv,
3263+
struct intel_shared_dpll *pll)
3264+
{
3265+
icl_pll_disable(dev_priv, pll, TBT_PLL_ENABLE);
32383266
}
32393267

32403268
static void mg_pll_disable(struct drm_i915_private *dev_priv,
@@ -3268,10 +3296,16 @@ static void icl_dump_hw_state(struct drm_i915_private *dev_priv,
32683296
hw_state->mg_pll_tdc_coldst_bias);
32693297
}
32703298

3271-
static const struct intel_shared_dpll_funcs icl_pll_funcs = {
3299+
static const struct intel_shared_dpll_funcs combo_pll_funcs = {
32723300
.enable = combo_pll_enable,
32733301
.disable = combo_pll_disable,
3274-
.get_hw_state = icl_pll_get_hw_state,
3302+
.get_hw_state = combo_pll_get_hw_state,
3303+
};
3304+
3305+
static const struct intel_shared_dpll_funcs tbt_pll_funcs = {
3306+
.enable = tbt_pll_enable,
3307+
.disable = tbt_pll_disable,
3308+
.get_hw_state = tbt_pll_get_hw_state,
32753309
};
32763310

32773311
static const struct intel_shared_dpll_funcs mg_pll_funcs = {
@@ -3281,9 +3315,9 @@ static const struct intel_shared_dpll_funcs mg_pll_funcs = {
32813315
};
32823316

32833317
static const struct dpll_info icl_plls[] = {
3284-
{ "DPLL 0", &icl_pll_funcs, DPLL_ID_ICL_DPLL0, 0 },
3285-
{ "DPLL 1", &icl_pll_funcs, DPLL_ID_ICL_DPLL1, 0 },
3286-
{ "TBT PLL", &icl_pll_funcs, DPLL_ID_ICL_TBTPLL, 0 },
3318+
{ "DPLL 0", &combo_pll_funcs, DPLL_ID_ICL_DPLL0, 0 },
3319+
{ "DPLL 1", &combo_pll_funcs, DPLL_ID_ICL_DPLL1, 0 },
3320+
{ "TBT PLL", &tbt_pll_funcs, DPLL_ID_ICL_TBTPLL, 0 },
32873321
{ "MG PLL 1", &mg_pll_funcs, DPLL_ID_ICL_MGPLL1, 0 },
32883322
{ "MG PLL 2", &mg_pll_funcs, DPLL_ID_ICL_MGPLL2, 0 },
32893323
{ "MG PLL 3", &mg_pll_funcs, DPLL_ID_ICL_MGPLL3, 0 },

0 commit comments

Comments
 (0)