drm/i915/display: Fix C20 PHY PLL DP/HDMI mode programming
Subsystems (3)
cover drm/i915/display: Fix C20 PHY PLL DP/HDMI mode programming
This patchset fixes the DP/HDMI mode programming for C20 PHY PLLs. While at it, it also adds the missing port clock HW readout for C10 PHY PLLs.
These patches were originally part of the RFC PLL rework patch series [1], now resent separately since they include a fix, which as such should be tested/merged separately.
[1] https://lore.kernel.org/all/[email protected]
Imre Deak (7):
drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/DP_RATE
field macros
drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/IS_DP flag
macro
drm/i915/display: Sanitize
PHY_C20_VDR_CUSTOM_SERDES_RATE/CONTEXT_TOGGLE flag macro
drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/IS_HDMI_FRL
flag macro
drm/i915/display: Fix PHY_C20_VDR_CUSTOM_SERDES_RATE programming drm/i915/display: Fix PHY_C20_VDR_HDMI_RATE programming drm/i915/display: Add missing clock to C10 PHY state compute/HW
readout
drivers/gpu/drm/i915/display/intel_cx0_phy.c | 43 ++++++++++++------- .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 10 +++-- .../drm/i915/display/intel_snps_hdmi_pll.c | 2 + 3 files changed, 36 insertions(+), 19 deletions(-)
Signature · 1 line
2.34.1
PATCH 1/7 drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/DP_RATE field macros
From: Imre Deak <[email protected]>
Rename the PHY_C20_CUSTOM_SERDES / PHY_C20_CUSTOM_SERDES_MASK register field names to PHY_C20_DP_RATE / PHY_C20_DP_RATE_MASK, and move the definitions under the actual register containing the fields.
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 6 +++--- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +3 -3
@@ -2700,12 +2700,12 @@ static void intel_c20_pll_program(struct intel_display *display,/* 5. For DP or 6. For HDMI */ if (is_dp) {intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -BIT (6 ) |PHY_C20_CUSTOM_SERDES_MASK , -BIT (6 ) |PHY_C20_CUSTOM_SERDES (intel_c20_get_dp_rate (port_clock)), +BIT (6 ) |PHY_C20_DP_RATE_MASK , +BIT (6 ) |PHY_C20_DP_RATE (intel_c20_get_dp_rate (port_clock)),MB_WRITE_COMMITTED ); }else {intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -BIT (7 ) |PHY_C20_CUSTOM_SERDES_MASK , +BIT (7 ) |PHY_C20_DP_RATE_MASK ,is_hdmi_frl (port_clock) ?BIT (7 ) :0 ,MB_WRITE_COMMITTED );
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2 -2
@@ -298,10 +298,10 @@#define PHY_C20_RD_DATA_L 0xC08#define PHY_C20_RD_DATA_H 0xC09#define PHY_C20_VDR_CUSTOM_SERDES_RATE 0xD00 +#define PHY_C20_DP_RATE_MASK REG_GENMASK8(4, 1) +#define PHY_C20_DP_RATE (val) REG_FIELD_PREP8(PHY_C20_DP_RATE_MASK, val)#define PHY_C20_VDR_HDMI_RATE 0xD01#define PHY_C20_CONTEXT_TOGGLE REG_BIT8(0) -#define PHY_C20_CUSTOM_SERDES_MASK REG_GENMASK8(4, 1) -#define PHY_C20_CUSTOM_SERDES (val) REG_FIELD_PREP8(PHY_C20_CUSTOM_SERDES_MASK, val)#define PHY_C20_VDR_CUSTOM_WIDTH 0xD02#define PHY_C20_CUSTOM_WIDTH_MASK REG_GENMASK(1, 0)#define PHY_C20_CUSTOM_WIDTH (val) REG_FIELD_PREP8(PHY_C20_CUSTOM_WIDTH_MASK, val)
Signature · 1 line
2.34.1
Re: [PATCH 1/7] drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/DP_RATE field macros
Quoted 40 lines · Mika Kahola
From: Imre Deak <[email protected]>
Rename the
PHY_C20_CUSTOM_SERDES/PHY_C20_CUSTOM_SERDES_MASKregister field names toPHY_C20_DP_RATE/PHY_C20_DP_RATE_MASK, and move the definitions under the actual register containing the fields.Signed-off-by Imre Deak <[email protected]>Signed-off-by Mika Kahola <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 6 +++--- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 4 ++-- 2 files changed, 5 insertions(+), 5 deletions(-)drivers/gpu/drm/i915/display/intel_cx0_phy.c +3
-3@@ -2700,12 +2700,12 @@ static void intel_c20_pll_program(struct intel_display *display,/* 5. For DP or 6. For HDMI */ if (is_dp) {intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -BIT (6 ) |PHY_C20_CUSTOM_SERDES_MASK , -BIT (6 ) |PHY_C20_CUSTOM_SERDES (intel_c20_get_dp_rate (port_clock)), +BIT (6 ) |PHY_C20_DP_RATE_MASK , +BIT (6 ) |PHY_C20_DP_RATE (intel_c20_get_dp_rate (port_clock)),MB_WRITE_COMMITTED ); }else {intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -BIT (7 ) |PHY_C20_CUSTOM_SERDES_MASK , +BIT (7 ) |PHY_C20_DP_RATE_MASK ,is_hdmi_frl (port_clock) ?BIT (7 ) :0 ,MB_WRITE_COMMITTED );drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-0@@ -298,10 +298,10 @@#define PHY_C20_RD_DATA_L 0xC08#define PHY_C20_RD_DATA_H 0xC09
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 307
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-2#define PHY_C20_VDR_CUSTOM_SERDES_RATE 0xD00 +#define PHY_C20_DP_RATE_MASK REG_GENMASK8(4, 1) +#define PHY_C20_DP_RATE (val) REG_FIELD_PREP8(PHY_C20_DP_RATE_MASK, val)#define PHY_C20_VDR_HDMI_RATE 0xD01#define PHY_C20_CONTEXT_TOGGLE REG_BIT8(0) -#define PHY_C20_CUSTOM_SERDES_MASK REG_GENMASK8(4, 1) -#define PHY_C20_CUSTOM_SERDES (val) REG_FIELD_PREP8(PHY_C20_CUSTOM_SERDES_MASK, val)#define PHY_C20_VDR_CUSTOM_WIDTH 0xD02#define PHY_C20_CUSTOM_WIDTH_MASK REG_GENMASK(1, 0)#define PHY_C20_CUSTOM_WIDTH (val) REG_FIELD_PREP8(PHY_C20_CUSTOM_WIDTH_MASK, val)
--
Cheers,
Luca.
PATCH 2/7 drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/IS_DP flag macro
In reply to Mika KaholaFrom: Imre Deak <[email protected]>
Define PHY_C20_IS_DP, so it can be used instead of the plain bit number.
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 4 ++-- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -2
@@ -2700,8 +2700,8 @@ static void intel_c20_pll_program(struct intel_display *display,/* 5. For DP or 6. For HDMI */ if (is_dp) {intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -BIT (6 ) |PHY_C20_DP_RATE_MASK , -BIT (6 ) |PHY_C20_DP_RATE (intel_c20_get_dp_rate (port_clock)), +PHY_C20_IS_DP |PHY_C20_DP_RATE_MASK , +PHY_C20_IS_DP |PHY_C20_DP_RATE (intel_c20_get_dp_rate (port_clock)),MB_WRITE_COMMITTED ); }else { intel_cx0_rmw(encoder, owned_lane_mask, PHY_C20_VDR_CUSTOM_SERDES_RATE,
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1 -0
@@ -298,6 +298,7 @@#define PHY_C20_RD_DATA_L 0xC08#define PHY_C20_RD_DATA_H 0xC09#define PHY_C20_VDR_CUSTOM_SERDES_RATE 0xD00 +#define PHY_C20_IS_DP REG_BIT8(6)#define PHY_C20_DP_RATE_MASK REG_GENMASK8(4, 1)#define PHY_C20_DP_RATE (val) REG_FIELD_PREP8(PHY_C20_DP_RATE_MASK, val)#define PHY_C20_VDR_HDMI_RATE 0xD01
Signature · 1 line
2.34.1
Re: [PATCH 2/7] drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/IS_DP flag macro
Quoted 31 lines · Mika Kahola
From: Imre Deak <[email protected]>
Define
PHY_C20_IS_DP, so it can be used instead of the plain bit number.Signed-off-by Imre Deak <[email protected]>Signed-off-by Mika Kahola <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 4 ++-- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-2@@ -2700,8 +2700,8 @@ static void intel_c20_pll_program(struct intel_display *display,/* 5. For DP or 6. For HDMI */ if (is_dp) {intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -BIT (6 ) |PHY_C20_DP_RATE_MASK , -BIT (6 ) |PHY_C20_DP_RATE (intel_c20_get_dp_rate (port_clock)), +PHY_C20_IS_DP |PHY_C20_DP_RATE_MASK , +PHY_C20_IS_DP |PHY_C20_DP_RATE (intel_c20_get_dp_rate (port_clock)),MB_WRITE_COMMITTED ); }else { intel_cx0_rmw(encoder, owned_lane_mask, PHY_C20_VDR_CUSTOM_SERDES_RATE,drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-0
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 304
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1
-0@@ -298,6 +298,7 @@#define PHY_C20_RD_DATA_L 0xC08#define PHY_C20_RD_DATA_H 0xC09#define PHY_C20_VDR_CUSTOM_SERDES_RATE 0xD00 +#define PHY_C20_IS_DP REG_BIT8(6)#define PHY_C20_DP_RATE_MASK REG_GENMASK8(4, 1)#define PHY_C20_DP_RATE (val) REG_FIELD_PREP8(PHY_C20_DP_RATE_MASK, val)#define PHY_C20_VDR_HDMI_RATE 0xD01
--
Cheers,
Luca.
PATCH 3/7 drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/CONTEXT_TOGGLE flag macro
In reply to Mika KaholaFrom: Imre Deak <[email protected]>
Move the PHY_C20_CONTEXT_TOGGLE flag's definition under the register containing the flag and refer to the flag always by its name instead of a plain bit number.
v2: Amend commit log to match what the patch does. (Jani)
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 6 ++++-- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +4 -2
@@ -2628,7 +2628,8 @@ static void intel_c20_pll_program(struct intel_display *display,int i;/* 1. Read current context selection */ - cntx =intel_cx0_read (encoder,INTEL_CX0_LANE0 ,PHY_C20_VDR_CUSTOM_SERDES_RATE ) &BIT (0 ); + cntx =intel_cx0_read (encoder,INTEL_CX0_LANE0 ,PHY_C20_VDR_CUSTOM_SERDES_RATE ) & +PHY_C20_CONTEXT_TOGGLE ;/* * 2. If there is a protocol switch from HDMI to DP or vice versa, clear
@@ -2719,7 +2720,8 @@ static void intel_c20_pll_program(struct intel_display *display,* the updated programming toggle context bit */ intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -BIT (0 ), cntx ?0 :1 ,MB_WRITE_COMMITTED ); +PHY_C20_CONTEXT_TOGGLE , cntx ?0 :PHY_C20_CONTEXT_TOGGLE , +MB_WRITE_COMMITTED ); } static int intel_c10pll_calc_port_clock(struct intel_encoder *encoder,
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1 -1
@@ -301,8 +301,8 @@#define PHY_C20_IS_DP REG_BIT8(6)#define PHY_C20_DP_RATE_MASK REG_GENMASK8(4, 1)#define PHY_C20_DP_RATE (val) REG_FIELD_PREP8(PHY_C20_DP_RATE_MASK, val) -#define PHY_C20_VDR_HDMI_RATE 0xD01#define PHY_C20_CONTEXT_TOGGLE REG_BIT8(0) +#define PHY_C20_VDR_HDMI_RATE 0xD01#define PHY_C20_VDR_CUSTOM_WIDTH 0xD02#define PHY_C20_CUSTOM_WIDTH_MASK REG_GENMASK(1, 0)#define PHY_C20_CUSTOM_WIDTH (val) REG_FIELD_PREP8(PHY_C20_CUSTOM_WIDTH_MASK, val)
Signature · 1 line
2.34.1
Re: [PATCH 3/7] drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/CONTEXT_TOGGLE flag macro
Quoted 44 lines · Mika Kahola
From: Imre Deak <[email protected]>
Move the
PHY_C20_CONTEXT_TOGGLEflag's definition under the register containing the flag and refer to the flag always by its name instead of a plain bit number.v2: Amend commit log to match what the patch does. (Jani)
Cc Jani Nikula <[email protected]>Signed-off-by Imre Deak <[email protected]>Signed-off-by Mika Kahola <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 6 ++++-- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 2 +- 2 files changed, 5 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/display/intel_cx0_phy.c +4
-2@@ -2628,7 +2628,8 @@ static void intel_c20_pll_program(struct intel_display *display,int i;/* 1. Read current context selection */ - cntx =intel_cx0_read (encoder,INTEL_CX0_LANE0 ,PHY_C20_VDR_CUSTOM_SERDES_RATE ) &BIT (0 ); + cntx =intel_cx0_read (encoder,INTEL_CX0_LANE0 ,PHY_C20_VDR_CUSTOM_SERDES_RATE ) & +PHY_C20_CONTEXT_TOGGLE ;/* * 2. If there is a protocol switch from HDMI to DP or vice versa, clear @@ -2719,7 +2720,8 @@ static void intel_c20_pll_program(struct intel_display *display,* the updated programming toggle context bit */ intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -BIT (0 ), cntx ?0 :1 ,MB_WRITE_COMMITTED ); +PHY_C20_CONTEXT_TOGGLE , cntx ?0 :PHY_C20_CONTEXT_TOGGLE , +MB_WRITE_COMMITTED ); } static int intel_c10pll_calc_port_clock(struct intel_encoder *encoder,drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-0
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 308
Quoted 9 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1
-1@@ -301,8 +301,8 @@#define PHY_C20_IS_DP REG_BIT8(6)#define PHY_C20_DP_RATE_MASK REG_GENMASK8(4, 1)#define PHY_C20_DP_RATE (val) REG_FIELD_PREP8(PHY_C20_DP_RATE_MASK, val) -#define PHY_C20_VDR_HDMI_RATE 0xD01#define PHY_C20_CONTEXT_TOGGLE REG_BIT8(0) +#define PHY_C20_VDR_HDMI_RATE 0xD01#define PHY_C20_VDR_CUSTOM_WIDTH 0xD02#define PHY_C20_CUSTOM_WIDTH_MASK REG_GENMASK(1, 0)#define PHY_C20_CUSTOM_WIDTH (val) REG_FIELD_PREP8(PHY_C20_CUSTOM_WIDTH_MASK, val)
--
Cheers,
Luca.
PATCH 4/7 drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/IS_HDMI_FRL flag macro
In reply to Mika KaholaFrom: Imre Deak <[email protected]>
Define PHY_C20_IS_HDMI_FRL, so it can be used instead of the plain bit number.
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 4 ++-- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -2
@@ -2706,8 +2706,8 @@ static void intel_c20_pll_program(struct intel_display *display, MB_WRITE_COMMITTED); }else {intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -BIT (7 ) |PHY_C20_DP_RATE_MASK , -is_hdmi_frl (port_clock) ?BIT (7 ) :0 , +PHY_C20_IS_HDMI_FRL |PHY_C20_DP_RATE_MASK , +is_hdmi_frl (port_clock) ?PHY_C20_IS_HDMI_FRL :0 ,MB_WRITE_COMMITTED ); intel_cx0_write(encoder, INTEL_CX0_BOTH_LANES, PHY_C20_VDR_HDMI_RATE,
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1 -0
@@ -298,6 +298,7 @@#define PHY_C20_RD_DATA_L 0xC08#define PHY_C20_RD_DATA_H 0xC09#define PHY_C20_VDR_CUSTOM_SERDES_RATE 0xD00 +#define PHY_C20_IS_HDMI_FRL REG_BIT8(7)#define PHY_C20_IS_DP REG_BIT8(6)#define PHY_C20_DP_RATE_MASK REG_GENMASK8(4, 1)#define PHY_C20_DP_RATE (val) REG_FIELD_PREP8(PHY_C20_DP_RATE_MASK, val)
Signature · 1 line
2.34.1
Re: [PATCH 4/7] drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/IS_HDMI_FRL flag macro
Quoted 31 lines · Mika Kahola
From: Imre Deak <[email protected]>
Define
PHY_C20_IS_HDMI_FRL, so it can be used instead of the plain bit number.Signed-off-by Imre Deak <[email protected]>Signed-off-by Mika Kahola <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 4 ++-- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 1 + 2 files changed, 3 insertions(+), 2 deletions(-)drivers/gpu/drm/i915/display/intel_cx0_phy.c +2
-2@@ -2706,8 +2706,8 @@ static void intel_c20_pll_program(struct intel_display *display, MB_WRITE_COMMITTED); }else {intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -BIT (7 ) |PHY_C20_DP_RATE_MASK , -is_hdmi_frl (port_clock) ?BIT (7 ) :0 , +PHY_C20_IS_HDMI_FRL |PHY_C20_DP_RATE_MASK , +is_hdmi_frl (port_clock) ?PHY_C20_IS_HDMI_FRL :0 ,MB_WRITE_COMMITTED ); intel_cx0_write(encoder, INTEL_CX0_BOTH_LANES, PHY_C20_VDR_HDMI_RATE,drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-0
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 304
Quoted 7 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1
-0@@ -298,6 +298,7 @@#define PHY_C20_RD_DATA_L 0xC08#define PHY_C20_RD_DATA_H 0xC09#define PHY_C20_VDR_CUSTOM_SERDES_RATE 0xD00 +#define PHY_C20_IS_HDMI_FRL REG_BIT8(7)#define PHY_C20_IS_DP REG_BIT8(6)#define PHY_C20_DP_RATE_MASK REG_GENMASK8(4, 1)#define PHY_C20_DP_RATE (val) REG_FIELD_PREP8(PHY_C20_DP_RATE_MASK, val)
--
Cheers,
Luca.
PATCH 5/7 drm/i915/display: Fix PHY_C20_VDR_CUSTOM_SERDES_RATE programming
In reply to Mika KaholaFrom: Imre Deak <[email protected]>
Make sure all the DP/HDMI/HDMI-FRL flags are programmed in all the modes the PLL is configured.
Atm the DP mode flag is not programmed in case the PLL is configured for HDMI mode for instance. This is incorrect after HW reset, since the DP mode flag is asserted after reset, hence would need to be cleared for HDMI, but also incorrect because of the same reason after configuring the PLL to HDMI mode after it was used in DP mode (for instance on a DP++ connector).
There is a similar issue with the HDMI-FRL flag, potentially remaining set when configuring the PLL in DP mode.
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +14 -11
@@ -2624,6 +2624,7 @@ static void intel_c20_pll_program(struct intel_display *display, bool is_dp, int port_clock) {u8 owned_lane_mask =intel_cx0_get_owned_lane_mask (encoder); +u8 serdes;bool cntx;int i;
@@ -2699,21 +2700,23 @@ static void intel_c20_pll_program(struct intel_display *display, MB_WRITE_COMMITTED);/* 5. For DP or 6. For HDMI */ -if (is_dp) { -intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -PHY_C20_IS_DP |PHY_C20_DP_RATE_MASK , -PHY_C20_IS_DP |PHY_C20_DP_RATE (intel_c20_get_dp_rate (port_clock)), -MB_WRITE_COMMITTED ); - }else { -intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -PHY_C20_IS_HDMI_FRL |PHY_C20_DP_RATE_MASK , -is_hdmi_frl (port_clock) ?PHY_C20_IS_HDMI_FRL :0 , -MB_WRITE_COMMITTED ); + serdes =0 ; + +if (is_dp) + serdes =PHY_C20_IS_DP | +PHY_C20_DP_RATE (intel_c20_get_dp_rate (port_clock)); +else if (is_hdmi_frl (port_clock)) + serdes =PHY_C20_IS_HDMI_FRL ; +intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , +PHY_C20_IS_DP |PHY_C20_DP_RATE_MASK |PHY_C20_IS_HDMI_FRL , + serdes, +MB_WRITE_COMMITTED ); + +if (!is_dp)intel_cx0_write (encoder,INTEL_CX0_BOTH_LANES ,PHY_C20_VDR_HDMI_RATE ,intel_c20_get_hdmi_rate (port_clock),MB_WRITE_COMMITTED ); - }/* * 7. Write Vendor specific registers to toggle context setting to load
Signature · 1 line
2.34.1
Re: [PATCH 5/7] drm/i915/display: Fix PHY_C20_VDR_CUSTOM_SERDES_RATE programming
Quoted 58 lines · Mika Kahola
From: Imre Deak <[email protected]>
Make sure all the DP/HDMI/HDMI-FRL flags are programmed in all the modes the PLL is configured.
Atm the DP mode flag is not programmed in case the PLL is configured for HDMI mode for instance. This is incorrect after HW reset, since the DP mode flag is asserted after reset, hence would need to be cleared for HDMI, but also incorrect because of the same reason after configuring the PLL to HDMI mode after it was used in DP mode (for instance on a DP++ connector).
There is a similar issue with the HDMI-FRL flag, potentially remaining set when configuring the PLL in DP mode.
Signed-off-by Imre Deak <[email protected]>Signed-off-by Mika Kahola <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 25 +++++++++++--------- 1 file changed, 14 insertions(+), 11 deletions(-)drivers/gpu/drm/i915/display/intel_cx0_phy.c +11
-10@@ -2624,6 +2624,7 @@ static void intel_c20_pll_program(struct intel_display *display, bool is_dp, int port_clock) {u8 owned_lane_mask =intel_cx0_get_owned_lane_mask (encoder); +u8 serdes;bool cntx;int i;@@ -2699,21 +2700,23 @@ static void intel_c20_pll_program(struct intel_display *display, MB_WRITE_COMMITTED);/* 5. For DP or 6. For HDMI */ -if (is_dp) { -intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -PHY_C20_IS_DP |PHY_C20_DP_RATE_MASK , -PHY_C20_IS_DP |PHY_C20_DP_RATE (intel_c20_get_dp_rate (port_clock)), -MB_WRITE_COMMITTED ); - }else { -intel_cx0_rmw (encoder, owned_lane_mask,PHY_C20_VDR_CUSTOM_SERDES_RATE , -PHY_C20_IS_HDMI_FRL |PHY_C20_DP_RATE_MASK , -is_hdmi_frl (port_clock) ?PHY_C20_IS_HDMI_FRL :0 , -MB_WRITE_COMMITTED ); + serdes =0 ; + +if (is_dp) + serdes =PHY_C20_IS_DP | +PHY_C20_DP_RATE (intel_c20_get_dp_rate (port_clock)); +else if (is_hdmi_frl (port_clock)) + serdes =PHY_C20_IS_HDMI_FRL ; + intel_cx0_rmw(encoder, owned_lane_mask, PHY_C20_VDR_CUSTOM_SERDES_RATE, + PHY_C20_IS_DP | PHY_C20_DP_RATE_MASK | PHY_C20_IS_HDMI_FRL, + serdes,
drivers/gpu/drm/i915/display/intel_cx0_phy.c static void intel_c20_pll_program(struct intel_display *display, · line 2722
Quoted 10 lines
drivers/gpu/drm/i915/display/intel_cx0_phy.c +3
-1+ MB_WRITE_COMMITTED); + +if (!is_dp)intel_cx0_write (encoder,INTEL_CX0_BOTH_LANES ,PHY_C20_VDR_HDMI_RATE ,intel_c20_get_hdmi_rate (port_clock),MB_WRITE_COMMITTED ); - }/* * 7. Write Vendor specific registers to toggle context setting to load
Seems to match the bspec.
--
Cheers,
Luca.
PATCH 6/7 drm/i915/display: Fix PHY_C20_VDR_HDMI_RATE programming
In reply to Mika KaholaFrom: Imre Deak <[email protected]>
The PHY_C20_VDR_HDMI_RATE registers 7:2 bits are reserved and they are not specified as a must-be-zero field. Accordingly this reserved field shouldn't be zeroed; to ensure that use an RMW to update the PHY_C20_HDMI_RATE field (which is bits 1:0 of the register).
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 7 ++++--- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +4 -3
@@ -2714,9 +2714,10 @@ static void intel_c20_pll_program(struct intel_display *display, MB_WRITE_COMMITTED);if (!is_dp) -intel_cx0_write (encoder,INTEL_CX0_BOTH_LANES ,PHY_C20_VDR_HDMI_RATE , -intel_c20_get_hdmi_rate (port_clock), -MB_WRITE_COMMITTED ); +intel_cx0_rmw (encoder,INTEL_CX0_BOTH_LANES ,PHY_C20_VDR_HDMI_RATE , +PHY_C20_HDMI_RATE_MASK , +intel_c20_get_hdmi_rate (port_clock), +MB_WRITE_COMMITTED );/* * 7. Write Vendor specific registers to toggle context setting to load
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2 -0
@@ -304,6 +304,8 @@#define PHY_C20_DP_RATE (val) REG_FIELD_PREP8(PHY_C20_DP_RATE_MASK, val)#define PHY_C20_CONTEXT_TOGGLE REG_BIT8(0)#define PHY_C20_VDR_HDMI_RATE 0xD01 +#define PHY_C20_HDMI_RATE_MASK REG_GENMASK8(1, 0) +#define PHY_C20_HDMI_RATE (val) REG_FIELD_PREP8(PHY_C20_HDMI_RATE_MASK, val)#define PHY_C20_VDR_CUSTOM_WIDTH 0xD02#define PHY_C20_CUSTOM_WIDTH_MASK REG_GENMASK(1, 0)#define PHY_C20_CUSTOM_WIDTH (val) REG_FIELD_PREP8(PHY_C20_CUSTOM_WIDTH_MASK, val)
Signature · 1 line
2.34.1
Re: [PATCH 6/7] drm/i915/display: Fix PHY_C20_VDR_HDMI_RATE programming
Quoted 37 lines · Mika Kahola
From: Imre Deak <[email protected]>
The
PHY_C20_VDR_HDMI_RATEregisters 7:2 bits are reserved and they are not specified as a must-be-zero field. Accordingly this reserved field shouldn't be zeroed; to ensure that use an RMW to update thePHY_C20_HDMI_RATEfield (which is bits 1:0 of the register).Signed-off-by Imre Deak <[email protected]>Signed-off-by Mika Kahola <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 7 ++++--- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 2 ++ 2 files changed, 6 insertions(+), 3 deletions(-)drivers/gpu/drm/i915/display/intel_cx0_phy.c +4
-3@@ -2714,9 +2714,10 @@ static void intel_c20_pll_program(struct intel_display *display, MB_WRITE_COMMITTED);if (!is_dp) -intel_cx0_write (encoder,INTEL_CX0_BOTH_LANES ,PHY_C20_VDR_HDMI_RATE , -intel_c20_get_hdmi_rate (port_clock), -MB_WRITE_COMMITTED ); +intel_cx0_rmw (encoder,INTEL_CX0_BOTH_LANES ,PHY_C20_VDR_HDMI_RATE , +PHY_C20_HDMI_RATE_MASK , +intel_c20_get_hdmi_rate (port_clock), +MB_WRITE_COMMITTED );/* * 7. Write Vendor specific registers to toggle context setting to load drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +0
-0
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h line 311
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +2
-0@@ -304,6 +304,8 @@#define PHY_C20_DP_RATE (val) REG_FIELD_PREP8(PHY_C20_DP_RATE_MASK, val)#define PHY_C20_CONTEXT_TOGGLE REG_BIT8(0)#define PHY_C20_VDR_HDMI_RATE 0xD01 +#define PHY_C20_HDMI_RATE_MASK REG_GENMASK8(1, 0) +#define PHY_C20_HDMI_RATE (val) REG_FIELD_PREP8(PHY_C20_HDMI_RATE_MASK, val)#define PHY_C20_VDR_CUSTOM_WIDTH 0xD02#define PHY_C20_CUSTOM_WIDTH_MASK REG_GENMASK(1, 0)#define PHY_C20_CUSTOM_WIDTH (val) REG_FIELD_PREP8(PHY_C20_CUSTOM_WIDTH_MASK, val)
--
Cheers,
Luca.
PATCH 7/7 drm/i915/display: Add missing clock to C10 PHY state compute/HW readout
In reply to Mika KaholaFrom: Imre Deak <[email protected]>
Clock value is missing from C10 hw readout stage. Let's fix this.
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 5 +++++ drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c | 2 ++ 2 files changed, 7 insertions(+)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +5 -0
@@ -2103,6 +2103,9 @@ static int intel_c10pll_calc_state(struct intel_crtc_state *crtc_state,return 0 ; } +static int intel_c10pll_calc_port_clock (struct intel_encoder *encoder, +const struct intel_c10pll_state *pll_state); +static void intel_c10pll_readout_hw_state (struct intel_encoder *encoder,struct intel_c10pll_state *pll_state) {
@@ -2127,6 +2130,8 @@ static void intel_c10pll_readout_hw_state(struct intel_encoder *encoder, pll_state->tx =intel_cx0_read (encoder, lane,PHY_C10_VDR_TX (0 ));intel_cx0_phy_transaction_end (encoder, wakeref); + + pll_state->clock =intel_c10pll_calc_port_clock (encoder, pll_state); } static void intel_c10_pll_program(struct intel_display *display,
drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c +2 -0
@@ -332,6 +332,8 @@ void intel_snps_hdmi_pll_compute_c10pll(struct intel_c10pll_state *pll_state, u6 c10_curve_1, c10_curve_2, prescaler_divider, &pll_params); + pll_state->clock = pixel_clock; + pll_state->tx =0x10 ; pll_state->cmn =0x1 ; pll_state->pll[0] = REG_FIELD_PREP(C10_PLL0_DIV5CLK_EN, pll_params.mpll_div5_en) |
Signature · 1 line
2.34.1
Re: [PATCH 7/7] drm/i915/display: Add missing clock to C10 PHY state compute/HW readout
Quoted 39 lines · Mika Kahola
From: Imre Deak <[email protected]>
Clock value is missing from C10 hw readout stage. Let's fix this.
Signed-off-by Imre Deak <[email protected]>Signed-off-by Mika Kahola <[email protected]>--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 5 +++++ drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c | 2 ++ 2 files changed, 7 insertions(+)drivers/gpu/drm/i915/display/intel_cx0_phy.c +5
-0@@ -2103,6 +2103,9 @@ static int intel_c10pll_calc_state(struct intel_crtc_state *crtc_state,return 0 ; } +static int intel_c10pll_calc_port_clock (struct intel_encoder *encoder, +const struct intel_c10pll_state *pll_state); +static void intel_c10pll_readout_hw_state (struct intel_encoder *encoder,struct intel_c10pll_state *pll_state) {@@ -2127,6 +2130,8 @@ static void intel_c10pll_readout_hw_state(struct intel_encoder *encoder, pll_state->tx =intel_cx0_read (encoder, lane,PHY_C10_VDR_TX (0 ));intel_cx0_phy_transaction_end (encoder, wakeref); + + pll_state->clock =intel_c10pll_calc_port_clock (encoder, pll_state); } static void intel_c10_pll_program(struct intel_display *display,drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c +0
-0
drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c void intel_snps_hdmi_pll_compute_c10pll(struct intel_c10pll_state *pll_state, u6 · line 339
Quoted 8 lines
drivers/gpu/drm/i915/display/intel_snps_hdmi_pll.c +2
-0@@ -332,6 +332,8 @@ void intel_snps_hdmi_pll_compute_c10pll(struct intel_c10pll_state *pll_state, u6 c10_curve_1, c10_curve_2, prescaler_divider, &pll_params); + pll_state->clock = pixel_clock; + pll_state->tx =0x10 ; pll_state->cmn =0x1 ; pll_state->pll[0] = REG_FIELD_PREP(C10_PLL0_DIV5CLK_EN, pll_params.mpll_div5_en) |
--
Cheers,
Luca.
Quoted 7 lines
-----Original Message-----
From: Kahola, Mika <[email protected]>
Sent: Monday, 13 October 2025 12.51
To: [email protected]; [email protected]
Cc: Kahola, Mika <[email protected]>
Subject: [PATCH 0/7] drm/i915/display: Fix C20 PHY PLL DP/HDMI mode programming
Quoted 9 lines
This patchset fixes the DP/HDMI mode programming for C20 PHY PLLs. While at it, it also adds the missing port clock HW readout for C10 PHY PLLs.
These patches were originally part of the RFC PLL rework patch series [1], now resent separately since they include a fix, which as such should be tested/merged separately.
Thanks, Luca, for reviewing the series. Series is now merged upstream.
-Mika-
Quoted 21 lines
Imre Deak (7):
drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/DP_RATE
field macros
drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/IS_DP flag
macro
drm/i915/display: Sanitize
PHY_C20_VDR_CUSTOM_SERDES_RATE/CONTEXT_TOGGLE flag macro
drm/i915/display: Sanitize PHY_C20_VDR_CUSTOM_SERDES_RATE/IS_HDMI_FRL
flag macro
drm/i915/display: FixPHY_C20_VDR_CUSTOM_SERDES_RATEprogramming drm/i915/display: FixPHY_C20_VDR_HDMI_RATEprogramming drm/i915/display: Add missing clock to C10 PHY state compute/HW
readoutdrivers/gpu/drm/i915/display/intel_cx0_phy.c | 43 ++++++++++++------- .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 10 +++-- .../drm/i915/display/intel_snps_hdmi_pll.c | 2 + 3 files changed, 36 insertions(+), 19 deletions(-)--
2.34.1