Skip to content

Commit a38b323

Browse files
ideakjlahtine-intel
authored andcommitted
drm/i915/ptl: Use everywhere the correct DDI port clock select mask
The PTL XELPDP_PORT_CLOCK_CTL register XELPDP_DDI_CLOCK_SELECT field's size is 5 bits vs. the earlier platforms where its size is 4 bits. Make sure the field is read-out/programmed everywhere correctly, according to the above. Cc: Mika Kahola <[email protected]> Cc: [email protected] # v6.13+ Tested-by: Mika Kahola <[email protected]> Reviewed-by: Mika Kahola <[email protected]> Signed-off-by: Imre Deak <[email protected]> Link: https://lore.kernel.org/r/[email protected] (cherry picked from commit d0bf684) Signed-off-by: Joonas Lahtinen <[email protected]>
1 parent c4f8ac0 commit a38b323

File tree

2 files changed

+21
-21
lines changed

2 files changed

+21
-21
lines changed

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

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -2763,9 +2763,9 @@ static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
27632763
val |= XELPDP_FORWARD_CLOCK_UNGATE;
27642764

27652765
if (!is_dp && is_hdmi_frl(port_clock))
2766-
val |= XELPDP_DDI_CLOCK_SELECT(XELPDP_DDI_CLOCK_SELECT_DIV18CLK);
2766+
val |= XELPDP_DDI_CLOCK_SELECT_PREP(display, XELPDP_DDI_CLOCK_SELECT_DIV18CLK);
27672767
else
2768-
val |= XELPDP_DDI_CLOCK_SELECT(XELPDP_DDI_CLOCK_SELECT_MAXPCLK);
2768+
val |= XELPDP_DDI_CLOCK_SELECT_PREP(display, XELPDP_DDI_CLOCK_SELECT_MAXPCLK);
27692769

27702770
/* TODO: HDMI FRL */
27712771
/* DP2.0 10G and 20G rates enable MPLLA*/
@@ -2776,7 +2776,7 @@ static void intel_program_port_clock_ctl(struct intel_encoder *encoder,
27762776

27772777
intel_de_rmw(display, XELPDP_PORT_CLOCK_CTL(display, encoder->port),
27782778
XELPDP_LANE1_PHY_CLOCK_SELECT | XELPDP_FORWARD_CLOCK_UNGATE |
2779-
XELPDP_DDI_CLOCK_SELECT_MASK | XELPDP_SSC_ENABLE_PLLA |
2779+
XELPDP_DDI_CLOCK_SELECT_MASK(display) | XELPDP_SSC_ENABLE_PLLA |
27802780
XELPDP_SSC_ENABLE_PLLB, val);
27812781
}
27822782

@@ -3099,10 +3099,7 @@ int intel_mtl_tbt_calc_port_clock(struct intel_encoder *encoder)
30993099

31003100
val = intel_de_read(display, XELPDP_PORT_CLOCK_CTL(display, encoder->port));
31013101

3102-
if (DISPLAY_VER(display) >= 30)
3103-
clock = REG_FIELD_GET(XE3_DDI_CLOCK_SELECT_MASK, val);
3104-
else
3105-
clock = REG_FIELD_GET(XELPDP_DDI_CLOCK_SELECT_MASK, val);
3102+
clock = XELPDP_DDI_CLOCK_SELECT_GET(display, val);
31063103

31073104
drm_WARN_ON(display->drm, !(val & XELPDP_FORWARD_CLOCK_UNGATE));
31083105
drm_WARN_ON(display->drm, !(val & XELPDP_TBT_CLOCK_REQUEST));
@@ -3170,13 +3167,9 @@ static void intel_mtl_tbt_pll_enable(struct intel_encoder *encoder,
31703167
* clock muxes, gating and SSC
31713168
*/
31723169

3173-
if (DISPLAY_VER(display) >= 30) {
3174-
mask = XE3_DDI_CLOCK_SELECT_MASK;
3175-
val |= XE3_DDI_CLOCK_SELECT(intel_mtl_tbt_clock_select(display, crtc_state->port_clock));
3176-
} else {
3177-
mask = XELPDP_DDI_CLOCK_SELECT_MASK;
3178-
val |= XELPDP_DDI_CLOCK_SELECT(intel_mtl_tbt_clock_select(display, crtc_state->port_clock));
3179-
}
3170+
mask = XELPDP_DDI_CLOCK_SELECT_MASK(display);
3171+
val |= XELPDP_DDI_CLOCK_SELECT_PREP(display,
3172+
intel_mtl_tbt_clock_select(display, crtc_state->port_clock));
31803173

31813174
mask |= XELPDP_FORWARD_CLOCK_UNGATE;
31823175
val |= XELPDP_FORWARD_CLOCK_UNGATE;
@@ -3289,7 +3282,7 @@ static void intel_cx0pll_disable(struct intel_encoder *encoder)
32893282

32903283
/* 7. Program PORT_CLOCK_CTL register to disable and gate clocks. */
32913284
intel_de_rmw(display, XELPDP_PORT_CLOCK_CTL(display, encoder->port),
3292-
XELPDP_DDI_CLOCK_SELECT_MASK, 0);
3285+
XELPDP_DDI_CLOCK_SELECT_MASK(display), 0);
32933286
intel_de_rmw(display, XELPDP_PORT_CLOCK_CTL(display, encoder->port),
32943287
XELPDP_FORWARD_CLOCK_UNGATE, 0);
32953288

@@ -3338,7 +3331,7 @@ static void intel_mtl_tbt_pll_disable(struct intel_encoder *encoder)
33383331
* 5. Program PORT CLOCK CTRL register to disable and gate clocks
33393332
*/
33403333
intel_de_rmw(display, XELPDP_PORT_CLOCK_CTL(display, encoder->port),
3341-
XELPDP_DDI_CLOCK_SELECT_MASK |
3334+
XELPDP_DDI_CLOCK_SELECT_MASK(display) |
33423335
XELPDP_FORWARD_CLOCK_UNGATE, 0);
33433336

33443337
/* 6. Program DDI_CLK_VALFREQ to 0. */
@@ -3367,7 +3360,7 @@ intel_mtl_port_pll_type(struct intel_encoder *encoder,
33673360
* handling is done via the standard shared DPLL framework.
33683361
*/
33693362
val = intel_de_read(display, XELPDP_PORT_CLOCK_CTL(display, encoder->port));
3370-
clock = REG_FIELD_GET(XELPDP_DDI_CLOCK_SELECT_MASK, val);
3363+
clock = XELPDP_DDI_CLOCK_SELECT_GET(display, val);
33713364

33723365
if (clock == XELPDP_DDI_CLOCK_SELECT_MAXPCLK ||
33733366
clock == XELPDP_DDI_CLOCK_SELECT_DIV18CLK)

drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -192,10 +192,17 @@
192192

193193
#define XELPDP_TBT_CLOCK_REQUEST REG_BIT(19)
194194
#define XELPDP_TBT_CLOCK_ACK REG_BIT(18)
195-
#define XELPDP_DDI_CLOCK_SELECT_MASK REG_GENMASK(15, 12)
196-
#define XE3_DDI_CLOCK_SELECT_MASK REG_GENMASK(16, 12)
197-
#define XELPDP_DDI_CLOCK_SELECT(val) REG_FIELD_PREP(XELPDP_DDI_CLOCK_SELECT_MASK, val)
198-
#define XE3_DDI_CLOCK_SELECT(val) REG_FIELD_PREP(XE3_DDI_CLOCK_SELECT_MASK, val)
195+
#define _XELPDP_DDI_CLOCK_SELECT_MASK REG_GENMASK(15, 12)
196+
#define _XE3_DDI_CLOCK_SELECT_MASK REG_GENMASK(16, 12)
197+
#define XELPDP_DDI_CLOCK_SELECT_MASK(display) (DISPLAY_VER(display) >= 30 ? \
198+
_XE3_DDI_CLOCK_SELECT_MASK : _XELPDP_DDI_CLOCK_SELECT_MASK)
199+
#define XELPDP_DDI_CLOCK_SELECT_PREP(display, val) (DISPLAY_VER(display) >= 30 ? \
200+
REG_FIELD_PREP(_XE3_DDI_CLOCK_SELECT_MASK, (val)) : \
201+
REG_FIELD_PREP(_XELPDP_DDI_CLOCK_SELECT_MASK, (val)))
202+
#define XELPDP_DDI_CLOCK_SELECT_GET(display, val) (DISPLAY_VER(display) >= 30 ? \
203+
REG_FIELD_GET(_XE3_DDI_CLOCK_SELECT_MASK, (val)) : \
204+
REG_FIELD_GET(_XELPDP_DDI_CLOCK_SELECT_MASK, (val)))
205+
199206
#define XELPDP_DDI_CLOCK_SELECT_NONE 0x0
200207
#define XELPDP_DDI_CLOCK_SELECT_MAXPCLK 0x8
201208
#define XELPDP_DDI_CLOCK_SELECT_DIV18CLK 0x9

0 commit comments

Comments
 (0)