diff options
author | Chris Wilson <chris@chris-wilson.co.uk> | 2011-02-12 05:29:38 -0500 |
---|---|---|
committer | Chris Wilson <chris@chris-wilson.co.uk> | 2011-02-16 04:41:07 -0500 |
commit | fe16d949b45036d9f80e20e07bde1ddacc930b10 (patch) | |
tree | 16c647e87ed85b48a33f28fdbac1fd0e08a1e4ac | |
parent | 47a05eca72991039e788b25232061f9c9df9ec23 (diff) |
drm/i915: Move the lvds OpRegion lid detection code to panel and reuse for eDP
Share the lid detection code for the all panels for consistent behaviour
and a single place to add the eventual quirks for crap hardware.
Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk>
-rw-r--r-- | drivers/gpu/drm/i915/intel_dp.c | 10 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_drv.h | 1 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_lvds.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/i915/intel_panel.c | 14 |
4 files changed, 25 insertions, 9 deletions
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c index e478f6a94535..65959a29ab2b 100644 --- a/drivers/gpu/drm/i915/intel_dp.c +++ b/drivers/gpu/drm/i915/intel_dp.c | |||
@@ -1522,9 +1522,13 @@ ironlake_dp_detect(struct intel_dp *intel_dp) | |||
1522 | { | 1522 | { |
1523 | enum drm_connector_status status; | 1523 | enum drm_connector_status status; |
1524 | 1524 | ||
1525 | /* Can't disconnect eDP */ | 1525 | /* Can't disconnect eDP, but you can close the lid... */ |
1526 | if (is_edp(intel_dp)) | 1526 | if (is_edp(intel_dp)) { |
1527 | return connector_status_connected; | 1527 | status = intel_panel_detect(intel_dp->base.base.dev); |
1528 | if (status == connector_status_unknown) | ||
1529 | status = connector_status_connected; | ||
1530 | return status; | ||
1531 | } | ||
1528 | 1532 | ||
1529 | status = connector_status_disconnected; | 1533 | status = connector_status_disconnected; |
1530 | if (intel_dp_aux_native_read(intel_dp, | 1534 | if (intel_dp_aux_native_read(intel_dp, |
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 5ce4a5f13de1..4a19eb6d65ab 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h | |||
@@ -267,6 +267,7 @@ extern void intel_panel_set_backlight(struct drm_device *dev, u32 level); | |||
267 | extern void intel_panel_setup_backlight(struct drm_device *dev); | 267 | extern void intel_panel_setup_backlight(struct drm_device *dev); |
268 | extern void intel_panel_enable_backlight(struct drm_device *dev); | 268 | extern void intel_panel_enable_backlight(struct drm_device *dev); |
269 | extern void intel_panel_disable_backlight(struct drm_device *dev); | 269 | extern void intel_panel_disable_backlight(struct drm_device *dev); |
270 | extern enum drm_connector_status intel_panel_detect(struct drm_device *dev); | ||
270 | 271 | ||
271 | extern void intel_crtc_load_lut(struct drm_crtc *crtc); | 272 | extern void intel_crtc_load_lut(struct drm_crtc *crtc); |
272 | extern void intel_encoder_prepare (struct drm_encoder *encoder); | 273 | extern void intel_encoder_prepare (struct drm_encoder *encoder); |
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c index cd089607eb89..8f909cda62d8 100644 --- a/drivers/gpu/drm/i915/intel_lvds.c +++ b/drivers/gpu/drm/i915/intel_lvds.c | |||
@@ -473,14 +473,11 @@ static enum drm_connector_status | |||
473 | intel_lvds_detect(struct drm_connector *connector, bool force) | 473 | intel_lvds_detect(struct drm_connector *connector, bool force) |
474 | { | 474 | { |
475 | struct drm_device *dev = connector->dev; | 475 | struct drm_device *dev = connector->dev; |
476 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
477 | enum drm_connector_status status = connector_status_connected; | 476 | enum drm_connector_status status = connector_status_connected; |
478 | 477 | ||
479 | /* Assume that the BIOS does not lie through the OpRegion... */ | 478 | status = intel_panel_detect(dev); |
480 | if (dev_priv->opregion.lid_state) | 479 | if (status != connector_status_unknown) |
481 | return ioread32(dev_priv->opregion.lid_state) & 0x1 ? | 480 | return status; |
482 | connector_status_connected : | ||
483 | connector_status_disconnected; | ||
484 | 481 | ||
485 | /* ACPI lid methods were generally unreliable in this generation, so | 482 | /* ACPI lid methods were generally unreliable in this generation, so |
486 | * don't even bother. | 483 | * don't even bother. |
diff --git a/drivers/gpu/drm/i915/intel_panel.c b/drivers/gpu/drm/i915/intel_panel.c index c65992df458d..286995a9a84a 100644 --- a/drivers/gpu/drm/i915/intel_panel.c +++ b/drivers/gpu/drm/i915/intel_panel.c | |||
@@ -281,3 +281,17 @@ void intel_panel_setup_backlight(struct drm_device *dev) | |||
281 | dev_priv->backlight_level = intel_panel_get_backlight(dev); | 281 | dev_priv->backlight_level = intel_panel_get_backlight(dev); |
282 | dev_priv->backlight_enabled = dev_priv->backlight_level != 0; | 282 | dev_priv->backlight_enabled = dev_priv->backlight_level != 0; |
283 | } | 283 | } |
284 | |||
285 | enum drm_connector_status | ||
286 | intel_panel_detect(struct drm_device *dev) | ||
287 | { | ||
288 | struct drm_i915_private *dev_priv = dev->dev_private; | ||
289 | |||
290 | /* Assume that the BIOS does not lie through the OpRegion... */ | ||
291 | if (dev_priv->opregion.lid_state) | ||
292 | return ioread32(dev_priv->opregion.lid_state) & 0x1 ? | ||
293 | connector_status_connected : | ||
294 | connector_status_disconnected; | ||
295 | |||
296 | return connector_status_unknown; | ||
297 | } | ||