Enable LT PHY
v4 cover Enable LT PHY
From Xe3p we move on to LT PHY from CX0 PHY. This series implements all the required enable/disable sequences, DP/HDMI PLL state calculation using tables, HDMI Algorithm to calculate PLL state and the reverse Algo where we use the state to calculate the portclock, new Vswing tables and programming required to get everything up and running.
Suraj Kandpal (25):
drm/i915/ltphy: Add LT Phy related VDR and Pipe Registers drm/i915/cx0: Change register bit naming for powerdown values drm/i915/ltphy: Phy lane reset for LT Phy
drm/i915/cx0: Move the HDMI FRL function to intel_hdmi drm/i915/ltphy: Program sequence for PORT_CLOCK_CTL for LT Phy drm/i915/ltphy: Add a wrapper for LT Phy powerdown change sequence drm/i915/ltphy: Read PHY_VDR_0_CONFIG register drm/i915/ltphy: Add LT Phy Programming recipe tables drm/i915/ltphy: Program the VDR PLL registers for LT PHY drm/i915/ltphy: Update the ltpll config table value for eDP drm/i915/ltphy: Enable SSC during port clock programming drm/i915/ltphy: Add function to calculate LT PHY port clock drm/i915/ltphy: Program the P2P Transaction flow for LT Phy drm/i915/ltphy: Program the rest of the PORT_CLOCK_CTL steps drm/i915/ltphy: Program the rest of the LT Phy Enable sequence drm/i915/ltphy: Program LT Phy Non-TBT PLL disable sequence drm/i915/ltphy: Hook up LT Phy Enable & Disable sequences drm/i915/ddi: Define LT Phy Swing tables drm/i915/ltphy: Program LT Phy Voltage Swing drm/i915/ltphy: Enable/Disable Tx after Non TBT Enable sequence drm/i915/ltphy: Define the LT Phy state compare function drm/i915/ltphy: Define function to readout LT Phy PLL state drm/i915/ltphy: Define LT PHY PLL state verify function drm/i915/display: Aux Enable and Display powerwell timeouts drm/i915/ltphy: Modify the step that need to be skipped
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_cx0_phy.c | 76 +- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 21 + .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 15 +- drivers/gpu/drm/i915/display/intel_ddi.c | 34 +- .../drm/i915/display/intel_ddi_buf_trans.c | 81 +- .../drm/i915/display/intel_ddi_buf_trans.h | 9 + drivers/gpu/drm/i915/display/intel_display.c | 33 +- .../i915/display/intel_display_power_well.c | 22 +- drivers/gpu/drm/i915/display/intel_dpll.c | 31 +- drivers/gpu/drm/i915/display/intel_dpll_mgr.h | 11 + drivers/gpu/drm/i915/display/intel_hdmi.c | 14 + drivers/gpu/drm/i915/display/intel_hdmi.h | 1 + drivers/gpu/drm/i915/display/intel_lt_phy.c | 2000 +++++++++++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.h | 44 + .../gpu/drm/i915/display/intel_lt_phy_regs.h | 75 + .../drm/i915/display/intel_modeset_verify.c | 2 + drivers/gpu/drm/xe/Makefile | 1 + 18 files changed, 2410 insertions(+), 61 deletions(-) create mode 100644 drivers/gpu/drm/i915/display/intel_lt_phy.c create mode 100644 drivers/gpu/drm/i915/display/intel_lt_phy.h create mode 100644 drivers/gpu/drm/i915/display/intel_lt_phy_regs.h
Signature · 1 line
2.34.1
PATCH v4 1/25 drm/i915/ltphy: Add LT Phy related VDR and Pipe Registers
Add LT Phy related VDR and pipe registers into its own new file.
Bspec: 74500
---
V1 -> V2:
-Remove unnecessary header inclusion (Jani/Arun)
.../gpu/drm/i915/display/intel_lt_phy_regs.h | 24 +++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 drivers/gpu/drm/i915/display/intel_lt_phy_regs.h
drivers/gpu/drm/i915/display/intel_lt_phy_regs.h new file +24 -0
@@ -0,0 +1,24 @@ +/* SPDX-License-Identifier: MIT +* +* Copyright © 2025 Intel Corporation +*/ + +#ifndef __INTEL_LT_PHY_REGS_H__ +#define __INTEL_LT_PHY_REGS_H__ + +/* LT Phy Vendor Register */ +#define LT_PHY_VDR_0_CONFIG 0xC02 +#define LT_PHY_VDR_DP_PLL_ENABLE REG_BIT(7) +#define LT_PHY_VDR_1_CONFIG 0xC03 +#define LT_PHY_VDR_RATE_ENCODING_MASK REG_GENMASK8(6, 3) +#define LT_PHY_VDR_MODE_ENCODING_MASK REG_GENMASK8(2, 0) +#define LT_PHY_VDR_2_CONFIG 0xCC3 + +#define LT_PHY_VDR_X_ADDR_MSB (idx) (0xC04 + 0x6 * (idx)) +#define LT_PHY_VDR_X_ADDR_LSB (idx) (0xC05 + 0x6 * (idx)) + +#define LT_PHY_VDR_X_DATAY (idx, y) ((0xC06 + (3 - (y))) + 0x6 * (idx)) + +#define LT_PHY_RATE_UPDATE 0xCC4 + +#endif /* __INTEL_LT_PHY_REGS_H__ */
Signature · 1 line
2.34.1
PATCH v4 2/25 drm/i915/cx0: Change register bit naming for powerdown values
In reply to Suraj KandpalChange the register bit naming for powerdown values from CX0 to XELPDP so that it can be used with LT Phy too.
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 14 +++++++------- drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h | 10 +++++----- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +7 -7
@@ -2861,11 +2861,11 @@ static void intel_cx0_setup_powerdown(struct intel_encoder *encoder)intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port),XELPDP_POWER_STATE_READY_MASK , -XELPDP_POWER_STATE_READY (CX0_P2_STATE_READY )); +XELPDP_POWER_STATE_READY (XELPDP_P2_STATE_READY ));intel_de_rmw (display,XELPDP_PORT_BUF_CTL3 (display, port),XELPDP_POWER_STATE_ACTIVE_MASK |XELPDP_PLL_LANE_STAGGERING_DELAY_MASK , -XELPDP_POWER_STATE_ACTIVE (CX0_P0_STATE_ACTIVE ) | +XELPDP_POWER_STATE_ACTIVE (XELPDP_P0_STATE_ACTIVE ) |XELPDP_PLL_LANE_STAGGERING_DELAY (0 )); }
@@ -2938,7 +2938,7 @@ static void intel_cx0_phy_lane_reset(struct intel_encoder *encoder, phy_name(phy), XELPDP_REFCLK_ENABLE_TIMEOUT_US);intel_cx0_powerdown_change_sequence (encoder,INTEL_CX0_BOTH_LANES , -CX0_P2_STATE_RESET ); +XELPDP_P2_STATE_RESET );intel_cx0_setup_powerdown (encoder);intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), lane_pipe_reset,0 );
@@ -3043,7 +3043,7 @@ static void __intel_cx0pll_enable(struct intel_encoder *encoder,* TODO: For DP alt mode use only one lane. */ intel_cx0_powerdown_change_sequence (encoder,INTEL_CX0_BOTH_LANES , -CX0_P2_STATE_READY ); +XELPDP_P2_STATE_READY );/* * 4. Program PORT_MSGBUS_TIMER register's Message Bus Timer field to 0xA000.
@@ -3284,13 +3284,13 @@ static u8 cx0_power_control_disable_val(struct intel_encoder *encoder)struct intel_display *display =to_intel_display (encoder);if (intel_encoder_is_c10phy (encoder)) -return CX0_P2PG_STATE_DISABLE ; +return XELPDP_P2PG_STATE_DISABLE ;if ((display->platform.battlemage && encoder->port ==PORT_A ) || (DISPLAY_VER (display) >=30 && encoder->type ==INTEL_OUTPUT_EDP )) -return CX0_P2PG_STATE_DISABLE ; +return XELPDP_P2PG_STATE_DISABLE ; -return CX0_P4PG_STATE_DISABLE ; +return XELPDP_P4PG_STATE_DISABLE ; }static void intel_cx0pll_disable (struct intel_encoder *encoder)
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +5 -5
@@ -149,11 +149,11 @@#define XELPDP_PLL_LANE_STAGGERING_DELAY (val) REG_FIELD_PREP(XELPDP_PLL_LANE_STAGGERING_DELAY_MASK, val)#define XELPDP_POWER_STATE_ACTIVE_MASK REG_GENMASK(3, 0)#define XELPDP_POWER_STATE_ACTIVE (val) REG_FIELD_PREP(XELPDP_POWER_STATE_ACTIVE_MASK, val) -#define CX0_P0_STATE_ACTIVE 0x0 -#define CX0_P2_STATE_READY 0x2 -#define CX0_P2PG_STATE_DISABLE 0x9 -#define CX0_P4PG_STATE_DISABLE 0xC -#define CX0_P2_STATE_RESET 0x2 +#define XELPDP_P0_STATE_ACTIVE 0x0 +#define XELPDP_P2_STATE_READY 0x2 +#define XELPDP_P2PG_STATE_DISABLE 0x9 +#define XELPDP_P4PG_STATE_DISABLE 0xC +#define XELPDP_P2_STATE_RESET 0x2#define _XELPDP_PORT_MSGBUS_TIMER_LN0_A 0x640d8#define _XELPDP_PORT_MSGBUS_TIMER_LN0_B 0x641d8
Signature · 1 line
2.34.1
PATCH v4 3/25 drm/i915/ltphy: Phy lane reset for LT Phy
In reply to Suraj KandpalDefine function to bring phy lane out of reset for LT Phy and the corresponding pre-requisite steps before we follow the steps for Phy lane reset. Also create a skeleton of LT PHY PLL enable sequence function in which we can place this function
Bspec: 77449, 74749, 74499, 74495, 68960
---
V1 -> V2: Align the definitions (Arun)
drivers/gpu/drm/i915/Makefile | 1 + drivers/gpu/drm/i915/display/intel_cx0_phy.c | 2 +- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 2 + .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 4 + drivers/gpu/drm/i915/display/intel_lt_phy.c | 159 ++++++++++++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.h | 17 ++ .../gpu/drm/i915/display/intel_lt_phy_regs.h | 17 ++ drivers/gpu/drm/xe/Makefile | 1 + 8 files changed, 202 insertions(+), 1 deletion(-) create mode 100644 drivers/gpu/drm/i915/display/intel_lt_phy.c create mode 100644 drivers/gpu/drm/i915/display/intel_lt_phy.h
drivers/gpu/drm/i915/Makefile +1 -0
@@ -356,6 +356,7 @@ i915-y += \ display/intel_gmbus.o \ display/intel_hdmi.o \ display/intel_lspcon.o \ + display/intel_lt_phy.o \ display/intel_lvds.o \ display/intel_panel.o \ display/intel_pfit.o \
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1 -1
@@ -2854,7 +2854,7 @@ static void intel_cx0_powerdown_change_sequence(struct intel_encoder *encoder, phy_name(phy), XELPDP_PORT_RESET_START_TIMEOUT_US); } -static void intel_cx0_setup_powerdown (struct intel_encoder *encoder) +void intel_cx0_setup_powerdown (struct intel_encoder *encoder) {struct intel_display *display =to_intel_display (encoder);enum port port = encoder->port;
drivers/gpu/drm/i915/display/intel_cx0_phy.h +2 -0
@@ -41,6 +41,8 @@ bool intel_cx0pll_compare_hw_state(const struct intel_cx0pll_state *a, const struct intel_cx0pll_state *b);void intel_cx0_phy_set_signal_levels (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state); +int intel_cx0_phy_check_hdmi_link_rate (struct intel_hdmi *hdmi,int clock); +void intel_cx0_setup_powerdown (struct intel_encoder *encoder);int intel_mtl_tbt_calc_port_clock (struct intel_encoder *encoder);void intel_cx0_pll_power_save_wa (struct intel_display *display); void intel_lnl_mac_transmit_lfps(struct intel_encoder *encoder,
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +4 -0
@@ -104,6 +104,8 @@#define XELPDP_PORT_BUF_PORT_DATA_20BIT REG_FIELD_PREP(XELPDP_PORT_BUF_PORT_DATA_WIDTH_MASK, 1)#define XELPDP_PORT_BUF_PORT_DATA_40BIT REG_FIELD_PREP(XELPDP_PORT_BUF_PORT_DATA_WIDTH_MASK, 2)#define XELPDP_PORT_REVERSAL REG_BIT(16) +#define XE3PLPDP_PHY_MODE_MASK REG_GENMASK(15, 12) +#define XE3PLPDP_PHY_MODE_DP REG_FIELD_PREP(XE3PLPDP_PHY_MODE_MASK, 0x3)#define XELPDP_PORT_BUF_IO_SELECT_TBT REG_BIT(11)#define XELPDP_PORT_BUF_PHY_IDLE REG_BIT(7)#define XELPDP_TC_PHY_OWNERSHIP REG_BIT(6)
@@ -124,6 +126,7 @@ _XELPDP_PORT_BUF_CTL2(port))#define XELPDP_LANE_PIPE_RESET (lane) _PICK(lane, REG_BIT(31), REG_BIT(30))#define XELPDP_LANE_PHY_CURRENT_STATUS (lane) _PICK(lane, REG_BIT(29), REG_BIT(28)) +#define XE3PLPDP_LANE_PHY_PULSE_STATUS (lane) _PICK(lane, REG_BIT(27), REG_BIT(26))#define XELPDP_LANE_POWERDOWN_UPDATE (lane) _PICK(lane, REG_BIT(25), REG_BIT(24))#define _XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK REG_GENMASK(23, 20)#define _XELPDP_LANE0_POWERDOWN_NEW_STATE (val) REG_FIELD_PREP(_XELPDP_LANE0_POWERDOWN_NEW_STATE_MASK, val)
@@ -151,6 +154,7 @@#define XELPDP_POWER_STATE_ACTIVE (val) REG_FIELD_PREP(XELPDP_POWER_STATE_ACTIVE_MASK, val)#define XELPDP_P0_STATE_ACTIVE 0x0#define XELPDP_P2_STATE_READY 0x2 +#define XE3PLPD_P4_STATE_DISABLE 0x4#define XELPDP_P2PG_STATE_DISABLE 0x9#define XELPDP_P4PG_STATE_DISABLE 0xC#define XELPDP_P2_STATE_RESET 0x2
drivers/gpu/drm/i915/display/intel_lt_phy.c new file +159 -0
159 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_lt_phy.h new file +17 -0
@@ -0,0 +1,17 @@ +/* SPDX-License-Identifier: MIT +* +* Copyright © 2025 Intel Corporation +*/ + +#ifndef __INTEL_LT_PHY_H__ +#define __INTEL_LT_PHY_H__ + +#include <linux/types.h> + +struct intel_encoder ; +struct intel_crtc_state ; + +void intel_lt_phy_pll_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state); + +#endif /* __INTEL_LT_PHY_H__ */
drivers/gpu/drm/i915/display/intel_lt_phy_regs.h +17 -0
@@ -6,6 +6,12 @@#ifndef __INTEL_LT_PHY_REGS_H__#define __INTEL_LT_PHY_REGS_H__ +#define XE3PLPD_MACCLK_TURNON_LATENCY_MS 1 +#define XE3PLPD_MACCLK_TURNON_LATENCY_US 21 +#define XE3PLPD_RATE_CALIB_DONE_LATENCY_US 50 +#define XE3PLPD_RESET_START_LATENCY_US 10 +#define XE3PLPD_RESET_END_LATENCY_US 200 +/* LT Phy Vendor Register */ #define LT_PHY_VDR_0_CONFIG 0xC02#define LT_PHY_VDR_DP_PLL_ENABLE REG_BIT(7)
@@ -21,4 +27,15 @@#define LT_PHY_RATE_UPDATE 0xCC4 +#define _XE3PLPD_PORT_BUF_CTL5 (idx) _MMIO(_PICK_EVEN_2RANGES(idx, PORT_TC1, \ + _XELPDP_PORT_BUF_CTL1_LN0_A, \ + _XELPDP_PORT_BUF_CTL1_LN0_B, \ + _XELPDP_PORT_BUF_CTL1_LN0_USBC1, \ + _XELPDP_PORT_BUF_CTL1_LN0_USBC2) \ + + 0x34) +#define XE3PLPD_PORT_BUF_CTL5 (port) _XE3PLPD_PORT_BUF_CTL5(__xe2lpd_port_idx(port)) +#define XE3PLPD_MACCLK_RESET_0 REG_BIT(11) +#define XE3PLPD_MACCLK_RATE_MASK REG_GENMASK(4, 0) +#define XE3PLPD_MACCLK_RATE_DEF REG_FIELD_PREP(XE3PLPD_MACCLK_RATE_MASK, 0x1F) +#endif /* __INTEL_LT_PHY_REGS_H__ */
drivers/gpu/drm/xe/Makefile +1 -0
@@ -294,6 +294,7 @@ xe-$(CONFIG_DRM_XE_DISPLAY) += \ i915-display/intel_hti.o \ i915-display/intel_link_bw.o \ i915-display/intel_lspcon.o \ + i915-display/intel_lt_phy.o \ i915-display/intel_modeset_lock.o \ i915-display/intel_modeset_setup.o \ i915-display/intel_modeset_verify.o \
Signature · 1 line
2.34.1
PATCH v4 4/25 drm/i915/cx0: Move the HDMI FRL function to intel_hdmi
In reply to Suraj KandpalMove the is_hdmi_frl to intel_hdmi.c. Rename it appropriately and make it non static.
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 21 +++----------------- drivers/gpu/drm/i915/display/intel_hdmi.c | 14 +++++++++++++ drivers/gpu/drm/i915/display/intel_hdmi.h | 1 + 3 files changed, 18 insertions(+), 18 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +3 -18
@@ -2590,20 +2590,6 @@ static bool is_dp2(u32 clock)return false; } -static bool is_hdmi_frl (u32 clock) -{ -switch (clock) { -case 300000 :/* 3 Gbps */ -case 600000 :/* 6 Gbps */ -case 800000 :/* 8 Gbps */ -case 1000000 :/* 10 Gbps */ -case 1200000 :/* 12 Gbps */ -return true; -default : -return false; - } -} -static bool intel_c20_protocol_switch_valid (struct intel_encoder *encoder) {struct intel_digital_port *intel_dig_port =enc_to_dig_port (encoder);
@@ -2617,7 +2603,7 @@ static int intel_get_c20_custom_width(u32 clock, bool dp) {if (dp &&is_dp2 (clock))return 2 ; -else if (is_hdmi_frl (clock)) +else if (intel_hdmi_is_frl (clock))return 1 ;else return 0 ;
@@ -2706,11 +2692,10 @@ static void intel_c20_pll_program(struct intel_display *display,/* 5. For DP or 6. For HDMI */ 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)) +else if (intel_hdmi_is_frl (port_clock)) serdes =PHY_C20_IS_HDMI_FRL ; intel_cx0_rmw(encoder, owned_lane_mask, PHY_C20_VDR_CUSTOM_SERDES_RATE,
@@ -2777,7 +2762,7 @@ static void intel_program_port_clock_ctl(struct intel_encoder *encoder, val |=XELPDP_FORWARD_CLOCK_UNGATE ; -if (!is_dp &&is_hdmi_frl (port_clock)) +if (!is_dp &&intel_hdmi_is_frl (port_clock)) val |=XELPDP_DDI_CLOCK_SELECT_PREP (display,XELPDP_DDI_CLOCK_SELECT_DIV18CLK );else val |=XELPDP_DDI_CLOCK_SELECT_PREP (display,XELPDP_DDI_CLOCK_SELECT_MAXPCLK );
drivers/gpu/drm/i915/display/intel_hdmi.c +14 -0
@@ -68,6 +68,20 @@#include "intel_snps_phy.h" #include "intel_vrr.h" +bool intel_hdmi_is_frl (u32 clock) +{ +switch (clock) { +case 300000 :/* 3 Gbps */ +case 600000 :/* 6 Gbps */ +case 800000 :/* 8 Gbps */ +case 1000000 :/* 10 Gbps */ +case 1200000 :/* 12 Gbps */ +return true; +default : +return false; + } +} +static void assert_hdmi_port_disabled (struct intel_hdmi *intel_hdmi) {
drivers/gpu/drm/i915/display/intel_hdmi.h +1 -0
@@ -60,6 +60,7 @@ int intel_hdmi_dsc_get_num_slices(const struct intel_crtc_state *crtc_state, int src_max_slices, int src_max_slice_width, int hdmi_max_slices, int hdmi_throughput);int intel_hdmi_dsc_get_slice_height (int vactive); +bool intel_hdmi_is_frl (u32 clock); void hsw_write_infoframe(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state,
Signature · 1 line
2.34.1
PATCH v4 5/25 drm/i915/ltphy: Program sequence for PORT_CLOCK_CTL for LT Phy
In reply to Suraj KandpalProgram sequence from port clock ctl except for the SSC enablement part which will be taken care of later.
Bspec: 74492
---
V1 -> V2:
-Break patch into two (Arun)
drivers/gpu/drm/i915/display/intel_cx0_phy.h | 1 + drivers/gpu/drm/i915/display/intel_lt_phy.c | 37 ++++++++++++++++++++ 2 files changed, 38 insertions(+)
drivers/gpu/drm/i915/display/intel_cx0_phy.h +1 -0
@@ -43,6 +43,7 @@ void intel_cx0_phy_set_signal_levels(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state);int intel_cx0_phy_check_hdmi_link_rate (struct intel_hdmi *hdmi,int clock);void intel_cx0_setup_powerdown (struct intel_encoder *encoder); +bool intel_cx0_is_hdmi_frl (u32 clock);int intel_mtl_tbt_calc_port_clock (struct intel_encoder *encoder);void intel_cx0_pll_power_save_wa (struct intel_display *display); void intel_lnl_mac_transmit_lfps(struct intel_encoder *encoder,
drivers/gpu/drm/i915/display/intel_lt_phy.c +37 -0
@@ -11,6 +11,7 @@#include "intel_de.h" #include "intel_display.h" #include "intel_display_types.h" +#include "intel_hdmi.h" #include "intel_lt_phy.h" #include "intel_lt_phy_regs.h" #include "intel_tc.h"
@@ -108,13 +109,49 @@ intel_lt_phy_lane_reset(struct intel_encoder *encoder,intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), lane_phy_pulse_status,0 ); } +static void +intel_lt_phy_program_port_clock_ctl (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +bool lane_reversal) +{ +struct intel_display *display =to_intel_display (encoder); +u32 val =0 ; + +intel_de_rmw (display,XELPDP_PORT_BUF_CTL1 (display, encoder->port), +XELPDP_PORT_REVERSAL , + lane_reversal ?XELPDP_PORT_REVERSAL :0 ); + + val |=XELPDP_FORWARD_CLOCK_UNGATE ; + +/* +* We actually mean MACCLK here and not MAXPCLK when using LT Phy +* but since the register bits still remain the same we use +* the same definition +*/ +if (intel_crtc_has_type (crtc_state,INTEL_OUTPUT_HDMI ) && +intel_hdmi_is_frl (crtc_state->port_clock)) + val |=XELPDP_DDI_CLOCK_SELECT_PREP (display,XELPDP_DDI_CLOCK_SELECT_DIV18CLK ); +else + val |=XELPDP_DDI_CLOCK_SELECT_PREP (display,XELPDP_DDI_CLOCK_SELECT_MAXPCLK ); + +intel_de_rmw (display,XELPDP_PORT_CLOCK_CTL (display, encoder->port), +XELPDP_LANE1_PHY_CLOCK_SELECT |XELPDP_FORWARD_CLOCK_UNGATE | +XELPDP_DDI_CLOCK_SELECT_MASK (display) |XELPDP_SSC_ENABLE_PLLA | +XELPDP_SSC_ENABLE_PLLB , val); +} +void intel_lt_phy_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state) { +struct intel_digital_port *dig_port =enc_to_dig_port (encoder); +bool lane_reversal = dig_port->lane_reversal; +/* 1. Enable MacCLK at default 162 MHz frequency. */ intel_lt_phy_lane_reset (encoder, crtc_state->lane_count);/* 2. Program PORT_CLOCK_CTL register to configure clock muxes, gating, and SSC. */ +intel_lt_phy_program_port_clock_ctl (encoder, crtc_state, lane_reversal); +/* 3. Change owned PHY lanes power to Ready state. */ /* * 4. Read the PHY message bus VDR register PHY_VDR_0_Config check enabled PLL type,
Signature · 1 line
2.34.1
PATCH v4 6/25 drm/i915/ltphy: Add a wrapper for LT Phy powerdown change sequence
In reply to Suraj KandpalAdd a wrapper on cx0 powerdown change sequence for LT Phy usage, as the sequence remains unchanged when going from SNPS Phy to LT Phy.
Bspec: 74495
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 6 +++--- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 2 ++ drivers/gpu/drm/i915/display/intel_lt_phy.c | 13 +++++++++++++ 3 files changed, 18 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +3 -3
@@ -2802,8 +2802,8 @@ static u32 intel_cx0_get_powerdown_state(u8 lane_mask, u8 state)return val; } -static void intel_cx0_powerdown_change_sequence (struct intel_encoder *encoder, -u8 lane_mask,u8 state) +void intel_cx0_powerdown_change_sequence (struct intel_encoder *encoder, +u8 lane_mask,u8 state) {struct intel_display *display =to_intel_display (encoder);enum port port = encoder->port;
@@ -2833,7 +2833,7 @@ static void intel_cx0_powerdown_change_sequence(struct intel_encoder *encoder,/* Update Timeout Value */ if (intel_de_wait_custom (display, buf_ctl2_reg,intel_cx0_get_powerdown_update (lane_mask),0 , -XELPDP_PORT_POWERDOWN_UPDATE_TIMEOUT_US ,0 ,NULL )) +XELPDP_PORT_POWERDOWN_UPDATE_TIMEOUT_US ,2 ,NULL ))drm_warn (display->drm,"PHY %c failed to bring out of Lane reset after %dus.\n" ,phy_name (phy),XELPDP_PORT_RESET_START_TIMEOUT_US );
drivers/gpu/drm/i915/display/intel_cx0_phy.h +2 -0
@@ -41,6 +41,8 @@ bool intel_cx0pll_compare_hw_state(const struct intel_cx0pll_state *a, const struct intel_cx0pll_state *b);void intel_cx0_phy_set_signal_levels (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state); +void intel_cx0_powerdown_change_sequence (struct intel_encoder *encoder, +u8 lane_mask,u8 state);int intel_cx0_phy_check_hdmi_link_rate (struct intel_hdmi *hdmi,int clock);void intel_cx0_setup_powerdown (struct intel_encoder *encoder);bool intel_cx0_is_hdmi_frl (u32 clock);
drivers/gpu/drm/i915/display/intel_lt_phy.c +13 -0
@@ -43,6 +43,13 @@ intel_lt_phy_setup_powerdown(struct intel_encoder *encoder, u8 lane_count)intel_cx0_setup_powerdown (encoder); } +static void +intel_lt_phy_powerdown_change_sequence (struct intel_encoder *encoder, +u8 lane_mask,u8 state) +{ +intel_cx0_powerdown_change_sequence (encoder, lane_mask, state); +} +static void intel_lt_phy_lane_reset (struct intel_encoder *encoder,u8 lane_count)
@@ -70,6 +77,8 @@ intel_lt_phy_lane_reset(struct intel_encoder *encoder, XE3PLPDP_PHY_MODE_MASK, XE3PLPDP_PHY_MODE_DP);intel_lt_phy_setup_powerdown (encoder, lane_count); +intel_lt_phy_powerdown_change_sequence (encoder, owned_lane_mask, +XELPDP_P2_STATE_RESET );intel_de_rmw (display,XE3PLPD_PORT_BUF_CTL5 (port),XE3PLPD_MACCLK_RESET_0 ,0 );
@@ -145,6 +154,7 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder, {struct intel_digital_port *dig_port =enc_to_dig_port (encoder);bool lane_reversal = dig_port->lane_reversal; +u8 owned_lane_mask =intel_lt_phy_get_owned_lane_mask (encoder);/* 1. Enable MacCLK at default 162 MHz frequency. */ intel_lt_phy_lane_reset (encoder, crtc_state->lane_count);
@@ -153,6 +163,9 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder,intel_lt_phy_program_port_clock_ctl (encoder, crtc_state, lane_reversal);/* 3. Change owned PHY lanes power to Ready state. */ +intel_lt_phy_powerdown_change_sequence (encoder, owned_lane_mask, +XELPDP_P2_STATE_READY ); +/* * 4. Read the PHY message bus VDR register PHY_VDR_0_Config check enabled PLL type, * encoded rate and encoded mode.
Signature · 1 line
2.34.1
PATCH v4 7/25 drm/i915/ltphy: Read PHY_VDR_0_CONFIG register
In reply to Suraj KandpalRead PHY_VDR_0_CONFIG to check if there is any change in the register and decide based on that if P2P sequence to change the data rate of LT PHY are required or not. This scenario only happens if the requested mode uses 1.62Gbps with DP mode since LT PHY defaults to this mode if any other mode is requested we need to follow the whole sequence.
---
V1 -> V2:
-Update the commit message (Arun)
V2 -> V3:
-Make functions fit in single line if they can (Jani)
drivers/gpu/drm/i915/display/intel_cx0_phy.c | 3 +- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 1 + drivers/gpu/drm/i915/display/intel_lt_phy.c | 144 ++++++++++++++++--- 3 files changed, 123 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1 -2
@@ -271,8 +271,7 @@ static u8 __intel_cx0_read(struct intel_encoder *encoder,return 0 ; } -static u8 intel_cx0_read (struct intel_encoder *encoder, -u8 lane_mask,u16 addr) +u8 intel_cx0_read (struct intel_encoder *encoder,u8 lane_mask,u16 addr) {int lane =lane_mask_to_lane (lane_mask);
drivers/gpu/drm/i915/display/intel_cx0_phy.h +1 -0
@@ -46,6 +46,7 @@ void intel_cx0_powerdown_change_sequence(struct intel_encoder *encoder,int intel_cx0_phy_check_hdmi_link_rate (struct intel_hdmi *hdmi,int clock);void intel_cx0_setup_powerdown (struct intel_encoder *encoder);bool intel_cx0_is_hdmi_frl (u32 clock); +u8 intel_cx0_read (struct intel_encoder *encoder,u8 lane_mask,u16 addr);int intel_mtl_tbt_calc_port_clock (struct intel_encoder *encoder);void intel_cx0_pll_power_save_wa (struct intel_display *display); void intel_lnl_mac_transmit_lfps(struct intel_encoder *encoder,
drivers/gpu/drm/i915/display/intel_lt_phy.c +121 -23
190 lines not on this page · raw message
Signature · 1 line
2.34.1
PATCH v4 8/25 drm/i915/ltphy: Add LT Phy Programming recipe tables
In reply to Suraj KandpalAdd the LT Phy programming recipe tables for eDP, DP & HDMI and a function to use the correct table.
Bspec: 74667
--- drivers/gpu/drm/i915/display/intel_dpll.c | 29 +- drivers/gpu/drm/i915/display/intel_dpll_mgr.h | 11 + drivers/gpu/drm/i915/display/intel_lt_phy.c | 992 ++++++++++++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.h | 5 + 4 files changed, 1036 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_dpll.c +28 -1
@@ -17,6 +17,7 @@#include "intel_display_types.h" #include "intel_dpio_phy.h" #include "intel_dpll.h" +#include "intel_lt_phy.h" #include "intel_lvds.h" #include "intel_lvds_regs.h" #include "intel_panel.h"
@@ -1232,6 +1233,26 @@ static int mtl_crtc_compute_clock(struct intel_atomic_state *state,return 0 ; } +static int xe3plpd_crtc_compute_clock (struct intel_atomic_state *state, +struct intel_crtc *crtc) +{ +struct intel_crtc_state *crtc_state = +intel_atomic_get_new_crtc_state (state, crtc); +struct intel_encoder *encoder = +intel_get_crtc_new_encoder (state, crtc_state); +int ret; + + ret =intel_lt_phy_pll_calc_state (crtc_state, encoder); +if (ret) +return ret; + +/* TODO: Do the readback via intel_compute_shared_dplls() */ + + crtc_state->hw.adjusted_mode.crtc_clock =intel_crtc_dotclock (crtc_state); + +return 0 ; +} +static int ilk_fb_cb_factor (const struct intel_crtc_state *crtc_state) {struct intel_display *display =to_intel_display (crtc_state);
@@ -1691,6 +1712,10 @@ static int i8xx_crtc_compute_clock(struct intel_atomic_state *state,return 0 ; } +static const struct intel_dpll_global_funcs xe3plpd_dpll_funcs = { + .crtc_compute_clock = xe3plpd_crtc_compute_clock, +}; +static const struct intel_dpll_global_funcs mtl_dpll_funcs = { .crtc_compute_clock = mtl_crtc_compute_clock, };
@@ -1789,7 +1814,9 @@ int intel_dpll_crtc_get_dpll(struct intel_atomic_state *state,void intel_dpll_init_clock_hook (struct intel_display *display) { -if (DISPLAY_VER (display) >=14 ) +if (HAS_LT_PHY (display)) + display->funcs.dpll = &xe3plpd_dpll_funcs; +else if (DISPLAY_VER (display) >=14 ) display->funcs.dpll = &mtl_dpll_funcs;else if (display->platform.dg2) display->funcs.dpll = &dg2_dpll_funcs;
drivers/gpu/drm/i915/display/intel_dpll_mgr.h +11 -0
@@ -267,6 +267,16 @@ struct intel_cx0pll_state {bool tbt_mode; }; +struct intel_lt_phy_pll_state { +u32 clock;/* in kHz */ +u8 addr_msb[13 ]; +u8 addr_lsb[13 ]; +u8 data[13 ][4 ]; +u8 config[3 ]; +bool ssc_enabled; +bool tbt_mode; +}; +struct intel_dpll_hw_state {union {struct i9xx_dpll_hw_state i9xx;
@@ -276,6 +286,7 @@ struct intel_dpll_hw_state {struct icl_dpll_hw_state icl;struct intel_mpllb_state mpllb;struct intel_cx0pll_state cx0pll; +struct intel_lt_phy_pll_state ltpll; }; };
drivers/gpu/drm/i915/display/intel_lt_phy.c +992 -0
1,010 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_lt_phy.h +5 -0
@@ -13,5 +13,10 @@ struct intel_crtc_state;void intel_lt_phy_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state); +int +intel_lt_phy_pll_calc_state (struct intel_crtc_state *crtc_state, +struct intel_encoder *encoder); + +#define HAS_LT_PHY (display) (DISPLAY_VER(display) >= 35)#endif /* __INTEL_LT_PHY_H__ */
Signature · 1 line
2.34.1
PATCH v4 9/25 drm/i915/ltphy: Program the VDR PLL registers for LT PHY
In reply to Suraj KandpalFetch the tables which need to be used and program it in the specified VDR register space. Everything is done over the respective lanes.
Bspec: 68862, 74500
---
V1 -> V2:
-Reframe commit message (Arun)
drivers/gpu/drm/i915/display/intel_cx0_phy.c | 7 ++-- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 5 +++ drivers/gpu/drm/i915/display/intel_lt_phy.c | 38 ++++++++++++++++++++ 3 files changed, 45 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -5
@@ -23,9 +23,6 @@#include "intel_snps_hdmi_pll.h" #include "intel_tc.h" -#define MB_WRITE_COMMITTED true -#define MB_WRITE_UNCOMMITTED false -#define for_each_cx0_lane_in_mask (__lane_mask, __lane) \ for ((__lane) = 0; (__lane) < 2; (__lane)++) \ for_each_if((__lane_mask) & BIT(__lane))
@@ -358,8 +355,8 @@ static void __intel_cx0_write(struct intel_encoder *encoder, "PHY %c Write %04x failed after %d retries.\n", phy_name(phy), addr, i); } -static void intel_cx0_write (struct intel_encoder *encoder, -u8 lane_mask,u16 addr,u8 data,bool committed) +void intel_cx0_write (struct intel_encoder *encoder, +u8 lane_mask,u16 addr,u8 data,bool committed) {int lane;
drivers/gpu/drm/i915/display/intel_cx0_phy.h +5 -0
@@ -8,6 +8,9 @@#include <linux/types.h> +#define MB_WRITE_COMMITTED true +#define MB_WRITE_UNCOMMITTED false +enum icl_port_dpll_id ;struct intel_atomic_state ;struct intel_c10pll_state ;
@@ -47,6 +50,8 @@ int intel_cx0_phy_check_hdmi_link_rate(struct intel_hdmi *hdmi, int clock);void intel_cx0_setup_powerdown (struct intel_encoder *encoder);bool intel_cx0_is_hdmi_frl (u32 clock);u8 intel_cx0_read (struct intel_encoder *encoder,u8 lane_mask,u16 addr); +void intel_cx0_write (struct intel_encoder *encoder, +u8 lane_mask,u16 addr,u8 data,bool committed);int intel_mtl_tbt_calc_port_clock (struct intel_encoder *encoder);void intel_cx0_pll_power_save_wa (struct intel_display *display); void intel_lnl_mac_transmit_lfps(struct intel_encoder *encoder,
drivers/gpu/drm/i915/display/intel_lt_phy.c +38 -0
@@ -992,6 +992,12 @@ static u8 intel_lt_phy_read(struct intel_encoder *encoder, u8 lane_mask, u16 addreturn intel_cx0_read (encoder, lane_mask, addr); } +static void intel_lt_phy_write (struct intel_encoder *encoder, +u8 lane_mask,u16 addr,u8 data,bool committed) +{ +intel_cx0_write (encoder, lane_mask, addr, data, committed); +} +static void intel_lt_phy_setup_powerdown (struct intel_encoder *encoder,u8 lane_count) {
@@ -1228,6 +1234,36 @@ intel_lt_phy_pll_calc_state(struct intel_crtc_state *crtc_state,return -EINVAL ; } +static void +intel_lt_phy_program_pll (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) +{ +u8 owned_lane_mask =intel_lt_phy_get_owned_lane_mask (encoder); +int i, j, k; + +intel_lt_phy_write (encoder, owned_lane_mask,LT_PHY_VDR_0_CONFIG , + crtc_state->dpll_hw_state.ltpll.config[0 ],MB_WRITE_COMMITTED ); +intel_lt_phy_write (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_VDR_1_CONFIG , + crtc_state->dpll_hw_state.ltpll.config[1 ],MB_WRITE_COMMITTED ); +intel_lt_phy_write (encoder, owned_lane_mask,LT_PHY_VDR_2_CONFIG , + crtc_state->dpll_hw_state.ltpll.config[2 ],MB_WRITE_COMMITTED ); + +for (i =0 ; i <=12 ; i++) { +intel_lt_phy_write (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_VDR_X_ADDR_MSB (i), + crtc_state->dpll_hw_state.ltpll.addr_msb[i], +MB_WRITE_COMMITTED ); +intel_lt_phy_write (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_VDR_X_ADDR_LSB (i), + crtc_state->dpll_hw_state.ltpll.addr_lsb[i], +MB_WRITE_COMMITTED ); + +for (j =3 , k =0 ; j >=0 ; j--, k++) +intel_lt_phy_write (encoder,INTEL_LT_PHY_LANE0 , +LT_PHY_VDR_X_DATAY (i, j), + crtc_state->dpll_hw_state.ltpll.data[i][k], +MB_WRITE_COMMITTED ); + } +} +void intel_lt_phy_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state) {
@@ -1258,6 +1294,8 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder,* 5. Program the PHY internal PLL registers over PHY message bus for the desired * frequency and protocol type */ +intel_lt_phy_program_pll (encoder, crtc_state); +/* 6. Use the P2P transaction flow */ /* * 6.1. Set the PHY VDR register 0xCC4[Rate Control VDR Update] = 1 over PHY message
Signature · 1 line
2.34.1
PATCH v4 10/25 drm/i915/ltphy: Update the ltpll config table value for eDP
In reply to Suraj KandpalWhen we get the eDP tables we reuse dp tables for some data rates. We need to modify the 3rd config value of this table to 1 instead of 0 since that is the only difference in the dp and edp table for that particular data rate.
--- drivers/gpu/drm/i915/display/intel_lt_phy.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/display/intel_lt_phy.c +4 -0
@@ -1225,6 +1225,10 @@ intel_lt_phy_pll_calc_state(struct intel_crtc_state *crtc_state,for (i =0 ; tables[i]; i++) {if (crtc_state->port_clock == tables[i]->clock) { crtc_state->dpll_hw_state.ltpll = *tables[i]; +if (intel_crtc_has_dp_encoder (crtc_state)) { +if (intel_crtc_has_type (crtc_state,INTEL_OUTPUT_EDP )) + crtc_state->dpll_hw_state.ltpll.config[2 ] =1 ; + }return 0 ; } }
Signature · 1 line
2.34.1
PATCH v4 11/25 drm/i915/ltphy: Enable SSC during port clock programming
In reply to Suraj KandpalWe enable SSC when we program PORT_CLOCK_CTL register. We logically determine if ssc is enabled or not while we calculate our state.
Bspec: 74492, 74667
--- drivers/gpu/drm/i915/display/intel_lt_phy.c | 26 +++++++++++++++++++++ 1 file changed, 26 insertions(+)
drivers/gpu/drm/i915/display/intel_lt_phy.c +26 -0
@@ -16,6 +16,7 @@#include "intel_hdmi.h" #include "intel_lt_phy.h" #include "intel_lt_phy_regs.h" +#include "intel_panel.h" #include "intel_psr.h" #include "intel_tc.h"
@@ -1109,6 +1110,12 @@ intel_lt_phy_program_port_clock_ctl(struct intel_encoder *encoder,else val |=XELPDP_DDI_CLOCK_SELECT_PREP (display,XELPDP_DDI_CLOCK_SELECT_MAXPCLK ); +/* DP2.0 10G and 20G rates enable MPLLA*/ +if (crtc_state->port_clock ==1000000 || crtc_state->port_clock ==2000000 ) + val |=XELPDP_SSC_ENABLE_PLLA ; +else + val |= crtc_state->dpll_hw_state.ltpll.ssc_enabled ?XELPDP_SSC_ENABLE_PLLB :0 ; + intel_de_rmw(display, XELPDP_PORT_CLOCK_CTL(display, encoder->port), XELPDP_LANE1_PHY_CLOCK_SELECT | XELPDP_FORWARD_CLOCK_UNGATE | XELPDP_DDI_CLOCK_SELECT_MASK(display) | XELPDP_SSC_ENABLE_PLLA |
@@ -1211,6 +1218,23 @@ intel_lt_phy_pll_tables_get(struct intel_crtc_state *crtc_state,return NULL ; } +static bool +intel_lt_phy_pll_is_ssc_enabled (struct intel_crtc_state *crtc_state, +struct intel_encoder *encoder) +{ +struct intel_display *display =to_intel_display (encoder); + +if (intel_crtc_has_dp_encoder (crtc_state)) { +if (intel_panel_use_ssc (display)) { +struct intel_dp *intel_dp =enc_to_intel_dp (encoder); + +return (intel_dp->dpcd[DP_MAX_DOWNSPREAD ] &DP_MAX_DOWNSPREAD_0_5 ); + } + } + +return false; +} +int intel_lt_phy_pll_calc_state (struct intel_crtc_state *crtc_state,struct intel_encoder *encoder)
@@ -1229,6 +1253,8 @@ intel_lt_phy_pll_calc_state(struct intel_crtc_state *crtc_state,if (intel_crtc_has_type (crtc_state,INTEL_OUTPUT_EDP )) crtc_state->dpll_hw_state.ltpll.config[2 ] =1 ; } + crtc_state->dpll_hw_state.ltpll.ssc_enabled = +intel_lt_phy_pll_is_ssc_enabled (crtc_state, encoder);return 0 ; } }
Signature · 1 line
2.34.1
PATCH v4 12/25 drm/i915/ltphy: Add function to calculate LT PHY port clock
In reply to Suraj KandpalCreate a reverse algorithm which is used to find port clock from the LT PHY state is provided which is used for comparision & verification functions.
Bspec: 74667
---
V1 -> V2:
-Correct comment grammar
V2 -> V3:
-Update commit mesage (Ankit)
-Update & add a more refined comment (Ankit)
V3 -> V4:
-Add blank lines in comment to make it more readable (Ankit)
drivers/gpu/drm/i915/display/intel_dpll.c | 2 + drivers/gpu/drm/i915/display/intel_lt_phy.c | 92 +++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.h | 3 + 3 files changed, 97 insertions(+)
drivers/gpu/drm/i915/display/intel_dpll.c +2 -0
@@ -1247,6 +1247,8 @@ static int xe3plpd_crtc_compute_clock(struct intel_atomic_state *state,return ret;/* TODO: Do the readback via intel_compute_shared_dplls() */ + crtc_state->port_clock = +intel_lt_phy_calc_port_clock (encoder, crtc_state); crtc_state->hw.adjusted_mode.crtc_clock =intel_crtc_dotclock (crtc_state);
drivers/gpu/drm/i915/display/intel_lt_phy.c +92 -0
98 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_lt_phy.h +3 -0
@@ -10,12 +10,15 @@struct intel_encoder ;struct intel_crtc_state ; +struct intel_lt_phy_pll_state ;void intel_lt_phy_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state);int intel_lt_phy_pll_calc_state (struct intel_crtc_state *crtc_state,struct intel_encoder *encoder); +int intel_lt_phy_calc_port_clock (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state);#define HAS_LT_PHY (display) (DISPLAY_VER(display) >= 35)
Signature · 1 line
2.34.1
PATCH v4 13/25 drm/i915/ltphy: Program the P2P Transaction flow for LT Phy
In reply to Suraj KandpalProgram the LT PHY P2P transaction which uses P2M cycle to get get data fro Phy when it is ready and then go read the MAC register from the MAC address space.
Bspec: 68966, 74497, 74483, 74500
---
V1 -> V2:
-Update the comment for udelay added (Arun)
V2 -> V3:
-Add REVISIT tag in comment (Arun)
drivers/gpu/drm/i915/display/intel_cx0_phy.c | 10 +- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 5 + .../gpu/drm/i915/display/intel_cx0_phy_regs.h | 1 + drivers/gpu/drm/i915/display/intel_lt_phy.c | 117 ++++++++++++++++++ .../gpu/drm/i915/display/intel_lt_phy_regs.h | 15 +++ 5 files changed, 143 insertions(+), 5 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +5 -5
@@ -125,8 +125,8 @@ static void intel_cx0_phy_transaction_end(struct intel_encoder *encoder, intel_wintel_display_power_put (display,POWER_DOMAIN_DC_OFF , wakeref); } -static void intel_clear_response_ready_flag (struct intel_encoder *encoder, -int lane) +void intel_clear_response_ready_flag (struct intel_encoder *encoder, +int lane) {struct intel_display *display =to_intel_display (encoder);
@@ -135,7 +135,7 @@ static void intel_clear_response_ready_flag(struct intel_encoder *encoder, 0, XELPDP_PORT_P2M_RESPONSE_READY | XELPDP_PORT_P2M_ERROR_SET); } -static void intel_cx0_bus_reset (struct intel_encoder *encoder,int lane) +void intel_cx0_bus_reset (struct intel_encoder *encoder,int lane) {struct intel_display *display =to_intel_display (encoder);enum port port = encoder->port;
@@ -156,8 +156,8 @@ static void intel_cx0_bus_reset(struct intel_encoder *encoder, int lane)intel_clear_response_ready_flag (encoder, lane); } -static int intel_cx0_wait_for_ack (struct intel_encoder *encoder, -int command,int lane,u32 *val) +int intel_cx0_wait_for_ack (struct intel_encoder *encoder, +int command,int lane,u32 *val) {struct intel_display *display =to_intel_display (encoder);enum port port = encoder->port;
drivers/gpu/drm/i915/display/intel_cx0_phy.h +5 -0
@@ -22,6 +22,8 @@ struct intel_display;struct intel_encoder ;struct intel_hdmi ; +void intel_clear_response_ready_flag (struct intel_encoder *encoder, +int lane);bool intel_encoder_is_c10phy (struct intel_encoder *encoder);void intel_mtl_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state);
@@ -52,6 +54,9 @@ bool intel_cx0_is_hdmi_frl(u32 clock);u8 intel_cx0_read (struct intel_encoder *encoder,u8 lane_mask,u16 addr);void intel_cx0_write (struct intel_encoder *encoder,u8 lane_mask,u16 addr,u8 data,bool committed); +int intel_cx0_wait_for_ack (struct intel_encoder *encoder, +int command,int lane,u32 *val); +void intel_cx0_bus_reset (struct intel_encoder *encoder,int lane);int intel_mtl_tbt_calc_port_clock (struct intel_encoder *encoder);void intel_cx0_pll_power_save_wa (struct intel_display *display); void intel_lnl_mac_transmit_lfps(struct intel_encoder *encoder,
drivers/gpu/drm/i915/display/intel_cx0_phy_regs.h +1 -0
@@ -50,6 +50,7 @@#define XELPDP_PORT_M2P_COMMAND_WRITE_UNCOMMITTED REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x1)#define XELPDP_PORT_M2P_COMMAND_WRITE_COMMITTED REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x2)#define XELPDP_PORT_M2P_COMMAND_READ REG_FIELD_PREP(XELPDP_PORT_M2P_COMMAND_TYPE_MASK, 0x3) +#define XELPDP_PORT_P2P_TRANSACTION_PENDING REG_BIT(24)#define XELPDP_PORT_M2P_DATA_MASK REG_GENMASK(23, 16)#define XELPDP_PORT_M2P_DATA (val) REG_FIELD_PREP(XELPDP_PORT_M2P_DATA_MASK, val)#define XELPDP_PORT_M2P_TRANSACTION_RESET REG_BIT(15)
drivers/gpu/drm/i915/display/intel_lt_phy.c +117 -0
135 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_lt_phy_regs.h +15 -0
@@ -6,12 +6,17 @@#ifndef __INTEL_LT_PHY_REGS_H__#define __INTEL_LT_PHY_REGS_H__ +#define XE3PLPD_MSGBUS_TIMEOUT_FAST_US 500#define XE3PLPD_MACCLK_TURNON_LATENCY_MS 1#define XE3PLPD_MACCLK_TURNON_LATENCY_US 21#define XE3PLPD_RATE_CALIB_DONE_LATENCY_US 50#define XE3PLPD_RESET_START_LATENCY_US 10#define XE3PLPD_RESET_END_LATENCY_US 200 +/* LT Phy MAC Register */ +#define LT_PHY_MAC_VDR _MMIO(0xC00) +#define LT_PHY_PCLKIN_GATE REG_BIT8(0) +/* LT Phy Vendor Register */ #define LT_PHY_VDR_0_CONFIG 0xC02#define LT_PHY_VDR_DP_PLL_ENABLE REG_BIT(7)
@@ -26,6 +31,7 @@#define LT_PHY_VDR_X_DATAY (idx, y) ((0xC06 + (3 - (y))) + 0x6 * (idx))#define LT_PHY_RATE_UPDATE 0xCC4 +#define LT_PHY_RATE_CONTROL_VDR_UPDATE REG_BIT8(0)#define _XE3PLPD_PORT_BUF_CTL5 (idx) _MMIO(_PICK_EVEN_2RANGES(idx, PORT_TC1, \ _XELPDP_PORT_BUF_CTL1_LN0_A, \
@@ -38,4 +44,13 @@#define XE3PLPD_MACCLK_RATE_MASK REG_GENMASK(4, 0)#define XE3PLPD_MACCLK_RATE_DEF REG_FIELD_PREP(XE3PLPD_MACCLK_RATE_MASK, 0x1F) +#define _XE3PLPD_PORT_P2M_MSGBUS_STATUS_P2P (idx, lane) _MMIO(_PICK_EVEN_2RANGES(idx, PORT_TC1, \ + _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_A, \ + _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_B, \ + _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC1, \ + _XELPDP_PORT_M2P_MSGBUS_CTL_LN0_USBC2) \ + + 0x60 + (lane) * 0x4) +#define XE3PLPD_PORT_P2M_MSGBUS_STATUS_P2P (port, lane) _XE3PLPD_PORT_P2M_MSGBUS_STATUS_P2P(__xe2lpd_port_idx(port), \ + lane) +#define XE3LPD_PORT_P2M_ADDR_MASK REG_GENMASK(11, 0)#endif /* __INTEL_LT_PHY_REGS_H__ */
Signature · 1 line
2.34.1
PATCH v4 14/25 drm/i915/ltphy: Program the rest of the PORT_CLOCK_CTL steps
In reply to Suraj KandpalProgram the rest of the steps with regards to PORT_CLOCK_CTL in Non-TBT PLL enable sequence.
--- drivers/gpu/drm/i915/display/intel_lt_phy.c | 25 +++++++++++++++++++ .../gpu/drm/i915/display/intel_lt_phy_regs.h | 1 + 2 files changed, 26 insertions(+)
drivers/gpu/drm/i915/display/intel_lt_phy.c +25 -0
@@ -1506,6 +1506,8 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder,struct intel_digital_port *dig_port =enc_to_dig_port (encoder);bool lane_reversal = dig_port->lane_reversal;u8 owned_lane_mask =intel_lt_phy_get_owned_lane_mask (encoder); +enum phy phy =intel_encoder_to_phy (encoder); +enum port port = encoder->port;intel_wakeref_t wakeref =0 ; wakeref =intel_lt_phy_transaction_begin (encoder);
@@ -1546,19 +1548,42 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder, LT_PHY_PCLKIN_GATE);/* 7. Program PORT_CLOCK_CTL[PCLK PLL Request LN0] = 0. */ +intel_de_rmw (display,XELPDP_PORT_CLOCK_CTL (display, port), +XELPDP_LANE_PCLK_PLL_REQUEST (0 ),0 ); +/* 8. Poll for PORT_CLOCK_CTL[PCLK PLL Ack LN0]= 0. */ +if (intel_de_wait_custom (display,XELPDP_PORT_CLOCK_CTL (display, port), +XELPDP_LANE_PCLK_PLL_ACK (0 ),0 , +XE3PLPD_MACCLK_TURNOFF_LATENCY_US ,0 ,NULL )) +drm_warn (display->drm,"PHY %c PLL MacCLK Ack deassertion Timeout after %dus.\n" , +phy_name (phy),XE3PLPD_MACCLK_TURNOFF_LATENCY_US ); +/* * 9. Follow the Display Voltage Frequency Switching - Sequence Before Frequency * Change. We handle this step in bxt_set_cdclk(). */ /* 10. Program DDI_CLK_VALFREQ to match intended DDI clock frequency. */ /* 11. Program PORT_CLOCK_CTL[PCLK PLL Request LN0] = 1. */ +intel_de_rmw (display,XELPDP_PORT_CLOCK_CTL (display, port), +XELPDP_LANE_PCLK_PLL_REQUEST (0 ), +XELPDP_LANE_PCLK_PLL_REQUEST (0 )); +/* 12. Poll for PORT_CLOCK_CTL[PCLK PLL Ack LN0]= 1. */ +if (intel_de_wait_custom (display,XELPDP_PORT_CLOCK_CTL (display, port), +XELPDP_LANE_PCLK_PLL_ACK (0 ), +XELPDP_LANE_PCLK_PLL_ACK (0 ), +XE3PLPD_MACCLK_TURNON_LATENCY_US ,2 ,NULL )) +drm_warn (display->drm,"PHY %c PLL MacCLK Ack assertion Timeout after %dus.\n" , +phy_name (phy),XE3PLPD_MACCLK_TURNON_LATENCY_US ); }else {intel_de_write (display,DDI_CLK_VALFREQ (encoder->port), crtc_state->port_clock); }/* 13. Ungate the forward clock by setting PORT_CLOCK_CTL[Forward Clock Ungate] = 1. */ +intel_de_rmw (display,XELPDP_PORT_CLOCK_CTL (display, port), +XELPDP_FORWARD_CLOCK_UNGATE , +XELPDP_FORWARD_CLOCK_UNGATE ); +/* 14. SW clears PORT_BUF_CTL2 [PHY Pulse Status]. */ /* * 15. Clear the PHY VDR register 0xCC4[Rate Control VDR Update] over PHY message bus for
drivers/gpu/drm/i915/display/intel_lt_phy_regs.h +1 -0
@@ -9,6 +9,7 @@#define XE3PLPD_MSGBUS_TIMEOUT_FAST_US 500#define XE3PLPD_MACCLK_TURNON_LATENCY_MS 1#define XE3PLPD_MACCLK_TURNON_LATENCY_US 21 +#define XE3PLPD_MACCLK_TURNOFF_LATENCY_US 1#define XE3PLPD_RATE_CALIB_DONE_LATENCY_US 50#define XE3PLPD_RESET_START_LATENCY_US 10#define XE3PLPD_RESET_END_LATENCY_US 200
Signature · 1 line
2.34.1
PATCH v4 15/25 drm/i915/ltphy: Program the rest of the LT Phy Enable sequence
In reply to Suraj KandpalProgram the rest of the LT Phy Non TBT PLL Enable sequence. This can be done in a single patch since the rest of the prequistie functions are already coded in.
Bspec: 74492, 69701
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 4 +-- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 2 ++ drivers/gpu/drm/i915/display/intel_lt_phy.c | 28 ++++++++++++++++++++ 3 files changed, 32 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +2 -2
@@ -408,8 +408,8 @@ static void __intel_cx0_rmw(struct intel_encoder *encoder,__intel_cx0_write (encoder, lane, addr, val, committed); } -static void intel_cx0_rmw (struct intel_encoder *encoder, -u8 lane_mask,u16 addr,u8 clear,u8 set,bool committed) +void intel_cx0_rmw (struct intel_encoder *encoder, +u8 lane_mask,u16 addr,u8 clear,u8 set,bool committed) {u8 lane;
drivers/gpu/drm/i915/display/intel_cx0_phy.h +2 -0
@@ -52,6 +52,8 @@ int intel_cx0_phy_check_hdmi_link_rate(struct intel_hdmi *hdmi, int clock);void intel_cx0_setup_powerdown (struct intel_encoder *encoder);bool intel_cx0_is_hdmi_frl (u32 clock);u8 intel_cx0_read (struct intel_encoder *encoder,u8 lane_mask,u16 addr); +void intel_cx0_rmw (struct intel_encoder *encoder, +u8 lane_mask,u16 addr,u8 clear,u8 set,bool committed);void intel_cx0_write (struct intel_encoder *encoder,u8 lane_mask,u16 addr,u8 data,bool committed); int intel_cx0_wait_for_ack(struct intel_encoder *encoder,
drivers/gpu/drm/i915/display/intel_lt_phy.c +28 -0
@@ -1509,6 +1509,11 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder,enum phy phy =intel_encoder_to_phy (encoder);enum port port = encoder->port;intel_wakeref_t wakeref =0 ; +u32 lane_phy_pulse_status = owned_lane_mask ==INTEL_LT_PHY_BOTH_LANES + ? (XE3PLPDP_LANE_PHY_PULSE_STATUS (0 ) | +XE3PLPDP_LANE_PHY_PULSE_STATUS (1 )) + :XE3PLPDP_LANE_PHY_PULSE_STATUS (0 ); +u8 rate_update; wakeref =intel_lt_phy_transaction_begin (encoder);
@@ -1563,6 +1568,9 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder,* Change. We handle this step in bxt_set_cdclk(). */ /* 10. Program DDI_CLK_VALFREQ to match intended DDI clock frequency. */ +intel_de_write (display,DDI_CLK_VALFREQ (encoder->port), + crtc_state->port_clock); +/* 11. Program PORT_CLOCK_CTL[PCLK PLL Request LN0] = 1. */ intel_de_rmw(display, XELPDP_PORT_CLOCK_CTL(display, port), XELPDP_LANE_PCLK_PLL_REQUEST(0),
@@ -1585,17 +1593,37 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder, XELPDP_FORWARD_CLOCK_UNGATE);/* 14. SW clears PORT_BUF_CTL2 [PHY Pulse Status]. */ +intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), + lane_phy_pulse_status, + lane_phy_pulse_status);/* * 15. Clear the PHY VDR register 0xCC4[Rate Control VDR Update] over PHY message bus for * Owned PHY Lanes. */ + rate_update =intel_lt_phy_read (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_RATE_UPDATE ); + rate_update &= ~LT_PHY_RATE_CONTROL_VDR_UPDATE ; +intel_lt_phy_write (encoder, owned_lane_mask,LT_PHY_RATE_UPDATE , + rate_update,MB_WRITE_COMMITTED ); +/* 16. Poll for PORT_BUF_CTL2 register PHY Pulse Status = 1 for Owned PHY Lanes. */ +if (intel_de_wait_custom (display,XELPDP_PORT_BUF_CTL2 (display, port), + lane_phy_pulse_status, lane_phy_pulse_status, +XE3PLPD_RATE_CALIB_DONE_LATENCY_US ,2 ,NULL )) +drm_warn (display->drm,"PHY %c PLL rate not changed after %dus.\n" , +phy_name (phy),XE3PLPD_RATE_CALIB_DONE_LATENCY_US ); +/* 17. SW clears PORT_BUF_CTL2 [PHY Pulse Status]. */ +intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), + lane_phy_pulse_status, + lane_phy_pulse_status); +/* * 18. Follow the Display Voltage Frequency Switching - Sequence After Frequency Change. * We handle this step in bxt_set_cdclk() */ /* 19. Move the PHY powerdown state to Active and program to enable/disable transmitters */ +intel_lt_phy_powerdown_change_sequence (encoder, owned_lane_mask, +XELPDP_P0_STATE_ACTIVE );intel_lt_phy_transaction_end (encoder, wakeref); }
Signature · 1 line
2.34.1
PATCH v4 16/25 drm/i915/ltphy: Program LT Phy Non-TBT PLL disable sequence
In reply to Suraj KandpalProgram in the steps for Non TBT PLL disable sequence. The whole function can be defined in one shot since most of prequiste functions are already coded in.
Bspec: 74492
--- drivers/gpu/drm/i915/display/intel_lt_phy.c | 78 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.h | 1 + .../gpu/drm/i915/display/intel_lt_phy_regs.h | 1 + 3 files changed, 80 insertions(+)
drivers/gpu/drm/i915/display/intel_lt_phy.c +78 -0
@@ -1627,3 +1627,81 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder,intel_lt_phy_transaction_end (encoder, wakeref); } + +void intel_lt_phy_pll_disable (struct intel_encoder *encoder) +{ +struct intel_display *display =to_intel_display (encoder); +enum phy phy =intel_encoder_to_phy (encoder); +enum port port = encoder->port; +intel_wakeref_t wakeref; +u8 owned_lane_mask =intel_lt_phy_get_owned_lane_mask (encoder); +u32 lane_pipe_reset = owned_lane_mask ==INTEL_LT_PHY_BOTH_LANES + ? (XELPDP_LANE_PIPE_RESET (0 ) | +XELPDP_LANE_PIPE_RESET (1 )) + :XELPDP_LANE_PIPE_RESET (0 ); +u32 lane_phy_current_status = owned_lane_mask ==INTEL_LT_PHY_BOTH_LANES + ? (XELPDP_LANE_PHY_CURRENT_STATUS (0 ) | +XELPDP_LANE_PHY_CURRENT_STATUS (1 )) + :XELPDP_LANE_PHY_CURRENT_STATUS (0 ); +u32 lane_phy_pulse_status = owned_lane_mask ==INTEL_LT_PHY_BOTH_LANES + ? (XE3PLPDP_LANE_PHY_PULSE_STATUS (0 ) | +XE3PLPDP_LANE_PHY_PULSE_STATUS (1 )) + :XE3PLPDP_LANE_PHY_PULSE_STATUS (0 ); + + wakeref =intel_lt_phy_transaction_begin (encoder); + +/* 1. Clear PORT_BUF_CTL2 [PHY Pulse Status]. */ +intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), + lane_phy_pulse_status, + lane_phy_pulse_status); + +/* 2. Set PORT_BUF_CTL2<port> Lane<PHY Lanes Owned> Pipe Reset to 1. */ +intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), lane_pipe_reset, + lane_pipe_reset); + +/* 3. Poll for PORT_BUF_CTL2<port> Lane<PHY Lanes Owned> PHY Current Status == 1. */ +if (intel_de_wait_custom (display,XELPDP_PORT_BUF_CTL2 (display, port), + lane_phy_current_status, + lane_phy_current_status, +XE3PLPD_RESET_START_LATENCY_US ,0 ,NULL )) +drm_warn (display->drm, +"PHY %c failed to reset Lane after %dms.\n" , +phy_name (phy),XE3PLPD_RESET_START_LATENCY_US ); + +/* 4. Clear for PHY pulse status on owned PHY lanes. */ +intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), + lane_phy_pulse_status, + lane_phy_pulse_status); + +/* +* 5. Follow the Display Voltage Frequency Switching - +* Sequence Before Frequency Change. We handle this step in bxt_set_cdclk(). +*/ +/* 6. Program PORT_CLOCK_CTL[PCLK PLL Request LN0] = 0. */ +intel_de_rmw (display,XELPDP_PORT_CLOCK_CTL (display, port), +XELPDP_LANE_PCLK_PLL_REQUEST (0 ),0 ); + +/* 7. Program DDI_CLK_VALFREQ to 0. */ +intel_de_write (display,DDI_CLK_VALFREQ (encoder->port),0 ); + +/* 8. Poll for PORT_CLOCK_CTL[PCLK PLL Ack LN0]= 0. */ +if (intel_de_wait_custom (display,XELPDP_PORT_CLOCK_CTL (display, port), +XELPDP_LANE_PCLK_PLL_ACK (0 ),0 , +XE3PLPD_MACCLK_TURNOFF_LATENCY_US ,0 ,NULL )) +drm_warn (display->drm,"PHY %c PLL MacCLK Ack deassertion Timeout after %dus.\n" , +phy_name (phy),XE3PLPD_MACCLK_TURNOFF_LATENCY_US ); + +/* +* 9. Follow the Display Voltage Frequency Switching - +* Sequence After Frequency Change. We handle this step in bxt_set_cdclk(). +*/ +/* 10. Program PORT_CLOCK_CTL register to disable and gate clocks. */ +intel_de_rmw (display,XELPDP_PORT_CLOCK_CTL (display, port), +XELPDP_DDI_CLOCK_SELECT_MASK (display) |XELPDP_FORWARD_CLOCK_UNGATE ,0 ); + +/* 11. Program PORT_BUF_CTL5[MacCLK Reset_0] = 1 to assert MacCLK reset. */ +intel_de_rmw (display,XE3PLPD_PORT_BUF_CTL5 (port), +XE3PLPD_MACCLK_RESET_0 ,XE3PLPD_MACCLK_RESET_0 ); + +intel_lt_phy_transaction_end (encoder, wakeref); +}
drivers/gpu/drm/i915/display/intel_lt_phy.h +1 -0
@@ -14,6 +14,7 @@ struct intel_lt_phy_pll_state;void intel_lt_phy_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state); +void intel_lt_phy_pll_disable (struct intel_encoder *encoder);int intel_lt_phy_pll_calc_state (struct intel_crtc_state *crtc_state,struct intel_encoder *encoder);
drivers/gpu/drm/i915/display/intel_lt_phy_regs.h +1 -0
@@ -12,6 +12,7 @@#define XE3PLPD_MACCLK_TURNOFF_LATENCY_US 1#define XE3PLPD_RATE_CALIB_DONE_LATENCY_US 50#define XE3PLPD_RESET_START_LATENCY_US 10 +#define XE3PLPD_PWRDN_TO_RDY_LATENCY_US 4#define XE3PLPD_RESET_END_LATENCY_US 200/* LT Phy MAC Register */
Signature · 1 line
2.34.1
PATCH v4 17/25 drm/i915/ltphy: Hook up LT Phy Enable & Disable sequences
In reply to Suraj KandpalHook up the LT Phy enable and disable sequences using encoder-> enable/disable_clock and reusing the TBT enable disable sequence from cx0 PHY since it remains the same.
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 7 ++++--- drivers/gpu/drm/i915/display/intel_cx0_phy.h | 3 +++ drivers/gpu/drm/i915/display/intel_ddi.c | 7 ++++++- drivers/gpu/drm/i915/display/intel_lt_phy.c | 21 ++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.h | 3 +++ 5 files changed, 37 insertions(+), 4 deletions(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +4 -3
@@ -18,6 +18,7 @@#include "intel_display_types.h" #include "intel_dp.h" #include "intel_hdmi.h" +#include "intel_lt_phy.h" #include "intel_panel.h" #include "intel_psr.h" #include "intel_snps_hdmi_pll.h"
@@ -3150,8 +3151,8 @@ static int intel_mtl_tbt_clock_select(struct intel_display *display, } } -static void intel_mtl_tbt_pll_enable (struct intel_encoder *encoder, -const struct intel_crtc_state *crtc_state) +void intel_mtl_tbt_pll_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) {struct intel_display *display =to_intel_display (encoder);enum phy phy =intel_encoder_to_phy (encoder);
@@ -3335,7 +3336,7 @@ static bool intel_cx0_pll_is_enabled(struct intel_encoder *encoder)intel_cx0_get_pclk_pll_request (lane); } -static void intel_mtl_tbt_pll_disable (struct intel_encoder *encoder) +void intel_mtl_tbt_pll_disable (struct intel_encoder *encoder) {struct intel_display *display =to_intel_display (encoder);enum phy phy =intel_encoder_to_phy (encoder);
drivers/gpu/drm/i915/display/intel_cx0_phy.h +3 -0
@@ -63,5 +63,8 @@ int intel_mtl_tbt_calc_port_clock(struct intel_encoder *encoder);void intel_cx0_pll_power_save_wa (struct intel_display *display);void intel_lnl_mac_transmit_lfps (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state); +void intel_mtl_tbt_pll_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state); +void intel_mtl_tbt_pll_disable (struct intel_encoder *encoder);#endif /* __INTEL_CX0_PHY_H__ */
drivers/gpu/drm/i915/display/intel_ddi.c +6 -1
@@ -72,6 +72,7 @@#include "intel_hotplug.h" #include "intel_hti.h" #include "intel_lspcon.h" +#include "intel_lt_phy.h" #include "intel_mg_phy_regs.h" #include "intel_modeset_lock.h" #include "intel_panel.h"
@@ -5231,7 +5232,11 @@ void intel_ddi_init(struct intel_display *display, encoder->cloneable =0 ; encoder->pipe_mask = ~0 ; -if (DISPLAY_VER (display) >=14 ) { +if (HAS_LT_PHY (display)) { + encoder->enable_clock = intel_xe3plpd_pll_enable; + encoder->disable_clock = intel_xe3plpd_pll_disable; + encoder->port_pll_type = intel_mtl_port_pll_type; + }else if (DISPLAY_VER (display) >=14 ) { encoder->enable_clock = intel_mtl_pll_enable; encoder->disable_clock = intel_mtl_pll_disable; encoder->port_pll_type = intel_mtl_port_pll_type;
drivers/gpu/drm/i915/display/intel_lt_phy.c +21 -0
@@ -1705,3 +1705,24 @@ void intel_lt_phy_pll_disable(struct intel_encoder *encoder)intel_lt_phy_transaction_end (encoder, wakeref); } + +void intel_xe3plpd_pll_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) +{ +struct intel_digital_port *dig_port =enc_to_dig_port (encoder); + +if (intel_tc_port_in_tbt_alt_mode (dig_port)) +intel_mtl_tbt_pll_enable (encoder, crtc_state); +else +intel_lt_phy_pll_enable (encoder, crtc_state); +} + +void intel_xe3plpd_pll_disable (struct intel_encoder *encoder) +{ +struct intel_digital_port *dig_port =enc_to_dig_port (encoder); + +if (intel_tc_port_in_tbt_alt_mode (dig_port)) +intel_mtl_tbt_pll_disable (encoder); +else +intel_lt_phy_pll_disable (encoder); +}
drivers/gpu/drm/i915/display/intel_lt_phy.h +3 -0
@@ -20,6 +20,9 @@ intel_lt_phy_pll_calc_state(struct intel_crtc_state *crtc_state, struct intel_encoder *encoder);int intel_lt_phy_calc_port_clock (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state); +void intel_xe3plpd_pll_enable (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state); +void intel_xe3plpd_pll_disable (struct intel_encoder *encoder);#define HAS_LT_PHY (display) (DISPLAY_VER(display) >= 35)
Signature · 1 line
2.34.1
PATCH v4 18/25 drm/i915/ddi: Define LT Phy Swing tables
In reply to Suraj KandpalDefine and initialize LT Phy Swing tables for DP 1.4, 2.1 and eDp. HDMI TMDS is not needed since LT Phy H/w handles that.
Bspec: 74493
--- .../drm/i915/display/intel_ddi_buf_trans.c | 81 ++++++++++++++++++- .../drm/i915/display/intel_ddi_buf_trans.h | 9 +++ 2 files changed, 89 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.c +80 -1
@@ -10,6 +10,7 @@#include "intel_de.h" #include "intel_display_types.h" #include "intel_dp.h" +#include "intel_lt_phy.h" /* HDMI/DVI modes ignore everything but the last 2 items. So we share * them for both DP and FDI transports, allowing those ports to
@@ -1115,6 +1116,69 @@ static const struct intel_ddi_buf_trans mtl_c20_trans_uhbr = { .num_entries = ARRAY_SIZE(_mtl_c20_trans_uhbr), }; +/* DP1.4 */ +static const union intel_ddi_buf_trans_entry _xe3plpd_lt_trans_dp14[] = { + { .lt = {1 ,0 ,0 ,21 ,0 } }, + { .lt = {1 ,1 ,0 ,24 ,3 } }, + { .lt = {1 ,2 ,0 ,28 ,7 } }, + { .lt = {0 ,3 ,0 ,35 ,13 } }, + { .lt = {1 ,1 ,0 ,27 ,0 } }, + { .lt = {1 ,2 ,0 ,31 ,4 } }, + { .lt = {0 ,3 ,0 ,39 ,9 } }, + { .lt = {1 ,2 ,0 ,35 ,0 } }, + { .lt = {0 ,3 ,0 ,41 ,7 } }, + { .lt = {0 ,3 ,0 ,48 ,0 } }, +}; + +/* DP2.1 */ +static const union intel_ddi_buf_trans_entry _xe3plpd_lt_trans_uhbr[] = { + { .lt = {0 ,0 ,0 ,48 ,0 } }, + { .lt = {0 ,0 ,0 ,43 ,5 } }, + { .lt = {0 ,0 ,0 ,40 ,8 } }, + { .lt = {0 ,0 ,0 ,37 ,11 } }, + { .lt = {0 ,0 ,0 ,33 ,15 } }, + { .lt = {0 ,0 ,2 ,46 ,0 } }, + { .lt = {0 ,0 ,2 ,42 ,4 } }, + { .lt = {0 ,0 ,2 ,38 ,8 } }, + { .lt = {0 ,0 ,2 ,35 ,11 } }, + { .lt = {0 ,0 ,2 ,33 ,13 } }, + { .lt = {0 ,0 ,4 ,44 ,0 } }, + { .lt = {0 ,0 ,4 ,40 ,4 } }, + { .lt = {0 ,0 ,4 ,37 ,7 } }, + { .lt = {0 ,0 ,4 ,33 ,11 } }, + { .lt = {0 ,0 ,8 ,40 ,0 } }, + { .lt = {1 ,0 ,2 ,26 ,2 } }, +}; + +/* eDp */ +static const union intel_ddi_buf_trans_entry _xe3plpd_lt_trans_edp[] = { + { .lt = {1 ,0 ,0 ,12 ,0 } }, + { .lt = {1 ,1 ,0 ,13 ,1 } }, + { .lt = {1 ,2 ,0 ,15 ,3 } }, + { .lt = {1 ,3 ,0 ,19 ,7 } }, + { .lt = {1 ,1 ,0 ,14 ,0 } }, + { .lt = {1 ,2 ,0 ,16 ,2 } }, + { .lt = {1 ,3 ,0 ,21 ,5 } }, + { .lt = {1 ,2 ,0 ,18 ,0 } }, + { .lt = {1 ,3 ,0 ,22 ,4 } }, + { .lt = {1 ,3 ,0 ,26 ,0 } }, +}; + +static const struct intel_ddi_buf_trans xe3plpd_lt_trans_dp14 = { + .entries = _xe3plpd_lt_trans_dp14, + .num_entries =ARRAY_SIZE (_xe3plpd_lt_trans_dp14), +}; + +static const struct intel_ddi_buf_trans xe3plpd_lt_trans_uhbr = { + .entries = _xe3plpd_lt_trans_uhbr, + .num_entries =ARRAY_SIZE (_xe3plpd_lt_trans_uhbr), +}; + +static const struct intel_ddi_buf_trans xe3plpd_lt_trans_edp = { + .entries = _xe3plpd_lt_trans_edp, + .num_entries =ARRAY_SIZE (_xe3plpd_lt_trans_edp), +}; +bool is_hobl_buf_trans (const struct intel_ddi_buf_trans *table) {return table == &tgl_combo_phy_trans_edp_hbr2_hobl;
@@ -1707,11 +1771,26 @@ mtl_get_c20_buf_trans(struct intel_encoder *encoder,return intel_get_buf_trans (&mtl_c20_trans_dp14, n_entries); } +static const struct intel_ddi_buf_trans * +xe3plpd_get_lt_buf_trans (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +int *n_entries) +{ +if (intel_crtc_has_dp_encoder (crtc_state) &&intel_dp_is_uhbr (crtc_state)) +return intel_get_buf_trans (&xe3plpd_lt_trans_uhbr, n_entries); +else if (intel_crtc_has_type (crtc_state,INTEL_OUTPUT_EDP )) +return intel_get_buf_trans (&xe3plpd_lt_trans_edp, n_entries); +else +return intel_get_buf_trans (&xe3plpd_lt_trans_dp14, n_entries); +} +void intel_ddi_buf_trans_init (struct intel_encoder *encoder) {struct intel_display *display =to_intel_display (encoder); -if (DISPLAY_VER (display) >=14 ) { +if (HAS_LT_PHY (display)) { + encoder->get_buf_trans = xe3plpd_get_lt_buf_trans; + }else if (DISPLAY_VER (display) >=14 ) {if (intel_encoder_is_c10phy (encoder)) encoder->get_buf_trans = mtl_get_c10_buf_trans;else
drivers/gpu/drm/i915/display/intel_ddi_buf_trans.h +9 -0
@@ -50,6 +50,14 @@ struct dg2_snps_phy_buf_trans {u8 post_cursor; }; +struct xe3plpd_lt_phy_buf_trans { +u8 txswing; +u8 txswing_level; +u8 pre_cursor; +u8 main_cursor; +u8 post_cursor; +}; +union intel_ddi_buf_trans_entry {struct hsw_ddi_buf_trans hsw;struct bxt_ddi_buf_trans bxt;
@@ -57,6 +65,7 @@ union intel_ddi_buf_trans_entry {struct icl_mg_phy_ddi_buf_trans mg;struct tgl_dkl_phy_ddi_buf_trans dkl;struct dg2_snps_phy_buf_trans snps; +struct xe3plpd_lt_phy_buf_trans lt; };struct intel_ddi_buf_trans {
Signature · 1 line
2.34.1
PATCH v4 19/25 drm/i915/ltphy: Program LT Phy Voltage Swing
In reply to Suraj KandpalProgram LT Phy voltage swing using the Swing tables and plug in the function at encoder->set_signal_level
Bspec: 74493
--- drivers/gpu/drm/i915/display/intel_ddi.c | 13 +++- drivers/gpu/drm/i915/display/intel_lt_phy.c | 63 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.h | 2 + .../gpu/drm/i915/display/intel_lt_phy_regs.h | 13 ++++ 4 files changed, 88 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/display/intel_ddi.c +10 -3
@@ -1467,10 +1467,15 @@ static int translate_signal_level(struct intel_dp *intel_dp, u8 signal_levels) {struct intel_display *display =to_intel_display (intel_dp); +const u8 *signal_array; +size_t array_size;int i; -for (i =0 ; i <ARRAY_SIZE (index_to_dp_signal_levels); i++) { -if (index_to_dp_signal_levels[i] == signal_levels) + signal_array = index_to_dp_signal_levels; + array_size =ARRAY_SIZE (index_to_dp_signal_levels); + +for (i =0 ; i < array_size; i++) { +if (signal_array[i] == signal_levels)return i; }
@@ -5301,7 +5306,9 @@ void intel_ddi_init(struct intel_display *display, encoder->get_config = hsw_ddi_get_config; } -if (DISPLAY_VER (display) >=14 ) { +if (HAS_LT_PHY (display)) { + encoder->set_signal_levels = intel_lt_phy_set_signal_levels; + }else if (DISPLAY_VER (display) >=14 ) { encoder->set_signal_levels = intel_cx0_phy_set_signal_levels; }else if (display->platform.dg2) { encoder->set_signal_levels = intel_snps_phy_set_signal_levels;
drivers/gpu/drm/i915/display/intel_lt_phy.c +63 -0
81 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_lt_phy.h +2 -0
@@ -20,6 +20,8 @@ intel_lt_phy_pll_calc_state(struct intel_crtc_state *crtc_state, struct intel_encoder *encoder);int intel_lt_phy_calc_port_clock (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state); +void intel_lt_phy_set_signal_levels (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state);void intel_xe3plpd_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state);void intel_xe3plpd_pll_disable (struct intel_encoder *encoder);
drivers/gpu/drm/i915/display/intel_lt_phy_regs.h +13 -0
@@ -19,6 +19,19 @@#define LT_PHY_MAC_VDR _MMIO(0xC00)#define LT_PHY_PCLKIN_GATE REG_BIT8(0) +/* LT Phy Pipe Spec Registers */ +#define LT_PHY_TXY_CTL8 (idx) (0x408 + (0x200 * (idx))) +#define LT_PHY_TX_SWING_LEVEL_MASK REG_GENMASK8(7, 4) +#define LT_PHY_TX_SWING_LEVEL (val) REG_FIELD_PREP8(LT_PHY_TX_SWING_LEVEL_MASK, val) +#define LT_PHY_TX_SWING_MASK REG_BIT8(3) +#define LT_PHY_TX_SWING (val) REG_FIELD_PREP8(LT_PHY_TX_SWING_MASK, val) + +#define LT_PHY_TXY_CTL2 (idx) (0x402 + (0x200 * (idx))) +#define LT_PHY_TXY_CTL3 (idx) (0x403 + (0x200 * (idx))) +#define LT_PHY_TXY_CTL4 (idx) (0x404 + (0x200 * (idx))) +#define LT_PHY_TX_CURSOR_MASK REG_GENMASK8(5, 0) +#define LT_PHY_TX_CURSOR (val) REG_FIELD_PREP8(LT_PHY_TX_CURSOR_MASK, val) +/* LT Phy Vendor Register */ #define LT_PHY_VDR_0_CONFIG 0xC02#define LT_PHY_VDR_DP_PLL_ENABLE REG_BIT(7)
Signature · 1 line
2.34.1
PATCH v4 20/25 drm/i915/ltphy: Enable/Disable Tx after Non TBT Enable sequence
In reply to Suraj KandpalWe need to enable and disable the Tx for each active lane after the Non-TBT enable sequence is done.
Bspec: 74500, 74497, 74701
--- drivers/gpu/drm/i915/display/intel_lt_phy.c | 87 +++++++++++++++++++ .../gpu/drm/i915/display/intel_lt_phy_regs.h | 4 + 2 files changed, 91 insertions(+)
drivers/gpu/drm/i915/display/intel_lt_phy.c +87 -0
@@ -1507,6 +1507,92 @@ intel_lt_phy_program_pll(struct intel_encoder *encoder, } } +static void +intel_lt_phy_enable_disable_tx (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state) +{ +struct intel_digital_port *dig_port =enc_to_dig_port (encoder); +bool lane_reversal = dig_port->lane_reversal; +u8 lane_count = crtc_state->lane_count; +bool is_dp_alt = +intel_tc_port_in_dp_alt_mode (dig_port); +enum intel_tc_pin_assignment tc_pin = +intel_tc_port_get_pin_assignment (dig_port); +u8 transmitter_mask =0 ; + +/* +* We have a two transmitters per lane and total of 2 PHY lanes so a total +* of 4 transmitters. We prepare a mask of the lanes that need to be activated +* and the transmitter which need to be activated for each lane. TX 0,1 correspond +* to LANE0 and TX 2, 3 correspond to LANE1. +*/ + +switch (lane_count) { +case 1 : + transmitter_mask = lane_reversal ?REG_BIT8 (3 ) :REG_BIT8 (0 ); +if (is_dp_alt) { +if (tc_pin ==INTEL_TC_PIN_ASSIGNMENT_D ) + transmitter_mask =REG_BIT8 (0 ); +else + transmitter_mask =REG_BIT8 (1 ); + } +break ; +case 2 : + transmitter_mask = lane_reversal ?REG_GENMASK8 (3 ,2 ) :REG_GENMASK8 (1 ,0 ); +if (is_dp_alt) + transmitter_mask =REG_GENMASK8 (1 ,0 ); +break ; +case 3 : + transmitter_mask = lane_reversal ?REG_GENMASK8 (3 ,1 ) :REG_GENMASK8 (2 ,0 ); +if (is_dp_alt) + transmitter_mask =REG_GENMASK8 (2 ,0 ); +break ; +case 4 : + transmitter_mask =REG_GENMASK8 (3 ,0 ); +break ; +default : +MISSING_CASE (lane_count); + transmitter_mask =REG_GENMASK8 (3 ,0 ); +break ; + } + +if (transmitter_mask &BIT (0 )) { +intel_lt_phy_p2p_write (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_TXY_CTL10 (0 ), +LT_PHY_TX_LANE_ENABLE ,LT_PHY_TXY_CTL10_MAC (0 ), +LT_PHY_TX_LANE_ENABLE ); + }else { +intel_lt_phy_p2p_write (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_TXY_CTL10 (0 ), +0 ,LT_PHY_TXY_CTL10_MAC (0 ),0 ); + } + +if (transmitter_mask &BIT (1 )) { +intel_lt_phy_p2p_write (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_TXY_CTL10 (1 ), +LT_PHY_TX_LANE_ENABLE ,LT_PHY_TXY_CTL10_MAC (1 ), +LT_PHY_TX_LANE_ENABLE ); + }else { +intel_lt_phy_p2p_write (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_TXY_CTL10 (1 ), +0 ,LT_PHY_TXY_CTL10_MAC (1 ),0 ); + } + +if (transmitter_mask &BIT (2 )) { +intel_lt_phy_p2p_write (encoder,INTEL_LT_PHY_LANE1 ,LT_PHY_TXY_CTL10 (0 ), +LT_PHY_TX_LANE_ENABLE ,LT_PHY_TXY_CTL10_MAC (0 ), +LT_PHY_TX_LANE_ENABLE ); + }else { +intel_lt_phy_p2p_write (encoder,INTEL_LT_PHY_LANE1 ,LT_PHY_TXY_CTL10 (0 ), +0 ,LT_PHY_TXY_CTL10_MAC (0 ),0 ); + } + +if (transmitter_mask &BIT (3 )) { +intel_lt_phy_p2p_write (encoder,INTEL_LT_PHY_LANE1 ,LT_PHY_TXY_CTL10 (1 ), +LT_PHY_TX_LANE_ENABLE ,LT_PHY_TXY_CTL10_MAC (1 ), +LT_PHY_TX_LANE_ENABLE ); + }else { +intel_lt_phy_p2p_write (encoder,INTEL_LT_PHY_LANE1 ,LT_PHY_TXY_CTL10 (1 ), +0 ,LT_PHY_TXY_CTL10_MAC (1 ),0 ); + } +} +void intel_lt_phy_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state) {
@@ -1633,6 +1719,7 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder,intel_lt_phy_powerdown_change_sequence (encoder, owned_lane_mask,XELPDP_P0_STATE_ACTIVE ); +intel_lt_phy_enable_disable_tx (encoder, crtc_state);intel_lt_phy_transaction_end (encoder, wakeref); }
drivers/gpu/drm/i915/display/intel_lt_phy_regs.h +4 -0
@@ -32,6 +32,10 @@#define LT_PHY_TX_CURSOR_MASK REG_GENMASK8(5, 0)#define LT_PHY_TX_CURSOR (val) REG_FIELD_PREP8(LT_PHY_TX_CURSOR_MASK, val) +#define LT_PHY_TXY_CTL10 (idx) (0x40A + (0x200 * (idx))) +#define LT_PHY_TXY_CTL10_MAC (idx) _MMIO(LT_PHY_TXY_CTL10(idx)) +#define LT_PHY_TX_LANE_ENABLE REG_BIT8(0) +/* LT Phy Vendor Register */ #define LT_PHY_VDR_0_CONFIG 0xC02#define LT_PHY_VDR_DP_PLL_ENABLE REG_BIT(7)
Signature · 1 line
2.34.1
PATCH v4 21/25 drm/i915/ltphy: Define the LT Phy state compare function
In reply to Suraj KandpalDefine function to compare the state and if mismatch is detected dump both the states.
--- drivers/gpu/drm/i915/display/intel_display.c | 33 +++++++++++++++++++- drivers/gpu/drm/i915/display/intel_lt_phy.c | 30 ++++++++++++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.h | 6 ++++ 3 files changed, 68 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_display.c +32 -1
@@ -101,6 +101,7 @@#include "intel_hdmi.h" #include "intel_hotplug.h" #include "intel_link_bw.h" +#include "intel_lt_phy.h" #include "intel_lvds.h" #include "intel_lvds_regs.h" #include "intel_modeset_setup.h"
@@ -5002,6 +5003,24 @@ static bool allow_vblank_delay_fastset(const struct intel_crtc_state *old_crtc_s !intel_crtc_has_type (old_crtc_state,INTEL_OUTPUT_DSI ); } +static void +pipe_config_lt_phy_pll_mismatch (struct drm_printer *p,bool fastset, +const struct intel_crtc *crtc, +const char *name, +const struct intel_lt_phy_pll_state *a, +const struct intel_lt_phy_pll_state *b) +{ +struct intel_display *display =to_intel_display (crtc); +char *chipname ="LTPHY" ; + +pipe_config_mismatch (p, fastset, crtc, name, chipname); + +drm_printf (p,"expected:\n" ); +intel_lt_phy_dump_hw_state (display, a); +drm_printf (p,"found:\n" ); +intel_lt_phy_dump_hw_state (display, b); +} + bool intel_pipe_config_compare(const struct intel_crtc_state *current_config, const struct intel_crtc_state *pipe_config,
@@ -5126,6 +5145,16 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config, } \ } while (0) +#define PIPE_CONF_CHECK_PLL_LT (name) do { \ + if (!intel_lt_phy_pll_compare_hw_state(¤t_config->name, \ + &pipe_config->name)) { \ + pipe_config_lt_phy_pll_mismatch(&p, fastset, crtc, __stringify(name), \ + ¤t_config->name, \ + &pipe_config->name); \ + ret = false; \ + } \ +} while (0) +#define PIPE_CONF_CHECK_TIMINGS (name) do { \ PIPE_CONF_CHECK_I(name.crtc_hdisplay); \ PIPE_CONF_CHECK_I(name.crtc_htotal); \
@@ -5353,7 +5382,9 @@ intel_pipe_config_compare(const struct intel_crtc_state *current_config,PIPE_CONF_CHECK_PLL (dpll_hw_state);/* FIXME convert MTL+ platforms over to dpll_mgr */ -if (DISPLAY_VER (display) >=14 ) +if (HAS_LT_PHY (display)) +PIPE_CONF_CHECK_PLL_LT (dpll_hw_state.ltpll); +else if (DISPLAY_VER (display) >=14 )PIPE_CONF_CHECK_PLL_CX0 (dpll_hw_state.cx0pll);PIPE_CONF_CHECK_X (dsi_pll.ctrl);
drivers/gpu/drm/i915/display/intel_lt_phy.c +30 -0
@@ -1856,6 +1856,36 @@ void intel_lt_phy_set_signal_levels(struct intel_encoder *encoder,intel_lt_phy_transaction_end (encoder, wakeref); } +void intel_lt_phy_dump_hw_state (struct intel_display *display, +const struct intel_lt_phy_pll_state *hw_state) +{ +int i, j; + +drm_dbg_kms (display->drm,"lt_phy_pll_hw_state:\n" ); +for (i =0 ; i <3 ; i++) { +drm_dbg_kms (display->drm,"config[%d] = 0x%.4x,\n" , + i, hw_state->config[i]); + } + +for (i =0 ; i <=12 ; i++) +for (j =3 ; j >=0 ; j--) +drm_dbg_kms (display->drm,"vdr_data[%d][%d] = 0x%.4x,\n" , + i, j, hw_state->data[i][j]); +} + +bool +intel_lt_phy_pll_compare_hw_state (const struct intel_lt_phy_pll_state *a, +const struct intel_lt_phy_pll_state *b) +{ +if (memcmp (&a->config, &b->config,sizeof (a->config)) !=0 ) +return false; + +if (memcmp (&a->data, &b->data,sizeof (a->data)) !=0 ) +return false; + +return true; +} +void intel_xe3plpd_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state) {
drivers/gpu/drm/i915/display/intel_lt_phy.h +6 -0
@@ -8,6 +8,7 @@#include <linux/types.h> +struct intel_display ;struct intel_encoder ;struct intel_crtc_state ;struct intel_lt_phy_pll_state ;
@@ -22,6 +23,11 @@ int intel_lt_phy_calc_port_clock(struct intel_encoder *encoder, const struct intel_crtc_state *crtc_state);void intel_lt_phy_set_signal_levels (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state); +void intel_lt_phy_dump_hw_state (struct intel_display *display, +const struct intel_lt_phy_pll_state *hw_state); +bool +intel_lt_phy_pll_compare_hw_state (const struct intel_lt_phy_pll_state *a, +const struct intel_lt_phy_pll_state *b);void intel_xe3plpd_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state);void intel_xe3plpd_pll_disable (struct intel_encoder *encoder);
Signature · 1 line
2.34.1
PATCH v4 22/25 drm/i915/ltphy: Define function to readout LT Phy PLL state
In reply to Suraj KandpalDefine a function to readout hw state for LT Phy PLL which can be used in get_config function call.
--- drivers/gpu/drm/i915/display/intel_ddi.c | 14 +++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.c | 33 +++++++++++++++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.h | 3 ++ 3 files changed, 50 insertions(+)
drivers/gpu/drm/i915/display/intel_ddi.c +14 -0
@@ -4246,6 +4246,19 @@ void intel_ddi_get_clock(struct intel_encoder *encoder, &crtc_state->dpll_hw_state); } +static void xe3plpd_ddi_get_config (struct intel_encoder *encoder, +struct intel_crtc_state *crtc_state) +{ +intel_lt_phy_pll_readout_hw_state (encoder, crtc_state, &crtc_state->dpll_hw_state.ltpll); + +if (crtc_state->dpll_hw_state.ltpll.tbt_mode) + crtc_state->port_clock =intel_mtl_tbt_calc_port_clock (encoder); +else + crtc_state->port_clock = +intel_lt_phy_calc_port_clock (encoder, crtc_state); +intel_ddi_get_config (encoder, crtc_state); +} +static void mtl_ddi_get_config (struct intel_encoder *encoder,struct intel_crtc_state *crtc_state) {
@@ -5241,6 +5254,7 @@ void intel_ddi_init(struct intel_display *display, encoder->enable_clock = intel_xe3plpd_pll_enable; encoder->disable_clock = intel_xe3plpd_pll_disable; encoder->port_pll_type = intel_mtl_port_pll_type; + encoder->get_config = xe3plpd_ddi_get_config; }else if (DISPLAY_VER (display) >=14 ) { encoder->enable_clock = intel_mtl_pll_enable; encoder->disable_clock = intel_mtl_pll_disable;
drivers/gpu/drm/i915/display/intel_lt_phy.c +33 -0
@@ -1886,6 +1886,39 @@ intel_lt_phy_pll_compare_hw_state(const struct intel_lt_phy_pll_state *a,return true; } +void intel_lt_phy_pll_readout_hw_state (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +struct intel_lt_phy_pll_state *pll_state) +{ +u8 owned_lane_mask; +u8 lane; +intel_wakeref_t wakeref; +int i, j, k; + + pll_state->tbt_mode =intel_tc_port_in_tbt_alt_mode (enc_to_dig_port (encoder)); +if (pll_state->tbt_mode) +return ; + + owned_lane_mask =intel_lt_phy_get_owned_lane_mask (encoder); + lane = owned_lane_mask &INTEL_LT_PHY_LANE0 ? :INTEL_LT_PHY_LANE1 ; + wakeref =intel_lt_phy_transaction_begin (encoder); + + pll_state->config[0 ] =intel_lt_phy_read (encoder, lane,LT_PHY_VDR_0_CONFIG ); + pll_state->config[1 ] =intel_lt_phy_read (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_VDR_1_CONFIG ); + pll_state->config[2 ] =intel_lt_phy_read (encoder, lane,LT_PHY_VDR_2_CONFIG ); + +for (i =0 ; i <=12 ; i++) { +for (j =3 , k =0 ; j >=0 ; j--, k++) + pll_state->data[i][k] = +intel_lt_phy_read (encoder,INTEL_LT_PHY_LANE0 , +LT_PHY_VDR_X_DATAY (i, j)); + } + + pll_state->clock = +intel_lt_phy_calc_port_clock (encoder, crtc_state); +intel_lt_phy_transaction_end (encoder, wakeref); +} +void intel_xe3plpd_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state) {
drivers/gpu/drm/i915/display/intel_lt_phy.h +3 -0
@@ -28,6 +28,9 @@ void intel_lt_phy_dump_hw_state(struct intel_display *display,bool intel_lt_phy_pll_compare_hw_state (const struct intel_lt_phy_pll_state *a,const struct intel_lt_phy_pll_state *b); +void intel_lt_phy_pll_readout_hw_state (struct intel_encoder *encoder, +const struct intel_crtc_state *crtc_state, +struct intel_lt_phy_pll_state *pll_state);void intel_xe3plpd_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state);void intel_xe3plpd_pll_disable (struct intel_encoder *encoder);
Signature · 1 line
2.34.1
PATCH v4 23/25 drm/i915/ltphy: Define LT PHY PLL state verify function
In reply to Suraj KandpalDefine function to verify the LT PHY PLL state function and call it in intel_modeset_verify_crtc.
--- drivers/gpu/drm/i915/display/intel_cx0_phy.c | 2 +- drivers/gpu/drm/i915/display/intel_lt_phy.c | 56 +++++++++++++++++++ drivers/gpu/drm/i915/display/intel_lt_phy.h | 4 ++ .../drm/i915/display/intel_modeset_verify.c | 2 + 4 files changed, 63 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/display/intel_cx0_phy.c +1 -1
@@ -3575,7 +3575,7 @@ void intel_cx0pll_state_verify(struct intel_atomic_state *state,struct intel_encoder *encoder;struct intel_cx0pll_state mpll_hw_state = {}; -if (DISPLAY_VER (display) <14 ) +if (!IS_DISPLAY_VER (display,14 ,30 ))return ;if (!new_crtc_state->hw.active)
drivers/gpu/drm/i915/display/intel_lt_phy.c +56 -0
66 lines not on this page · raw message
drivers/gpu/drm/i915/display/intel_lt_phy.h +4 -0
@@ -8,9 +8,11 @@#include <linux/types.h> +struct intel_atomic_state ;struct intel_display ;struct intel_encoder ;struct intel_crtc_state ; +struct intel_crtc ;struct intel_lt_phy_pll_state ; void intel_lt_phy_pll_enable(struct intel_encoder *encoder,
@@ -31,6 +33,8 @@ intel_lt_phy_pll_compare_hw_state(const struct intel_lt_phy_pll_state *a,void intel_lt_phy_pll_readout_hw_state (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state,struct intel_lt_phy_pll_state *pll_state); +void intel_lt_phy_pll_state_verify (struct intel_atomic_state *state, +struct intel_crtc *crtc);void intel_xe3plpd_pll_enable (struct intel_encoder *encoder,const struct intel_crtc_state *crtc_state);void intel_xe3plpd_pll_disable (struct intel_encoder *encoder);
drivers/gpu/drm/i915/display/intel_modeset_verify.c +2 -0
@@ -16,6 +16,7 @@#include "intel_display_core.h" #include "intel_display_types.h" #include "intel_fdi.h" +#include "intel_lt_phy.h" #include "intel_modeset_verify.h" #include "intel_snps_phy.h" #include "skl_watermark.h"
@@ -246,6 +247,7 @@ void intel_modeset_verify_crtc(struct intel_atomic_state *state,intel_dpll_state_verify (state, crtc);intel_mpllb_state_verify (state, crtc);intel_cx0pll_state_verify (state, crtc); +intel_lt_phy_pll_state_verify (state, crtc); }void intel_modeset_verify_disabled (struct intel_atomic_state *state)
Signature · 1 line
2.34.1
PATCH v4 24/25 drm/i915/display: Aux Enable and Display powerwell timeouts
In reply to Suraj KandpalFrom XE3P we can now poll if the AUX power is up or down define the timeouts for each respectively.
Bspec: 68967
---
V1 -> V2:
-Remove the extra blank line added (Arun)
.../i915/display/intel_display_power_well.c | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-)
drivers/gpu/drm/i915/display/intel_display_power_well.c +20 -2
@@ -1866,18 +1866,36 @@ static void xelpdp_aux_power_well_enable(struct intel_display *display,* expected to just wait a fixed 600us after raising the request * bit. */ -usleep_range (600 ,1200 ); +if (DISPLAY_VER (display) >=35 ) { +if (intel_de_wait_for_set (display,XELPDP_DP_AUX_CH_CTL (display, aux_ch), +XELPDP_DP_AUX_CH_CTL_POWER_STATUS ,2 )) +drm_warn (display->drm, +"Timeout waiting for PHY %c AUX channel power to be up\n" , +phy_name (phy)); + }else { +usleep_range (600 ,1200 ); + } }static void xelpdp_aux_power_well_disable (struct intel_display *display,struct i915_power_well *power_well) {enum aux_ch aux_ch =i915_power_well_instance (power_well)->xelpdp.aux_ch; +enum phy phy =icl_aux_pw_to_phy (display, power_well);intel_de_rmw (display,XELPDP_DP_AUX_CH_CTL (display, aux_ch),XELPDP_DP_AUX_CH_CTL_POWER_REQUEST ,0 ); -usleep_range (10 ,30 ); + +if (DISPLAY_VER (display) >=35 ) { +if (intel_de_wait_for_clear (display,XELPDP_DP_AUX_CH_CTL (display, aux_ch), +XELPDP_DP_AUX_CH_CTL_POWER_STATUS ,1 )) +drm_warn (display->drm, +"Timeout waiting for PHY %c AUX channel to powerdown\n" , +phy_name (phy)); + }else { +usleep_range (10 ,30 ); + } } static bool xelpdp_aux_power_well_enabled(struct intel_display *display,
Signature · 1 line
2.34.1
PATCH v4 25/25 drm/i915/ltphy: Modify the step that need to be skipped
In reply to Suraj KandpalBspec has changed the non tbt pll enable sequence now we skip steps 5-17 if no config change has occurred.
--- drivers/gpu/drm/i915/display/intel_lt_phy.c | 63 +++++++++++---------- 1 file changed, 33 insertions(+), 30 deletions(-)
drivers/gpu/drm/i915/display/intel_lt_phy.c +33 -30
@@ -1677,40 +1677,43 @@ void intel_lt_phy_pll_enable(struct intel_encoder *encoder, XE3PLPD_MACCLK_TURNON_LATENCY_US, 2, NULL))drm_warn (display->drm,"PHY %c PLL MacCLK Ack assertion Timeout after %dus.\n" ,phy_name (phy),XE3PLPD_MACCLK_TURNON_LATENCY_US ); + +/* +* 13. Ungate the forward clock by setting +* PORT_CLOCK_CTL[Forward Clock Ungate] = 1. +*/ +intel_de_rmw (display,XELPDP_PORT_CLOCK_CTL (display, port), +XELPDP_FORWARD_CLOCK_UNGATE , +XELPDP_FORWARD_CLOCK_UNGATE ); + +/* 14. SW clears PORT_BUF_CTL2 [PHY Pulse Status]. */ +intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), + lane_phy_pulse_status, + lane_phy_pulse_status); +/* +* 15. Clear the PHY VDR register 0xCC4[Rate Control VDR Update] over +* PHY message bus for Owned PHY Lanes. +*/ + rate_update =intel_lt_phy_read (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_RATE_UPDATE ); + rate_update &= ~LT_PHY_RATE_CONTROL_VDR_UPDATE ; +intel_lt_phy_write (encoder, owned_lane_mask,LT_PHY_RATE_UPDATE , + rate_update,MB_WRITE_COMMITTED ); + +/* 16. Poll for PORT_BUF_CTL2 register PHY Pulse Status = 1 for Owned PHY Lanes. */ +if (intel_de_wait_custom (display,XELPDP_PORT_BUF_CTL2 (display, port), + lane_phy_pulse_status, lane_phy_pulse_status, +XE3PLPD_RATE_CALIB_DONE_LATENCY_US ,2 ,NULL )) +drm_warn (display->drm,"PHY %c PLL rate not changed after %dus.\n" , +phy_name (phy),XE3PLPD_RATE_CALIB_DONE_LATENCY_US ); + +/* 17. SW clears PORT_BUF_CTL2 [PHY Pulse Status]. */ +intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), + lane_phy_pulse_status, + lane_phy_pulse_status); }else {intel_de_write (display,DDI_CLK_VALFREQ (encoder->port), crtc_state->port_clock); } -/* 13. Ungate the forward clock by setting PORT_CLOCK_CTL[Forward Clock Ungate] = 1. */ -intel_de_rmw (display,XELPDP_PORT_CLOCK_CTL (display, port), -XELPDP_FORWARD_CLOCK_UNGATE , -XELPDP_FORWARD_CLOCK_UNGATE ); - -/* 14. SW clears PORT_BUF_CTL2 [PHY Pulse Status]. */ -intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), - lane_phy_pulse_status, - lane_phy_pulse_status); -/* -* 15. Clear the PHY VDR register 0xCC4[Rate Control VDR Update] over PHY message bus for -* Owned PHY Lanes. -*/ - rate_update =intel_lt_phy_read (encoder,INTEL_LT_PHY_LANE0 ,LT_PHY_RATE_UPDATE ); - rate_update &= ~LT_PHY_RATE_CONTROL_VDR_UPDATE ; -intel_lt_phy_write (encoder, owned_lane_mask,LT_PHY_RATE_UPDATE , - rate_update,MB_WRITE_COMMITTED ); - -/* 16. Poll for PORT_BUF_CTL2 register PHY Pulse Status = 1 for Owned PHY Lanes. */ -if (intel_de_wait_custom (display,XELPDP_PORT_BUF_CTL2 (display, port), - lane_phy_pulse_status, lane_phy_pulse_status, -XE3PLPD_RATE_CALIB_DONE_LATENCY_US ,2 ,NULL )) -drm_warn (display->drm,"PHY %c PLL rate not changed after %dus.\n" , -phy_name (phy),XE3PLPD_RATE_CALIB_DONE_LATENCY_US ); - -/* 17. SW clears PORT_BUF_CTL2 [PHY Pulse Status]. */ -intel_de_rmw (display,XELPDP_PORT_BUF_CTL2 (display, port), - lane_phy_pulse_status, - lane_phy_pulse_status); -/* * 18. Follow the Display Voltage Frequency Switching - Sequence After Frequency Change. * We handle this step in bxt_set_cdclk()
Signature · 1 line
2.34.1
Patchwork
CI✗ Fi.CI.BUILD: failure for Enable LT PHY (rev4)
In reply to Suraj Kandpal== Series Details ==
== Series Details ==
Series: Enable LT PHY (rev4)
URL : https://patchwork.freedesktop.org/series/155955/
State : failure
== Summary ==
Error: patch https://patchwork.freedesktop.org/api/1.0/series/155955/revisions/4/mbox/ not applied
Applying: drm/i915/ltphy: Add LT Phy related VDR and Pipe Registers
Applying: drm/i915/cx0: Change register bit naming for powerdown values
Applying: drm/i915/ltphy: Phy lane reset for LT Phy
Applying: drm/i915/cx0: Move the HDMI FRL function to intel_hdmi
Applying: drm/i915/ltphy: Program sequence for PORT_CLOCK_CTL for LT Phy
Applying: drm/i915/ltphy: Add a wrapper for LT Phy powerdown change sequence
Applying: drm/i915/ltphy: Read PHY_VDR_0_CONFIG register
Applying: drm/i915/ltphy: Add LT Phy Programming recipe tables
Applying: drm/i915/ltphy: Program the VDR PLL registers for LT PHY
Applying: drm/i915/ltphy: Update the ltpll config table value for eDP
Applying: drm/i915/ltphy: Enable SSC during port clock programming
Applying: drm/i915/ltphy: Add function to calculate LT PHY port clock
Applying: drm/i915/ltphy: Program the P2P Transaction flow for LT Phy
Applying: drm/i915/ltphy: Program the rest of the PORT_CLOCK_CTL steps
Applying: drm/i915/ltphy: Program the rest of the LT Phy Enable sequence
Applying: drm/i915/ltphy: Program LT Phy Non-TBT PLL disable sequence
Applying: drm/i915/ltphy: Hook up LT Phy Enable & Disable sequences
error: sha1 information is lacking or useless (drivers/gpu/drm/i915/display/intel_cx0_phy.c).
error: could not build fake ancestor
hint: Use 'git am --show-current-patch=diff' to see the failed patch
Patch failed at 0017 drm/i915/ltphy: Hook up LT Phy Enable & Disable sequences When you have resolved this problem, run "git am --continue".
If you prefer to skip this patch, run "git am --skip" instead.
To restore the original branch and stop patching, run "git am --abort".
Build failed, no error log produced