Commit 256cfdde authored by Rodrigo Vivi's avatar Rodrigo Vivi

drm/i915: Simplify hpd pin to port

We will soon need to make that pin port association per
platform, so let's try to simplify it beforehand.

Also we are moving the backwards port to pin
here as well so let's use a standardized way.

One extra possibility here would be to add a
MISSING_CASE along with PORT_NONE, but I don't want
to change this behaviour for now.

Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Signed-off-by: default avatarRodrigo Vivi <rodrigo.vivi@intel.com>
Reviewed-by: default avatarDhinakaran Pandiyan <dhinakaran.pandiyan@intel.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20170811182650.14327-1-rodrigo.vivi@intel.com
parent c1b56c52
...@@ -3194,7 +3194,7 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, ...@@ -3194,7 +3194,7 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
void intel_hpd_init(struct drm_i915_private *dev_priv); void intel_hpd_init(struct drm_i915_private *dev_priv);
void intel_hpd_init_work(struct drm_i915_private *dev_priv); void intel_hpd_init_work(struct drm_i915_private *dev_priv);
void intel_hpd_cancel_work(struct drm_i915_private *dev_priv); void intel_hpd_cancel_work(struct drm_i915_private *dev_priv);
bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port *port); enum port intel_hpd_pin_to_port(enum hpd_pin pin);
bool intel_hpd_disable(struct drm_i915_private *dev_priv, enum hpd_pin pin); bool intel_hpd_disable(struct drm_i915_private *dev_priv, enum hpd_pin pin);
void intel_hpd_enable(struct drm_i915_private *dev_priv, enum hpd_pin pin); void intel_hpd_enable(struct drm_i915_private *dev_priv, enum hpd_pin pin);
......
...@@ -1501,7 +1501,8 @@ static void intel_get_hpd_pins(u32 *pin_mask, u32 *long_mask, ...@@ -1501,7 +1501,8 @@ static void intel_get_hpd_pins(u32 *pin_mask, u32 *long_mask,
*pin_mask |= BIT(i); *pin_mask |= BIT(i);
if (!intel_hpd_pin_to_port(i, &port)) port = intel_hpd_pin_to_port(i);
if (port == PORT_NONE)
continue; continue;
if (long_pulse_detect(port, dig_hotplug_reg)) if (long_pulse_detect(port, dig_hotplug_reg))
......
...@@ -4578,7 +4578,7 @@ static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv, ...@@ -4578,7 +4578,7 @@ static bool bxt_digital_port_connected(struct drm_i915_private *dev_priv,
enum port port; enum port port;
u32 bit; u32 bit;
intel_hpd_pin_to_port(intel_encoder->hpd_pin, &port); port = intel_hpd_pin_to_port(intel_encoder->hpd_pin);
switch (port) { switch (port) {
case PORT_A: case PORT_A:
bit = BXT_DE_PORT_HP_DDIA; bit = BXT_DE_PORT_HP_DDIA;
......
...@@ -76,26 +76,28 @@ ...@@ -76,26 +76,28 @@
* it will use i915_hotplug_work_func where this logic is handled. * it will use i915_hotplug_work_func where this logic is handled.
*/ */
bool intel_hpd_pin_to_port(enum hpd_pin pin, enum port *port) /**
* intel_hpd_port - return port hard associated with certain pin.
* @pin: the hpd pin to get associated port
*
* Return port that is associatade with @pin and PORT_NONE if no port is
* hard associated with that @pin.
*/
enum port intel_hpd_pin_to_port(enum hpd_pin pin)
{ {
switch (pin) { switch (pin) {
case HPD_PORT_A: case HPD_PORT_A:
*port = PORT_A; return PORT_A;
return true;
case HPD_PORT_B: case HPD_PORT_B:
*port = PORT_B; return PORT_B;
return true;
case HPD_PORT_C: case HPD_PORT_C:
*port = PORT_C; return PORT_C;
return true;
case HPD_PORT_D: case HPD_PORT_D:
*port = PORT_D; return PORT_D;
return true;
case HPD_PORT_E: case HPD_PORT_E:
*port = PORT_E; return PORT_E;
return true;
default: default:
return false; /* no hpd */ return PORT_NONE; /* no port for this pin */
} }
} }
...@@ -389,8 +391,9 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv, ...@@ -389,8 +391,9 @@ void intel_hpd_irq_handler(struct drm_i915_private *dev_priv,
if (!(BIT(i) & pin_mask)) if (!(BIT(i) & pin_mask))
continue; continue;
is_dig_port = intel_hpd_pin_to_port(i, &port) && port = intel_hpd_pin_to_port(i);
dev_priv->hotplug.irq_port[port]; is_dig_port = port != PORT_NONE &&
dev_priv->hotplug.irq_port[port];
if (is_dig_port) { if (is_dig_port) {
bool long_hpd = long_mask & BIT(i); bool long_hpd = long_mask & BIT(i);
......
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