[Intel-gfx] [PATCH] drm/i915: Use LVDS config in Driver feature BDB for integrated LVDS check

Wang, Zhenyu Z zhenyu.z.wang at intel.com
Mon Mar 2 03:47:31 CET 2009


On 2009.02.27 11:09:02 +0800, Wang, Zhenyu Z wrote:
> On 2009.02.25 09:58:11 +0800, Wang, Zhenyu Z wrote:
> > The LVDS config bits in VBT driver feature block is used by vendor
> > to identify the board implement of integrated LVDS/eDP or SDVO LVDS.
> > And video bios also uses these bits for LVDS enabling or not. So this
> > should be reliable for LVDS detect, and may eliminate quirks.
> > 
> 
> Eric, hold on commit this one. We have met LVDS failure with current ddx driver,
> like bug 20339, although a bios upgrade fixed the problem. We might check BDB
> version to verfiy driver feature block definition, and only use the block info
> when satisfied.
> 

As we haven't successfully accessed vbios doc for this yet, here's updated patch
which skipping driver feature block parsing on pre-9xx chips, which from my testing
is pretty broken on this. I think check BDB version might be a better choice but 
depends on when we can get docs, and our current LVDS quirks in 2D driver are all
for 9xx chips. Also update driver feature BDB definition including some missing unused
fields.

Eric, should I make a patch against d-i-n tree or you will refresh it with updated
one?

From a04f41d1cd46c0a8d13c368bf3d90ac30874a213 Mon Sep 17 00:00:00 2001
From: Zhenyu Wang <zhenyu.z.wang at intel.com>
Date: Mon, 2 Mar 2009 10:48:18 +0800
Subject: [PATCH] drm/i915: Use LVDS config in Driver feature BDB for integrated LVDS check

The LVDS config bits in VBT driver feature block is used by vendor
to identify the board implement of integrated LVDS/eDP or SDVO LVDS.
And video bios also uses these bits for LVDS enabling or not. So this
should be reliable for LVDS detect, and may eliminate quirks. Only parse
this block for 9XX chips, as previous chips seems mostly broken on this
block.

Signed-off-by: Zhenyu Wang <zhenyu.z.wang at intel.com>
---
 drivers/gpu/drm/i915/i915_drv.h   |    1 +
 drivers/gpu/drm/i915/intel_bios.c |   21 +++++++++++++++++++
 drivers/gpu/drm/i915/intel_bios.h |   41 +++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_lvds.c |    5 ++++
 4 files changed, 68 insertions(+), 0 deletions(-)

diff --git a/drivers/gpu/drm/i915/i915_drv.h b/drivers/gpu/drm/i915/i915_drv.h
index 3951a12..cb468fc 100644
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -180,6 +180,7 @@ typedef struct drm_i915_private {
 	struct drm_display_mode *vbt_mode; /* if any */
 
 	/* Feature bits from the VBIOS */
+	unsigned int int_lvds_support:1;
 	unsigned int int_tv_support:1;
 	unsigned int lvds_dither:1;
 	unsigned int lvds_vbt:1;
diff --git a/drivers/gpu/drm/i915/intel_bios.c b/drivers/gpu/drm/i915/intel_bios.c
index 65be30d..e97bf8b 100644
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -146,6 +146,26 @@ parse_general_features(struct drm_i915_private *dev_priv,
 	}
 }
 
+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 mobile chips */
+	if (IS_MOBILE(dev) && !IS_I830(dev))
+		dev_priv->int_lvds_support = 1;
+
+	/* pre-9xx chips's VBIOS seems broken with this block, skipping */
+	if (!IS_I9XX(dev))
+		return;
+
+	driver = find_section(bdb, BDB_DRIVER_FEATURES);
+	if (driver && driver->lvds_config != BDB_DRIVER_FEATURE_INT_LVDS)
+		dev_priv->int_lvds_support = 0;
+}
+
 /**
  * intel_init_bios - initialize VBIOS settings & find VBT
  * @dev: DRM device
@@ -194,6 +214,7 @@ intel_init_bios(struct drm_device *dev)
 	/* Grab useful general definitions */
 	parse_general_features(dev_priv, bdb);
 	parse_panel_data(dev_priv, bdb);
+	parse_driver_features(dev_priv, bdb);
 
 	pci_unmap_rom(pdev, bios);
 
diff --git a/drivers/gpu/drm/i915/intel_bios.h b/drivers/gpu/drm/i915/intel_bios.h
index 5ea715a..9be642f 100644
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -279,6 +279,47 @@ struct vch_bdb_22 {
 	struct vch_panel_data panels[16];
 } __attribute__((packed));
 
+#define BDB_DRIVER_FEATURE_NO_LVDS		0
+#define BDB_DRIVER_FEATURE_INT_LVDS		1
+#define BDB_DRIVER_FEATURE_SDVO_LVDS		2
+#define BDB_DRIVER_FEATURE_EDP			3
+
+struct bdb_driver_features {
+	u8 boot_dev_algorithm:1;
+	u8 block_display_switch:1;
+	u8 allow_display_switch:1;
+	u8 hotplug_dvo:1;
+	u8 dual_view_zoom:1;
+	u8 int15h_hook:1;
+	u8 sprite_in_clone:1;
+	u8 primary_lfp_id:1;
+
+	u16 boot_mode_x;
+	u16 boot_mode_y;
+	u8 boot_mode_bpp;
+	u8 boot_mode_refresh;
+
+	u16 enable_lfp_primary:1;
+	u16 selective_mode_pruning:1;
+	u16 dual_frequency:1;
+	u16 render_clock_freq:1; /* 0: high freq; 1: low freq */
+	u16 nt_clone_support:1;
+	u16 power_scheme_ui:1; /* 0: CUI; 1: 3rd party */
+	u16 sprite_display_assign:1; /* 0: secondary; 1: primary */
+	u16 cui_aspect_scaling:1;
+	u16 preserve_aspect_ratio:1;
+	u16 sdvo_device_power_down:1;
+	u16 crt_hotplug:1;
+	u16 lvds_config:2;
+	u16 reserved:3;
+
+	u8 static_display:1;
+	u8 reserved2:7;
+	u16 legacy_crt_max_x;
+	u16 legacy_crt_max_y;
+	u8 legacy_crt_max_refresh;
+} __attribute__((packed));
+
 bool intel_init_bios(struct drm_device *dev);
 
 /*
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 0d211af..8a1600c 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -404,6 +404,11 @@ void intel_lvds_init(struct drm_device *dev)
 	u32 lvds;
 	int pipe;
 
+	if (!dev_priv->int_lvds_support) {
+		DRM_DEBUG("Skipping LVDS from Driver feature BDB config\n");
+		return;
+	}
+
 	/* Blacklist machines that we know falsely report LVDS. */
 	/* FIXME: add a check for the Aopen Mini PC */
 
-- 
1.6.1.3


-- 
Open Source Technology Center, Intel ltd.

$gpg --keyserver wwwkeys.pgp.net --recv-keys 4D781827
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 197 bytes
Desc: Digital signature
URL: <http://lists.freedesktop.org/archives/intel-gfx/attachments/20090302/256ceec0/attachment.sig>


More information about the Intel-gfx mailing list