Skip to content

Commit

Permalink
drm/i915: add port field to struct intel_dp and use it
Browse files Browse the repository at this point in the history
This will be needed for Haswell, but already has its uses here.

This patch started as a small patch written patch by Shobhit Kumar,
but it has changed so much that none of its original lines remain.

Credits-to: Shobhit Kumar <shobhit.kumar@intel.com>
Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
  • Loading branch information
Paulo Zanoni authored and Daniel Vetter committed Jul 25, 2012
1 parent 47ea754 commit ab9d7c3
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 34 deletions.
20 changes: 10 additions & 10 deletions drivers/gpu/drm/i915/intel_display.c
Original file line number Diff line number Diff line change
Expand Up @@ -6764,10 +6764,10 @@ static void intel_setup_outputs(struct drm_device *dev)
dpd_is_edp = intel_dpd_is_edp(dev);

if (has_edp_a(dev))
intel_dp_init(dev, DP_A);
intel_dp_init(dev, DP_A, PORT_A);

if (dpd_is_edp && (I915_READ(PCH_DP_D) & DP_DETECTED))
intel_dp_init(dev, PCH_DP_D);
intel_dp_init(dev, PCH_DP_D, PORT_D);
}

intel_crt_init(dev);
Expand Down Expand Up @@ -6800,7 +6800,7 @@ static void intel_setup_outputs(struct drm_device *dev)
if (!found)
intel_hdmi_init(dev, HDMIB, PORT_B);
if (!found && (I915_READ(PCH_DP_B) & DP_DETECTED))
intel_dp_init(dev, PCH_DP_B);
intel_dp_init(dev, PCH_DP_B, PORT_B);
}

if (I915_READ(HDMIC) & PORT_DETECTED)
Expand All @@ -6810,10 +6810,10 @@ static void intel_setup_outputs(struct drm_device *dev)
intel_hdmi_init(dev, HDMID, PORT_D);

if (I915_READ(PCH_DP_C) & DP_DETECTED)
intel_dp_init(dev, PCH_DP_C);
intel_dp_init(dev, PCH_DP_C, PORT_C);

if (!dpd_is_edp && (I915_READ(PCH_DP_D) & DP_DETECTED))
intel_dp_init(dev, PCH_DP_D);
intel_dp_init(dev, PCH_DP_D, PORT_D);
} else if (IS_VALLEYVIEW(dev)) {
int found;

Expand All @@ -6823,15 +6823,15 @@ static void intel_setup_outputs(struct drm_device *dev)
if (!found)
intel_hdmi_init(dev, SDVOB, PORT_B);
if (!found && (I915_READ(DP_B) & DP_DETECTED))
intel_dp_init(dev, DP_B);
intel_dp_init(dev, DP_B, PORT_B);
}

if (I915_READ(SDVOC) & PORT_DETECTED)
intel_hdmi_init(dev, SDVOC, PORT_C);

/* Shares lanes with HDMI on SDVOC */
if (I915_READ(DP_C) & DP_DETECTED)
intel_dp_init(dev, DP_C);
intel_dp_init(dev, DP_C, PORT_C);
} else if (SUPPORTS_DIGITAL_OUTPUTS(dev)) {
bool found = false;

Expand All @@ -6845,7 +6845,7 @@ static void intel_setup_outputs(struct drm_device *dev)

if (!found && SUPPORTS_INTEGRATED_DP(dev)) {
DRM_DEBUG_KMS("probing DP_B\n");
intel_dp_init(dev, DP_B);
intel_dp_init(dev, DP_B, PORT_B);
}
}

Expand All @@ -6864,14 +6864,14 @@ static void intel_setup_outputs(struct drm_device *dev)
}
if (SUPPORTS_INTEGRATED_DP(dev)) {
DRM_DEBUG_KMS("probing DP_C\n");
intel_dp_init(dev, DP_C);
intel_dp_init(dev, DP_C, PORT_C);
}
}

if (SUPPORTS_INTEGRATED_DP(dev) &&
(I915_READ(DP_D) & DP_DETECTED)) {
DRM_DEBUG_KMS("probing DP_D\n");
intel_dp_init(dev, DP_D);
intel_dp_init(dev, DP_D, PORT_D);
}
} else if (IS_GEN2(dev))
intel_dvo_init(dev);
Expand Down
44 changes: 21 additions & 23 deletions drivers/gpu/drm/i915/intel_dp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2426,7 +2426,7 @@ intel_dp_add_properties(struct intel_dp *intel_dp, struct drm_connector *connect
}

void
intel_dp_init(struct drm_device *dev, int output_reg)
intel_dp_init(struct drm_device *dev, int output_reg, enum port port)
{
struct drm_i915_private *dev_priv = dev->dev_private;
struct drm_connector *connector;
Expand All @@ -2441,6 +2441,7 @@ intel_dp_init(struct drm_device *dev, int output_reg)
return;

intel_dp->output_reg = output_reg;
intel_dp->port = port;
intel_dp->dpms_mode = -1;

intel_connector = kzalloc(sizeof(struct intel_connector), GFP_KERNEL);
Expand Down Expand Up @@ -2486,28 +2487,25 @@ intel_dp_init(struct drm_device *dev, int output_reg)
drm_sysfs_connector_add(connector);

/* Set up the DDC bus. */
switch (output_reg) {
case DP_A:
name = "DPDDC-A";
break;
case DP_B:
case PCH_DP_B:
dev_priv->hotplug_supported_mask |=
DPB_HOTPLUG_INT_STATUS;
name = "DPDDC-B";
break;
case DP_C:
case PCH_DP_C:
dev_priv->hotplug_supported_mask |=
DPC_HOTPLUG_INT_STATUS;
name = "DPDDC-C";
break;
case DP_D:
case PCH_DP_D:
dev_priv->hotplug_supported_mask |=
DPD_HOTPLUG_INT_STATUS;
name = "DPDDC-D";
break;
switch (port) {
case PORT_A:
name = "DPDDC-A";
break;
case PORT_B:
dev_priv->hotplug_supported_mask |= DPB_HOTPLUG_INT_STATUS;
name = "DPDDC-B";
break;
case PORT_C:
dev_priv->hotplug_supported_mask |= DPC_HOTPLUG_INT_STATUS;
name = "DPDDC-C";
break;
case PORT_D:
dev_priv->hotplug_supported_mask |= DPD_HOTPLUG_INT_STATUS;
name = "DPDDC-D";
break;
default:
WARN(1, "Invalid port %c\n", port_name(port));
break;
}

intel_dp_i2c_init(intel_dp, intel_connector, name);
Expand Down
4 changes: 3 additions & 1 deletion drivers/gpu/drm/i915/intel_drv.h
Original file line number Diff line number Diff line change
Expand Up @@ -306,6 +306,7 @@ struct intel_dp {
uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE];
bool has_audio;
enum hdmi_force_audio force_audio;
enum port port;
uint32_t color_range;
int dpms_mode;
uint8_t link_bw;
Expand Down Expand Up @@ -375,7 +376,8 @@ extern void intel_tv_init(struct drm_device *dev);
extern void intel_mark_busy(struct drm_device *dev,
struct drm_i915_gem_object *obj);
extern bool intel_lvds_init(struct drm_device *dev);
extern void intel_dp_init(struct drm_device *dev, int dp_reg);
extern void intel_dp_init(struct drm_device *dev, int output_reg,
enum port port);
void
intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
struct drm_display_mode *adjusted_mode);
Expand Down

0 comments on commit ab9d7c3

Please sign in to comment.