diff options
| author | Keith Packard <keithp@keithp.com> | 2009-05-06 14:51:10 -0400 |
|---|---|---|
| committer | Keith Packard <keithp@keithp.com> | 2009-06-18 18:54:08 -0400 |
| commit | c8110e52b753f3d105604df84ac06cd6d1645409 (patch) | |
| tree | 6631108e20f72a8a7eac5bca35694a5aeb2f4cca /drivers/gpu | |
| parent | a4fc5ed69817c73e32571ad7837bb707f9890009 (diff) | |
drm/i915: Use hotplug callback to retrain DP link
When a DP monitor is plugged back in, it needs to be retrained if it was
active before.
Signed-off-by: Keith Packard <keithp@keithp.com>
Diffstat (limited to 'drivers/gpu')
| -rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 15 |
1 files changed, 13 insertions, 2 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index c57cdab4f4a6..3f8d7b449e70 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
| @@ -47,6 +47,7 @@ struct intel_dp_priv { | |||
| 47 | uint32_t save_DP; | 47 | uint32_t save_DP; |
| 48 | uint8_t save_link_configuration[DP_LINK_CONFIGURATION_SIZE]; | 48 | uint8_t save_link_configuration[DP_LINK_CONFIGURATION_SIZE]; |
| 49 | bool has_audio; | 49 | bool has_audio; |
| 50 | int dpms_mode; | ||
| 50 | uint8_t link_bw; | 51 | uint8_t link_bw; |
| 51 | uint8_t lane_count; | 52 | uint8_t lane_count; |
| 52 | uint8_t dpcd[4]; | 53 | uint8_t dpcd[4]; |
| @@ -527,6 +528,7 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode) | |||
| 527 | if (!(dp_reg & DP_PORT_EN)) | 528 | if (!(dp_reg & DP_PORT_EN)) |
| 528 | intel_dp_link_train(intel_output, dp_priv->DP, dp_priv->link_configuration); | 529 | intel_dp_link_train(intel_output, dp_priv->DP, dp_priv->link_configuration); |
| 529 | } | 530 | } |
| 531 | dp_priv->dpms_mode = mode; | ||
| 530 | } | 532 | } |
| 531 | 533 | ||
| 532 | /* | 534 | /* |
| @@ -902,7 +904,6 @@ intel_dp_restore(struct drm_connector *connector) | |||
| 902 | intel_dp_link_down(intel_output, dp_priv->save_DP); | 904 | intel_dp_link_down(intel_output, dp_priv->save_DP); |
| 903 | } | 905 | } |
| 904 | 906 | ||
| 905 | #if 0 | ||
| 906 | /* | 907 | /* |
| 907 | * According to DP spec | 908 | * According to DP spec |
| 908 | * 5.1.2: | 909 | * 5.1.2: |
| @@ -929,7 +930,6 @@ intel_dp_check_link_status(struct intel_output *intel_output) | |||
| 929 | if (!intel_channel_eq_ok(link_status, dp_priv->lane_count)) | 930 | if (!intel_channel_eq_ok(link_status, dp_priv->lane_count)) |
| 930 | intel_dp_link_train(intel_output, dp_priv->DP, dp_priv->link_configuration); | 931 | intel_dp_link_train(intel_output, dp_priv->DP, dp_priv->link_configuration); |
| 931 | } | 932 | } |
| 932 | #endif | ||
| 933 | 933 | ||
| 934 | /** | 934 | /** |
| 935 | * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect DP connection. | 935 | * Uses CRT_HOTPLUG_EN and CRT_HOTPLUG_STAT to detect DP connection. |
| @@ -1044,6 +1044,15 @@ static const struct drm_encoder_funcs intel_dp_enc_funcs = { | |||
| 1044 | }; | 1044 | }; |
| 1045 | 1045 | ||
| 1046 | void | 1046 | void |
| 1047 | intel_dp_hot_plug(struct intel_output *intel_output) | ||
| 1048 | { | ||
| 1049 | struct intel_dp_priv *dp_priv = intel_output->dev_priv; | ||
| 1050 | |||
| 1051 | if (dp_priv->dpms_mode == DRM_MODE_DPMS_ON) | ||
| 1052 | intel_dp_check_link_status(intel_output); | ||
| 1053 | } | ||
| 1054 | |||
| 1055 | void | ||
| 1047 | intel_dp_init(struct drm_device *dev, int output_reg) | 1056 | intel_dp_init(struct drm_device *dev, int output_reg) |
| 1048 | { | 1057 | { |
| 1049 | struct drm_i915_private *dev_priv = dev->dev_private; | 1058 | struct drm_i915_private *dev_priv = dev->dev_private; |
| @@ -1071,6 +1080,7 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
| 1071 | dp_priv->intel_output = intel_output; | 1080 | dp_priv->intel_output = intel_output; |
| 1072 | dp_priv->output_reg = output_reg; | 1081 | dp_priv->output_reg = output_reg; |
| 1073 | dp_priv->has_audio = false; | 1082 | dp_priv->has_audio = false; |
| 1083 | dp_priv->dpms_mode = DRM_MODE_DPMS_ON; | ||
| 1074 | intel_output->dev_priv = dp_priv; | 1084 | intel_output->dev_priv = dp_priv; |
| 1075 | 1085 | ||
| 1076 | drm_encoder_init(dev, &intel_output->enc, &intel_dp_enc_funcs, | 1086 | drm_encoder_init(dev, &intel_output->enc, &intel_dp_enc_funcs, |
| @@ -1086,6 +1096,7 @@ intel_dp_init(struct drm_device *dev, int output_reg) | |||
| 1086 | (output_reg == DP_B) ? "DPDDC-B" : | 1096 | (output_reg == DP_B) ? "DPDDC-B" : |
| 1087 | (output_reg == DP_C) ? "DPDDC-C" : "DPDDC-D"); | 1097 | (output_reg == DP_C) ? "DPDDC-C" : "DPDDC-D"); |
| 1088 | intel_output->ddc_bus = &dp_priv->adapter; | 1098 | intel_output->ddc_bus = &dp_priv->adapter; |
| 1099 | intel_output->hot_plug = intel_dp_hot_plug; | ||
| 1089 | 1100 | ||
| 1090 | /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written | 1101 | /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written |
| 1091 | * 0xd. Failure to do so will result in spurious interrupts being | 1102 | * 0xd. Failure to do so will result in spurious interrupts being |
