aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/intel_crt.c
diff options
context:
space:
mode:
authorEric Anholt <eric@anholt.net>2010-03-25 14:11:14 -0400
committerEric Anholt <eric@anholt.net>2010-03-25 15:27:32 -0400
commit21d40d37eca86872f2bf0af995809ebdef25c9d9 (patch)
treeb9626f936392f223fa7d001de38213a177bfe7fd /drivers/gpu/drm/i915/intel_crt.c
parent5e64499f3d39c633de49320e399479642c2b1743 (diff)
drm/i915: Rename intel_output to intel_encoder.
The intel_output naming is inherited from the UMS code, which had a structure of screen -> CRTC -> output. The DRM code has an additional notion of encoder/connector, so the structure is screen -> CRTC -> encoder -> connector. This is a useful structure for SDVO encoders which can support multiple connectors (each of which requires different programming in the one encoder and could be connected to different CRTCs), or for DVI-I, where multiple encoders feed into the connector for whether it's used for digital or analog. Most of our code is encoder-related, so transition it to talking about encoders before we start trying to distinguish connectors. This patch is produced by sed s/intel_output/intel_encoder/ over the driver. Signed-off-by: Eric Anholt <eric@anholt.net>
Diffstat (limited to 'drivers/gpu/drm/i915/intel_crt.c')
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c68
1 files changed, 34 insertions, 34 deletions
diff --git a/drivers/gpu/drm/i915/intel_crt.c b/drivers/gpu/drm/i915/intel_crt.c
index fccf07470c8f..36c4ad7fb3b6 100644
--- a/drivers/gpu/drm/i915/intel_crt.c
+++ b/drivers/gpu/drm/i915/intel_crt.c
@@ -246,19 +246,19 @@ static bool intel_crt_detect_hotplug(struct drm_connector *connector)
246 246
247static bool intel_crt_detect_ddc(struct drm_connector *connector) 247static bool intel_crt_detect_ddc(struct drm_connector *connector)
248{ 248{
249 struct intel_output *intel_output = to_intel_output(connector); 249 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
250 250
251 /* CRT should always be at 0, but check anyway */ 251 /* CRT should always be at 0, but check anyway */
252 if (intel_output->type != INTEL_OUTPUT_ANALOG) 252 if (intel_encoder->type != INTEL_OUTPUT_ANALOG)
253 return false; 253 return false;
254 254
255 return intel_ddc_probe(intel_output); 255 return intel_ddc_probe(intel_encoder);
256} 256}
257 257
258static enum drm_connector_status 258static enum drm_connector_status
259intel_crt_load_detect(struct drm_crtc *crtc, struct intel_output *intel_output) 259intel_crt_load_detect(struct drm_crtc *crtc, struct intel_encoder *intel_encoder)
260{ 260{
261 struct drm_encoder *encoder = &intel_output->enc; 261 struct drm_encoder *encoder = &intel_encoder->enc;
262 struct drm_device *dev = encoder->dev; 262 struct drm_device *dev = encoder->dev;
263 struct drm_i915_private *dev_priv = dev->dev_private; 263 struct drm_i915_private *dev_priv = dev->dev_private;
264 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 264 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
@@ -386,8 +386,8 @@ intel_crt_load_detect(struct drm_crtc *crtc, struct intel_output *intel_output)
386static enum drm_connector_status intel_crt_detect(struct drm_connector *connector) 386static enum drm_connector_status intel_crt_detect(struct drm_connector *connector)
387{ 387{
388 struct drm_device *dev = connector->dev; 388 struct drm_device *dev = connector->dev;
389 struct intel_output *intel_output = to_intel_output(connector); 389 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
390 struct drm_encoder *encoder = &intel_output->enc; 390 struct drm_encoder *encoder = &intel_encoder->enc;
391 struct drm_crtc *crtc; 391 struct drm_crtc *crtc;
392 int dpms_mode; 392 int dpms_mode;
393 enum drm_connector_status status; 393 enum drm_connector_status status;
@@ -404,13 +404,13 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto
404 404
405 /* for pre-945g platforms use load detect */ 405 /* for pre-945g platforms use load detect */
406 if (encoder->crtc && encoder->crtc->enabled) { 406 if (encoder->crtc && encoder->crtc->enabled) {
407 status = intel_crt_load_detect(encoder->crtc, intel_output); 407 status = intel_crt_load_detect(encoder->crtc, intel_encoder);
408 } else { 408 } else {
409 crtc = intel_get_load_detect_pipe(intel_output, 409 crtc = intel_get_load_detect_pipe(intel_encoder,
410 NULL, &dpms_mode); 410 NULL, &dpms_mode);
411 if (crtc) { 411 if (crtc) {
412 status = intel_crt_load_detect(crtc, intel_output); 412 status = intel_crt_load_detect(crtc, intel_encoder);
413 intel_release_load_detect_pipe(intel_output, dpms_mode); 413 intel_release_load_detect_pipe(intel_encoder, dpms_mode);
414 } else 414 } else
415 status = connector_status_unknown; 415 status = connector_status_unknown;
416 } 416 }
@@ -420,9 +420,9 @@ static enum drm_connector_status intel_crt_detect(struct drm_connector *connecto
420 420
421static void intel_crt_destroy(struct drm_connector *connector) 421static void intel_crt_destroy(struct drm_connector *connector)
422{ 422{
423 struct intel_output *intel_output = to_intel_output(connector); 423 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
424 424
425 intel_i2c_destroy(intel_output->ddc_bus); 425 intel_i2c_destroy(intel_encoder->ddc_bus);
426 drm_sysfs_connector_remove(connector); 426 drm_sysfs_connector_remove(connector);
427 drm_connector_cleanup(connector); 427 drm_connector_cleanup(connector);
428 kfree(connector); 428 kfree(connector);
@@ -431,28 +431,28 @@ static void intel_crt_destroy(struct drm_connector *connector)
431static int intel_crt_get_modes(struct drm_connector *connector) 431static int intel_crt_get_modes(struct drm_connector *connector)
432{ 432{
433 int ret; 433 int ret;
434 struct intel_output *intel_output = to_intel_output(connector); 434 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
435 struct i2c_adapter *ddcbus; 435 struct i2c_adapter *ddcbus;
436 struct drm_device *dev = connector->dev; 436 struct drm_device *dev = connector->dev;
437 437
438 438
439 ret = intel_ddc_get_modes(intel_output); 439 ret = intel_ddc_get_modes(intel_encoder);
440 if (ret || !IS_G4X(dev)) 440 if (ret || !IS_G4X(dev))
441 goto end; 441 goto end;
442 442
443 ddcbus = intel_output->ddc_bus; 443 ddcbus = intel_encoder->ddc_bus;
444 /* Try to probe digital port for output in DVI-I -> VGA mode. */ 444 /* Try to probe digital port for output in DVI-I -> VGA mode. */
445 intel_output->ddc_bus = 445 intel_encoder->ddc_bus =
446 intel_i2c_create(connector->dev, GPIOD, "CRTDDC_D"); 446 intel_i2c_create(connector->dev, GPIOD, "CRTDDC_D");
447 447
448 if (!intel_output->ddc_bus) { 448 if (!intel_encoder->ddc_bus) {
449 intel_output->ddc_bus = ddcbus; 449 intel_encoder->ddc_bus = ddcbus;
450 dev_printk(KERN_ERR, &connector->dev->pdev->dev, 450 dev_printk(KERN_ERR, &connector->dev->pdev->dev,
451 "DDC bus registration failed for CRTDDC_D.\n"); 451 "DDC bus registration failed for CRTDDC_D.\n");
452 goto end; 452 goto end;
453 } 453 }
454 /* Try to get modes by GPIOD port */ 454 /* Try to get modes by GPIOD port */
455 ret = intel_ddc_get_modes(intel_output); 455 ret = intel_ddc_get_modes(intel_encoder);
456 intel_i2c_destroy(ddcbus); 456 intel_i2c_destroy(ddcbus);
457 457
458end: 458end:
@@ -505,23 +505,23 @@ static const struct drm_encoder_funcs intel_crt_enc_funcs = {
505void intel_crt_init(struct drm_device *dev) 505void intel_crt_init(struct drm_device *dev)
506{ 506{
507 struct drm_connector *connector; 507 struct drm_connector *connector;
508 struct intel_output *intel_output; 508 struct intel_encoder *intel_encoder;
509 struct drm_i915_private *dev_priv = dev->dev_private; 509 struct drm_i915_private *dev_priv = dev->dev_private;
510 u32 i2c_reg; 510 u32 i2c_reg;
511 511
512 intel_output = kzalloc(sizeof(struct intel_output), GFP_KERNEL); 512 intel_encoder = kzalloc(sizeof(struct intel_encoder), GFP_KERNEL);
513 if (!intel_output) 513 if (!intel_encoder)
514 return; 514 return;
515 515
516 connector = &intel_output->base; 516 connector = &intel_encoder->base;
517 drm_connector_init(dev, &intel_output->base, 517 drm_connector_init(dev, &intel_encoder->base,
518 &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA); 518 &intel_crt_connector_funcs, DRM_MODE_CONNECTOR_VGA);
519 519
520 drm_encoder_init(dev, &intel_output->enc, &intel_crt_enc_funcs, 520 drm_encoder_init(dev, &intel_encoder->enc, &intel_crt_enc_funcs,
521 DRM_MODE_ENCODER_DAC); 521 DRM_MODE_ENCODER_DAC);
522 522
523 drm_mode_connector_attach_encoder(&intel_output->base, 523 drm_mode_connector_attach_encoder(&intel_encoder->base,
524 &intel_output->enc); 524 &intel_encoder->enc);
525 525
526 /* Set up the DDC bus. */ 526 /* Set up the DDC bus. */
527 if (HAS_PCH_SPLIT(dev)) 527 if (HAS_PCH_SPLIT(dev))
@@ -532,22 +532,22 @@ void intel_crt_init(struct drm_device *dev)
532 if (dev_priv->crt_ddc_bus != 0) 532 if (dev_priv->crt_ddc_bus != 0)
533 i2c_reg = dev_priv->crt_ddc_bus; 533 i2c_reg = dev_priv->crt_ddc_bus;
534 } 534 }
535 intel_output->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A"); 535 intel_encoder->ddc_bus = intel_i2c_create(dev, i2c_reg, "CRTDDC_A");
536 if (!intel_output->ddc_bus) { 536 if (!intel_encoder->ddc_bus) {
537 dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " 537 dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
538 "failed.\n"); 538 "failed.\n");
539 return; 539 return;
540 } 540 }
541 541
542 intel_output->type = INTEL_OUTPUT_ANALOG; 542 intel_encoder->type = INTEL_OUTPUT_ANALOG;
543 intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | 543 intel_encoder->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
544 (1 << INTEL_ANALOG_CLONE_BIT) | 544 (1 << INTEL_ANALOG_CLONE_BIT) |
545 (1 << INTEL_SDVO_LVDS_CLONE_BIT); 545 (1 << INTEL_SDVO_LVDS_CLONE_BIT);
546 intel_output->crtc_mask = (1 << 0) | (1 << 1); 546 intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
547 connector->interlace_allowed = 0; 547 connector->interlace_allowed = 0;
548 connector->doublescan_allowed = 0; 548 connector->doublescan_allowed = 0;
549 549
550 drm_encoder_helper_add(&intel_output->enc, &intel_crt_helper_funcs); 550 drm_encoder_helper_add(&intel_encoder->enc, &intel_crt_helper_funcs);
551 drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs); 551 drm_connector_helper_add(connector, &intel_crt_connector_helper_funcs);
552 552
553 drm_sysfs_connector_add(connector); 553 drm_sysfs_connector_add(connector);