Skip to content

Commit 995e9bc

Browse files
zehortigozarodrigovivi
authored andcommitted
drm/i915/display/dg1: Correctly map DPLLs during state readout
_DG1_DPCLKA0_CFGCR0 maps between DPLL 0 and 1 with one bit for phy A and B while _DG1_DPCLKA1_CFGCR0 maps between DPLL 2 and 3 with one bit for phy C and D. Reusing _cnl_ddi_get_pll() don't take that into cosideration returing DPLL 0 and 1 for phy C and D. That is a regression introduced in the refactor done in commit 351221f ("drm/i915: Move DDI clock readout to encoder->get_config()"). While at it also dropping the macros previously used, not reusing it to improve readability. BSpec: 50286 Fixes: 351221f ("drm/i915: Move DDI clock readout to encoder->get_config()") Cc: Lucas De Marchi <[email protected]> Cc: Ville Syrjälä <[email protected]> Signed-off-by: José Roberto de Souza <[email protected]> Reviewed-by: Lucas De Marchi <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected] (cherry picked from commit 3352d86) Signed-off-by: Rodrigo Vivi <[email protected]>
1 parent 07b7296 commit 995e9bc

File tree

2 files changed

+16
-6
lines changed

2 files changed

+16
-6
lines changed

drivers/gpu/drm/i915/display/intel_ddi.c

Lines changed: 16 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1791,10 +1791,23 @@ static struct intel_shared_dpll *dg1_ddi_get_pll(struct intel_encoder *encoder)
17911791
{
17921792
struct drm_i915_private *i915 = to_i915(encoder->base.dev);
17931793
enum phy phy = intel_port_to_phy(i915, encoder->port);
1794+
enum intel_dpll_id id;
1795+
u32 val;
17941796

1795-
return _cnl_ddi_get_pll(i915, DG1_DPCLKA_CFGCR0(phy),
1796-
DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy),
1797-
DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy));
1797+
val = intel_de_read(i915, DG1_DPCLKA_CFGCR0(phy));
1798+
val &= DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy);
1799+
val >>= DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy);
1800+
id = val;
1801+
1802+
/*
1803+
* _DG1_DPCLKA0_CFGCR0 maps between DPLL 0 and 1 with one bit for phy A
1804+
* and B while _DG1_DPCLKA1_CFGCR0 maps between DPLL 2 and 3 with one
1805+
* bit for phy C and D.
1806+
*/
1807+
if (phy >= PHY_C)
1808+
id += DPLL_ID_DG1_DPLL2;
1809+
1810+
return intel_get_shared_dpll_by_id(i915, id);
17981811
}
17991812

18001813
static void icl_ddi_combo_enable_clock(struct intel_encoder *encoder,

drivers/gpu/drm/i915/i915_reg.h

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10513,16 +10513,13 @@ enum skl_power_gate {
1051310513
#define _DG1_DPCLKA1_CFGCR0 0x16C280
1051410514
#define _DG1_DPCLKA_PHY_IDX(phy) ((phy) % 2)
1051510515
#define _DG1_DPCLKA_PLL_IDX(pll) ((pll) % 2)
10516-
#define _DG1_PHY_DPLL_MAP(phy) ((phy) >= PHY_C ? DPLL_ID_DG1_DPLL2 : DPLL_ID_DG1_DPLL0)
1051710516
#define DG1_DPCLKA_CFGCR0(phy) _MMIO_PHY((phy) / 2, \
1051810517
_DG1_DPCLKA_CFGCR0, \
1051910518
_DG1_DPCLKA1_CFGCR0)
1052010519
#define DG1_DPCLKA_CFGCR0_DDI_CLK_OFF(phy) REG_BIT(_DG1_DPCLKA_PHY_IDX(phy) + 10)
1052110520
#define DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy) (_DG1_DPCLKA_PHY_IDX(phy) * 2)
1052210521
#define DG1_DPCLKA_CFGCR0_DDI_CLK_SEL(pll, phy) (_DG1_DPCLKA_PLL_IDX(pll) << DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
1052310522
#define DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_MASK(phy) (0x3 << DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy))
10524-
#define DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_DPLL_MAP(clk_sel, phy) \
10525-
(((clk_sel) >> DG1_DPCLKA_CFGCR0_DDI_CLK_SEL_SHIFT(phy)) + _DG1_PHY_DPLL_MAP(phy))
1052610523

1052710524
/* ADLS Clocks */
1052810525
#define _ADLS_DPCLKA_CFGCR0 0x164280

0 commit comments

Comments
 (0)