HDMI detection fix backport
Subsystems (2)
cover HDMI detection fix backport
This is a backport of a fix for an HDMI detection problem, which was introduced in v4.4-rc1, see the last patch for details. The fix for it with its dependencies is in drm-intel-next-queued only, the patches here are rebased versions of those on top of drm-intel-fixes. I had to resolve some conflicts during rebasing, but non of those were functional conflicts.
Imre Deak (3):
drm/i915/ddi: fix intel_display_port_aux_power_domain() after HDMI
detect
drm/i915: add MISSING_CASE to a few port/aux power domain helpers drm/i915: take a power domain reference while checking the HDMI live
status
Ville Syrjälä (2):
drm/i915: Clean up AUX power domain handling
drm/i915: Introduce a gmbus power domain
drivers/gpu/drm/i915/i915_debugfs.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_display.c | 52 ++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dp.c | 48 +++++++++--------------------- drivers/gpu/drm/i915/intel_drv.h | 4 +-- drivers/gpu/drm/i915/intel_hdmi.c | 12 ++++---- drivers/gpu/drm/i915/intel_i2c.c | 6 ++-- drivers/gpu/drm/i915/intel_runtime_pm.c | 34 +++------------------ 8 files changed, 84 insertions(+), 75 deletions(-)
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 1/5 drm/i915: Clean up AUX power domain handling
From: Ville Syrjälä <[email protected]>
Introduce intel_display_port_aux_power_domain() which simply returns the appropriate AUX power domain for a specific port, and then replace the intel_display_port_power_domain() with calls to the new function in the DP code. As long as we're not actually enabling the port we don't need the lane power domains, and those are handled now purely from modeset_update_crtc_power_domains().
My initial motivation for this was to see if I could keep the DPIO power wells powered down while doing AUX on CHV, but turns out I can't so this doesn't change anything for CHV at least. But I think it's still a worthwile change.
v2: Add case for PORT E. Default to POWER_DOMAIN_AUX_D for now. (Ville)
--- drivers/gpu/drm/i915/intel_display.c | 43 ++++++++++++++++++++++++++++++++ drivers/gpu/drm/i915/intel_dp.c | 48 +++++++++++------------------------- drivers/gpu/drm/i915/intel_drv.h | 2 ++ 3 files changed, 59 insertions(+), 34 deletions(-)
drivers/gpu/drm/i915/intel_display.c +43 -0
@@ -5199,6 +5199,26 @@ static enum intel_display_power_domain port_to_power_domain(enum port port) } } +static enum intel_display_power_domain port_to_aux_power_domain (enum port port) +{ +switch (port) { +case PORT_A : +return POWER_DOMAIN_AUX_A ; +case PORT_B : +return POWER_DOMAIN_AUX_B ; +case PORT_C : +return POWER_DOMAIN_AUX_C ; +case PORT_D : +return POWER_DOMAIN_AUX_D ; +case PORT_E : +/* FIXME: Check VBT for actual wiring of PORT E */ +return POWER_DOMAIN_AUX_D ; +default : +WARN_ON_ONCE (1 ); +return POWER_DOMAIN_AUX_A ; + } +} +#define for_each_power_domain (domain, mask) \ for ((domain) = 0; (domain) < POWER_DOMAIN_NUM; (domain)++) \ if ((1 << (domain)) & (mask))
@@ -5230,6 +5250,29 @@ intel_display_port_power_domain(struct intel_encoder *intel_encoder) } } +enum intel_display_power_domain +intel_display_port_aux_power_domain (struct intel_encoder *intel_encoder) +{ +struct drm_device *dev = intel_encoder->base.dev; +struct intel_digital_port *intel_dig_port; + +switch (intel_encoder->type) { +case INTEL_OUTPUT_UNKNOWN : +/* Only DDI platforms should ever use this output type */ +WARN_ON_ONCE (!HAS_DDI (dev)); +case INTEL_OUTPUT_DISPLAYPORT : +case INTEL_OUTPUT_EDP : + intel_dig_port =enc_to_dig_port (&intel_encoder->base); +return port_to_aux_power_domain (intel_dig_port->port); +case INTEL_OUTPUT_DP_MST : + intel_dig_port =enc_to_mst (&intel_encoder->base)->primary; +return port_to_aux_power_domain (intel_dig_port->port); +default : +WARN_ON_ONCE (1 ); +return POWER_DOMAIN_AUX_A ; + } +} +static unsigned long get_crtc_power_domains (struct drm_crtc *crtc) {struct drm_device *dev = crtc->dev;
drivers/gpu/drm/i915/intel_dp.c +14 -34
135 lines not on this page · raw message
drivers/gpu/drm/i915/intel_drv.h +2 -0
@@ -1169,6 +1169,8 @@ void hsw_enable_ips(struct intel_crtc *crtc);void hsw_disable_ips (struct intel_crtc *crtc);enum intel_display_power_domain intel_display_port_power_domain (struct intel_encoder *intel_encoder); +enum intel_display_power_domain +intel_display_port_aux_power_domain (struct intel_encoder *intel_encoder);void intel_mode_from_pipe_config (struct drm_display_mode *mode,struct intel_crtc_state *pipe_config);void intel_crtc_wait_for_pending_flips (struct drm_crtc *crtc);
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 2/5 drm/i915: Introduce a gmbus power domain
In reply to Imre DeakFrom: Ville Syrjälä <[email protected]>
Currently the gmbus code uses intel_aux_display_runtime_get/put in an effort to make sure the hardware is powered up sufficiently for gmbus. That function only takes the runtime PM reference which on VLV/CHV/BXT is not enough. We need the disp2d/pipe-a well on VLV/CHV and power well 2 on BXT. So add a new power domnain for gmbus and kill off the now unused intel_aux_display_runtime_get/put. And change intel_hdmi_set_edid() to use the gmbus power domain too since that's all we need there.
Also toss in a BUILD_BUG_ON() to catch problems if we run out of bits for power domains. We're already really close to the limit...
[Patrik: Add gmbus string to debugfs output]
--- drivers/gpu/drm/i915/i915_debugfs.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_drv.h | 2 -- drivers/gpu/drm/i915/intel_hdmi.c | 8 ++------ drivers/gpu/drm/i915/intel_i2c.c | 6 ++++-- drivers/gpu/drm/i915/intel_runtime_pm.c | 34 ++++----------------------------- 6 files changed, 13 insertions(+), 40 deletions(-)
drivers/gpu/drm/i915/i915_debugfs.c +2 -0
@@ -2734,6 +2734,8 @@ static const char *power_domain_str(enum intel_display_power_domain domain)return "AUX_C" ;case POWER_DOMAIN_AUX_D :return "AUX_D" ; +case POWER_DOMAIN_GMBUS : +return "GMBUS" ;case POWER_DOMAIN_INIT :return "INIT" ;default :
drivers/gpu/drm/i915/i915_drv.h +1 -0
@@ -199,6 +199,7 @@ enum intel_display_power_domain {POWER_DOMAIN_AUX_B ,POWER_DOMAIN_AUX_C ,POWER_DOMAIN_AUX_D , +POWER_DOMAIN_GMBUS ,POWER_DOMAIN_INIT , POWER_DOMAIN_NUM,
drivers/gpu/drm/i915/intel_drv.h +0 -2
@@ -1379,8 +1379,6 @@ void intel_display_power_get(struct drm_i915_private *dev_priv, enum intel_display_power_domain domain);void intel_display_power_put (struct drm_i915_private *dev_priv,enum intel_display_power_domain domain); -void intel_aux_display_runtime_get (struct drm_i915_private *dev_priv); -void intel_aux_display_runtime_put (struct drm_i915_private *dev_priv);void intel_runtime_pm_get (struct drm_i915_private *dev_priv);void intel_runtime_pm_get_noresume (struct drm_i915_private *dev_priv);void intel_runtime_pm_put (struct drm_i915_private *dev_priv);
drivers/gpu/drm/i915/intel_hdmi.c +2 -6
@@ -1335,21 +1335,17 @@ intel_hdmi_set_edid(struct drm_connector *connector, bool force) {struct drm_i915_private *dev_priv =to_i915 (connector->dev);struct intel_hdmi *intel_hdmi =intel_attached_hdmi (connector); -struct intel_encoder *intel_encoder = - &hdmi_to_dig_port (intel_hdmi)->base; -enum intel_display_power_domain power_domain;struct edid *edid =NULL ;bool connected = false; - power_domain =intel_display_port_power_domain (intel_encoder); -intel_display_power_get (dev_priv, power_domain); +intel_display_power_get (dev_priv,POWER_DOMAIN_GMBUS );if (force) edid =drm_get_edid (connector,intel_gmbus_get_adapter (dev_priv, intel_hdmi->ddc_bus)); -intel_display_power_put (dev_priv, power_domain); +intel_display_power_put (dev_priv,POWER_DOMAIN_GMBUS );to_intel_connector (connector)->detect_edid = edid;if (edid && edid->input &DRM_EDID_INPUT_DIGITAL ) {
drivers/gpu/drm/i915/intel_i2c.c +4 -2
@@ -483,7 +483,7 @@ gmbus_xfer(struct i2c_adapter *adapter,int i =0 , inc, try =0 ;int ret =0 ; -intel_aux_display_runtime_get (dev_priv); +intel_display_power_get (dev_priv,POWER_DOMAIN_GMBUS );mutex_lock (&dev_priv->gmbus_mutex);if (bus->force_bit) {
@@ -595,7 +595,9 @@ timeout: out:mutex_unlock (&dev_priv->gmbus_mutex); -intel_aux_display_runtime_put (dev_priv); + +intel_display_power_put (dev_priv,POWER_DOMAIN_GMBUS ); +return ret; }
drivers/gpu/drm/i915/intel_runtime_pm.c +4 -30
@@ -362,6 +362,7 @@ static void hsw_set_power_well(struct drm_i915_private *dev_priv, BIT(POWER_DOMAIN_AUX_C) | \ BIT(POWER_DOMAIN_AUDIO) | \ BIT(POWER_DOMAIN_VGA) | \ + BIT(POWER_DOMAIN_GMBUS) | \ BIT(POWER_DOMAIN_INIT))#define BXT_DISPLAY_POWERWELL_1_POWER_DOMAINS ( \ BXT_DISPLAY_POWERWELL_2_POWER_DOMAINS | \
@@ -1483,6 +1484,7 @@ void intel_display_power_put(struct drm_i915_private *dev_priv, BIT(POWER_DOMAIN_AUX_B) | \ BIT(POWER_DOMAIN_AUX_C) | \ BIT(POWER_DOMAIN_AUX_D) | \ + BIT(POWER_DOMAIN_GMBUS) | \ BIT(POWER_DOMAIN_INIT))#define HSW_DISPLAY_POWER_DOMAINS ( \ (POWER_DOMAIN_MASK & ~HSW_ALWAYS_ON_POWER_DOMAINS) | \
@@ -1845,6 +1847,8 @@ int intel_power_domains_init(struct drm_i915_private *dev_priv) i915.disable_power_well =sanitize_disable_power_well_option (dev_priv, i915.disable_power_well); +BUILD_BUG_ON (POWER_DOMAIN_NUM >31 ); +mutex_init (&power_domains->lock);/*
@@ -2064,36 +2068,6 @@ void intel_power_domains_init_hw(struct drm_i915_private *dev_priv) }/** -* intel_aux_display_runtime_get - grab an auxiliary power domain reference -* @dev_priv: i915 device instance -* -* This function grabs a power domain reference for the auxiliary power domain -* (for access to the GMBUS and DP AUX blocks) and ensures that it and all its -* parents are powered up. Therefore users should only grab a reference to the -* innermost power domain they need. -* -* Any power domain reference obtained by this function must have a symmetric -* call to intel_aux_display_runtime_put() to release the reference again. -*/ -void intel_aux_display_runtime_get (struct drm_i915_private *dev_priv) -{ -intel_runtime_pm_get (dev_priv); -} - -/** -* intel_aux_display_runtime_put - release an auxiliary power domain reference -* @dev_priv: i915 device instance -* -* This function drops the auxiliary power domain reference obtained by -* intel_aux_display_runtime_get() and might power down the corresponding -* hardware block right away if this is the last reference. -*/ -void intel_aux_display_runtime_put (struct drm_i915_private *dev_priv) -{ -intel_runtime_pm_put (dev_priv); -} - -/** * intel_runtime_pm_get - grab a runtime pm reference * @dev_priv: i915 device instance *
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 3/5 drm/i915/ddi: fix intel_display_port_aux_power_domain() after HDMI detect
In reply to Imre DeakDue to the current sharing of the DDI encoder between DP and HDMI connectors we can run the DP detection after the HDMI detection has already set the shared encoder's type. For now solve this keeping the current behavior and running the detection in this case too. For a proper solution Ville suggested to split the encoder into an HDMI and DP one, that can be done as a follow-up.
This issue triggers the WARN in intel_display_port_aux_power_domain() and was introduced in:
commit 25f78f58e5bfb46a270ce4d690fb49dc104558b1
Author: Ville Syrjälä <[email protected]> Date: Mon Nov 16 15:01:04 2015 +0100
drm/i915: Clean up AUX power domain handling
--- drivers/gpu/drm/i915/intel_display.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-)
drivers/gpu/drm/i915/intel_display.c +8 -1
@@ -5258,7 +5258,14 @@ intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder)switch (intel_encoder->type) {case INTEL_OUTPUT_UNKNOWN : -/* Only DDI platforms should ever use this output type */ +case INTEL_OUTPUT_HDMI : +/* +* Only DDI platforms should ever use these output types. +* We can get here after the HDMI detect code has already set +* the type of the shared encoder. Since we can't be sure +* what's the status of the given connectors, play safe and +* run the DP detection too. +*/ WARN_ON_ONCE (!HAS_DDI (dev));case INTEL_OUTPUT_DISPLAYPORT :case INTEL_OUTPUT_EDP :
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 4/5 drm/i915: add MISSING_CASE to a few port/aux power domain helpers
In reply to Imre DeakMISSING_CASE() would have been useful to track down a recent problem in intel_display_port_aux_power_domain(), so add it there and a few related helpers. This was also suggested by Ville in his review of the latest DMC/DC changes, we forgot to address that.
--- drivers/gpu/drm/i915/intel_display.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/gpu/drm/i915/intel_display.c +3 -3
@@ -5194,7 +5194,7 @@ static enum intel_display_power_domain port_to_power_domain(enum port port)case PORT_E :return POWER_DOMAIN_PORT_DDI_E_2_LANES ;default : -WARN_ON_ONCE (1 ); +MISSING_CASE (port);return POWER_DOMAIN_PORT_OTHER ; } }
@@ -5214,7 +5214,7 @@ static enum intel_display_power_domain port_to_aux_power_domain(enum port port)/* FIXME: Check VBT for actual wiring of PORT E */ return POWER_DOMAIN_AUX_D ;default : -WARN_ON_ONCE (1 ); +MISSING_CASE (port);return POWER_DOMAIN_AUX_A ; } }
@@ -5275,7 +5275,7 @@ intel_display_port_aux_power_domain(struct intel_encoder *intel_encoder) intel_dig_port =enc_to_mst (&intel_encoder->base)->primary;return port_to_aux_power_domain (intel_dig_port->port);default : -WARN_ON_ONCE (1 ); +MISSING_CASE (intel_encoder->type);return POWER_DOMAIN_AUX_A ; } }
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
PATCH 5/5 drm/i915: take a power domain reference while checking the HDMI live status
In reply to Imre DeakThere are platforms that don't need the full GMBUS power domain (BXT) while others do (PCH, VLV/CHV). For optimizing this we would need to add a new power domain, but it's not clear how much we would benefit given the short time we hold the reference. So for now let's keep things simple.
This fixes a regression introduced in
commit 237ed86c693d8a8e4db476976aeb30df4deac74b
Author: Sonika Jindal <[email protected]> Date: Tue Sep 15 09:44:20 2015 +0530
drm/i915: Check live status before reading edid
v2:
- fix commit message, PCH won't take any redundant power resource after this change (Ville)
--- drivers/gpu/drm/i915/intel_hdmi.c | 4 ++++ 1 file changed, 4 insertions(+)
drivers/gpu/drm/i915/intel_hdmi.c +4 -0
@@ -1379,6 +1379,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force)DRM_DEBUG_KMS ("[CONNECTOR:%d:%s]\n" , connector->base.id, connector->name); +intel_display_power_get (dev_priv,POWER_DOMAIN_GMBUS ); +while (!live_status && --retry) { live_status =intel_digital_port_connected (dev_priv,hdmi_to_dig_port (intel_hdmi));
@@ -1398,6 +1400,8 @@ intel_hdmi_detect(struct drm_connector *connector, bool force) }else status = connector_status_disconnected; +intel_display_power_put (dev_priv,POWER_DOMAIN_GMBUS ); +return status; }
Signature · 6 lines
2.5.0 _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx
Quoted 6 lines · Imre Deak
This is a backport of a fix for an HDMI detection problem, which was introduced in v4.4-rc1, see the last patch for details. The fix for it with its dependencies is in drm-intel-next-queued only, the patches here are rebased versions of those on top of drm-intel-fixes. I had to resolve some conflicts during rebasing, but non of those were functional conflicts.
Pushed the lot to drm-intel-fixes, and fixed the conflicts galore on nightly. Thanks for the backports.
BR,
Jani.
Quoted 21 lines
Imre Deak (3):
drm/i915/ddi: fixintel_display_port_aux_power_domain()after HDMI
detect
drm/i915: addMISSING_CASEto a few port/aux power domain helpers drm/i915: take a power domain reference while checking the HDMI live
statusVille Syrjälä (2):
drm/i915: Clean up AUX power domain handling
drm/i915: Introduce a gmbus power domaindrivers/gpu/drm/i915/i915_debugfs.c | 2 ++ drivers/gpu/drm/i915/i915_drv.h | 1 + drivers/gpu/drm/i915/intel_display.c | 52 ++++++++++++++++++++++++++++++++- drivers/gpu/drm/i915/intel_dp.c | 48 +++++++++--------------------- drivers/gpu/drm/i915/intel_drv.h | 4 +-- drivers/gpu/drm/i915/intel_hdmi.c | 12 ++++---- drivers/gpu/drm/i915/intel_i2c.c | 6 ++-- drivers/gpu/drm/i915/intel_runtime_pm.c | 34 +++------------------ 8 files changed, 84 insertions(+), 75 deletions(-)
Signature · 5 lines
Jani Nikula, Intel Open Source Technology Center _______________________________________________ Intel-gfx mailing list [email protected] http://lists.freedesktop.org/mailman/listinfo/intel-gfx