Commit 822974ae authored by Paulo Zanoni's avatar Paulo Zanoni Committed by Daniel Vetter

drm/i915: enable DIP before enabling each InfoFrame

So the write_infoframe function can assume the DIP is on.

V2: Be more defensive and add WARN().
Signed-off-by: default avatarPaulo Zanoni <paulo.r.zanoni@intel.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent f278d972
...@@ -124,11 +124,12 @@ static void g4x_write_infoframe(struct drm_encoder *encoder, ...@@ -124,11 +124,12 @@ static void g4x_write_infoframe(struct drm_encoder *encoder,
u32 val = I915_READ(VIDEO_DIP_CTL); u32 val = I915_READ(VIDEO_DIP_CTL);
unsigned i, len = DIP_HEADER_SIZE + frame->len; unsigned i, len = DIP_HEADER_SIZE + frame->len;
WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */ val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
val |= g4x_infoframe_index(frame); val |= g4x_infoframe_index(frame);
val &= ~g4x_infoframe_enable(frame); val &= ~g4x_infoframe_enable(frame);
val |= VIDEO_DIP_ENABLE;
I915_WRITE(VIDEO_DIP_CTL, val); I915_WRITE(VIDEO_DIP_CTL, val);
...@@ -155,13 +156,14 @@ static void ibx_write_infoframe(struct drm_encoder *encoder, ...@@ -155,13 +156,14 @@ static void ibx_write_infoframe(struct drm_encoder *encoder,
unsigned i, len = DIP_HEADER_SIZE + frame->len; unsigned i, len = DIP_HEADER_SIZE + frame->len;
u32 val = I915_READ(reg); u32 val = I915_READ(reg);
WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
intel_wait_for_vblank(dev, intel_crtc->pipe); intel_wait_for_vblank(dev, intel_crtc->pipe);
val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */ val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
val |= g4x_infoframe_index(frame); val |= g4x_infoframe_index(frame);
val &= ~g4x_infoframe_enable(frame); val &= ~g4x_infoframe_enable(frame);
val |= VIDEO_DIP_ENABLE;
I915_WRITE(reg, val); I915_WRITE(reg, val);
...@@ -188,6 +190,8 @@ static void cpt_write_infoframe(struct drm_encoder *encoder, ...@@ -188,6 +190,8 @@ static void cpt_write_infoframe(struct drm_encoder *encoder,
unsigned i, len = DIP_HEADER_SIZE + frame->len; unsigned i, len = DIP_HEADER_SIZE + frame->len;
u32 val = I915_READ(reg); u32 val = I915_READ(reg);
WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
intel_wait_for_vblank(dev, intel_crtc->pipe); intel_wait_for_vblank(dev, intel_crtc->pipe);
val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */ val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
...@@ -195,13 +199,9 @@ static void cpt_write_infoframe(struct drm_encoder *encoder, ...@@ -195,13 +199,9 @@ static void cpt_write_infoframe(struct drm_encoder *encoder,
/* The DIP control register spec says that we need to update the AVI /* The DIP control register spec says that we need to update the AVI
* infoframe without clearing its enable bit */ * infoframe without clearing its enable bit */
if (frame->type == DIP_TYPE_AVI) if (frame->type != DIP_TYPE_AVI)
val |= VIDEO_DIP_ENABLE_AVI;
else
val &= ~g4x_infoframe_enable(frame); val &= ~g4x_infoframe_enable(frame);
val |= VIDEO_DIP_ENABLE;
I915_WRITE(reg, val); I915_WRITE(reg, val);
for (i = 0; i < len; i += 4) { for (i = 0; i < len; i += 4) {
...@@ -227,13 +227,14 @@ static void vlv_write_infoframe(struct drm_encoder *encoder, ...@@ -227,13 +227,14 @@ static void vlv_write_infoframe(struct drm_encoder *encoder,
unsigned i, len = DIP_HEADER_SIZE + frame->len; unsigned i, len = DIP_HEADER_SIZE + frame->len;
u32 val = I915_READ(reg); u32 val = I915_READ(reg);
WARN(!(val & VIDEO_DIP_ENABLE), "Writing DIP with CTL reg disabled\n");
intel_wait_for_vblank(dev, intel_crtc->pipe); intel_wait_for_vblank(dev, intel_crtc->pipe);
val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */ val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
val |= g4x_infoframe_index(frame); val |= g4x_infoframe_index(frame);
val &= ~g4x_infoframe_enable(frame); val &= ~g4x_infoframe_enable(frame);
val |= VIDEO_DIP_ENABLE;
I915_WRITE(reg, val); I915_WRITE(reg, val);
...@@ -356,6 +357,8 @@ static void g4x_set_infoframes(struct drm_encoder *encoder, ...@@ -356,6 +357,8 @@ static void g4x_set_infoframes(struct drm_encoder *encoder,
return; return;
} }
val |= VIDEO_DIP_ENABLE;
I915_WRITE(reg, val); I915_WRITE(reg, val);
intel_hdmi_set_avi_infoframe(encoder, adjusted_mode); intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
...@@ -397,6 +400,8 @@ static void ibx_set_infoframes(struct drm_encoder *encoder, ...@@ -397,6 +400,8 @@ static void ibx_set_infoframes(struct drm_encoder *encoder,
return; return;
} }
val |= VIDEO_DIP_ENABLE;
I915_WRITE(reg, val); I915_WRITE(reg, val);
intel_hdmi_set_avi_infoframe(encoder, adjusted_mode); intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
...@@ -423,6 +428,11 @@ static void cpt_set_infoframes(struct drm_encoder *encoder, ...@@ -423,6 +428,11 @@ static void cpt_set_infoframes(struct drm_encoder *encoder,
return; return;
} }
/* Set both together, unset both together: see the spec. */
val |= VIDEO_DIP_ENABLE | VIDEO_DIP_ENABLE_AVI;
I915_WRITE(reg, val);
intel_hdmi_set_avi_infoframe(encoder, adjusted_mode); intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
intel_hdmi_set_spd_infoframe(encoder); intel_hdmi_set_spd_infoframe(encoder);
} }
...@@ -447,6 +457,10 @@ static void vlv_set_infoframes(struct drm_encoder *encoder, ...@@ -447,6 +457,10 @@ static void vlv_set_infoframes(struct drm_encoder *encoder,
return; return;
} }
val |= VIDEO_DIP_ENABLE;
I915_WRITE(reg, val);
intel_hdmi_set_avi_infoframe(encoder, adjusted_mode); intel_hdmi_set_avi_infoframe(encoder, adjusted_mode);
intel_hdmi_set_spd_infoframe(encoder); intel_hdmi_set_spd_infoframe(encoder);
} }
......
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