Revert "Merge remote-tracking branch 'linux-2.6.32.y/master' into develop"
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / i915 / intel_lvds.c
index 952bb4e2484d7acb100d6a4e8bc27a356f142931..d5b736104fd8b8286ea9290bf6241a4424aa6205 100644 (file)
@@ -629,6 +629,13 @@ static const struct dmi_system_id bad_lid_status[] = {
                        DMI_MATCH(DMI_PRODUCT_NAME, "PC-81005"),
                },
        },
+       {
+               .ident = "Clevo M5x0N",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "CLEVO Co."),
+                       DMI_MATCH(DMI_BOARD_NAME, "M5x0N"),
+               },
+       },
        { }
 };
 
@@ -641,8 +648,12 @@ static const struct dmi_system_id bad_lid_status[] = {
  */
 static enum drm_connector_status intel_lvds_detect(struct drm_connector *connector)
 {
+       struct drm_device *dev = connector->dev;
        enum drm_connector_status status = connector_status_connected;
 
+       if (IS_I8XX(dev))
+               return connector_status_connected;
+
        if (!acpi_lid_open() && !dmi_check_system(bad_lid_status))
                status = connector_status_disconnected;
 
@@ -878,68 +889,57 @@ static const struct dmi_system_id intel_no_lvds[] = {
                        DMI_MATCH(DMI_PRODUCT_VERSION, "AO00001JW"),
                },
        },
+       {
+               .callback = intel_no_lvds_dmi_callback,
+               .ident = "Clientron U800",
+               .matches = {
+                       DMI_MATCH(DMI_SYS_VENDOR, "Clientron"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "U800"),
+               },
+       },
 
        { }     /* terminating entry */
 };
 
-#ifdef CONFIG_ACPI
 /*
- * check_lid_device -- check whether @handle is an ACPI LID device.
- * @handle: ACPI device handle
- * @level : depth in the ACPI namespace tree
- * @context: the number of LID device when we find the device
- * @rv: a return value to fill if desired (Not use)
+ * Enumerate the child dev array parsed from VBT to check whether
+ * the LVDS is present.
+ * If it is present, return 1.
+ * If it is not present, return false.
+ * If no child dev is parsed from VBT, it assumes that the LVDS is present.
+ * Note: The addin_offset should also be checked for LVDS panel.
+ * Only when it is non-zero, it is assumed that it is present.
  */
-static acpi_status
-check_lid_device(acpi_handle handle, u32 level, void *context,
-                       void **return_value)
+static int lvds_is_present_in_vbt(struct drm_device *dev)
 {
-       struct acpi_device *acpi_dev;
-       int *lid_present = context;
-
-       acpi_dev = NULL;
-       /* Get the acpi device for device handle */
-       if (acpi_bus_get_device(handle, &acpi_dev) || !acpi_dev) {
-               /* If there is no ACPI device for handle, return */
-               return AE_OK;
-       }
-
-       if (!strncmp(acpi_device_hid(acpi_dev), "PNP0C0D", 7))
-               *lid_present = 1;
+       struct drm_i915_private *dev_priv = dev->dev_private;
+       struct child_device_config *p_child;
+       int i, ret;
 
-       return AE_OK;
-}
+       if (!dev_priv->child_dev_num)
+               return 1;
 
-/**
- * check whether there exists the ACPI LID device by enumerating the ACPI
- * device tree.
- */
-static int intel_lid_present(void)
-{
-       int lid_present = 0;
+       ret = 0;
+       for (i = 0; i < dev_priv->child_dev_num; i++) {
+               p_child = dev_priv->child_dev + i;
+               /*
+                * If the device type is not LFP, continue.
+                * If the device type is 0x22, it is also regarded as LFP.
+                */
+               if (p_child->device_type != DEVICE_TYPE_INT_LFP &&
+                       p_child->device_type != DEVICE_TYPE_LFP)
+                       continue;
 
-       if (acpi_disabled) {
-               /* If ACPI is disabled, there is no ACPI device tree to
-                * check, so assume the LID device would have been present.
+               /* The addin_offset should be checked. Only when it is
+                * non-zero, it is regarded as present.
                 */
-               return 1;
+               if (p_child->addin_offset) {
+                       ret = 1;
+                       break;
+               }
        }
-
-       acpi_walk_namespace(ACPI_TYPE_DEVICE, ACPI_ROOT_OBJECT,
-                               ACPI_UINT32_MAX,
-                               check_lid_device, &lid_present, NULL);
-
-       return lid_present;
+       return ret;
 }
-#else
-static int intel_lid_present(void)
-{
-       /* In the absence of ACPI built in, assume that the LID device would
-        * have been present.
-        */
-       return 1;
-}
-#endif
 
 /**
  * intel_lvds_init - setup LVDS connectors on this device
@@ -964,15 +964,10 @@ void intel_lvds_init(struct drm_device *dev)
        if (dmi_check_system(intel_no_lvds))
                return;
 
-       /* Assume that any device without an ACPI LID device also doesn't
-        * have an integrated LVDS.  We would be better off parsing the BIOS
-        * to get a reliable indicator, but that code isn't written yet.
-        *
-        * In the case of all-in-one desktops using LVDS that we've seen,
-        * they're using SDVO LVDS.
-        */
-       if (!intel_lid_present())
+       if (!lvds_is_present_in_vbt(dev)) {
+               DRM_DEBUG_KMS("LVDS is not present in VBT\n");
                return;
+       }
 
        if (IS_IGDNG(dev)) {
                if ((I915_READ(PCH_LVDS) & LVDS_DETECTED) == 0)