Commit 1d245987 authored by Jani Nikula's avatar Jani Nikula Committed by Daniel Vetter

drm/i915: make g4x_digital_port_connected return boolean status

We should not be hitting any of the default cases in
g4x_digital_port_connected, so add MISSING_CASE annotation and return
boolean status. The current behaviour is just cargo culting from the
days of yonder when the display port support was added to i915.
Signed-off-by: default avatarJani Nikula <jani.nikula@intel.com>
Reviewed-by: default avatarDurgadoss R <durgadoss.r@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent b93433cc
...@@ -4525,14 +4525,14 @@ static bool ibx_digital_port_connected(struct drm_i915_private *dev_priv, ...@@ -4525,14 +4525,14 @@ static bool ibx_digital_port_connected(struct drm_i915_private *dev_priv,
return I915_READ(SDEISR) & bit; return I915_READ(SDEISR) & bit;
} }
static int g4x_digital_port_connected(struct drm_device *dev, static bool g4x_digital_port_connected(struct drm_device *dev,
struct intel_digital_port *intel_dig_port) struct intel_digital_port *port)
{ {
struct drm_i915_private *dev_priv = dev->dev_private; struct drm_i915_private *dev_priv = dev->dev_private;
uint32_t bit; uint32_t bit;
if (IS_VALLEYVIEW(dev)) { if (IS_VALLEYVIEW(dev)) {
switch (intel_dig_port->port) { switch (port->port) {
case PORT_B: case PORT_B:
bit = PORTB_HOTPLUG_LIVE_STATUS_VLV; bit = PORTB_HOTPLUG_LIVE_STATUS_VLV;
break; break;
...@@ -4543,10 +4543,11 @@ static int g4x_digital_port_connected(struct drm_device *dev, ...@@ -4543,10 +4543,11 @@ static int g4x_digital_port_connected(struct drm_device *dev,
bit = PORTD_HOTPLUG_LIVE_STATUS_VLV; bit = PORTD_HOTPLUG_LIVE_STATUS_VLV;
break; break;
default: default:
return -EINVAL; MISSING_CASE(port->port);
return false;
} }
} else { } else {
switch (intel_dig_port->port) { switch (port->port) {
case PORT_B: case PORT_B:
bit = PORTB_HOTPLUG_LIVE_STATUS_G4X; bit = PORTB_HOTPLUG_LIVE_STATUS_G4X;
break; break;
...@@ -4557,13 +4558,12 @@ static int g4x_digital_port_connected(struct drm_device *dev, ...@@ -4557,13 +4558,12 @@ static int g4x_digital_port_connected(struct drm_device *dev,
bit = PORTD_HOTPLUG_LIVE_STATUS_G4X; bit = PORTD_HOTPLUG_LIVE_STATUS_G4X;
break; break;
default: default:
return -EINVAL; MISSING_CASE(port->port);
return false;
} }
} }
if ((I915_READ(PORT_HOTPLUG_STAT) & bit) == 0) return I915_READ(PORT_HOTPLUG_STAT) & bit;
return 0;
return 1;
} }
static enum drm_connector_status static enum drm_connector_status
...@@ -4584,7 +4584,6 @@ g4x_dp_detect(struct intel_dp *intel_dp) ...@@ -4584,7 +4584,6 @@ g4x_dp_detect(struct intel_dp *intel_dp)
{ {
struct drm_device *dev = intel_dp_to_dev(intel_dp); struct drm_device *dev = intel_dp_to_dev(intel_dp);
struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp); struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
int ret;
/* Can't disconnect eDP, but you can close the lid... */ /* Can't disconnect eDP, but you can close the lid... */
if (is_edp(intel_dp)) { if (is_edp(intel_dp)) {
...@@ -4596,10 +4595,7 @@ g4x_dp_detect(struct intel_dp *intel_dp) ...@@ -4596,10 +4595,7 @@ g4x_dp_detect(struct intel_dp *intel_dp)
return status; return status;
} }
ret = g4x_digital_port_connected(dev, intel_dig_port); if (!g4x_digital_port_connected(dev, intel_dig_port))
if (ret == -EINVAL)
return connector_status_unknown;
else if (ret == 0)
return connector_status_disconnected; return connector_status_disconnected;
return intel_dp_detect_dpcd(intel_dp); return intel_dp_detect_dpcd(intel_dp);
...@@ -5066,7 +5062,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd) ...@@ -5066,7 +5062,7 @@ intel_dp_hpd_pulse(struct intel_digital_port *intel_dig_port, bool long_hpd)
if (!ibx_digital_port_connected(dev_priv, intel_dig_port)) if (!ibx_digital_port_connected(dev_priv, intel_dig_port))
goto mst_fail; goto mst_fail;
} else { } else {
if (g4x_digital_port_connected(dev, intel_dig_port) != 1) if (!g4x_digital_port_connected(dev, intel_dig_port))
goto mst_fail; goto mst_fail;
} }
......
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