diff options
author | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
---|---|---|
committer | Andrea Bastoni <bastoni@cs.unc.edu> | 2010-05-30 19:16:45 -0400 |
commit | ada47b5fe13d89735805b566185f4885f5a3f750 (patch) | |
tree | 644b88f8a71896307d71438e9b3af49126ffb22b /drivers/gpu/drm/i915/intel_dvo.c | |
parent | 43e98717ad40a4ae64545b5ba047c7b86aa44f4f (diff) | |
parent | 3280f21d43ee541f97f8cda5792150d2dbec20d5 (diff) |
Merge branch 'wip-2.6.34' into old-private-masterarchived-private-master
Diffstat (limited to 'drivers/gpu/drm/i915/intel_dvo.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_dvo.c | 93 |
1 files changed, 47 insertions, 46 deletions
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c index a4d2606de778..ebf213c96b9c 100644 --- a/drivers/gpu/drm/i915/intel_dvo.c +++ b/drivers/gpu/drm/i915/intel_dvo.c | |||
@@ -25,6 +25,7 @@ | |||
25 | * Eric Anholt <eric@anholt.net> | 25 | * Eric Anholt <eric@anholt.net> |
26 | */ | 26 | */ |
27 | #include <linux/i2c.h> | 27 | #include <linux/i2c.h> |
28 | #include <linux/slab.h> | ||
28 | #include "drmP.h" | 29 | #include "drmP.h" |
29 | #include "drm.h" | 30 | #include "drm.h" |
30 | #include "drm_crtc.h" | 31 | #include "drm_crtc.h" |
@@ -79,8 +80,8 @@ static struct intel_dvo_device intel_dvo_devices[] = { | |||
79 | static void intel_dvo_dpms(struct drm_encoder *encoder, int mode) | 80 | static void intel_dvo_dpms(struct drm_encoder *encoder, int mode) |
80 | { | 81 | { |
81 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; | 82 | struct drm_i915_private *dev_priv = encoder->dev->dev_private; |
82 | struct intel_output *intel_output = enc_to_intel_output(encoder); | 83 | struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder); |
83 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 84 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
84 | u32 dvo_reg = dvo->dvo_reg; | 85 | u32 dvo_reg = dvo->dvo_reg; |
85 | u32 temp = I915_READ(dvo_reg); | 86 | u32 temp = I915_READ(dvo_reg); |
86 | 87 | ||
@@ -98,8 +99,8 @@ static void intel_dvo_dpms(struct drm_encoder *encoder, int mode) | |||
98 | static void intel_dvo_save(struct drm_connector *connector) | 99 | static void intel_dvo_save(struct drm_connector *connector) |
99 | { | 100 | { |
100 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | 101 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
101 | struct intel_output *intel_output = to_intel_output(connector); | 102 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
102 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 103 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
103 | 104 | ||
104 | /* Each output should probably just save the registers it touches, | 105 | /* Each output should probably just save the registers it touches, |
105 | * but for now, use more overkill. | 106 | * but for now, use more overkill. |
@@ -114,8 +115,8 @@ static void intel_dvo_save(struct drm_connector *connector) | |||
114 | static void intel_dvo_restore(struct drm_connector *connector) | 115 | static void intel_dvo_restore(struct drm_connector *connector) |
115 | { | 116 | { |
116 | struct drm_i915_private *dev_priv = connector->dev->dev_private; | 117 | struct drm_i915_private *dev_priv = connector->dev->dev_private; |
117 | struct intel_output *intel_output = to_intel_output(connector); | 118 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
118 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 119 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
119 | 120 | ||
120 | dvo->dev_ops->restore(dvo); | 121 | dvo->dev_ops->restore(dvo); |
121 | 122 | ||
@@ -127,8 +128,8 @@ static void intel_dvo_restore(struct drm_connector *connector) | |||
127 | static int intel_dvo_mode_valid(struct drm_connector *connector, | 128 | static int intel_dvo_mode_valid(struct drm_connector *connector, |
128 | struct drm_display_mode *mode) | 129 | struct drm_display_mode *mode) |
129 | { | 130 | { |
130 | struct intel_output *intel_output = to_intel_output(connector); | 131 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
131 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 132 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
132 | 133 | ||
133 | if (mode->flags & DRM_MODE_FLAG_DBLSCAN) | 134 | if (mode->flags & DRM_MODE_FLAG_DBLSCAN) |
134 | return MODE_NO_DBLESCAN; | 135 | return MODE_NO_DBLESCAN; |
@@ -149,8 +150,8 @@ static bool intel_dvo_mode_fixup(struct drm_encoder *encoder, | |||
149 | struct drm_display_mode *mode, | 150 | struct drm_display_mode *mode, |
150 | struct drm_display_mode *adjusted_mode) | 151 | struct drm_display_mode *adjusted_mode) |
151 | { | 152 | { |
152 | struct intel_output *intel_output = enc_to_intel_output(encoder); | 153 | struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder); |
153 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 154 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
154 | 155 | ||
155 | /* If we have timings from the BIOS for the panel, put them in | 156 | /* If we have timings from the BIOS for the panel, put them in |
156 | * to the adjusted mode. The CRTC will be set up for this mode, | 157 | * to the adjusted mode. The CRTC will be set up for this mode, |
@@ -185,8 +186,8 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder, | |||
185 | struct drm_device *dev = encoder->dev; | 186 | struct drm_device *dev = encoder->dev; |
186 | struct drm_i915_private *dev_priv = dev->dev_private; | 187 | struct drm_i915_private *dev_priv = dev->dev_private; |
187 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); | 188 | struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); |
188 | struct intel_output *intel_output = enc_to_intel_output(encoder); | 189 | struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder); |
189 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 190 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
190 | int pipe = intel_crtc->pipe; | 191 | int pipe = intel_crtc->pipe; |
191 | u32 dvo_val; | 192 | u32 dvo_val; |
192 | u32 dvo_reg = dvo->dvo_reg, dvo_srcdim_reg; | 193 | u32 dvo_reg = dvo->dvo_reg, dvo_srcdim_reg; |
@@ -240,23 +241,23 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder, | |||
240 | */ | 241 | */ |
241 | static enum drm_connector_status intel_dvo_detect(struct drm_connector *connector) | 242 | static enum drm_connector_status intel_dvo_detect(struct drm_connector *connector) |
242 | { | 243 | { |
243 | struct intel_output *intel_output = to_intel_output(connector); | 244 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
244 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 245 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
245 | 246 | ||
246 | return dvo->dev_ops->detect(dvo); | 247 | return dvo->dev_ops->detect(dvo); |
247 | } | 248 | } |
248 | 249 | ||
249 | static int intel_dvo_get_modes(struct drm_connector *connector) | 250 | static int intel_dvo_get_modes(struct drm_connector *connector) |
250 | { | 251 | { |
251 | struct intel_output *intel_output = to_intel_output(connector); | 252 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
252 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 253 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
253 | 254 | ||
254 | /* We should probably have an i2c driver get_modes function for those | 255 | /* We should probably have an i2c driver get_modes function for those |
255 | * devices which will have a fixed set of modes determined by the chip | 256 | * devices which will have a fixed set of modes determined by the chip |
256 | * (TV-out, for example), but for now with just TMDS and LVDS, | 257 | * (TV-out, for example), but for now with just TMDS and LVDS, |
257 | * that's not the case. | 258 | * that's not the case. |
258 | */ | 259 | */ |
259 | intel_ddc_get_modes(intel_output); | 260 | intel_ddc_get_modes(intel_encoder); |
260 | if (!list_empty(&connector->probed_modes)) | 261 | if (!list_empty(&connector->probed_modes)) |
261 | return 1; | 262 | return 1; |
262 | 263 | ||
@@ -274,8 +275,8 @@ static int intel_dvo_get_modes(struct drm_connector *connector) | |||
274 | 275 | ||
275 | static void intel_dvo_destroy (struct drm_connector *connector) | 276 | static void intel_dvo_destroy (struct drm_connector *connector) |
276 | { | 277 | { |
277 | struct intel_output *intel_output = to_intel_output(connector); | 278 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
278 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 279 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
279 | 280 | ||
280 | if (dvo) { | 281 | if (dvo) { |
281 | if (dvo->dev_ops->destroy) | 282 | if (dvo->dev_ops->destroy) |
@@ -285,13 +286,13 @@ static void intel_dvo_destroy (struct drm_connector *connector) | |||
285 | /* no need, in i830_dvoices[] now */ | 286 | /* no need, in i830_dvoices[] now */ |
286 | //kfree(dvo); | 287 | //kfree(dvo); |
287 | } | 288 | } |
288 | if (intel_output->i2c_bus) | 289 | if (intel_encoder->i2c_bus) |
289 | intel_i2c_destroy(intel_output->i2c_bus); | 290 | intel_i2c_destroy(intel_encoder->i2c_bus); |
290 | if (intel_output->ddc_bus) | 291 | if (intel_encoder->ddc_bus) |
291 | intel_i2c_destroy(intel_output->ddc_bus); | 292 | intel_i2c_destroy(intel_encoder->ddc_bus); |
292 | drm_sysfs_connector_remove(connector); | 293 | drm_sysfs_connector_remove(connector); |
293 | drm_connector_cleanup(connector); | 294 | drm_connector_cleanup(connector); |
294 | kfree(intel_output); | 295 | kfree(intel_encoder); |
295 | } | 296 | } |
296 | 297 | ||
297 | #ifdef RANDR_GET_CRTC_INTERFACE | 298 | #ifdef RANDR_GET_CRTC_INTERFACE |
@@ -299,8 +300,8 @@ static struct drm_crtc *intel_dvo_get_crtc(struct drm_connector *connector) | |||
299 | { | 300 | { |
300 | struct drm_device *dev = connector->dev; | 301 | struct drm_device *dev = connector->dev; |
301 | struct drm_i915_private *dev_priv = dev->dev_private; | 302 | struct drm_i915_private *dev_priv = dev->dev_private; |
302 | struct intel_output *intel_output = to_intel_output(connector); | 303 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
303 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 304 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
304 | int pipe = !!(I915_READ(dvo->dvo_reg) & SDVO_PIPE_B_SELECT); | 305 | int pipe = !!(I915_READ(dvo->dvo_reg) & SDVO_PIPE_B_SELECT); |
305 | 306 | ||
306 | return intel_pipe_to_crtc(pScrn, pipe); | 307 | return intel_pipe_to_crtc(pScrn, pipe); |
@@ -351,8 +352,8 @@ intel_dvo_get_current_mode (struct drm_connector *connector) | |||
351 | { | 352 | { |
352 | struct drm_device *dev = connector->dev; | 353 | struct drm_device *dev = connector->dev; |
353 | struct drm_i915_private *dev_priv = dev->dev_private; | 354 | struct drm_i915_private *dev_priv = dev->dev_private; |
354 | struct intel_output *intel_output = to_intel_output(connector); | 355 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
355 | struct intel_dvo_device *dvo = intel_output->dev_priv; | 356 | struct intel_dvo_device *dvo = intel_encoder->dev_priv; |
356 | uint32_t dvo_reg = dvo->dvo_reg; | 357 | uint32_t dvo_reg = dvo->dvo_reg; |
357 | uint32_t dvo_val = I915_READ(dvo_reg); | 358 | uint32_t dvo_val = I915_READ(dvo_reg); |
358 | struct drm_display_mode *mode = NULL; | 359 | struct drm_display_mode *mode = NULL; |
@@ -382,24 +383,24 @@ intel_dvo_get_current_mode (struct drm_connector *connector) | |||
382 | 383 | ||
383 | void intel_dvo_init(struct drm_device *dev) | 384 | void intel_dvo_init(struct drm_device *dev) |
384 | { | 385 | { |
385 | struct intel_output *intel_output; | 386 | struct intel_encoder *intel_encoder; |
386 | struct intel_dvo_device *dvo; | 387 | struct intel_dvo_device *dvo; |
387 | struct i2c_adapter *i2cbus = NULL; | 388 | struct i2c_adapter *i2cbus = NULL; |
388 | int ret = 0; | 389 | int ret = 0; |
389 | int i; | 390 | int i; |
390 | int encoder_type = DRM_MODE_ENCODER_NONE; | 391 | int encoder_type = DRM_MODE_ENCODER_NONE; |
391 | intel_output = kzalloc (sizeof(struct intel_output), GFP_KERNEL); | 392 | intel_encoder = kzalloc (sizeof(struct intel_encoder), GFP_KERNEL); |
392 | if (!intel_output) | 393 | if (!intel_encoder) |
393 | return; | 394 | return; |
394 | 395 | ||
395 | /* Set up the DDC bus */ | 396 | /* Set up the DDC bus */ |
396 | intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "DVODDC_D"); | 397 | intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOD, "DVODDC_D"); |
397 | if (!intel_output->ddc_bus) | 398 | if (!intel_encoder->ddc_bus) |
398 | goto free_intel; | 399 | goto free_intel; |
399 | 400 | ||
400 | /* Now, try to find a controller */ | 401 | /* Now, try to find a controller */ |
401 | for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) { | 402 | for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) { |
402 | struct drm_connector *connector = &intel_output->base; | 403 | struct drm_connector *connector = &intel_encoder->base; |
403 | int gpio; | 404 | int gpio; |
404 | 405 | ||
405 | dvo = &intel_dvo_devices[i]; | 406 | dvo = &intel_dvo_devices[i]; |
@@ -434,11 +435,11 @@ void intel_dvo_init(struct drm_device *dev) | |||
434 | if (!ret) | 435 | if (!ret) |
435 | continue; | 436 | continue; |
436 | 437 | ||
437 | intel_output->type = INTEL_OUTPUT_DVO; | 438 | intel_encoder->type = INTEL_OUTPUT_DVO; |
438 | intel_output->crtc_mask = (1 << 0) | (1 << 1); | 439 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1); |
439 | switch (dvo->type) { | 440 | switch (dvo->type) { |
440 | case INTEL_DVO_CHIP_TMDS: | 441 | case INTEL_DVO_CHIP_TMDS: |
441 | intel_output->clone_mask = | 442 | intel_encoder->clone_mask = |
442 | (1 << INTEL_DVO_TMDS_CLONE_BIT) | | 443 | (1 << INTEL_DVO_TMDS_CLONE_BIT) | |
443 | (1 << INTEL_ANALOG_CLONE_BIT); | 444 | (1 << INTEL_ANALOG_CLONE_BIT); |
444 | drm_connector_init(dev, connector, | 445 | drm_connector_init(dev, connector, |
@@ -447,7 +448,7 @@ void intel_dvo_init(struct drm_device *dev) | |||
447 | encoder_type = DRM_MODE_ENCODER_TMDS; | 448 | encoder_type = DRM_MODE_ENCODER_TMDS; |
448 | break; | 449 | break; |
449 | case INTEL_DVO_CHIP_LVDS: | 450 | case INTEL_DVO_CHIP_LVDS: |
450 | intel_output->clone_mask = | 451 | intel_encoder->clone_mask = |
451 | (1 << INTEL_DVO_LVDS_CLONE_BIT); | 452 | (1 << INTEL_DVO_LVDS_CLONE_BIT); |
452 | drm_connector_init(dev, connector, | 453 | drm_connector_init(dev, connector, |
453 | &intel_dvo_connector_funcs, | 454 | &intel_dvo_connector_funcs, |
@@ -462,16 +463,16 @@ void intel_dvo_init(struct drm_device *dev) | |||
462 | connector->interlace_allowed = false; | 463 | connector->interlace_allowed = false; |
463 | connector->doublescan_allowed = false; | 464 | connector->doublescan_allowed = false; |
464 | 465 | ||
465 | intel_output->dev_priv = dvo; | 466 | intel_encoder->dev_priv = dvo; |
466 | intel_output->i2c_bus = i2cbus; | 467 | intel_encoder->i2c_bus = i2cbus; |
467 | 468 | ||
468 | drm_encoder_init(dev, &intel_output->enc, | 469 | drm_encoder_init(dev, &intel_encoder->enc, |
469 | &intel_dvo_enc_funcs, encoder_type); | 470 | &intel_dvo_enc_funcs, encoder_type); |
470 | drm_encoder_helper_add(&intel_output->enc, | 471 | drm_encoder_helper_add(&intel_encoder->enc, |
471 | &intel_dvo_helper_funcs); | 472 | &intel_dvo_helper_funcs); |
472 | 473 | ||
473 | drm_mode_connector_attach_encoder(&intel_output->base, | 474 | drm_mode_connector_attach_encoder(&intel_encoder->base, |
474 | &intel_output->enc); | 475 | &intel_encoder->enc); |
475 | if (dvo->type == INTEL_DVO_CHIP_LVDS) { | 476 | if (dvo->type == INTEL_DVO_CHIP_LVDS) { |
476 | /* For our LVDS chipsets, we should hopefully be able | 477 | /* For our LVDS chipsets, we should hopefully be able |
477 | * to dig the fixed panel mode out of the BIOS data. | 478 | * to dig the fixed panel mode out of the BIOS data. |
@@ -489,10 +490,10 @@ void intel_dvo_init(struct drm_device *dev) | |||
489 | return; | 490 | return; |
490 | } | 491 | } |
491 | 492 | ||
492 | intel_i2c_destroy(intel_output->ddc_bus); | 493 | intel_i2c_destroy(intel_encoder->ddc_bus); |
493 | /* Didn't find a chip, so tear down. */ | 494 | /* Didn't find a chip, so tear down. */ |
494 | if (i2cbus != NULL) | 495 | if (i2cbus != NULL) |
495 | intel_i2c_destroy(i2cbus); | 496 | intel_i2c_destroy(i2cbus); |
496 | free_intel: | 497 | free_intel: |
497 | kfree(intel_output); | 498 | kfree(intel_encoder); |
498 | } | 499 | } |