Commit 04410279 authored by Dave Airlie's avatar Dave Airlie

Merge remote branch 'intel/drm-intel-fixes' of /ssd/git/drm-next into drm-fixes

* 'intel/drm-intel-fixes' of /ssd/git/drm-next:
  drm/i915/bios: Reverse order of 100/120 Mhz SSC clocks
  agp/intel: Fix missed cached memory flags setting in i965_write_entry()
  drm/i915/sdvo: Only use the SDVO pin if it is in the valid range
  drm/i915/ringbuffer: Handle wrapping of the autoreported HEAD
  drm/i915/dp: Fix I2C/EDID handling with active DisplayPort to DVI converter
parents a4851d8f 448f53a1
...@@ -1192,12 +1192,19 @@ static void i9xx_chipset_flush(void) ...@@ -1192,12 +1192,19 @@ static void i9xx_chipset_flush(void)
writel(1, intel_private.i9xx_flush_page); writel(1, intel_private.i9xx_flush_page);
} }
static void i965_write_entry(dma_addr_t addr, unsigned int entry, static void i965_write_entry(dma_addr_t addr,
unsigned int entry,
unsigned int flags) unsigned int flags)
{ {
u32 pte_flags;
pte_flags = I810_PTE_VALID;
if (flags == AGP_USER_CACHED_MEMORY)
pte_flags |= I830_PTE_SYSTEM_CACHED;
/* Shift high bits down */ /* Shift high bits down */
addr |= (addr >> 28) & 0xf0; addr |= (addr >> 28) & 0xf0;
writel(addr | I810_PTE_VALID, intel_private.gtt + entry); writel(addr | pte_flags, intel_private.gtt + entry);
} }
static bool gen6_check_flags(unsigned int flags) static bool gen6_check_flags(unsigned int flags)
......
...@@ -270,7 +270,7 @@ parse_general_features(struct drm_i915_private *dev_priv, ...@@ -270,7 +270,7 @@ parse_general_features(struct drm_i915_private *dev_priv,
general->ssc_freq ? 66 : 48; general->ssc_freq ? 66 : 48;
else if (IS_GEN5(dev) || IS_GEN6(dev)) else if (IS_GEN5(dev) || IS_GEN6(dev))
dev_priv->lvds_ssc_freq = dev_priv->lvds_ssc_freq =
general->ssc_freq ? 100 : 120; general->ssc_freq ? 120 : 100;
else else
dev_priv->lvds_ssc_freq = dev_priv->lvds_ssc_freq =
general->ssc_freq ? 100 : 96; general->ssc_freq ? 100 : 96;
......
...@@ -479,6 +479,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, ...@@ -479,6 +479,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
uint16_t address = algo_data->address; uint16_t address = algo_data->address;
uint8_t msg[5]; uint8_t msg[5];
uint8_t reply[2]; uint8_t reply[2];
unsigned retry;
int msg_bytes; int msg_bytes;
int reply_bytes; int reply_bytes;
int ret; int ret;
...@@ -513,14 +514,33 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, ...@@ -513,14 +514,33 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
break; break;
} }
for (;;) { for (retry = 0; retry < 5; retry++) {
ret = intel_dp_aux_ch(intel_dp, ret = intel_dp_aux_ch(intel_dp,
msg, msg_bytes, msg, msg_bytes,
reply, reply_bytes); reply, reply_bytes);
if (ret < 0) { if (ret < 0) {
DRM_DEBUG_KMS("aux_ch failed %d\n", ret); DRM_DEBUG_KMS("aux_ch failed %d\n", ret);
return ret; return ret;
} }
switch (reply[0] & AUX_NATIVE_REPLY_MASK) {
case AUX_NATIVE_REPLY_ACK:
/* I2C-over-AUX Reply field is only valid
* when paired with AUX ACK.
*/
break;
case AUX_NATIVE_REPLY_NACK:
DRM_DEBUG_KMS("aux_ch native nack\n");
return -EREMOTEIO;
case AUX_NATIVE_REPLY_DEFER:
udelay(100);
continue;
default:
DRM_ERROR("aux_ch invalid native reply 0x%02x\n",
reply[0]);
return -EREMOTEIO;
}
switch (reply[0] & AUX_I2C_REPLY_MASK) { switch (reply[0] & AUX_I2C_REPLY_MASK) {
case AUX_I2C_REPLY_ACK: case AUX_I2C_REPLY_ACK:
if (mode == MODE_I2C_READ) { if (mode == MODE_I2C_READ) {
...@@ -528,17 +548,20 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode, ...@@ -528,17 +548,20 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
} }
return reply_bytes - 1; return reply_bytes - 1;
case AUX_I2C_REPLY_NACK: case AUX_I2C_REPLY_NACK:
DRM_DEBUG_KMS("aux_ch nack\n"); DRM_DEBUG_KMS("aux_i2c nack\n");
return -EREMOTEIO; return -EREMOTEIO;
case AUX_I2C_REPLY_DEFER: case AUX_I2C_REPLY_DEFER:
DRM_DEBUG_KMS("aux_ch defer\n"); DRM_DEBUG_KMS("aux_i2c defer\n");
udelay(100); udelay(100);
break; break;
default: default:
DRM_ERROR("aux_ch invalid reply 0x%02x\n", reply[0]); DRM_ERROR("aux_i2c invalid reply 0x%02x\n", reply[0]);
return -EREMOTEIO; return -EREMOTEIO;
} }
} }
DRM_ERROR("too many retries, giving up\n");
return -EREMOTEIO;
} }
static int static int
......
...@@ -696,20 +696,17 @@ int intel_wait_ring_buffer(struct drm_device *dev, ...@@ -696,20 +696,17 @@ int intel_wait_ring_buffer(struct drm_device *dev,
drm_i915_private_t *dev_priv = dev->dev_private; drm_i915_private_t *dev_priv = dev->dev_private;
u32 head; u32 head;
head = intel_read_status_page(ring, 4);
if (head) {
ring->head = head & HEAD_ADDR;
ring->space = ring->head - (ring->tail + 8);
if (ring->space < 0)
ring->space += ring->size;
if (ring->space >= n)
return 0;
}
trace_i915_ring_wait_begin (dev); trace_i915_ring_wait_begin (dev);
end = jiffies + 3 * HZ; end = jiffies + 3 * HZ;
do { do {
ring->head = I915_READ_HEAD(ring) & HEAD_ADDR; /* If the reported head position has wrapped or hasn't advanced,
* fallback to the slow and accurate path.
*/
head = intel_read_status_page(ring, 4);
if (head < ring->actual_head)
head = I915_READ_HEAD(ring);
ring->actual_head = head;
ring->head = head & HEAD_ADDR;
ring->space = ring->head - (ring->tail + 8); ring->space = ring->head - (ring->tail + 8);
if (ring->space < 0) if (ring->space < 0)
ring->space += ring->size; ring->space += ring->size;
......
...@@ -30,8 +30,9 @@ struct intel_ring_buffer { ...@@ -30,8 +30,9 @@ struct intel_ring_buffer {
struct drm_device *dev; struct drm_device *dev;
struct drm_gem_object *gem_object; struct drm_gem_object *gem_object;
unsigned int head; u32 actual_head;
unsigned int tail; u32 head;
u32 tail;
int space; int space;
struct intel_hw_status_page status_page; struct intel_hw_status_page status_page;
......
...@@ -1908,9 +1908,12 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv, ...@@ -1908,9 +1908,12 @@ intel_sdvo_select_i2c_bus(struct drm_i915_private *dev_priv,
speed = mapping->i2c_speed; speed = mapping->i2c_speed;
} }
sdvo->i2c = &dev_priv->gmbus[pin].adapter; if (pin < GMBUS_NUM_PORTS) {
intel_gmbus_set_speed(sdvo->i2c, speed); sdvo->i2c = &dev_priv->gmbus[pin].adapter;
intel_gmbus_force_bit(sdvo->i2c, true); intel_gmbus_set_speed(sdvo->i2c, speed);
intel_gmbus_force_bit(sdvo->i2c, true);
} else
sdvo->i2c = &dev_priv->gmbus[GMBUS_PORT_DPB].adapter;
} }
static bool static bool
......
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