aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlan Cox <alan@linux.intel.com>2012-04-25 09:37:27 -0400
committerDave Airlie <airlied@redhat.com>2012-04-27 04:23:56 -0400
commit1b2db4cee5433e089533f81fea6721c1b653703c (patch)
treeec94b00842eb028dfe108e487d773e0ea487f2d6
parent1fb28e9e737e26a0d2ee59f211ff400dc448d7e5 (diff)
gma500: panel presence check
Introduce a panel presence check for Cedartrail. Non netbook devices don't necessarily have a panel attached. Signed-off-by: Alan Cox <alan@linux.intel.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/gma500/cdv_intel_lvds.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/drivers/gpu/drm/gma500/cdv_intel_lvds.c b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
index 8359c1a3f45f..c87b179eadfd 100644
--- a/drivers/gpu/drm/gma500/cdv_intel_lvds.c
+++ b/drivers/gpu/drm/gma500/cdv_intel_lvds.c
@@ -556,6 +556,56 @@ const struct drm_encoder_funcs cdv_intel_lvds_enc_funcs = {
556 .destroy = cdv_intel_lvds_enc_destroy, 556 .destroy = cdv_intel_lvds_enc_destroy,
557}; 557};
558 558
559/*
560 * Enumerate the child dev array parsed from VBT to check whether
561 * the LVDS is present.
562 * If it is present, return 1.
563 * If it is not present, return false.
564 * If no child dev is parsed from VBT, it assumes that the LVDS is present.
565 */
566static bool lvds_is_present_in_vbt(struct drm_device *dev,
567 u8 *i2c_pin)
568{
569 struct drm_psb_private *dev_priv = dev->dev_private;
570 int i;
571
572 if (!dev_priv->child_dev_num)
573 return true;
574
575 for (i = 0; i < dev_priv->child_dev_num; i++) {
576 struct child_device_config *child = dev_priv->child_dev + i;
577
578 /* If the device type is not LFP, continue.
579 * We have to check both the new identifiers as well as the
580 * old for compatibility with some BIOSes.
581 */
582 if (child->device_type != DEVICE_TYPE_INT_LFP &&
583 child->device_type != DEVICE_TYPE_LFP)
584 continue;
585
586 if (child->i2c_pin)
587 *i2c_pin = child->i2c_pin;
588
589 /* However, we cannot trust the BIOS writers to populate
590 * the VBT correctly. Since LVDS requires additional
591 * information from AIM blocks, a non-zero addin offset is
592 * a good indicator that the LVDS is actually present.
593 */
594 if (child->addin_offset)
595 return true;
596
597 /* But even then some BIOS writers perform some black magic
598 * and instantiate the device without reference to any
599 * additional data. Trust that if the VBT was written into
600 * the OpRegion then they have validated the LVDS's existence.
601 */
602 if (dev_priv->opregion.vbt)
603 return true;
604 }
605
606 return false;
607}
608
559/** 609/**
560 * cdv_intel_lvds_init - setup LVDS connectors on this device 610 * cdv_intel_lvds_init - setup LVDS connectors on this device
561 * @dev: drm device 611 * @dev: drm device
@@ -576,6 +626,13 @@ void cdv_intel_lvds_init(struct drm_device *dev,
576 struct drm_psb_private *dev_priv = dev->dev_private; 626 struct drm_psb_private *dev_priv = dev->dev_private;
577 u32 lvds; 627 u32 lvds;
578 int pipe; 628 int pipe;
629 u8 pin;
630
631 pin = GMBUS_PORT_PANEL;
632 if (!lvds_is_present_in_vbt(dev, &pin)) {
633 DRM_DEBUG_KMS("LVDS is not present in VBT\n");
634 return;
635 }
579 636
580 psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder), 637 psb_intel_encoder = kzalloc(sizeof(struct psb_intel_encoder),
581 GFP_KERNEL); 638 GFP_KERNEL);