drm/i915: intel_lvds.c fix section mismatch
[safe/jmp/linux-2.6] / drivers / gpu / drm / i915 / intel_lvds.c
index b36a521..53cccfa 100644 (file)
@@ -27,6 +27,7 @@
  *      Jesse Barnes <jesse.barnes@intel.com>
  */
 
+#include <linux/dmi.h>
 #include <linux/i2c.h>
 #include "drmP.h"
 #include "drm.h"
@@ -264,7 +265,7 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder,
                pfit_control = 0;
 
        if (!IS_I965G(dev)) {
-               if (dev_priv->panel_wants_dither)
+               if (dev_priv->panel_wants_dither || dev_priv->lvds_dither)
                        pfit_control |= PANEL_8TO6_DITHER_ENABLE;
        }
        else
@@ -311,10 +312,8 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
        if (dev_priv->panel_fixed_mode != NULL) {
                struct drm_display_mode *mode;
 
-               mutex_lock(&dev->mode_config.mutex);
                mode = drm_mode_duplicate(dev, dev_priv->panel_fixed_mode);
                drm_mode_probed_add(connector, mode);
-               mutex_unlock(&dev->mode_config.mutex);
 
                return 1;
        }
@@ -344,11 +343,6 @@ static int intel_lvds_set_property(struct drm_connector *connector,
                                   struct drm_property *property,
                                   uint64_t value)
 {
-       struct drm_device *dev = connector->dev;
-
-       if (property == dev->mode_config.dpms_property && connector->encoder)
-               intel_lvds_dpms(connector->encoder, (uint32_t)(value & 0xf));
-
        return 0;
 }
 
@@ -367,6 +361,7 @@ static const struct drm_connector_helper_funcs intel_lvds_connector_helper_funcs
 };
 
 static const struct drm_connector_funcs intel_lvds_connector_funcs = {
+       .dpms = drm_helper_connector_dpms,
        .save = intel_lvds_save,
        .restore = intel_lvds_restore,
        .detect = intel_lvds_detect,
@@ -385,7 +380,51 @@ static const struct drm_encoder_funcs intel_lvds_enc_funcs = {
        .destroy = intel_lvds_enc_destroy,
 };
 
+static int __init intel_no_lvds_dmi_callback(const struct dmi_system_id *id)
+{
+       DRM_DEBUG("Skipping LVDS initialization for %s\n", id->ident);
+       return 1;
+}
 
+/* These systems claim to have LVDS, but really don't */
+static const struct dmi_system_id intel_no_lvds[] = {
+       {
+               .callback = intel_no_lvds_dmi_callback,
+               .ident = "Apple Mac Mini (Core series)",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Macmini1,1"),
+               },
+       },
+       {
+               .callback = intel_no_lvds_dmi_callback,
+               .ident = "Apple Mac Mini (Core 2 series)",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Apple Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Macmini2,1"),
+               },
+       },
+       {
+               .callback = intel_no_lvds_dmi_callback,
+               .ident = "MSI IM-945GSE-A",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "MSI"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "A9830IMS"),
+               },
+       },
+       {
+               .callback = intel_no_lvds_dmi_callback,
+               .ident = "Dell Studio Hybrid",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "Studio Hybrid 140g"),
+               },
+       },
+
+       /* FIXME: add a check for the Aopen Mini PC */
+
+       { }     /* terminating entry */
+};
 
 /**
  * intel_lvds_init - setup LVDS connectors on this device
@@ -405,6 +444,10 @@ void intel_lvds_init(struct drm_device *dev)
        u32 lvds;
        int pipe;
 
+       /* Skip init on machines we know falsely report LVDS */
+       if (dmi_check_system(intel_no_lvds))
+               return;
+
        intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL);
        if (!intel_output) {
                return;
@@ -458,22 +501,20 @@ void intel_lvds_init(struct drm_device *dev)
                        dev_priv->panel_fixed_mode =
                                drm_mode_duplicate(dev, scan);
                        mutex_unlock(&dev->mode_config.mutex);
-                       goto out; /* FIXME: check for quirks */
+                       goto out;
                }
                mutex_unlock(&dev->mode_config.mutex);
        }
 
        /* Failed to get EDID, what about VBT? */
-       if (dev_priv->vbt_mode) {
+       if (dev_priv->lfp_lvds_vbt_mode) {
                mutex_lock(&dev->mode_config.mutex);
                dev_priv->panel_fixed_mode =
-                       drm_mode_duplicate(dev, dev_priv->vbt_mode);
+                       drm_mode_duplicate(dev, dev_priv->lfp_lvds_vbt_mode);
                mutex_unlock(&dev->mode_config.mutex);
                if (dev_priv->panel_fixed_mode) {
                        dev_priv->panel_fixed_mode->type |=
                                DRM_MODE_TYPE_PREFERRED;
-                       drm_mode_probed_add(connector,
-                                           dev_priv->panel_fixed_mode);
                        goto out;
                }
        }
@@ -492,7 +533,7 @@ void intel_lvds_init(struct drm_device *dev)
                if (dev_priv->panel_fixed_mode) {
                        dev_priv->panel_fixed_mode->type |=
                                DRM_MODE_TYPE_PREFERRED;
-                       goto out; /* FIXME: check for quirks */
+                       goto out;
                }
        }
 
@@ -500,38 +541,6 @@ void intel_lvds_init(struct drm_device *dev)
        if (!dev_priv->panel_fixed_mode)
                goto failed;
 
-       /* FIXME: detect aopen & mac mini type stuff automatically? */
-       /*
-        * Blacklist machines with BIOSes that list an LVDS panel without
-        * actually having one.
-        */
-       if (IS_I945GM(dev)) {
-               /* aopen mini pc */
-               if (dev->pdev->subsystem_vendor == 0xa0a0)
-                       goto failed;
-
-               if ((dev->pdev->subsystem_vendor == 0x8086) &&
-                   (dev->pdev->subsystem_device == 0x7270)) {
-                       /* It's a Mac Mini or Macbook Pro.
-                        *
-                        * Apple hardware is out to get us.  The macbook pro
-                        * has a real LVDS panel, but the mac mini does not,
-                        * and they have the same device IDs.  We'll
-                        * distinguish by panel size, on the assumption
-                        * that Apple isn't about to make any machines with an
-                        * 800x600 display.
-                        */
-
-                       if (dev_priv->panel_fixed_mode != NULL &&
-                           dev_priv->panel_fixed_mode->hdisplay == 800 &&
-                           dev_priv->panel_fixed_mode->vdisplay == 600) {
-                               DRM_DEBUG("Suspected Mac Mini, ignoring the LVDS\n");
-                               goto failed;
-                       }
-               }
-       }
-
-
 out:
        drm_sysfs_connector_add(connector);
        return;