diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_lvds.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_lvds.c | 67 |
1 files changed, 15 insertions, 52 deletions
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index f9f3b0885ba5..e6c5d985ea0a 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -42,10 +42,6 @@ | |||
42 | #include <linux/acpi.h> | 42 | #include <linux/acpi.h> |
43 | 43 | ||
44 | /* Private structure for the integrated LVDS support */ | 44 | /* Private structure for the integrated LVDS support */ |
45 | struct intel_lvds_connector { | ||
46 | struct intel_connector base; | ||
47 | }; | ||
48 | |||
49 | struct intel_lvds_pps { | 45 | struct intel_lvds_pps { |
50 | /* 100us units */ | 46 | /* 100us units */ |
51 | int t1_t2; | 47 | int t1_t2; |
@@ -70,7 +66,7 @@ struct intel_lvds_encoder { | |||
70 | struct intel_lvds_pps init_pps; | 66 | struct intel_lvds_pps init_pps; |
71 | u32 init_lvds_val; | 67 | u32 init_lvds_val; |
72 | 68 | ||
73 | struct intel_lvds_connector *attached_connector; | 69 | struct intel_connector *attached_connector; |
74 | }; | 70 | }; |
75 | 71 | ||
76 | static struct intel_lvds_encoder *to_lvds_encoder(struct drm_encoder *encoder) | 72 | static struct intel_lvds_encoder *to_lvds_encoder(struct drm_encoder *encoder) |
@@ -78,11 +74,6 @@ static struct intel_lvds_encoder *to_lvds_encoder(struct drm_encoder *encoder) | |||
78 | return container_of(encoder, struct intel_lvds_encoder, base.base); | 74 | return container_of(encoder, struct intel_lvds_encoder, base.base); |
79 | } | 75 | } |
80 | 76 | ||
81 | static struct intel_lvds_connector *to_lvds_connector(struct drm_connector *connector) | ||
82 | { | ||
83 | return container_of(connector, struct intel_lvds_connector, base.base); | ||
84 | } | ||
85 | |||
86 | bool intel_lvds_port_enabled(struct drm_i915_private *dev_priv, | 77 | bool intel_lvds_port_enabled(struct drm_i915_private *dev_priv, |
87 | i915_reg_t lvds_reg, enum pipe *pipe) | 78 | i915_reg_t lvds_reg, enum pipe *pipe) |
88 | { | 79 | { |
@@ -396,7 +387,7 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder, | |||
396 | struct intel_lvds_encoder *lvds_encoder = | 387 | struct intel_lvds_encoder *lvds_encoder = |
397 | to_lvds_encoder(&intel_encoder->base); | 388 | to_lvds_encoder(&intel_encoder->base); |
398 | struct intel_connector *intel_connector = | 389 | struct intel_connector *intel_connector = |
399 | &lvds_encoder->attached_connector->base; | 390 | lvds_encoder->attached_connector; |
400 | struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; | 391 | struct drm_display_mode *adjusted_mode = &pipe_config->base.adjusted_mode; |
401 | struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc); | 392 | struct intel_crtc *intel_crtc = to_intel_crtc(pipe_config->base.crtc); |
402 | unsigned int lvds_bpp; | 393 | unsigned int lvds_bpp; |
@@ -418,6 +409,8 @@ static bool intel_lvds_compute_config(struct intel_encoder *intel_encoder, | |||
418 | pipe_config->pipe_bpp = lvds_bpp; | 409 | pipe_config->pipe_bpp = lvds_bpp; |
419 | } | 410 | } |
420 | 411 | ||
412 | pipe_config->output_format = INTEL_OUTPUT_FORMAT_RGB; | ||
413 | |||
421 | /* | 414 | /* |
422 | * We have timings from the BIOS for the panel, put them in | 415 | * We have timings from the BIOS for the panel, put them in |
423 | * to the adjusted mode. The CRTC will be set up for this mode, | 416 | * to the adjusted mode. The CRTC will be set up for this mode, |
@@ -461,15 +454,15 @@ intel_lvds_detect(struct drm_connector *connector, bool force) | |||
461 | */ | 454 | */ |
462 | static int intel_lvds_get_modes(struct drm_connector *connector) | 455 | static int intel_lvds_get_modes(struct drm_connector *connector) |
463 | { | 456 | { |
464 | struct intel_lvds_connector *lvds_connector = to_lvds_connector(connector); | 457 | struct intel_connector *intel_connector = to_intel_connector(connector); |
465 | struct drm_device *dev = connector->dev; | 458 | struct drm_device *dev = connector->dev; |
466 | struct drm_display_mode *mode; | 459 | struct drm_display_mode *mode; |
467 | 460 | ||
468 | /* use cached edid if we have one */ | 461 | /* use cached edid if we have one */ |
469 | if (!IS_ERR_OR_NULL(lvds_connector->base.edid)) | 462 | if (!IS_ERR_OR_NULL(intel_connector->edid)) |
470 | return drm_add_edid_modes(connector, lvds_connector->base.edid); | 463 | return drm_add_edid_modes(connector, intel_connector->edid); |
471 | 464 | ||
472 | mode = drm_mode_duplicate(dev, lvds_connector->base.panel.fixed_mode); | 465 | mode = drm_mode_duplicate(dev, intel_connector->panel.fixed_mode); |
473 | if (mode == NULL) | 466 | if (mode == NULL) |
474 | return 0; | 467 | return 0; |
475 | 468 | ||
@@ -477,27 +470,6 @@ static int intel_lvds_get_modes(struct drm_connector *connector) | |||
477 | return 1; | 470 | return 1; |
478 | } | 471 | } |
479 | 472 | ||
480 | /** | ||
481 | * intel_lvds_destroy - unregister and free LVDS structures | ||
482 | * @connector: connector to free | ||
483 | * | ||
484 | * Unregister the DDC bus for this connector then free the driver private | ||
485 | * structure. | ||
486 | */ | ||
487 | static void intel_lvds_destroy(struct drm_connector *connector) | ||
488 | { | ||
489 | struct intel_lvds_connector *lvds_connector = | ||
490 | to_lvds_connector(connector); | ||
491 | |||
492 | if (!IS_ERR_OR_NULL(lvds_connector->base.edid)) | ||
493 | kfree(lvds_connector->base.edid); | ||
494 | |||
495 | intel_panel_fini(&lvds_connector->base.panel); | ||
496 | |||
497 | drm_connector_cleanup(connector); | ||
498 | kfree(connector); | ||
499 | } | ||
500 | |||
501 | static const struct drm_connector_helper_funcs intel_lvds_connector_helper_funcs = { | 473 | static const struct drm_connector_helper_funcs intel_lvds_connector_helper_funcs = { |
502 | .get_modes = intel_lvds_get_modes, | 474 | .get_modes = intel_lvds_get_modes, |
503 | .mode_valid = intel_lvds_mode_valid, | 475 | .mode_valid = intel_lvds_mode_valid, |
@@ -511,7 +483,7 @@ static const struct drm_connector_funcs intel_lvds_connector_funcs = { | |||
511 | .atomic_set_property = intel_digital_connector_atomic_set_property, | 483 | .atomic_set_property = intel_digital_connector_atomic_set_property, |
512 | .late_register = intel_connector_register, | 484 | .late_register = intel_connector_register, |
513 | .early_unregister = intel_connector_unregister, | 485 | .early_unregister = intel_connector_unregister, |
514 | .destroy = intel_lvds_destroy, | 486 | .destroy = intel_connector_destroy, |
515 | .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, | 487 | .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, |
516 | .atomic_duplicate_state = intel_digital_connector_duplicate_state, | 488 | .atomic_duplicate_state = intel_digital_connector_duplicate_state, |
517 | }; | 489 | }; |
@@ -802,8 +774,7 @@ static bool compute_is_dual_link_lvds(struct intel_lvds_encoder *lvds_encoder) | |||
802 | return i915_modparams.lvds_channel_mode == 2; | 774 | return i915_modparams.lvds_channel_mode == 2; |
803 | 775 | ||
804 | /* single channel LVDS is limited to 112 MHz */ | 776 | /* single channel LVDS is limited to 112 MHz */ |
805 | if (lvds_encoder->attached_connector->base.panel.fixed_mode->clock | 777 | if (lvds_encoder->attached_connector->panel.fixed_mode->clock > 112999) |
806 | > 112999) | ||
807 | return true; | 778 | return true; |
808 | 779 | ||
809 | if (dmi_check_system(intel_dual_link_lvds)) | 780 | if (dmi_check_system(intel_dual_link_lvds)) |
@@ -858,7 +829,6 @@ void intel_lvds_init(struct drm_i915_private *dev_priv) | |||
858 | struct drm_device *dev = &dev_priv->drm; | 829 | struct drm_device *dev = &dev_priv->drm; |
859 | struct intel_lvds_encoder *lvds_encoder; | 830 | struct intel_lvds_encoder *lvds_encoder; |
860 | struct intel_encoder *intel_encoder; | 831 | struct intel_encoder *intel_encoder; |
861 | struct intel_lvds_connector *lvds_connector; | ||
862 | struct intel_connector *intel_connector; | 832 | struct intel_connector *intel_connector; |
863 | struct drm_connector *connector; | 833 | struct drm_connector *connector; |
864 | struct drm_encoder *encoder; | 834 | struct drm_encoder *encoder; |
@@ -911,23 +881,16 @@ void intel_lvds_init(struct drm_i915_private *dev_priv) | |||
911 | if (!lvds_encoder) | 881 | if (!lvds_encoder) |
912 | return; | 882 | return; |
913 | 883 | ||
914 | lvds_connector = kzalloc(sizeof(*lvds_connector), GFP_KERNEL); | 884 | intel_connector = intel_connector_alloc(); |
915 | if (!lvds_connector) { | 885 | if (!intel_connector) { |
916 | kfree(lvds_encoder); | ||
917 | return; | ||
918 | } | ||
919 | |||
920 | if (intel_connector_init(&lvds_connector->base) < 0) { | ||
921 | kfree(lvds_connector); | ||
922 | kfree(lvds_encoder); | 886 | kfree(lvds_encoder); |
923 | return; | 887 | return; |
924 | } | 888 | } |
925 | 889 | ||
926 | lvds_encoder->attached_connector = lvds_connector; | 890 | lvds_encoder->attached_connector = intel_connector; |
927 | 891 | ||
928 | intel_encoder = &lvds_encoder->base; | 892 | intel_encoder = &lvds_encoder->base; |
929 | encoder = &intel_encoder->base; | 893 | encoder = &intel_encoder->base; |
930 | intel_connector = &lvds_connector->base; | ||
931 | connector = &intel_connector->base; | 894 | connector = &intel_connector->base; |
932 | drm_connector_init(dev, &intel_connector->base, &intel_lvds_connector_funcs, | 895 | drm_connector_init(dev, &intel_connector->base, &intel_lvds_connector_funcs, |
933 | DRM_MODE_CONNECTOR_LVDS); | 896 | DRM_MODE_CONNECTOR_LVDS); |
@@ -1008,7 +971,7 @@ void intel_lvds_init(struct drm_i915_private *dev_priv) | |||
1008 | } else { | 971 | } else { |
1009 | edid = ERR_PTR(-ENOENT); | 972 | edid = ERR_PTR(-ENOENT); |
1010 | } | 973 | } |
1011 | lvds_connector->base.edid = edid; | 974 | intel_connector->edid = edid; |
1012 | 975 | ||
1013 | list_for_each_entry(scan, &connector->probed_modes, head) { | 976 | list_for_each_entry(scan, &connector->probed_modes, head) { |
1014 | if (scan->type & DRM_MODE_TYPE_PREFERRED) { | 977 | if (scan->type & DRM_MODE_TYPE_PREFERRED) { |
@@ -1072,6 +1035,6 @@ failed: | |||
1072 | drm_connector_cleanup(connector); | 1035 | drm_connector_cleanup(connector); |
1073 | drm_encoder_cleanup(encoder); | 1036 | drm_encoder_cleanup(encoder); |
1074 | kfree(lvds_encoder); | 1037 | kfree(lvds_encoder); |
1075 | kfree(lvds_connector); | 1038 | intel_connector_free(intel_connector); |
1076 | return; | 1039 | return; |
1077 | } | 1040 | } |