Commit bee6bd0a authored by Dave Airlie's avatar Dave Airlie

Merge tag 'drm-intel-next-fixes-2014-10-17' of...

Merge tag 'drm-intel-next-fixes-2014-10-17' of git://anongit.freedesktop.org/drm-intel into drm-fixes

first set of i915 fixes, all over.

* tag 'drm-intel-next-fixes-2014-10-17' of git://anongit.freedesktop.org/drm-intel:
  drm/i915: fix short vs. long hpd detection
  drm/i915: Don't trust the DP_DETECT bit for eDP ports on CHV
  drm/i915: properly reenable gen8 pipe IRQs
  drm/i915: Move DIV_ROUND_CLOSEST_ULL macro to header
  drm/i915: intel_backlight scale() math WA
parents da36bbd0 07c338ce
...@@ -1711,7 +1711,7 @@ static irqreturn_t gen8_gt_irq_handler(struct drm_device *dev, ...@@ -1711,7 +1711,7 @@ static irqreturn_t gen8_gt_irq_handler(struct drm_device *dev,
#define HPD_STORM_DETECT_PERIOD 1000 #define HPD_STORM_DETECT_PERIOD 1000
#define HPD_STORM_THRESHOLD 5 #define HPD_STORM_THRESHOLD 5
static int ilk_port_to_hotplug_shift(enum port port) static int pch_port_to_hotplug_shift(enum port port)
{ {
switch (port) { switch (port) {
case PORT_A: case PORT_A:
...@@ -1727,7 +1727,7 @@ static int ilk_port_to_hotplug_shift(enum port port) ...@@ -1727,7 +1727,7 @@ static int ilk_port_to_hotplug_shift(enum port port)
} }
} }
static int g4x_port_to_hotplug_shift(enum port port) static int i915_port_to_hotplug_shift(enum port port)
{ {
switch (port) { switch (port) {
case PORT_A: case PORT_A:
...@@ -1785,12 +1785,12 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev, ...@@ -1785,12 +1785,12 @@ static inline void intel_hpd_irq_handler(struct drm_device *dev,
if (port && dev_priv->hpd_irq_port[port]) { if (port && dev_priv->hpd_irq_port[port]) {
bool long_hpd; bool long_hpd;
if (IS_G4X(dev)) { if (HAS_PCH_SPLIT(dev)) {
dig_shift = g4x_port_to_hotplug_shift(port); dig_shift = pch_port_to_hotplug_shift(port);
long_hpd = (hotplug_trigger >> dig_shift) & PORTB_HOTPLUG_LONG_DETECT;
} else {
dig_shift = ilk_port_to_hotplug_shift(port);
long_hpd = (dig_hotplug_reg >> dig_shift) & PORTB_HOTPLUG_LONG_DETECT; long_hpd = (dig_hotplug_reg >> dig_shift) & PORTB_HOTPLUG_LONG_DETECT;
} else {
dig_shift = i915_port_to_hotplug_shift(port);
long_hpd = (hotplug_trigger >> dig_shift) & PORTB_HOTPLUG_LONG_DETECT;
} }
DRM_DEBUG_DRIVER("digital hpd port %c - %s\n", DRM_DEBUG_DRIVER("digital hpd port %c - %s\n",
...@@ -3458,12 +3458,13 @@ static void gen8_irq_reset(struct drm_device *dev) ...@@ -3458,12 +3458,13 @@ static void gen8_irq_reset(struct drm_device *dev)
void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv) void gen8_irq_power_well_post_enable(struct drm_i915_private *dev_priv)
{ {
unsigned long irqflags; unsigned long irqflags;
uint32_t extra_ier = GEN8_PIPE_VBLANK | GEN8_PIPE_FIFO_UNDERRUN;
spin_lock_irqsave(&dev_priv->irq_lock, irqflags); spin_lock_irqsave(&dev_priv->irq_lock, irqflags);
GEN8_IRQ_INIT_NDX(DE_PIPE, PIPE_B, dev_priv->de_irq_mask[PIPE_B], GEN8_IRQ_INIT_NDX(DE_PIPE, PIPE_B, dev_priv->de_irq_mask[PIPE_B],
~dev_priv->de_irq_mask[PIPE_B]); ~dev_priv->de_irq_mask[PIPE_B] | extra_ier);
GEN8_IRQ_INIT_NDX(DE_PIPE, PIPE_C, dev_priv->de_irq_mask[PIPE_C], GEN8_IRQ_INIT_NDX(DE_PIPE, PIPE_C, dev_priv->de_irq_mask[PIPE_C],
~dev_priv->de_irq_mask[PIPE_C]); ~dev_priv->de_irq_mask[PIPE_C] | extra_ier);
spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags); spin_unlock_irqrestore(&dev_priv->irq_lock, irqflags);
} }
......
...@@ -73,9 +73,6 @@ static const uint32_t intel_cursor_formats[] = { ...@@ -73,9 +73,6 @@ static const uint32_t intel_cursor_formats[] = {
DRM_FORMAT_ARGB8888, DRM_FORMAT_ARGB8888,
}; };
#define DIV_ROUND_CLOSEST_ULL(ll, d) \
({ unsigned long long _tmp = (ll)+(d)/2; do_div(_tmp, d); _tmp; })
static void intel_increase_pllclock(struct drm_device *dev, static void intel_increase_pllclock(struct drm_device *dev,
enum pipe pipe); enum pipe pipe);
static void intel_crtc_update_cursor(struct drm_crtc *crtc, bool on); static void intel_crtc_update_cursor(struct drm_crtc *crtc, bool on);
...@@ -12357,27 +12354,36 @@ static void intel_setup_outputs(struct drm_device *dev) ...@@ -12357,27 +12354,36 @@ static void intel_setup_outputs(struct drm_device *dev)
if (I915_READ(PCH_DP_D) & DP_DETECTED) if (I915_READ(PCH_DP_D) & DP_DETECTED)
intel_dp_init(dev, PCH_DP_D, PORT_D); intel_dp_init(dev, PCH_DP_D, PORT_D);
} else if (IS_VALLEYVIEW(dev)) { } else if (IS_VALLEYVIEW(dev)) {
if (I915_READ(VLV_DISPLAY_BASE + GEN4_HDMIB) & SDVO_DETECTED) { /*
* The DP_DETECTED bit is the latched state of the DDC
* SDA pin at boot. However since eDP doesn't require DDC
* (no way to plug in a DP->HDMI dongle) the DDC pins for
* eDP ports may have been muxed to an alternate function.
* Thus we can't rely on the DP_DETECTED bit alone to detect
* eDP ports. Consult the VBT as well as DP_DETECTED to
* detect eDP ports.
*/
if (I915_READ(VLV_DISPLAY_BASE + GEN4_HDMIB) & SDVO_DETECTED)
intel_hdmi_init(dev, VLV_DISPLAY_BASE + GEN4_HDMIB, intel_hdmi_init(dev, VLV_DISPLAY_BASE + GEN4_HDMIB,
PORT_B); PORT_B);
if (I915_READ(VLV_DISPLAY_BASE + DP_B) & DP_DETECTED) if (I915_READ(VLV_DISPLAY_BASE + DP_B) & DP_DETECTED ||
intel_dp_init(dev, VLV_DISPLAY_BASE + DP_B, PORT_B); intel_dp_is_edp(dev, PORT_B))
} intel_dp_init(dev, VLV_DISPLAY_BASE + DP_B, PORT_B);
if (I915_READ(VLV_DISPLAY_BASE + GEN4_HDMIC) & SDVO_DETECTED) { if (I915_READ(VLV_DISPLAY_BASE + GEN4_HDMIC) & SDVO_DETECTED)
intel_hdmi_init(dev, VLV_DISPLAY_BASE + GEN4_HDMIC, intel_hdmi_init(dev, VLV_DISPLAY_BASE + GEN4_HDMIC,
PORT_C); PORT_C);
if (I915_READ(VLV_DISPLAY_BASE + DP_C) & DP_DETECTED) if (I915_READ(VLV_DISPLAY_BASE + DP_C) & DP_DETECTED ||
intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C, PORT_C); intel_dp_is_edp(dev, PORT_C))
} intel_dp_init(dev, VLV_DISPLAY_BASE + DP_C, PORT_C);
if (IS_CHERRYVIEW(dev)) { if (IS_CHERRYVIEW(dev)) {
if (I915_READ(VLV_DISPLAY_BASE + CHV_HDMID) & SDVO_DETECTED) { if (I915_READ(VLV_DISPLAY_BASE + CHV_HDMID) & SDVO_DETECTED)
intel_hdmi_init(dev, VLV_DISPLAY_BASE + CHV_HDMID, intel_hdmi_init(dev, VLV_DISPLAY_BASE + CHV_HDMID,
PORT_D); PORT_D);
if (I915_READ(VLV_DISPLAY_BASE + DP_D) & DP_DETECTED) /* eDP not supported on port D, so don't check VBT */
intel_dp_init(dev, VLV_DISPLAY_BASE + DP_D, PORT_D); if (I915_READ(VLV_DISPLAY_BASE + DP_D) & DP_DETECTED)
} intel_dp_init(dev, VLV_DISPLAY_BASE + DP_D, PORT_D);
} }
intel_dsi_init(dev); intel_dsi_init(dev);
......
...@@ -35,6 +35,9 @@ ...@@ -35,6 +35,9 @@
#include <drm/drm_fb_helper.h> #include <drm/drm_fb_helper.h>
#include <drm/drm_dp_mst_helper.h> #include <drm/drm_dp_mst_helper.h>
#define DIV_ROUND_CLOSEST_ULL(ll, d) \
({ unsigned long long _tmp = (ll)+(d)/2; do_div(_tmp, d); _tmp; })
/** /**
* _wait_for - magic (register) wait macro * _wait_for - magic (register) wait macro
* *
......
...@@ -419,9 +419,8 @@ static uint32_t scale(uint32_t source_val, ...@@ -419,9 +419,8 @@ static uint32_t scale(uint32_t source_val,
source_val = clamp(source_val, source_min, source_max); source_val = clamp(source_val, source_min, source_max);
/* avoid overflows */ /* avoid overflows */
target_val = (uint64_t)(source_val - source_min) * target_val = DIV_ROUND_CLOSEST_ULL((uint64_t)(source_val - source_min) *
(target_max - target_min); (target_max - target_min), source_max - source_min);
do_div(target_val, source_max - source_min);
target_val += target_min; target_val += target_min;
return target_val; return target_val;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment