Rev 3746 | Rev 4398 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed
Rev 3746 | Rev 4104 | ||
---|---|---|---|
Line 52... | Line 52... | ||
52 | .dvo_reg = DVOC, |
52 | .dvo_reg = DVOC, |
53 | .slave_addr = CH7xxx_ADDR, |
53 | .slave_addr = CH7xxx_ADDR, |
54 | .dev_ops = &ch7xxx_ops, |
54 | .dev_ops = &ch7xxx_ops, |
55 | }, |
55 | }, |
56 | { |
56 | { |
- | 57 | .type = INTEL_DVO_CHIP_TMDS, |
|
- | 58 | .name = "ch7xxx", |
|
- | 59 | .dvo_reg = DVOC, |
|
- | 60 | .slave_addr = 0x75, /* For some ch7010 */ |
|
- | 61 | .dev_ops = &ch7xxx_ops, |
|
- | 62 | }, |
|
- | 63 | { |
|
57 | .type = INTEL_DVO_CHIP_LVDS, |
64 | .type = INTEL_DVO_CHIP_LVDS, |
58 | .name = "ivch", |
65 | .name = "ivch", |
59 | .dvo_reg = DVOA, |
66 | .dvo_reg = DVOA, |
60 | .slave_addr = 0x02, /* Might also be 0x44, 0x84, 0xc4 */ |
67 | .slave_addr = 0x02, /* Might also be 0x44, 0x84, 0xc4 */ |
61 | .dev_ops = &ivch_ops, |
68 | .dev_ops = &ivch_ops, |
Line 91... | Line 98... | ||
91 | 98 | ||
92 | struct drm_display_mode *panel_fixed_mode; |
99 | struct drm_display_mode *panel_fixed_mode; |
93 | bool panel_wants_dither; |
100 | bool panel_wants_dither; |
Line 94... | Line 101... | ||
94 | }; |
101 | }; |
95 | 102 | ||
96 | static struct intel_dvo *enc_to_intel_dvo(struct drm_encoder *encoder) |
103 | static struct intel_dvo *enc_to_dvo(struct intel_encoder *encoder) |
97 | { |
104 | { |
Line 98... | Line 105... | ||
98 | return container_of(encoder, struct intel_dvo, base.base); |
105 | return container_of(encoder, struct intel_dvo, base); |
99 | } |
106 | } |
100 | 107 | ||
101 | static struct intel_dvo *intel_attached_dvo(struct drm_connector *connector) |
- | |
102 | { |
108 | static struct intel_dvo *intel_attached_dvo(struct drm_connector *connector) |
Line 103... | Line 109... | ||
103 | return container_of(intel_attached_encoder(connector), |
109 | { |
104 | struct intel_dvo, base); |
110 | return enc_to_dvo(intel_attached_encoder(connector)); |
105 | } |
111 | } |
Line 114... | Line 120... | ||
114 | static bool intel_dvo_get_hw_state(struct intel_encoder *encoder, |
120 | static bool intel_dvo_get_hw_state(struct intel_encoder *encoder, |
115 | enum pipe *pipe) |
121 | enum pipe *pipe) |
116 | { |
122 | { |
117 | struct drm_device *dev = encoder->base.dev; |
123 | struct drm_device *dev = encoder->base.dev; |
118 | struct drm_i915_private *dev_priv = dev->dev_private; |
124 | struct drm_i915_private *dev_priv = dev->dev_private; |
119 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(&encoder->base); |
125 | struct intel_dvo *intel_dvo = enc_to_dvo(encoder); |
120 | u32 tmp; |
126 | u32 tmp; |
Line 121... | Line 127... | ||
121 | 127 | ||
Line 122... | Line 128... | ||
122 | tmp = I915_READ(intel_dvo->dev.dvo_reg); |
128 | tmp = I915_READ(intel_dvo->dev.dvo_reg); |
Line 127... | Line 133... | ||
127 | *pipe = PORT_TO_PIPE(tmp); |
133 | *pipe = PORT_TO_PIPE(tmp); |
Line 128... | Line 134... | ||
128 | 134 | ||
129 | return true; |
135 | return true; |
Line -... | Line 136... | ||
- | 136 | } |
|
- | 137 | ||
- | 138 | static void intel_dvo_get_config(struct intel_encoder *encoder, |
|
- | 139 | struct intel_crtc_config *pipe_config) |
|
- | 140 | { |
|
- | 141 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
|
- | 142 | struct intel_dvo *intel_dvo = enc_to_dvo(encoder); |
|
- | 143 | u32 tmp, flags = 0; |
|
- | 144 | ||
- | 145 | tmp = I915_READ(intel_dvo->dev.dvo_reg); |
|
- | 146 | if (tmp & DVO_HSYNC_ACTIVE_HIGH) |
|
- | 147 | flags |= DRM_MODE_FLAG_PHSYNC; |
|
- | 148 | else |
|
- | 149 | flags |= DRM_MODE_FLAG_NHSYNC; |
|
- | 150 | if (tmp & DVO_VSYNC_ACTIVE_HIGH) |
|
- | 151 | flags |= DRM_MODE_FLAG_PVSYNC; |
|
- | 152 | else |
|
- | 153 | flags |= DRM_MODE_FLAG_NVSYNC; |
|
- | 154 | ||
- | 155 | pipe_config->adjusted_mode.flags |= flags; |
|
130 | } |
156 | } |
131 | 157 | ||
132 | static void intel_disable_dvo(struct intel_encoder *encoder) |
158 | static void intel_disable_dvo(struct intel_encoder *encoder) |
133 | { |
159 | { |
134 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
160 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
135 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(&encoder->base); |
161 | struct intel_dvo *intel_dvo = enc_to_dvo(encoder); |
Line 136... | Line 162... | ||
136 | u32 dvo_reg = intel_dvo->dev.dvo_reg; |
162 | u32 dvo_reg = intel_dvo->dev.dvo_reg; |
137 | u32 temp = I915_READ(dvo_reg); |
163 | u32 temp = I915_READ(dvo_reg); |
Line 142... | Line 168... | ||
142 | } |
168 | } |
Line 143... | Line 169... | ||
143 | 169 | ||
144 | static void intel_enable_dvo(struct intel_encoder *encoder) |
170 | static void intel_enable_dvo(struct intel_encoder *encoder) |
145 | { |
171 | { |
146 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
172 | struct drm_i915_private *dev_priv = encoder->base.dev->dev_private; |
147 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(&encoder->base); |
173 | struct intel_dvo *intel_dvo = enc_to_dvo(encoder); |
148 | u32 dvo_reg = intel_dvo->dev.dvo_reg; |
174 | u32 dvo_reg = intel_dvo->dev.dvo_reg; |
Line 149... | Line 175... | ||
149 | u32 temp = I915_READ(dvo_reg); |
175 | u32 temp = I915_READ(dvo_reg); |
150 | 176 | ||
151 | I915_WRITE(dvo_reg, temp | DVO_ENABLE); |
177 | I915_WRITE(dvo_reg, temp | DVO_ENABLE); |
152 | I915_READ(dvo_reg); |
178 | I915_READ(dvo_reg); |
Line -... | Line 179... | ||
- | 179 | intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, true); |
|
153 | intel_dvo->dev.dev_ops->dpms(&intel_dvo->dev, true); |
180 | } |
154 | } |
181 | |
155 | 182 | /* Special dpms function to support cloning between dvo/sdvo/crt. */ |
|
156 | static void intel_dvo_dpms(struct drm_connector *connector, int mode) |
183 | static void intel_dvo_dpms(struct drm_connector *connector, int mode) |
Line 172... | Line 199... | ||
172 | if (!crtc) { |
199 | if (!crtc) { |
173 | intel_dvo->base.connectors_active = false; |
200 | intel_dvo->base.connectors_active = false; |
174 | return; |
201 | return; |
175 | } |
202 | } |
Line -... | Line 203... | ||
- | 203 | ||
- | 204 | /* We call connector dpms manually below in case pipe dpms doesn't |
|
176 | 205 | * change due to cloning. */ |
|
177 | if (mode == DRM_MODE_DPMS_ON) { |
206 | if (mode == DRM_MODE_DPMS_ON) { |
Line 178... | Line 207... | ||
178 | intel_dvo->base.connectors_active = true; |
207 | intel_dvo->base.connectors_active = true; |
Line 209... | Line 238... | ||
209 | } |
238 | } |
Line 210... | Line 239... | ||
210 | 239 | ||
211 | return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode); |
240 | return intel_dvo->dev.dev_ops->mode_valid(&intel_dvo->dev, mode); |
Line 212... | Line 241... | ||
212 | } |
241 | } |
213 | - | ||
214 | static bool intel_dvo_mode_fixup(struct drm_encoder *encoder, |
242 | |
215 | const struct drm_display_mode *mode, |
243 | static bool intel_dvo_compute_config(struct intel_encoder *encoder, |
216 | struct drm_display_mode *adjusted_mode) |
244 | struct intel_crtc_config *pipe_config) |
- | 245 | { |
|
Line 217... | Line 246... | ||
217 | { |
246 | struct intel_dvo *intel_dvo = enc_to_dvo(encoder); |
218 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder); |
247 | struct drm_display_mode *adjusted_mode = &pipe_config->adjusted_mode; |
219 | 248 | ||
220 | /* If we have timings from the BIOS for the panel, put them in |
249 | /* If we have timings from the BIOS for the panel, put them in |
Line 232... | Line 261... | ||
232 | C(vsync_start); |
261 | C(vsync_start); |
233 | C(vsync_end); |
262 | C(vsync_end); |
234 | C(vtotal); |
263 | C(vtotal); |
235 | C(clock); |
264 | C(clock); |
236 | #undef C |
265 | #undef C |
- | 266 | ||
- | 267 | drm_mode_set_crtcinfo(adjusted_mode, 0); |
|
237 | } |
268 | } |
Line 238... | Line 269... | ||
238 | 269 | ||
239 | if (intel_dvo->dev.dev_ops->mode_fixup) |
270 | if (intel_dvo->dev.dev_ops->mode_fixup) |
- | 271 | return intel_dvo->dev.dev_ops->mode_fixup(&intel_dvo->dev, |
|
- | 272 | &pipe_config->requested_mode, |
|
Line 240... | Line 273... | ||
240 | return intel_dvo->dev.dev_ops->mode_fixup(&intel_dvo->dev, mode, adjusted_mode); |
273 | adjusted_mode); |
241 | 274 | ||
Line 242... | Line 275... | ||
242 | return true; |
275 | return true; |
243 | } |
- | |
244 | - | ||
245 | static void intel_dvo_mode_set(struct drm_encoder *encoder, |
276 | } |
246 | struct drm_display_mode *mode, |
277 | |
247 | struct drm_display_mode *adjusted_mode) |
278 | static void intel_dvo_mode_set(struct intel_encoder *encoder) |
248 | { |
279 | { |
- | 280 | struct drm_device *dev = encoder->base.dev; |
|
249 | struct drm_device *dev = encoder->dev; |
281 | struct drm_i915_private *dev_priv = dev->dev_private; |
250 | struct drm_i915_private *dev_priv = dev->dev_private; |
282 | struct intel_crtc *crtc = to_intel_crtc(encoder->base.crtc); |
251 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
283 | struct drm_display_mode *adjusted_mode = &crtc->config.adjusted_mode; |
252 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder); |
284 | struct intel_dvo *intel_dvo = enc_to_dvo(encoder); |
253 | int pipe = intel_crtc->pipe; |
- | |
Line 254... | Line 285... | ||
254 | u32 dvo_val; |
285 | int pipe = crtc->pipe; |
255 | u32 dvo_reg = intel_dvo->dev.dvo_reg, dvo_srcdim_reg; |
286 | u32 dvo_val; |
256 | int dpll_reg = DPLL(pipe); |
287 | u32 dvo_reg = intel_dvo->dev.dvo_reg, dvo_srcdim_reg; |
257 | 288 | ||
Line 266... | Line 297... | ||
266 | case DVOC: |
297 | case DVOC: |
267 | dvo_srcdim_reg = DVOC_SRCDIM; |
298 | dvo_srcdim_reg = DVOC_SRCDIM; |
268 | break; |
299 | break; |
269 | } |
300 | } |
Line 270... | Line 301... | ||
270 | 301 | ||
- | 302 | intel_dvo->dev.dev_ops->mode_set(&intel_dvo->dev, |
|
- | 303 | &crtc->config.requested_mode, |
|
Line 271... | Line 304... | ||
271 | intel_dvo->dev.dev_ops->mode_set(&intel_dvo->dev, mode, adjusted_mode); |
304 | adjusted_mode); |
272 | 305 | ||
273 | /* Save the data order, since I don't know what it should be set to. */ |
306 | /* Save the data order, since I don't know what it should be set to. */ |
274 | dvo_val = I915_READ(dvo_reg) & |
307 | dvo_val = I915_READ(dvo_reg) & |
Line 282... | Line 315... | ||
282 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
315 | if (adjusted_mode->flags & DRM_MODE_FLAG_PHSYNC) |
283 | dvo_val |= DVO_HSYNC_ACTIVE_HIGH; |
316 | dvo_val |= DVO_HSYNC_ACTIVE_HIGH; |
284 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
317 | if (adjusted_mode->flags & DRM_MODE_FLAG_PVSYNC) |
285 | dvo_val |= DVO_VSYNC_ACTIVE_HIGH; |
318 | dvo_val |= DVO_VSYNC_ACTIVE_HIGH; |
Line 286... | Line -... | ||
286 | - | ||
287 | I915_WRITE(dpll_reg, I915_READ(dpll_reg) | DPLL_DVO_HIGH_SPEED); |
- | |
288 | 319 | ||
289 | /*I915_WRITE(DVOB_SRCDIM, |
320 | /*I915_WRITE(DVOB_SRCDIM, |
290 | (adjusted_mode->hdisplay << DVO_SRCDIM_HORIZONTAL_SHIFT) | |
321 | (adjusted_mode->hdisplay << DVO_SRCDIM_HORIZONTAL_SHIFT) | |
291 | (adjusted_mode->VDisplay << DVO_SRCDIM_VERTICAL_SHIFT));*/ |
322 | (adjusted_mode->VDisplay << DVO_SRCDIM_VERTICAL_SHIFT));*/ |
292 | I915_WRITE(dvo_srcdim_reg, |
323 | I915_WRITE(dvo_srcdim_reg, |
Line 303... | Line 334... | ||
303 | */ |
334 | */ |
304 | static enum drm_connector_status |
335 | static enum drm_connector_status |
305 | intel_dvo_detect(struct drm_connector *connector, bool force) |
336 | intel_dvo_detect(struct drm_connector *connector, bool force) |
306 | { |
337 | { |
307 | struct intel_dvo *intel_dvo = intel_attached_dvo(connector); |
338 | struct intel_dvo *intel_dvo = intel_attached_dvo(connector); |
- | 339 | DRM_DEBUG_KMS("[CONNECTOR:%d:%s]\n", |
|
- | 340 | connector->base.id, drm_get_connector_name(connector)); |
|
308 | return intel_dvo->dev.dev_ops->detect(&intel_dvo->dev); |
341 | return intel_dvo->dev.dev_ops->detect(&intel_dvo->dev); |
309 | } |
342 | } |
Line 310... | Line 343... | ||
310 | 343 | ||
311 | static int intel_dvo_get_modes(struct drm_connector *connector) |
344 | static int intel_dvo_get_modes(struct drm_connector *connector) |
Line 340... | Line 373... | ||
340 | drm_sysfs_connector_remove(connector); |
373 | drm_sysfs_connector_remove(connector); |
341 | drm_connector_cleanup(connector); |
374 | drm_connector_cleanup(connector); |
342 | kfree(connector); |
375 | kfree(connector); |
343 | } |
376 | } |
Line 344... | Line -... | ||
344 | - | ||
345 | static const struct drm_encoder_helper_funcs intel_dvo_helper_funcs = { |
- | |
346 | .mode_fixup = intel_dvo_mode_fixup, |
- | |
347 | .mode_set = intel_dvo_mode_set, |
- | |
348 | }; |
- | |
349 | 377 | ||
350 | static const struct drm_connector_funcs intel_dvo_connector_funcs = { |
378 | static const struct drm_connector_funcs intel_dvo_connector_funcs = { |
351 | .dpms = intel_dvo_dpms, |
379 | .dpms = intel_dvo_dpms, |
352 | .detect = intel_dvo_detect, |
380 | .detect = intel_dvo_detect, |
353 | .destroy = intel_dvo_destroy, |
381 | .destroy = intel_dvo_destroy, |
Line 360... | Line 388... | ||
360 | .best_encoder = intel_best_encoder, |
388 | .best_encoder = intel_best_encoder, |
361 | }; |
389 | }; |
Line 362... | Line 390... | ||
362 | 390 | ||
363 | static void intel_dvo_enc_destroy(struct drm_encoder *encoder) |
391 | static void intel_dvo_enc_destroy(struct drm_encoder *encoder) |
364 | { |
392 | { |
Line 365... | Line 393... | ||
365 | struct intel_dvo *intel_dvo = enc_to_intel_dvo(encoder); |
393 | struct intel_dvo *intel_dvo = enc_to_dvo(to_intel_encoder(encoder)); |
366 | 394 | ||
Line 367... | Line 395... | ||
367 | if (intel_dvo->dev.dev_ops->destroy) |
395 | if (intel_dvo->dev.dev_ops->destroy) |
Line 438... | Line 466... | ||
438 | &intel_dvo_enc_funcs, encoder_type); |
466 | &intel_dvo_enc_funcs, encoder_type); |
Line 439... | Line 467... | ||
439 | 467 | ||
440 | intel_encoder->disable = intel_disable_dvo; |
468 | intel_encoder->disable = intel_disable_dvo; |
441 | intel_encoder->enable = intel_enable_dvo; |
469 | intel_encoder->enable = intel_enable_dvo; |
- | 470 | intel_encoder->get_hw_state = intel_dvo_get_hw_state; |
|
- | 471 | intel_encoder->get_config = intel_dvo_get_config; |
|
- | 472 | intel_encoder->compute_config = intel_dvo_compute_config; |
|
442 | intel_encoder->get_hw_state = intel_dvo_get_hw_state; |
473 | intel_encoder->mode_set = intel_dvo_mode_set; |
Line 443... | Line 474... | ||
443 | intel_connector->get_hw_state = intel_dvo_connector_get_hw_state; |
474 | intel_connector->get_hw_state = intel_dvo_connector_get_hw_state; |
444 | 475 | ||
445 | /* Now, try to find a controller */ |
476 | /* Now, try to find a controller */ |
Line 504... | Line 535... | ||
504 | &intel_dvo_connector_helper_funcs); |
535 | &intel_dvo_connector_helper_funcs); |
505 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; |
536 | connector->display_info.subpixel_order = SubPixelHorizontalRGB; |
506 | connector->interlace_allowed = false; |
537 | connector->interlace_allowed = false; |
507 | connector->doublescan_allowed = false; |
538 | connector->doublescan_allowed = false; |
Line 508... | Line -... | ||
508 | - | ||
509 | drm_encoder_helper_add(&intel_encoder->base, |
- | |
510 | &intel_dvo_helper_funcs); |
- | |
511 | 539 | ||
512 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
540 | intel_connector_attach_encoder(intel_connector, intel_encoder); |
513 | if (dvo->type == INTEL_DVO_CHIP_LVDS) { |
541 | if (dvo->type == INTEL_DVO_CHIP_LVDS) { |
514 | /* For our LVDS chipsets, we should hopefully be able |
542 | /* For our LVDS chipsets, we should hopefully be able |
515 | * to dig the fixed panel mode out of the BIOS data. |
543 | * to dig the fixed panel mode out of the BIOS data. |