linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Greg KH <gregkh@suse.de>
To: linux-kernel@vger.kernel.org, stable@kernel.org
Cc: stable-review@kernel.org, torvalds@linux-foundation.org,
	akpm@linux-foundation.org, alan@lxorguk.ukuu.org.uk,
	Zhao Yakui <yakui.zhao@intel.com>, Eric Anholt <eric@anholt.net>,
	Takashi Iwai <tiwai@suse.de>
Subject: [29/34] drm/i915: parse child device from VBT
Date: Fri, 06 Aug 2010 11:57:24 -0700	[thread overview]
Message-ID: <20100806185836.439426482@clark.site> (raw)
In-Reply-To: <20100806185853.GA28270@kroah.com>

2.6.32-stable review patch.  If anyone has any objections, please let us know.

------------------

From: Zhao Yakui <yakui.zhao@intel.com>

commit 6363ee6f496eb7e3b3f78dc105e522c7b496089b upstream.

On some laptops there is no HDMI/DP. But the xrandr still reports
several disconnected HDMI/display ports. In such case the user will be
confused.
 >DVI1 disconnected (normal left inverted right x axis y axis)
 >DP1 disconnected (normal left inverted right x axis y axis)
 >DVI2 disconnected (normal left inverted right x axis y axis)
 >DP2 disconnected (normal left inverted right x axis y axis)
 >DP3 disconnected (normal left inverted right x axis y axis)

This patch set is to use the child device parsed in VBT to decide whether
the HDMI/DP/LVDS/TV should be initialized.

Parse the child device from VBT.

The device class type is also added for LFP, TV, HDMI, DP output.

https://bugs.freedesktop.org/show_bug.cgi?id=22785

Signed-off-by: Zhao Yakui <yakui.zhao@intel.com>
Reviewed-by: Adam Jackson <ajax@redhat.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
Acked-by: Takashi Iwai <tiwai@suse.de>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

---
 drivers/gpu/drm/i915/i915_dma.c   |    9 +++++
 drivers/gpu/drm/i915/i915_drv.h   |    2 +
 drivers/gpu/drm/i915/intel_bios.c |   65 ++++++++++++++++++++++++++++++++++++++
 drivers/gpu/drm/i915/intel_bios.h |   17 +++++++++
 4 files changed, 93 insertions(+)

--- a/drivers/gpu/drm/i915/i915_dma.c
+++ b/drivers/gpu/drm/i915/i915_dma.c
@@ -1526,6 +1526,15 @@ int i915_driver_unload(struct drm_device
 	}
 
 	if (drm_core_check_feature(dev, DRIVER_MODESET)) {
+		/*
+		 * free the memory space allocated for the child device
+		 * config parsed from VBT
+		 */
+		if (dev_priv->child_dev && dev_priv->child_dev_num) {
+			kfree(dev_priv->child_dev);
+			dev_priv->child_dev = NULL;
+			dev_priv->child_dev_num = 0;
+		}
 		drm_irq_uninstall(dev);
 		vga_client_register(dev->pdev, NULL, NULL, NULL);
 	}
--- a/drivers/gpu/drm/i915/i915_drv.h
+++ b/drivers/gpu/drm/i915/i915_drv.h
@@ -555,6 +555,8 @@ typedef struct drm_i915_private {
 	struct timer_list idle_timer;
 	bool busy;
 	u16 orig_clock;
+	int child_dev_num;
+	struct child_device_config *child_dev;
 	struct drm_connector *int_lvds_connector;
 } drm_i915_private_t;
 
--- a/drivers/gpu/drm/i915/intel_bios.c
+++ b/drivers/gpu/drm/i915/intel_bios.c
@@ -362,6 +362,70 @@ parse_driver_features(struct drm_i915_pr
 		dev_priv->render_reclock_avail = true;
 }
 
+static void
+parse_device_mapping(struct drm_i915_private *dev_priv,
+		       struct bdb_header *bdb)
+{
+	struct bdb_general_definitions *p_defs;
+	struct child_device_config *p_child, *child_dev_ptr;
+	int i, child_device_num, count;
+	u16	block_size;
+
+	p_defs = find_section(bdb, BDB_GENERAL_DEFINITIONS);
+	if (!p_defs) {
+		DRM_DEBUG_KMS("No general definition block is found\n");
+		return;
+	}
+	/* judge whether the size of child device meets the requirements.
+	 * If the child device size obtained from general definition block
+	 * is different with sizeof(struct child_device_config), skip the
+	 * parsing of sdvo device info
+	 */
+	if (p_defs->child_dev_size != sizeof(*p_child)) {
+		/* different child dev size . Ignore it */
+		DRM_DEBUG_KMS("different child size is found. Invalid.\n");
+		return;
+	}
+	/* get the block size of general definitions */
+	block_size = get_blocksize(p_defs);
+	/* get the number of child device */
+	child_device_num = (block_size - sizeof(*p_defs)) /
+				sizeof(*p_child);
+	count = 0;
+	/* get the number of child device that is present */
+	for (i = 0; i < child_device_num; i++) {
+		p_child = &(p_defs->devices[i]);
+		if (!p_child->device_type) {
+			/* skip the device block if device type is invalid */
+			continue;
+		}
+		count++;
+	}
+	if (!count) {
+		DRM_DEBUG_KMS("no child dev is parsed from VBT \n");
+		return;
+	}
+	dev_priv->child_dev = kzalloc(sizeof(*p_child) * count, GFP_KERNEL);
+	if (!dev_priv->child_dev) {
+		DRM_DEBUG_KMS("No memory space for child device\n");
+		return;
+	}
+
+	dev_priv->child_dev_num = count;
+	count = 0;
+	for (i = 0; i < child_device_num; i++) {
+		p_child = &(p_defs->devices[i]);
+		if (!p_child->device_type) {
+			/* skip the device block if device type is invalid */
+			continue;
+		}
+		child_dev_ptr = dev_priv->child_dev + count;
+		count++;
+		memcpy((void *)child_dev_ptr, (void *)p_child,
+					sizeof(*p_child));
+	}
+	return;
+}
 /**
  * intel_init_bios - initialize VBIOS settings & find VBT
  * @dev: DRM device
@@ -413,6 +477,7 @@ 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_device_mapping(dev_priv, bdb);
 	parse_driver_features(dev_priv, bdb);
 
 	pci_unmap_rom(pdev, bios);
--- a/drivers/gpu/drm/i915/intel_bios.h
+++ b/drivers/gpu/drm/i915/intel_bios.h
@@ -549,4 +549,21 @@ bool intel_init_bios(struct drm_device *
 #define   SWF14_APM_STANDBY	0x1
 #define   SWF14_APM_RESTORE	0x0
 
+/* Add the device class for LFP, TV, HDMI */
+#define	 DEVICE_TYPE_INT_LFP	0x1022
+#define	 DEVICE_TYPE_INT_TV	0x1009
+#define	 DEVICE_TYPE_HDMI	0x60D2
+#define	 DEVICE_TYPE_DP		0x68C6
+#define	 DEVICE_TYPE_eDP	0x78C6
+
+/* define the DVO port for HDMI output type */
+#define		DVO_B		1
+#define		DVO_C		2
+#define		DVO_D		3
+
+/* define the PORT for DP output type */
+#define		PORT_IDPB	7
+#define		PORT_IDPC	8
+#define		PORT_IDPD	9
+
 #endif /* _I830_BIOS_H_ */



  parent reply	other threads:[~2010-08-06 19:00 UTC|newest]

Thread overview: 38+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2010-08-06 18:58 [00/34] 2.6.32.18-stable review Greg KH
2010-08-06 18:56 ` [01/34] sched: cgroup: Implement different treatment for idle shares Greg KH
2010-08-06 18:56 ` [02/34] mm: fix ia64 crash when gcore reads gate area Greg KH
2010-08-06 18:56 ` [03/34] Re: acl trouble after upgrading ubuntu Greg KH
2010-08-06 18:56 ` [04/34] comedi: Uncripple 8255-based DIO subdevices Greg KH
2010-08-06 18:57 ` [05/34] NFS: kswapd must not block in nfs_release_page Greg KH
2010-08-06 18:57 ` [06/34] PARISC: led.c - fix potential stack overflow in led_proc_write() Greg KH
2010-08-06 18:57 ` [07/34] arm/imx/gpio: add spinlock protection Greg KH
2010-08-06 18:57 ` [08/34] parisc: pass through \t to early (iodc) console Greg KH
2010-08-06 18:57 ` [09/34] amd64_edac: Fix DCT base address selector Greg KH
2010-08-06 18:57 ` [10/34] amd64_edac: Correct scrub rate setting Greg KH
2010-08-06 18:57 ` [11/34] e1000e: dont inadvertently re-set INTX_DISABLE Greg KH
2010-08-06 18:57 ` [12/34] e1000e: 82577/82578 PHY register access issues Greg KH
2010-08-06 18:57 ` [13/34] 9p: strlen() doesnt count the terminator Greg KH
2010-08-06 18:57 ` [14/34] ath9k: enable serialize_regmode for non-PCIE AR9160 Greg KH
2010-08-06 18:57 ` [15/34] ath9k_hw: fix an off-by-one error in the PDADC boundaries calculation Greg KH
2010-08-06 18:57 ` [16/34] ath9k: fix TSF after reset on AR913x Greg KH
2010-08-06 18:57 ` [17/34] ath9k: fix yet another buffer leak in the tx aggregation code Greg KH
2010-08-06 18:57 ` [18/34] iwlwifi: fix scan abort Greg KH
2010-08-06 18:57 ` [19/34] cfg80211: ignore spurious deauth Greg KH
2010-08-06 18:57 ` [20/34] cfg80211: dont get expired BSSes Greg KH
2010-08-06 18:57 ` [21/34] xfs: prevent swapext from operating on write-only files Greg KH
2010-08-06 18:57 ` [22/34] SCSI: enclosure: fix error path - actually return ERR_PTR() on error Greg KH
2010-08-06 18:57 ` [23/34] GFS2: rename causes kernel Oops Greg KH
2010-08-06 18:57 ` [24/34] slow-work: use get_ref wrapper instead of directly calling get_ref Greg KH
2010-08-06 18:57 ` [25/34] CIFS: Remove __exit mark from cifs_exit_dns_resolver() Greg KH
2010-08-06 18:57 ` [26/34] CIFS: Fix compile error with __init in cifs_init_dns_resolver() definition Greg KH
2010-08-06 20:53   ` [Stable-review] " Ben Hutchings
2010-08-06 21:06     ` Greg KH
2010-08-07  3:38       ` Michael Neuling
2010-08-06 18:57 ` [27/34] xen: drop xen_sched_clock in favour of using plain wallclock time Greg KH
2010-08-06 18:57 ` [28/34] drm/i915: Fix LVDS presence check Greg KH
2010-08-06 18:57 ` Greg KH [this message]
2010-08-06 18:57 ` [30/34] Revert "ssb: Handle Netbook devices where the SPROM address is changed" Greg KH
2010-08-06 18:57 ` [31/34] ssb: do not read SPROM if it does not exist Greg KH
2010-08-06 18:57 ` [32/34] ssb: Look for SPROM at different offset on higher rev CC Greg KH
2010-08-06 18:57 ` [33/34] ssb: fix NULL ptr deref when pcihost_wrapper is used Greg KH
2010-08-06 18:57 ` [34/34] ssb: Handle alternate SSPROM location Greg KH

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20100806185836.439426482@clark.site \
    --to=gregkh@suse.de \
    --cc=akpm@linux-foundation.org \
    --cc=alan@lxorguk.ukuu.org.uk \
    --cc=eric@anholt.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=stable-review@kernel.org \
    --cc=stable@kernel.org \
    --cc=tiwai@suse.de \
    --cc=torvalds@linux-foundation.org \
    --cc=yakui.zhao@intel.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).