aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_sdvo.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/i915/intel_sdvo.c')
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 26a6a4d0d078..123afd357611 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -444,13 +444,16 @@ static bool intel_sdvo_write_cmd(struct intel_sdvo *intel_sdvo, u8 cmd,
444 struct i2c_msg *msgs; 444 struct i2c_msg *msgs;
445 int i, ret = true; 445 int i, ret = true;
446 446
447 /* Would be simpler to allocate both in one go ? */
447 buf = (u8 *)kzalloc(args_len * 2 + 2, GFP_KERNEL); 448 buf = (u8 *)kzalloc(args_len * 2 + 2, GFP_KERNEL);
448 if (!buf) 449 if (!buf)
449 return false; 450 return false;
450 451
451 msgs = kcalloc(args_len + 3, sizeof(*msgs), GFP_KERNEL); 452 msgs = kcalloc(args_len + 3, sizeof(*msgs), GFP_KERNEL);
452 if (!msgs) 453 if (!msgs) {
454 kfree(buf);
453 return false; 455 return false;
456 }
454 457
455 intel_sdvo_debug_write(intel_sdvo, cmd, args, args_len); 458 intel_sdvo_debug_write(intel_sdvo, cmd, args, args_len);
456 459
@@ -1689,6 +1692,7 @@ static bool intel_sdvo_detect_hdmi_audio(struct drm_connector *connector)
1689 edid = intel_sdvo_get_edid(connector); 1692 edid = intel_sdvo_get_edid(connector);
1690 if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL) 1693 if (edid != NULL && edid->input & DRM_EDID_INPUT_DIGITAL)
1691 has_audio = drm_detect_monitor_audio(edid); 1694 has_audio = drm_detect_monitor_audio(edid);
1695 kfree(edid);
1692 1696
1693 return has_audio; 1697 return has_audio;
1694} 1698}
@@ -2569,7 +2573,6 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2569 hotplug_mask = intel_sdvo->is_sdvob ? 2573 hotplug_mask = intel_sdvo->is_sdvob ?
2570 SDVOB_HOTPLUG_INT_STATUS_I915 : SDVOC_HOTPLUG_INT_STATUS_I915; 2574 SDVOB_HOTPLUG_INT_STATUS_I915 : SDVOC_HOTPLUG_INT_STATUS_I915;
2571 } 2575 }
2572 dev_priv->hotplug_supported_mask |= hotplug_mask;
2573 2576
2574 drm_encoder_helper_add(&intel_encoder->base, &intel_sdvo_helper_funcs); 2577 drm_encoder_helper_add(&intel_encoder->base, &intel_sdvo_helper_funcs);
2575 2578
@@ -2577,14 +2580,6 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2577 if (!intel_sdvo_get_capabilities(intel_sdvo, &intel_sdvo->caps)) 2580 if (!intel_sdvo_get_capabilities(intel_sdvo, &intel_sdvo->caps))
2578 goto err; 2581 goto err;
2579 2582
2580 /* Set up hotplug command - note paranoia about contents of reply.
2581 * We assume that the hardware is in a sane state, and only touch
2582 * the bits we think we understand.
2583 */
2584 intel_sdvo_get_value(intel_sdvo, SDVO_CMD_GET_ACTIVE_HOT_PLUG,
2585 &intel_sdvo->hotplug_active, 2);
2586 intel_sdvo->hotplug_active[0] &= ~0x3;
2587
2588 if (intel_sdvo_output_setup(intel_sdvo, 2583 if (intel_sdvo_output_setup(intel_sdvo,
2589 intel_sdvo->caps.output_flags) != true) { 2584 intel_sdvo->caps.output_flags) != true) {
2590 DRM_DEBUG_KMS("SDVO output failed to setup on %s\n", 2585 DRM_DEBUG_KMS("SDVO output failed to setup on %s\n",
@@ -2592,6 +2587,12 @@ bool intel_sdvo_init(struct drm_device *dev, uint32_t sdvo_reg, bool is_sdvob)
2592 goto err; 2587 goto err;
2593 } 2588 }
2594 2589
2590 /* Only enable the hotplug irq if we need it, to work around noisy
2591 * hotplug lines.
2592 */
2593 if (intel_sdvo->hotplug_active[0])
2594 dev_priv->hotplug_supported_mask |= hotplug_mask;
2595
2595 intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo, sdvo_reg); 2596 intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo, sdvo_reg);
2596 2597
2597 /* Set the input timing to the screen. Assume always input 0. */ 2598 /* Set the input timing to the screen. Assume always input 0. */