aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDaniel Vetter <daniel.vetter@ffwll.ch>2014-03-21 18:22:35 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2014-03-28 13:25:18 -0400
commit4da98541d898d45255edf874b16687aad0ff90cd (patch)
treece06da71c49d797fc5761fe066dc4a3b18200a5c
parent698b3135acb94e838a33a69f1a7a684fe0d90734 (diff)
drm/i915: add locking to fixed panel edid probing
With the recent addition of locking checks in commit 62ff94a5492175759546f8bc61383189d6b49122 Author: Daniel Vetter <daniel.vetter@ffwll.ch> AuthorDate: Thu Jan 23 22:18:47 2014 +0100 drm/crtc-helper: remove LOCKING from kerneldoc drm_add_edid_modes started to WARN about the mode_config.mutex not being held in the lvds and dp initialization code. Now since this is init code locking is fairly redudant if it wouldn't be for the drm core registering sysfs files a bit early. And the locking WARNINGs nicely enforce that indeed all access to the mode lists are properly protected. And a full audit shows that only i915 and gma500 touch the modes lists at init time. Hence I've opted to wrap up this entire mode detection sequence for fixed panels with the mode_config mutex for both lvds and edp outputs. Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c2
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c5
2 files changed, 7 insertions, 0 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index bbb1327644d4..7ca38e11e695 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -3646,6 +3646,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
3646 /* We now know it's not a ghost, init power sequence regs. */ 3646 /* We now know it's not a ghost, init power sequence regs. */
3647 intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, power_seq); 3647 intel_dp_init_panel_power_sequencer_registers(dev, intel_dp, power_seq);
3648 3648
3649 mutex_lock(&dev->mode_config.mutex);
3649 edid = drm_get_edid(connector, &intel_dp->aux.ddc); 3650 edid = drm_get_edid(connector, &intel_dp->aux.ddc);
3650 if (edid) { 3651 if (edid) {
3651 if (drm_add_edid_modes(connector, edid)) { 3652 if (drm_add_edid_modes(connector, edid)) {
@@ -3676,6 +3677,7 @@ static bool intel_edp_init_connector(struct intel_dp *intel_dp,
3676 if (fixed_mode) 3677 if (fixed_mode)
3677 fixed_mode->type |= DRM_MODE_TYPE_PREFERRED; 3678 fixed_mode->type |= DRM_MODE_TYPE_PREFERRED;
3678 } 3679 }
3680 mutex_unlock(&dev->mode_config.mutex);
3679 3681
3680 intel_panel_init(&intel_connector->panel, fixed_mode, NULL); 3682 intel_panel_init(&intel_connector->panel, fixed_mode, NULL);
3681 intel_panel_setup_backlight(connector); 3683 intel_panel_setup_backlight(connector);
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index ef5e5661efb2..f1ecf916474a 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -1002,6 +1002,7 @@ void intel_lvds_init(struct drm_device *dev)
1002 * Attempt to get the fixed panel mode from DDC. Assume that the 1002 * Attempt to get the fixed panel mode from DDC. Assume that the
1003 * preferred mode is the right one. 1003 * preferred mode is the right one.
1004 */ 1004 */
1005 mutex_lock(&dev->mode_config.mutex);
1005 edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin)); 1006 edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin));
1006 if (edid) { 1007 if (edid) {
1007 if (drm_add_edid_modes(connector, edid)) { 1008 if (drm_add_edid_modes(connector, edid)) {
@@ -1095,6 +1096,8 @@ void intel_lvds_init(struct drm_device *dev)
1095 goto failed; 1096 goto failed;
1096 1097
1097out: 1098out:
1099 mutex_unlock(&dev->mode_config.mutex);
1100
1098 lvds_encoder->is_dual_link = compute_is_dual_link_lvds(lvds_encoder); 1101 lvds_encoder->is_dual_link = compute_is_dual_link_lvds(lvds_encoder);
1099 DRM_DEBUG_KMS("detected %s-link lvds configuration\n", 1102 DRM_DEBUG_KMS("detected %s-link lvds configuration\n",
1100 lvds_encoder->is_dual_link ? "dual" : "single"); 1103 lvds_encoder->is_dual_link ? "dual" : "single");
@@ -1123,6 +1126,8 @@ out:
1123 return; 1126 return;
1124 1127
1125failed: 1128failed:
1129 mutex_unlock(&dev->mode_config.mutex);
1130
1126 DRM_DEBUG_KMS("No LVDS modes found, disabling.\n"); 1131 DRM_DEBUG_KMS("No LVDS modes found, disabling.\n");
1127 drm_connector_cleanup(connector); 1132 drm_connector_cleanup(connector);
1128 drm_encoder_cleanup(encoder); 1133 drm_encoder_cleanup(encoder);