diff options
Diffstat (limited to 'drivers/gpu/drm/i915/intel_crt.c')
-rw-r--r-- | drivers/gpu/drm/i915/intel_crt.c | 69 |
1 files changed, 35 insertions, 34 deletions
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c index fccf07470c8f..759c2ef72eff 100644 --- a/drivers/gpu/drm/i915/intel_crt.c +++ b/drivers/gpu/drm/i915/intel_crt.c | |||
@@ -25,6 +25,7 @@ | |||
25 | */ | 25 | */ |
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" |
@@ -246,19 +247,19 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector) | |||
246 | 247 | ||
247 | static bool intel_crt_detect_ddc(struct drm_connector *connector) | 248 | static bool intel_crt_detect_ddc(struct drm_connector *connector) |
248 | { | 249 | { |
249 | struct intel_output *intel_output = to_intel_output(connector); | 250 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
250 | 251 | ||
251 | /* CRT should always be at 0, but check anyway */ | 252 | /* CRT should always be at 0, but check anyway */ |
252 | if (intel_output->type != INTEL_OUTPUT_ANALOG) | 253 | if (intel_encoder->type != INTEL_OUTPUT_ANALOG) |
253 | return false; | 254 | return false; |
254 | 255 | ||
255 | return intel_ddc_probe(intel_output); | 256 | return intel_ddc_probe(intel_encoder); |
256 | } | 257 | } |
257 | 258 | ||
258 | static enum drm_connector_status | 259 | static enum drm_connector_status |
259 | intel_crt_load_detect(struct drm_crtc *crtc, struct intel_output *intel_output) | 260 | intel_crt_load_detect(struct drm_crtc *crtc, struct intel_encoder *intel_encoder) |
260 | { | 261 | { |
261 | struct drm_encoder *encoder = &intel_output->enc; | 262 | struct drm_encoder *encoder = &intel_encoder->enc; |
262 | struct drm_device *dev = encoder->dev; | 263 | struct drm_device *dev = encoder->dev; |
263 | struct drm_i915_private *dev_priv = dev->dev_private; | 264 | struct drm_i915_private *dev_priv = dev->dev_private; |
264 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); | 265 | struct intel_crtc *intel_crtc = to_intel_crtc(crtc); |
@@ -386,8 +387,8 @@ intel_crt_load_detect(struct drm_crtc *crtc, struct intel_output *intel_output) | |||
386 | static enum drm_connector_status intel_crt_detect(struct drm_connector *connector) | 387 | static enum drm_connector_status intel_crt_detect(struct drm_connector *connector) |
387 | { | 388 | { |
388 | struct drm_device *dev = connector->dev; | 389 | struct drm_device *dev = connector->dev; |
389 | struct intel_output *intel_output = to_intel_output(connector); | 390 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
390 | struct drm_encoder *encoder = &intel_output->enc; | 391 | struct drm_encoder *encoder = &intel_encoder->enc; |
391 | struct drm_crtc *crtc; | 392 | struct drm_crtc *crtc; |
392 | int dpms_mode; | 393 | int dpms_mode; |
393 | enum drm_connector_status status; | 394 | enum drm_connector_status status; |
@@ -404,13 +405,13 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto | |||
404 | 405 | ||
405 | /* for pre-945g platforms use load detect */ | 406 | /* for pre-945g platforms use load detect */ |
406 | if (encoder->crtc && encoder->crtc->enabled) { | 407 | if (encoder->crtc && encoder->crtc->enabled) { |
407 | status = intel_crt_load_detect(encoder->crtc, intel_output); | 408 | status = intel_crt_load_detect(encoder->crtc, intel_encoder); |
408 | } else { | 409 | } else { |
409 | crtc = intel_get_load_detect_pipe(intel_output, | 410 | crtc = intel_get_load_detect_pipe(intel_encoder, |
410 | NULL, &dpms_mode); | 411 | NULL, &dpms_mode); |
411 | if (crtc) { | 412 | if (crtc) { |
412 | status = intel_crt_load_detect(crtc, intel_output); | 413 | status = intel_crt_load_detect(crtc, intel_encoder); |
413 | intel_release_load_detect_pipe(intel_output, dpms_mode); | 414 | intel_release_load_detect_pipe(intel_encoder, dpms_mode); |
414 | } else | 415 | } else |
415 | status = connector_status_unknown; | 416 | status = connector_status_unknown; |
416 | } | 417 | } |
@@ -420,9 +421,9 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto | |||
420 | 421 | ||
421 | static void intel_crt_destroy(struct drm_connector *connector) | 422 | static void intel_crt_destroy(struct drm_connector *connector) |
422 | { | 423 | { |
423 | struct intel_output *intel_output = to_intel_output(connector); | 424 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
424 | 425 | ||
425 | intel_i2c_destroy(intel_output->ddc_bus); | 426 | intel_i2c_destroy(intel_encoder->ddc_bus); |
426 | drm_sysfs_connector_remove(connector); | 427 | drm_sysfs_connector_remove(connector); |
427 | drm_connector_cleanup(connector); | 428 | drm_connector_cleanup(connector); |
428 | kfree(connector); | 429 | kfree(connector); |
@@ -431,28 +432,28 @@ static void intel_crt_destroy(struct drm_connector *connector) | |||
431 | static int intel_crt_get_modes(struct drm_connector *connector) | 432 | static int intel_crt_get_modes(struct drm_connector *connector) |
432 | { | 433 | { |
433 | int ret; | 434 | int ret; |
434 | struct intel_output *intel_output = to_intel_output(connector); | 435 | struct intel_encoder *intel_encoder = to_intel_encoder(connector); |
435 | struct i2c_adapter *ddcbus; | 436 | struct i2c_adapter *ddcbus; |
436 | struct drm_device *dev = connector->dev; | 437 | struct drm_device *dev = connector->dev; |
437 | 438 | ||
438 | 439 | ||
439 | ret = intel_ddc_get_modes(intel_output); | 440 | ret = intel_ddc_get_modes(intel_encoder); |
440 | if (ret || !IS_G4X(dev)) | 441 | if (ret || !IS_G4X(dev)) |
441 | goto end; | 442 | goto end; |
442 | 443 | ||
443 | ddcbus = intel_output->ddc_bus; | 444 | ddcbus = intel_encoder->ddc_bus; |
444 | /* Try to probe digital port for output in DVI-I -> VGA mode. */ | 445 | /* Try to probe digital port for output in DVI-I -> VGA mode. */ |
445 | intel_output->ddc_bus = | 446 | intel_encoder->ddc_bus = |
446 | intel_i2c_create(connector->dev, GPIOD, "CRTDDC_D"); | 447 | intel_i2c_create(connector->dev, GPIOD, "CRTDDC_D"); |
447 | 448 | ||
448 | if (!intel_output->ddc_bus) { | 449 | if (!intel_encoder->ddc_bus) { |
449 | intel_output->ddc_bus = ddcbus; | 450 | intel_encoder->ddc_bus = ddcbus; |
450 | dev_printk(KERN_ERR, &connector->dev->pdev->dev, | 451 | dev_printk(KERN_ERR, &connector->dev->pdev->dev, |
451 | "DDC bus registration failed for CRTDDC_D.\n"); | 452 | "DDC bus registration failed for CRTDDC_D.\n"); |
452 | goto end; | 453 | goto end; |
453 | } | 454 | } |
454 | /* Try to get modes by GPIOD port */ | 455 | /* Try to get modes by GPIOD port */ |
455 | ret = intel_ddc_get_modes(intel_output); | 456 | ret = intel_ddc_get_modes(intel_encoder); |
456 | intel_i2c_destroy(ddcbus); | 457 | intel_i2c_destroy(ddcbus); |
457 | 458 | ||
458 | end: | 459 | end: |
@@ -505,23 +506,23 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = { | |||
505 | void intel_crt_init(struct drm_device *dev) | 506 | void intel_crt_init(struct drm_device *dev) |
506 | { | 507 | { |
507 | struct drm_connector *connector; | 508 | struct drm_connector *connector; |
508 | struct intel_output *intel_output; | 509 | struct intel_encoder *intel_encoder; |
509 | struct drm_i915_private *dev_priv = dev->dev_private; | 510 | struct drm_i915_private *dev_priv = dev->dev_private; |
510 | u32 i2c_reg; | 511 | u32 i2c_reg; |
511 | 512 | ||
512 | intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL); | 513 | intel_encoder = kzalloc(sizeof(struct intel_encoder), GFP_KERNEL); |
513 | if (!intel_output) | 514 | if (!intel_encoder) |
514 | return; | 515 | return; |
515 | 516 | ||
516 | connector = &intel_output->base; | 517 | connector = &intel_encoder->base; |
517 | drm_connector_init(dev, &intel_output->base, | 518 | drm_connector_init(dev, &intel_encoder->base, |
518 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); | 519 | &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); |
519 | 520 | ||
520 | drm_encoder_init(dev, &intel_output->enc, &intel_crt_enc_funcs, | 521 | drm_encoder_init(dev, &intel_encoder->enc, &intel_crt_enc_funcs, |
521 | DRM_MODE_ENCODER_DAC); | 522 | DRM_MODE_ENCODER_DAC); |
522 | 523 | ||
523 | drm_mode_connector_attach_encoder(&intel_output->base, | 524 | drm_mode_connector_attach_encoder(&intel_encoder->base, |
524 | &intel_output->enc); | 525 | &intel_encoder->enc); |
525 | 526 | ||
526 | /* Set up the DDC bus. */ | 527 | /* Set up the DDC bus. */ |
527 | if (HAS_PCH_SPLIT(dev)) | 528 | if (HAS_PCH_SPLIT(dev)) |
@@ -532,22 +533,22 @@ void intel_crt_init(struct drm_device *dev) | |||
532 | if (dev_priv->crt_ddc_bus != 0) | 533 | if (dev_priv->crt_ddc_bus != 0) |
533 | i2c_reg = dev_priv->crt_ddc_bus; | 534 | i2c_reg = dev_priv->crt_ddc_bus; |
534 | } | 535 | } |
535 | intel_output->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A"); | 536 | intel_encoder->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A"); |
536 | if (!intel_output->ddc_bus) { | 537 | if (!intel_encoder->ddc_bus) { |
537 | dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " | 538 | dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " |
538 | "failed.\n"); | 539 | "failed.\n"); |
539 | return; | 540 | return; |
540 | } | 541 | } |
541 | 542 | ||
542 | intel_output->type = INTEL_OUTPUT_ANALOG; | 543 | intel_encoder->type = INTEL_OUTPUT_ANALOG; |
543 | intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | | 544 | intel_encoder->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | |
544 | (1 << INTEL_ANALOG_CLONE_BIT) | | 545 | (1 << INTEL_ANALOG_CLONE_BIT) | |
545 | (1 << INTEL_SDVO_LVDS_CLONE_BIT); | 546 | (1 << INTEL_SDVO_LVDS_CLONE_BIT); |
546 | intel_output->crtc_mask = (1 << 0) | (1 << 1); | 547 | intel_encoder->crtc_mask = (1 << 0) | (1 << 1); |
547 | connector->interlace_allowed = 0; | 548 | connector->interlace_allowed = 0; |
548 | connector->doublescan_allowed = 0; | 549 | connector->doublescan_allowed = 0; |
549 | 550 | ||
550 | drm_encoder_helper_add(&intel_output->enc, &intel_crt_helper_funcs); | 551 | drm_encoder_helper_add(&intel_encoder->enc, &intel_crt_helper_funcs); |
551 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); | 552 | drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); |
552 | 553 | ||
553 | drm_sysfs_connector_add(connector); | 554 | drm_sysfs_connector_add(connector); |