aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_hdmi.c
diff options
context:
space:
mode:
authorPaulo Zanoni <paulo.r.zanoni@intel.com>2012-05-04 16:18:17 -0400
committerDaniel Vetter <daniel.vetter@ffwll.ch>2012-05-08 08:02:43 -0400
commit22509ec8676fdbba8da525b9ec9cb3ddb4cb71b0 (patch)
treecf65a9211407a2209672992cd3fdea76fbd6bc0a /drivers/gpu/drm/i915/intel_hdmi.c
parent837ba00f20aa47018a3317bc7c1f058be0a92e39 (diff)
drm/i915: change coding style of the write_infoframe functions
Don't use intermediate variables, change the value of 'val' as we go through the function. The new style looks more similar to the rest of our code. IMHO, it's also easier to read and change. Signed-off-by: Paulo Zanoni <paulo.r.zanoni@intel.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_hdmi.c')
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c43
1 files changed, 23 insertions, 20 deletions
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index bf218753cbaf..b84d19d0eaed 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -120,32 +120,33 @@ static void i9xx_write_infoframe(struct drm_encoder *encoder,
120 struct drm_device *dev = encoder->dev; 120 struct drm_device *dev = encoder->dev;
121 struct drm_i915_private *dev_priv = dev->dev_private; 121 struct drm_i915_private *dev_priv = dev->dev_private;
122 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder); 122 struct intel_hdmi *intel_hdmi = enc_to_intel_hdmi(encoder);
123 u32 port, flags, val = I915_READ(VIDEO_DIP_CTL); 123 u32 val = I915_READ(VIDEO_DIP_CTL);
124 unsigned i, len = DIP_HEADER_SIZE + frame->len; 124 unsigned i, len = DIP_HEADER_SIZE + frame->len;
125 125
126 126
127 /* XXX first guess at handling video port, is this corrent? */ 127 /* XXX first guess at handling video port, is this corrent? */
128 if (intel_hdmi->sdvox_reg == SDVOB) 128 if (intel_hdmi->sdvox_reg == SDVOB)
129 port = VIDEO_DIP_PORT_B; 129 val |= VIDEO_DIP_PORT_B;
130 else if (intel_hdmi->sdvox_reg == SDVOC) 130 else if (intel_hdmi->sdvox_reg == SDVOC)
131 port = VIDEO_DIP_PORT_C; 131 val |= VIDEO_DIP_PORT_C;
132 else 132 else
133 return; 133 return;
134 134
135 flags = intel_infoframe_index(frame);
136
137 val &= ~VIDEO_DIP_SELECT_MASK; 135 val &= ~VIDEO_DIP_SELECT_MASK;
136 val |= intel_infoframe_index(frame);
137
138 val |= VIDEO_DIP_ENABLE;
138 139
139 I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags); 140 I915_WRITE(VIDEO_DIP_CTL, val);
140 141
141 for (i = 0; i < len; i += 4) { 142 for (i = 0; i < len; i += 4) {
142 I915_WRITE(VIDEO_DIP_DATA, *data); 143 I915_WRITE(VIDEO_DIP_DATA, *data);
143 data++; 144 data++;
144 } 145 }
145 146
146 flags |= intel_infoframe_flags(frame); 147 val |= intel_infoframe_flags(frame);
147 148
148 I915_WRITE(VIDEO_DIP_CTL, VIDEO_DIP_ENABLE | val | port | flags); 149 I915_WRITE(VIDEO_DIP_CTL, val);
149} 150}
150 151
151static void ironlake_write_infoframe(struct drm_encoder *encoder, 152static void ironlake_write_infoframe(struct drm_encoder *encoder,
@@ -158,24 +159,25 @@ static void ironlake_write_infoframe(struct drm_encoder *encoder,
158 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 159 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
159 int reg = TVIDEO_DIP_CTL(intel_crtc->pipe); 160 int reg = TVIDEO_DIP_CTL(intel_crtc->pipe);
160 unsigned i, len = DIP_HEADER_SIZE + frame->len; 161 unsigned i, len = DIP_HEADER_SIZE + frame->len;
161 u32 flags, val = I915_READ(reg); 162 u32 val = I915_READ(reg);
162 163
163 intel_wait_for_vblank(dev, intel_crtc->pipe); 164 intel_wait_for_vblank(dev, intel_crtc->pipe);
164 165
165 flags = intel_infoframe_index(frame);
166
167 val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */ 166 val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
167 val |= intel_infoframe_index(frame);
168 168
169 I915_WRITE(reg, VIDEO_DIP_ENABLE | val | flags); 169 val |= VIDEO_DIP_ENABLE;
170
171 I915_WRITE(reg, val);
170 172
171 for (i = 0; i < len; i += 4) { 173 for (i = 0; i < len; i += 4) {
172 I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data); 174 I915_WRITE(TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
173 data++; 175 data++;
174 } 176 }
175 177
176 flags |= intel_infoframe_flags(frame); 178 val |= intel_infoframe_flags(frame);
177 179
178 I915_WRITE(reg, VIDEO_DIP_ENABLE | val | flags); 180 I915_WRITE(reg, val);
179} 181}
180 182
181static void vlv_write_infoframe(struct drm_encoder *encoder, 183static void vlv_write_infoframe(struct drm_encoder *encoder,
@@ -188,24 +190,25 @@ static void vlv_write_infoframe(struct drm_encoder *encoder,
188 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 190 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
189 int reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe); 191 int reg = VLV_TVIDEO_DIP_CTL(intel_crtc->pipe);
190 unsigned i, len = DIP_HEADER_SIZE + frame->len; 192 unsigned i, len = DIP_HEADER_SIZE + frame->len;
191 u32 flags, val = I915_READ(reg); 193 u32 val = I915_READ(reg);
192 194
193 intel_wait_for_vblank(dev, intel_crtc->pipe); 195 intel_wait_for_vblank(dev, intel_crtc->pipe);
194 196
195 flags = intel_infoframe_index(frame);
196
197 val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */ 197 val &= ~(VIDEO_DIP_SELECT_MASK | 0xf); /* clear DIP data offset */
198 val |= intel_infoframe_index(frame);
199
200 val |= VIDEO_DIP_ENABLE;
198 201
199 I915_WRITE(reg, VIDEO_DIP_ENABLE | val | flags); 202 I915_WRITE(reg, val);
200 203
201 for (i = 0; i < len; i += 4) { 204 for (i = 0; i < len; i += 4) {
202 I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), *data); 205 I915_WRITE(VLV_TVIDEO_DIP_DATA(intel_crtc->pipe), *data);
203 data++; 206 data++;
204 } 207 }
205 208
206 flags |= intel_infoframe_flags(frame); 209 val |= intel_infoframe_flags(frame);
207 210
208 I915_WRITE(reg, VIDEO_DIP_ENABLE | val | flags); 211 I915_WRITE(reg, val);
209} 212}
210 213
211static void intel_set_infoframe(struct drm_encoder *encoder, 214static void intel_set_infoframe(struct drm_encoder *encoder,