[Intel-gfx] [PATCH 6/7] drm/i915: Unify hpd setup between init and hpd storm handling
ville.syrjala at linux.intel.com
ville.syrjala at linux.intel.com
Fri Jan 9 04:21:17 PST 2015
From: Ville Syrjälä <ville.syrjala at linux.intel.com>
Handle things the same way when initializing hpd support and re-enabling
hpd interrupts after recovering from an interrupt storm. Later on we'll
share the same code also when togglind hpd on/off for inidividual eDP
connectors.
Signed-off-by: Ville Syrjälä <ville.syrjala at linux.intel.com>
---
drivers/gpu/drm/i915/i915_irq.c | 93 +++++++++++++++++++++--------------------
1 file changed, 48 insertions(+), 45 deletions(-)
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index 8fe5a87..c482903 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -4165,6 +4165,46 @@ static void i915_hpd_irq_setup(struct drm_device *dev)
I915_WRITE(PORT_HOTPLUG_EN, hotplug_en);
}
+static void intel_hpd_irq_setup(struct drm_device *dev)
+{
+ struct drm_i915_private *dev_priv = to_i915(dev);
+ struct drm_mode_config *mode_config = &dev->mode_config;
+ struct drm_connector *connector;
+ int hpd_pin;
+
+ assert_spin_locked(&dev_priv->irq_lock);
+
+ for (hpd_pin = 1; hpd_pin < HPD_NUM_PINS; hpd_pin++)
+ dev_priv->hpd_stats[hpd_pin].hpd_mark = HPD_DISABLED;
+
+ list_for_each_entry(connector, &mode_config->connector_list, head) {
+ struct intel_connector *intel_connector = to_intel_connector(connector);
+ uint8_t polled;
+
+ /* mst connector */
+ if (!intel_connector->encoder)
+ continue;
+
+ hpd_pin = intel_connector->encoder->hpd_pin;
+ if (hpd_pin == HPD_NONE)
+ continue;
+
+ polled = intel_connector->polled;
+
+ if (connector->polled != polled)
+ DRM_DEBUG_KMS("%sabling HPD on connector %s (pin %d)\n",
+ polled == DRM_CONNECTOR_POLL_HPD ? "en" : "dis",
+ connector->name, hpd_pin);
+ connector->polled = polled;
+
+ if (connector->polled == DRM_CONNECTOR_POLL_HPD)
+ dev_priv->hpd_stats[hpd_pin].hpd_mark = HPD_ENABLED;
+ }
+
+ if (dev_priv->display.hpd_irq_setup)
+ dev_priv->display.hpd_irq_setup(dev);
+}
+
static irqreturn_t i965_irq_handler(int irq, void *arg)
{
struct drm_device *dev = arg;
@@ -4293,35 +4333,11 @@ static void intel_hpd_irq_reenable_work(struct work_struct *work)
container_of(work, typeof(*dev_priv),
hotplug_reenable_work.work);
struct drm_device *dev = dev_priv->dev;
- struct drm_mode_config *mode_config = &dev->mode_config;
- int i;
intel_runtime_pm_get(dev_priv);
spin_lock_irq(&dev_priv->irq_lock);
- for (i = (HPD_NONE + 1); i < HPD_NUM_PINS; i++) {
- struct drm_connector *connector;
-
- if (dev_priv->hpd_stats[i].hpd_mark != HPD_DISABLED)
- continue;
-
- dev_priv->hpd_stats[i].hpd_mark = HPD_ENABLED;
-
- list_for_each_entry(connector, &mode_config->connector_list, head) {
- struct intel_connector *intel_connector = to_intel_connector(connector);
-
- if (intel_connector->encoder->hpd_pin == i) {
- if (connector->polled != intel_connector->polled)
- DRM_DEBUG_DRIVER("Reenabling HPD on connector %s\n",
- connector->name);
- connector->polled = intel_connector->polled;
- if (!connector->polled)
- connector->polled = DRM_CONNECTOR_POLL_HPD;
- }
- }
- }
- if (dev_priv->display.hpd_irq_setup)
- dev_priv->display.hpd_irq_setup(dev);
+ intel_hpd_irq_setup(dev);
spin_unlock_irq(&dev_priv->irq_lock);
intel_runtime_pm_put(dev_priv);
@@ -4454,28 +4470,15 @@ void intel_irq_init(struct drm_i915_private *dev_priv)
void intel_hpd_init(struct drm_i915_private *dev_priv)
{
struct drm_device *dev = dev_priv->dev;
- struct drm_mode_config *mode_config = &dev->mode_config;
- struct drm_connector *connector;
- int i;
+ int hpd_pin;
- for (i = 1; i < HPD_NUM_PINS; i++) {
- dev_priv->hpd_stats[i].hpd_cnt = 0;
- dev_priv->hpd_stats[i].hpd_mark = HPD_ENABLED;
- }
- list_for_each_entry(connector, &mode_config->connector_list, head) {
- struct intel_connector *intel_connector = to_intel_connector(connector);
- connector->polled = intel_connector->polled;
- if (connector->encoder && !connector->polled && I915_HAS_HOTPLUG(dev) && intel_connector->encoder->hpd_pin > HPD_NONE)
- connector->polled = DRM_CONNECTOR_POLL_HPD;
- if (intel_connector->mst_port)
- connector->polled = DRM_CONNECTOR_POLL_HPD;
- }
-
- /* Interrupt setup is already guaranteed to be single-threaded, this is
- * just to make the assert_spin_locked checks happy. */
spin_lock_irq(&dev_priv->irq_lock);
- if (dev_priv->display.hpd_irq_setup)
- dev_priv->display.hpd_irq_setup(dev);
+
+ for (hpd_pin = 1; hpd_pin < HPD_NUM_PINS; hpd_pin++)
+ dev_priv->hpd_stats[hpd_pin].hpd_cnt = 0;
+
+ intel_hpd_irq_setup(dev);
+
spin_unlock_irq(&dev_priv->irq_lock);
}
--
2.0.5
More information about the Intel-gfx
mailing list