diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2010-09-15 07:03:59 -0400 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2010-09-15 11:45:25 -0400 |
commit | 373a3cf744c774478f44921c50011b896ab08f9d (patch) | |
tree | 78725e96b9d17190c05baa50a96bf1afdcab0e7f | |
parent | 2f551c84563df2bf144a819993b2d729c66583ee (diff) |
drm/i915: call drm_encoder_init first
Later initialisation of the encoder often requires that
drm_encoder_init() has already been called, for instance, initialiasing
the DDC buses.
Yet another recent regression, as 819f3fb7 depended upon these fixes
which I missed when cherry-picking.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | drivers/gpu/drm/i915/intel_crt.c | 4 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_dvo.c | 5 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_hdmi.c | 6 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_sdvo.c | 15 |
4 files changed, 18 insertions, 12 deletions
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index 0403ec9e164a..2353da625d25 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -548,6 +548,10 @@ void intel_crt_init(struct drm_device *dev) | |||
548 | if (!intel_encoder->ddc_bus) { | 548 | if (!intel_encoder->ddc_bus) { |
549 | dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " | 549 | dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " |
550 | "failed.\n"); | 550 | "failed.\n"); |
551 | drm_connector_cleanup(&intel_connector->base); | ||
552 | kfree(intel_connector); | ||
553 | drm_encoder_cleanup(&intel_encoder->base); | ||
554 | kfree(intel_encoder); | ||
551 | return; | 555 | return; |
552 | } | 556 | } |
553 | 557 | ||
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c index 7de7d1a68c07..d8a586b41275 100644 --- a/drivers/gpu/drm/i915/intel_dvo.c +++ b/drivers/gpu/drm/i915/intel_dvo.c | |||
@@ -360,6 +360,8 @@ void intel_dvo_init(struct drm_device *dev) | |||
360 | } | 360 | } |
361 | 361 | ||
362 | intel_encoder = &intel_dvo->base; | 362 | intel_encoder = &intel_dvo->base; |
363 | drm_encoder_init(dev, &intel_encoder->base, | ||
364 | &intel_dvo_enc_funcs, encoder_type); | ||
363 | 365 | ||
364 | /* Set up the DDC bus */ | 366 | /* Set up the DDC bus */ |
365 | intel_encoder->ddc_bus = intel_i2c_create(intel_encoder, | 367 | intel_encoder->ddc_bus = intel_i2c_create(intel_encoder, |
@@ -428,8 +430,6 @@ void intel_dvo_init(struct drm_device *dev) | |||
428 | connector->interlace_allowed = false; | 430 | connector->interlace_allowed = false; |
429 | connector->doublescan_allowed = false; | 431 | connector->doublescan_allowed = false; |
430 | 432 | ||
431 | drm_encoder_init(dev, &intel_encoder->base, | ||
432 | &intel_dvo_enc_funcs, encoder_type); | ||
433 | drm_encoder_helper_add(&intel_encoder->base, | 433 | drm_encoder_helper_add(&intel_encoder->base, |
434 | &intel_dvo_helper_funcs); | 434 | &intel_dvo_helper_funcs); |
435 | 435 | ||
@@ -456,6 +456,7 @@ void intel_dvo_init(struct drm_device *dev) | |||
456 | if (i2cbus != NULL) | 456 | if (i2cbus != NULL) |
457 | intel_i2c_destroy(i2cbus); | 457 | intel_i2c_destroy(i2cbus); |
458 | free_intel: | 458 | free_intel: |
459 | drm_encoder_cleanup(&intel_encoder->base); | ||
459 | kfree(intel_dvo); | 460 | kfree(intel_dvo); |
460 | kfree(intel_connector); | 461 | kfree(intel_connector); |
461 | } | 462 | } |
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c index 93d5b61bf5bd..783924c7682a 100644 --- a/drivers/gpu/drm/i915/intel_hdmi.c +++ b/drivers/gpu/drm/i915/intel_hdmi.c | |||
@@ -228,6 +228,9 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) | |||
228 | } | 228 | } |
229 | 229 | ||
230 | intel_encoder = &intel_hdmi->base; | 230 | intel_encoder = &intel_hdmi->base; |
231 | drm_encoder_init(dev, &intel_encoder->base, &intel_hdmi_enc_funcs, | ||
232 | DRM_MODE_ENCODER_TMDS); | ||
233 | |||
231 | connector = &intel_connector->base; | 234 | connector = &intel_connector->base; |
232 | drm_connector_init(dev, connector, &intel_hdmi_connector_funcs, | 235 | drm_connector_init(dev, connector, &intel_hdmi_connector_funcs, |
233 | DRM_MODE_CONNECTOR_HDMIA); | 236 | DRM_MODE_CONNECTOR_HDMIA); |
@@ -272,8 +275,6 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) | |||
272 | 275 | ||
273 | intel_hdmi->sdvox_reg = sdvox_reg; | 276 | intel_hdmi->sdvox_reg = sdvox_reg; |
274 | 277 | ||
275 | drm_encoder_init(dev, &intel_encoder->base, &intel_hdmi_enc_funcs, | ||
276 | DRM_MODE_ENCODER_TMDS); | ||
277 | drm_encoder_helper_add(&intel_encoder->base, &intel_hdmi_helper_funcs); | 278 | drm_encoder_helper_add(&intel_encoder->base, &intel_hdmi_helper_funcs); |
278 | 279 | ||
279 | intel_connector_attach_encoder(intel_connector, intel_encoder); | 280 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
@@ -291,6 +292,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg) | |||
291 | return; | 292 | return; |
292 | 293 | ||
293 | err_connector: | 294 | err_connector: |
295 | drm_encoder_cleanup(&intel_encoder->base); | ||
294 | drm_connector_cleanup(connector); | 296 | drm_connector_cleanup(connector); |
295 | kfree(intel_hdmi); | 297 | kfree(intel_hdmi); |
296 | kfree(intel_connector); | 298 | kfree(intel_connector); |
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c index d2b4a6a28405..f7030e481083 100644 --- a/drivers/gpu/drm/i915/intel_sdvo.c +++ b/drivers/gpu/drm/i915/intel_sdvo.c | |||
@@ -2552,6 +2552,8 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) | |||
2552 | 2552 | ||
2553 | intel_encoder = &intel_sdvo->base; | 2553 | intel_encoder = &intel_sdvo->base; |
2554 | intel_encoder->type = INTEL_OUTPUT_SDVO; | 2554 | intel_encoder->type = INTEL_OUTPUT_SDVO; |
2555 | /* encoder type will be decided later */ | ||
2556 | drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, 0); | ||
2555 | 2557 | ||
2556 | if (HAS_PCH_SPLIT(dev)) { | 2558 | if (HAS_PCH_SPLIT(dev)) { |
2557 | i2c_reg = PCH_GPIOE; | 2559 | i2c_reg = PCH_GPIOE; |
@@ -2606,31 +2608,29 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) | |||
2606 | /* Wrap with our custom algo which switches to DDC mode */ | 2608 | /* Wrap with our custom algo which switches to DDC mode */ |
2607 | intel_encoder->ddc_bus->algo = &intel_sdvo_i2c_bit_algo; | 2609 | intel_encoder->ddc_bus->algo = &intel_sdvo_i2c_bit_algo; |
2608 | 2610 | ||
2609 | /* encoder type will be decided later */ | ||
2610 | drm_encoder_init(dev, &intel_encoder->base, &intel_sdvo_enc_funcs, 0); | ||
2611 | drm_encoder_helper_add(&intel_encoder->base, &intel_sdvo_helper_funcs); | 2611 | drm_encoder_helper_add(&intel_encoder->base, &intel_sdvo_helper_funcs); |
2612 | 2612 | ||
2613 | /* In default case sdvo lvds is false */ | 2613 | /* In default case sdvo lvds is false */ |
2614 | if (!intel_sdvo_get_capabilities(intel_sdvo, &intel_sdvo->caps)) | 2614 | if (!intel_sdvo_get_capabilities(intel_sdvo, &intel_sdvo->caps)) |
2615 | goto err_enc; | 2615 | goto err_i2c; |
2616 | 2616 | ||
2617 | if (intel_sdvo_output_setup(intel_sdvo, | 2617 | if (intel_sdvo_output_setup(intel_sdvo, |
2618 | intel_sdvo->caps.output_flags) != true) { | 2618 | intel_sdvo->caps.output_flags) != true) { |
2619 | DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n", | 2619 | DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n", |
2620 | IS_SDVOB(sdvo_reg) ? 'B' : 'C'); | 2620 | IS_SDVOB(sdvo_reg) ? 'B' : 'C'); |
2621 | goto err_enc; | 2621 | goto err_i2c; |
2622 | } | 2622 | } |
2623 | 2623 | ||
2624 | intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo, sdvo_reg); | 2624 | intel_sdvo_select_ddc_bus(dev_priv, intel_sdvo, sdvo_reg); |
2625 | 2625 | ||
2626 | /* Set the input timing to the screen. Assume always input 0. */ | 2626 | /* Set the input timing to the screen. Assume always input 0. */ |
2627 | if (!intel_sdvo_set_target_input(intel_sdvo)) | 2627 | if (!intel_sdvo_set_target_input(intel_sdvo)) |
2628 | goto err_enc; | 2628 | goto err_i2c; |
2629 | 2629 | ||
2630 | if (!intel_sdvo_get_input_pixel_clock_range(intel_sdvo, | 2630 | if (!intel_sdvo_get_input_pixel_clock_range(intel_sdvo, |
2631 | &intel_sdvo->pixel_clock_min, | 2631 | &intel_sdvo->pixel_clock_min, |
2632 | &intel_sdvo->pixel_clock_max)) | 2632 | &intel_sdvo->pixel_clock_max)) |
2633 | goto err_enc; | 2633 | goto err_i2c; |
2634 | 2634 | ||
2635 | DRM_DEBUG_KMS("%s device VID/DID: %02X:%02X.%02X, " | 2635 | DRM_DEBUG_KMS("%s device VID/DID: %02X:%02X.%02X, " |
2636 | "clock range %dMHz - %dMHz, " | 2636 | "clock range %dMHz - %dMHz, " |
@@ -2650,14 +2650,13 @@ bool intel_sdvo_init(struct drm_device *dev, int sdvo_reg) | |||
2650 | (SDVO_OUTPUT_TMDS1 | SDVO_OUTPUT_RGB1) ? 'Y' : 'N'); | 2650 | (SDVO_OUTPUT_TMDS1 | SDVO_OUTPUT_RGB1) ? 'Y' : 'N'); |
2651 | return true; | 2651 | return true; |
2652 | 2652 | ||
2653 | err_enc: | ||
2654 | drm_encoder_cleanup(&intel_encoder->base); | ||
2655 | err_i2c: | 2653 | err_i2c: |
2656 | if (intel_encoder->ddc_bus != NULL) | 2654 | if (intel_encoder->ddc_bus != NULL) |
2657 | intel_i2c_destroy(intel_encoder->ddc_bus); | 2655 | intel_i2c_destroy(intel_encoder->ddc_bus); |
2658 | if (intel_encoder->i2c_bus != NULL) | 2656 | if (intel_encoder->i2c_bus != NULL) |
2659 | intel_i2c_destroy(intel_encoder->i2c_bus); | 2657 | intel_i2c_destroy(intel_encoder->i2c_bus); |
2660 | err_inteloutput: | 2658 | err_inteloutput: |
2659 | drm_encoder_cleanup(&intel_encoder->base); | ||
2661 | kfree(intel_sdvo); | 2660 | kfree(intel_sdvo); |
2662 | 2661 | ||
2663 | return false; | 2662 | return false; |