diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_hdmi.c')
| -rw-r--r-- | drivers/gpu/drm/i915/intel_hdmi.c | 55 |
1 files changed, 52 insertions, 3 deletions
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index c33451aec1bd..f04dbbe7d400 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
| @@ -82,7 +82,7 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode) | |||
| 82 | /* HW workaround, need to toggle enable bit off and on for 12bpc, but | 82 | /* HW workaround, need to toggle enable bit off and on for 12bpc, but |
| 83 | * we do this anyway which shows more stable in testing. | 83 | * we do this anyway which shows more stable in testing. |
| 84 | */ | 84 | */ |
| 85 | if (IS_IGDNG(dev)) { | 85 | if (IS_IRONLAKE(dev)) { |
| 86 | I915_WRITE(hdmi_priv->sdvox_reg, temp & ~SDVO_ENABLE); | 86 | I915_WRITE(hdmi_priv->sdvox_reg, temp & ~SDVO_ENABLE); |
| 87 | POSTING_READ(hdmi_priv->sdvox_reg); | 87 | POSTING_READ(hdmi_priv->sdvox_reg); |
| 88 | } | 88 | } |
| @@ -99,7 +99,7 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode) | |||
| 99 | /* HW workaround, need to write this twice for issue that may result | 99 | /* HW workaround, need to write this twice for issue that may result |
| 100 | * in first write getting masked. | 100 | * in first write getting masked. |
| 101 | */ | 101 | */ |
| 102 | if (IS_IGDNG(dev)) { | 102 | if (IS_IRONLAKE(dev)) { |
| 103 | I915_WRITE(hdmi_priv->sdvox_reg, temp); | 103 | I915_WRITE(hdmi_priv->sdvox_reg, temp); |
| 104 | POSTING_READ(hdmi_priv->sdvox_reg); | 104 | POSTING_READ(hdmi_priv->sdvox_reg); |
| 105 | } | 105 | } |
| @@ -225,7 +225,52 @@ static const struct drm_encoder_funcs intel_hdmi_enc_funcs = { | |||
| 225 | .destroy = intel_hdmi_enc_destroy, | 225 | .destroy = intel_hdmi_enc_destroy, |
| 226 | }; | 226 | }; |
| 227 | 227 | ||
| 228 | 228 | /* | |
| 229 | * Enumerate the child dev array parsed from VBT to check whether | ||
| 230 | * the given HDMI is present. | ||
| 231 | * If it is present, return 1. | ||
| 232 | * If it is not present, return false. | ||
| 233 | * If no child dev is parsed from VBT, it assumes that the given | ||
| 234 | * HDMI is present. | ||
| 235 | */ | ||
| 236 | static int hdmi_is_present_in_vbt(struct drm_device *dev, int hdmi_reg) | ||
| 237 | { | ||
| 238 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
| 239 | struct child_device_config *p_child; | ||
| 240 | int i, hdmi_port, ret; | ||
| 241 | |||
| 242 | if (!dev_priv->child_dev_num) | ||
| 243 | return 1; | ||
| 244 | |||
| 245 | if (hdmi_reg == SDVOB) | ||
| 246 | hdmi_port = DVO_B; | ||
| 247 | else if (hdmi_reg == SDVOC) | ||
| 248 | hdmi_port = DVO_C; | ||
| 249 | else if (hdmi_reg == HDMIB) | ||
| 250 | hdmi_port = DVO_B; | ||
| 251 | else if (hdmi_reg == HDMIC) | ||
| 252 | hdmi_port = DVO_C; | ||
| 253 | else if (hdmi_reg == HDMID) | ||
| 254 | hdmi_port = DVO_D; | ||
| 255 | else | ||
| 256 | return 0; | ||
| 257 | |||
| 258 | ret = 0; | ||
| 259 | for (i = 0; i < dev_priv->child_dev_num; i++) { | ||
| 260 | p_child = dev_priv->child_dev + i; | ||
| 261 | /* | ||
| 262 | * If the device type is not HDMI, continue. | ||
| 263 | */ | ||
| 264 | if (p_child->device_type != DEVICE_TYPE_HDMI) | ||
| 265 | continue; | ||
| 266 | /* Find the HDMI port */ | ||
| 267 | if (p_child->dvo_port == hdmi_port) { | ||
| 268 | ret = 1; | ||
| 269 | break; | ||
| 270 | } | ||
| 271 | } | ||
| 272 | return ret; | ||
| 273 | } | ||
| 229 | void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) | 274 | void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) |
| 230 | { | 275 | { |
| 231 | struct drm_i915_private *dev_priv = dev->dev_private; | 276 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -233,6 +278,10 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) | |||
| 233 | struct intel_output *intel_output; | 278 | struct intel_output *intel_output; |
| 234 | struct intel_hdmi_priv *hdmi_priv; | 279 | struct intel_hdmi_priv *hdmi_priv; |
| 235 | 280 | ||
| 281 | if (!hdmi_is_present_in_vbt(dev, sdvox_reg)) { | ||
| 282 | DRM_DEBUG_KMS("HDMI is not present. Ignored it \n"); | ||
| 283 | return; | ||
| 284 | } | ||
| 236 | intel_output = kcalloc(sizeof(struct intel_output) + | 285 | intel_output = kcalloc(sizeof(struct intel_output) + |
| 237 | sizeof(struct intel_hdmi_priv), 1, GFP_KERNEL); | 286 | sizeof(struct intel_hdmi_priv), 1, GFP_KERNEL); |
| 238 | if (!intel_output) | 287 | if (!intel_output) |
