aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2013-06-12 16:27:24 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2013-06-28 08:14:17 -0400
commited92f0b239ac971edc509169ae3d6955fbe0a188 (patch)
tree50709dc511e4c9c6d0ca2adabb969c083f64cd72
parentacd8db100ed5220fe8043f91cdc20155325542a9 (diff)
drm/i915: extract intel_edp_init_connector
Because intel_dp_init_connector is too big for my poor little brain. No functional changes. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Reviewed-by: Zoltan Nyul <zoltan.nyul@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c151
1 files changed, 82 insertions, 69 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 6975d4bdad6b..30514e58269b 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -2955,6 +2955,86 @@ intel_dp_init_panel_power_sequencer_registers(struct drm_device *dev,
2955 I915_READ(pp_div_reg)); 2955 I915_READ(pp_div_reg));
2956} 2956}
2957 2957
2958static bool intel_edp_init_connector(struct intel_dp *intel_dp,
2959 struct intel_connector *intel_connector)
2960{
2961 struct drm_connector *connector = &intel_connector->base;
2962 struct intel_digital_port *intel_dig_port = dp_to_dig_port(intel_dp);
2963 struct drm_device *dev = intel_dig_port->base.base.dev;
2964 struct drm_i915_private *dev_priv = dev->dev_private;
2965 struct drm_display_mode *fixed_mode = NULL;
2966 struct edp_power_seq power_seq = { 0 };
2967 bool has_dpcd;
2968 struct drm_display_mode *scan;
2969 struct edid *edid;
2970
2971 if (!is_edp(intel_dp))
2972 return true;
2973
2974 intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq);
2975
2976 /* Cache DPCD and EDID for edp. */
2977 ironlake_edp_panel_vdd_on(intel_dp);
2978 has_dpcd = intel_dp_get_dpcd(intel_dp);
2979 ironlake_edp_panel_vdd_off(intel_dp, false);
2980
2981 if (has_dpcd) {
2982 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11)
2983 dev_priv->no_aux_handshake =
2984 intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
2985 DP_NO_AUX_HANDSHAKE_LINK_TRAINING;
2986 } else {
2987 /* if this fails, presume the device is a ghost */
2988 DRM_INFO("failed to retrieve link info, disabling eDP\n");
2989 intel_dp_encoder_destroy(&intel_dig_port->base.base);
2990 intel_dp_destroy(connector);
2991 return false;
2992 }
2993
2994 /* We now know it's not a ghost, init power sequence regs. */
2995 intel_dp_init_panel_power_sequencer_registers(dev, intel_dp,
2996 &power_seq);
2997
2998 ironlake_edp_panel_vdd_on(intel_dp);
2999 edid = drm_get_edid(connector, &intel_dp->adapter);
3000 if (edid) {
3001 if (drm_add_edid_modes(connector, edid)) {
3002 drm_mode_connector_update_edid_property(connector,
3003 edid);
3004 drm_edid_to_eld(connector, edid);
3005 } else {
3006 kfree(edid);
3007 edid = ERR_PTR(-EINVAL);
3008 }
3009 } else {
3010 edid = ERR_PTR(-ENOENT);
3011 }
3012 intel_connector->edid = edid;
3013
3014 /* prefer fixed mode from EDID if available */
3015 list_for_each_entry(scan, &connector->probed_modes, head) {
3016 if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
3017 fixed_mode = drm_mode_duplicate(dev, scan);
3018 break;
3019 }
3020 }
3021
3022 /* fallback to VBT if available for eDP */
3023 if (!fixed_mode && dev_priv->vbt.lfp_lvds_vbt_mode) {
3024 fixed_mode = drm_mode_duplicate(dev,
3025 dev_priv->vbt.lfp_lvds_vbt_mode);
3026 if (fixed_mode)
3027 fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
3028 }
3029
3030 ironlake_edp_panel_vdd_off(intel_dp, false);
3031
3032 intel_panel_init(&intel_connector->panel, fixed_mode);
3033 intel_panel_setup_backlight(connector);
3034
3035 return true;
3036}
3037
2958void 3038void
2959intel_dp_init_connector(struct intel_digital_port *intel_dig_port, 3039intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
2960 struct intel_connector *intel_connector) 3040 struct intel_connector *intel_connector)
@@ -2964,8 +3044,6 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
2964 struct intel_encoder *intel_encoder = &intel_dig_port->base; 3044 struct intel_encoder *intel_encoder = &intel_dig_port->base;
2965 struct drm_device *dev = intel_encoder->base.dev; 3045 struct drm_device *dev = intel_encoder->base.dev;
2966 struct drm_i915_private *dev_priv = dev->dev_private; 3046 struct drm_i915_private *dev_priv = dev->dev_private;
2967 struct drm_display_mode *fixed_mode = NULL;
2968 struct edp_power_seq power_seq = { 0 };
2969 enum port port = intel_dig_port->port; 3047 enum port port = intel_dig_port->port;
2970 const char *name = NULL; 3048 const char *name = NULL;
2971 int type; 3049 int type;
@@ -3066,75 +3144,10 @@ intel_dp_init_connector(struct intel_digital_port *intel_dig_port,
3066 BUG(); 3144 BUG();
3067 } 3145 }
3068 3146
3069 if (is_edp(intel_dp))
3070 intel_dp_init_panel_power_sequencer(dev, intel_dp, &power_seq);
3071
3072 intel_dp_i2c_init(intel_dp, intel_connector, name); 3147 intel_dp_i2c_init(intel_dp, intel_connector, name);
3073 3148
3074 /* Cache DPCD and EDID for edp. */ 3149 if (!intel_edp_init_connector(intel_dp, intel_connector))
3075 if (is_edp(intel_dp)) { 3150 return;
3076 bool ret;
3077 struct drm_display_mode *scan;
3078 struct edid *edid;
3079
3080 ironlake_edp_panel_vdd_on(intel_dp);
3081 ret = intel_dp_get_dpcd(intel_dp);
3082 ironlake_edp_panel_vdd_off(intel_dp, false);
3083
3084 if (ret) {
3085 if (intel_dp->dpcd[DP_DPCD_REV] >= 0x11)
3086 dev_priv->no_aux_handshake =
3087 intel_dp->dpcd[DP_MAX_DOWNSPREAD] &
3088 DP_NO_AUX_HANDSHAKE_LINK_TRAINING;
3089 } else {
3090 /* if this fails, presume the device is a ghost */
3091 DRM_INFO("failed to retrieve link info, disabling eDP\n");
3092 intel_dp_encoder_destroy(&intel_encoder->base);
3093 intel_dp_destroy(connector);
3094 return;
3095 }
3096
3097 /* We now know it's not a ghost, init power sequence regs. */
3098 intel_dp_init_panel_power_sequencer_registers(dev, intel_dp,
3099 &power_seq);
3100
3101 ironlake_edp_panel_vdd_on(intel_dp);
3102 edid = drm_get_edid(connector, &intel_dp->adapter);
3103 if (edid) {
3104 if (drm_add_edid_modes(connector, edid)) {
3105 drm_mode_connector_update_edid_property(connector, edid);
3106 drm_edid_to_eld(connector, edid);
3107 } else {
3108 kfree(edid);
3109 edid = ERR_PTR(-EINVAL);
3110 }
3111 } else {
3112 edid = ERR_PTR(-ENOENT);
3113 }
3114 intel_connector->edid = edid;
3115
3116 /* prefer fixed mode from EDID if available */
3117 list_for_each_entry(scan, &connector->probed_modes, head) {
3118 if ((scan->type & DRM_MODE_TYPE_PREFERRED)) {
3119 fixed_mode = drm_mode_duplicate(dev, scan);
3120 break;
3121 }
3122 }
3123
3124 /* fallback to VBT if available for eDP */
3125 if (!fixed_mode && dev_priv->vbt.lfp_lvds_vbt_mode) {
3126 fixed_mode = drm_mode_duplicate(dev, dev_priv->vbt.lfp_lvds_vbt_mode);
3127 if (fixed_mode)
3128 fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
3129 }
3130
3131 ironlake_edp_panel_vdd_off(intel_dp, false);
3132 }
3133
3134 if (is_edp(intel_dp)) {
3135 intel_panel_init(&intel_connector->panel, fixed_mode);
3136 intel_panel_setup_backlight(connector);
3137 }
3138 3151
3139 intel_dp_add_properties(intel_dp, connector); 3152 intel_dp_add_properties(intel_dp, connector);
3140 3153