drm/i915: Add HDMI support on IGDNG
authorZhenyu Wang <zhenyuw@linux.intel.com>
Fri, 5 Jun 2009 07:38:43 +0000 (15:38 +0800)
committerEric Anholt <eric@anholt.net>
Fri, 5 Jun 2009 11:35:17 +0000 (11:35 +0000)
Signed-off-by: Zhenyu Wang <zhenyuw@linux.intel.com>
Signed-off-by: Eric Anholt <eric@anholt.net>
drivers/gpu/drm/i915/intel_display.c
drivers/gpu/drm/i915/intel_hdmi.c

index 2cd6ba6523d8c88c97e0c71a9fc2aba81ae3b6e3..53cf6efa67b60bd208d90aedab70c7859bdff2d8 100644 (file)
@@ -2432,7 +2432,22 @@ static void intel_setup_outputs(struct drm_device *dev)
                intel_lvds_init(dev);
 
        if (IS_IGDNG(dev)) {
-               /* ignore for other outputs */
+               int found;
+
+               if (I915_READ(HDMIB) & PORT_DETECTED) {
+                       /* check SDVOB */
+                       /* found = intel_sdvo_init(dev, HDMIB); */
+                       found = 0;
+                       if (!found)
+                               intel_hdmi_init(dev, HDMIB);
+               }
+
+               if (I915_READ(HDMIC) & PORT_DETECTED)
+                       intel_hdmi_init(dev, HDMIC);
+
+               if (I915_READ(HDMID) & PORT_DETECTED)
+                       intel_hdmi_init(dev, HDMID);
+
        } else if (IS_I9XX(dev)) {
                int found;
                u32 reg;
index d0983bb93a18e4cbc6a5af57198adfa2c8f5254d..d874b0c4b0657473a2bee821c886bbef4de38e90 100644 (file)
@@ -56,7 +56,8 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
        sdvox = SDVO_ENCODING_HDMI |
                SDVO_BORDER_ENABLE |
                SDVO_VSYNC_ACTIVE_HIGH |
-               SDVO_HSYNC_ACTIVE_HIGH;
+               SDVO_HSYNC_ACTIVE_HIGH |
+               SDVO_NULL_PACKETS_DURING_VSYNC;
 
        if (hdmi_priv->has_hdmi_sink)
                sdvox |= SDVO_AUDIO_ENABLE;
@@ -144,6 +145,22 @@ intel_hdmi_sink_detect(struct drm_connector *connector)
        }
 }
 
+static enum drm_connector_status
+igdng_hdmi_detect(struct drm_connector *connector)
+{
+       struct intel_output *intel_output = to_intel_output(connector);
+       struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
+
+       /* FIXME hotplug detect */
+
+       hdmi_priv->has_hdmi_sink = false;
+       intel_hdmi_sink_detect(connector);
+       if (hdmi_priv->has_hdmi_sink)
+               return connector_status_connected;
+       else
+               return connector_status_disconnected;
+}
+
 static enum drm_connector_status
 intel_hdmi_detect(struct drm_connector *connector)
 {
@@ -153,6 +170,9 @@ intel_hdmi_detect(struct drm_connector *connector)
        struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv;
        u32 temp, bit;
 
+       if (IS_IGDNG(dev))
+               return igdng_hdmi_detect(connector);
+
        temp = I915_READ(PORT_HOTPLUG_EN);
 
        switch (hdmi_priv->sdvox_reg) {
@@ -268,8 +288,17 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
        /* Set up the DDC bus. */
        if (sdvox_reg == SDVOB)
                intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB");
-       else
+       else if (sdvox_reg == SDVOC)
                intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC");
+       else if (sdvox_reg == HDMIB)
+               intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE,
+                                                               "HDMIB");
+       else if (sdvox_reg == HDMIC)
+               intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD,
+                                                               "HDMIC");
+       else if (sdvox_reg == HDMID)
+               intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF,
+                                                               "HDMID");
 
        if (!intel_output->ddc_bus)
                goto err_connector;