@@ -1056,6 +1056,10 @@
#define LVDS_PIPEB_SELECT (1 << 30)
/* LVDS dithering flag on 965/g4x platform */
#define LVDS_ENABLE_DITHER (1 << 25)
+/* LVDS sync polarity flags. Set to invert (i.e. negative) */
+#define LVDS_VSYNC_POLARITY (1 << 21)
+#define LVDS_HSYNC_POLARITY (1 << 20)
+
/* Enable border for unscaled (or aspect-scaled) display */
#define LVDS_BORDER_ENABLE (1 << 15)
/*
@@ -3334,6 +3334,29 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
lvds &= ~LVDS_ENABLE_DITHER;
}
}
+ /* Only tested on pineview, should work on IS_9XX */
+ if (IS_PINEVIEW(dev)) {
+ /* Set sync polarity for case when vbios did not */
+ char curhs, curvs, newhs, newvs;
+ curhs = (lvds & LVDS_HSYNC_POLARITY) ? '-' : '+';
+ curvs = (lvds & LVDS_VSYNC_POLARITY) ? '-' : '+';
+ newhs = (adjusted_mode->flags & DRM_MODE_FLAG_NHSYNC) ?
+ '-' : '+';
+ newvs = (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) ?
+ '-' : '+';
+ if ((newhs != curhs) || (newvs != curvs)) {
+ DRM_INFO("Change lvds panel from %chsync "
+ "%cvsync to %chsync %cvsync\n",
+ curhs, curvs, newhs, newvs);
+ /* Clear to both + polarity */
+ lvds &= ~(LVDS_HSYNC_POLARITY |
+ LVDS_VSYNC_POLARITY);
+ if (newhs == '-')
+ lvds |= LVDS_HSYNC_POLARITY;
+ if (newvs == '-')
+ lvds |= LVDS_VSYNC_POLARITY;
+ }
+ }
I915_WRITE(lvds_reg, lvds);
I915_READ(lvds_reg);
}