Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/i915/rkl: Add DPLL4 support

Rocket Lake has a third DPLL (called 'DPLL4') that must be used to
enable a third display. Unlike EHL's variant of DPLL4, the RKL variant
behaves the same as DPLL0/1. And despite its name, the DPLL4 registers
are offset as if it were DPLL2.

v2:
- Add new .update_ref_clks() hook.

v3:
- Renumber TBT PLL to '3' and switch _MMIO_PLL3 to _MMIO_PLL (Lucas)

v4:
- Don't drop _MMIO_PLL3; although it's now unused, we're going to need
it very soon again for upcoming DG1 patches. (Lucas)

v5:
- Don't re-number TBT PLL and beyond, just use new RKL_DPLL_CFGCR
macros to lookup the proper registers instead. Although renumbering
the PLLs might be something we want to consider down the road, it
opens a big can of worms right now since a bunch of places in the
code have an assumption that the PLL table has idx==id and no holes.
Renumbering creates a hole for TGL, so we'd either need to allow
holes in the table or break the idx==id invariant, both of which are
somewhat invasive changes to the design.

Bspec: 49202
Bspec: 49443
Bspec: 50288
Bspec: 50289
Cc: Lucas De Marchi <lucas.demarchi@intel.com>
Cc: José Roberto de Souza <jose.souza@intel.com>
Signed-off-by: Matt Roper <matthew.d.roper@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20200716220551.2730644-4-matthew.d.roper@intel.com
Reviewed-by: Lucas De Marchi <lucas.demarchi@intel.com>
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>

authored by

Matt Roper and committed by
Rodrigo Vivi
e66f609b f52fa57a

+40 -7
+36 -5
drivers/gpu/drm/i915/display/intel_dpll_mgr.c
··· 3504 3504 3505 3505 icl_calc_dpll_state(dev_priv, &pll_params, &port_dpll->hw_state); 3506 3506 3507 - if (IS_ELKHARTLAKE(dev_priv) && port != PORT_A) 3507 + if (IS_ROCKETLAKE(dev_priv)) { 3508 3508 dpll_mask = 3509 3509 BIT(DPLL_ID_EHL_DPLL4) | 3510 3510 BIT(DPLL_ID_ICL_DPLL1) | 3511 3511 BIT(DPLL_ID_ICL_DPLL0); 3512 - else 3512 + } else if (IS_ELKHARTLAKE(dev_priv) && port != PORT_A) { 3513 + dpll_mask = 3514 + BIT(DPLL_ID_EHL_DPLL4) | 3515 + BIT(DPLL_ID_ICL_DPLL1) | 3516 + BIT(DPLL_ID_ICL_DPLL0); 3517 + } else { 3513 3518 dpll_mask = BIT(DPLL_ID_ICL_DPLL1) | BIT(DPLL_ID_ICL_DPLL0); 3519 + } 3514 3520 3515 3521 port_dpll->pll = intel_find_shared_dpll(state, crtc, 3516 3522 &port_dpll->hw_state, ··· 3797 3791 if (!(val & PLL_ENABLE)) 3798 3792 goto out; 3799 3793 3800 - if (INTEL_GEN(dev_priv) >= 12) { 3794 + if (IS_ROCKETLAKE(dev_priv)) { 3795 + hw_state->cfgcr0 = intel_de_read(dev_priv, 3796 + RKL_DPLL_CFGCR0(id)); 3797 + hw_state->cfgcr1 = intel_de_read(dev_priv, 3798 + RKL_DPLL_CFGCR1(id)); 3799 + } else if (INTEL_GEN(dev_priv) >= 12) { 3801 3800 hw_state->cfgcr0 = intel_de_read(dev_priv, 3802 3801 TGL_DPLL_CFGCR0(id)); 3803 3802 hw_state->cfgcr1 = intel_de_read(dev_priv, ··· 3855 3844 const enum intel_dpll_id id = pll->info->id; 3856 3845 i915_reg_t cfgcr0_reg, cfgcr1_reg; 3857 3846 3858 - if (INTEL_GEN(dev_priv) >= 12) { 3847 + if (IS_ROCKETLAKE(dev_priv)) { 3848 + cfgcr0_reg = RKL_DPLL_CFGCR0(id); 3849 + cfgcr1_reg = RKL_DPLL_CFGCR1(id); 3850 + } else if (INTEL_GEN(dev_priv) >= 12) { 3859 3851 cfgcr0_reg = TGL_DPLL_CFGCR0(id); 3860 3852 cfgcr1_reg = TGL_DPLL_CFGCR1(id); 3861 3853 } else { ··· 4290 4276 .dump_hw_state = icl_dump_hw_state, 4291 4277 }; 4292 4278 4279 + static const struct dpll_info rkl_plls[] = { 4280 + { "DPLL 0", &combo_pll_funcs, DPLL_ID_ICL_DPLL0, 0 }, 4281 + { "DPLL 1", &combo_pll_funcs, DPLL_ID_ICL_DPLL1, 0 }, 4282 + { "DPLL 4", &combo_pll_funcs, DPLL_ID_EHL_DPLL4, 0 }, 4283 + { }, 4284 + }; 4285 + 4286 + static const struct intel_dpll_mgr rkl_pll_mgr = { 4287 + .dpll_info = rkl_plls, 4288 + .get_dplls = icl_get_dplls, 4289 + .put_dplls = icl_put_dplls, 4290 + .update_ref_clks = icl_update_dpll_ref_clks, 4291 + .dump_hw_state = icl_dump_hw_state, 4292 + }; 4293 + 4293 4294 /** 4294 4295 * intel_shared_dpll_init - Initialize shared DPLLs 4295 4296 * @dev: drm device ··· 4318 4289 const struct dpll_info *dpll_info; 4319 4290 int i; 4320 4291 4321 - if (INTEL_GEN(dev_priv) >= 12) 4292 + if (IS_ROCKETLAKE(dev_priv)) 4293 + dpll_mgr = &rkl_pll_mgr; 4294 + else if (INTEL_GEN(dev_priv) >= 12) 4322 4295 dpll_mgr = &tgl_pll_mgr; 4323 4296 else if (IS_ELKHARTLAKE(dev_priv)) 4324 4297 dpll_mgr = &ehl_pll_mgr;
+4 -2
drivers/gpu/drm/i915/i915_reg.h
··· 10511 10511 10512 10512 #define _TGL_DPLL0_CFGCR0 0x164284 10513 10513 #define _TGL_DPLL1_CFGCR0 0x16428C 10514 - /* TODO: add DPLL4 */ 10515 10514 #define _TGL_TBTPLL_CFGCR0 0x16429C 10516 10515 #define TGL_DPLL_CFGCR0(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR0, \ 10517 10516 _TGL_DPLL1_CFGCR0, \ 10518 10517 _TGL_TBTPLL_CFGCR0) 10518 + #define RKL_DPLL_CFGCR0(pll) _MMIO_PLL(pll, _TGL_DPLL0_CFGCR0, \ 10519 + _TGL_DPLL1_CFGCR0) 10519 10520 10520 10521 #define _TGL_DPLL0_CFGCR1 0x164288 10521 10522 #define _TGL_DPLL1_CFGCR1 0x164290 10522 - /* TODO: add DPLL4 */ 10523 10523 #define _TGL_TBTPLL_CFGCR1 0x1642A0 10524 10524 #define TGL_DPLL_CFGCR1(pll) _MMIO_PLL3(pll, _TGL_DPLL0_CFGCR1, \ 10525 10525 _TGL_DPLL1_CFGCR1, \ 10526 10526 _TGL_TBTPLL_CFGCR1) 10527 + #define RKL_DPLL_CFGCR1(pll) _MMIO_PLL(pll, _TGL_DPLL0_CFGCR1, \ 10528 + _TGL_DPLL1_CFGCR1) 10527 10529 10528 10530 #define _DKL_PHY1_BASE 0x168000 10529 10531 #define _DKL_PHY2_BASE 0x169000