diff options
author | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2018-03-28 17:57:59 -0400 |
---|---|---|
committer | Paulo Zanoni <paulo.r.zanoni@intel.com> | 2018-05-07 19:44:08 -0400 |
commit | febafb93181e4fb4de19f4484df62ce2d04155aa (patch) | |
tree | 322fc1f1b3dca941ed7f7137664905981eaeee51 | |
parent | c27e917e2bda748777b7927d7cb7c911bc2027c8 (diff) |
drm/i915/icl: compute the combo PHY (DPLL) HDMI registers
HDMI mode DPLL programming on ICL is the same as CNL, so just reuse
the CNL code.
v2:
- Properly detect HDMI crtcs.
- Rebase after changes to the cnl function (clock * 1000).
v3:
- Add a comment to clarify why we treat 38.4 as 19.2 (James).
Reviewed-by: James Ausmus <james.ausmus@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180328215803.13835-5-paulo.r.zanoni@intel.com
-rw-r--r-- | drivers/gpu/drm/i915/intel_dpll_mgr.c | 39 |
1 files changed, 36 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_dpll_mgr.c b/drivers/gpu/drm/i915/intel_dpll_mgr.c index 14f5414ceab2..a1c2bd10a72e 100644 --- a/drivers/gpu/drm/i915/intel_dpll_mgr.c +++ b/drivers/gpu/drm/i915/intel_dpll_mgr.c | |||
@@ -2218,6 +2218,7 @@ cnl_ddi_calculate_wrpll(int clock, | |||
2218 | struct skl_wrpll_params *wrpll_params) | 2218 | struct skl_wrpll_params *wrpll_params) |
2219 | { | 2219 | { |
2220 | u32 afe_clock = clock * 5; | 2220 | u32 afe_clock = clock * 5; |
2221 | uint32_t ref_clock; | ||
2221 | u32 dco_min = 7998000; | 2222 | u32 dco_min = 7998000; |
2222 | u32 dco_max = 10000000; | 2223 | u32 dco_max = 10000000; |
2223 | u32 dco_mid = (dco_min + dco_max) / 2; | 2224 | u32 dco_mid = (dco_min + dco_max) / 2; |
@@ -2250,8 +2251,17 @@ cnl_ddi_calculate_wrpll(int clock, | |||
2250 | 2251 | ||
2251 | cnl_wrpll_get_multipliers(best_div, &pdiv, &qdiv, &kdiv); | 2252 | cnl_wrpll_get_multipliers(best_div, &pdiv, &qdiv, &kdiv); |
2252 | 2253 | ||
2253 | cnl_wrpll_params_populate(wrpll_params, best_dco, | 2254 | ref_clock = dev_priv->cdclk.hw.ref; |
2254 | dev_priv->cdclk.hw.ref, pdiv, qdiv, kdiv); | 2255 | |
2256 | /* | ||
2257 | * For ICL, the spec states: if reference frequency is 38.4, use 19.2 | ||
2258 | * because the DPLL automatically divides that by 2. | ||
2259 | */ | ||
2260 | if (IS_ICELAKE(dev_priv) && ref_clock == 38400) | ||
2261 | ref_clock = 19200; | ||
2262 | |||
2263 | cnl_wrpll_params_populate(wrpll_params, best_dco, ref_clock, pdiv, qdiv, | ||
2264 | kdiv); | ||
2255 | 2265 | ||
2256 | return true; | 2266 | return true; |
2257 | } | 2267 | } |
@@ -2403,7 +2413,30 @@ static bool icl_calc_dpll_state(struct intel_crtc_state *crtc_state, | |||
2403 | struct intel_encoder *encoder, int clock, | 2413 | struct intel_encoder *encoder, int clock, |
2404 | struct intel_dpll_hw_state *pll_state) | 2414 | struct intel_dpll_hw_state *pll_state) |
2405 | { | 2415 | { |
2406 | /* TODO */ | 2416 | struct drm_i915_private *dev_priv = to_i915(encoder->base.dev); |
2417 | uint32_t cfgcr0, cfgcr1; | ||
2418 | struct skl_wrpll_params pll_params = { 0 }; | ||
2419 | bool ret; | ||
2420 | |||
2421 | if (intel_crtc_has_type(crtc_state, INTEL_OUTPUT_HDMI)) | ||
2422 | ret = cnl_ddi_calculate_wrpll(clock, dev_priv, &pll_params); | ||
2423 | else | ||
2424 | ret = false; /* TODO */ | ||
2425 | |||
2426 | if (!ret) | ||
2427 | return false; | ||
2428 | |||
2429 | cfgcr0 = DPLL_CFGCR0_DCO_FRACTION(pll_params.dco_fraction) | | ||
2430 | pll_params.dco_integer; | ||
2431 | |||
2432 | cfgcr1 = DPLL_CFGCR1_QDIV_RATIO(pll_params.qdiv_ratio) | | ||
2433 | DPLL_CFGCR1_QDIV_MODE(pll_params.qdiv_mode) | | ||
2434 | DPLL_CFGCR1_KDIV(pll_params.kdiv) | | ||
2435 | DPLL_CFGCR1_PDIV(pll_params.pdiv) | | ||
2436 | DPLL_CFGCR1_CENTRAL_FREQ_8400; | ||
2437 | |||
2438 | pll_state->cfgcr0 = cfgcr0; | ||
2439 | pll_state->cfgcr1 = cfgcr1; | ||
2407 | return true; | 2440 | return true; |
2408 | } | 2441 | } |
2409 | 2442 | ||