drm/i915: allow pipe A for lvds on gen4
[firefly-linux-kernel-4.4.55.git] / drivers / gpu / drm / i915 / intel_lvds.c
index 9dee82350defb0590ecc16326a4cdd712d15b0e4..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)
@@ -745,6 +746,14 @@ 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",
@@ -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);
 
@@ -1066,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);
        }