Merge branch 'fix/hda' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound-2.6
[pandora-kernel.git] / drivers / gpu / drm / i915 / intel_bios.c
index 7cc4471..300aee3 100644 (file)
@@ -97,14 +97,13 @@ static void
 parse_lfp_panel_data(struct drm_i915_private *dev_priv,
                            struct bdb_header *bdb)
 {
-       struct drm_device *dev = dev_priv->dev;
        struct bdb_lvds_options *lvds_options;
        struct bdb_lvds_lfp_data *lvds_lfp_data;
        struct bdb_lvds_lfp_data_ptrs *lvds_lfp_data_ptrs;
        struct bdb_lvds_lfp_data_entry *entry;
        struct lvds_dvo_timing *dvo_timing;
        struct drm_display_mode *panel_fixed_mode;
-       int lfp_data_size;
+       int lfp_data_size, dvo_timing_offset;
 
        /* Defaults if we can't find VBT info */
        dev_priv->lvds_dither = 0;
@@ -133,14 +132,16 @@ parse_lfp_panel_data(struct drm_i915_private *dev_priv,
        entry = (struct bdb_lvds_lfp_data_entry *)
                ((uint8_t *)lvds_lfp_data->data + (lfp_data_size *
                                                   lvds_options->panel_type));
+       dvo_timing_offset = lvds_lfp_data_ptrs->ptr[0].dvo_timing_offset -
+               lvds_lfp_data_ptrs->ptr[0].fp_timing_offset;
 
-       /* On IGDNG mobile, LVDS data block removes panel fitting registers.
-          So dec 2 dword from dvo_timing offset */
-       if (IS_IGDNG(dev))
-               dvo_timing = (struct lvds_dvo_timing *)
-                                       ((u8 *)&entry->dvo_timing - 8);
-       else
-               dvo_timing = &entry->dvo_timing;
+       /*
+        * the size of fp_timing varies on the different platform.
+        * So calculate the DVO timing relative offset in LVDS data
+        * entry to get the DVO timing entry
+        */
+       dvo_timing = (struct lvds_dvo_timing *)
+                       ((unsigned char *)entry + dvo_timing_offset);
 
        panel_fixed_mode = kzalloc(sizeof(*panel_fixed_mode), GFP_KERNEL);
 
@@ -295,6 +296,25 @@ parse_sdvo_device_mapping(struct drm_i915_private *dev_priv,
        }
        return;
 }
+
+static void
+parse_driver_features(struct drm_i915_private *dev_priv,
+                      struct bdb_header *bdb)
+{
+       struct drm_device *dev = dev_priv->dev;
+       struct bdb_driver_features *driver;
+
+       /* set default for chips without eDP */
+       if (!SUPPORTS_EDP(dev)) {
+               dev_priv->edp_support = 0;
+               return;
+       }
+
+       driver = find_section(bdb, BDB_DRIVER_FEATURES);
+       if (driver && driver->lvds_config == BDB_DRIVER_FEATURE_EDP)
+               dev_priv->edp_support = 1;
+}
+
 /**
  * intel_init_bios - initialize VBIOS settings & find VBT
  * @dev: DRM device
@@ -345,6 +365,8 @@ intel_init_bios(struct drm_device *dev)
        parse_lfp_panel_data(dev_priv, bdb);
        parse_sdvo_panel_data(dev_priv, bdb);
        parse_sdvo_device_mapping(dev_priv, bdb);
+       parse_driver_features(dev_priv, bdb);
+
        pci_unmap_rom(pdev, bios);
 
        return 0;