summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/i915/intel_lvds.c
diff options
context:
space:
mode:
authorJani Nikula <jani.nikula@intel.com>2012-10-19 14:51:52 +0300
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-10-22 19:34:03 +0200
commit9cd300e038d492af4990b04e127e0bd2df64b1ca (patch)
treed40ffef7d09f6c85a554d2f1e0f5c559ad35f120 /drivers/gpu/drm/i915/intel_lvds.c
parentebda95a9965dc6641deacc57ac480e01a378e19b (diff)
drm/i915: Move cached EDID to intel_connector
Move the cached EDID from intel_dp and intel_lvds_connector to intel_connector. Unify cached EDID handling for LVDS and eDP, in preparation for adding more generic EDID caching later. Signed-off-by: Jani Nikula <jani.nikula@intel.com> Reviewed-by: Jesse Barnes <jbarnes@virtuousgeek.org> Reviewed-by: Chris Wilson <chris@chris-wilson.co.uk> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_lvds.c')
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c34
1 files changed, 23 insertions, 11 deletions
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 50b6124a6943..587ed0f31bda 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -44,7 +44,6 @@ struct intel_lvds_connector {
struct intel_connector base;
struct notifier_block lid_notifier;
- struct edid *edid;
int fitting_mode;
};
@@ -460,8 +459,14 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
struct drm_device *dev = connector->dev;
struct drm_display_mode *mode;
- if (lvds_connector->edid)
- return drm_add_edid_modes(connector, lvds_connector->edid);
+ /* use cached edid if we have one */
+ if (lvds_connector->base.edid) {
+ /* invalid edid */
+ if (IS_ERR(lvds_connector->base.edid))
+ return 0;
+
+ return drm_add_edid_modes(connector, lvds_connector->base.edid);
+ }
mode = drm_mode_duplicate(dev, lvds_connector->base.panel.fixed_mode);
if (mode == NULL)
@@ -553,6 +558,9 @@ static void intel_lvds_destroy(struct drm_connector *connector)
if (lvds_connector->lid_notifier.notifier_call)
acpi_lid_notifier_unregister(&lvds_connector->lid_notifier);
+ if (!IS_ERR_OR_NULL(lvds_connector->base.edid))
+ kfree(lvds_connector->base.edid);
+
intel_panel_destroy_backlight(connector->dev);
intel_panel_fini(&lvds_connector->base.panel);
@@ -922,6 +930,7 @@ bool intel_lvds_init(struct drm_device *dev)
struct drm_encoder *encoder;
struct drm_display_mode *scan; /* *modes, *bios_mode; */
struct drm_display_mode *fixed_mode = NULL;
+ struct edid *edid;
struct drm_crtc *crtc;
u32 lvds;
int pipe;
@@ -1021,18 +1030,21 @@ bool intel_lvds_init(struct drm_device *dev)
* Attempt to get the fixed panel mode from DDC. Assume that the
* preferred mode is the right one.
*/
- lvds_connector->edid = drm_get_edid(connector,
- intel_gmbus_get_adapter(dev_priv, pin));
- if (lvds_connector->edid) {
- if (drm_add_edid_modes(connector, lvds_connector->edid)) {
+ edid = drm_get_edid(connector, intel_gmbus_get_adapter(dev_priv, pin));
+ if (edid) {
+ if (drm_add_edid_modes(connector, edid)) {
drm_mode_connector_update_edid_property(connector,
- lvds_connector->edid);
+ edid);
} else {
- kfree(lvds_connector->edid);
- lvds_connector->edid = NULL;
+ kfree(edid);
+ edid = ERR_PTR(-EINVAL);
}
+ } else {
+ edid = ERR_PTR(-ENOENT);
}
- if (!lvds_connector->edid) {
+ lvds_connector->base.edid = edid;
+
+ if (IS_ERR_OR_NULL(edid)) {
/* Didn't get an EDID, so
* Set wide sync ranges so we get all modes
* handed to valid_mode for checking