History

drm/i915/crt: Remove ->mode_set callback

We only set a few bits in the ADPA register, which we then read back in the enable/disable hooks. So we can just move that bit of state computation code to the place where we need it since setting these bits without enabling the CRT encoder has no effects. The only exceptions are the hotplug bits since they affect the hotplug detection logic, but we already set those in the ->reset function and then never touch them.

Daniel Vetter committed 12 years ago

Commit 894ed1e1 parent 809a2a81 file · +30 −46Browse files

Unified · Split

drivers/gpu/drm/i915/intel_crt.c+30−46
@@ -144,28 +144,49 @@ static void intel_crt_set_dpms(struct intel_encoder *encoder, int mode) · 143 unmodified lines
144144 struct drm_device *dev = encoder->base.dev;
145145 struct drm_i915_private *dev_priv = dev->dev_private;
146146 struct intel_crt *crt = intel_encoder_to_crt(encoder);
147− u32 temp;
147+ struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
148+ struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;
149+ u32 adpa;
150+
151+ if (INTEL_INFO(dev)->gen >= 5)
152+ adpa = ADPA_HOTPLUG_BITS;
153+ else
154+ adpa = 0;
148155
149− temp = I915_READ(crt->adpa_reg);
150− temp &= ~(ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE);
151− temp &= ~ADPA_DAC_ENABLE;
156+ if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
157+ adpa |= ADPA_HSYNC_ACTIVE_HIGH;
158+ if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
159+ adpa |= ADPA_VSYNC_ACTIVE_HIGH;
160+
161+ /* For CPT allow 3 pipe config, for others just use A or B */
162+ if (HAS_PCH_LPT(dev))
163+ ; /* Those bits don't exist here */
164+ else if (HAS_PCH_CPT(dev))
165+ adpa |= PORT_TRANS_SEL_CPT(crtc->pipe);
166+ else if (crtc->pipe == 0)
167+ adpa |= ADPA_PIPE_A_SELECT;
168+ else
169+ adpa |= ADPA_PIPE_B_SELECT;
170+
171+ if (!HAS_PCH_SPLIT(dev))
172+ I915_WRITE(BCLRPAT(crtc->pipe), 0);
152173
153174 switch (mode) {
154175 case DRM_MODE_DPMS_ON:
155− temp |= ADPA_DAC_ENABLE;
176+ adpa |= ADPA_DAC_ENABLE;
156177 break;
157178 case DRM_MODE_DPMS_STANDBY:
158− temp |= ADPA_DAC_ENABLE | ADPA_HSYNC_CNTL_DISABLE;
179+ adpa |= ADPA_DAC_ENABLE | ADPA_HSYNC_CNTL_DISABLE;
159180 break;
160181 case DRM_MODE_DPMS_SUSPEND:
161− temp |= ADPA_DAC_ENABLE | ADPA_VSYNC_CNTL_DISABLE;
182+ adpa |= ADPA_DAC_ENABLE | ADPA_VSYNC_CNTL_DISABLE;
162183 break;
163184 case DRM_MODE_DPMS_OFF:
164− temp |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
185+ adpa |= ADPA_HSYNC_CNTL_DISABLE | ADPA_VSYNC_CNTL_DISABLE;
165186 break;
166187 }
167188
168− I915_WRITE(crt->adpa_reg, temp);
189+ I915_WRITE(crt->adpa_reg, adpa);
169190 }
170191
171192 static void intel_disable_crt(struct intel_encoder *encoder)
@@ -274,42 +295,6 @@ static bool intel_crt_compute_config(struct intel_encoder *encoder, · 102 unmodified lines
274295 return true;
275296 }
276297
277−static void intel_crt_mode_set(struct intel_encoder *encoder)
278−{
279−
280− struct drm_device *dev = encoder->base.dev;
281− struct intel_crt *crt = intel_encoder_to_crt(encoder);
282− struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc);
283− struct drm_i915_private *dev_priv = dev->dev_private;
284− struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode;
285− u32 adpa;
286−
287− if (INTEL_INFO(dev)->gen >= 5)
288− adpa = ADPA_HOTPLUG_BITS;
289− else
290− adpa = 0;
291−
292− if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC)
293− adpa |= ADPA_HSYNC_ACTIVE_HIGH;
294− if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC)
295− adpa |= ADPA_VSYNC_ACTIVE_HIGH;
296−
297− /* For CPT allow 3 pipe config, for others just use A or B */
298− if (HAS_PCH_LPT(dev))
299− ; /* Those bits don't exist here */
300− else if (HAS_PCH_CPT(dev))
301− adpa |= PORT_TRANS_SEL_CPT(crtc->pipe);
302− else if (crtc->pipe == 0)
303− adpa |= ADPA_PIPE_A_SELECT;
304− else
305− adpa |= ADPA_PIPE_B_SELECT;
306−
307− if (!HAS_PCH_SPLIT(dev))
308− I915_WRITE(BCLRPAT(crtc->pipe), 0);
309−
310− I915_WRITE(crt->adpa_reg, adpa);
311−}
312−
313298 static bool intel_ironlake_crt_detect_hotplug(struct drm_connector *connector)
314299 {
315300 struct drm_device *dev = connector->dev;
@@ -867,7 +852,6 @@ void intel_crt_init(struct drm_device *dev) · 551 unmodified lines
867852 crt->adpa_reg = ADPA;
868853
869854 crt->base.compute_config = intel_crt_compute_config;
870− crt->base.mode_set = intel_crt_mode_set;
871855 crt->base.disable = intel_disable_crt;
872856 crt->base.enable = intel_enable_crt;
873857 if (I915_HAS_HOTPLUG(dev))

Keyboard shortcuts

General

Show keyboard shortcuts
?
Focus the current search
/

Issues and pull requests

Open filters
f

Issues, pull requests and Inbox

Select next item
j↓
Select previous item
k↑
Open selected item
Enter
Dismiss filters or clear selection
Esc

Repository code

Go to file
t