drm/i915: allow pipe A for lvds on gen4
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / i915 / intel_lvds.c
index 30e2c82101de0d8cb0c841d97f77db6acfc501aa..ab4d6479261681b46fe1c5c8c15b60566d3aea36 100644 (file)
@@ -71,6 +71,7 @@ static struct intel_lvds *intel_attached_lvds(struct drm_connector *connector)
 static void intel_lvds_enable(struct intel_lvds *intel_lvds)
 {
        struct drm_device *dev = intel_lvds->base.base.dev;
+       struct intel_crtc *intel_crtc = to_intel_crtc(intel_lvds->base.base.crtc);
        struct drm_i915_private *dev_priv = dev->dev_private;
        u32 ctl_reg, lvds_reg, stat_reg;
 
@@ -107,7 +108,7 @@ static void intel_lvds_enable(struct intel_lvds *intel_lvds)
        if (wait_for((I915_READ(stat_reg) & PP_ON) != 0, 1000))
                DRM_ERROR("timed out waiting for panel to power on\n");
 
-       intel_panel_enable_backlight(dev);
+       intel_panel_enable_backlight(dev, intel_crtc->pipe);
 }
 
 static void intel_lvds_disable(struct intel_lvds *intel_lvds)
@@ -480,7 +481,7 @@ static int intel_lvds_get_modes(struct drm_connector *connector)
 
 static int intel_no_modeset_on_lid_dmi_callback(const struct dmi_system_id *id)
 {
-       DRM_DEBUG_KMS("Skipping forced modeset for %s\n", id->ident);
+       DRM_INFO("Skipping forced modeset for %s\n", id->ident);
        return 1;
 }
 
@@ -628,7 +629,7 @@ static const struct drm_encoder_funcs intel_lvds_enc_funcs = {
 
 static int __init intel_no_lvds_dmi_callback(const struct dmi_system_id *id)
 {
-       DRM_DEBUG_KMS("Skipping LVDS initialization for %s\n", id->ident);
+       DRM_INFO("Skipping LVDS initialization for %s\n", id->ident);
        return 1;
 }
 
@@ -745,12 +746,20 @@ static const struct dmi_system_id intel_no_lvds[] = {
                        DMI_MATCH(DMI_BOARD_NAME, "AT5NM10T-I"),
                },
        },
+       {
+               .callback = intel_no_lvds_dmi_callback,
+               .ident = "Hewlett-Packard HP t5740e Thin Client",
+               .matches = {
+                       DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "HP t5740e Thin Client"),
+               },
+       },
        {
                .callback = intel_no_lvds_dmi_callback,
                .ident = "Hewlett-Packard t5745",
                .matches = {
                        DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
-                       DMI_MATCH(DMI_BOARD_NAME, "hp t5745"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "hp t5745"),
                },
        },
        {
@@ -758,7 +767,7 @@ static const struct dmi_system_id intel_no_lvds[] = {
                .ident = "Hewlett-Packard st5747",
                .matches = {
                        DMI_MATCH(DMI_BOARD_VENDOR, "Hewlett-Packard"),
-                       DMI_MATCH(DMI_BOARD_NAME, "hp st5747"),
+                       DMI_MATCH(DMI_PRODUCT_NAME, "hp st5747"),
                },
        },
        {
@@ -851,8 +860,8 @@ static bool lvds_is_present_in_vbt(struct drm_device *dev,
                    child->device_type != DEVICE_TYPE_LFP)
                        continue;
 
-               if (child->i2c_pin)
-                   *i2c_pin = child->i2c_pin;
+               if (intel_gmbus_is_port_valid(child->i2c_pin))
+                       *i2c_pin = child->i2c_pin;
 
                /* However, we cannot trust the BIOS writers to populate
                 * the VBT correctly.  Since LVDS requires additional
@@ -959,6 +968,8 @@ bool intel_lvds_init(struct drm_device *dev)
        intel_encoder->clone_mask = (1 << INTEL_LVDS_CLONE_BIT);
        if (HAS_PCH_SPLIT(dev))
                intel_encoder->crtc_mask = (1 << 0) | (1 << 1) | (1 << 2);
+       else if (IS_GEN4(dev))
+               intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
        else
                intel_encoder->crtc_mask = (1 << 1);
 
@@ -993,7 +1004,8 @@ bool intel_lvds_init(struct drm_device *dev)
         * preferred mode is the right one.
         */
        intel_lvds->edid = drm_get_edid(connector,
-                                       &dev_priv->gmbus[pin].adapter);
+                                       intel_gmbus_get_adapter(dev_priv,
+                                                               pin));
        if (intel_lvds->edid) {
                if (drm_add_edid_modes(connector,
                                       intel_lvds->edid)) {
@@ -1065,35 +1077,14 @@ bool intel_lvds_init(struct drm_device *dev)
                goto failed;
 
 out:
+       /*
+        * Unlock registers and just
+        * leave them unlocked
+        */
        if (HAS_PCH_SPLIT(dev)) {
-               u32 pwm;
-
-               pipe = (I915_READ(PCH_LVDS) & LVDS_PIPEB_SELECT) ? 1 : 0;
-
-               /* make sure PWM is enabled and locked to the LVDS pipe */
-               pwm = I915_READ(BLC_PWM_CPU_CTL2);
-               if (pipe == 0 && (pwm & PWM_PIPE_B))
-                       I915_WRITE(BLC_PWM_CPU_CTL2, pwm & ~PWM_ENABLE);
-               if (pipe)
-                       pwm |= PWM_PIPE_B;
-               else
-                       pwm &= ~PWM_PIPE_B;
-               I915_WRITE(BLC_PWM_CPU_CTL2, pwm | PWM_ENABLE);
-
-               pwm = I915_READ(BLC_PWM_PCH_CTL1);
-               pwm |= PWM_PCH_ENABLE;
-               I915_WRITE(BLC_PWM_PCH_CTL1, pwm);
-               /*
-                * Unlock registers and just
-                * leave them unlocked
-                */
                I915_WRITE(PCH_PP_CONTROL,
                           I915_READ(PCH_PP_CONTROL) | PANEL_UNLOCK_REGS);
        } else {
-               /*
-                * Unlock registers and just
-                * leave them unlocked
-                */
                I915_WRITE(PP_CONTROL,
                           I915_READ(PP_CONTROL) | PANEL_UNLOCK_REGS);
        }