Commit b6ca3eee authored by Ville Syrjälä's avatar Ville Syrjälä

drm/i915: Nuke dev_priv->irq_port[]

Instead of looping over ports and hpd_pins, let's loop over
the encoders when doing hotplug processing. And instead of
depending on dev_priv->irq_port[] to tell us whether the
encoder has the ->hpd_pulse() hook or not, we can just
check for that directly. So we can just nuke irq_port[] entirely.
Signed-off-by: default avatarVille Syrjälä <ville.syrjala@linux.intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20180705164357.28512-5-ville.syrjala@linux.intel.comReviewed-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
parent 1a4313d1
...@@ -299,7 +299,6 @@ struct i915_hotplug { ...@@ -299,7 +299,6 @@ struct i915_hotplug {
u32 event_bits; u32 event_bits;
struct delayed_work reenable_work; struct delayed_work reenable_work;
struct intel_digital_port *irq_port[I915_MAX_PORTS];
u32 long_port_mask; u32 long_port_mask;
u32 short_port_mask; u32 short_port_mask;
struct work_struct dig_port_work; struct work_struct dig_port_work;
......
...@@ -3639,7 +3639,6 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port) ...@@ -3639,7 +3639,6 @@ void intel_ddi_init(struct drm_i915_private *dev_priv, enum port port)
goto err; goto err;
intel_dig_port->hpd_pulse = intel_dp_hpd_pulse; intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
dev_priv->hotplug.irq_port[port] = intel_dig_port;
} }
/* In theory we don't need the encoder->type check, but leave it just in /* In theory we don't need the encoder->type check, but leave it just in
......
...@@ -6464,7 +6464,6 @@ bool intel_dp_init(struct drm_i915_private *dev_priv, ...@@ -6464,7 +6464,6 @@ bool intel_dp_init(struct drm_i915_private *dev_priv,
intel_encoder->port = port; intel_encoder->port = port;
intel_dig_port->hpd_pulse = intel_dp_hpd_pulse; intel_dig_port->hpd_pulse = intel_dp_hpd_pulse;
dev_priv->hotplug.irq_port[port] = intel_dig_port;
if (port != PORT_A) if (port != PORT_A)
intel_infoframe_init(intel_dig_port); intel_infoframe_init(intel_dig_port);
......
...@@ -304,6 +304,8 @@ struct intel_panel { ...@@ -304,6 +304,8 @@ struct intel_panel {
} backlight; } backlight;
}; };
struct intel_digital_port;
/* /*
* This structure serves as a translation layer between the generic HDCP code * This structure serves as a translation layer between the generic HDCP code
* and the bus-specific code. What that means is that HDCP over HDMI differs * and the bus-specific code. What that means is that HDCP over HDMI differs
......
...@@ -301,13 +301,18 @@ bool intel_encoder_hotplug(struct intel_encoder *encoder, ...@@ -301,13 +301,18 @@ bool intel_encoder_hotplug(struct intel_encoder *encoder,
return true; return true;
} }
static bool intel_encoder_has_hpd_pulse(struct intel_encoder *encoder)
{
return intel_encoder_is_dig_port(encoder) &&
enc_to_dig_port(&encoder->base)->hpd_pulse != NULL;
}
static void i915_digport_work_func(struct work_struct *work) static void i915_digport_work_func(struct work_struct *work)
{ {
struct drm_i915_private *dev_priv = struct drm_i915_private *dev_priv =
container_of(work, struct drm_i915_private, hotplug.dig_port_work); container_of(work, struct drm_i915_private, hotplug.dig_port_work);
u32 long_port_mask, short_port_mask; u32 long_port_mask, short_port_mask;
struct intel_digital_port *intel_dig_port; struct intel_encoder *encoder;
int i;
u32 old_bits = 0; u32 old_bits = 0;
spin_lock_irq(&dev_priv->irq_lock); spin_lock_irq(&dev_priv->irq_lock);
...@@ -317,27 +322,27 @@ static void i915_digport_work_func(struct work_struct *work) ...@@ -317,27 +322,27 @@ static void i915_digport_work_func(struct work_struct *work)
dev_priv->hotplug.short_port_mask = 0; dev_priv->hotplug.short_port_mask = 0;
spin_unlock_irq(&dev_priv->irq_lock); spin_unlock_irq(&dev_priv->irq_lock);
for (i = 0; i < I915_MAX_PORTS; i++) { for_each_intel_encoder(&dev_priv->drm, encoder) {
bool valid = false; struct intel_digital_port *dig_port;
bool long_hpd = false; enum port port = encoder->port;
intel_dig_port = dev_priv->hotplug.irq_port[i]; bool long_hpd, short_hpd;
if (!intel_dig_port || !intel_dig_port->hpd_pulse) enum irqreturn ret;
if (!intel_encoder_has_hpd_pulse(encoder))
continue; continue;
if (long_port_mask & (1 << i)) { long_hpd = long_port_mask & BIT(port);
valid = true; short_hpd = short_port_mask & BIT(port);
long_hpd = true;
} else if (short_port_mask & (1 << i)) if (!long_hpd && !short_hpd)
valid = true; continue;
if (valid) { dig_port = enc_to_dig_port(&encoder->base);
enum irqreturn ret;
ret = intel_dig_port->hpd_pulse(intel_dig_port, long_hpd); ret = dig_port->hpd_pulse(dig_port, long_hpd);
if (ret == IRQ_NONE) { if (ret == IRQ_NONE) {
/* fall back to old school hpd */ /* fall back to old school hpd */
old_bits |= (1 << intel_dig_port->base.hpd_pin); old_bits |= BIT(encoder->hpd_pin);
}
} }
} }
...@@ -418,26 +423,24 @@ static void i915_hotplug_work_func(struct work_struct *work) ...@@ -418,26 +423,24 @@ static void i915_hotplug_work_func(struct work_struct *work)
void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
u32 pin_mask, u32 long_mask) u32 pin_mask, u32 long_mask)
{ {
int i; struct intel_encoder *encoder;
enum port port;
bool storm_detected = false; bool storm_detected = false;
bool queue_dig = false, queue_hp = false; bool queue_dig = false, queue_hp = false;
bool is_dig_port;
if (!pin_mask) if (!pin_mask)
return; return;
spin_lock(&dev_priv->irq_lock); spin_lock(&dev_priv->irq_lock);
for_each_hpd_pin(i) { for_each_intel_encoder(&dev_priv->drm, encoder) {
enum hpd_pin i = encoder->hpd_pin;
bool has_hpd_pulse = intel_encoder_has_hpd_pulse(encoder);
if (!(BIT(i) & pin_mask)) if (!(BIT(i) & pin_mask))
continue; continue;
port = intel_hpd_pin_to_port(dev_priv, i); if (has_hpd_pulse) {
is_dig_port = port != PORT_NONE &&
dev_priv->hotplug.irq_port[port];
if (is_dig_port) {
bool long_hpd = long_mask & BIT(i); bool long_hpd = long_mask & BIT(i);
enum port port = encoder->port;
DRM_DEBUG_DRIVER("digital hpd port %c - %s\n", port_name(port), DRM_DEBUG_DRIVER("digital hpd port %c - %s\n", port_name(port),
long_hpd ? "long" : "short"); long_hpd ? "long" : "short");
...@@ -470,7 +473,7 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, ...@@ -470,7 +473,7 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
if (dev_priv->hotplug.stats[i].state != HPD_ENABLED) if (dev_priv->hotplug.stats[i].state != HPD_ENABLED)
continue; continue;
if (!is_dig_port) { if (!has_hpd_pulse) {
dev_priv->hotplug.event_bits |= BIT(i); dev_priv->hotplug.event_bits |= BIT(i);
queue_hp = true; queue_hp = true;
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment