@@ -558,6 +558,9 @@ static int i915_drm_freeze(struct drm_device *dev)
intel_fbdev_set_suspend(dev, FBINFO_STATE_SUSPENDED);
console_unlock();
+ if (IS_VALLEYVIEW(dev))
+ valleyview_program_pfi_credits(dev_priv, false);
+
dev_priv->suspend_count++;
intel_display_set_init_power(dev_priv, false);
@@ -693,6 +696,9 @@ static int __i915_drm_thaw(struct drm_device *dev, bool restore_gtt_mappings)
dev_priv->modeset_restore = MODESET_DONE;
mutex_unlock(&dev_priv->modeset_restore_lock);
+ if (IS_VALLEYVIEW(dev))
+ valleyview_program_pfi_credits(dev_priv, true);
+
intel_opregion_notify_adapter(dev, PCI_D0);
return 0;
@@ -2152,6 +2152,8 @@ extern struct i915_params i915 __read_mostly;
/* i915_dma.c */
void i915_update_dri1_breadcrumb(struct drm_device *dev);
+extern void valleyview_program_pfi_credits(struct drm_i915_private *dev_priv,
+ bool flag);
extern void i915_kernel_lost_context(struct drm_device * dev);
extern int i915_driver_load(struct drm_device *, unsigned long flags);
extern int i915_driver_unload(struct drm_device *);
@@ -1914,6 +1914,11 @@ enum punit_power_well {
#define CZCLK_FREQ_MASK 0xf
#define GMBUSFREQ_VLV (VLV_DISPLAY_BASE + 0x6510)
+#define GCI_CONTROL (VLV_DISPLAY_BASE + 0x650C)
+#define PFI_CREDIT (7 << 28)
+#define PFI_CREDIT_RESEND (1 << 27)
+#define VGA_FAST_MODE_DISABLE (1 << 14)
+
/*
* Palette regs
*/
@@ -12555,8 +12555,10 @@ void intel_modeset_init_hw(struct drm_device *dev)
{
intel_prepare_ddi(dev);
- if (IS_VALLEYVIEW(dev))
+ if (IS_VALLEYVIEW(dev)) {
vlv_update_cdclk(dev);
+ valleyview_program_pfi_credits(dev->dev_private, true);
+ }
intel_init_clock_gating(dev);
@@ -6780,6 +6780,28 @@ void intel_fini_runtime_pm(struct drm_i915_private *dev_priv)
pm_runtime_disable(device);
}
+void valleyview_program_pfi_credits(struct drm_i915_private *dev_priv,
+ bool flag)
+{
+ int cd_clk, cz_clk;
+
+ if (!flag) {
+ I915_WRITE(GCI_CONTROL, VGA_FAST_MODE_DISABLE);
+ return;
+ }
+
+ cd_clk = dev_priv->display.get_display_clock_speed(dev_priv->dev);
+ cz_clk = valleyview_get_cz_clock_speed(dev_priv->dev);
+
+ if (cd_clk >= cz_clk) {
+ /* WA - write default credits before re-programming */
+ I915_WRITE(GCI_CONTROL, VGA_FAST_MODE_DISABLE);
+ I915_WRITE(GCI_CONTROL, (PFI_CREDIT | PFI_CREDIT_RESEND |
+ VGA_FAST_MODE_DISABLE));
+ } else
+ DRM_DEBUG_KMS("cd clk < cz clk");
+}
+
/* Set up chip specific power management-related functions */
void intel_init_pm(struct drm_device *dev)
{