Enable upfront link training on DDI platforms
Subsystems (2)
cover Enable upfront link training on DDI platforms
This patch series enables upfront link training on DDI platforms (SKL/BDW/HSW/BXT). They are based on some of the patches submitted earlier by Ander and Durgadoss.
The upfront link training had to be factored out of long pulse hanlder because of deadlock issues seen on DP MST cases. Now the upfront link training takes place in intel_dp_mode_valid() to find the maximum lane count and link rate at which the DP link can be successfully trained. These values are used to prune the invalid modes before modeset. Modeset makes use the upfront lane count and link train values.
These patches have been validated for DP SST on DDI platforms (SKL/HSW/BDW/BXT). They have also been tested for any regressions on non DDI platforms (CHV).
Ander Conselvan de Oliveira (3):
drm/i915: Don't pass crtc_state to intel_dp_set_link_params() drm/i915: Remove ddi_pll_sel from intel_crtc_state drm/i915: Split intel_ddi_pre_enable() into DP and HDMI versions
Durgadoss R (2):
drm/i915: Split bxt_ddi_pll_select()
drm/i915/dp: Enable Upfront link training for typeC DP support on BXT
Jim Bride (2):
drm/i915: Split skl_get_dpll() drm/i915/dp: Enable upfront link training on SKL
Manasi Navare (2):
drm/i915: Split hsw_get_dpll()
drm/i915: Enable upfront link training support for HSW/BDW
drivers/gpu/drm/i915/intel_ddi.c | 207 +++++++++--- drivers/gpu/drm/i915/intel_display.c | 43 +-- drivers/gpu/drm/i915/intel_dp.c | 386 ++++++++++++++++------ drivers/gpu/drm/i915/intel_dp_link_training.c | 7 +- drivers/gpu/drm/i915/intel_dp_mst.c | 9 +- drivers/gpu/drm/i915/intel_dpll_mgr.c | 457 ++++++++++++++++---------- drivers/gpu/drm/i915/intel_dpll_mgr.h | 15 + drivers/gpu/drm/i915/intel_drv.h | 29 +- 8 files changed, 776 insertions(+), 377 deletions(-)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/9 drm/i915: Don't pass crtc_state to intel_dp_set_link_params()
From: Ander Conselvan de Oliveira <[email protected]>
Decouple intel_dp_set_link_params() from struct intel_crtc_state. This will be useful for implementing DP upfront link training.
--- drivers/gpu/drm/i915/intel_ddi.c | 5 ++++- drivers/gpu/drm/i915/intel_dp.c | 14 +++++++++----- drivers/gpu/drm/i915/intel_dp_mst.c | 6 ++++-- drivers/gpu/drm/i915/intel_drv.h | 3 ++- 4 files changed, 19 insertions(+), 9 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +4 -1
@@ -1637,7 +1637,10 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)intel_prepare_dp_ddi_buffers (intel_encoder); -intel_dp_set_link_params (intel_dp, crtc->config); +intel_dp_set_link_params (intel_dp, crtc->config->port_clock, + crtc->config->lane_count, +intel_crtc_has_type (crtc->config, +INTEL_OUTPUT_DP_MST ));intel_ddi_init_dp_buf_reg (intel_encoder);
drivers/gpu/drm/i915/intel_dp.c +9 -5
@@ -1647,11 +1647,12 @@ found: }void intel_dp_set_link_params (struct intel_dp *intel_dp, -const struct intel_crtc_state *pipe_config) +int link_rate,uint8_t lane_count, +bool link_mst) { - intel_dp->link_rate = pipe_config->port_clock; - intel_dp->lane_count = pipe_config->lane_count; - intel_dp->link_mst =intel_crtc_has_type (pipe_config,INTEL_OUTPUT_DP_MST ); + intel_dp->link_rate = link_rate; + intel_dp->lane_count = lane_count; + intel_dp->link_mst = link_mst; }static void intel_dp_prepare (struct intel_encoder *encoder)
@@ -1663,7 +1664,10 @@ static void intel_dp_prepare(struct intel_encoder *encoder)struct intel_crtc *crtc =to_intel_crtc (encoder->base.crtc);const struct drm_display_mode *adjusted_mode = &crtc->config->base.adjusted_mode; -intel_dp_set_link_params (intel_dp, crtc->config); +intel_dp_set_link_params (intel_dp, crtc->config->port_clock, + crtc->config->lane_count, +intel_crtc_has_type (crtc->config, +INTEL_OUTPUT_DP_MST ));/* * There are four kinds of DP registers:
drivers/gpu/drm/i915/intel_dp_mst.c +4 -2
@@ -173,8 +173,10 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder)intel_ddi_clk_select (&intel_dig_port->base, intel_crtc->config);intel_prepare_dp_ddi_buffers (&intel_dig_port->base); - -intel_dp_set_link_params (intel_dp, intel_crtc->config); +intel_dp_set_link_params (intel_dp, + intel_crtc->config->port_clock, + intel_crtc->config->lane_count, + true);intel_ddi_init_dp_buf_reg (&intel_dig_port->base);
drivers/gpu/drm/i915/intel_drv.h +2 -1
@@ -1342,7 +1342,8 @@ bool intel_dp_init(struct drm_device *dev, i915_reg_t output_reg, enum port portbool intel_dp_init_connector (struct intel_digital_port *intel_dig_port,struct intel_connector *intel_connector);void intel_dp_set_link_params (struct intel_dp *intel_dp, -const struct intel_crtc_state *pipe_config); +int link_rate,uint8_t lane_count, +bool link_mst);void intel_dp_start_link_train (struct intel_dp *intel_dp);void intel_dp_stop_link_train (struct intel_dp *intel_dp);void intel_dp_sink_dpms (struct intel_dp *intel_dp,int mode);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/9 drm/i915: Remove ddi_pll_sel from intel_crtc_state
In reply to Manasi NavareFrom: Ander Conselvan de Oliveira <[email protected]>
The value of ddi_pll_sel is derived from the selection of shared dpll, so just calculate the final value when necessary.
v2: Actually remove it from crtc state and delete remaining usages. (CI)
--- drivers/gpu/drm/i915/intel_ddi.c | 45 ++++++++++++++++++++++++++--------- drivers/gpu/drm/i915/intel_display.c | 43 +++++++-------------------------- drivers/gpu/drm/i915/intel_dp_mst.c | 3 ++- drivers/gpu/drm/i915/intel_dpll_mgr.c | 27 --------------------- drivers/gpu/drm/i915/intel_drv.h | 8 +------ 5 files changed, 45 insertions(+), 81 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +34 -11
@@ -546,6 +546,27 @@ static void intel_wait_ddi_buf_idle(struct drm_i915_private *dev_priv,DRM_ERROR ("Timeout waiting for DDI BUF %c idle bit\n" ,port_name (port)); } +static uint32_t hsw_pll_to_ddi_pll_sel (struct intel_shared_dpll *pll) +{ +switch (pll->id) { +case DPLL_ID_WRPLL1 : +return PORT_CLK_SEL_WRPLL1 ; +case DPLL_ID_WRPLL2 : +return PORT_CLK_SEL_WRPLL2 ; +case DPLL_ID_SPLL : +return PORT_CLK_SEL_SPLL ; +case DPLL_ID_LCPLL_810 : +return PORT_CLK_SEL_LCPLL_810 ; +case DPLL_ID_LCPLL_1350 : +return PORT_CLK_SEL_LCPLL_1350 ; +case DPLL_ID_LCPLL_2700 : +return PORT_CLK_SEL_LCPLL_2700 ; +default : +MISSING_CASE (pll->id); +return PORT_CLK_SEL_NONE ; + } +} +/* Starting with Haswell, different DDI ports can work in FDI mode for * connection to the PCH-located connectors. For this, it is necessary to train * both the DDI port and PCH receiver for the desired DDI buffer settings.
@@ -561,7 +582,7 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)struct drm_i915_private *dev_priv =to_i915 (dev);struct intel_crtc *intel_crtc =to_intel_crtc (crtc);struct intel_encoder *encoder; -u32 temp, i, rx_ctl_val; +u32 temp, i, rx_ctl_val, ddi_pll_sel;for_each_encoder_on_crtc (dev, crtc, encoder) {WARN_ON (encoder->type !=INTEL_OUTPUT_ANALOG );
@@ -592,8 +613,9 @@ void hsw_fdi_link_train(struct drm_crtc *crtc)I915_WRITE (FDI_RX_CTL (PIPE_A ), rx_ctl_val);/* Configure Port Clock Select */ -I915_WRITE (PORT_CLK_SEL (PORT_E ), intel_crtc->config->ddi_pll_sel); -WARN_ON (intel_crtc->config->ddi_pll_sel !=PORT_CLK_SEL_SPLL ); + ddi_pll_sel =hsw_pll_to_ddi_pll_sel (intel_crtc->config->shared_dpll); +I915_WRITE (PORT_CLK_SEL (PORT_E ), ddi_pll_sel); +WARN_ON (ddi_pll_sel !=PORT_CLK_SEL_SPLL );/* Start the training iterating through available voltages and emphasis, * testing each value twice. */
@@ -870,7 +892,7 @@ static void skl_ddi_clock_get(struct intel_encoder *encoder,int link_clock =0 ;uint32_t dpll_ctl1, dpll; - dpll = pipe_config->ddi_pll_sel; + dpll =intel_get_shared_dpll_id (dev_priv, pipe_config->shared_dpll); dpll_ctl1 =I915_READ (DPLL_CTRL1 );
@@ -918,7 +940,7 @@ static void hsw_ddi_clock_get(struct intel_encoder *encoder,int link_clock =0 ;u32 val, pll; - val = pipe_config->ddi_pll_sel; + val =hsw_pll_to_ddi_pll_sel (pipe_config->shared_dpll);switch (val &PORT_CLK_SEL_MASK ) {case PORT_CLK_SEL_LCPLL_810 : link_clock =81000 ;
@@ -1586,13 +1608,15 @@ uint32_t ddi_signal_levels(struct intel_dp *intel_dp) }void intel_ddi_clk_select (struct intel_encoder *encoder, -const struct intel_crtc_state *pipe_config) +struct intel_shared_dpll *pll) {struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);enum port port =intel_ddi_get_encoder_port (encoder); +if (WARN_ON (!pll)) +return ; +if (IS_SKYLAKE (dev_priv) ||IS_KABYLAKE (dev_priv)) { -uint32_t dpll = pipe_config->ddi_pll_sel;uint32_t val;/* DDI -> PLL mapping */
@@ -1600,14 +1624,13 @@ void intel_ddi_clk_select(struct intel_encoder *encoder, val &= ~(DPLL_CTRL2_DDI_CLK_OFF (port) |DPLL_CTRL2_DDI_CLK_SEL_MASK (port)); - val |= (DPLL_CTRL2_DDI_CLK_SEL (dpll, port) | + val |= (DPLL_CTRL2_DDI_CLK_SEL (pll->id, port) |DPLL_CTRL2_DDI_SEL_OVERRIDE (port));I915_WRITE (DPLL_CTRL2 , val); }else if (INTEL_INFO (dev_priv)->gen <9 ) { -WARN_ON (pipe_config->ddi_pll_sel ==PORT_CLK_SEL_NONE ); -I915_WRITE (PORT_CLK_SEL (port), pipe_config->ddi_pll_sel); +I915_WRITE (PORT_CLK_SEL (port),hsw_pll_to_ddi_pll_sel (pll)); } }
@@ -1630,7 +1653,7 @@ static void intel_ddi_pre_enable(struct intel_encoder *intel_encoder)intel_edp_panel_on (intel_dp); } -intel_ddi_clk_select (intel_encoder, crtc->config); +intel_ddi_clk_select (intel_encoder, crtc->config->shared_dpll);if (type ==INTEL_OUTPUT_DP || type ==INTEL_OUTPUT_EDP ) {struct intel_dp *intel_dp =enc_to_intel_dp (encoder);
drivers/gpu/drm/i915/intel_display.c +8 -35
119 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dp_mst.c +2 -1
@@ -170,7 +170,8 @@ static void intel_mst_pre_enable_dp(struct intel_encoder *encoder) intel_mst->connector = found;if (intel_dp->active_mst_links ==0 ) { -intel_ddi_clk_select (&intel_dig_port->base, intel_crtc->config); +intel_ddi_clk_select (&intel_dig_port->base, + intel_crtc->config->shared_dpll);intel_prepare_dp_ddi_buffers (&intel_dig_port->base); intel_dp_set_link_params(intel_dp,
drivers/gpu/drm/i915/intel_dpll_mgr.c +0 -27
@@ -452,26 +452,6 @@ static bool hsw_ddi_spll_get_hw_state(struct drm_i915_private *dev_priv,return val &SPLL_PLL_ENABLE ; } -static uint32_t hsw_pll_to_ddi_pll_sel (struct intel_shared_dpll *pll) -{ -switch (pll->id) { -case DPLL_ID_WRPLL1 : -return PORT_CLK_SEL_WRPLL1 ; -case DPLL_ID_WRPLL2 : -return PORT_CLK_SEL_WRPLL2 ; -case DPLL_ID_SPLL : -return PORT_CLK_SEL_SPLL ; -case DPLL_ID_LCPLL_810 : -return PORT_CLK_SEL_LCPLL_810 ; -case DPLL_ID_LCPLL_1350 : -return PORT_CLK_SEL_LCPLL_1350 ; -case DPLL_ID_LCPLL_2700 : -return PORT_CLK_SEL_LCPLL_2700 ; -default : -return PORT_CLK_SEL_NONE ; - } -} -#define LC_FREQ 2700#define LC_FREQ_2K U64_C(LC_FREQ * 2000)
@@ -751,8 +731,6 @@ hsw_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,if (!pll)return NULL ; - crtc_state->ddi_pll_sel =hsw_pll_to_ddi_pll_sel (pll); -intel_reference_shared_dpll (pll, crtc_state);return pll;
@@ -1274,8 +1252,6 @@ skl_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,if (!pll)return NULL ; - crtc_state->ddi_pll_sel = pll->id; -intel_reference_shared_dpll (pll, crtc_state);return pll;
@@ -1622,9 +1598,6 @@ bxt_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,intel_reference_shared_dpll (pll, crtc_state); -/* shared DPLL id 0 is DPLL A */ - crtc_state->ddi_pll_sel = pll->id; -return pll; }
drivers/gpu/drm/i915/intel_drv.h +1 -7
@@ -558,12 +558,6 @@ struct intel_crtc_state {/* Selected dpll when shared or NULL. */ struct intel_shared_dpll *shared_dpll; -/* -* - PORT_CLK_SEL for DDI ports on HSW/BDW. -* - enum skl_dpll on SKL -*/ -uint32_t ddi_pll_sel; -/* Actual register state of the dpll, for shared dpll cross-checking. */ struct intel_dpll_hw_state dpll_hw_state;
@@ -1104,7 +1098,7 @@ void intel_crt_reset(struct drm_encoder *encoder);/* intel_ddi.c */ void intel_ddi_clk_select (struct intel_encoder *encoder, -const struct intel_crtc_state *pipe_config); +struct intel_shared_dpll *pll);void intel_prepare_dp_ddi_buffers (struct intel_encoder *encoder);void hsw_fdi_link_train (struct drm_crtc *crtc);void intel_ddi_init (struct drm_device *dev,enum port port);
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 3/9 drm/i915: Split intel_ddi_pre_enable() into DP and HDMI versions
In reply to Manasi NavareFrom: Ander Conselvan de Oliveira <[email protected]>
Split intel_ddi_pre_enable() into encoder type specific versions that don't depend on crtc_state. The necessary parameters are passed as function arguments. This split will be necessary for implementing DP upfront link training.
v2:
* Rebased onto kernel v4.7 (Jim)
--- drivers/gpu/drm/i915/intel_ddi.c | 96 +++++++++++++++++++++++----------------- 1 file changed, 55 insertions(+), 41 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +55 -41
@@ -1634,59 +1634,73 @@ void intel_ddi_clk_select(struct intel_encoder *encoder, } } -static void intel_ddi_pre_enable (struct intel_encoder *intel_encoder) +static void intel_ddi_pre_enable_dp (struct intel_encoder *encoder, +int link_rate,uint32_t lane_count, +struct intel_shared_dpll *pll, +bool link_mst) { -struct drm_encoder *encoder = &intel_encoder->base; -struct drm_i915_private *dev_priv =to_i915 (encoder->dev); -struct intel_crtc *crtc =to_intel_crtc (encoder->crtc); -enum port port =intel_ddi_get_encoder_port (intel_encoder); -int type = intel_encoder->type; - -if (type ==INTEL_OUTPUT_HDMI ) { -struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (encoder); +struct intel_dp *intel_dp =enc_to_intel_dp (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +enum port port =intel_ddi_get_encoder_port (encoder); -intel_dp_dual_mode_set_tmds_output (intel_hdmi, true); - } +intel_dp_set_link_params (intel_dp, link_rate, lane_count, + link_mst); -if (type ==INTEL_OUTPUT_EDP ) { -struct intel_dp *intel_dp =enc_to_intel_dp (encoder); +if (encoder->type ==INTEL_OUTPUT_EDP )intel_edp_panel_on (intel_dp); - } - -intel_ddi_clk_select (intel_encoder, crtc->config->shared_dpll); -if (type ==INTEL_OUTPUT_DP || type ==INTEL_OUTPUT_EDP ) { -struct intel_dp *intel_dp =enc_to_intel_dp (encoder); +intel_ddi_clk_select (encoder, pll); +intel_prepare_dp_ddi_buffers (encoder); +intel_ddi_init_dp_buf_reg (encoder); +intel_dp_sink_dpms (intel_dp,DRM_MODE_DPMS_ON ); +intel_dp_start_link_train (intel_dp); +if (port !=PORT_A ||INTEL_INFO (dev_priv)->gen >=9 ) +intel_dp_stop_link_train (intel_dp); +} -intel_prepare_dp_ddi_buffers (intel_encoder); +static void intel_ddi_pre_enable_hdmi (struct intel_encoder *encoder, +bool has_hdmi_sink, +struct drm_display_mode *adjusted_mode, +struct intel_shared_dpll *pll) +{ +struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct drm_encoder *drm_encoder = &encoder->base; +enum port port =intel_ddi_get_encoder_port (encoder); +int level =intel_ddi_hdmi_level (dev_priv, port); -intel_dp_set_link_params (intel_dp, crtc->config->port_clock, - crtc->config->lane_count, -intel_crtc_has_type (crtc->config, -INTEL_OUTPUT_DP_MST )); +intel_dp_dual_mode_set_tmds_output (intel_hdmi, true); +intel_ddi_clk_select (encoder, pll); +intel_prepare_hdmi_ddi_buffers (encoder); -intel_ddi_init_dp_buf_reg (intel_encoder); +if (IS_SKYLAKE (dev_priv) ||IS_KABYLAKE (dev_priv)) +skl_ddi_set_iboost (encoder, level); +else if (IS_BROXTON (dev_priv)) +bxt_ddi_vswing_sequence (dev_priv, level, port, +INTEL_OUTPUT_HDMI ); -intel_dp_sink_dpms (intel_dp,DRM_MODE_DPMS_ON ); -intel_dp_start_link_train (intel_dp); -if (port !=PORT_A ||INTEL_INFO (dev_priv)->gen >=9 ) -intel_dp_stop_link_train (intel_dp); - }else if (type ==INTEL_OUTPUT_HDMI ) { -struct intel_hdmi *intel_hdmi =enc_to_intel_hdmi (encoder); -int level =intel_ddi_hdmi_level (dev_priv, port); + intel_hdmi->set_infoframes (drm_encoder, has_hdmi_sink, adjusted_mode); +} -intel_prepare_hdmi_ddi_buffers (intel_encoder); +static void intel_ddi_pre_enable (struct intel_encoder *intel_encoder) +{ +struct drm_encoder *encoder = &intel_encoder->base; +struct intel_crtc *crtc =to_intel_crtc (encoder->crtc); +int type = intel_encoder->type; -if (IS_SKYLAKE (dev_priv) ||IS_KABYLAKE (dev_priv)) -skl_ddi_set_iboost (intel_encoder, level); -else if (IS_BROXTON (dev_priv)) -bxt_ddi_vswing_sequence (dev_priv, level, port, -INTEL_OUTPUT_HDMI ); +if (type ==INTEL_OUTPUT_DP || type ==INTEL_OUTPUT_EDP ) +intel_ddi_pre_enable_dp (intel_encoder, + crtc->config->port_clock, + crtc->config->lane_count, + crtc->config->shared_dpll, +intel_crtc_has_type (crtc->config, +INTEL_OUTPUT_DP_MST )); - intel_hdmi->set_infoframes (encoder, - crtc->config->has_hdmi_sink, - &crtc->config->base.adjusted_mode); - } +if (type ==INTEL_OUTPUT_HDMI ) +intel_ddi_pre_enable_hdmi (intel_encoder, + crtc->config->has_hdmi_sink, + &crtc->config->base.adjusted_mode, + crtc->config->shared_dpll); }static void intel_ddi_post_disable (struct intel_encoder *intel_encoder)
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/9 drm/i915: Split bxt_ddi_pll_select()
In reply to Manasi NavareFrom: Durgadoss R <[email protected]>
Split out of bxt_ddi_pll_select() the logic that calculates the pll dividers and dpll_hw_state into a new function that doesn't depend on crtc state. This will be used for enabling the port pll when doing upfront link training.
v2:
* Refactored code so that bxt_clk_div need not be exported (Durga) v1:
* Rebased on top of intel_dpll_mgr.c (Durga)
* Initial version from Ander on top of intel_ddi.c
--- drivers/gpu/drm/i915/intel_dpll_mgr.c | 165 +++++++++++++++++++++------------- drivers/gpu/drm/i915/intel_dpll_mgr.h | 3 + 2 files changed, 104 insertions(+), 64 deletions(-)
drivers/gpu/drm/i915/intel_dpll_mgr.c +101 -64
@@ -1460,6 +1460,8 @@ struct bxt_clk_div {uint32_t m2_frac;bool m2_frac_en;uint32_t n; + +int vco; };/* pre-calculated values for DP linkrates */
@@ -1473,57 +1475,60 @@ static const struct bxt_clk_div bxt_dp_clk_val[] = { {432000, 3, 1, 32, 1677722, 1, 1} }; -static struct intel_shared_dpll * -bxt_get_dpll (struct intel_crtc *crtc,struct intel_crtc_state *crtc_state, -struct intel_encoder *encoder) +static bool +bxt_ddi_hdmi_pll_dividers (struct intel_crtc *intel_crtc, +struct intel_crtc_state *crtc_state,int clock, +struct bxt_clk_div *clk_div) { -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); -struct intel_shared_dpll *pll; -enum intel_dpll_id i; -struct intel_digital_port *intel_dig_port; -struct bxt_clk_div clk_div = {0 }; -int vco =0 ; -uint32_t prop_coef, int_coef, gain_ctl, targ_cnt; -uint32_t lanestagger; -int clock = crtc_state->port_clock; +struct dpll best_clock; -if (encoder->type ==INTEL_OUTPUT_HDMI ) { -struct dpll best_clock; +/* Calculate HDMI div */ +/* +* FIXME: tie the following calculation into +* i9xx_crtc_compute_clock +*/ +if (!bxt_find_best_dpll (crtc_state, clock, &best_clock)) { +DRM_DEBUG_DRIVER ("no PLL dividers found for clock %d pipe %c\n" , + clock,pipe_name (intel_crtc->pipe)); +return false; + } -/* Calculate HDMI div */ -/* -* FIXME: tie the following calculation into -* i9xx_crtc_compute_clock -*/ -if (!bxt_find_best_dpll (crtc_state, clock, &best_clock)) { -DRM_DEBUG_DRIVER ("no PLL dividers found for clock %d pipe %c\n" , - clock,pipe_name (crtc->pipe)); -return NULL ; - } + clk_div->p1 = best_clock.p1; + clk_div->p2 = best_clock.p2; +WARN_ON (best_clock.m1 !=2 ); + clk_div->n = best_clock.n; + clk_div->m2_int = best_clock.m2 >>22 ; + clk_div->m2_frac = best_clock.m2 & ((1 <<22 ) -1 ); + clk_div->m2_frac_en = clk_div->m2_frac !=0 ; - clk_div.p1 = best_clock.p1; - clk_div.p2 = best_clock.p2; -WARN_ON (best_clock.m1 !=2 ); - clk_div.n = best_clock.n; - clk_div.m2_int = best_clock.m2 >>22 ; - clk_div.m2_frac = best_clock.m2 & ((1 <<22 ) -1 ); - clk_div.m2_frac_en = clk_div.m2_frac !=0 ; + clk_div->vco = best_clock.vco; - vco = best_clock.vco; - }else if (encoder->type ==INTEL_OUTPUT_DP || - encoder->type ==INTEL_OUTPUT_EDP ) { -int i; +return true; +} - clk_div = bxt_dp_clk_val[0 ]; -for (i =0 ; i <ARRAY_SIZE (bxt_dp_clk_val); ++i) { -if (bxt_dp_clk_val[i].clock == clock) { - clk_div = bxt_dp_clk_val[i]; -break ; - } +static void bxt_ddi_dp_pll_dividers (int clock,struct bxt_clk_div *clk_div) +{ +int i; + + *clk_div = bxt_dp_clk_val[0 ]; +for (i =0 ; i <ARRAY_SIZE (bxt_dp_clk_val); ++i) { +if (bxt_dp_clk_val[i].clock == clock) { + *clk_div = bxt_dp_clk_val[i]; +break ; } - vco = clock *10 /2 * clk_div.p1 * clk_div.p2; } + clk_div->vco = clock *10 /2 * clk_div->p1 * clk_div->p2; +} + +static bool bxt_ddi_set_dpll_hw_state (int clock, +struct bxt_clk_div *clk_div, +struct intel_dpll_hw_state *dpll_hw_state) +{ +int vco = clk_div->vco; +uint32_t prop_coef, int_coef, gain_ctl, targ_cnt; +uint32_t lanestagger; +if (vco >=6200000 && vco <=6700000 ) { prop_coef =4 ; int_coef =9 ;
@@ -1542,12 +1547,9 @@ bxt_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state, targ_cnt =9 ; }else {DRM_ERROR ("Invalid VCO\n" ); -return NULL ; +return false; } -memset (&crtc_state->dpll_hw_state,0 , -sizeof (crtc_state->dpll_hw_state)); -if (clock >270000 ) lanestagger =0x18 ;else if (clock >135000 )
@@ -1559,33 +1561,68 @@ bxt_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,else lanestagger =0x02 ; - crtc_state->dpll_hw_state.ebb0 = -PORT_PLL_P1 (clk_div.p1) |PORT_PLL_P2 (clk_div.p2); - crtc_state->dpll_hw_state.pll0 = clk_div.m2_int; - crtc_state->dpll_hw_state.pll1 =PORT_PLL_N (clk_div.n); - crtc_state->dpll_hw_state.pll2 = clk_div.m2_frac; + dpll_hw_state->ebb0 =PORT_PLL_P1 (clk_div->p1) |PORT_PLL_P2 (clk_div->p2); + dpll_hw_state->pll0 = clk_div->m2_int; + dpll_hw_state->pll1 =PORT_PLL_N (clk_div->n); + dpll_hw_state->pll2 = clk_div->m2_frac; -if (clk_div.m2_frac_en) - crtc_state->dpll_hw_state.pll3 = -PORT_PLL_M2_FRAC_ENABLE ; +if (clk_div->m2_frac_en) + dpll_hw_state->pll3 =PORT_PLL_M2_FRAC_ENABLE ; - crtc_state->dpll_hw_state.pll6 = - prop_coef |PORT_PLL_INT_COEFF (int_coef); - crtc_state->dpll_hw_state.pll6 |= -PORT_PLL_GAIN_CTL (gain_ctl); + dpll_hw_state->pll6 = prop_coef |PORT_PLL_INT_COEFF (int_coef); + dpll_hw_state->pll6 |=PORT_PLL_GAIN_CTL (gain_ctl); - crtc_state->dpll_hw_state.pll8 = targ_cnt; + dpll_hw_state->pll8 = targ_cnt; - crtc_state->dpll_hw_state.pll9 =5 <<PORT_PLL_LOCK_THRESHOLD_SHIFT ; + dpll_hw_state->pll9 =5 <<PORT_PLL_LOCK_THRESHOLD_SHIFT ; - crtc_state->dpll_hw_state.pll10 = + dpll_hw_state->pll10 =PORT_PLL_DCO_AMP (PORT_PLL_DCO_AMP_DEFAULT ) |PORT_PLL_DCO_AMP_OVR_EN_H ; - crtc_state->dpll_hw_state.ebb4 =PORT_PLL_10BIT_CLK_ENABLE ; + dpll_hw_state->ebb4 =PORT_PLL_10BIT_CLK_ENABLE ; + + dpll_hw_state->pcsdw12 =LANESTAGGER_STRAP_OVRD | lanestagger; + +return true; +} + +bool bxt_ddi_dp_set_dpll_hw_state (int clock, +struct intel_dpll_hw_state *dpll_hw_state) +{ +struct bxt_clk_div clk_div = {0 }; + +bxt_ddi_dp_pll_dividers (clock, &clk_div); + +return bxt_ddi_set_dpll_hw_state (clock, &clk_div, dpll_hw_state); +} + +static struct intel_shared_dpll * +bxt_get_dpll (struct intel_crtc *crtc, +struct intel_crtc_state *crtc_state, +struct intel_encoder *encoder) +{ +struct bxt_clk_div clk_div = {0 }; +struct intel_dpll_hw_state dpll_hw_state = {0 }; +struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev); +struct intel_digital_port *intel_dig_port; +struct intel_shared_dpll *pll; +int i, clock = crtc_state->port_clock; + +if (encoder->type ==INTEL_OUTPUT_HDMI + && !bxt_ddi_hdmi_pll_dividers (crtc, crtc_state, + clock, &clk_div)) +return false; + +if ((encoder->type ==INTEL_OUTPUT_DP || + encoder->type ==INTEL_OUTPUT_EDP ) && + !bxt_ddi_dp_set_dpll_hw_state (clock, &dpll_hw_state)) +return false; + +memset (&crtc_state->dpll_hw_state,0 , +sizeof (crtc_state->dpll_hw_state)); - crtc_state->dpll_hw_state.pcsdw12 = -LANESTAGGER_STRAP_OVRD | lanestagger; + crtc_state->dpll_hw_state = dpll_hw_state; intel_dig_port =enc_to_dig_port (&encoder->base);
drivers/gpu/drm/i915/intel_dpll_mgr.h +3 -0
@@ -160,5 +160,8 @@ void intel_disable_shared_dpll(struct intel_crtc *crtc);void intel_shared_dpll_commit (struct drm_atomic_state *state);void intel_shared_dpll_init (struct drm_device *dev); +/* BXT dpll related functions */ +bool bxt_ddi_dp_set_dpll_hw_state (int clock, +struct intel_dpll_hw_state *dpll_hw_state);#endif /* _INTEL_DPLL_MGR_H_ */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v8 5/9 drm/i915/dp: Enable Upfront link training for typeC DP support on BXT
In reply to Manasi NavareFrom: Durgadoss R <[email protected]>
To support USB type C alternate DP mode, the display driver needs to know the number of lanes required by the DP panel as well as number of lanes that can be supported by the type-C cable. Sometimes, the type-C cable may limit the bandwidth even if Panel can support more lanes. To address these scenarios, the display driver will start link training with max lanes, and if that fails, the driver falls back to x2 lanes; and repeats this procedure for all bandwidth/lane configurations.
* Since link training is done before modeset only the port (and not pipe/planes) and its associated PLLs are enabled.
* On DP hotplug: Directly start link training on the DP encoder.
* On Connected boot scenarios: When booted with an LFP and a DP, sometimes BIOS brings up DP. In these cases, we disable the crtc and then do upfront link training; and bring it back up.
* All local changes made for upfront link training are reset to their previous values once it is done; so that the subsequent modeset is not aware of these changes.
Changes since v7:
* Move the upfront link training to intel_dp_mode_valid() to avoid a race condition with DP MST sideband comms. (Ville)
Changes since v6:
* Fix some initialization bugs on link_rate (Jim Bride)
* Use link_rate (and not link_bw) for upfront (Ville)
* Make intel_dp_upfront*() as a vfunc (Ander)
* The train_set_valid variable in intel_dp was removed due to issues in fast link training. So, to indicate the link train status, move the channel_eq inside intel_dp.
Changes since v5:
* Moved retry logic in upfront to intel_dp.c so that it can be used for all platforms.
Changes since v4:
* Removed usage of crtc_state in upfront link training; Hence no need to find free crtc to do upfront now.
* Re-enable crtc if it was disabled for upfront.
* Use separate variables to track max lane count
and link rate found by upfront, without modifying the original DPCD read from panel.
Changes since v3:
* Fixed a return value on BXT check
* Reworked on top of bxt_ddi_pll_select split from Ander
* Renamed from ddi_upfront to bxt_upfront since the upfront logic includes BXT specific functions for now.
Changes since v2:
* Rebased on top of latest dpll_mgr.c code and
latest HPD related clean ups.
* Corrected return values from upfront (Ander)
* Corrected atomic locking for upfront in intel_dp.c (Ville) Changes since v1:
* all pll related functions inside ddi.c
--- drivers/gpu/drm/i915/intel_ddi.c | 47 ++++ drivers/gpu/drm/i915/intel_dp.c | 370 +++++++++++++++++++------- drivers/gpu/drm/i915/intel_dp_link_training.c | 7 +- drivers/gpu/drm/i915/intel_drv.h | 16 ++ 4 files changed, 337 insertions(+), 103 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +47 -0
@@ -2378,6 +2378,53 @@ intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port)return connector; } + +bool intel_bxt_upfront_link_train (struct intel_dp *intel_dp, +int clock,uint8_t lane_count, +bool link_mst) +{ +struct intel_connector *connector = intel_dp->attached_connector; +struct intel_encoder *encoder = connector->encoder; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_shared_dpll *pll; +struct intel_shared_dpll_config tmp_pll_config; +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +enum intel_dpll_id dpll_id = (enum intel_dpll_id )dig_port->port; + +/* +* FIXME: Works only for BXT. +* Select the required PLL. This works for platforms where +* there is no shared DPLL. +*/ + pll = &dev_priv->shared_dplls[dpll_id]; +if (WARN_ON (pll->active_mask)) { +DRM_ERROR ("Shared DPLL already in use. active_mask:%x\n" , pll->active_mask); +return false; + } + + tmp_pll_config = pll->config; + +if (!bxt_ddi_dp_set_dpll_hw_state (clock, &pll->config.hw_state)) { +DRM_ERROR ("Could not setup DPLL\n" ); + pll->config = tmp_pll_config; +return false; + } + +/* Enable PLL followed by port */ + pll->funcs.enable (dev_priv, pll); +intel_ddi_pre_enable_dp (encoder, clock, lane_count, pll, link_mst); + +DRM_DEBUG_KMS ("Upfront link train %s: link_clock:%d lanes:%d\n" , + intel_dp->channel_eq_status ?"Passed" :"Failed" , clock, lane_count); + +/* Disable port followed by PLL for next retry/clean up */ +intel_ddi_post_disable (encoder); + pll->funcs.disable (dev_priv, pll); + + pll->config = tmp_pll_config; +return intel_dp->channel_eq_status; +} +void intel_ddi_init (struct drm_device *dev,enum port port) {struct drm_i915_private *dev_priv =to_i915 (dev);
drivers/gpu/drm/i915/intel_dp.c +271 -99
456 lines not on this page · raw message
drivers/gpu/drm/i915/intel_dp_link_training.c +3 -4
@@ -232,7 +232,6 @@ static u32 intel_dp_training_pattern(struct intel_dp *intel_dp)static void intel_dp_link_training_channel_equalization (struct intel_dp *intel_dp) { -bool channel_eq = false;int tries, cr_tries;u32 training_pattern;
@@ -248,7 +247,7 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp) tries =0 ; cr_tries =0 ; - channel_eq = false; + intel_dp->channel_eq_status = false;for (;;) {uint8_t link_status[DP_LINK_STATUS_SIZE ];
@@ -276,7 +275,7 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp)if (drm_dp_channel_eq_ok (link_status, intel_dp->lane_count)) { - channel_eq = true; + intel_dp->channel_eq_status = true;break ; }
@@ -302,7 +301,7 @@ intel_dp_link_training_channel_equalization(struct intel_dp *intel_dp)intel_dp_set_idle_link_train (intel_dp); -if (channel_eq) +if (intel_dp->channel_eq_status)DRM_DEBUG_KMS ("Channel EQ done. DP Training successful\n" ); }
drivers/gpu/drm/i915/intel_drv.h +16 -0
@@ -849,6 +849,15 @@ struct intel_dp {enum hdmi_force_audio force_audio;bool limited_color_range;bool color_range_auto; + +/* Whether Channel Equalization was achieved during Link training */ +bool channel_eq_status; + +/* Upfront link train parameters */ +int max_link_rate_upfront; +uint8_t max_lanes_upfront; +bool upfront_done; +uint8_t dpcd[DP_RECEIVER_CAP_SIZE ];uint8_t psr_dpcd[EDP_PSR_RECEIVER_CAP_SIZE ];uint8_t downstream_ports[DP_MAX_DOWNSTREAM_PORTS ];
@@ -906,6 +915,10 @@ struct intel_dp {/* This is called before a link training is starterd */ void (*prepare_link_retrain)(struct intel_dp *intel_dp); +/* For Upfront link training */ +bool (*upfront_link_train)(struct intel_dp *intel_dp,int clock, +uint8_t lane_count,bool link_mst); +/* Displayport compliance testing */ unsigned long compliance_test_type;unsigned long compliance_test_data;
@@ -1125,6 +1138,9 @@ void intel_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config);void intel_ddi_set_vc_payload_alloc (struct drm_crtc *crtc,bool state);uint32_t ddi_signal_levels (struct intel_dp *intel_dp); +bool intel_bxt_upfront_link_train (struct intel_dp *intel_dp, +int clock,uint8_t lane_count, +bool link_mst); unsigned int intel_fb_align_height(struct drm_device *dev, unsigned int height,
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/9 drm/i915: Split skl_get_dpll()
In reply to Manasi NavareFrom: Jim Bride <[email protected]>
Split out the DisplayPort and HDMI pll setup code into separate functions and refactor the DP code does not directly depend on crtc state, so that the code can be used for upfront link training.
--- drivers/gpu/drm/i915/intel_dpll_mgr.c | 131 +++++++++++++++++++++------------- drivers/gpu/drm/i915/intel_dpll_mgr.h | 4 ++ 2 files changed, 87 insertions(+), 48 deletions(-)
drivers/gpu/drm/i915/intel_dpll_mgr.c +83 -48
@@ -1172,75 +1172,110 @@ skip_remaining_dividers:return true; } -static struct intel_shared_dpll * -skl_get_dpll (struct intel_crtc *crtc,struct intel_crtc_state *crtc_state, -struct intel_encoder *encoder) +static bool skl_ddi_hdmi_pll_dividers (struct intel_crtc *crtc, +struct intel_crtc_state *crtc_state, +int clock) { -struct intel_shared_dpll *pll;uint32_t ctrl1, cfgcr1, cfgcr2; -int clock = crtc_state->port_clock; +struct skl_wrpll_params wrpll_params = {0 , };/* * See comment in intel_dpll_hw_state to understand why we always use 0 * as the DPLL id in this function. */ - ctrl1 =DPLL_CTRL1_OVERRIDE (0 ); -if (encoder->type ==INTEL_OUTPUT_HDMI ) { -struct skl_wrpll_params wrpll_params = {0 , }; + ctrl1 |=DPLL_CTRL1_HDMI_MODE (0 ); - ctrl1 |=DPLL_CTRL1_HDMI_MODE (0 ); +if (!skl_ddi_calculate_wrpll (clock *1000 , &wrpll_params)) +return false; -if (!skl_ddi_calculate_wrpll (clock *1000 , &wrpll_params)) -return NULL ; + cfgcr1 =DPLL_CFGCR1_FREQ_ENABLE | +DPLL_CFGCR1_DCO_FRACTION (wrpll_params.dco_fraction) | + wrpll_params.dco_integer; + + cfgcr2 =DPLL_CFGCR2_QDIV_RATIO (wrpll_params.qdiv_ratio) | +DPLL_CFGCR2_QDIV_MODE (wrpll_params.qdiv_mode) | +DPLL_CFGCR2_KDIV (wrpll_params.kdiv) | +DPLL_CFGCR2_PDIV (wrpll_params.pdiv) | + wrpll_params.central_freq; + +memset (&crtc_state->dpll_hw_state,0 , +sizeof (crtc_state->dpll_hw_state)); + + crtc_state->dpll_hw_state.ctrl1 = ctrl1; + crtc_state->dpll_hw_state.cfgcr1 = cfgcr1; + crtc_state->dpll_hw_state.cfgcr2 = cfgcr2; +return true; +} + + +bool skl_ddi_dp_set_dpll_hw_state (int clock, +struct intel_dpll_hw_state *dpll_hw_state) +{ +uint32_t ctrl1; + +/* +* See comment in intel_dpll_hw_state to understand why we always use 0 +* as the DPLL id in this function. +*/ + ctrl1 =DPLL_CTRL1_OVERRIDE (0 ); +switch (clock /2 ) { +case 81000 : + ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_810 ,0 ); +break ; +case 135000 : + ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_1350 ,0 ); +break ; +case 270000 : + ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_2700 ,0 ); +break ; +/* eDP 1.4 rates */ +case 162000 : + ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_1620 ,0 ); +break ; +case 108000 : + ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_1080 ,0 ); +break ; +case 216000 : + ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_2160 ,0 ); +break ; + } - cfgcr1 =DPLL_CFGCR1_FREQ_ENABLE | -DPLL_CFGCR1_DCO_FRACTION (wrpll_params.dco_fraction) | - wrpll_params.dco_integer; + dpll_hw_state->ctrl1 = ctrl1; +return true; +} - cfgcr2 =DPLL_CFGCR2_QDIV_RATIO (wrpll_params.qdiv_ratio) | -DPLL_CFGCR2_QDIV_MODE (wrpll_params.qdiv_mode) | -DPLL_CFGCR2_KDIV (wrpll_params.kdiv) | -DPLL_CFGCR2_PDIV (wrpll_params.pdiv) | - wrpll_params.central_freq; +static struct intel_shared_dpll * +skl_get_dpll (struct intel_crtc *crtc,struct intel_crtc_state *crtc_state, +struct intel_encoder *encoder) +{ +struct intel_shared_dpll *pll; +int clock = crtc_state->port_clock; +bool bret; +struct intel_dpll_hw_state dpll_hw_state; + +memset (&dpll_hw_state,0 ,sizeof (dpll_hw_state)); + +if (encoder->type ==INTEL_OUTPUT_HDMI ) { + bret =skl_ddi_hdmi_pll_dividers (crtc, crtc_state, clock); +if (!bret) { +DRM_DEBUG_KMS ("Could not get HDMI pll dividers.\n" ); +return NULL ; + } }else if (encoder->type ==INTEL_OUTPUT_DP || encoder->type ==INTEL_OUTPUT_DP_MST || encoder->type ==INTEL_OUTPUT_EDP ) { -switch (crtc_state->port_clock /2 ) { -case 81000 : - ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_810 ,0 ); -break ; -case 135000 : - ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_1350 ,0 ); -break ; -case 270000 : - ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_2700 ,0 ); -break ; -/* eDP 1.4 rates */ -case 162000 : - ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_1620 ,0 ); -break ; -case 108000 : - ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_1080 ,0 ); -break ; -case 216000 : - ctrl1 |=DPLL_CTRL1_LINK_RATE (DPLL_CTRL1_LINK_RATE_2160 ,0 ); -break ; + bret =skl_ddi_dp_set_dpll_hw_state (clock, &dpll_hw_state); +if (!bret) { +DRM_DEBUG_KMS ("Could not set DP dpll HW state.\n" ); +return NULL ; } - - cfgcr1 = cfgcr2 =0 ; + crtc_state->dpll_hw_state = dpll_hw_state; }else {return NULL ; } -memset (&crtc_state->dpll_hw_state,0 , -sizeof (crtc_state->dpll_hw_state)); - - crtc_state->dpll_hw_state.ctrl1 = ctrl1; - crtc_state->dpll_hw_state.cfgcr1 = cfgcr1; - crtc_state->dpll_hw_state.cfgcr2 = cfgcr2; -if (encoder->type ==INTEL_OUTPUT_EDP ) pll = intel_find_shared_dpll(crtc, crtc_state, DPLL_ID_SKL_DPLL0,
drivers/gpu/drm/i915/intel_dpll_mgr.h +4 -0
@@ -164,4 +164,8 @@ void intel_shared_dpll_init(struct drm_device *dev);bool bxt_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state); +/* SKL dpll related functions */ +bool skl_ddi_dp_set_dpll_hw_state (int clock, +struct intel_dpll_hw_state *dpll_hw_state); +#endif /* _INTEL_DPLL_MGR_H_ */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 7/9 drm/i915/dp: Enable upfront link training on SKL
In reply to Manasi NavareFrom: Jim Bride <[email protected]>
Split the PLL selection code out of the BXT upfront link training implementation and into a stand-alone function in order to allow for the implementation of a platform neutral upfront link training function, and then enable upfront link training for Skylake.
--- drivers/gpu/drm/i915/intel_ddi.c | 58 ++++++++++++++++++++++++----------- drivers/gpu/drm/i915/intel_dp.c | 4 +-- drivers/gpu/drm/i915/intel_dpll_mgr.c | 38 +++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.h | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 4 ++- 5 files changed, 85 insertions(+), 21 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +40 -18
@@ -2378,8 +2378,43 @@ intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port)return connector; } +struct intel_shared_dpll * +intel_ddi_get_link_dpll (struct intel_dp *intel_dp,int clock) +{ +struct intel_connector *connector = intel_dp->attached_connector; +struct intel_encoder *encoder = connector->encoder; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_shared_dpll *pll =NULL ; +struct intel_shared_dpll_config tmp_pll_config; +enum intel_dpll_id dpll_id; -bool intel_bxt_upfront_link_train (struct intel_dp *intel_dp, +if (IS_BROXTON (dev_priv)) { + dpll_id = (enum intel_dpll_id )dig_port->port; +/* +* Select the required PLL. This works for platforms where +* there is no shared DPLL. +*/ + pll = &dev_priv->shared_dplls[dpll_id]; +if (WARN_ON (pll->active_mask)) { + +DRM_ERROR ("Shared DPLL in use. active_mask:%x\n" , + pll->active_mask); + pll =NULL ; + } + tmp_pll_config = pll->config; +if (!bxt_ddi_dp_set_dpll_hw_state (clock, + &pll->config.hw_state)) { +DRM_ERROR ("Could not setup DPLL\n" ); + pll->config = tmp_pll_config; + } + }else if (IS_SKYLAKE (dev_priv)) { + pll =skl_find_link_pll (dev_priv, clock); + } +return pll; +} + +bool intel_ddi_upfront_link_train (struct intel_dp *intel_dp,int clock,uint8_t lane_count,bool link_mst) {
@@ -2388,28 +2423,15 @@ bool intel_bxt_upfront_link_train(struct intel_dp *intel_dp,struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev);struct intel_shared_dpll *pll;struct intel_shared_dpll_config tmp_pll_config; -struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); -enum intel_dpll_id dpll_id = (enum intel_dpll_id )dig_port->port; -/* -* FIXME: Works only for BXT. -* Select the required PLL. This works for platforms where -* there is no shared DPLL. -*/ - pll = &dev_priv->shared_dplls[dpll_id]; -if (WARN_ON (pll->active_mask)) { -DRM_ERROR ("Shared DPLL already in use. active_mask:%x\n" , pll->active_mask); + pll =intel_ddi_get_link_dpll (intel_dp, clock); +if (pll ==NULL ) { +DRM_ERROR ("Could not find DPLL for link training.\n" );return false; } - + tmp_pll_config = pll->config; -if (!bxt_ddi_dp_set_dpll_hw_state (clock, &pll->config.hw_state)) { -DRM_ERROR ("Could not setup DPLL\n" ); - pll->config = tmp_pll_config; -return false; - } -/* Enable PLL followed by port */ pll->funcs.enable (dev_priv, pll);intel_ddi_pre_enable_dp (encoder, clock, lane_count, pll, link_mst);
drivers/gpu/drm/i915/intel_dp.c +2 -2
@@ -5762,8 +5762,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,/* Initialize upfront link training vfunc for DP */ if (intel_encoder->type !=INTEL_OUTPUT_EDP ) { -if (IS_BROXTON (dev)) - intel_dp->upfront_link_train = intel_bxt_upfront_link_train; +if (IS_BROXTON (dev) ||IS_SKYLAKE (dev)) + intel_dp->upfront_link_train = intel_ddi_upfront_link_train; }/* eDP only on port B and/or C on vlv/chv */
drivers/gpu/drm/i915/intel_dpll_mgr.c +38 -0
@@ -24,6 +24,44 @@#include "intel_drv.h" struct intel_shared_dpll * +skl_find_link_pll (struct drm_i915_private *dev_priv,int clock) +{ +struct intel_shared_dpll *pll =NULL ; +struct intel_dpll_hw_state dpll_hw_state; +enum intel_dpll_id i; +bool found = false; + +if (!skl_ddi_dp_set_dpll_hw_state (clock, &dpll_hw_state)) +return pll; + +for (i =DPLL_ID_SKL_DPLL1 ; i <=DPLL_ID_SKL_DPLL3 ; i++) { + pll = &dev_priv->shared_dplls[i]; + +/* Only want to check enabled timings first */ +if (pll->config.crtc_mask ==0 ) +continue ; + +if (memcmp (&dpll_hw_state, &pll->config.hw_state, +sizeof (pll->config.hw_state)) ==0 ) { + found = true; +break ; + } + } + +/* Ok no matching timings, maybe there's a free one? */ +for (i =DPLL_ID_SKL_DPLL1 ; + ((found == false) && (i <=DPLL_ID_SKL_DPLL3 )); i++) { + pll = &dev_priv->shared_dplls[i]; +if (pll->config.crtc_mask ==0 ) { + pll->config.hw_state = dpll_hw_state; +break ; + } + } + +return pll; +} + +struct intel_shared_dpll *intel_get_shared_dpll_by_id (struct drm_i915_private *dev_priv,enum intel_dpll_id id) {
drivers/gpu/drm/i915/intel_dpll_mgr.h +2 -0
@@ -167,5 +167,7 @@ bool bxt_ddi_dp_set_dpll_hw_state(int clock,/* SKL dpll related functions */ bool skl_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state); +struct intel_shared_dpll *skl_find_link_pll (struct drm_i915_private *dev_priv, +int clock);#endif /* _INTEL_DPLL_MGR_H_ */
drivers/gpu/drm/i915/intel_drv.h +3 -1
@@ -1138,9 +1138,11 @@ void intel_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config);void intel_ddi_set_vc_payload_alloc (struct drm_crtc *crtc,bool state);uint32_t ddi_signal_levels (struct intel_dp *intel_dp); -bool intel_bxt_upfront_link_train (struct intel_dp *intel_dp, +bool intel_ddi_upfront_link_train (struct intel_dp *intel_dp,int clock,uint8_t lane_count,bool link_mst); +struct intel_shared_dpll *intel_ddi_get_link_dpll (struct intel_dp *intel_dp, +int clock); unsigned int intel_fb_align_height(struct drm_device *dev, unsigned int height,
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 7/9] drm/i915/dp: Enable upfront link training on SKL
Quoted 157 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Manasi Navare
Sent: Wednesday, August 10, 2016 12:59 AM
To: [email protected]
Subject: [Intel-gfx] [PATCH 7/9] drm/i915/dp: Enable upfront link training on SKLFrom: Jim Bride <[email protected]>
Split the PLL selection code out of the BXT upfront link training implementation and into a stand-alone function in order to allow for the implementation of a platform neutral upfront link training function, and then enable upfront link training for Skylake.
Signed-off-by Jim Bride <[email protected]>--- drivers/gpu/drm/i915/intel_ddi.c | 58 ++++++++++++++++++++++++----- ------ drivers/gpu/drm/i915/intel_dp.c | 4 +-- drivers/gpu/drm/i915/intel_dpll_mgr.c | 38 +++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dpll_mgr.h | 2 ++ drivers/gpu/drm/i915/intel_drv.h | 4 ++- 5 files changed, 85 insertions(+), 21 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +36
-1@@ -2378,8 +2378,43 @@ intel_ddi_init_hdmi_connector(struct intel_digital_port *intel_dig_port)return connector; } +struct intel_shared_dpll * +intel_ddi_get_link_dpll (struct intel_dp *intel_dp,int clock) +{ +struct intel_connector *connector = intel_dp->attached_connector; +struct intel_encoder *encoder = connector->encoder; +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); +struct intel_shared_dpll *pll =NULL ; +struct intel_shared_dpll_config tmp_pll_config; +enum intel_dpll_id dpll_id; -bool intel_bxt_upfront_link_train(struct intel_dp *intel_dp, +if (IS_BROXTON (dev_priv)) { + dpll_id = (enum intel_dpll_id )dig_port->port; +/* +* Select the required PLL. This works for platforms where +* there is no shared DPLL. +*/ + pll = &dev_priv->shared_dplls[dpll_id]; +if (WARN_ON (pll->active_mask)) { + +DRM_ERROR ("Shared DPLL in use. active_mask:%x\n", + pll->active_mask); + pll =NULL ; + } + tmp_pll_config = pll->config; +if (!bxt_ddi_dp_set_dpll_hw_state (clock, + &pll->config.hw_state)) { +DRM_ERROR ("Could not setup DPLL\n" ); + pll->config = tmp_pll_config; + } + }else if (IS_SKYLAKE (dev_priv)) { + pll =skl_find_link_pll (dev_priv, clock); + } +return pll; +} + +bool intel_ddi_upfront_link_train(struct intel_dp *intel_dp, int clock, uint8_t lane_count,drivers/gpu/drm/i915/intel_ddi.c +4
-17bool link_mst) {@@ -2388,28 +2423,15 @@ bool intel_bxt_upfront_link_train(struct intel_dp *intel_dp, struct drm_i915_private *dev_priv = to_i915(encoder->base.dev);struct intel_shared_dpll *pll;struct intel_shared_dpll_config tmp_pll_config; -struct intel_digital_port *dig_port =dp_to_dig_port (intel_dp); -enum intel_dpll_id dpll_id = (enum intel_dpll_id )dig_port->port; -/* -* FIXME: Works only for BXT. -* Select the required PLL. This works for platforms where -* there is no shared DPLL. -*/ - pll = &dev_priv->shared_dplls[dpll_id]; -if (WARN_ON (pll->active_mask)) { -DRM_ERROR ("Shared DPLL already in use. active_mask:%x\n", pll->active_mask); + pll = intel_ddi_get_link_dpll(intel_dp, clock); +if (pll ==NULL ) { +DRM_ERROR ("Could not find DPLL for link training.\n" );return false; } - + tmp_pll_config = pll->config; -if (!bxt_ddi_dp_set_dpll_hw_state (clock, &pll->config.hw_state)) { -DRM_ERROR ("Could not setup DPLL\n" ); - pll->config = tmp_pll_config; -return false; - } -/* Enable PLL followed by port */ drivers/gpu/drm/i915/intel_ddi.c +0
-0pll->funcs.enable (dev_priv, pll);intel_ddi_pre_enable_dp (encoder, clock, lane_count, pll, link_mst);drivers/gpu/drm/i915/intel_dp.c +2
-2@@ -5762,8 +5762,8 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,/* Initialize upfront link training vfunc for DP */ if (intel_encoder->type != INTEL_OUTPUT_EDP) { -if (IS_BROXTON (dev)) - intel_dp->upfront_link_train = intel_bxt_upfront_link_train; +if (IS_BROXTON (dev) ||IS_SKYLAKE (dev)) + intel_dp->upfront_link_train = intel_ddi_upfront_link_train;drivers/gpu/drm/i915/intel_dp.c +0
-0}/* eDP only on port B and/or C on vlv/chv */ drivers/gpu/drm/i915/intel_dpll_mgr.c +17
-0@@ -24,6 +24,44 @@#include "intel_drv.h" struct intel_shared_dpll * +skl_find_link_pll (struct drm_i915_private *dev_priv,int clock) +{ +struct intel_shared_dpll *pll =NULL ; +struct intel_dpll_hw_state dpll_hw_state; +enum intel_dpll_id i; +bool found = false; + +if (!skl_ddi_dp_set_dpll_hw_state (clock, &dpll_hw_state)) +return pll; + +for (i =DPLL_ID_SKL_DPLL1 ; i <=DPLL_ID_SKL_DPLL3 ; i++) { + pll = &dev_priv->shared_dplls[i]; + +/* Only want to check enabled timings first */ +if (pll->config.crtc_mask ==0 ) +continue ; +
drivers/gpu/drm/i915/intel_dpll_mgr.c line 53
Quoted 10 lines
drivers/gpu/drm/i915/intel_dpll_mgr.c +10
-0+if (memcmp (&dpll_hw_state, &pll->config.hw_state, +sizeof (pll->config.hw_state)) ==0 ) { + found = true; +break ; + } + } + +/* Ok no matching timings, maybe there's a free one? */ +for (i =DPLL_ID_SKL_DPLL1 ; + ((found == false) && (i <=DPLL_ID_SKL_DPLL3 )); i++) {
Will moving this 'found' check outside the loop make it more readable ..? [make it closer to the previous loop above]
if (!found) {
for() {}
}Either way,
Thanks,
Durga
Quoted 50 lines
drivers/gpu/drm/i915/intel_dpll_mgr.c +11
-0+ pll = &dev_priv->shared_dplls[i]; +if (pll->config.crtc_mask ==0 ) { + pll->config.hw_state = dpll_hw_state; +break ; + } + } + +return pll; +} + +struct intel_shared_dpll *intel_get_shared_dpll_by_id (struct drm_i915_private *dev_priv,enum intel_dpll_id id) {drivers/gpu/drm/i915/intel_dpll_mgr.h +2
-0@@ -167,5 +167,7 @@ bool bxt_ddi_dp_set_dpll_hw_state(int clock,/* SKL dpll related functions */ bool skl_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state); +struct intel_shared_dpll *skl_find_link_pll (struct drm_i915_private *dev_priv, +int clock);#endif /* _INTEL_DPLL_MGR_H_ */
drivers/gpu/drm/i915/intel_drv.h +3
-1@@ -1138,9 +1138,11 @@ void intel_ddi_clock_get(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config);void intel_ddi_set_vc_payload_alloc (struct drm_crtc *crtc,bool state);uint32_t ddi_signal_levels (struct intel_dp *intel_dp); -bool intel_bxt_upfront_link_train (struct intel_dp *intel_dp, +bool intel_ddi_upfront_link_train (struct intel_dp *intel_dp,int clock,uint8_t lane_count,bool link_mst); +struct intel_shared_dpll *intel_ddi_get_link_dpll (struct intel_dp *intel_dp, +int clock); unsigned int intel_fb_align_height(struct drm_device *dev,unsigned int height,
--
1.9.1
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 8/9 drm/i915: Split hsw_get_dpll()
In reply to Manasi NavareSplit out the DisplayPort and HDMI pll setup code into separate functions and refactor the DP code that calculates the pll so that it doesn't depend on crtc state.
This will be used for acquiring port pll when doing upfront link training.
--- drivers/gpu/drm/i915/intel_dpll_mgr.c | 90 ++++++++++++++++++++++------------- drivers/gpu/drm/i915/intel_dpll_mgr.h | 6 +++ 2 files changed, 63 insertions(+), 33 deletions(-)
drivers/gpu/drm/i915/intel_dpll_mgr.c +57 -33
@@ -705,11 +705,65 @@ hsw_ddi_calculate_wrpll(int clock /* in Hz */, *r2_out = best.r2; } +static struct intel_shared_dpll *hsw_ddi_hdmi_get_dpll (int clock, +struct intel_crtc *crtc, +struct intel_crtc_state *crtc_state) +{ +struct intel_shared_dpll *pll; +uint32_t val; +unsigned p, n2, r2; + +hsw_ddi_calculate_wrpll (clock *1000 , &r2, &n2, &p); + + val =WRPLL_PLL_ENABLE |WRPLL_PLL_LCPLL | +WRPLL_DIVIDER_REFERENCE (r2) |WRPLL_DIVIDER_FEEDBACK (n2) | +WRPLL_DIVIDER_POST (p); + + crtc_state->dpll_hw_state.wrpll = val; + + pll =intel_find_shared_dpll (crtc, crtc_state, +DPLL_ID_WRPLL1 ,DPLL_ID_WRPLL2 ); + +if (!pll) +return NULL ; + +return pll; +} + +struct intel_shared_dpll *hsw_ddi_dp_get_dpll (struct intel_encoder *encoder, +int clock) +{ +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_shared_dpll *pll; +enum intel_dpll_id pll_id; + +switch (clock /2 ) { +case 81000 : + pll_id =DPLL_ID_LCPLL_810 ; +break ; +case 135000 : + pll_id =DPLL_ID_LCPLL_1350 ; +break ; +case 270000 : + pll_id =DPLL_ID_LCPLL_2700 ; +break ; +default : +DRM_DEBUG_KMS ("Invalid clock for DP: %d\n" , clock); +return NULL ; + } + + pll =intel_get_shared_dpll_by_id (dev_priv, pll_id); + +if (!pll) +return NULL ; + +return pll; +} +static struct intel_shared_dpll *hsw_get_dpll (struct intel_crtc *crtc,struct intel_crtc_state *crtc_state,struct intel_encoder *encoder) { -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);struct intel_shared_dpll *pll;int clock = crtc_state->port_clock;
@@ -717,41 +771,12 @@ hsw_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state, sizeof(crtc_state->dpll_hw_state));if (encoder->type ==INTEL_OUTPUT_HDMI ) { -uint32_t val; -unsigned p, n2, r2; - -hsw_ddi_calculate_wrpll (clock *1000 , &r2, &n2, &p); - - val =WRPLL_PLL_ENABLE |WRPLL_PLL_LCPLL | -WRPLL_DIVIDER_REFERENCE (r2) |WRPLL_DIVIDER_FEEDBACK (n2) | -WRPLL_DIVIDER_POST (p); - - crtc_state->dpll_hw_state.wrpll = val; - - pll =intel_find_shared_dpll (crtc, crtc_state, -DPLL_ID_WRPLL1 ,DPLL_ID_WRPLL2 ); + pll =hsw_ddi_hdmi_get_dpll (clock, crtc, crtc_state); }else if (encoder->type ==INTEL_OUTPUT_DP || encoder->type ==INTEL_OUTPUT_DP_MST || encoder->type ==INTEL_OUTPUT_EDP ) { -enum intel_dpll_id pll_id; - -switch (clock /2 ) { -case 81000 : - pll_id =DPLL_ID_LCPLL_810 ; -break ; -case 135000 : - pll_id =DPLL_ID_LCPLL_1350 ; -break ; -case 270000 : - pll_id =DPLL_ID_LCPLL_2700 ; -break ; -default : -DRM_DEBUG_KMS ("Invalid clock for DP: %d\n" , clock); -return NULL ; - } - - pll =intel_get_shared_dpll_by_id (dev_priv, pll_id); + pll =hsw_ddi_dp_get_dpll (encoder, clock); }else if (encoder->type ==INTEL_OUTPUT_ANALOG ) {if (WARN_ON (crtc_state->port_clock /2 !=135000 ))
@@ -774,7 +799,6 @@ hsw_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state,return pll; } -static const struct intel_shared_dpll_funcs hsw_ddi_wrpll_funcs = { .enable = hsw_ddi_wrpll_enable, .disable = hsw_ddi_wrpll_disable,
drivers/gpu/drm/i915/intel_dpll_mgr.h +6 -0
@@ -164,10 +164,16 @@ void intel_shared_dpll_init(struct drm_device *dev);bool bxt_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state); +/* SKL dpll related functions */ bool skl_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state);struct intel_shared_dpll *skl_find_link_pll (struct drm_i915_private *dev_priv,int clock); + +/* HSW dpll related functions */ +struct intel_shared_dpll *hsw_ddi_dp_get_dpll (struct intel_encoder *encoder, +int clock); +#endif /* _INTEL_DPLL_MGR_H_ */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 8/9] drm/i915: Split hsw_get_dpll()
Quoted 8 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Manasi Navare
Sent: Wednesday, August 10, 2016 12:59 AM
To: [email protected]
Subject: [Intel-gfx] [PATCH 8/9] drm/i915: Splithsw_get_dpll()
Quoted 7 lines
Split out the DisplayPort and HDMI pll setup code into separate functions and refactor the DP code that calculates the pll so that it doesn't depend on crtc state.
This will be used for acquiring port pll when doing upfront link training.Signed-off-by Manasi Navare <[email protected]>
Thanks,
Durga
Quoted 166 lines
--- drivers/gpu/drm/i915/intel_dpll_mgr.c | 90 ++++++++++++++++++++++---- --------- drivers/gpu/drm/i915/intel_dpll_mgr.h | 6 +++ 2 files changed, 63 insertions(+), 33 deletions(-)drivers/gpu/drm/i915/intel_dpll_mgr.c +12
-0@@ -705,11 +705,65 @@ hsw_ddi_calculate_wrpll(int clock /* in Hz */, *r2_out = best.r2; } +static struct intel_shared_dpll *hsw_ddi_hdmi_get_dpll (int clock, +struct intel_crtc *crtc, +struct intel_crtc_state *crtc_state) +{ +struct intel_shared_dpll *pll; +uint32_t val; +unsigned p, n2, r2; + +hsw_ddi_calculate_wrpll (clock *1000 , &r2, &n2, &p); + + val =WRPLL_PLL_ENABLE |WRPLL_PLL_LCPLL | + WRPLL_DIVIDER_REFERENCE(r2) |
WRPLL_DIVIDER_FEEDBACK(n2)|drivers/gpu/drm/i915/intel_dpll_mgr.c +14
-0+WRPLL_DIVIDER_POST (p); + + crtc_state->dpll_hw_state.wrpll = val; + + pll =intel_find_shared_dpll (crtc, crtc_state, +DPLL_ID_WRPLL1 ,DPLL_ID_WRPLL2 ); + +if (!pll) +return NULL ; + +return pll; +} + +struct intel_shared_dpll *hsw_ddi_dp_get_dpll(struct intel_encoder*encoder,
drivers/gpu/drm/i915/intel_dpll_mgr.c +29
-8+ int clock) +{ +struct drm_i915_private *dev_priv =to_i915 (encoder->base.dev); +struct intel_shared_dpll *pll; +enum intel_dpll_id pll_id; + +switch (clock /2 ) { +case 81000 : + pll_id =DPLL_ID_LCPLL_810 ; +break ; +case 135000 : + pll_id =DPLL_ID_LCPLL_1350 ; +break ; +case 270000 : + pll_id =DPLL_ID_LCPLL_2700 ; +break ; +default : +DRM_DEBUG_KMS ("Invalid clock for DP: %d\n" , clock); +return NULL ; + } + + pll =intel_get_shared_dpll_by_id (dev_priv, pll_id); + +if (!pll) +return NULL ; + +return pll; +} +static struct intel_shared_dpll *hsw_get_dpll (struct intel_crtc *crtc,struct intel_crtc_state *crtc_state,struct intel_encoder *encoder) { -struct drm_i915_private *dev_priv =to_i915 (crtc->base.dev);struct intel_shared_dpll *pll;int clock = crtc_state->port_clock;@@ -717,41 +771,12 @@ hsw_get_dpll(struct intel_crtc *crtc, struct intel_crtc_state *crtc_state, sizeof(crtc_state->dpll_hw_state));if (encoder->type ==INTEL_OUTPUT_HDMI ) { -uint32_t val; -unsigned p, n2, r2; - -hsw_ddi_calculate_wrpll (clock *1000 , &r2, &n2, &p); - - val =WRPLL_PLL_ENABLE |WRPLL_PLL_LCPLL | - WRPLL_DIVIDER_REFERENCE(r2) |
WRPLL_DIVIDER_FEEDBACK(n2)|drivers/gpu/drm/i915/intel_dpll_mgr.c +0
-6-WRPLL_DIVIDER_POST (p); - - crtc_state->dpll_hw_state.wrpll = val; - - pll = intel_find_shared_dpll(crtc, crtc_state, - DPLL_ID_WRPLL1,
DPLL_ID_WRPLL2);drivers/gpu/drm/i915/intel_dpll_mgr.c +1
-14+ pll =hsw_ddi_hdmi_get_dpll (clock, crtc, crtc_state); }else if (encoder->type ==INTEL_OUTPUT_DP || encoder->type ==INTEL_OUTPUT_DP_MST || encoder->type ==INTEL_OUTPUT_EDP ) { -enum intel_dpll_id pll_id; - -switch (clock /2 ) { -case 81000 : - pll_id =DPLL_ID_LCPLL_810 ; -break ; -case 135000 : - pll_id =DPLL_ID_LCPLL_1350 ; -break ; -case 270000 : - pll_id =DPLL_ID_LCPLL_2700 ; -break ; -default : - DRM_DEBUG_KMS("Invalid clock for DP: %d\n",clock);
drivers/gpu/drm/i915/intel_dpll_mgr.c +1
-5-return NULL ; - } - - pll =intel_get_shared_dpll_by_id (dev_priv, pll_id); + pll =hsw_ddi_dp_get_dpll (encoder, clock); }else if (encoder->type ==INTEL_OUTPUT_ANALOG ) {if (WARN_ON (crtc_state->port_clock /2 !=135000 ))@@ -774,7 +799,6 @@ hsw_get_dpll(struct intel_crtc *crtc, structintel_crtc_state *crtc_state, return pll; } -static const struct intel_shared_dpll_funcs hsw_ddi_wrpll_funcs = { .enable = hsw_ddi_wrpll_enable,drivers/gpu/drm/i915/intel_dpll_mgr.c +0
-0.disable = hsw_ddi_wrpll_disable,drivers/gpu/drm/i915/intel_dpll_mgr.h +4
-0@@ -164,10 +164,16 @@ void intel_shared_dpll_init(struct drm_device *dev);bool bxt_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state); +/* SKL dpll related functions */ bool skl_ddi_dp_set_dpll_hw_state (int clock,struct intel_dpll_hw_state *dpll_hw_state);struct intel_shared_dpll *skl_find_link_pll (struct drm_i915_private *dev_priv,int clock); + +/* HSW dpll related functions */ +struct intel_shared_dpll *hsw_ddi_dp_get_dpll(struct intel_encoder*encoder,
drivers/gpu/drm/i915/intel_dpll_mgr.h +2
-1+ int clock); +#endif /* _INTEL_DPLL_MGR_H_ */ --1.9.1
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 9/9 drm/i915: Enable upfront link training support for HSW/BDW
In reply to Manasi NavareGet the PLLs for HSW/BDW using the platform specific function and add hooks for enabling upfront link training on HSW and BDW.
--- drivers/gpu/drm/i915/intel_ddi.c | 2 ++ drivers/gpu/drm/i915/intel_dp.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_ddi.c +2 -0
@@ -2410,6 +2410,8 @@ intel_ddi_get_link_dpll(struct intel_dp *intel_dp, int clock) } }else if (IS_SKYLAKE (dev_priv)) { pll =skl_find_link_pll (dev_priv, clock); + }else if (IS_HASWELL (dev_priv) ||IS_BROADWELL (dev_priv)) { + pll =hsw_ddi_dp_get_dpll (encoder, clock); }return pll; }
drivers/gpu/drm/i915/intel_dp.c +3 -1
@@ -5762,8 +5762,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,/* Initialize upfront link training vfunc for DP */ if (intel_encoder->type !=INTEL_OUTPUT_EDP ) { -if (IS_BROXTON (dev) ||IS_SKYLAKE (dev)) +if (IS_BROXTON (dev) ||IS_SKYLAKE (dev) || +IS_BROADWELL (dev) ||IS_HASWELL (dev)) intel_dp->upfront_link_train = intel_ddi_upfront_link_train; + }/* eDP only on port B and/or C on vlv/chv */
Signature · 6 lines
1.9.1 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 9/9] drm/i915: Enable upfront link training support for HSW/BDW
Quoted 8 lines
-----Original Message-----
From: Intel-gfx [mailto:[email protected]] On Behalf Of Manasi Navare
Sent: Wednesday, August 10, 2016 12:59 AM
To: [email protected]
Subject: [Intel-gfx] [PATCH 9/9] drm/i915: Enable upfront link training support for HSW/BDW
Quoted 4 lines
Get the PLLs for HSW/BDW using the platform specific function and add hooks for enabling upfront link training on HSW and BDW.
Signed-off-by Manasi Navare <[email protected]>
Thanks,
Durga
Quoted 38 lines
--- drivers/gpu/drm/i915/intel_ddi.c | 2 ++ drivers/gpu/drm/i915/intel_dp.c | 4 +++- 2 files changed, 5 insertions(+), 1 deletion(-)drivers/gpu/drm/i915/intel_ddi.c +2
-0@@ -2410,6 +2410,8 @@ intel_ddi_get_link_dpll(struct intel_dp *intel_dp, int clock) } }else if (IS_SKYLAKE (dev_priv)) { pll =skl_find_link_pll (dev_priv, clock); + }else if (IS_HASWELL (dev_priv) ||IS_BROADWELL (dev_priv)) { + pll =hsw_ddi_dp_get_dpll (encoder, clock); }return pll;}
drivers/gpu/drm/i915/intel_dp.c +3
-1@@ -5762,8 +5762,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,/* Initialize upfront link training vfunc for DP */ if (intel_encoder->type != INTEL_OUTPUT_EDP) { -if (IS_BROXTON (dev) ||IS_SKYLAKE (dev)) +if (IS_BROXTON (dev) ||IS_SKYLAKE (dev) || +IS_BROADWELL (dev) ||IS_HASWELL (dev)) intel_dp->upfront_link_train = intel_ddi_upfront_link_train; + }
Quoted 8 lines
/* eDP only on port B and/or C on vlv/chv */
--
1.9.1_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Ro.CI.BAT: failure for Enable upfront link training on DDI platforms (rev2)
In reply to Manasi Navare== Series Details ==
== Series Details ==
Series: Enable upfront link training on DDI platforms (rev2)
URL : https://patchwork.freedesktop.org/series/10821/
State : failure
== Summary ==
Series 10821v2 Enable upfront link training on DDI platforms
http://patchwork.freedesktop.org/api/1.0/series/10821/revisions/2/mbox
Test drv_module_reload_basic:
pass -> DMESG-WARN (ro-bdw-i5-5250u)
Test gem_exec_suspend:
Subgroup basic-s3:
pass -> DMESG-WARN (ro-bdw-i7-5600u)
incomplete -> DMESG-WARN (fi-skl-i7-6700k)
Test kms_cursor_legacy:
Subgroup basic-cursor-vs-flip-varying-size:
fail -> PASS (ro-ilk1-i5-650)
Subgroup basic-flip-vs-cursor-legacy:
pass -> FAIL (ro-byt-n2820)
pass -> FAIL (ro-bdw-i5-5250u)
pass -> FAIL (ro-skl3-i5-6260u)
Test kms_pipe_crc_basic:
Subgroup read-crc-pipe-c-frame-sequence:
fail -> PASS (ro-ivb-i7-3770)
Subgroup suspend-read-crc-pipe-a:
incomplete -> PASS (fi-hsw-i7-4770k)
Subgroup suspend-read-crc-pipe-b:
skip -> DMESG-WARN (ro-bdw-i5-5250u)
Subgroup suspend-read-crc-pipe-c:
dmesg-warn -> PASS (ro-bdw-i7-5600u)fi-hsw-i7-4770k total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-qkkr total:244 pass:185 dwarn:29 dfail:0 fail:3 skip:27 fi-skl-i5-6260u total:244 pass:224 dwarn:4 dfail:0 fail:2 skip:14 fi-skl-i7-6700k total:244 pass:208 dwarn:4 dfail:2 fail:2 skip:28 fi-snb-i7-2600 total:244 pass:202 dwarn:0 dfail:0 fail:0 skip:42 ro-bdw-i5-5250u total:240 pass:218 dwarn:4 dfail:0 fail:1 skip:17 ro-bdw-i7-5557U total:240 pass:219 dwarn:3 dfail:0 fail:0 skip:18 ro-bdw-i7-5600u total:240 pass:206 dwarn:1 dfail:0 fail:1 skip:32 ro-bsw-n3050 total:240 pass:194 dwarn:0 dfail:0 fail:4 skip:42 ro-byt-n2820 total:240 pass:197 dwarn:0 dfail:0 fail:3 skip:40 ro-hsw-i3-4010u total:240 pass:214 dwarn:0 dfail:0 fail:0 skip:26 ro-hsw-i7-4770r total:240 pass:214 dwarn:0 dfail:0 fail:0 skip:26 ro-ilk1-i5-650 total:235 pass:174 dwarn:0 dfail:0 fail:1 skip:60 ro-ivb-i7-3770 total:240 pass:205 dwarn:0 dfail:0 fail:0 skip:35 ro-ivb2-i7-3770 total:240 pass:209 dwarn:0 dfail:0 fail:0 skip:31 ro-skl3-i5-6260u total:240 pass:223 dwarn:0 dfail:0 fail:3 skip:14
Results at /archive/results/CI_IGT_test/RO_Patchwork_1806/
d0e3a4b drm-intel-nightly: 2016y-08m-09d-20h-18m-38s UTC integration manifest f5b42cb drm/i915: Enable upfront link training support for HSW/BDW b4816e8 drm/i915: Split hsw_get_dpll()
871eea3 drm/i915/dp: Enable upfront link training on SKL
81e41dd drm/i915: Split skl_get_dpll()
caf9e6b drm/i915/dp: Enable Upfront link training for typeC DP support on BXT ac2d7ae drm/i915: Split bxt_ddi_pll_select()
99362db drm/i915: Split intel_ddi_pre_enable() into DP and HDMI versions d97a2be drm/i915: Remove ddi_pll_sel from intel_crtc_state 3faa91d drm/i915: Don't pass crtc_state to intel_dp_set_link_params()
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Ro.CI.BAT: failure for Enable upfront link training on DDI platforms (rev2)
Quoted 6 lines · Patchwork
== Series Details ==
Series: Enable upfront link training on DDI platforms (rev2)
URL : https://patchwork.freedesktop.org/series/10821/
State : failure
Quoted 7 lines
== Summary ==
Series 10821v2 Enable upfront link training on DDI platforms
http://patchwork.freedesktop.org/api/1.0/series/10821/revisions/2/mboxTest
drv_module_reload_basic:pass -> DMESG-WARN (ro-bdw-i5-5250u)
https://bugs.freedesktop.org/show_bug.cgi?id=96614
Quoted 3 lines
Test
gem_exec_suspend:Subgroup basic-s3: pass -> DMESG-WARN (ro-bdw-i7-5600u)
https://bugs.freedesktop.org/show_bug.cgi?id=96614
Quoted 1 line
incomplete -> DMESG-WARN (fi-skl-i7-6700k)
https://bugs.freedesktop.org/show_bug.cgi?id=96226
Quoted 7 lines
Test
kms_cursor_legacy:Subgroup basic-cursor-vs-flip-varying-size: fail -> PASS (ro-ilk1-i5-650) Subgroup basic-flip-vs-cursor-legacy: pass -> FAIL (ro-byt-n2820) pass -> FAIL (ro-bdw-i5-5250u) pass -> FAIL (ro-skl3-i5-6260u)
https://bugs.freedesktop.org/show_bug.cgi?id=97188
Quoted 7 lines
Test
kms_pipe_crc_basic:Subgroup read-crc-pipe-c-frame-sequence: fail -> PASS (ro-ivb-i7-3770) Subgroup suspend-read-crc-pipe-a: incomplete -> PASS (fi-hsw-i7-4770k) Subgroup suspend-read-crc-pipe-b: skip -> DMESG-WARN (ro-bdw-i5-5250u)
https://bugs.freedesktop.org/show_bug.cgi?id=96913
Quoted 2 lines
Subgroup suspend-read-crc-pipe-c:
dmesg-warn -> PASS (ro-bdw-i7-5600u)https://bugs.freedesktop.org/show_bug.cgi?id=97294
Quoted 31 lines
fi-hsw-i7-4770k total:244 pass:222 dwarn:0 dfail:0 fail:0 skip:22 fi-kbl-qkkr total:244 pass:185 dwarn:29 dfail:0 fail:3 skip:27 fi-skl-i5-6260u total:244 pass:224 dwarn:4 dfail:0 fail:2 skip:14 fi-skl-i7-6700k total:244 pass:208 dwarn:4 dfail:2 fail:2 skip:28 fi-snb-i7-2600 total:244 pass:202 dwarn:0 dfail:0 fail:0 skip:42 ro-bdw-i5-5250u total:240 pass:218 dwarn:4 dfail:0 fail:1 skip:17 ro-bdw-i7-5557U total:240 pass:219 dwarn:3 dfail:0 fail:0 skip:18 ro-bdw-i7-5600u total:240 pass:206 dwarn:1 dfail:0 fail:1 skip:32 ro-bsw-n3050 total:240 pass:194 dwarn:0 dfail:0 fail:4 skip:42 ro-byt-n2820 total:240 pass:197 dwarn:0 dfail:0 fail:3 skip:40 ro-hsw-i3-4010u total:240 pass:214 dwarn:0 dfail:0 fail:0 skip:26 ro-hsw-i7-4770r total:240 pass:214 dwarn:0 dfail:0 fail:0 skip:26 ro-ilk1-i5-650 total:235 pass:174 dwarn:0 dfail:0 fail:1 skip:60 ro-ivb-i7-3770 total:240 pass:205 dwarn:0 dfail:0 fail:0 skip:35 ro-ivb2-i7-3770 total:240 pass:209 dwarn:0 dfail:0 fail:0 skip:31 ro-skl3-i5-6260u total:240 pass:223 dwarn:0 dfail:0 fail:3 skip:14Results at /archive/results/CI_IGT_test/RO_Patchwork_1806/
d0e3a4b drm-intel-nightly: 2016y-08m-09d-20h-18m-38s UTC integration manifest f5b42cb drm/i915: Enable upfront link training support for HSW/BDW b4816e8 drm/i915: Split
hsw_get_dpll()
871eea3 drm/i915/dp: Enable upfront link training on SKL
81e41dd drm/i915: Splitskl_get_dpll()
caf9e6b drm/i915/dp: Enable Upfront link training for typeC DP support on BXT ac2d7ae drm/i915: Splitbxt_ddi_pll_select()
99362db drm/i915: Splitintel_ddi_pre_enable()into DP and HDMI versions d97a2be drm/i915: Removeddi_pll_selfromintel_crtc_state3faa91d drm/i915: Don't passcrtc_statetointel_dp_set_link_params()
Quoted 4 lines
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx