drm/i915/bxt: Fix DDI PHY setup for low resolutions
Subsystems (2)
cover drm/i915/bxt: Fix DDI PHY setup for low resolutions
There are two problems with the current way of enabling the DDI PHYs during driver loading/resuming:
Relying on the HWs dynamic power gating may waste some power and part of the PHY configuration is dependent on the mode specific DDI lane count. To solve both of these issues split the PHY initialization, moving one half of it to the power well code the other half to the modeset code, similarly to the CHV code.
Kudos to Ville for explaining about the PHY power gating and other quirks on CHV, it helped a lot to better understand the BXT PHY which is quite similar.
This fixes modeset problems for modes with less than 4 lanes.
Imre Deak (6):
drm/i915/bxt: Wait for PHY1 GRC calibration synchronously drm/i915: Factor out intel_power_well_get/put drm/i915/bxt: Move DDI PHY enabling/disabling to the power well code drm/i915/bxt: Set DDI PHY lane latency optimization during modeset drm/i915/bxt: Rename broxton to bxt in PHY/CDCLK function prefixes drm/i915/bxt: Sanitiy check the PHY lane power down status
drivers/gpu/drm/i915/i915_reg.h | 12 ++ drivers/gpu/drm/i915/intel_ddi.c | 222 ++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_display.c | 33 +++-- drivers/gpu/drm/i915/intel_drv.h | 19 ++- drivers/gpu/drm/i915/intel_runtime_pm.c | 133 ++++++++++++++++--- 5 files changed, 291 insertions(+), 128 deletions(-)
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/6 drm/i915/bxt: Wait for PHY1 GRC calibration synchronously
A follow-up patch moves the PHY enabling to the power well code where enabling/disabling the PHYs will happen independently. Because of this waiting for the GRC calibration in PHY1 asynchronously would need some additional logic. Instead of adding that let's keep things simple for now and wait synchronously. My measurements showed that the calibration takes ~4ms.
--- drivers/gpu/drm/i915/intel_ddi.c | 15 +++------------ 1 file changed, 3 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +3 -12
@@ -1899,8 +1899,6 @@ static void broxton_phy_init(struct drm_i915_private *dev_priv,* the corresponding calibrated value from PHY1, and disable * the automatic calibration on PHY0. */ -broxton_phy_wait_grc_done (dev_priv,DPIO_PHY1 ); - val = dev_priv->bxt_phy_grc =broxton_get_grc (dev_priv,DPIO_PHY1 ); grc_code = val << GRC_CODE_FAST_SHIFT |
@@ -1912,14 +1910,13 @@ static void broxton_phy_init(struct drm_i915_private *dev_priv, val |=GRC_DIS |GRC_RDY_OVRD ;I915_WRITE (BXT_PORT_REF_DW8 (DPIO_PHY0 ), val); } -/* -* During PHY1 init delay waiting for GRC calibration to finish, since -* it can happen in parallel with the subsequent PHY0 init. -*/ val =I915_READ (BXT_PHY_CTL_FAMILY (phy)); val |=COMMON_RESET_DIS ;I915_WRITE (BXT_PHY_CTL_FAMILY (phy), val); + +if (phy ==DPIO_PHY1 ) +broxton_phy_wait_grc_done (dev_priv,DPIO_PHY1 ); }void broxton_ddi_phy_init (struct drm_i915_private *dev_priv)
@@ -1927,12 +1924,6 @@ void broxton_ddi_phy_init(struct drm_i915_private *dev_priv)/* Enable PHY1 first since it provides Rcomp for PHY0 */ broxton_phy_init (dev_priv,DPIO_PHY1 );broxton_phy_init (dev_priv,DPIO_PHY0 ); - -/* -* If BIOS enabled only PHY0 and not PHY1, we skipped waiting for the -* PHY1 GRC calibration to finish, so wait for it here. -*/ -broxton_phy_wait_grc_done (dev_priv,DPIO_PHY1 ); } static void broxton_phy_uninit(struct drm_i915_private *dev_priv,
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/6 drm/i915: Factor out intel_power_well_get/put
In reply to Imre DeakThese helpers will be needed by the next patch, so factor them out.
No functional change.
--- drivers/gpu/drm/i915/intel_runtime_pm.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)
drivers/gpu/drm/i915/intel_runtime_pm.c +17 -6
@@ -151,6 +151,20 @@ static void intel_power_well_disable(struct drm_i915_private *dev_priv, power_well->ops->disable (dev_priv, power_well); } +static void intel_power_well_get (struct drm_i915_private *dev_priv, +struct i915_power_well *power_well) +{ +if (!power_well->count++) +intel_power_well_enable (dev_priv, power_well); +} + +static void intel_power_well_put (struct drm_i915_private *dev_priv, +struct i915_power_well *power_well) +{ +if (!--power_well->count) +intel_power_well_disable (dev_priv, power_well); +} +/* * We should only use the power well if we explicitly asked the hardware to * enable it, so check if it's enabled and also check if we've requested it to
@@ -1518,10 +1532,8 @@ __intel_display_power_get_domain(struct drm_i915_private *dev_priv,struct i915_power_well *power_well;int i; -for_each_power_well (i, power_well,BIT (domain), power_domains) { -if (!power_well->count++) -intel_power_well_enable (dev_priv, power_well); - } +for_each_power_well (i, power_well,BIT (domain), power_domains) +intel_power_well_get (dev_priv, power_well); power_domains->domain_use_count[domain]++; }
@@ -1620,8 +1632,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,"Use count on power well %s is already zero" , power_well->name); -if (!--power_well->count) -intel_power_well_disable (dev_priv, power_well); +intel_power_well_put (dev_priv, power_well); }mutex_unlock (&power_domains->lock);
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 2/6] drm/i915: Factor out intel_power_well_get/put
Quoted 48 lines · Imre Deak
These helpers will be needed by the next patch, so factor them out.
No functional change.
Signed-off-by Imre Deak <[email protected]>--- drivers/gpu/drm/i915/intel_runtime_pm.c | 23 +++++++++++++++++------ 1 file changed, 17 insertions(+), 6 deletions(-)drivers/gpu/drm/i915/intel_runtime_pm.c +16
-4@@ -151,6 +151,20 @@ static void intel_power_well_disable(struct drm_i915_private *dev_priv, power_well->ops->disable (dev_priv, power_well); } +static void intel_power_well_get (struct drm_i915_private *dev_priv, +struct i915_power_well *power_well) +{ +if (!power_well->count++) +intel_power_well_enable (dev_priv, power_well); +} + +static void intel_power_well_put (struct drm_i915_private *dev_priv, +struct i915_power_well *power_well) +{ +if (!--power_well->count) +intel_power_well_disable (dev_priv, power_well); +} +/* * We should only use the power well if we explicitly asked the hardware to * enable it, so check if it's enabled and also check if we've requested it to @@ -1518,10 +1532,8 @@ __intel_display_power_get_domain(struct drm_i915_private *dev_priv,struct i915_power_well *power_well;int i; -for_each_power_well (i, power_well,BIT (domain), power_domains) { -if (!power_well->count++) -intel_power_well_enable (dev_priv, power_well); - } +for_each_power_well (i, power_well,BIT (domain), power_domains) +intel_power_well_get (dev_priv, power_well); power_domains->domain_use_count[domain]++; }
drivers/gpu/drm/i915/intel_runtime_pm.c void intel_display_power_put(struct drm_i915_private *dev_priv, · line 1633
Quoted 2 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +0
-0@@ -1620,8 +1632,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv,"Use count on power well %s is already zero" , power_well->name);
Move the WARN too?
Quoted 14 lines
drivers/gpu/drm/i915/intel_runtime_pm.c +1
-2-if (!--power_well->count) -intel_power_well_disable (dev_priv, power_well); +intel_power_well_put (dev_priv, power_well); }mutex_unlock (&power_domains->lock);Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 2/6 drm/i915: Factor out intel_power_well_get/put
In reply to Imre DeakThese helpers will be needed by the next patch, so factor them out.
No functional change.
v2:
- Move the refcount==0 WARN to the new put helper. (Ville)
--- drivers/gpu/drm/i915/intel_runtime_pm.c | 33 +++++++++++++++++++++------------ 1 file changed, 21 insertions(+), 12 deletions(-)
drivers/gpu/drm/i915/intel_runtime_pm.c +21 -12
@@ -151,6 +151,23 @@ static void intel_power_well_disable(struct drm_i915_private *dev_priv, power_well->ops->disable (dev_priv, power_well); } +static void intel_power_well_get (struct drm_i915_private *dev_priv, +struct i915_power_well *power_well) +{ +if (!power_well->count++) +intel_power_well_enable (dev_priv, power_well); +} + +static void intel_power_well_put (struct drm_i915_private *dev_priv, +struct i915_power_well *power_well) +{ +WARN (!power_well->count,"Use count on power well %s is already zero" , + power_well->name); + +if (!--power_well->count) +intel_power_well_disable (dev_priv, power_well); +} +/* * We should only use the power well if we explicitly asked the hardware to * enable it, so check if it's enabled and also check if we've requested it to
@@ -1518,10 +1535,8 @@ __intel_display_power_get_domain(struct drm_i915_private *dev_priv,struct i915_power_well *power_well;int i; -for_each_power_well (i, power_well,BIT (domain), power_domains) { -if (!power_well->count++) -intel_power_well_enable (dev_priv, power_well); - } +for_each_power_well (i, power_well,BIT (domain), power_domains) +intel_power_well_get (dev_priv, power_well); power_domains->domain_use_count[domain]++; }
@@ -1615,14 +1630,8 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, intel_display_power_domain_str(domain)); power_domains->domain_use_count[domain]--; -for_each_power_well_rev (i, power_well,BIT (domain), power_domains) { -WARN (!power_well->count, -"Use count on power well %s is already zero" , - power_well->name); - -if (!--power_well->count) -intel_power_well_disable (dev_priv, power_well); - } +for_each_power_well_rev (i, power_well,BIT (domain), power_domains) +intel_power_well_put (dev_priv, power_well);mutex_unlock (&power_domains->lock);
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 4/6 drm/i915/bxt: Set DDI PHY lane latency optimization during modeset
So far we configured a static lane latency optimization during driver loading/resuming. The specification changed at one point and now this configuration depends on the lane count, so move the configuration to modeset time accordingly.
It's not clear when this lane configuration takes effect. The specification only requires that the programming is done before enabling the port. On CHV OTOH the lanes start to power up already right after enabling the PLL. To be safe preserve the current order and set things up already before enabling the PLL.
v2: (Ander)
- Simplify the optimization mask calculation.
- Use the correct pipe_config always during the calculation instead of the bogus intel_crtc->config.
CC: Ander Conselvan de Oliveira <[email protected]>
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95476
--- drivers/gpu/drm/i915/intel_ddi.c | 123 +++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_display.c | 5 ++ drivers/gpu/drm/i915/intel_drv.h | 6 ++ 3 files changed, 91 insertions(+), 43 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +80 -43
@@ -1789,8 +1789,7 @@ static void broxton_phy_wait_grc_done(struct drm_i915_private *dev_priv,void bxt_ddi_phy_init (struct drm_i915_private *dev_priv,enum dpio_phy phy) { -enum port port; -u32 ports, val; +u32 val;if (bxt_ddi_phy_is_enabled (dev_priv, phy)) {/* Still read out the GRC value for state verification */
@@ -1825,28 +1824,6 @@ void bxt_ddi_phy_init(struct drm_i915_private *dev_priv, enum dpio_phy phy)DRM_ERROR ("timeout during PHY%d power on\n" , phy); } -if (phy ==DPIO_PHY0 ) - ports =BIT (PORT_B ) |BIT (PORT_C ); -else - ports =BIT (PORT_A ); - -for_each_port_masked (port, ports) { -int lane; - -for (lane =0 ; lane <4 ; lane++) { - val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); -/* -* Note that on CHV this flag is called UPAR, but has -* the same function. -*/ - val &= ~LATENCY_OPTIM ; -if (lane !=1 ) - val |=LATENCY_OPTIM ; - -I915_WRITE (BXT_PORT_TX_DW14_LN (port, lane), val); - } - } -/* Program PLL Rcomp code offset */ val =I915_READ (BXT_PORT_CL1CM_DW9 (phy)); val &= ~IREF0RC_OFFSET_MASK ;
@@ -1956,8 +1933,6 @@ __phy_reg_verify_state(struct drm_i915_private *dev_priv, enum dpio_phy phy,bool bxt_ddi_phy_verify_state (struct drm_i915_private *dev_priv,enum dpio_phy phy) { -enum port port; -u32 ports;uint32_t mask;bool ok;
@@ -1970,21 +1945,6 @@ bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv, ok = true; -if (phy ==DPIO_PHY0 ) - ports =BIT (PORT_B ) |BIT (PORT_C ); -else - ports =BIT (PORT_A ); - -for_each_port_masked (port, ports) { -int lane; - -for (lane =0 ; lane <4 ; lane++) - ok &=_CHK (BXT_PORT_TX_DW14_LN (port, lane), -LATENCY_OPTIM , - lane !=1 ?LATENCY_OPTIM :0 , -"BXT_PORT_TX_DW14_LN(%d, %d)" , port, lane); - } -/* PLL Rcomp code offset */ ok &= _CHK(BXT_PORT_CL1CM_DW9(phy), IREF0RC_OFFSET_MASK, 0xe4 << IREF0RC_OFFSET_SHIFT,
@@ -2028,6 +1988,67 @@ bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv,#undef _CHK } +static uint8_t +bxt_ddi_phy_calc_lane_lat_optim_mask (struct intel_encoder *encoder, +struct intel_crtc_state *pipe_config) +{ +switch (pipe_config->lane_count) { +case 1 : +return 0 ; +case 2 : +return BIT (2 ) |BIT (0 ); +case 4 : +return BIT (3 ) |BIT (2 ) |BIT (0 ); +default : +MISSING_CASE (pipe_config->lane_count); + +return 0 ; + } +} + +static void bxt_ddi_pre_pll_enable (struct intel_encoder *encoder) +{ +struct intel_digital_port *dport =enc_to_dig_port (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (dport->base.base.dev); +enum port port = dport->port; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int lane; + +for (lane =0 ; lane <4 ; lane++) { +u32 val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); + +/* +* Note that on CHV this flag is called UPAR, but has +* the same function. +*/ + val &= ~LATENCY_OPTIM ; +if (intel_crtc->config->lane_lat_optim_mask &BIT (lane)) + val |=LATENCY_OPTIM ; + +I915_WRITE (BXT_PORT_TX_DW14_LN (port, lane), val); + } +} + +static uint8_t +bxt_ddi_phy_get_lane_lat_optim_mask (struct intel_encoder *encoder) +{ +struct intel_digital_port *dport =enc_to_dig_port (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (dport->base.base.dev); +enum port port = dport->port; +int lane; +uint8_t mask; + + mask =0 ; +for (lane =0 ; lane <4 ; lane++) { +u32 val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); + +if (val &LATENCY_OPTIM ) + mask |=BIT (lane); + } + +return mask; +} +void intel_ddi_prepare_link_retrain (struct intel_dp *intel_dp) {struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp);
@@ -2199,13 +2220,19 @@ void intel_ddi_get_config(struct intel_encoder *encoder, }intel_ddi_clock_get (encoder, pipe_config); + +if (IS_BROXTON (dev_priv)) + pipe_config->lane_lat_optim_mask = +bxt_ddi_phy_get_lane_lat_optim_mask (encoder); }static bool intel_ddi_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config) { +struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;int type = encoder->type;int port =intel_ddi_get_encoder_port (encoder); +int ret;WARN (type ==INTEL_OUTPUT_UNKNOWN ,"compute_config() on unknown output!\n" );
@@ -2213,9 +2240,17 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder, pipe_config->cpu_transcoder =TRANSCODER_EDP ;if (type ==INTEL_OUTPUT_HDMI ) -return intel_hdmi_compute_config (encoder, pipe_config); + ret =intel_hdmi_compute_config (encoder, pipe_config);else -return intel_dp_compute_config (encoder, pipe_config); + ret =intel_dp_compute_config (encoder, pipe_config); + +if (IS_BROXTON (dev_priv) && ret) + pipe_config->lane_lat_optim_mask = +bxt_ddi_phy_calc_lane_lat_optim_mask (encoder, + pipe_config); + +return ret; + }static const struct drm_encoder_funcs intel_ddi_funcs = {
@@ -2314,6 +2349,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port) intel_encoder->compute_config = intel_ddi_compute_config; intel_encoder->enable = intel_enable_ddi; +if (IS_BROXTON (dev_priv)) + intel_encoder->pre_pll_enable = bxt_ddi_pre_pll_enable; intel_encoder->pre_enable = intel_ddi_pre_enable; intel_encoder->disable = intel_disable_ddi; intel_encoder->post_disable = intel_ddi_post_disable;
drivers/gpu/drm/i915/intel_display.c +5 -0
@@ -4841,6 +4841,10 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)intel_set_pch_fifo_underrun_reporting (dev_priv,TRANSCODER_A , false); +for_each_encoder_on_crtc (dev, crtc, encoder) +if (encoder->pre_pll_enable) + encoder->pre_pll_enable (encoder); +if (intel_crtc->config->shared_dpll)intel_enable_shared_dpll (intel_crtc);
@@ -12816,6 +12820,7 @@ intel_pipe_config_compare(struct drm_device *dev,PIPE_CONF_CHECK_I (has_dp_encoder);PIPE_CONF_CHECK_I (lane_count); +PIPE_CONF_CHECK_X (lane_lat_optim_mask);if (INTEL_INFO (dev)->gen <8 ) {PIPE_CONF_CHECK_M_N (dp_m_n);
drivers/gpu/drm/i915/intel_drv.h +6 -0
@@ -579,6 +579,12 @@ struct intel_crtc_state {uint8_t lane_count; +/* +* Used by platforms having DP/HDMI PHY with programmable lane +* latency optimization. +*/ +uint8_t lane_lat_optim_mask; +/* Panel fitter controls for gen2-gen4 + VLV */ struct {u32 control;
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH v2 6/6 drm/i915/bxt: Sanitiy check the PHY lane power down status
In reply to Imre DeakWe can check the power state of the PHY data and common lanes as reported by the PHY. Do this in case we need to debug problems where the PHY gets stuck in an unexpected state.
Note that I only check these when the lanes are expected to be powered on purpose, since it's not clear at what point the PHY power/clock gates things.
v2:
- Don't report the encoder as disabled when the sanity check fails. (Ville)
--- drivers/gpu/drm/i915/i915_reg.h | 9 +++++++++ drivers/gpu/drm/i915/intel_ddi.c | 25 +++++++++++++++++++++++++ 2 files changed, 34 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +9 -0
@@ -1276,6 +1276,15 @@ enum skl_disp_power_wells {#define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090)#define GT_DISPLAY_POWER_ON (phy) (1 << (phy)) +#define _BXT_PHY_CTL_DDI_A 0x64C00 +#define _BXT_PHY_CTL_DDI_B 0x64C10 +#define _BXT_PHY_CTL_DDI_C 0x64C20 +#define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10) +#define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9) +#define BXT_PHY_LANE_ENABLED (1 << 8) +#define BXT_PHY_CTL (port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \ + _BXT_PHY_CTL_DDI_B) +#define _PHY_CTL_FAMILY_EDP 0x64C80#define _PHY_CTL_FAMILY_DDI 0x64C90#define COMMON_RESET_DIS (1 << 31)
drivers/gpu/drm/i915/intel_ddi.c +25 -0
@@ -1342,6 +1342,14 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder,DRM_DEBUG_KMS ("No pipe for ddi port %c found\n" ,port_name (port)); out: +if (ret &&IS_BROXTON (dev_priv)) { + tmp =I915_READ (BXT_PHY_CTL (port)); +if ((tmp & (BXT_PHY_LANE_POWERDOWN_ACK | +BXT_PHY_LANE_ENABLED )) !=BXT_PHY_LANE_ENABLED ) +DRM_ERROR ("Port %c enabled but PHY powered down? " +"(PHY_CTL %08x)\n" ,port_name (port), tmp); + } +intel_display_power_put (dev_priv, power_domain);return ret;
@@ -1745,6 +1753,8 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)bool bxt_ddi_phy_is_enabled (struct drm_i915_private *dev_priv,enum dpio_phy phy) { +enum port port; +if (!(I915_READ (BXT_P_CR_GT_DISP_PWRON ) >_DISPLAY_POWER_ON (phy)))return false;
@@ -1770,6 +1780,21 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv,return false; } +for_each_port_masked (port, + phy ==DPIO_PHY0 ?BIT (PORT_B ) |BIT (PORT_C ) : +BIT (PORT_A )) { +u32 tmp =I915_READ (BXT_PHY_CTL (port)); + +if (tmp &BXT_PHY_CMNLANE_POWERDOWN_ACK ) { +DRM_DEBUG_DRIVER ("DDI PHY %d powered, but common lane " +"for port %c powered down " +"(PHY_CTL %08x)\n" , + phy,port_name (port), tmp); + +return false; + } + } +return true; }
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/6 drm/i915/bxt: Move DDI PHY enabling/disabling to the power well code
In reply to Imre DeakSo far we depended on the HW to dynamically power down unused PHYs and so we enabled them manually once during driver loading/resuming. There are indications however that we can achieve better power savings by manual powering toggling. So make the PHY enabling/disabling to happen on-demand whenever we need either the corresponding AUX or port functionality. CHV does this already by enabling the PHY along the corresponding PHY common lane power wells there, do the same on BXT by adding virtual power wells for the same purpose.
Also sanity check the common lane power down ack signal from the PHY. Do this only when the PHY is enabled, since it's not clear at what point the HW power/clock gates things.
While at it rename broxton_ prefix to bxt_ in related function names to better align with the SKL code.
--- drivers/gpu/drm/i915/i915_reg.h | 3 + drivers/gpu/drm/i915/intel_ddi.c | 46 +++----------- drivers/gpu/drm/i915/intel_drv.h | 9 ++- drivers/gpu/drm/i915/intel_runtime_pm.c | 106 +++++++++++++++++++++++++++++--- 4 files changed, 117 insertions(+), 47 deletions(-)
drivers/gpu/drm/i915/i915_reg.h +3 -0
@@ -713,6 +713,9 @@ enum skl_disp_power_wells {/* Not actual bit groups. Used as IDs for lookup_power_well() */ SKL_DISP_PW_ALWAYS_ON ,SKL_DISP_PW_DC_OFF , + +BXT_DPIO_CMN_A , + BXT_DPIO_CMN_BC, };#define SKL_POWER_WELL_STATE (pw) (1 << ((pw) * 2))
drivers/gpu/drm/i915/intel_ddi.c +9 -37
102 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +6 -3
@@ -1263,9 +1263,12 @@ void hsw_enable_pc8(struct drm_i915_private *dev_priv);void hsw_disable_pc8 (struct drm_i915_private *dev_priv);void broxton_init_cdclk (struct drm_i915_private *dev_priv);void broxton_uninit_cdclk (struct drm_i915_private *dev_priv); -void broxton_ddi_phy_init (struct drm_i915_private *dev_priv); -void broxton_ddi_phy_uninit (struct drm_i915_private *dev_priv); -void broxton_ddi_phy_verify_state (struct drm_i915_private *dev_priv); +void bxt_ddi_phy_init (struct drm_i915_private *dev_priv,enum dpio_phy phy); +void bxt_ddi_phy_uninit (struct drm_i915_private *dev_priv,enum dpio_phy phy); +bool bxt_ddi_phy_is_enabled (struct drm_i915_private *dev_priv, +enum dpio_phy phy); +bool bxt_ddi_phy_verify_state (struct drm_i915_private *dev_priv, +enum dpio_phy phy);void gen9_sanitize_dc_state (struct drm_i915_private *dev_priv);void bxt_enable_dc9 (struct drm_i915_private *dev_priv);void bxt_disable_dc9 (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_runtime_pm.c +99 -7
154 lines not on this page · raw message
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/6 drm/i915/bxt: Set DDI PHY lane latency optimization during modeset
In reply to Imre DeakSo far we configured a static lane latency optimization during driver loading/resuming. The specification changed at one point and now this configuration depends on the lane count, so move the configuration to modeset time accordingly.
It's not clear when this lane configuration takes effect. The specification only requires that the programming is done before enabling the port. On CHV OTOH the lanes start to power up already right after enabling the PLL. To be safe preserve the current order and set things up already before enabling the PLL.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95476
--- drivers/gpu/drm/i915/intel_ddi.c | 131 +++++++++++++++++++++++------------ drivers/gpu/drm/i915/intel_display.c | 5 ++ drivers/gpu/drm/i915/intel_drv.h | 6 ++ 3 files changed, 99 insertions(+), 43 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +88 -43
@@ -1789,8 +1789,7 @@ static void broxton_phy_wait_grc_done(struct drm_i915_private *dev_priv,void bxt_ddi_phy_init (struct drm_i915_private *dev_priv,enum dpio_phy phy) { -enum port port; -u32 ports, val; +u32 val;if (bxt_ddi_phy_is_enabled (dev_priv, phy)) {/* Still read out the GRC value for state verification */
@@ -1825,28 +1824,6 @@ void bxt_ddi_phy_init(struct drm_i915_private *dev_priv, enum dpio_phy phy)DRM_ERROR ("timeout during PHY%d power on\n" , phy); } -if (phy ==DPIO_PHY0 ) - ports =BIT (PORT_B ) |BIT (PORT_C ); -else - ports =BIT (PORT_A ); - -for_each_port_masked (port, ports) { -int lane; - -for (lane =0 ; lane <4 ; lane++) { - val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); -/* -* Note that on CHV this flag is called UPAR, but has -* the same function. -*/ - val &= ~LATENCY_OPTIM ; -if (lane !=1 ) - val |=LATENCY_OPTIM ; - -I915_WRITE (BXT_PORT_TX_DW14_LN (port, lane), val); - } - } -/* Program PLL Rcomp code offset */ val =I915_READ (BXT_PORT_CL1CM_DW9 (phy)); val &= ~IREF0RC_OFFSET_MASK ;
@@ -1956,8 +1933,6 @@ __phy_reg_verify_state(struct drm_i915_private *dev_priv, enum dpio_phy phy,bool bxt_ddi_phy_verify_state (struct drm_i915_private *dev_priv,enum dpio_phy phy) { -enum port port; -u32 ports;uint32_t mask;bool ok;
@@ -1970,21 +1945,6 @@ bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv, ok = true; -if (phy ==DPIO_PHY0 ) - ports =BIT (PORT_B ) |BIT (PORT_C ); -else - ports =BIT (PORT_A ); - -for_each_port_masked (port, ports) { -int lane; - -for (lane =0 ; lane <4 ; lane++) - ok &=_CHK (BXT_PORT_TX_DW14_LN (port, lane), -LATENCY_OPTIM , - lane !=1 ?LATENCY_OPTIM :0 , -"BXT_PORT_TX_DW14_LN(%d, %d)" , port, lane); - } -/* PLL Rcomp code offset */ ok &= _CHK(BXT_PORT_CL1CM_DW9(phy), IREF0RC_OFFSET_MASK, 0xe4 << IREF0RC_OFFSET_SHIFT,
@@ -2028,6 +1988,75 @@ bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv,#undef _CHK } +static uint8_t +bxt_ddi_phy_calc_lane_lat_optim_mask (struct intel_encoder *encoder, +struct intel_crtc_state *pipe_config) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int optim_lane_count; + +switch (pipe_config->lane_count) { +case 1 : + optim_lane_count =0 ; +break ; +case 2 : + optim_lane_count =3 ; +break ; +case 4 : + optim_lane_count =4 ; +break ; +default : +MISSING_CASE (intel_crtc->config->lane_count); + +return 0 ; + } + +return (BIT (optim_lane_count) -1 ) & ~BIT (1 ); +} + +static void bxt_ddi_pre_pll_enable (struct intel_encoder *encoder) +{ +struct intel_digital_port *dport =enc_to_dig_port (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (dport->base.base.dev); +enum port port = dport->port; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int lane; + +for (lane =0 ; lane <4 ; lane++) { +u32 val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); + +/* +* Note that on CHV this flag is called UPAR, but has +* the same function. +*/ + val &= ~LATENCY_OPTIM ; +if (intel_crtc->config->lane_lat_optim_mask &BIT (lane)) + val |=LATENCY_OPTIM ; + +I915_WRITE (BXT_PORT_TX_DW14_LN (port, lane), val); + } +} + +static uint8_t +bxt_ddi_phy_get_lane_lat_optim_mask (struct intel_encoder *encoder) +{ +struct intel_digital_port *dport =enc_to_dig_port (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (dport->base.base.dev); +enum port port = dport->port; +int lane; +uint8_t mask; + + mask =0 ; +for (lane =0 ; lane <4 ; lane++) { +u32 val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); + +if (val &LATENCY_OPTIM ) + mask |=BIT (lane); + } + +return mask; +} +void intel_ddi_prepare_link_retrain (struct intel_dp *intel_dp) {struct intel_digital_port *intel_dig_port =dp_to_dig_port (intel_dp);
@@ -2199,13 +2228,19 @@ void intel_ddi_get_config(struct intel_encoder *encoder, }intel_ddi_clock_get (encoder, pipe_config); + +if (IS_BROXTON (dev_priv)) + pipe_config->lane_lat_optim_mask = +bxt_ddi_phy_get_lane_lat_optim_mask (encoder); }static bool intel_ddi_compute_config (struct intel_encoder *encoder,struct intel_crtc_state *pipe_config) { +struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;int type = encoder->type;int port =intel_ddi_get_encoder_port (encoder); +int ret;WARN (type ==INTEL_OUTPUT_UNKNOWN ,"compute_config() on unknown output!\n" );
@@ -2213,9 +2248,17 @@ static bool intel_ddi_compute_config(struct intel_encoder *encoder, pipe_config->cpu_transcoder =TRANSCODER_EDP ;if (type ==INTEL_OUTPUT_HDMI ) -return intel_hdmi_compute_config (encoder, pipe_config); + ret =intel_hdmi_compute_config (encoder, pipe_config);else -return intel_dp_compute_config (encoder, pipe_config); + ret =intel_dp_compute_config (encoder, pipe_config); + +if (IS_BROXTON (dev_priv) && ret) + pipe_config->lane_lat_optim_mask = +bxt_ddi_phy_calc_lane_lat_optim_mask (encoder, + pipe_config); + +return ret; + }static const struct drm_encoder_funcs intel_ddi_funcs = {
@@ -2314,6 +2357,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port) intel_encoder->compute_config = intel_ddi_compute_config; intel_encoder->enable = intel_enable_ddi; +if (IS_BROXTON (dev_priv)) + intel_encoder->pre_pll_enable = bxt_ddi_pre_pll_enable; intel_encoder->pre_enable = intel_ddi_pre_enable; intel_encoder->disable = intel_disable_ddi; intel_encoder->post_disable = intel_ddi_post_disable;
drivers/gpu/drm/i915/intel_display.c +5 -0
@@ -4841,6 +4841,10 @@ static void haswell_crtc_enable(struct drm_crtc *crtc)intel_set_pch_fifo_underrun_reporting (dev_priv,TRANSCODER_A , false); +for_each_encoder_on_crtc (dev, crtc, encoder) +if (encoder->pre_pll_enable) + encoder->pre_pll_enable (encoder); +if (intel_crtc->config->shared_dpll)intel_enable_shared_dpll (intel_crtc);
@@ -12816,6 +12820,7 @@ intel_pipe_config_compare(struct drm_device *dev,PIPE_CONF_CHECK_I (has_dp_encoder);PIPE_CONF_CHECK_I (lane_count); +PIPE_CONF_CHECK_X (lane_lat_optim_mask);if (INTEL_INFO (dev)->gen <8 ) {PIPE_CONF_CHECK_M_N (dp_m_n);
drivers/gpu/drm/i915/intel_drv.h +6 -0
@@ -579,6 +579,12 @@ struct intel_crtc_state {uint8_t lane_count; +/* +* Used by platforms having DP/HDMI PHY with programmable lane +* latency optimization. +*/ +uint8_t lane_lat_optim_mask; +/* Panel fitter controls for gen2-gen4 + VLV */ struct {u32 control;
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/6] drm/i915/bxt: Set DDI PHY lane latency optimization during modeset
Quoted 114 lines · Imre Deak
So far we configured a static lane latency optimization during driver loading/resuming. The specification changed at one point and now this configuration depends on the lane count, so move the configuration to modeset time accordingly.
It's not clear when this lane configuration takes effect. The specification only requires that the programming is done before enabling the port. On CHV OTOH the lanes start to power up already right after enabling the PLL. To be safe preserve the current order and set things up already before enabling the PLL.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95476
Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/i915/intel_ddi.c | 131 +++++++++++++++++++++++----------- -
drivers/gpu/drm/i915/intel_display.c | 5 ++ drivers/gpu/drm/i915/intel_drv.h | 6 ++3 files changed, 99 insertions(+), 43 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1789,8 +1789,7 @@ static void broxton_phy_wait_grc_done(struct drm_i915_private *dev_priv,
voidbxt_ddi_phy_init(struct drm_i915_private *dev_priv, enum dpio_phy phy){drivers/gpu/drm/i915/intel_ddi.c +1
-2-enum port port; -u32 ports, val; +u32 val;
if (bxt_ddi_phy_is_enabled(dev_priv, phy)) {
/* Still read out the GRC value for state verification */drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1825,28 +1824,6 @@ void bxt_ddi_phy_init(struct drm_i915_private *dev_priv, enum dpio_phy phy) DRM_ERROR("timeout during PHY%d power on\n", phy); }drivers/gpu/drm/i915/intel_ddi.c +0
-22-if (phy ==DPIO_PHY0 ) - ports =BIT (PORT_B ) |BIT (PORT_C ); -else - ports =BIT (PORT_A ); - -for_each_port_masked (port, ports) { -int lane; - -for (lane =0 ; lane <4 ; lane++) { - val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); -/* -* Note that on CHV this flag is called UPAR, but has -* the same function. -*/ - val &= ~LATENCY_OPTIM ; -if (lane !=1 ) - val |=LATENCY_OPTIM ; - -I915_WRITE (BXT_PORT_TX_DW14_LN (port, lane), val); - } - } -/* Program PLL Rcomp code offset */
val = I915_READ(BXT_PORT_CL1CM_DW9(phy));
val &= ~IREF0RC_OFFSET_MASK;drivers/gpu/drm/i915/intel_ddi.c +0
-2@@ -1956,8 +1933,6 @@ __phy_reg_verify_state(struct drm_i915_private *dev_priv, enum dpio_phy phy, bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv, enum dpio_phy phy) { -enum port port; -u32 ports; uint32_t mask; bool ok;drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1970,21 +1945,6 @@ bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv,
ok = true;drivers/gpu/drm/i915/intel_ddi.c +0
-13-if (phy ==DPIO_PHY0 ) - ports =BIT (PORT_B ) |BIT (PORT_C ); -else - ports =BIT (PORT_A ); - -for_each_port_masked (port, ports) { -int lane; - -for (lane =0 ; lane <4 ; lane++) - ok &= _CHK(BXT_PORT_TX_DW14_LN(port, lane), - LATENCY_OPTIM, - lane != 1 ? LATENCY_OPTIM : 0, - "BXT_PORT_TX_DW14_LN(%d, %d)", port,lane);
drivers/gpu/drm/i915/intel_ddi.c +0
-2- } -/* PLL Rcomp code offset */
ok &= _CHK(BXT_PORT_CL1CM_DW9(phy),IREF0RC_OFFSET_MASK,0xe4<<IREF0RC_OFFSET_SHIFT,drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2028,6 +1988,75 @@ bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv, #undef _CHK }drivers/gpu/drm/i915/intel_ddi.c +9
-0+static uint8_t +bxt_ddi_phy_calc_lane_lat_optim_mask (struct intel_encoder *encoder, + struct intel_crtc_state *pipe_config) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int optim_lane_count; + +switch (pipe_config->lane_count) { +case 1 :
drivers/gpu/drm/i915/intel_ddi.c bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv, · line 2009
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +10
-0+ optim_lane_count =0 ; +break ; +case 2 : + optim_lane_count =3 ; +break ; +case 4 : + optim_lane_count =4 ; +break ; +default : +MISSING_CASE (intel_crtc->config->lane_count);
Since this is called from compute config, pipe_config and intel_crtc->config will be different. But anyway, I think this belongs in the dpll code. See below.
drivers/gpu/drm/i915/intel_ddi.c bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv, · line 2014
Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-0+ +return 0 ; + } + +return (BIT (optim_lane_count) -1 ) & ~BIT (1 );
Wouldn't it be easier to just return the right mask from the switch? There's already a case for each possible lane count.
Quoted 114 lines
drivers/gpu/drm/i915/intel_ddi.c +45
-0+} + +static void bxt_ddi_pre_pll_enable (struct intel_encoder *encoder) +{ +struct intel_digital_port *dport =enc_to_dig_port (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (dport->base.base.dev); +enum port port = dport->port; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int lane; + +for (lane =0 ; lane <4 ; lane++) { +u32 val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); + +/* +* Note that on CHV this flag is called UPAR, but has +* the same function. +*/ + val &= ~LATENCY_OPTIM ; +if (intel_crtc->config->lane_lat_optim_mask &BIT (lane)) + val |=LATENCY_OPTIM ; + +I915_WRITE (BXT_PORT_TX_DW14_LN (port, lane), val); + } +} + +static uint8_t +bxt_ddi_phy_get_lane_lat_optim_mask (struct intel_encoder *encoder) +{ +struct intel_digital_port *dport =enc_to_dig_port (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (dport->base.base.dev); +enum port port = dport->port; +int lane; +uint8_t mask; + + mask =0 ; +for (lane =0 ; lane <4 ; lane++) { +u32 val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); + +if (val &LATENCY_OPTIM ) + mask |=BIT (lane); + } + +return mask; +} +void
intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp)
{
structintel_digital_port*intel_dig_port=dp_to_dig_port(intel_dp);drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2199,13 +2228,19 @@ void intel_ddi_get_config(struct intel_encoder *encoder, }
intel_ddi_clock_get(encoder, pipe_config);drivers/gpu/drm/i915/intel_ddi.c +4
-0+ +if (IS_BROXTON (dev_priv)) + pipe_config->lane_lat_optim_mask = +bxt_ddi_phy_get_lane_lat_optim_mask (encoder);}
static boolintel_ddi_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config){drivers/gpu/drm/i915/intel_ddi.c +1
-0+struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;int type =
encoder->type;
int port =intel_ddi_get_encoder_port(encoder);drivers/gpu/drm/i915/intel_ddi.c +1
-0+int ret;
WARN(type == INTEL_OUTPUT_UNKNOWN, "compute_config() on unknown output!\n");drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2213,9 +2248,17 @@ static bool intel_ddi_compute_config(structintel_encoder *encoder, pipe_config->cpu_transcoder = TRANSCODER_EDP;
if (type ==INTEL_OUTPUT_HDMI)drivers/gpu/drm/i915/intel_ddi.c +1
-1-return intel_hdmi_compute_config (encoder, pipe_config); + ret =intel_hdmi_compute_config (encoder, pipe_config);else
drivers/gpu/drm/i915/intel_ddi.c +9
-1-return intel_dp_compute_config (encoder, pipe_config); + ret =intel_dp_compute_config (encoder, pipe_config); + +if (IS_BROXTON (dev_priv) && ret) + pipe_config->lane_lat_optim_mask = +bxt_ddi_phy_calc_lane_lat_optim_mask (encoder, + pipe_config); + +return ret; +}
static const structdrm_encoder_funcsintel_ddi_funcs= {drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2314,6 +2357,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
intel_encoder->compute_config=intel_ddi_compute_config;intel_encoder->enable=intel_enable_ddi;drivers/gpu/drm/i915/intel_ddi.c +2
-0+if (IS_BROXTON (dev_priv)) + intel_encoder->pre_pll_enable = bxt_ddi_pre_pll_enable;
intel_encoder->pre_enable=intel_ddi_pre_enable;intel_encoder->disable=intel_disable_ddi;intel_encoder->post_disable=intel_ddi_post_disable;drivers/gpu/drm/i915/intel_display.c +0
-0@@ -4841,6 +4841,10 @@ static void haswell_crtc_enable(struct drm_crtc *crtc) intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A, false);drivers/gpu/drm/i915/intel_display.c +4
-0+for_each_encoder_on_crtc (dev, crtc, encoder) +if (encoder->pre_pll_enable) + encoder->pre_pll_enable (encoder); +
Quoted 2 lines
if (
intel_crtc->config->shared_dpll)intel_enable_shared_dpll(intel_crtc);
Effectively this writes BXT_PORT_TX_DW14_LN before bxt_ddi_pll_enable() is called. If that would be the first register write in that function, it would avoid the extra detour. So we can calculate the optimization in bxt_get_dpll(), store it in struct intel_dpll_hw_state and use the pll state checking to verify the right values were programmed. That way there's no need to add a value specific to the bxt phy to struct intel_crtc_state or implement the pre_pll_enable hook.
Ander
Quoted 24 lines
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12816,6 +12820,7 @@ intel_pipe_config_compare(struct drm_device *dev,
PIPE_CONF_CHECK_I(has_dp_encoder);
PIPE_CONF_CHECK_I(lane_count);drivers/gpu/drm/i915/intel_display.c +1
-0+PIPE_CONF_CHECK_X (lane_lat_optim_mask);
if (INTEL_INFO(dev)->gen < 8) {
PIPE_CONF_CHECK_M_N(dp_m_n);drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -579,6 +579,12 @@ struct intel_crtc_state {
uint8_tlane_count;drivers/gpu/drm/i915/intel_drv.h +6
-0+/* +* Used by platforms having DP/HDMI PHY with programmable lane +* latency optimization. +*/ +uint8_t lane_lat_optim_mask; +
Quoted 3 lines
/* Panel fitter controls for gen2-gen4 + VLV */ struct {
u32 control;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 4/6] drm/i915/bxt: Set DDI PHY lane latency optimization during modeset
Quoted 120 lines · Ander Conselvan De Oliveira
Quoted 119 lines · Imre Deak
So far we configured a static lane latency optimization during driver loading/resuming. The specification changed at one point and now this configuration depends on the lane count, so move the configuration to modeset time accordingly.
It's not clear when this lane configuration takes effect. The specification only requires that the programming is done before enabling the port. On CHV OTOH the lanes start to power up already right after enabling the PLL. To be safe preserve the current order and set things up already before enabling the PLL.
Bugzilla: https://bugs.freedesktop.org/show_bug.cgi?id=95476
Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/i915/intel_ddi.c | 131 +++++++++++++++++++++++----------- -
drivers/gpu/drm/i915/intel_display.c | 5 ++ drivers/gpu/drm/i915/intel_drv.h | 6 ++3 files changed, 99 insertions(+), 43 deletions(-)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1789,8 +1789,7 @@ static void broxton_phy_wait_grc_done(struct drm_i915_private *dev_priv,
voidbxt_ddi_phy_init(struct drm_i915_private *dev_priv, enum dpio_phy phy){drivers/gpu/drm/i915/intel_ddi.c +1
-2-enum port port; -u32 ports, val; +u32 val;
if (bxt_ddi_phy_is_enabled(dev_priv, phy)) {
/* Still read out the GRC value for state verification */drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1825,28 +1824,6 @@ void bxt_ddi_phy_init(struct drm_i915_private *dev_priv, enum dpio_phy phy) DRM_ERROR("timeout during PHY%d power on\n", phy); }drivers/gpu/drm/i915/intel_ddi.c +0
-22-if (phy ==DPIO_PHY0 ) - ports =BIT (PORT_B ) |BIT (PORT_C ); -else - ports =BIT (PORT_A ); - -for_each_port_masked (port, ports) { -int lane; - -for (lane =0 ; lane <4 ; lane++) { - val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); -/* -* Note that on CHV this flag is called UPAR, but has -* the same function. -*/ - val &= ~LATENCY_OPTIM ; -if (lane !=1 ) - val |=LATENCY_OPTIM ; - -I915_WRITE (BXT_PORT_TX_DW14_LN (port, lane), val); - } - } -/* Program PLL Rcomp code offset */
val = I915_READ(BXT_PORT_CL1CM_DW9(phy));
val &= ~IREF0RC_OFFSET_MASK;drivers/gpu/drm/i915/intel_ddi.c +0
-2@@ -1956,8 +1933,6 @@ __phy_reg_verify_state(struct drm_i915_private *dev_priv, enum dpio_phy phy, bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv, enum dpio_phy phy) { -enum port port; -u32 ports; uint32_t mask; bool ok;drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1970,21 +1945,6 @@ bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv,
ok = true;drivers/gpu/drm/i915/intel_ddi.c +0
-13-if (phy ==DPIO_PHY0 ) - ports =BIT (PORT_B ) |BIT (PORT_C ); -else - ports =BIT (PORT_A ); - -for_each_port_masked (port, ports) { -int lane; - -for (lane =0 ; lane <4 ; lane++) - ok &= _CHK(BXT_PORT_TX_DW14_LN(port, lane), - LATENCY_OPTIM, - lane != 1 ? LATENCY_OPTIM : 0, - "BXT_PORT_TX_DW14_LN(%d, %d)", port,lane);
drivers/gpu/drm/i915/intel_ddi.c +0
-2- } -/* PLL Rcomp code offset */
ok &= _CHK(BXT_PORT_CL1CM_DW9(phy),IREF0RC_OFFSET_MASK,0xe4<<IREF0RC_OFFSET_SHIFT,drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2028,6 +1988,75 @@ bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv, #undef _CHK }drivers/gpu/drm/i915/intel_ddi.c +14
-0+static uint8_t +bxt_ddi_phy_calc_lane_lat_optim_mask (struct intel_encoder *encoder, + struct intel_crtc_state *pipe_config) +{ +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int optim_lane_count; + +switch (pipe_config->lane_count) { +case 1 : + optim_lane_count =0 ; +break ; +case 2 : + optim_lane_count =3 ; +break ;
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv, · line 2009
Quoted 5 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-0+case 4 : + optim_lane_count =4 ; +break ; +default : +MISSING_CASE (intel_crtc->config->lane_count);Since this is called from compute config,
pipe_configandintel_crtc->configwill be different. But anyway, I think this belongs in the dpll code. See below.
Yep, this is a typo left-over before I realized that the two things are different:) Thanks for catching it.
Quoted 9 lines
drivers/gpu/drm/i915/intel_ddi.c bool bxt_ddi_phy_verify_state(struct drm_i915_private *dev_priv, · line 2014
Quoted 6 lines
drivers/gpu/drm/i915/intel_ddi.c +5
-0+ +return 0 ; + } + +return (BIT (optim_lane_count) -1 ) & ~BIT (1 );Wouldn't it be easier to just return the right mask from the switch? There's already a case for each possible lane count.
Ok, will simplify it.
Quoted 117 lines
Quoted 114 lines
drivers/gpu/drm/i915/intel_ddi.c +45
-0+} + +static void bxt_ddi_pre_pll_enable (struct intel_encoder *encoder) +{ +struct intel_digital_port *dport =enc_to_dig_port (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (dport->base.base.dev); +enum port port = dport->port; +struct intel_crtc *intel_crtc =to_intel_crtc (encoder->base.crtc); +int lane; + +for (lane =0 ; lane <4 ; lane++) { +u32 val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); + +/* +* Note that on CHV this flag is called UPAR, but has +* the same function. +*/ + val &= ~LATENCY_OPTIM ; +if (intel_crtc->config->lane_lat_optim_mask &BIT (lane)) + val |=LATENCY_OPTIM ; + +I915_WRITE (BXT_PORT_TX_DW14_LN (port, lane), val); + } +} + +static uint8_t +bxt_ddi_phy_get_lane_lat_optim_mask (struct intel_encoder *encoder) +{ +struct intel_digital_port *dport =enc_to_dig_port (&encoder->base); +struct drm_i915_private *dev_priv =to_i915 (dport->base.base.dev); +enum port port = dport->port; +int lane; +uint8_t mask; + + mask =0 ; +for (lane =0 ; lane <4 ; lane++) { +u32 val =I915_READ (BXT_PORT_TX_DW14_LN (port, lane)); + +if (val &LATENCY_OPTIM ) + mask |=BIT (lane); + } + +return mask; +} +void
intel_ddi_prepare_link_retrain(struct intel_dp *intel_dp)
{
structintel_digital_port*intel_dig_port=dp_to_dig_port(intel_dp);drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2199,13 +2228,19 @@ void intel_ddi_get_config(struct intel_encoder *encoder, }
intel_ddi_clock_get(encoder, pipe_config);drivers/gpu/drm/i915/intel_ddi.c +4
-0+ +if (IS_BROXTON (dev_priv)) + pipe_config->lane_lat_optim_mask = +bxt_ddi_phy_get_lane_lat_optim_mask (encoder);}
static boolintel_ddi_compute_config(struct intel_encoder *encoder, struct intel_crtc_state *pipe_config){drivers/gpu/drm/i915/intel_ddi.c +1
-0+struct drm_i915_private *dev_priv = encoder->base.dev->dev_private;int type =
encoder->type;
int port =intel_ddi_get_encoder_port(encoder);drivers/gpu/drm/i915/intel_ddi.c +1
-0+int ret;
WARN(type == INTEL_OUTPUT_UNKNOWN, "compute_config() on unknown output!\n");drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2213,9 +2248,17 @@ static bool intel_ddi_compute_config(structintel_encoder *encoder, pipe_config->cpu_transcoder = TRANSCODER_EDP;
if (type ==INTEL_OUTPUT_HDMI)drivers/gpu/drm/i915/intel_ddi.c +1
-1-return intel_hdmi_compute_config (encoder, pipe_config); + ret =intel_hdmi_compute_config (encoder, pipe_config);else
drivers/gpu/drm/i915/intel_ddi.c +9
-1-return intel_dp_compute_config (encoder, pipe_config); + ret =intel_dp_compute_config (encoder, pipe_config); + +if (IS_BROXTON (dev_priv) && ret) + pipe_config->lane_lat_optim_mask = +bxt_ddi_phy_calc_lane_lat_optim_mask (encoder, + pipe_config); + +return ret; +}
static const structdrm_encoder_funcsintel_ddi_funcs= {drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -2314,6 +2357,8 @@ void intel_ddi_init(struct drm_device *dev, enum port port)
intel_encoder->compute_config=intel_ddi_compute_config;intel_encoder->enable=intel_enable_ddi;drivers/gpu/drm/i915/intel_ddi.c +2
-0+if (IS_BROXTON (dev_priv)) + intel_encoder->pre_pll_enable = bxt_ddi_pre_pll_enable;
intel_encoder->pre_enable=intel_ddi_pre_enable;intel_encoder->disable=intel_disable_ddi;intel_encoder->post_disable=intel_ddi_post_disable;drivers/gpu/drm/i915/intel_display.c +0
-0@@ -4841,6 +4841,10 @@ static void haswell_crtc_enable(struct drm_crtc *crtc) intel_set_pch_fifo_underrun_reporting(dev_priv, TRANSCODER_A, false);drivers/gpu/drm/i915/intel_display.c +4
-0+for_each_encoder_on_crtc (dev, crtc, encoder) +if (encoder->pre_pll_enable) + encoder->pre_pll_enable (encoder); +Quoted 2 lines
if (
intel_crtc->config->shared_dpll)intel_enable_shared_dpll(intel_crtc);
Quoted 7 lines
Effectively this writes BXT_PORT_TX_DW14_LN before
bxt_ddi_pll_enable()is called. If that would be the first register write in that function, it would avoid the extra detour. So we can calculate the optimization inbxt_get_dpll(), store it in structintel_dpll_hw_stateand use the pll state checking to verify the right values were programmed. That way there's no need to add a value specific to the bxt phy to structintel_crtc_stateor implement thepre_pll_enablehook.
It's not a PLL specific thing though, rather a property of the PHY channel. For instance we could share one PLL for two channels in which case we'd need to enable only one PLL but configure the lanes for both channels.
--Imre
Quoted 22 lines
Ander
Quoted 19 lines
drivers/gpu/drm/i915/intel_display.c +0
-0@@ -12816,6 +12820,7 @@ intel_pipe_config_compare(struct drm_device *dev,
PIPE_CONF_CHECK_I(has_dp_encoder);
PIPE_CONF_CHECK_I(lane_count);drivers/gpu/drm/i915/intel_display.c +1
-0+PIPE_CONF_CHECK_X (lane_lat_optim_mask);
if (INTEL_INFO(dev)->gen < 8) {
PIPE_CONF_CHECK_M_N(dp_m_n);drivers/gpu/drm/i915/intel_drv.h +0
-0@@ -579,6 +579,12 @@ struct intel_crtc_state {
uint8_tlane_count;drivers/gpu/drm/i915/intel_drv.h +1
-0+/*
Quoted 8 lines
Quoted 8 lines
drivers/gpu/drm/i915/intel_drv.h +5
-0+* Used by platforms having DP/HDMI PHY with programmable lane +* latency optimization. +*/ +uint8_t lane_lat_optim_mask; +/* Panel fitter controls for gen2-gen4 + VLV */ struct {
u32 control;
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/6 drm/i915/bxt: Rename broxton to bxt in PHY/CDCLK function prefixes
In reply to Imre DeakRename these remaining function prefixes to better align with the corresponding SKL functions.
No functional change.
--- drivers/gpu/drm/i915/intel_ddi.c | 13 ++++++------- drivers/gpu/drm/i915/intel_display.c | 28 ++++++++++++++-------------- drivers/gpu/drm/i915/intel_drv.h | 4 ++-- drivers/gpu/drm/i915/intel_runtime_pm.c | 4 ++-- 4 files changed, 24 insertions(+), 25 deletions(-)
drivers/gpu/drm/i915/intel_ddi.c +6 -7
@@ -1773,15 +1773,15 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv,return true; } -static u32 broxton_get_grc (struct drm_i915_private *dev_priv,enum dpio_phy phy) +static u32 bxt_get_grc (struct drm_i915_private *dev_priv,enum dpio_phy phy) {u32 val =I915_READ (BXT_PORT_REF_DW6 (phy));return (val &GRC_CODE_MASK ) >>GRC_CODE_SHIFT ; } -static void broxton_phy_wait_grc_done (struct drm_i915_private *dev_priv, -enum dpio_phy phy) +static void bxt_phy_wait_grc_done (struct drm_i915_private *dev_priv, +enum dpio_phy phy) {if (wait_for (I915_READ (BXT_PORT_REF_DW3 (phy)) &GRC_DONE ,10 ))DRM_ERROR ("timeout waiting for PHY%d GRC\n" , phy);
@@ -1794,7 +1794,7 @@ void bxt_ddi_phy_init(struct drm_i915_private *dev_priv, enum dpio_phy phy)if (bxt_ddi_phy_is_enabled (dev_priv, phy)) {/* Still read out the GRC value for state verification */ if (phy ==DPIO_PHY0 ) - dev_priv->bxt_phy_grc =broxton_get_grc (dev_priv, phy); + dev_priv->bxt_phy_grc =bxt_get_grc (dev_priv, phy);if (bxt_ddi_phy_verify_state (dev_priv, phy)) { DRM_DEBUG_DRIVER("DDI PHY %d already enabled, "
@@ -1870,8 +1870,7 @@ void bxt_ddi_phy_init(struct drm_i915_private *dev_priv, enum dpio_phy phy)* the corresponding calibrated value from PHY1, and disable * the automatic calibration on PHY0. */ - val = dev_priv->bxt_phy_grc =broxton_get_grc (dev_priv, -DPIO_PHY1 ); + val = dev_priv->bxt_phy_grc =bxt_get_grc (dev_priv,DPIO_PHY1 ); grc_code = val <<GRC_CODE_FAST_SHIFT | val <<GRC_CODE_SLOW_SHIFT | val;
@@ -1887,7 +1886,7 @@ void bxt_ddi_phy_init(struct drm_i915_private *dev_priv, enum dpio_phy phy)I915_WRITE (BXT_PHY_CTL_FAMILY (phy), val);if (phy ==DPIO_PHY1 ) -broxton_phy_wait_grc_done (dev_priv,DPIO_PHY1 ); +bxt_phy_wait_grc_done (dev_priv,DPIO_PHY1 ); }void bxt_ddi_phy_uninit (struct drm_i915_private *dev_priv,enum dpio_phy phy)
drivers/gpu/drm/i915/intel_display.c +14 -14
@@ -123,7 +123,7 @@ static void ironlake_pfit_enable(struct intel_crtc *crtc);static void intel_modeset_setup_hw_state (struct drm_device *dev);static void intel_pre_disable_primary_noatomic (struct drm_crtc *crtc);static int ilk_max_pixel_rate (struct drm_atomic_state *state); -static int broxton_calc_cdclk (int max_pixclk); +static int bxt_calc_cdclk (int max_pixclk); struct intel_limit { struct {
@@ -5420,7 +5420,7 @@ static void bxt_de_pll_enable(struct drm_i915_private *dev_priv, int vco) dev_priv->cdclk_pll.vco = vco; } -static void broxton_set_cdclk (struct drm_i915_private *dev_priv,int cdclk) +static void bxt_set_cdclk (struct drm_i915_private *dev_priv,int cdclk) {u32 val, divider;int vco, ret;
@@ -5545,7 +5545,7 @@ sanitize: dev_priv->cdclk_pll.vco =-1 ; } -void broxton_init_cdclk (struct drm_i915_private *dev_priv) +void bxt_init_cdclk (struct drm_i915_private *dev_priv) {bxt_sanitize_cdclk (dev_priv);
@@ -5557,12 +5557,12 @@ void broxton_init_cdclk(struct drm_i915_private *dev_priv)* - The initial CDCLK needs to be read from VBT. * Need to make this change after VBT has changes for BXT. */ -broxton_set_cdclk (dev_priv,broxton_calc_cdclk (0 )); +bxt_set_cdclk (dev_priv,bxt_calc_cdclk (0 )); } -void broxton_uninit_cdclk (struct drm_i915_private *dev_priv) +void bxt_uninit_cdclk (struct drm_i915_private *dev_priv) { -broxton_set_cdclk (dev_priv, dev_priv->cdclk_pll.ref); +bxt_set_cdclk (dev_priv, dev_priv->cdclk_pll.ref); }static int skl_calc_cdclk (int max_pixclk,int vco)
@@ -5988,7 +5988,7 @@ static int valleyview_calc_cdclk(struct drm_i915_private *dev_priv,return 200000 ; } -static int broxton_calc_cdclk (int max_pixclk) +static int bxt_calc_cdclk (int max_pixclk) {if (max_pixclk >576000 )return 624000 ;
@@ -6048,17 +6048,17 @@ static int valleyview_modeset_calc_cdclk(struct drm_atomic_state *state)return 0 ; } -static int broxton_modeset_calc_cdclk (struct drm_atomic_state *state) +static int bxt_modeset_calc_cdclk (struct drm_atomic_state *state) {int max_pixclk =ilk_max_pixel_rate (state);struct intel_atomic_state *intel_state =to_intel_atomic_state (state); intel_state->cdclk = intel_state->dev_cdclk = -broxton_calc_cdclk (max_pixclk); +bxt_calc_cdclk (max_pixclk);if (!intel_state->active_crtcs) - intel_state->dev_cdclk =broxton_calc_cdclk (0 ); + intel_state->dev_cdclk =bxt_calc_cdclk (0 );return 0 ; }
@@ -9677,14 +9677,14 @@ void hsw_disable_pc8(struct drm_i915_private *dev_priv) } } -static void broxton_modeset_commit_cdclk (struct drm_atomic_state *old_state) +static void bxt_modeset_commit_cdclk (struct drm_atomic_state *old_state) {struct drm_device *dev = old_state->dev;struct intel_atomic_state *old_intel_state =to_intel_atomic_state (old_state);unsigned int req_cdclk = old_intel_state->dev_cdclk; -broxton_set_cdclk (to_i915 (dev), req_cdclk); +bxt_set_cdclk (to_i915 (dev), req_cdclk); }/* compute the max rate for new configuration */
@@ -15217,9 +15217,9 @@ void intel_init_display_hooks(struct drm_i915_private *dev_priv) valleyview_modeset_calc_cdclk; }else if (IS_BROXTON (dev_priv)) { dev_priv->display.modeset_commit_cdclk = - broxton_modeset_commit_cdclk; + bxt_modeset_commit_cdclk; dev_priv->display.modeset_calc_cdclk = - broxton_modeset_calc_cdclk; + bxt_modeset_calc_cdclk; }else if (IS_SKYLAKE (dev_priv) ||IS_KABYLAKE (dev_priv)) { dev_priv->display.modeset_commit_cdclk = skl_modeset_commit_cdclk;
drivers/gpu/drm/i915/intel_drv.h +2 -2
@@ -1267,8 +1267,8 @@ void intel_prepare_reset(struct drm_i915_private *dev_priv);void intel_finish_reset (struct drm_i915_private *dev_priv);void hsw_enable_pc8 (struct drm_i915_private *dev_priv);void hsw_disable_pc8 (struct drm_i915_private *dev_priv); -void broxton_init_cdclk (struct drm_i915_private *dev_priv); -void broxton_uninit_cdclk (struct drm_i915_private *dev_priv); +void bxt_init_cdclk (struct drm_i915_private *dev_priv); +void bxt_uninit_cdclk (struct drm_i915_private *dev_priv);void bxt_ddi_phy_init (struct drm_i915_private *dev_priv,enum dpio_phy phy);void bxt_ddi_phy_uninit (struct drm_i915_private *dev_priv,enum dpio_phy phy); bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv,
drivers/gpu/drm/i915/intel_runtime_pm.c +2 -2
@@ -2403,7 +2403,7 @@ void bxt_display_core_init(struct drm_i915_private *dev_priv,mutex_unlock (&power_domains->lock); -broxton_init_cdclk (dev_priv); +bxt_init_cdclk (dev_priv);gen9_dbuf_enable (dev_priv);
@@ -2420,7 +2420,7 @@ void bxt_display_core_uninit(struct drm_i915_private *dev_priv)gen9_dbuf_disable (dev_priv); -broxton_uninit_cdclk (dev_priv); +bxt_uninit_cdclk (dev_priv);/* The spec doesn't call for removing the reset handshake flag */
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 6/6 drm/i915/bxt: Sanitiy check the PHY lane power down status
In reply to Imre DeakWe can check the power state of the PHY data and common lanes as reported by the PHY. Do this in case we need to debug problems where the PHY gets stuck in an unexpected state.
Note that I only check these when the lanes are expected to be powered on purpose, since it's not clear at what point the PHY power/clock gates things.
--- drivers/gpu/drm/i915/i915_reg.h | 9 +++++++++ drivers/gpu/drm/i915/intel_ddi.c | 27 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)
drivers/gpu/drm/i915/i915_reg.h +9 -0
@@ -1276,6 +1276,15 @@ enum skl_disp_power_wells {#define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090)#define GT_DISPLAY_POWER_ON (phy) (1 << (phy)) +#define _BXT_PHY_CTL_DDI_A 0x64C00 +#define _BXT_PHY_CTL_DDI_B 0x64C10 +#define _BXT_PHY_CTL_DDI_C 0x64C20 +#define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10) +#define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9) +#define BXT_PHY_LANE_ENABLED (1 << 8) +#define BXT_PHY_CTL (port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \ + _BXT_PHY_CTL_DDI_B) +#define _PHY_CTL_FAMILY_EDP 0x64C80#define _PHY_CTL_FAMILY_DDI 0x64C90#define COMMON_RESET_DIS (1 << 31)
drivers/gpu/drm/i915/intel_ddi.c +27 -0
@@ -1342,6 +1342,16 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder,DRM_DEBUG_KMS ("No pipe for ddi port %c found\n" ,port_name (port)); out: +if (ret &&IS_BROXTON (dev_priv)) { + tmp =I915_READ (BXT_PHY_CTL (port)); +if ((tmp & (BXT_PHY_LANE_POWERDOWN_ACK | +BXT_PHY_LANE_ENABLED )) !=BXT_PHY_LANE_ENABLED ) { +DRM_DEBUG_KMS ("Port %c enabled but PHY powered down? " +"(PHY_CTL %08x)\n" ,port_name (port), tmp); + ret = false; + } + } +intel_display_power_put (dev_priv, power_domain);return ret;
@@ -1745,6 +1755,8 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)bool bxt_ddi_phy_is_enabled (struct drm_i915_private *dev_priv,enum dpio_phy phy) { +enum port port; +if (!(I915_READ (BXT_P_CR_GT_DISP_PWRON ) >_DISPLAY_POWER_ON (phy)))return false;
@@ -1770,6 +1782,21 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv,return false; } +for_each_port_masked (port, + phy ==DPIO_PHY0 ?BIT (PORT_B ) |BIT (PORT_C ) : +BIT (PORT_A )) { +u32 tmp =I915_READ (BXT_PHY_CTL (port)); + +if (tmp &BXT_PHY_CMNLANE_POWERDOWN_ACK ) { +DRM_DEBUG_DRIVER ("DDI PHY %d powered, but common lane " +"for port %c powered down " +"(PHY_CTL %08x)\n" , + phy,port_name (port), tmp); + +return false; + } + } +return true; }
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 6/6] drm/i915/bxt: Sanitiy check the PHY lane power down status
Quoted 39 lines · Imre Deak
We can check the power state of the PHY data and common lanes as reported by the PHY. Do this in case we need to debug problems where the PHY gets stuck in an unexpected state.
Note that I only check these when the lanes are expected to be powered on purpose, since it's not clear at what point the PHY power/clock gates things.
Signed-off-by Imre Deak <[email protected]>--- drivers/gpu/drm/i915/i915_reg.h | 9 +++++++++ drivers/gpu/drm/i915/intel_ddi.c | 27 +++++++++++++++++++++++++++ 2 files changed, 36 insertions(+)drivers/gpu/drm/i915/i915_reg.h +9
-0@@ -1276,6 +1276,15 @@ enum skl_disp_power_wells {#define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090)#define GT_DISPLAY_POWER_ON (phy) (1 << (phy)) +#define _BXT_PHY_CTL_DDI_A 0x64C00 +#define _BXT_PHY_CTL_DDI_B 0x64C10 +#define _BXT_PHY_CTL_DDI_C 0x64C20 +#define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10) +#define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9) +#define BXT_PHY_LANE_ENABLED (1 << 8) +#define BXT_PHY_CTL (port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \ + _BXT_PHY_CTL_DDI_B) +#define _PHY_CTL_FAMILY_EDP 0x64C80#define _PHY_CTL_FAMILY_DDI 0x64C90#define COMMON_RESET_DIS (1 << 31)drivers/gpu/drm/i915/intel_ddi.c +0
-0
drivers/gpu/drm/i915/intel_ddi.c bool intel_ddi_get_hw_state(struct intel_encoder *encoder, · line 1351
Quoted 10 lines
drivers/gpu/drm/i915/intel_ddi.c +7
-0@@ -1342,6 +1342,16 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder,DRM_DEBUG_KMS ("No pipe for ddi port %c found\n" ,port_name (port)); out: +if (ret &&IS_BROXTON (dev_priv)) { + tmp =I915_READ (BXT_PHY_CTL (port)); +if ((tmp & (BXT_PHY_LANE_POWERDOWN_ACK | +BXT_PHY_LANE_ENABLED )) !=BXT_PHY_LANE_ENABLED ) { +DRM_DEBUG_KMS ("Port %c enabled but PHY powered down? " +"(PHY_CTL %08x)\n" ,port_name (port), tmp); + ret = false;
Hmm. I'm not sure I'd change the return value here because then we'd fail to follow the proper shutdown sequence, perhaps even messing up the next modeset?
So maybe just ERROR/WARN in these cases?
Quoted 44 lines
drivers/gpu/drm/i915/intel_ddi.c +20
-0+ } + } +intel_display_power_put (dev_priv, power_domain);return ret;@@ -1745,6 +1755,8 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder)bool bxt_ddi_phy_is_enabled (struct drm_i915_private *dev_priv,enum dpio_phy phy) { +enum port port; +if (!(I915_READ (BXT_P_CR_GT_DISP_PWRON ) >_DISPLAY_POWER_ON (phy)))return false;@@ -1770,6 +1782,21 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv,return false; } +for_each_port_masked (port, + phy ==DPIO_PHY0 ?BIT (PORT_B ) |BIT (PORT_C ) : +BIT (PORT_A )) { +u32 tmp =I915_READ (BXT_PHY_CTL (port)); + +if (tmp &BXT_PHY_CMNLANE_POWERDOWN_ACK ) { +DRM_DEBUG_DRIVER ("DDI PHY %d powered, but common lane " +"for port %c powered down " +"(PHY_CTL %08x)\n" , + phy,port_name (port), tmp); + +return false; + } + } +return true; }Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 6/6] drm/i915/bxt: Sanitiy check the PHY lane power down status
Quoted 46 lines · Ville Syrjälä
Quoted 45 lines · Imre Deak
We can check the power state of the PHY data and common lanes as reported by the PHY. Do this in case we need to debug problems where the PHY gets stuck in an unexpected state.
Note that I only check these when the lanes are expected to be powered on purpose, since it's not clear at what point the PHY power/clock gates things.
Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/i915/i915_reg.h | 9 +++++++++drivers/gpu/drm/i915/intel_ddi.c| 27 +++++++++++++++++++++++++++2 files changed, 36 insertions(+)drivers/gpu/drm/i915/i915_reg.h +0
-0@@ -1276,6 +1276,15 @@ enum skl_disp_power_wells { #define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090) #define GT_DISPLAY_POWER_ON(phy) (1 << (phy))drivers/gpu/drm/i915/i915_reg.h +9
-0+#define _BXT_PHY_CTL_DDI_A 0x64C00 +#define _BXT_PHY_CTL_DDI_B 0x64C10 +#define _BXT_PHY_CTL_DDI_C 0x64C20 +#define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10) +#define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9) +#define BXT_PHY_LANE_ENABLED (1 << 8) +#define BXT_PHY_CTL (port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \ + _BXT_PHY_CTL_DDI_B) +#define
_PHY_CTL_FAMILY_EDP0x64C80
#define_PHY_CTL_FAMILY_DDI0x64C90
#define COMMON_RESET_DIS (1 << 31)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1342,6 +1342,16 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder, DRM_DEBUG_KMS("No pipe for ddi port %c found\n", port_name(port));
out:drivers/gpu/drm/i915/intel_ddi.c +3
-0+if (ret &&IS_BROXTON (dev_priv)) { + tmp =I915_READ (BXT_PHY_CTL (port)); + if ((tmp & (BXT_PHY_LANE_POWERDOWN_ACK |
Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c bool intel_ddi_get_hw_state(struct intel_encoder *encoder, · line 1351
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4
-0+ BXT_PHY_LANE_ENABLED)) != BXT_PHY_LANE_ENABLED) { +DRM_DEBUG_KMS ("Port %c enabled but PHY powered down? " + "(PHY_CTL %08x)\n", port_name(port), tmp); + ret = false;Hmm. I'm not sure I'd change the return value here because then we'd fail to follow the proper shutdown sequence, perhaps even messing up the next modeset?
What I wanted is to force a reprogramming in this case, but yea we would miss then the proper disable sequence. AFAICS we can't mark the state here as enabled but not valid, so for now I will just change the above to DRM_ERROR then and report an enabled state as you suggested.
Quoted 42 lines
So maybe just ERROR/WARN in these cases?
Quoted 40 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+ } + } +
intel_display_power_put(dev_priv, power_domain);
return ret;drivers/gpu/drm/i915/intel_ddi.c +2
-0@@ -1745,6 +1755,8 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, enum dpio_phy phy) { +enum port port; + if (!(I915_READ(BXT_P_CR_GT_DISP_PWRON) & GT_DISPLAY_POWER_ON(phy))) return false;drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1770,6 +1782,21 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, return false; }drivers/gpu/drm/i915/intel_ddi.c +15
-0+for_each_port_masked (port, + phy == DPIO_PHY0 ? BIT(PORT_B) | BIT(PORT_C) : + BIT(PORT_A)) { +u32 tmp =I915_READ (BXT_PHY_CTL (port)); + +if (tmp &BXT_PHY_CMNLANE_POWERDOWN_ACK ) { +DRM_DEBUG_DRIVER ("DDI PHY %d powered, but common lane " + "for port %c powered down " + "(PHY_CTL %08x)\n", + phy, port_name(port), tmp); + +return false; + } + } +return true;
}
--
2.5.0
Quoted 5 lines
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
Re: [PATCH 6/6] drm/i915/bxt: Sanitiy check the PHY lane power down status
Quoted 56 lines · Imre Deak
Quoted 46 lines · Ville Syrjälä
Quoted 45 lines · Imre Deak
We can check the power state of the PHY data and common lanes as reported by the PHY. Do this in case we need to debug problems where the PHY gets stuck in an unexpected state.
Note that I only check these when the lanes are expected to be powered on purpose, since it's not clear at what point the PHY power/clock gates things.
Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/i915/i915_reg.h | 9 +++++++++drivers/gpu/drm/i915/intel_ddi.c| 27 +++++++++++++++++++++++++++2 files changed, 36 insertions(+)drivers/gpu/drm/i915/i915_reg.h +0
-0@@ -1276,6 +1276,15 @@ enum skl_disp_power_wells { #define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090) #define GT_DISPLAY_POWER_ON(phy) (1 << (phy))drivers/gpu/drm/i915/i915_reg.h +9
-0+#define _BXT_PHY_CTL_DDI_A 0x64C00 +#define _BXT_PHY_CTL_DDI_B 0x64C10 +#define _BXT_PHY_CTL_DDI_C 0x64C20 +#define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10) +#define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9) +#define BXT_PHY_LANE_ENABLED (1 << 8) +#define BXT_PHY_CTL (port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \ + _BXT_PHY_CTL_DDI_B) +#define
_PHY_CTL_FAMILY_EDP0x64C80
#define_PHY_CTL_FAMILY_DDI0x64C90
#define COMMON_RESET_DIS (1 << 31)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1342,6 +1342,16 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder, DRM_DEBUG_KMS("No pipe for ddi port %c found\n", port_name(port));
out:drivers/gpu/drm/i915/intel_ddi.c +3
-0+if (ret &&IS_BROXTON (dev_priv)) { + tmp =I915_READ (BXT_PHY_CTL (port)); + if ((tmp & (BXT_PHY_LANE_POWERDOWN_ACK |Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c bool intel_ddi_get_hw_state(struct intel_encoder *encoder, · line 1351
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4
-0+ BXT_PHY_LANE_ENABLED)) != BXT_PHY_LANE_ENABLED) { +DRM_DEBUG_KMS ("Port %c enabled but PHY powered down? " + "(PHY_CTL %08x)\n", port_name(port), tmp); + ret = false;Hmm. I'm not sure I'd change the return value here because then we'd fail to follow the proper shutdown sequence, perhaps even messing up the next modeset?
Quoted 4 lines
What I wanted is to force a reprogramming in this case, but yea we would miss then the proper disable sequence. AFAICS we can't mark the state here as enabled but not valid, so for now I will just change the above to
DRM_ERRORthen and report an enabled state as you suggested.
Yeah. So far we've done any reprogramming in the sanitize phase, but that may require splitting/duplicating some parts of state readout. Maybe we should allow .get_config() & co. to flag the state as "this needs a forced modeset to sanitize things"?
Quoted 48 lines
Quoted 48 lines
So maybe just ERROR/WARN in these cases?
Quoted 44 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+ } + } +
intel_display_power_put(dev_priv, power_domain);
return ret;drivers/gpu/drm/i915/intel_ddi.c +2
-0@@ -1745,6 +1755,8 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, enum dpio_phy phy) { +enum port port; + if (!(I915_READ(BXT_P_CR_GT_DISP_PWRON) & GT_DISPLAY_POWER_ON(phy))) return false;drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1770,6 +1782,21 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, return false; }drivers/gpu/drm/i915/intel_ddi.c +15
-0+for_each_port_masked (port, + phy == DPIO_PHY0 ? BIT(PORT_B) | BIT(PORT_C) : + BIT(PORT_A)) { +u32 tmp =I915_READ (BXT_PHY_CTL (port)); + +if (tmp &BXT_PHY_CMNLANE_POWERDOWN_ACK ) { +DRM_DEBUG_DRIVER ("DDI PHY %d powered, but common lane " + "for port %c powered down " + "(PHY_CTL %08x)\n", + phy, port_name(port), tmp); + +return false; + } + } +return true;
}
--
2.5.0_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: [PATCH 6/6] drm/i915/bxt: Sanitiy check the PHY lane power down status
Quoted 62 lines · Ville Syrjälä
Quoted 56 lines · Imre Deak
Quoted 46 lines · Ville Syrjälä
Quoted 45 lines · Imre Deak
We can check the power state of the PHY data and common lanes as reported by the PHY. Do this in case we need to debug problems where the PHY gets stuck in an unexpected state.
Note that I only check these when the lanes are expected to be powered on purpose, since it's not clear at what point the PHY power/clock gates things.
Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/i915/i915_reg.h | 9 +++++++++drivers/gpu/drm/i915/intel_ddi.c| 27 +++++++++++++++++++++++++++2 files changed, 36 insertions(+)drivers/gpu/drm/i915/i915_reg.h +0
-0@@ -1276,6 +1276,15 @@ enum skl_disp_power_wells { #define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090) #define GT_DISPLAY_POWER_ON(phy) (1 << (phy))drivers/gpu/drm/i915/i915_reg.h +9
-0+#define _BXT_PHY_CTL_DDI_A 0x64C00 +#define _BXT_PHY_CTL_DDI_B 0x64C10 +#define _BXT_PHY_CTL_DDI_C 0x64C20 +#define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10) +#define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9) +#define BXT_PHY_LANE_ENABLED (1 << 8) +#define BXT_PHY_CTL (port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \ + _BXT_PHY_CTL_DDI_B) +#define
_PHY_CTL_FAMILY_EDP0x64C80
#define_PHY_CTL_FAMILY_DDI0x64C90
#define COMMON_RESET_DIS (1 << 31)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1342,6 +1342,16 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder, DRM_DEBUG_KMS("No pipe for ddi port %c found\n", port_name(port));
out:drivers/gpu/drm/i915/intel_ddi.c +3
-0+if (ret &&IS_BROXTON (dev_priv)) { + tmp =I915_READ (BXT_PHY_CTL (port)); + if ((tmp & (BXT_PHY_LANE_POWERDOWN_ACK |Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c bool intel_ddi_get_hw_state(struct intel_encoder *encoder, · line 1351
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4
-0+ BXT_PHY_LANE_ENABLED)) != BXT_PHY_LANE_ENABLED) { +DRM_DEBUG_KMS ("Port %c enabled but PHY powered down? " + "(PHY_CTL %08x)\n", port_name(port), tmp); + ret = false;Hmm. I'm not sure I'd change the return value here because then we'd fail to follow the proper shutdown sequence, perhaps even messing up the next modeset?
Quoted 4 lines
What I wanted is to force a reprogramming in this case, but yea we would miss then the proper disable sequence. AFAICS we can't mark the state here as enabled but not valid, so for now I will just change the above to
DRM_ERRORthen and report an enabled state as you suggested.
Quoted 4 lines
Yeah. So far we've done any reprogramming in the sanitize phase, but that may require splitting/duplicating some parts of state readout. Maybe we should allow .get_config() & co. to flag the state as "this needs a forced modeset to sanitize things"?
Yea, sounds good to me. Since this a new check in any case could we add this as a follow-up?
Quoted 42 lines
Quoted 42 lines
Quoted 42 lines
So maybe just ERROR/WARN in these cases?
Quoted 40 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+ } + } +
intel_display_power_put(dev_priv, power_domain);
return ret;drivers/gpu/drm/i915/intel_ddi.c +2
-0@@ -1745,6 +1755,8 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, enum dpio_phy phy) { +enum port port; + if (!(I915_READ(BXT_P_CR_GT_DISP_PWRON) & GT_DISPLAY_POWER_ON(phy))) return false;drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1770,6 +1782,21 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, return false; }drivers/gpu/drm/i915/intel_ddi.c +15
-0+for_each_port_masked (port, + phy == DPIO_PHY0 ? BIT(PORT_B) | BIT(PORT_C) : + BIT(PORT_A)) { +u32 tmp =I915_READ (BXT_PHY_CTL (port)); + +if (tmp &BXT_PHY_CMNLANE_POWERDOWN_ACK ) { +DRM_DEBUG_DRIVER ("DDI PHY %d powered, but common lane " + "for port %c powered down " + "(PHY_CTL %08x)\n", + phy, port_name(port), tmp); + +return false; + } + } +return true;
}
--
2.5.0
Quoted 6 lines
Quoted 5 lines
Quoted 5 lines
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
Re: [PATCH 6/6] drm/i915/bxt: Sanitiy check the PHY lane power down status
Quoted 63 lines · Imre Deak
Quoted 62 lines · Ville Syrjälä
Quoted 60 lines · Imre Deak
Quoted 46 lines · Ville Syrjälä
Quoted 45 lines · Imre Deak
We can check the power state of the PHY data and common lanes as reported by the PHY. Do this in case we need to debug problems where the PHY gets stuck in an unexpected state.
Note that I only check these when the lanes are expected to be powered on purpose, since it's not clear at what point the PHY power/clock gates things.
Signed-off-by Imre Deak <[email protected]>---
drivers/gpu/drm/i915/i915_reg.h | 9 +++++++++drivers/gpu/drm/i915/intel_ddi.c| 27 +++++++++++++++++++++++++++2 files changed, 36 insertions(+)drivers/gpu/drm/i915/i915_reg.h +0
-0@@ -1276,6 +1276,15 @@ enum skl_disp_power_wells { #define BXT_P_CR_GT_DISP_PWRON _MMIO(0x138090) #define GT_DISPLAY_POWER_ON(phy) (1 << (phy))drivers/gpu/drm/i915/i915_reg.h +9
-0+#define _BXT_PHY_CTL_DDI_A 0x64C00 +#define _BXT_PHY_CTL_DDI_B 0x64C10 +#define _BXT_PHY_CTL_DDI_C 0x64C20 +#define BXT_PHY_CMNLANE_POWERDOWN_ACK (1 << 10) +#define BXT_PHY_LANE_POWERDOWN_ACK (1 << 9) +#define BXT_PHY_LANE_ENABLED (1 << 8) +#define BXT_PHY_CTL (port) _MMIO_PORT(port, _BXT_PHY_CTL_DDI_A, \ + _BXT_PHY_CTL_DDI_B) +#define
_PHY_CTL_FAMILY_EDP0x64C80
#define_PHY_CTL_FAMILY_DDI0x64C90
#define COMMON_RESET_DIS (1 << 31)drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1342,6 +1342,16 @@ bool intel_ddi_get_hw_state(struct intel_encoder *encoder, DRM_DEBUG_KMS("No pipe for ddi port %c found\n", port_name(port));
out:drivers/gpu/drm/i915/intel_ddi.c +3
-0+if (ret &&IS_BROXTON (dev_priv)) { + tmp =I915_READ (BXT_PHY_CTL (port)); + if ((tmp & (BXT_PHY_LANE_POWERDOWN_ACK |Quoted 8 lines
drivers/gpu/drm/i915/intel_ddi.c bool intel_ddi_get_hw_state(struct intel_encoder *encoder, · line 1351
Quoted 4 lines
drivers/gpu/drm/i915/intel_ddi.c +4
-0+ BXT_PHY_LANE_ENABLED)) != BXT_PHY_LANE_ENABLED) { +DRM_DEBUG_KMS ("Port %c enabled but PHY powered down? " + "(PHY_CTL %08x)\n", port_name(port), tmp); + ret = false;Hmm. I'm not sure I'd change the return value here because then we'd fail to follow the proper shutdown sequence, perhaps even messing up the next modeset?
What I wanted is to force a reprogramming in this case, but yea we would miss then the proper disable sequence. AFAICS we can't mark the state here as enabled but not valid, so for now I will just change the above to
DRM_ERRORthen and report an enabled state as you suggested.
Quoted 7 lines
Quoted 4 lines
Yeah. So far we've done any reprogramming in the sanitize phase, but that may require splitting/duplicating some parts of state readout. Maybe we should allow .get_config() & co. to flag the state as "this needs a forced modeset to sanitize things"?
Yea, sounds good to me. Since this a new check in any case could we add this as a follow-up?
Yes. This was more of a food for thought type of suggestion, so wasn't expecting that it would happen right away.
Quoted 49 lines
Quoted 49 lines
Quoted 48 lines
Quoted 48 lines
So maybe just ERROR/WARN in these cases?
Quoted 44 lines
drivers/gpu/drm/i915/intel_ddi.c +3
-0+ } + } +
intel_display_power_put(dev_priv, power_domain);
return ret;drivers/gpu/drm/i915/intel_ddi.c +2
-0@@ -1745,6 +1755,8 @@ static void intel_disable_ddi(struct intel_encoder *intel_encoder) bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, enum dpio_phy phy) { +enum port port; + if (!(I915_READ(BXT_P_CR_GT_DISP_PWRON) & GT_DISPLAY_POWER_ON(phy))) return false;drivers/gpu/drm/i915/intel_ddi.c +0
-0@@ -1770,6 +1782,21 @@ bool bxt_ddi_phy_is_enabled(struct drm_i915_private *dev_priv, return false; }drivers/gpu/drm/i915/intel_ddi.c +15
-0+for_each_port_masked (port, + phy == DPIO_PHY0 ? BIT(PORT_B) | BIT(PORT_C) : + BIT(PORT_A)) { +u32 tmp =I915_READ (BXT_PHY_CTL (port)); + +if (tmp &BXT_PHY_CMNLANE_POWERDOWN_ACK ) { +DRM_DEBUG_DRIVER ("DDI PHY %d powered, but common lane " + "for port %c powered down " + "(PHY_CTL %08x)\n", + phy, port_name(port), tmp); + +return false; + } + } +return true;
}
--
2.5.0_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✓ Ro.CI.BAT: success for drm/i915/bxt: Fix DDI PHY setup for low resolutions
In reply to Imre Deak== Series Details ==
== Series Details ==
Series: drm/i915/bxt: Fix DDI PHY setup for low resolutions
URL : https://patchwork.freedesktop.org/series/8414/
State : success
== Summary ==
Series 8414v1 drm/i915/bxt: Fix DDI PHY setup for low resolutions
http://patchwork.freedesktop.org/api/1.0/series/8414/revisions/1/mbox
fi-bdw-i7-5557u total:102 pass:93 dwarn:0 dfail:0 fail:0 skip:8 fi-skl-i5-6260u total:209 pass:198 dwarn:0 dfail:0 fail:0 skip:11 fi-skl-i7-6700k total:209 pass:184 dwarn:0 dfail:0 fail:0 skip:25 fi-snb-i7-2600 total:209 pass:170 dwarn:0 dfail:0 fail:0 skip:39 ro-bdw-i5-5250u total:183 pass:172 dwarn:0 dfail:0 fail:0 skip:10 ro-bdw-i7-5600u total:93 pass:85 dwarn:0 dfail:0 fail:0 skip:8 ro-bsw-n3050 total:208 pass:167 dwarn:0 dfail:0 fail:2 skip:39 ro-byt-n2820 total:208 pass:168 dwarn:0 dfail:0 fail:3 skip:37 ro-hsw-i3-4010u total:208 pass:185 dwarn:0 dfail:0 fail:0 skip:23 ro-hsw-i7-4770r total:183 pass:161 dwarn:0 dfail:0 fail:0 skip:21 ro-ilk1-i5-650 total:204 pass:146 dwarn:0 dfail:0 fail:1 skip:57 ro-ivb-i7-3770 total:183 pass:154 dwarn:0 dfail:0 fail:0 skip:28 ro-ivb2-i7-3770 total:183 pass:158 dwarn:0 dfail:0 fail:0 skip:24 ro-snb-i7-2620M total:183 pass:151 dwarn:0 dfail:0 fail:0 skip:31
fi-hsw-i7-4770k failed to connect after reboot
ro-bdw-i7-5557U failed to connect after reboot
ro-bdw-i7-5600u failed to connect after reboot
Results at /archive/results/CI_IGT_test/RO_Patchwork_1133/
131a54b drm-intel-nightly: 2016y-06m-07d-19h-46m-33s UTC integration manifest 9c8fe8f drm/i915/bxt: Sanitiy check the PHY lane power down status 11da1b8 drm/i915/bxt: Rename broxton to bxt in PHY/CDCLK function prefixes 218803a drm/i915/bxt: Set DDI PHY lane latency optimization during modeset bda698f drm/i915/bxt: Move DDI PHY enabling/disabling to the power well code 765d6b6 drm/i915: Factor out intel_power_well_get/put
82df3ef drm/i915/bxt: Wait for PHY1 GRC calibration synchronously
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Patchwork
CI✗ Ro.CI.BAT: failure for drm/i915/bxt: Fix DDI PHY setup for low resolutions (rev4)
In reply to Imre Deak== Series Details ==
== Series Details ==
Series: drm/i915/bxt: Fix DDI PHY setup for low resolutions (rev4)
URL : https://patchwork.freedesktop.org/series/8414/
State : failure
== Summary ==
Applying: drm/i915/bxt: Wait for PHY1 GRC calibration synchronously
Applying: drm/i915/bxt: Sanitiy check the PHY lane power down status
fatal: sha1 information is lacking or useless (drivers/gpu/drm/i915/intel_ddi.c).
error: could not build fake ancestor
Patch failed at 0002 drm/i915/bxt: Sanitiy check the PHY lane power down status The copy of the patch that failed is found in: .git/rebase-apply/patch 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".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Re: ✗ Ro.CI.BAT: failure for drm/i915/bxt: Fix DDI PHY setup for low resolutions (rev4)
In reply to Imre DeakSomehow threading seems to be broken, v2 of 6/6 is applied out of order after 1/6. Also I can't see v2 of 2/6 and v2 of 4/6 at [1] which I sent along with v2 of 6/6. AFAICS the In-reply-to fields were correct in the v2 versions I sent.
--Imre
[1] https://patchwork.freedesktop.org/series/8414/
Quoted 8 lines
== Series Details ==
Series: drm/i915/bxt: Fix DDI PHY setup for low resolutions (rev4) URL : https://patchwork.freedesktop.org/series/8414/
State : failure== Summary ==
Quoted 9 lines
Applying: drm/i915/bxt: Wait for PHY1 GRC calibration synchronously
Applying: drm/i915/bxt: Sanitiy check the PHY lane power down status
fatal: sha1 information is lacking oruseless(drivers/gpu/drm/i915/intel_ddi.c).
error: could not build fake ancestor
Patch failed at 0002 drm/i915/bxt: Sanitiy check the PHY lane power down status The copy of the patch that failed is found in: .git/rebase-apply/patch 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".
_______________________________________________
Intel-gfx mailing list
[email protected]
https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 14 lines · Imre Deak
There are two problems with the current way of enabling the DDI PHYs during driver loading/resuming:
Relying on the HWs dynamic power gating may waste some power and part of the PHY configuration is dependent on the mode specific DDI lane count. To solve both of these issues split the PHY initialization, moving one half of it to the power well code the other half to the modeset code, similarly to the CHV code.Kudos to Ville for explaining about the PHY power gating and other quirks on CHV, it helped a lot to better understand the BXT PHY which is quite similar.
This fixes modeset problems for modes with less than 4 lanes.
Quoted 7 lines
Imre Deak (6):
drm/i915/bxt: Wait for PHY1 GRC calibration synchronously drm/i915: Factor out intel_power_well_get/put drm/i915/bxt: Move DDI PHY enabling/disabling to the power well code drm/i915/bxt: Set DDI PHY lane latency optimization during modeset drm/i915/bxt: Rename broxton to bxt in PHY/CDCLK function prefixes drm/i915/bxt: Sanitiy check the PHY lane power down status
Series lgtm
Quoted 15 lines
drivers/gpu/drm/i915/i915_reg.h | 12 ++ drivers/gpu/drm/i915/intel_ddi.c | 222 ++++++++++++++++++-------------- drivers/gpu/drm/i915/intel_display.c | 33 +++-- drivers/gpu/drm/i915/intel_drv.h | 19 ++- drivers/gpu/drm/i915/intel_runtime_pm.c | 133 ++++++++++++++++--- 5 files changed, 291 insertions(+), 128 deletions(-)Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx
Signature · 6 lines
Ville Syrjälä Intel OTC _______________________________________________ Intel-gfx mailing list [email protected] https://lists.freedesktop.org/mailman/listinfo/intel-gfx