aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915
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
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')
-rw-r--r--drivers/gpu/drm/i915/i915_irq.c6
-rw-r--r--drivers/gpu/drm/i915/intel_crt.c68
-rw-r--r--drivers/gpu/drm/i915/intel_display.c46
-rw-r--r--drivers/gpu/drm/i915/intel_dp.c256
-rw-r--r--drivers/gpu/drm/i915/intel_drv.h18
-rw-r--r--drivers/gpu/drm/i915/intel_dvo.c92
-rw-r--r--drivers/gpu/drm/i915/intel_hdmi.c86
-rw-r--r--drivers/gpu/drm/i915/intel_lvds.c64
-rw-r--r--drivers/gpu/drm/i915/intel_modes.c22
-rw-r--r--drivers/gpu/drm/i915/intel_sdvo.c572
-rw-r--r--drivers/gpu/drm/i915/intel_tv.c96
11 files changed, 663 insertions, 663 deletions
diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c
index bfbdad92d73d..5b53adfad40a 100644
--- a/drivers/gpu/drm/i915/i915_irq.c
+++ b/drivers/gpu/drm/i915/i915_irq.c
@@ -259,10 +259,10 @@ static void i915_hotplug_work_func(struct work_struct *work)
259 259
260 if (mode_config->num_connector) { 260 if (mode_config->num_connector) {
261 list_for_each_entry(connector, &mode_config->connector_list, head) { 261 list_for_each_entry(connector, &mode_config->connector_list, head) {
262 struct intel_output *intel_output = to_intel_output(connector); 262 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
263 263
264 if (intel_output->hot_plug) 264 if (intel_encoder->hot_plug)
265 (*intel_output->hot_plug) (intel_output); 265 (*intel_encoder->hot_plug) (intel_encoder);
266 } 266 }
267 } 267 }
268 /* Just fire off a uevent and let userspace tell us what to do */ 268 /* Just fire off a uevent and let userspace tell us what to do */
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);
diff --git a/drivers/gpu/drm/i915/intel_display.c b/drivers/gpu/drm/i915/intel_display.c
index 7adb3a54aac6..2595c4ccc6a8 100644
--- a/drivers/gpu/drm/i915/intel_display.c
+++ b/drivers/gpu/drm/i915/intel_display.c
@@ -746,8 +746,8 @@ bool intel_pipe_has_type (struct drm_crtc *crtc, int type)
746 list_for_each_entry(l_entry, &mode_config->connector_list, head) { 746 list_for_each_entry(l_entry, &mode_config->connector_list, head) {
747 if (l_entry->encoder && 747 if (l_entry->encoder &&
748 l_entry->encoder->crtc == crtc) { 748 l_entry->encoder->crtc == crtc) {
749 struct intel_output *intel_output = to_intel_output(l_entry); 749 struct intel_encoder *intel_encoder = to_intel_encoder(l_entry);
750 if (intel_output->type == type) 750 if (intel_encoder->type == type)
751 return true; 751 return true;
752 } 752 }
753 } 753 }
@@ -2942,19 +2942,19 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
2942 drm_vblank_pre_modeset(dev, pipe); 2942 drm_vblank_pre_modeset(dev, pipe);
2943 2943
2944 list_for_each_entry(connector, &mode_config->connector_list, head) { 2944 list_for_each_entry(connector, &mode_config->connector_list, head) {
2945 struct intel_output *intel_output = to_intel_output(connector); 2945 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
2946 2946
2947 if (!connector->encoder || connector->encoder->crtc != crtc) 2947 if (!connector->encoder || connector->encoder->crtc != crtc)
2948 continue; 2948 continue;
2949 2949
2950 switch (intel_output->type) { 2950 switch (intel_encoder->type) {
2951 case INTEL_OUTPUT_LVDS: 2951 case INTEL_OUTPUT_LVDS:
2952 is_lvds = true; 2952 is_lvds = true;
2953 break; 2953 break;
2954 case INTEL_OUTPUT_SDVO: 2954 case INTEL_OUTPUT_SDVO:
2955 case INTEL_OUTPUT_HDMI: 2955 case INTEL_OUTPUT_HDMI:
2956 is_sdvo = true; 2956 is_sdvo = true;
2957 if (intel_output->needs_tv_clock) 2957 if (intel_encoder->needs_tv_clock)
2958 is_tv = true; 2958 is_tv = true;
2959 break; 2959 break;
2960 case INTEL_OUTPUT_DVO: 2960 case INTEL_OUTPUT_DVO:
@@ -3049,7 +3049,7 @@ static int intel_crtc_mode_set(struct drm_crtc *crtc,
3049 struct drm_connector *edp; 3049 struct drm_connector *edp;
3050 target_clock = mode->clock; 3050 target_clock = mode->clock;
3051 edp = intel_pipe_get_output(crtc); 3051 edp = intel_pipe_get_output(crtc);
3052 intel_edp_link_config(to_intel_output(edp), 3052 intel_edp_link_config(to_intel_encoder(edp),
3053 &lane, &link_bw); 3053 &lane, &link_bw);
3054 } else { 3054 } else {
3055 /* DP over FDI requires target mode clock 3055 /* DP over FDI requires target mode clock
@@ -3669,14 +3669,14 @@ static struct drm_display_mode load_detect_mode = {
3669 704, 832, 0, 480, 489, 491, 520, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC), 3669 704, 832, 0, 480, 489, 491, 520, 0, DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC),
3670}; 3670};
3671 3671
3672struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output, 3672struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
3673 struct drm_display_mode *mode, 3673 struct drm_display_mode *mode,
3674 int *dpms_mode) 3674 int *dpms_mode)
3675{ 3675{
3676 struct intel_crtc *intel_crtc; 3676 struct intel_crtc *intel_crtc;
3677 struct drm_crtc *possible_crtc; 3677 struct drm_crtc *possible_crtc;
3678 struct drm_crtc *supported_crtc =NULL; 3678 struct drm_crtc *supported_crtc =NULL;
3679 struct drm_encoder *encoder = &intel_output->enc; 3679 struct drm_encoder *encoder = &intel_encoder->enc;
3680 struct drm_crtc *crtc = NULL; 3680 struct drm_crtc *crtc = NULL;
3681 struct drm_device *dev = encoder->dev; 3681 struct drm_device *dev = encoder->dev;
3682 struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; 3682 struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
@@ -3728,8 +3728,8 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output,
3728 } 3728 }
3729 3729
3730 encoder->crtc = crtc; 3730 encoder->crtc = crtc;
3731 intel_output->base.encoder = encoder; 3731 intel_encoder->base.encoder = encoder;
3732 intel_output->load_detect_temp = true; 3732 intel_encoder->load_detect_temp = true;
3733 3733
3734 intel_crtc = to_intel_crtc(crtc); 3734 intel_crtc = to_intel_crtc(crtc);
3735 *dpms_mode = intel_crtc->dpms_mode; 3735 *dpms_mode = intel_crtc->dpms_mode;
@@ -3754,18 +3754,18 @@ struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output,
3754 return crtc; 3754 return crtc;
3755} 3755}
3756 3756
3757void intel_release_load_detect_pipe(struct intel_output *intel_output, int dpms_mode) 3757void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder, int dpms_mode)
3758{ 3758{
3759 struct drm_encoder *encoder = &intel_output->enc; 3759 struct drm_encoder *encoder = &intel_encoder->enc;
3760 struct drm_device *dev = encoder->dev; 3760 struct drm_device *dev = encoder->dev;
3761 struct drm_crtc *crtc = encoder->crtc; 3761 struct drm_crtc *crtc = encoder->crtc;
3762 struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private; 3762 struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
3763 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private; 3763 struct drm_crtc_helper_funcs *crtc_funcs = crtc->helper_private;
3764 3764
3765 if (intel_output->load_detect_temp) { 3765 if (intel_encoder->load_detect_temp) {
3766 encoder->crtc = NULL; 3766 encoder->crtc = NULL;
3767 intel_output->base.encoder = NULL; 3767 intel_encoder->base.encoder = NULL;
3768 intel_output->load_detect_temp = false; 3768 intel_encoder->load_detect_temp = false;
3769 crtc->enabled = drm_helper_crtc_in_use(crtc); 3769 crtc->enabled = drm_helper_crtc_in_use(crtc);
3770 drm_helper_disable_unused_functions(dev); 3770 drm_helper_disable_unused_functions(dev);
3771 } 3771 }
@@ -4398,8 +4398,8 @@ static int intel_connector_clones(struct drm_device *dev, int type_mask)
4398 int entry = 0; 4398 int entry = 0;
4399 4399
4400 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 4400 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
4401 struct intel_output *intel_output = to_intel_output(connector); 4401 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
4402 if (type_mask & intel_output->clone_mask) 4402 if (type_mask & intel_encoder->clone_mask)
4403 index_mask |= (1 << entry); 4403 index_mask |= (1 << entry);
4404 entry++; 4404 entry++;
4405 } 4405 }
@@ -4494,12 +4494,12 @@ static void intel_setup_outputs(struct drm_device *dev)
4494 intel_tv_init(dev); 4494 intel_tv_init(dev);
4495 4495
4496 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 4496 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
4497 struct intel_output *intel_output = to_intel_output(connector); 4497 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
4498 struct drm_encoder *encoder = &intel_output->enc; 4498 struct drm_encoder *encoder = &intel_encoder->enc;
4499 4499
4500 encoder->possible_crtcs = intel_output->crtc_mask; 4500 encoder->possible_crtcs = intel_encoder->crtc_mask;
4501 encoder->possible_clones = intel_connector_clones(dev, 4501 encoder->possible_clones = intel_connector_clones(dev,
4502 intel_output->clone_mask); 4502 intel_encoder->clone_mask);
4503 } 4503 }
4504} 4504}
4505 4505
@@ -4977,9 +4977,9 @@ void intel_modeset_cleanup(struct drm_device *dev)
4977*/ 4977*/
4978struct drm_encoder *intel_best_encoder(struct drm_connector *connector) 4978struct drm_encoder *intel_best_encoder(struct drm_connector *connector)
4979{ 4979{
4980 struct intel_output *intel_output = to_intel_output(connector); 4980 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
4981 4981
4982 return &intel_output->enc; 4982 return &intel_encoder->enc;
4983} 4983}
4984 4984
4985/* 4985/*
diff --git a/drivers/gpu/drm/i915/intel_dp.c b/drivers/gpu/drm/i915/intel_dp.c
index 3ef3a0d0edd0..0a7e3264dac2 100644
--- a/drivers/gpu/drm/i915/intel_dp.c
+++ b/drivers/gpu/drm/i915/intel_dp.c
@@ -54,23 +54,23 @@ struct intel_dp_priv {
54 uint8_t link_bw; 54 uint8_t link_bw;
55 uint8_t lane_count; 55 uint8_t lane_count;
56 uint8_t dpcd[4]; 56 uint8_t dpcd[4];
57 struct intel_output *intel_output; 57 struct intel_encoder *intel_encoder;
58 struct i2c_adapter adapter; 58 struct i2c_adapter adapter;
59 struct i2c_algo_dp_aux_data algo; 59 struct i2c_algo_dp_aux_data algo;
60}; 60};
61 61
62static void 62static void
63intel_dp_link_train(struct intel_output *intel_output, uint32_t DP, 63intel_dp_link_train(struct intel_encoder *intel_encoder, uint32_t DP,
64 uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE]); 64 uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE]);
65 65
66static void 66static void
67intel_dp_link_down(struct intel_output *intel_output, uint32_t DP); 67intel_dp_link_down(struct intel_encoder *intel_encoder, uint32_t DP);
68 68
69void 69void
70intel_edp_link_config (struct intel_output *intel_output, 70intel_edp_link_config (struct intel_encoder *intel_encoder,
71 int *lane_num, int *link_bw) 71 int *lane_num, int *link_bw)
72{ 72{
73 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 73 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
74 74
75 *lane_num = dp_priv->lane_count; 75 *lane_num = dp_priv->lane_count;
76 if (dp_priv->link_bw == DP_LINK_BW_1_62) 76 if (dp_priv->link_bw == DP_LINK_BW_1_62)
@@ -80,9 +80,9 @@ intel_edp_link_config (struct intel_output *intel_output,
80} 80}
81 81
82static int 82static int
83intel_dp_max_lane_count(struct intel_output *intel_output) 83intel_dp_max_lane_count(struct intel_encoder *intel_encoder)
84{ 84{
85 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 85 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
86 int max_lane_count = 4; 86 int max_lane_count = 4;
87 87
88 if (dp_priv->dpcd[0] >= 0x11) { 88 if (dp_priv->dpcd[0] >= 0x11) {
@@ -98,9 +98,9 @@ intel_dp_max_lane_count(struct intel_output *intel_output)
98} 98}
99 99
100static int 100static int
101intel_dp_max_link_bw(struct intel_output *intel_output) 101intel_dp_max_link_bw(struct intel_encoder *intel_encoder)
102{ 102{
103 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 103 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
104 int max_link_bw = dp_priv->dpcd[1]; 104 int max_link_bw = dp_priv->dpcd[1];
105 105
106 switch (max_link_bw) { 106 switch (max_link_bw) {
@@ -126,11 +126,11 @@ intel_dp_link_clock(uint8_t link_bw)
126/* I think this is a fiction */ 126/* I think this is a fiction */
127static int 127static int
128intel_dp_link_required(struct drm_device *dev, 128intel_dp_link_required(struct drm_device *dev,
129 struct intel_output *intel_output, int pixel_clock) 129 struct intel_encoder *intel_encoder, int pixel_clock)
130{ 130{
131 struct drm_i915_private *dev_priv = dev->dev_private; 131 struct drm_i915_private *dev_priv = dev->dev_private;
132 132
133 if (IS_eDP(intel_output)) 133 if (IS_eDP(intel_encoder))
134 return (pixel_clock * dev_priv->edp_bpp) / 8; 134 return (pixel_clock * dev_priv->edp_bpp) / 8;
135 else 135 else
136 return pixel_clock * 3; 136 return pixel_clock * 3;
@@ -140,11 +140,11 @@ static int
140intel_dp_mode_valid(struct drm_connector *connector, 140intel_dp_mode_valid(struct drm_connector *connector,
141 struct drm_display_mode *mode) 141 struct drm_display_mode *mode)
142{ 142{
143 struct intel_output *intel_output = to_intel_output(connector); 143 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
144 int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_output)); 144 int max_link_clock = intel_dp_link_clock(intel_dp_max_link_bw(intel_encoder));
145 int max_lanes = intel_dp_max_lane_count(intel_output); 145 int max_lanes = intel_dp_max_lane_count(intel_encoder);
146 146
147 if (intel_dp_link_required(connector->dev, intel_output, mode->clock) 147 if (intel_dp_link_required(connector->dev, intel_encoder, mode->clock)
148 > max_link_clock * max_lanes) 148 > max_link_clock * max_lanes)
149 return MODE_CLOCK_HIGH; 149 return MODE_CLOCK_HIGH;
150 150
@@ -208,13 +208,13 @@ intel_hrawclk(struct drm_device *dev)
208} 208}
209 209
210static int 210static int
211intel_dp_aux_ch(struct intel_output *intel_output, 211intel_dp_aux_ch(struct intel_encoder *intel_encoder,
212 uint8_t *send, int send_bytes, 212 uint8_t *send, int send_bytes,
213 uint8_t *recv, int recv_size) 213 uint8_t *recv, int recv_size)
214{ 214{
215 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 215 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
216 uint32_t output_reg = dp_priv->output_reg; 216 uint32_t output_reg = dp_priv->output_reg;
217 struct drm_device *dev = intel_output->base.dev; 217 struct drm_device *dev = intel_encoder->base.dev;
218 struct drm_i915_private *dev_priv = dev->dev_private; 218 struct drm_i915_private *dev_priv = dev->dev_private;
219 uint32_t ch_ctl = output_reg + 0x10; 219 uint32_t ch_ctl = output_reg + 0x10;
220 uint32_t ch_data = ch_ctl + 4; 220 uint32_t ch_data = ch_ctl + 4;
@@ -229,7 +229,7 @@ intel_dp_aux_ch(struct intel_output *intel_output,
229 * and would like to run at 2MHz. So, take the 229 * and would like to run at 2MHz. So, take the
230 * hrawclk value and divide by 2 and use that 230 * hrawclk value and divide by 2 and use that
231 */ 231 */
232 if (IS_eDP(intel_output)) 232 if (IS_eDP(intel_encoder))
233 aux_clock_divider = 225; /* eDP input clock at 450Mhz */ 233 aux_clock_divider = 225; /* eDP input clock at 450Mhz */
234 else if (HAS_PCH_SPLIT(dev)) 234 else if (HAS_PCH_SPLIT(dev))
235 aux_clock_divider = 62; /* IRL input clock fixed at 125Mhz */ 235 aux_clock_divider = 62; /* IRL input clock fixed at 125Mhz */
@@ -312,7 +312,7 @@ intel_dp_aux_ch(struct intel_output *intel_output,
312 312
313/* Write data to the aux channel in native mode */ 313/* Write data to the aux channel in native mode */
314static int 314static int
315intel_dp_aux_native_write(struct intel_output *intel_output, 315intel_dp_aux_native_write(struct intel_encoder *intel_encoder,
316 uint16_t address, uint8_t *send, int send_bytes) 316 uint16_t address, uint8_t *send, int send_bytes)
317{ 317{
318 int ret; 318 int ret;
@@ -329,7 +329,7 @@ intel_dp_aux_native_write(struct intel_output *intel_output,
329 memcpy(&msg[4], send, send_bytes); 329 memcpy(&msg[4], send, send_bytes);
330 msg_bytes = send_bytes + 4; 330 msg_bytes = send_bytes + 4;
331 for (;;) { 331 for (;;) {
332 ret = intel_dp_aux_ch(intel_output, msg, msg_bytes, &ack, 1); 332 ret = intel_dp_aux_ch(intel_encoder, msg, msg_bytes, &ack, 1);
333 if (ret < 0) 333 if (ret < 0)
334 return ret; 334 return ret;
335 if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK) 335 if ((ack & AUX_NATIVE_REPLY_MASK) == AUX_NATIVE_REPLY_ACK)
@@ -344,15 +344,15 @@ intel_dp_aux_native_write(struct intel_output *intel_output,
344 344
345/* Write a single byte to the aux channel in native mode */ 345/* Write a single byte to the aux channel in native mode */
346static int 346static int
347intel_dp_aux_native_write_1(struct intel_output *intel_output, 347intel_dp_aux_native_write_1(struct intel_encoder *intel_encoder,
348 uint16_t address, uint8_t byte) 348 uint16_t address, uint8_t byte)
349{ 349{
350 return intel_dp_aux_native_write(intel_output, address, &byte, 1); 350 return intel_dp_aux_native_write(intel_encoder, address, &byte, 1);
351} 351}
352 352
353/* read bytes from a native aux channel */ 353/* read bytes from a native aux channel */
354static int 354static int
355intel_dp_aux_native_read(struct intel_output *intel_output, 355intel_dp_aux_native_read(struct intel_encoder *intel_encoder,
356 uint16_t address, uint8_t *recv, int recv_bytes) 356 uint16_t address, uint8_t *recv, int recv_bytes)
357{ 357{
358 uint8_t msg[4]; 358 uint8_t msg[4];
@@ -371,7 +371,7 @@ intel_dp_aux_native_read(struct intel_output *intel_output,
371 reply_bytes = recv_bytes + 1; 371 reply_bytes = recv_bytes + 1;
372 372
373 for (;;) { 373 for (;;) {
374 ret = intel_dp_aux_ch(intel_output, msg, msg_bytes, 374 ret = intel_dp_aux_ch(intel_encoder, msg, msg_bytes,
375 reply, reply_bytes); 375 reply, reply_bytes);
376 if (ret == 0) 376 if (ret == 0)
377 return -EPROTO; 377 return -EPROTO;
@@ -397,7 +397,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
397 struct intel_dp_priv *dp_priv = container_of(adapter, 397 struct intel_dp_priv *dp_priv = container_of(adapter,
398 struct intel_dp_priv, 398 struct intel_dp_priv,
399 adapter); 399 adapter);
400 struct intel_output *intel_output = dp_priv->intel_output; 400 struct intel_encoder *intel_encoder = dp_priv->intel_encoder;
401 uint16_t address = algo_data->address; 401 uint16_t address = algo_data->address;
402 uint8_t msg[5]; 402 uint8_t msg[5];
403 uint8_t reply[2]; 403 uint8_t reply[2];
@@ -436,7 +436,7 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
436 } 436 }
437 437
438 for (;;) { 438 for (;;) {
439 ret = intel_dp_aux_ch(intel_output, 439 ret = intel_dp_aux_ch(intel_encoder,
440 msg, msg_bytes, 440 msg, msg_bytes,
441 reply, reply_bytes); 441 reply, reply_bytes);
442 if (ret < 0) { 442 if (ret < 0) {
@@ -464,9 +464,9 @@ intel_dp_i2c_aux_ch(struct i2c_adapter *adapter, int mode,
464} 464}
465 465
466static int 466static int
467intel_dp_i2c_init(struct intel_output *intel_output, const char *name) 467intel_dp_i2c_init(struct intel_encoder *intel_encoder, const char *name)
468{ 468{
469 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 469 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
470 470
471 DRM_DEBUG_KMS("i2c_init %s\n", name); 471 DRM_DEBUG_KMS("i2c_init %s\n", name);
472 dp_priv->algo.running = false; 472 dp_priv->algo.running = false;
@@ -479,7 +479,7 @@ intel_dp_i2c_init(struct intel_output *intel_output, const char *name)
479 strncpy (dp_priv->adapter.name, name, sizeof(dp_priv->adapter.name) - 1); 479 strncpy (dp_priv->adapter.name, name, sizeof(dp_priv->adapter.name) - 1);
480 dp_priv->adapter.name[sizeof(dp_priv->adapter.name) - 1] = '\0'; 480 dp_priv->adapter.name[sizeof(dp_priv->adapter.name) - 1] = '\0';
481 dp_priv->adapter.algo_data = &dp_priv->algo; 481 dp_priv->adapter.algo_data = &dp_priv->algo;
482 dp_priv->adapter.dev.parent = &intel_output->base.kdev; 482 dp_priv->adapter.dev.parent = &intel_encoder->base.kdev;
483 483
484 return i2c_dp_aux_add_bus(&dp_priv->adapter); 484 return i2c_dp_aux_add_bus(&dp_priv->adapter);
485} 485}
@@ -488,18 +488,18 @@ static bool
488intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode, 488intel_dp_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
489 struct drm_display_mode *adjusted_mode) 489 struct drm_display_mode *adjusted_mode)
490{ 490{
491 struct intel_output *intel_output = enc_to_intel_output(encoder); 491 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
492 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 492 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
493 int lane_count, clock; 493 int lane_count, clock;
494 int max_lane_count = intel_dp_max_lane_count(intel_output); 494 int max_lane_count = intel_dp_max_lane_count(intel_encoder);
495 int max_clock = intel_dp_max_link_bw(intel_output) == DP_LINK_BW_2_7 ? 1 : 0; 495 int max_clock = intel_dp_max_link_bw(intel_encoder) == DP_LINK_BW_2_7 ? 1 : 0;
496 static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 }; 496 static int bws[2] = { DP_LINK_BW_1_62, DP_LINK_BW_2_7 };
497 497
498 for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) { 498 for (lane_count = 1; lane_count <= max_lane_count; lane_count <<= 1) {
499 for (clock = 0; clock <= max_clock; clock++) { 499 for (clock = 0; clock <= max_clock; clock++) {
500 int link_avail = intel_dp_link_clock(bws[clock]) * lane_count; 500 int link_avail = intel_dp_link_clock(bws[clock]) * lane_count;
501 501
502 if (intel_dp_link_required(encoder->dev, intel_output, mode->clock) 502 if (intel_dp_link_required(encoder->dev, intel_encoder, mode->clock)
503 <= link_avail) { 503 <= link_avail) {
504 dp_priv->link_bw = bws[clock]; 504 dp_priv->link_bw = bws[clock];
505 dp_priv->lane_count = lane_count; 505 dp_priv->lane_count = lane_count;
@@ -561,16 +561,16 @@ intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
561 struct intel_dp_m_n m_n; 561 struct intel_dp_m_n m_n;
562 562
563 /* 563 /*
564 * Find the lane count in the intel_output private 564 * Find the lane count in the intel_encoder private
565 */ 565 */
566 list_for_each_entry(connector, &mode_config->connector_list, head) { 566 list_for_each_entry(connector, &mode_config->connector_list, head) {
567 struct intel_output *intel_output = to_intel_output(connector); 567 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
568 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 568 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
569 569
570 if (!connector->encoder || connector->encoder->crtc != crtc) 570 if (!connector->encoder || connector->encoder->crtc != crtc)
571 continue; 571 continue;
572 572
573 if (intel_output->type == INTEL_OUTPUT_DISPLAYPORT) { 573 if (intel_encoder->type == INTEL_OUTPUT_DISPLAYPORT) {
574 lane_count = dp_priv->lane_count; 574 lane_count = dp_priv->lane_count;
575 break; 575 break;
576 } 576 }
@@ -625,9 +625,9 @@ static void
625intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, 625intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
626 struct drm_display_mode *adjusted_mode) 626 struct drm_display_mode *adjusted_mode)
627{ 627{
628 struct intel_output *intel_output = enc_to_intel_output(encoder); 628 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
629 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 629 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
630 struct drm_crtc *crtc = intel_output->enc.crtc; 630 struct drm_crtc *crtc = intel_encoder->enc.crtc;
631 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 631 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
632 632
633 dp_priv->DP = (DP_LINK_TRAIN_OFF | 633 dp_priv->DP = (DP_LINK_TRAIN_OFF |
@@ -666,7 +666,7 @@ intel_dp_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
666 if (intel_crtc->pipe == 1) 666 if (intel_crtc->pipe == 1)
667 dp_priv->DP |= DP_PIPEB_SELECT; 667 dp_priv->DP |= DP_PIPEB_SELECT;
668 668
669 if (IS_eDP(intel_output)) { 669 if (IS_eDP(intel_encoder)) {
670 /* don't miss out required setting for eDP */ 670 /* don't miss out required setting for eDP */
671 dp_priv->DP |= DP_PLL_ENABLE; 671 dp_priv->DP |= DP_PLL_ENABLE;
672 if (adjusted_mode->clock < 200000) 672 if (adjusted_mode->clock < 200000)
@@ -701,22 +701,22 @@ static void ironlake_edp_backlight_off (struct drm_device *dev)
701static void 701static void
702intel_dp_dpms(struct drm_encoder *encoder, int mode) 702intel_dp_dpms(struct drm_encoder *encoder, int mode)
703{ 703{
704 struct intel_output *intel_output = enc_to_intel_output(encoder); 704 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
705 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 705 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
706 struct drm_device *dev = intel_output->base.dev; 706 struct drm_device *dev = intel_encoder->base.dev;
707 struct drm_i915_private *dev_priv = dev->dev_private; 707 struct drm_i915_private *dev_priv = dev->dev_private;
708 uint32_t dp_reg = I915_READ(dp_priv->output_reg); 708 uint32_t dp_reg = I915_READ(dp_priv->output_reg);
709 709
710 if (mode != DRM_MODE_DPMS_ON) { 710 if (mode != DRM_MODE_DPMS_ON) {
711 if (dp_reg & DP_PORT_EN) { 711 if (dp_reg & DP_PORT_EN) {
712 intel_dp_link_down(intel_output, dp_priv->DP); 712 intel_dp_link_down(intel_encoder, dp_priv->DP);
713 if (IS_eDP(intel_output)) 713 if (IS_eDP(intel_encoder))
714 ironlake_edp_backlight_off(dev); 714 ironlake_edp_backlight_off(dev);
715 } 715 }
716 } else { 716 } else {
717 if (!(dp_reg & DP_PORT_EN)) { 717 if (!(dp_reg & DP_PORT_EN)) {
718 intel_dp_link_train(intel_output, dp_priv->DP, dp_priv->link_configuration); 718 intel_dp_link_train(intel_encoder, dp_priv->DP, dp_priv->link_configuration);
719 if (IS_eDP(intel_output)) 719 if (IS_eDP(intel_encoder))
720 ironlake_edp_backlight_on(dev); 720 ironlake_edp_backlight_on(dev);
721 } 721 }
722 } 722 }
@@ -728,12 +728,12 @@ intel_dp_dpms(struct drm_encoder *encoder, int mode)
728 * link status information 728 * link status information
729 */ 729 */
730static bool 730static bool
731intel_dp_get_link_status(struct intel_output *intel_output, 731intel_dp_get_link_status(struct intel_encoder *intel_encoder,
732 uint8_t link_status[DP_LINK_STATUS_SIZE]) 732 uint8_t link_status[DP_LINK_STATUS_SIZE])
733{ 733{
734 int ret; 734 int ret;
735 735
736 ret = intel_dp_aux_native_read(intel_output, 736 ret = intel_dp_aux_native_read(intel_encoder,
737 DP_LANE0_1_STATUS, 737 DP_LANE0_1_STATUS,
738 link_status, DP_LINK_STATUS_SIZE); 738 link_status, DP_LINK_STATUS_SIZE);
739 if (ret != DP_LINK_STATUS_SIZE) 739 if (ret != DP_LINK_STATUS_SIZE)
@@ -751,13 +751,13 @@ intel_dp_link_status(uint8_t link_status[DP_LINK_STATUS_SIZE],
751static void 751static void
752intel_dp_save(struct drm_connector *connector) 752intel_dp_save(struct drm_connector *connector)
753{ 753{
754 struct intel_output *intel_output = to_intel_output(connector); 754 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
755 struct drm_device *dev = intel_output->base.dev; 755 struct drm_device *dev = intel_encoder->base.dev;
756 struct drm_i915_private *dev_priv = dev->dev_private; 756 struct drm_i915_private *dev_priv = dev->dev_private;
757 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 757 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
758 758
759 dp_priv->save_DP = I915_READ(dp_priv->output_reg); 759 dp_priv->save_DP = I915_READ(dp_priv->output_reg);
760 intel_dp_aux_native_read(intel_output, DP_LINK_BW_SET, 760 intel_dp_aux_native_read(intel_encoder, DP_LINK_BW_SET,
761 dp_priv->save_link_configuration, 761 dp_priv->save_link_configuration,
762 sizeof (dp_priv->save_link_configuration)); 762 sizeof (dp_priv->save_link_configuration));
763} 763}
@@ -824,7 +824,7 @@ intel_dp_pre_emphasis_max(uint8_t voltage_swing)
824} 824}
825 825
826static void 826static void
827intel_get_adjust_train(struct intel_output *intel_output, 827intel_get_adjust_train(struct intel_encoder *intel_encoder,
828 uint8_t link_status[DP_LINK_STATUS_SIZE], 828 uint8_t link_status[DP_LINK_STATUS_SIZE],
829 int lane_count, 829 int lane_count,
830 uint8_t train_set[4]) 830 uint8_t train_set[4])
@@ -941,15 +941,15 @@ intel_channel_eq_ok(uint8_t link_status[DP_LINK_STATUS_SIZE], int lane_count)
941} 941}
942 942
943static bool 943static bool
944intel_dp_set_link_train(struct intel_output *intel_output, 944intel_dp_set_link_train(struct intel_encoder *intel_encoder,
945 uint32_t dp_reg_value, 945 uint32_t dp_reg_value,
946 uint8_t dp_train_pat, 946 uint8_t dp_train_pat,
947 uint8_t train_set[4], 947 uint8_t train_set[4],
948 bool first) 948 bool first)
949{ 949{
950 struct drm_device *dev = intel_output->base.dev; 950 struct drm_device *dev = intel_encoder->base.dev;
951 struct drm_i915_private *dev_priv = dev->dev_private; 951 struct drm_i915_private *dev_priv = dev->dev_private;
952 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 952 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
953 int ret; 953 int ret;
954 954
955 I915_WRITE(dp_priv->output_reg, dp_reg_value); 955 I915_WRITE(dp_priv->output_reg, dp_reg_value);
@@ -957,11 +957,11 @@ intel_dp_set_link_train(struct intel_output *intel_output,
957 if (first) 957 if (first)
958 intel_wait_for_vblank(dev); 958 intel_wait_for_vblank(dev);
959 959
960 intel_dp_aux_native_write_1(intel_output, 960 intel_dp_aux_native_write_1(intel_encoder,
961 DP_TRAINING_PATTERN_SET, 961 DP_TRAINING_PATTERN_SET,
962 dp_train_pat); 962 dp_train_pat);
963 963
964 ret = intel_dp_aux_native_write(intel_output, 964 ret = intel_dp_aux_native_write(intel_encoder,
965 DP_TRAINING_LANE0_SET, train_set, 4); 965 DP_TRAINING_LANE0_SET, train_set, 4);
966 if (ret != 4) 966 if (ret != 4)
967 return false; 967 return false;
@@ -970,12 +970,12 @@ intel_dp_set_link_train(struct intel_output *intel_output,
970} 970}
971 971
972static void 972static void
973intel_dp_link_train(struct intel_output *intel_output, uint32_t DP, 973intel_dp_link_train(struct intel_encoder *intel_encoder, uint32_t DP,
974 uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE]) 974 uint8_t link_configuration[DP_LINK_CONFIGURATION_SIZE])
975{ 975{
976 struct drm_device *dev = intel_output->base.dev; 976 struct drm_device *dev = intel_encoder->base.dev;
977 struct drm_i915_private *dev_priv = dev->dev_private; 977 struct drm_i915_private *dev_priv = dev->dev_private;
978 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 978 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
979 uint8_t train_set[4]; 979 uint8_t train_set[4];
980 uint8_t link_status[DP_LINK_STATUS_SIZE]; 980 uint8_t link_status[DP_LINK_STATUS_SIZE];
981 int i; 981 int i;
@@ -986,7 +986,7 @@ intel_dp_link_train(struct intel_output *intel_output, uint32_t DP,
986 int tries; 986 int tries;
987 987
988 /* Write the link configuration data */ 988 /* Write the link configuration data */
989 intel_dp_aux_native_write(intel_output, 0x100, 989 intel_dp_aux_native_write(intel_encoder, 0x100,
990 link_configuration, DP_LINK_CONFIGURATION_SIZE); 990 link_configuration, DP_LINK_CONFIGURATION_SIZE);
991 991
992 DP |= DP_PORT_EN; 992 DP |= DP_PORT_EN;
@@ -1000,14 +1000,14 @@ intel_dp_link_train(struct intel_output *intel_output, uint32_t DP,
1000 uint32_t signal_levels = intel_dp_signal_levels(train_set[0], dp_priv->lane_count); 1000 uint32_t signal_levels = intel_dp_signal_levels(train_set[0], dp_priv->lane_count);
1001 DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; 1001 DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels;
1002 1002
1003 if (!intel_dp_set_link_train(intel_output, DP | DP_LINK_TRAIN_PAT_1, 1003 if (!intel_dp_set_link_train(intel_encoder, DP | DP_LINK_TRAIN_PAT_1,
1004 DP_TRAINING_PATTERN_1, train_set, first)) 1004 DP_TRAINING_PATTERN_1, train_set, first))
1005 break; 1005 break;
1006 first = false; 1006 first = false;
1007 /* Set training pattern 1 */ 1007 /* Set training pattern 1 */
1008 1008
1009 udelay(100); 1009 udelay(100);
1010 if (!intel_dp_get_link_status(intel_output, link_status)) 1010 if (!intel_dp_get_link_status(intel_encoder, link_status))
1011 break; 1011 break;
1012 1012
1013 if (intel_clock_recovery_ok(link_status, dp_priv->lane_count)) { 1013 if (intel_clock_recovery_ok(link_status, dp_priv->lane_count)) {
@@ -1032,7 +1032,7 @@ intel_dp_link_train(struct intel_output *intel_output, uint32_t DP,
1032 voltage = train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK; 1032 voltage = train_set[0] & DP_TRAIN_VOLTAGE_SWING_MASK;
1033 1033
1034 /* Compute new train_set as requested by target */ 1034 /* Compute new train_set as requested by target */
1035 intel_get_adjust_train(intel_output, link_status, dp_priv->lane_count, train_set); 1035 intel_get_adjust_train(intel_encoder, link_status, dp_priv->lane_count, train_set);
1036 } 1036 }
1037 1037
1038 /* channel equalization */ 1038 /* channel equalization */
@@ -1044,13 +1044,13 @@ intel_dp_link_train(struct intel_output *intel_output, uint32_t DP,
1044 DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels; 1044 DP = (DP & ~(DP_VOLTAGE_MASK|DP_PRE_EMPHASIS_MASK)) | signal_levels;
1045 1045
1046 /* channel eq pattern */ 1046 /* channel eq pattern */
1047 if (!intel_dp_set_link_train(intel_output, DP | DP_LINK_TRAIN_PAT_2, 1047 if (!intel_dp_set_link_train(intel_encoder, DP | DP_LINK_TRAIN_PAT_2,
1048 DP_TRAINING_PATTERN_2, train_set, 1048 DP_TRAINING_PATTERN_2, train_set,
1049 false)) 1049 false))
1050 break; 1050 break;
1051 1051
1052 udelay(400); 1052 udelay(400);
1053 if (!intel_dp_get_link_status(intel_output, link_status)) 1053 if (!intel_dp_get_link_status(intel_encoder, link_status))
1054 break; 1054 break;
1055 1055
1056 if (intel_channel_eq_ok(link_status, dp_priv->lane_count)) { 1056 if (intel_channel_eq_ok(link_status, dp_priv->lane_count)) {
@@ -1063,26 +1063,26 @@ intel_dp_link_train(struct intel_output *intel_output, uint32_t DP,
1063 break; 1063 break;
1064 1064
1065 /* Compute new train_set as requested by target */ 1065 /* Compute new train_set as requested by target */
1066 intel_get_adjust_train(intel_output, link_status, dp_priv->lane_count, train_set); 1066 intel_get_adjust_train(intel_encoder, link_status, dp_priv->lane_count, train_set);
1067 ++tries; 1067 ++tries;
1068 } 1068 }
1069 1069
1070 I915_WRITE(dp_priv->output_reg, DP | DP_LINK_TRAIN_OFF); 1070 I915_WRITE(dp_priv->output_reg, DP | DP_LINK_TRAIN_OFF);
1071 POSTING_READ(dp_priv->output_reg); 1071 POSTING_READ(dp_priv->output_reg);
1072 intel_dp_aux_native_write_1(intel_output, 1072 intel_dp_aux_native_write_1(intel_encoder,
1073 DP_TRAINING_PATTERN_SET, DP_TRAINING_PATTERN_DISABLE); 1073 DP_TRAINING_PATTERN_SET, DP_TRAINING_PATTERN_DISABLE);
1074} 1074}
1075 1075
1076static void 1076static void
1077intel_dp_link_down(struct intel_output *intel_output, uint32_t DP) 1077intel_dp_link_down(struct intel_encoder *intel_encoder, uint32_t DP)
1078{ 1078{
1079 struct drm_device *dev = intel_output->base.dev; 1079 struct drm_device *dev = intel_encoder->base.dev;
1080 struct drm_i915_private *dev_priv = dev->dev_private; 1080 struct drm_i915_private *dev_priv = dev->dev_private;
1081 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 1081 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
1082 1082
1083 DRM_DEBUG_KMS("\n"); 1083 DRM_DEBUG_KMS("\n");
1084 1084
1085 if (IS_eDP(intel_output)) { 1085 if (IS_eDP(intel_encoder)) {
1086 DP &= ~DP_PLL_ENABLE; 1086 DP &= ~DP_PLL_ENABLE;
1087 I915_WRITE(dp_priv->output_reg, DP); 1087 I915_WRITE(dp_priv->output_reg, DP);
1088 POSTING_READ(dp_priv->output_reg); 1088 POSTING_READ(dp_priv->output_reg);
@@ -1095,7 +1095,7 @@ intel_dp_link_down(struct intel_output *intel_output, uint32_t DP)
1095 1095
1096 udelay(17000); 1096 udelay(17000);
1097 1097
1098 if (IS_eDP(intel_output)) 1098 if (IS_eDP(intel_encoder))
1099 DP |= DP_LINK_TRAIN_OFF; 1099 DP |= DP_LINK_TRAIN_OFF;
1100 I915_WRITE(dp_priv->output_reg, DP & ~DP_PORT_EN); 1100 I915_WRITE(dp_priv->output_reg, DP & ~DP_PORT_EN);
1101 POSTING_READ(dp_priv->output_reg); 1101 POSTING_READ(dp_priv->output_reg);
@@ -1104,13 +1104,13 @@ intel_dp_link_down(struct intel_output *intel_output, uint32_t DP)
1104static void 1104static void
1105intel_dp_restore(struct drm_connector *connector) 1105intel_dp_restore(struct drm_connector *connector)
1106{ 1106{
1107 struct intel_output *intel_output = to_intel_output(connector); 1107 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1108 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 1108 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
1109 1109
1110 if (dp_priv->save_DP & DP_PORT_EN) 1110 if (dp_priv->save_DP & DP_PORT_EN)
1111 intel_dp_link_train(intel_output, dp_priv->save_DP, dp_priv->save_link_configuration); 1111 intel_dp_link_train(intel_encoder, dp_priv->save_DP, dp_priv->save_link_configuration);
1112 else 1112 else
1113 intel_dp_link_down(intel_output, dp_priv->save_DP); 1113 intel_dp_link_down(intel_encoder, dp_priv->save_DP);
1114} 1114}
1115 1115
1116/* 1116/*
@@ -1123,32 +1123,32 @@ intel_dp_restore(struct drm_connector *connector)
1123 */ 1123 */
1124 1124
1125static void 1125static void
1126intel_dp_check_link_status(struct intel_output *intel_output) 1126intel_dp_check_link_status(struct intel_encoder *intel_encoder)
1127{ 1127{
1128 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 1128 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
1129 uint8_t link_status[DP_LINK_STATUS_SIZE]; 1129 uint8_t link_status[DP_LINK_STATUS_SIZE];
1130 1130
1131 if (!intel_output->enc.crtc) 1131 if (!intel_encoder->enc.crtc)
1132 return; 1132 return;
1133 1133
1134 if (!intel_dp_get_link_status(intel_output, link_status)) { 1134 if (!intel_dp_get_link_status(intel_encoder, link_status)) {
1135 intel_dp_link_down(intel_output, dp_priv->DP); 1135 intel_dp_link_down(intel_encoder, dp_priv->DP);
1136 return; 1136 return;
1137 } 1137 }
1138 1138
1139 if (!intel_channel_eq_ok(link_status, dp_priv->lane_count)) 1139 if (!intel_channel_eq_ok(link_status, dp_priv->lane_count))
1140 intel_dp_link_train(intel_output, dp_priv->DP, dp_priv->link_configuration); 1140 intel_dp_link_train(intel_encoder, dp_priv->DP, dp_priv->link_configuration);
1141} 1141}
1142 1142
1143static enum drm_connector_status 1143static enum drm_connector_status
1144ironlake_dp_detect(struct drm_connector *connector) 1144ironlake_dp_detect(struct drm_connector *connector)
1145{ 1145{
1146 struct intel_output *intel_output = to_intel_output(connector); 1146 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1147 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 1147 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
1148 enum drm_connector_status status; 1148 enum drm_connector_status status;
1149 1149
1150 status = connector_status_disconnected; 1150 status = connector_status_disconnected;
1151 if (intel_dp_aux_native_read(intel_output, 1151 if (intel_dp_aux_native_read(intel_encoder,
1152 0x000, dp_priv->dpcd, 1152 0x000, dp_priv->dpcd,
1153 sizeof (dp_priv->dpcd)) == sizeof (dp_priv->dpcd)) 1153 sizeof (dp_priv->dpcd)) == sizeof (dp_priv->dpcd))
1154 { 1154 {
@@ -1167,10 +1167,10 @@ ironlake_dp_detect(struct drm_connector *connector)
1167static enum drm_connector_status 1167static enum drm_connector_status
1168intel_dp_detect(struct drm_connector *connector) 1168intel_dp_detect(struct drm_connector *connector)
1169{ 1169{
1170 struct intel_output *intel_output = to_intel_output(connector); 1170 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1171 struct drm_device *dev = intel_output->base.dev; 1171 struct drm_device *dev = intel_encoder->base.dev;
1172 struct drm_i915_private *dev_priv = dev->dev_private; 1172 struct drm_i915_private *dev_priv = dev->dev_private;
1173 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 1173 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
1174 uint32_t temp, bit; 1174 uint32_t temp, bit;
1175 enum drm_connector_status status; 1175 enum drm_connector_status status;
1176 1176
@@ -1209,7 +1209,7 @@ intel_dp_detect(struct drm_connector *connector)
1209 return connector_status_disconnected; 1209 return connector_status_disconnected;
1210 1210
1211 status = connector_status_disconnected; 1211 status = connector_status_disconnected;
1212 if (intel_dp_aux_native_read(intel_output, 1212 if (intel_dp_aux_native_read(intel_encoder,
1213 0x000, dp_priv->dpcd, 1213 0x000, dp_priv->dpcd,
1214 sizeof (dp_priv->dpcd)) == sizeof (dp_priv->dpcd)) 1214 sizeof (dp_priv->dpcd)) == sizeof (dp_priv->dpcd))
1215 { 1215 {
@@ -1221,20 +1221,20 @@ intel_dp_detect(struct drm_connector *connector)
1221 1221
1222static int intel_dp_get_modes(struct drm_connector *connector) 1222static int intel_dp_get_modes(struct drm_connector *connector)
1223{ 1223{
1224 struct intel_output *intel_output = to_intel_output(connector); 1224 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1225 struct drm_device *dev = intel_output->base.dev; 1225 struct drm_device *dev = intel_encoder->base.dev;
1226 struct drm_i915_private *dev_priv = dev->dev_private; 1226 struct drm_i915_private *dev_priv = dev->dev_private;
1227 int ret; 1227 int ret;
1228 1228
1229 /* We should parse the EDID data and find out if it has an audio sink 1229 /* We should parse the EDID data and find out if it has an audio sink
1230 */ 1230 */
1231 1231
1232 ret = intel_ddc_get_modes(intel_output); 1232 ret = intel_ddc_get_modes(intel_encoder);
1233 if (ret) 1233 if (ret)
1234 return ret; 1234 return ret;
1235 1235
1236 /* if eDP has no EDID, try to use fixed panel mode from VBT */ 1236 /* if eDP has no EDID, try to use fixed panel mode from VBT */
1237 if (IS_eDP(intel_output)) { 1237 if (IS_eDP(intel_encoder)) {
1238 if (dev_priv->panel_fixed_mode != NULL) { 1238 if (dev_priv->panel_fixed_mode != NULL) {
1239 struct drm_display_mode *mode; 1239 struct drm_display_mode *mode;
1240 mode = drm_mode_duplicate(dev, dev_priv->panel_fixed_mode); 1240 mode = drm_mode_duplicate(dev, dev_priv->panel_fixed_mode);
@@ -1248,13 +1248,13 @@ static int intel_dp_get_modes(struct drm_connector *connector)
1248static void 1248static void
1249intel_dp_destroy (struct drm_connector *connector) 1249intel_dp_destroy (struct drm_connector *connector)
1250{ 1250{
1251 struct intel_output *intel_output = to_intel_output(connector); 1251 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1252 1252
1253 if (intel_output->i2c_bus) 1253 if (intel_encoder->i2c_bus)
1254 intel_i2c_destroy(intel_output->i2c_bus); 1254 intel_i2c_destroy(intel_encoder->i2c_bus);
1255 drm_sysfs_connector_remove(connector); 1255 drm_sysfs_connector_remove(connector);
1256 drm_connector_cleanup(connector); 1256 drm_connector_cleanup(connector);
1257 kfree(intel_output); 1257 kfree(intel_encoder);
1258} 1258}
1259 1259
1260static const struct drm_encoder_helper_funcs intel_dp_helper_funcs = { 1260static const struct drm_encoder_helper_funcs intel_dp_helper_funcs = {
@@ -1290,12 +1290,12 @@ static const struct drm_encoder_funcs intel_dp_enc_funcs = {
1290}; 1290};
1291 1291
1292void 1292void
1293intel_dp_hot_plug(struct intel_output *intel_output) 1293intel_dp_hot_plug(struct intel_encoder *intel_encoder)
1294{ 1294{
1295 struct intel_dp_priv *dp_priv = intel_output->dev_priv; 1295 struct intel_dp_priv *dp_priv = intel_encoder->dev_priv;
1296 1296
1297 if (dp_priv->dpms_mode == DRM_MODE_DPMS_ON) 1297 if (dp_priv->dpms_mode == DRM_MODE_DPMS_ON)
1298 intel_dp_check_link_status(intel_output); 1298 intel_dp_check_link_status(intel_encoder);
1299} 1299}
1300 1300
1301void 1301void
@@ -1303,53 +1303,53 @@ intel_dp_init(struct drm_device *dev, int output_reg)
1303{ 1303{
1304 struct drm_i915_private *dev_priv = dev->dev_private; 1304 struct drm_i915_private *dev_priv = dev->dev_private;
1305 struct drm_connector *connector; 1305 struct drm_connector *connector;
1306 struct intel_output *intel_output; 1306 struct intel_encoder *intel_encoder;
1307 struct intel_dp_priv *dp_priv; 1307 struct intel_dp_priv *dp_priv;
1308 const char *name = NULL; 1308 const char *name = NULL;
1309 1309
1310 intel_output = kcalloc(sizeof(struct intel_output) + 1310 intel_encoder = kcalloc(sizeof(struct intel_encoder) +
1311 sizeof(struct intel_dp_priv), 1, GFP_KERNEL); 1311 sizeof(struct intel_dp_priv), 1, GFP_KERNEL);
1312 if (!intel_output) 1312 if (!intel_encoder)
1313 return; 1313 return;
1314 1314
1315 dp_priv = (struct intel_dp_priv *)(intel_output + 1); 1315 dp_priv = (struct intel_dp_priv *)(intel_encoder + 1);
1316 1316
1317 connector = &intel_output->base; 1317 connector = &intel_encoder->base;
1318 drm_connector_init(dev, connector, &intel_dp_connector_funcs, 1318 drm_connector_init(dev, connector, &intel_dp_connector_funcs,
1319 DRM_MODE_CONNECTOR_DisplayPort); 1319 DRM_MODE_CONNECTOR_DisplayPort);
1320 drm_connector_helper_add(connector, &intel_dp_connector_helper_funcs); 1320 drm_connector_helper_add(connector, &intel_dp_connector_helper_funcs);
1321 1321
1322 if (output_reg == DP_A) 1322 if (output_reg == DP_A)
1323 intel_output->type = INTEL_OUTPUT_EDP; 1323 intel_encoder->type = INTEL_OUTPUT_EDP;
1324 else 1324 else
1325 intel_output->type = INTEL_OUTPUT_DISPLAYPORT; 1325 intel_encoder->type = INTEL_OUTPUT_DISPLAYPORT;
1326 1326
1327 if (output_reg == DP_B || output_reg == PCH_DP_B) 1327 if (output_reg == DP_B || output_reg == PCH_DP_B)
1328 intel_output->clone_mask = (1 << INTEL_DP_B_CLONE_BIT); 1328 intel_encoder->clone_mask = (1 << INTEL_DP_B_CLONE_BIT);
1329 else if (output_reg == DP_C || output_reg == PCH_DP_C) 1329 else if (output_reg == DP_C || output_reg == PCH_DP_C)
1330 intel_output->clone_mask = (1 << INTEL_DP_C_CLONE_BIT); 1330 intel_encoder->clone_mask = (1 << INTEL_DP_C_CLONE_BIT);
1331 else if (output_reg == DP_D || output_reg == PCH_DP_D) 1331 else if (output_reg == DP_D || output_reg == PCH_DP_D)
1332 intel_output->clone_mask = (1 << INTEL_DP_D_CLONE_BIT); 1332 intel_encoder->clone_mask = (1 << INTEL_DP_D_CLONE_BIT);
1333 1333
1334 if (IS_eDP(intel_output)) 1334 if (IS_eDP(intel_encoder))
1335 intel_output->clone_mask = (1 << INTEL_EDP_CLONE_BIT); 1335 intel_encoder->clone_mask = (1 << INTEL_EDP_CLONE_BIT);
1336 1336
1337 intel_output->crtc_mask = (1 << 0) | (1 << 1); 1337 intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
1338 connector->interlace_allowed = true; 1338 connector->interlace_allowed = true;
1339 connector->doublescan_allowed = 0; 1339 connector->doublescan_allowed = 0;
1340 1340
1341 dp_priv->intel_output = intel_output; 1341 dp_priv->intel_encoder = intel_encoder;
1342 dp_priv->output_reg = output_reg; 1342 dp_priv->output_reg = output_reg;
1343 dp_priv->has_audio = false; 1343 dp_priv->has_audio = false;
1344 dp_priv->dpms_mode = DRM_MODE_DPMS_ON; 1344 dp_priv->dpms_mode = DRM_MODE_DPMS_ON;
1345 intel_output->dev_priv = dp_priv; 1345 intel_encoder->dev_priv = dp_priv;
1346 1346
1347 drm_encoder_init(dev, &intel_output->enc, &intel_dp_enc_funcs, 1347 drm_encoder_init(dev, &intel_encoder->enc, &intel_dp_enc_funcs,
1348 DRM_MODE_ENCODER_TMDS); 1348 DRM_MODE_ENCODER_TMDS);
1349 drm_encoder_helper_add(&intel_output->enc, &intel_dp_helper_funcs); 1349 drm_encoder_helper_add(&intel_encoder->enc, &intel_dp_helper_funcs);
1350 1350
1351 drm_mode_connector_attach_encoder(&intel_output->base, 1351 drm_mode_connector_attach_encoder(&intel_encoder->base,
1352 &intel_output->enc); 1352 &intel_encoder->enc);
1353 drm_sysfs_connector_add(connector); 1353 drm_sysfs_connector_add(connector);
1354 1354
1355 /* Set up the DDC bus. */ 1355 /* Set up the DDC bus. */
@@ -1377,10 +1377,10 @@ intel_dp_init(struct drm_device *dev, int output_reg)
1377 break; 1377 break;
1378 } 1378 }
1379 1379
1380 intel_dp_i2c_init(intel_output, name); 1380 intel_dp_i2c_init(intel_encoder, name);
1381 1381
1382 intel_output->ddc_bus = &dp_priv->adapter; 1382 intel_encoder->ddc_bus = &dp_priv->adapter;
1383 intel_output->hot_plug = intel_dp_hot_plug; 1383 intel_encoder->hot_plug = intel_dp_hot_plug;
1384 1384
1385 if (output_reg == DP_A) { 1385 if (output_reg == DP_A) {
1386 /* initialize panel mode from VBT if available for eDP */ 1386 /* initialize panel mode from VBT if available for eDP */
diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h
index 3a467ca57857..e30253755f12 100644
--- a/drivers/gpu/drm/i915/intel_drv.h
+++ b/drivers/gpu/drm/i915/intel_drv.h
@@ -95,7 +95,7 @@ struct intel_framebuffer {
95}; 95};
96 96
97 97
98struct intel_output { 98struct intel_encoder {
99 struct drm_connector base; 99 struct drm_connector base;
100 100
101 struct drm_encoder enc; 101 struct drm_encoder enc;
@@ -105,7 +105,7 @@ struct intel_output {
105 bool load_detect_temp; 105 bool load_detect_temp;
106 bool needs_tv_clock; 106 bool needs_tv_clock;
107 void *dev_priv; 107 void *dev_priv;
108 void (*hot_plug)(struct intel_output *); 108 void (*hot_plug)(struct intel_encoder *);
109 int crtc_mask; 109 int crtc_mask;
110 int clone_mask; 110 int clone_mask;
111}; 111};
@@ -152,15 +152,15 @@ struct intel_crtc {
152}; 152};
153 153
154#define to_intel_crtc(x) container_of(x, struct intel_crtc, base) 154#define to_intel_crtc(x) container_of(x, struct intel_crtc, base)
155#define to_intel_output(x) container_of(x, struct intel_output, base) 155#define to_intel_encoder(x) container_of(x, struct intel_encoder, base)
156#define enc_to_intel_output(x) container_of(x, struct intel_output, enc) 156#define enc_to_intel_encoder(x) container_of(x, struct intel_encoder, enc)
157#define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base) 157#define to_intel_framebuffer(x) container_of(x, struct intel_framebuffer, base)
158 158
159struct i2c_adapter *intel_i2c_create(struct drm_device *dev, const u32 reg, 159struct i2c_adapter *intel_i2c_create(struct drm_device *dev, const u32 reg,
160 const char *name); 160 const char *name);
161void intel_i2c_destroy(struct i2c_adapter *adapter); 161void intel_i2c_destroy(struct i2c_adapter *adapter);
162int intel_ddc_get_modes(struct intel_output *intel_output); 162int intel_ddc_get_modes(struct intel_encoder *intel_encoder);
163extern bool intel_ddc_probe(struct intel_output *intel_output); 163extern bool intel_ddc_probe(struct intel_encoder *intel_encoder);
164void intel_i2c_quirk_set(struct drm_device *dev, bool enable); 164void intel_i2c_quirk_set(struct drm_device *dev, bool enable);
165void intel_i2c_reset_gmbus(struct drm_device *dev); 165void intel_i2c_reset_gmbus(struct drm_device *dev);
166 166
@@ -175,7 +175,7 @@ extern void intel_dp_init(struct drm_device *dev, int dp_reg);
175void 175void
176intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode, 176intel_dp_set_m_n(struct drm_crtc *crtc, struct drm_display_mode *mode,
177 struct drm_display_mode *adjusted_mode); 177 struct drm_display_mode *adjusted_mode);
178extern void intel_edp_link_config (struct intel_output *, int *, int *); 178extern void intel_edp_link_config (struct intel_encoder *, int *, int *);
179 179
180 180
181extern int intel_panel_fitter_pipe (struct drm_device *dev); 181extern int intel_panel_fitter_pipe (struct drm_device *dev);
@@ -191,10 +191,10 @@ int intel_get_pipe_from_crtc_id(struct drm_device *dev, void *data,
191 struct drm_file *file_priv); 191 struct drm_file *file_priv);
192extern void intel_wait_for_vblank(struct drm_device *dev); 192extern void intel_wait_for_vblank(struct drm_device *dev);
193extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe); 193extern struct drm_crtc *intel_get_crtc_from_pipe(struct drm_device *dev, int pipe);
194extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_output *intel_output, 194extern struct drm_crtc *intel_get_load_detect_pipe(struct intel_encoder *intel_encoder,
195 struct drm_display_mode *mode, 195 struct drm_display_mode *mode,
196 int *dpms_mode); 196 int *dpms_mode);
197extern void intel_release_load_detect_pipe(struct intel_output *intel_output, 197extern void intel_release_load_detect_pipe(struct intel_encoder *intel_encoder,
198 int dpms_mode); 198 int dpms_mode);
199 199
200extern struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB); 200extern struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB);
diff --git a/drivers/gpu/drm/i915/intel_dvo.c b/drivers/gpu/drm/i915/intel_dvo.c
index a4d2606de778..62282f34eba9 100644
--- a/drivers/gpu/drm/i915/intel_dvo.c
+++ b/drivers/gpu/drm/i915/intel_dvo.c
@@ -79,8 +79,8 @@ static struct intel_dvo_device intel_dvo_devices[] = {
79static void intel_dvo_dpms(struct drm_encoder *encoder, int mode) 79static void intel_dvo_dpms(struct drm_encoder *encoder, int mode)
80{ 80{
81 struct drm_i915_private *dev_priv = encoder->dev->dev_private; 81 struct drm_i915_private *dev_priv = encoder->dev->dev_private;
82 struct intel_output *intel_output = enc_to_intel_output(encoder); 82 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
83 struct intel_dvo_device *dvo = intel_output->dev_priv; 83 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
84 u32 dvo_reg = dvo->dvo_reg; 84 u32 dvo_reg = dvo->dvo_reg;
85 u32 temp = I915_READ(dvo_reg); 85 u32 temp = I915_READ(dvo_reg);
86 86
@@ -98,8 +98,8 @@ static void intel_dvo_dpms(struct drm_encoder *encoder, int mode)
98static void intel_dvo_save(struct drm_connector *connector) 98static void intel_dvo_save(struct drm_connector *connector)
99{ 99{
100 struct drm_i915_private *dev_priv = connector->dev->dev_private; 100 struct drm_i915_private *dev_priv = connector->dev->dev_private;
101 struct intel_output *intel_output = to_intel_output(connector); 101 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
102 struct intel_dvo_device *dvo = intel_output->dev_priv; 102 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
103 103
104 /* Each output should probably just save the registers it touches, 104 /* Each output should probably just save the registers it touches,
105 * but for now, use more overkill. 105 * but for now, use more overkill.
@@ -114,8 +114,8 @@ static void intel_dvo_save(struct drm_connector *connector)
114static void intel_dvo_restore(struct drm_connector *connector) 114static void intel_dvo_restore(struct drm_connector *connector)
115{ 115{
116 struct drm_i915_private *dev_priv = connector->dev->dev_private; 116 struct drm_i915_private *dev_priv = connector->dev->dev_private;
117 struct intel_output *intel_output = to_intel_output(connector); 117 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
118 struct intel_dvo_device *dvo = intel_output->dev_priv; 118 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
119 119
120 dvo->dev_ops->restore(dvo); 120 dvo->dev_ops->restore(dvo);
121 121
@@ -127,8 +127,8 @@ static void intel_dvo_restore(struct drm_connector *connector)
127static int intel_dvo_mode_valid(struct drm_connector *connector, 127static int intel_dvo_mode_valid(struct drm_connector *connector,
128 struct drm_display_mode *mode) 128 struct drm_display_mode *mode)
129{ 129{
130 struct intel_output *intel_output = to_intel_output(connector); 130 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
131 struct intel_dvo_device *dvo = intel_output->dev_priv; 131 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
132 132
133 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) 133 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
134 return MODE_NO_DBLESCAN; 134 return MODE_NO_DBLESCAN;
@@ -149,8 +149,8 @@ static bool intel_dvo_mode_fixup(struct drm_encoder *encoder,
149 struct drm_display_mode *mode, 149 struct drm_display_mode *mode,
150 struct drm_display_mode *adjusted_mode) 150 struct drm_display_mode *adjusted_mode)
151{ 151{
152 struct intel_output *intel_output = enc_to_intel_output(encoder); 152 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
153 struct intel_dvo_device *dvo = intel_output->dev_priv; 153 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
154 154
155 /* If we have timings from the BIOS for the panel, put them in 155 /* 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, 156 * to the adjusted mode. The CRTC will be set up for this mode,
@@ -185,8 +185,8 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder,
185 struct drm_device *dev = encoder->dev; 185 struct drm_device *dev = encoder->dev;
186 struct drm_i915_private *dev_priv = dev->dev_private; 186 struct drm_i915_private *dev_priv = dev->dev_private;
187 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); 187 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
188 struct intel_output *intel_output = enc_to_intel_output(encoder); 188 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
189 struct intel_dvo_device *dvo = intel_output->dev_priv; 189 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
190 int pipe = intel_crtc->pipe; 190 int pipe = intel_crtc->pipe;
191 u32 dvo_val; 191 u32 dvo_val;
192 u32 dvo_reg = dvo->dvo_reg, dvo_srcdim_reg; 192 u32 dvo_reg = dvo->dvo_reg, dvo_srcdim_reg;
@@ -240,23 +240,23 @@ static void intel_dvo_mode_set(struct drm_encoder *encoder,
240 */ 240 */
241static enum drm_connector_status intel_dvo_detect(struct drm_connector *connector) 241static enum drm_connector_status intel_dvo_detect(struct drm_connector *connector)
242{ 242{
243 struct intel_output *intel_output = to_intel_output(connector); 243 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
244 struct intel_dvo_device *dvo = intel_output->dev_priv; 244 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
245 245
246 return dvo->dev_ops->detect(dvo); 246 return dvo->dev_ops->detect(dvo);
247} 247}
248 248
249static int intel_dvo_get_modes(struct drm_connector *connector) 249static int intel_dvo_get_modes(struct drm_connector *connector)
250{ 250{
251 struct intel_output *intel_output = to_intel_output(connector); 251 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
252 struct intel_dvo_device *dvo = intel_output->dev_priv; 252 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
253 253
254 /* We should probably have an i2c driver get_modes function for those 254 /* 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 255 * 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, 256 * (TV-out, for example), but for now with just TMDS and LVDS,
257 * that's not the case. 257 * that's not the case.
258 */ 258 */
259 intel_ddc_get_modes(intel_output); 259 intel_ddc_get_modes(intel_encoder);
260 if (!list_empty(&connector->probed_modes)) 260 if (!list_empty(&connector->probed_modes))
261 return 1; 261 return 1;
262 262
@@ -274,8 +274,8 @@ static int intel_dvo_get_modes(struct drm_connector *connector)
274 274
275static void intel_dvo_destroy (struct drm_connector *connector) 275static void intel_dvo_destroy (struct drm_connector *connector)
276{ 276{
277 struct intel_output *intel_output = to_intel_output(connector); 277 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
278 struct intel_dvo_device *dvo = intel_output->dev_priv; 278 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
279 279
280 if (dvo) { 280 if (dvo) {
281 if (dvo->dev_ops->destroy) 281 if (dvo->dev_ops->destroy)
@@ -285,13 +285,13 @@ static void intel_dvo_destroy (struct drm_connector *connector)
285 /* no need, in i830_dvoices[] now */ 285 /* no need, in i830_dvoices[] now */
286 //kfree(dvo); 286 //kfree(dvo);
287 } 287 }
288 if (intel_output->i2c_bus) 288 if (intel_encoder->i2c_bus)
289 intel_i2c_destroy(intel_output->i2c_bus); 289 intel_i2c_destroy(intel_encoder->i2c_bus);
290 if (intel_output->ddc_bus) 290 if (intel_encoder->ddc_bus)
291 intel_i2c_destroy(intel_output->ddc_bus); 291 intel_i2c_destroy(intel_encoder->ddc_bus);
292 drm_sysfs_connector_remove(connector); 292 drm_sysfs_connector_remove(connector);
293 drm_connector_cleanup(connector); 293 drm_connector_cleanup(connector);
294 kfree(intel_output); 294 kfree(intel_encoder);
295} 295}
296 296
297#ifdef RANDR_GET_CRTC_INTERFACE 297#ifdef RANDR_GET_CRTC_INTERFACE
@@ -299,8 +299,8 @@ static struct drm_crtc *intel_dvo_get_crtc(struct drm_connector *connector)
299{ 299{
300 struct drm_device *dev = connector->dev; 300 struct drm_device *dev = connector->dev;
301 struct drm_i915_private *dev_priv = dev->dev_private; 301 struct drm_i915_private *dev_priv = dev->dev_private;
302 struct intel_output *intel_output = to_intel_output(connector); 302 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
303 struct intel_dvo_device *dvo = intel_output->dev_priv; 303 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
304 int pipe = !!(I915_READ(dvo->dvo_reg) & SDVO_PIPE_B_SELECT); 304 int pipe = !!(I915_READ(dvo->dvo_reg) & SDVO_PIPE_B_SELECT);
305 305
306 return intel_pipe_to_crtc(pScrn, pipe); 306 return intel_pipe_to_crtc(pScrn, pipe);
@@ -351,8 +351,8 @@ intel_dvo_get_current_mode (struct drm_connector *connector)
351{ 351{
352 struct drm_device *dev = connector->dev; 352 struct drm_device *dev = connector->dev;
353 struct drm_i915_private *dev_priv = dev->dev_private; 353 struct drm_i915_private *dev_priv = dev->dev_private;
354 struct intel_output *intel_output = to_intel_output(connector); 354 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
355 struct intel_dvo_device *dvo = intel_output->dev_priv; 355 struct intel_dvo_device *dvo = intel_encoder->dev_priv;
356 uint32_t dvo_reg = dvo->dvo_reg; 356 uint32_t dvo_reg = dvo->dvo_reg;
357 uint32_t dvo_val = I915_READ(dvo_reg); 357 uint32_t dvo_val = I915_READ(dvo_reg);
358 struct drm_display_mode *mode = NULL; 358 struct drm_display_mode *mode = NULL;
@@ -382,24 +382,24 @@ intel_dvo_get_current_mode (struct drm_connector *connector)
382 382
383void intel_dvo_init(struct drm_device *dev) 383void intel_dvo_init(struct drm_device *dev)
384{ 384{
385 struct intel_output *intel_output; 385 struct intel_encoder *intel_encoder;
386 struct intel_dvo_device *dvo; 386 struct intel_dvo_device *dvo;
387 struct i2c_adapter *i2cbus = NULL; 387 struct i2c_adapter *i2cbus = NULL;
388 int ret = 0; 388 int ret = 0;
389 int i; 389 int i;
390 int encoder_type = DRM_MODE_ENCODER_NONE; 390 int encoder_type = DRM_MODE_ENCODER_NONE;
391 intel_output = kzalloc (sizeof(struct intel_output), GFP_KERNEL); 391 intel_encoder = kzalloc (sizeof(struct intel_encoder), GFP_KERNEL);
392 if (!intel_output) 392 if (!intel_encoder)
393 return; 393 return;
394 394
395 /* Set up the DDC bus */ 395 /* Set up the DDC bus */
396 intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "DVODDC_D"); 396 intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOD, "DVODDC_D");
397 if (!intel_output->ddc_bus) 397 if (!intel_encoder->ddc_bus)
398 goto free_intel; 398 goto free_intel;
399 399
400 /* Now, try to find a controller */ 400 /* Now, try to find a controller */
401 for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) { 401 for (i = 0; i < ARRAY_SIZE(intel_dvo_devices); i++) {
402 struct drm_connector *connector = &intel_output->base; 402 struct drm_connector *connector = &intel_encoder->base;
403 int gpio; 403 int gpio;
404 404
405 dvo = &intel_dvo_devices[i]; 405 dvo = &intel_dvo_devices[i];
@@ -434,11 +434,11 @@ void intel_dvo_init(struct drm_device *dev)
434 if (!ret) 434 if (!ret)
435 continue; 435 continue;
436 436
437 intel_output->type = INTEL_OUTPUT_DVO; 437 intel_encoder->type = INTEL_OUTPUT_DVO;
438 intel_output->crtc_mask = (1 << 0) | (1 << 1); 438 intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
439 switch (dvo->type) { 439 switch (dvo->type) {
440 case INTEL_DVO_CHIP_TMDS: 440 case INTEL_DVO_CHIP_TMDS:
441 intel_output->clone_mask = 441 intel_encoder->clone_mask =
442 (1 << INTEL_DVO_TMDS_CLONE_BIT) | 442 (1 << INTEL_DVO_TMDS_CLONE_BIT) |
443 (1 << INTEL_ANALOG_CLONE_BIT); 443 (1 << INTEL_ANALOG_CLONE_BIT);
444 drm_connector_init(dev, connector, 444 drm_connector_init(dev, connector,
@@ -447,7 +447,7 @@ void intel_dvo_init(struct drm_device *dev)
447 encoder_type = DRM_MODE_ENCODER_TMDS; 447 encoder_type = DRM_MODE_ENCODER_TMDS;
448 break; 448 break;
449 case INTEL_DVO_CHIP_LVDS: 449 case INTEL_DVO_CHIP_LVDS:
450 intel_output->clone_mask = 450 intel_encoder->clone_mask =
451 (1 << INTEL_DVO_LVDS_CLONE_BIT); 451 (1 << INTEL_DVO_LVDS_CLONE_BIT);
452 drm_connector_init(dev, connector, 452 drm_connector_init(dev, connector,
453 &intel_dvo_connector_funcs, 453 &intel_dvo_connector_funcs,
@@ -462,16 +462,16 @@ void intel_dvo_init(struct drm_device *dev)
462 connector->interlace_allowed = false; 462 connector->interlace_allowed = false;
463 connector->doublescan_allowed = false; 463 connector->doublescan_allowed = false;
464 464
465 intel_output->dev_priv = dvo; 465 intel_encoder->dev_priv = dvo;
466 intel_output->i2c_bus = i2cbus; 466 intel_encoder->i2c_bus = i2cbus;
467 467
468 drm_encoder_init(dev, &intel_output->enc, 468 drm_encoder_init(dev, &intel_encoder->enc,
469 &intel_dvo_enc_funcs, encoder_type); 469 &intel_dvo_enc_funcs, encoder_type);
470 drm_encoder_helper_add(&intel_output->enc, 470 drm_encoder_helper_add(&intel_encoder->enc,
471 &intel_dvo_helper_funcs); 471 &intel_dvo_helper_funcs);
472 472
473 drm_mode_connector_attach_encoder(&intel_output->base, 473 drm_mode_connector_attach_encoder(&intel_encoder->base,
474 &intel_output->enc); 474 &intel_encoder->enc);
475 if (dvo->type == INTEL_DVO_CHIP_LVDS) { 475 if (dvo->type == INTEL_DVO_CHIP_LVDS) {
476 /* For our LVDS chipsets, we should hopefully be able 476 /* For our LVDS chipsets, we should hopefully be able
477 * to dig the fixed panel mode out of the BIOS data. 477 * to dig the fixed panel mode out of the BIOS data.
@@ -489,10 +489,10 @@ void intel_dvo_init(struct drm_device *dev)
489 return; 489 return;
490 } 490 }
491 491
492 intel_i2c_destroy(intel_output->ddc_bus); 492 intel_i2c_destroy(intel_encoder->ddc_bus);
493 /* Didn't find a chip, so tear down. */ 493 /* Didn't find a chip, so tear down. */
494 if (i2cbus != NULL) 494 if (i2cbus != NULL)
495 intel_i2c_destroy(i2cbus); 495 intel_i2c_destroy(i2cbus);
496free_intel: 496free_intel:
497 kfree(intel_output); 497 kfree(intel_encoder);
498} 498}
diff --git a/drivers/gpu/drm/i915/intel_hdmi.c b/drivers/gpu/drm/i915/intel_hdmi.c
index a30f8bfc1985..9777504afeb2 100644
--- a/drivers/gpu/drm/i915/intel_hdmi.c
+++ b/drivers/gpu/drm/i915/intel_hdmi.c
@@ -50,8 +50,8 @@ static void intel_hdmi_mode_set(struct drm_encoder *encoder,
50 struct drm_i915_private *dev_priv = dev->dev_private; 50 struct drm_i915_private *dev_priv = dev->dev_private;
51 struct drm_crtc *crtc = encoder->crtc; 51 struct drm_crtc *crtc = encoder->crtc;
52 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 52 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
53 struct intel_output *intel_output = enc_to_intel_output(encoder); 53 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
54 struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; 54 struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
55 u32 sdvox; 55 u32 sdvox;
56 56
57 sdvox = SDVO_ENCODING_HDMI | 57 sdvox = SDVO_ENCODING_HDMI |
@@ -73,8 +73,8 @@ static void intel_hdmi_dpms(struct drm_encoder *encoder, int mode)
73{ 73{
74 struct drm_device *dev = encoder->dev; 74 struct drm_device *dev = encoder->dev;
75 struct drm_i915_private *dev_priv = dev->dev_private; 75 struct drm_i915_private *dev_priv = dev->dev_private;
76 struct intel_output *intel_output = enc_to_intel_output(encoder); 76 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
77 struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; 77 struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
78 u32 temp; 78 u32 temp;
79 79
80 temp = I915_READ(hdmi_priv->sdvox_reg); 80 temp = I915_READ(hdmi_priv->sdvox_reg);
@@ -109,8 +109,8 @@ static void intel_hdmi_save(struct drm_connector *connector)
109{ 109{
110 struct drm_device *dev = connector->dev; 110 struct drm_device *dev = connector->dev;
111 struct drm_i915_private *dev_priv = dev->dev_private; 111 struct drm_i915_private *dev_priv = dev->dev_private;
112 struct intel_output *intel_output = to_intel_output(connector); 112 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
113 struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; 113 struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
114 114
115 hdmi_priv->save_SDVOX = I915_READ(hdmi_priv->sdvox_reg); 115 hdmi_priv->save_SDVOX = I915_READ(hdmi_priv->sdvox_reg);
116} 116}
@@ -119,8 +119,8 @@ static void intel_hdmi_restore(struct drm_connector *connector)
119{ 119{
120 struct drm_device *dev = connector->dev; 120 struct drm_device *dev = connector->dev;
121 struct drm_i915_private *dev_priv = dev->dev_private; 121 struct drm_i915_private *dev_priv = dev->dev_private;
122 struct intel_output *intel_output = to_intel_output(connector); 122 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
123 struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; 123 struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
124 124
125 I915_WRITE(hdmi_priv->sdvox_reg, hdmi_priv->save_SDVOX); 125 I915_WRITE(hdmi_priv->sdvox_reg, hdmi_priv->save_SDVOX);
126 POSTING_READ(hdmi_priv->sdvox_reg); 126 POSTING_READ(hdmi_priv->sdvox_reg);
@@ -150,21 +150,21 @@ static bool intel_hdmi_mode_fixup(struct drm_encoder *encoder,
150static enum drm_connector_status 150static enum drm_connector_status
151intel_hdmi_detect(struct drm_connector *connector) 151intel_hdmi_detect(struct drm_connector *connector)
152{ 152{
153 struct intel_output *intel_output = to_intel_output(connector); 153 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
154 struct intel_hdmi_priv *hdmi_priv = intel_output->dev_priv; 154 struct intel_hdmi_priv *hdmi_priv = intel_encoder->dev_priv;
155 struct edid *edid = NULL; 155 struct edid *edid = NULL;
156 enum drm_connector_status status = connector_status_disconnected; 156 enum drm_connector_status status = connector_status_disconnected;
157 157
158 hdmi_priv->has_hdmi_sink = false; 158 hdmi_priv->has_hdmi_sink = false;
159 edid = drm_get_edid(&intel_output->base, 159 edid = drm_get_edid(&intel_encoder->base,
160 intel_output->ddc_bus); 160 intel_encoder->ddc_bus);
161 161
162 if (edid) { 162 if (edid) {
163 if (edid->input & DRM_EDID_INPUT_DIGITAL) { 163 if (edid->input & DRM_EDID_INPUT_DIGITAL) {
164 status = connector_status_connected; 164 status = connector_status_connected;
165 hdmi_priv->has_hdmi_sink = drm_detect_hdmi_monitor(edid); 165 hdmi_priv->has_hdmi_sink = drm_detect_hdmi_monitor(edid);
166 } 166 }
167 intel_output->base.display_info.raw_edid = NULL; 167 intel_encoder->base.display_info.raw_edid = NULL;
168 kfree(edid); 168 kfree(edid);
169 } 169 }
170 170
@@ -173,24 +173,24 @@ intel_hdmi_detect(struct drm_connector *connector)
173 173
174static int intel_hdmi_get_modes(struct drm_connector *connector) 174static int intel_hdmi_get_modes(struct drm_connector *connector)
175{ 175{
176 struct intel_output *intel_output = to_intel_output(connector); 176 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
177 177
178 /* We should parse the EDID data and find out if it's an HDMI sink so 178 /* We should parse the EDID data and find out if it's an HDMI sink so
179 * we can send audio to it. 179 * we can send audio to it.
180 */ 180 */
181 181
182 return intel_ddc_get_modes(intel_output); 182 return intel_ddc_get_modes(intel_encoder);
183} 183}
184 184
185static void intel_hdmi_destroy(struct drm_connector *connector) 185static void intel_hdmi_destroy(struct drm_connector *connector)
186{ 186{
187 struct intel_output *intel_output = to_intel_output(connector); 187 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
188 188
189 if (intel_output->i2c_bus) 189 if (intel_encoder->i2c_bus)
190 intel_i2c_destroy(intel_output->i2c_bus); 190 intel_i2c_destroy(intel_encoder->i2c_bus);
191 drm_sysfs_connector_remove(connector); 191 drm_sysfs_connector_remove(connector);
192 drm_connector_cleanup(connector); 192 drm_connector_cleanup(connector);
193 kfree(intel_output); 193 kfree(intel_encoder);
194} 194}
195 195
196static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = { 196static const struct drm_encoder_helper_funcs intel_hdmi_helper_funcs = {
@@ -229,63 +229,63 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
229{ 229{
230 struct drm_i915_private *dev_priv = dev->dev_private; 230 struct drm_i915_private *dev_priv = dev->dev_private;
231 struct drm_connector *connector; 231 struct drm_connector *connector;
232 struct intel_output *intel_output; 232 struct intel_encoder *intel_encoder;
233 struct intel_hdmi_priv *hdmi_priv; 233 struct intel_hdmi_priv *hdmi_priv;
234 234
235 intel_output = kcalloc(sizeof(struct intel_output) + 235 intel_encoder = kcalloc(sizeof(struct intel_encoder) +
236 sizeof(struct intel_hdmi_priv), 1, GFP_KERNEL); 236 sizeof(struct intel_hdmi_priv), 1, GFP_KERNEL);
237 if (!intel_output) 237 if (!intel_encoder)
238 return; 238 return;
239 hdmi_priv = (struct intel_hdmi_priv *)(intel_output + 1); 239 hdmi_priv = (struct intel_hdmi_priv *)(intel_encoder + 1);
240 240
241 connector = &intel_output->base; 241 connector = &intel_encoder->base;
242 drm_connector_init(dev, connector, &intel_hdmi_connector_funcs, 242 drm_connector_init(dev, connector, &intel_hdmi_connector_funcs,
243 DRM_MODE_CONNECTOR_HDMIA); 243 DRM_MODE_CONNECTOR_HDMIA);
244 drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs); 244 drm_connector_helper_add(connector, &intel_hdmi_connector_helper_funcs);
245 245
246 intel_output->type = INTEL_OUTPUT_HDMI; 246 intel_encoder->type = INTEL_OUTPUT_HDMI;
247 247
248 connector->interlace_allowed = 0; 248 connector->interlace_allowed = 0;
249 connector->doublescan_allowed = 0; 249 connector->doublescan_allowed = 0;
250 intel_output->crtc_mask = (1 << 0) | (1 << 1); 250 intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
251 251
252 /* Set up the DDC bus. */ 252 /* Set up the DDC bus. */
253 if (sdvox_reg == SDVOB) { 253 if (sdvox_reg == SDVOB) {
254 intel_output->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT); 254 intel_encoder->clone_mask = (1 << INTEL_HDMIB_CLONE_BIT);
255 intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB"); 255 intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOE, "HDMIB");
256 dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; 256 dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
257 } else if (sdvox_reg == SDVOC) { 257 } else if (sdvox_reg == SDVOC) {
258 intel_output->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT); 258 intel_encoder->clone_mask = (1 << INTEL_HDMIC_CLONE_BIT);
259 intel_output->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC"); 259 intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOD, "HDMIC");
260 dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; 260 dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
261 } else if (sdvox_reg == HDMIB) { 261 } else if (sdvox_reg == HDMIB) {
262 intel_output->clone_mask = (1 << INTEL_HDMID_CLONE_BIT); 262 intel_encoder->clone_mask = (1 << INTEL_HDMID_CLONE_BIT);
263 intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOE, 263 intel_encoder->ddc_bus = intel_i2c_create(dev, PCH_GPIOE,
264 "HDMIB"); 264 "HDMIB");
265 dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS; 265 dev_priv->hotplug_supported_mask |= HDMIB_HOTPLUG_INT_STATUS;
266 } else if (sdvox_reg == HDMIC) { 266 } else if (sdvox_reg == HDMIC) {
267 intel_output->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT); 267 intel_encoder->clone_mask = (1 << INTEL_HDMIE_CLONE_BIT);
268 intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOD, 268 intel_encoder->ddc_bus = intel_i2c_create(dev, PCH_GPIOD,
269 "HDMIC"); 269 "HDMIC");
270 dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS; 270 dev_priv->hotplug_supported_mask |= HDMIC_HOTPLUG_INT_STATUS;
271 } else if (sdvox_reg == HDMID) { 271 } else if (sdvox_reg == HDMID) {
272 intel_output->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT); 272 intel_encoder->clone_mask = (1 << INTEL_HDMIF_CLONE_BIT);
273 intel_output->ddc_bus = intel_i2c_create(dev, PCH_GPIOF, 273 intel_encoder->ddc_bus = intel_i2c_create(dev, PCH_GPIOF,
274 "HDMID"); 274 "HDMID");
275 dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS; 275 dev_priv->hotplug_supported_mask |= HDMID_HOTPLUG_INT_STATUS;
276 } 276 }
277 if (!intel_output->ddc_bus) 277 if (!intel_encoder->ddc_bus)
278 goto err_connector; 278 goto err_connector;
279 279
280 hdmi_priv->sdvox_reg = sdvox_reg; 280 hdmi_priv->sdvox_reg = sdvox_reg;
281 intel_output->dev_priv = hdmi_priv; 281 intel_encoder->dev_priv = hdmi_priv;
282 282
283 drm_encoder_init(dev, &intel_output->enc, &intel_hdmi_enc_funcs, 283 drm_encoder_init(dev, &intel_encoder->enc, &intel_hdmi_enc_funcs,
284 DRM_MODE_ENCODER_TMDS); 284 DRM_MODE_ENCODER_TMDS);
285 drm_encoder_helper_add(&intel_output->enc, &intel_hdmi_helper_funcs); 285 drm_encoder_helper_add(&intel_encoder->enc, &intel_hdmi_helper_funcs);
286 286
287 drm_mode_connector_attach_encoder(&intel_output->base, 287 drm_mode_connector_attach_encoder(&intel_encoder->base,
288 &intel_output->enc); 288 &intel_encoder->enc);
289 drm_sysfs_connector_add(connector); 289 drm_sysfs_connector_add(connector);
290 290
291 /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written 291 /* For G4X desktop chip, PEG_BAND_GAP_DATA 3:0 must first be written
@@ -301,7 +301,7 @@ void intel_hdmi_init(struct drm_device *dev, int sdvox_reg)
301 301
302err_connector: 302err_connector:
303 drm_connector_cleanup(connector); 303 drm_connector_cleanup(connector);
304 kfree(intel_output); 304 kfree(intel_encoder);
305 305
306 return; 306 return;
307} 307}
diff --git a/drivers/gpu/drm/i915/intel_lvds.c b/drivers/gpu/drm/i915/intel_lvds.c
index 2b3fa7a3c028..9d99ddca17ef 100644
--- a/drivers/gpu/drm/i915/intel_lvds.c
+++ b/drivers/gpu/drm/i915/intel_lvds.c
@@ -238,8 +238,8 @@ static bool intel_lvds_mode_fixup(struct drm_encoder *encoder,
238 struct drm_i915_private *dev_priv = dev->dev_private; 238 struct drm_i915_private *dev_priv = dev->dev_private;
239 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc); 239 struct intel_crtc *intel_crtc = to_intel_crtc(encoder->crtc);
240 struct drm_encoder *tmp_encoder; 240 struct drm_encoder *tmp_encoder;
241 struct intel_output *intel_output = enc_to_intel_output(encoder); 241 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
242 struct intel_lvds_priv *lvds_priv = intel_output->dev_priv; 242 struct intel_lvds_priv *lvds_priv = intel_encoder->dev_priv;
243 u32 pfit_control = 0, pfit_pgm_ratios = 0; 243 u32 pfit_control = 0, pfit_pgm_ratios = 0;
244 int left_border = 0, right_border = 0, top_border = 0; 244 int left_border = 0, right_border = 0, top_border = 0;
245 int bottom_border = 0; 245 int bottom_border = 0;
@@ -586,8 +586,8 @@ static void intel_lvds_mode_set(struct drm_encoder *encoder,
586{ 586{
587 struct drm_device *dev = encoder->dev; 587 struct drm_device *dev = encoder->dev;
588 struct drm_i915_private *dev_priv = dev->dev_private; 588 struct drm_i915_private *dev_priv = dev->dev_private;
589 struct intel_output *intel_output = enc_to_intel_output(encoder); 589 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
590 struct intel_lvds_priv *lvds_priv = intel_output->dev_priv; 590 struct intel_lvds_priv *lvds_priv = intel_encoder->dev_priv;
591 591
592 /* 592 /*
593 * The LVDS pin pair will already have been turned on in the 593 * The LVDS pin pair will already have been turned on in the
@@ -634,11 +634,11 @@ static enum drm_connector_status intel_lvds_detect(struct drm_connector *connect
634static int intel_lvds_get_modes(struct drm_connector *connector) 634static int intel_lvds_get_modes(struct drm_connector *connector)
635{ 635{
636 struct drm_device *dev = connector->dev; 636 struct drm_device *dev = connector->dev;
637 struct intel_output *intel_output = to_intel_output(connector); 637 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
638 struct drm_i915_private *dev_priv = dev->dev_private; 638 struct drm_i915_private *dev_priv = dev->dev_private;
639 int ret = 0; 639 int ret = 0;
640 640
641 ret = intel_ddc_get_modes(intel_output); 641 ret = intel_ddc_get_modes(intel_encoder);
642 642
643 if (ret) 643 if (ret)
644 return ret; 644 return ret;
@@ -714,11 +714,11 @@ static int intel_lid_notify(struct notifier_block *nb, unsigned long val,
714static void intel_lvds_destroy(struct drm_connector *connector) 714static void intel_lvds_destroy(struct drm_connector *connector)
715{ 715{
716 struct drm_device *dev = connector->dev; 716 struct drm_device *dev = connector->dev;
717 struct intel_output *intel_output = to_intel_output(connector); 717 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
718 struct drm_i915_private *dev_priv = dev->dev_private; 718 struct drm_i915_private *dev_priv = dev->dev_private;
719 719
720 if (intel_output->ddc_bus) 720 if (intel_encoder->ddc_bus)
721 intel_i2c_destroy(intel_output->ddc_bus); 721 intel_i2c_destroy(intel_encoder->ddc_bus);
722 if (dev_priv->lid_notifier.notifier_call) 722 if (dev_priv->lid_notifier.notifier_call)
723 acpi_lid_notifier_unregister(&dev_priv->lid_notifier); 723 acpi_lid_notifier_unregister(&dev_priv->lid_notifier);
724 drm_sysfs_connector_remove(connector); 724 drm_sysfs_connector_remove(connector);
@@ -731,13 +731,13 @@ static int intel_lvds_set_property(struct drm_connector *connector,
731 uint64_t value) 731 uint64_t value)
732{ 732{
733 struct drm_device *dev = connector->dev; 733 struct drm_device *dev = connector->dev;
734 struct intel_output *intel_output = 734 struct intel_encoder *intel_encoder =
735 to_intel_output(connector); 735 to_intel_encoder(connector);
736 736
737 if (property == dev->mode_config.scaling_mode_property && 737 if (property == dev->mode_config.scaling_mode_property &&
738 connector->encoder) { 738 connector->encoder) {
739 struct drm_crtc *crtc = connector->encoder->crtc; 739 struct drm_crtc *crtc = connector->encoder->crtc;
740 struct intel_lvds_priv *lvds_priv = intel_output->dev_priv; 740 struct intel_lvds_priv *lvds_priv = intel_encoder->dev_priv;
741 if (value == DRM_MODE_SCALE_NONE) { 741 if (value == DRM_MODE_SCALE_NONE) {
742 DRM_DEBUG_KMS("no scaling not supported\n"); 742 DRM_DEBUG_KMS("no scaling not supported\n");
743 return 0; 743 return 0;
@@ -967,7 +967,7 @@ static int lvds_is_present_in_vbt(struct drm_device *dev)
967void intel_lvds_init(struct drm_device *dev) 967void intel_lvds_init(struct drm_device *dev)
968{ 968{
969 struct drm_i915_private *dev_priv = dev->dev_private; 969 struct drm_i915_private *dev_priv = dev->dev_private;
970 struct intel_output *intel_output; 970 struct intel_encoder *intel_encoder;
971 struct drm_connector *connector; 971 struct drm_connector *connector;
972 struct drm_encoder *encoder; 972 struct drm_encoder *encoder;
973 struct drm_display_mode *scan; /* *modes, *bios_mode; */ 973 struct drm_display_mode *scan; /* *modes, *bios_mode; */
@@ -995,40 +995,40 @@ void intel_lvds_init(struct drm_device *dev)
995 gpio = PCH_GPIOC; 995 gpio = PCH_GPIOC;
996 } 996 }
997 997
998 intel_output = kzalloc(sizeof(struct intel_output) + 998 intel_encoder = kzalloc(sizeof(struct intel_encoder) +
999 sizeof(struct intel_lvds_priv), GFP_KERNEL); 999 sizeof(struct intel_lvds_priv), GFP_KERNEL);
1000 if (!intel_output) { 1000 if (!intel_encoder) {
1001 return; 1001 return;
1002 } 1002 }
1003 1003
1004 connector = &intel_output->base; 1004 connector = &intel_encoder->base;
1005 encoder = &intel_output->enc; 1005 encoder = &intel_encoder->enc;
1006 drm_connector_init(dev, &intel_output->base, &intel_lvds_connector_funcs, 1006 drm_connector_init(dev, &intel_encoder->base, &intel_lvds_connector_funcs,
1007 DRM_MODE_CONNECTOR_LVDS); 1007 DRM_MODE_CONNECTOR_LVDS);
1008 1008
1009 drm_encoder_init(dev, &intel_output->enc, &intel_lvds_enc_funcs, 1009 drm_encoder_init(dev, &intel_encoder->enc, &intel_lvds_enc_funcs,
1010 DRM_MODE_ENCODER_LVDS); 1010 DRM_MODE_ENCODER_LVDS);
1011 1011
1012 drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); 1012 drm_mode_connector_attach_encoder(&intel_encoder->base, &intel_encoder->enc);
1013 intel_output->type = INTEL_OUTPUT_LVDS; 1013 intel_encoder->type = INTEL_OUTPUT_LVDS;
1014 1014
1015 intel_output->clone_mask = (1 << INTEL_LVDS_CLONE_BIT); 1015 intel_encoder->clone_mask = (1 << INTEL_LVDS_CLONE_BIT);
1016 intel_output->crtc_mask = (1 << 1); 1016 intel_encoder->crtc_mask = (1 << 1);
1017 drm_encoder_helper_add(encoder, &intel_lvds_helper_funcs); 1017 drm_encoder_helper_add(encoder, &intel_lvds_helper_funcs);
1018 drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs); 1018 drm_connector_helper_add(connector, &intel_lvds_connector_helper_funcs);
1019 connector->display_info.subpixel_order = SubPixelHorizontalRGB; 1019 connector->display_info.subpixel_order = SubPixelHorizontalRGB;
1020 connector->interlace_allowed = false; 1020 connector->interlace_allowed = false;
1021 connector->doublescan_allowed = false; 1021 connector->doublescan_allowed = false;
1022 1022
1023 lvds_priv = (struct intel_lvds_priv *)(intel_output + 1); 1023 lvds_priv = (struct intel_lvds_priv *)(intel_encoder + 1);
1024 intel_output->dev_priv = lvds_priv; 1024 intel_encoder->dev_priv = lvds_priv;
1025 /* create the scaling mode property */ 1025 /* create the scaling mode property */
1026 drm_mode_create_scaling_mode_property(dev); 1026 drm_mode_create_scaling_mode_property(dev);
1027 /* 1027 /*
1028 * the initial panel fitting mode will be FULL_SCREEN. 1028 * the initial panel fitting mode will be FULL_SCREEN.
1029 */ 1029 */
1030 1030
1031 drm_connector_attach_property(&intel_output->base, 1031 drm_connector_attach_property(&intel_encoder->base,
1032 dev->mode_config.scaling_mode_property, 1032 dev->mode_config.scaling_mode_property,
1033 DRM_MODE_SCALE_FULLSCREEN); 1033 DRM_MODE_SCALE_FULLSCREEN);
1034 lvds_priv->fitting_mode = DRM_MODE_SCALE_FULLSCREEN; 1034 lvds_priv->fitting_mode = DRM_MODE_SCALE_FULLSCREEN;
@@ -1043,8 +1043,8 @@ void intel_lvds_init(struct drm_device *dev)
1043 */ 1043 */
1044 1044
1045 /* Set up the DDC bus. */ 1045 /* Set up the DDC bus. */
1046 intel_output->ddc_bus = intel_i2c_create(dev, gpio, "LVDSDDC_C"); 1046 intel_encoder->ddc_bus = intel_i2c_create(dev, gpio, "LVDSDDC_C");
1047 if (!intel_output->ddc_bus) { 1047 if (!intel_encoder->ddc_bus) {
1048 dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration " 1048 dev_printk(KERN_ERR, &dev->pdev->dev, "DDC bus registration "
1049 "failed.\n"); 1049 "failed.\n");
1050 goto failed; 1050 goto failed;
@@ -1054,7 +1054,7 @@ void intel_lvds_init(struct drm_device *dev)
1054 * Attempt to get the fixed panel mode from DDC. Assume that the 1054 * Attempt to get the fixed panel mode from DDC. Assume that the
1055 * preferred mode is the right one. 1055 * preferred mode is the right one.
1056 */ 1056 */
1057 intel_ddc_get_modes(intel_output); 1057 intel_ddc_get_modes(intel_encoder);
1058 1058
1059 list_for_each_entry(scan, &connector->probed_modes, head) { 1059 list_for_each_entry(scan, &connector->probed_modes, head) {
1060 mutex_lock(&dev->mode_config.mutex); 1060 mutex_lock(&dev->mode_config.mutex);
@@ -1132,9 +1132,9 @@ out:
1132 1132
1133failed: 1133failed:
1134 DRM_DEBUG_KMS("No LVDS modes found, disabling.\n"); 1134 DRM_DEBUG_KMS("No LVDS modes found, disabling.\n");
1135 if (intel_output->ddc_bus) 1135 if (intel_encoder->ddc_bus)
1136 intel_i2c_destroy(intel_output->ddc_bus); 1136 intel_i2c_destroy(intel_encoder->ddc_bus);
1137 drm_connector_cleanup(connector); 1137 drm_connector_cleanup(connector);
1138 drm_encoder_cleanup(encoder); 1138 drm_encoder_cleanup(encoder);
1139 kfree(intel_output); 1139 kfree(intel_encoder);
1140} 1140}
diff --git a/drivers/gpu/drm/i915/intel_modes.c b/drivers/gpu/drm/i915/intel_modes.c
index 67e2f4632a24..3111a1c2731f 100644
--- a/drivers/gpu/drm/i915/intel_modes.c
+++ b/drivers/gpu/drm/i915/intel_modes.c
@@ -33,7 +33,7 @@
33 * intel_ddc_probe 33 * intel_ddc_probe
34 * 34 *
35 */ 35 */
36bool intel_ddc_probe(struct intel_output *intel_output) 36bool intel_ddc_probe(struct intel_encoder *intel_encoder)
37{ 37{
38 u8 out_buf[] = { 0x0, 0x0}; 38 u8 out_buf[] = { 0x0, 0x0};
39 u8 buf[2]; 39 u8 buf[2];
@@ -53,9 +53,9 @@ bool intel_ddc_probe(struct intel_output *intel_output)
53 } 53 }
54 }; 54 };
55 55
56 intel_i2c_quirk_set(intel_output->base.dev, true); 56 intel_i2c_quirk_set(intel_encoder->base.dev, true);
57 ret = i2c_transfer(intel_output->ddc_bus, msgs, 2); 57 ret = i2c_transfer(intel_encoder->ddc_bus, msgs, 2);
58 intel_i2c_quirk_set(intel_output->base.dev, false); 58 intel_i2c_quirk_set(intel_encoder->base.dev, false);
59 if (ret == 2) 59 if (ret == 2)
60 return true; 60 return true;
61 61
@@ -68,19 +68,19 @@ bool intel_ddc_probe(struct intel_output *intel_output)
68 * 68 *
69 * Fetch the EDID information from @connector using the DDC bus. 69 * Fetch the EDID information from @connector using the DDC bus.
70 */ 70 */
71int intel_ddc_get_modes(struct intel_output *intel_output) 71int intel_ddc_get_modes(struct intel_encoder *intel_encoder)
72{ 72{
73 struct edid *edid; 73 struct edid *edid;
74 int ret = 0; 74 int ret = 0;
75 75
76 intel_i2c_quirk_set(intel_output->base.dev, true); 76 intel_i2c_quirk_set(intel_encoder->base.dev, true);
77 edid = drm_get_edid(&intel_output->base, intel_output->ddc_bus); 77 edid = drm_get_edid(&intel_encoder->base, intel_encoder->ddc_bus);
78 intel_i2c_quirk_set(intel_output->base.dev, false); 78 intel_i2c_quirk_set(intel_encoder->base.dev, false);
79 if (edid) { 79 if (edid) {
80 drm_mode_connector_update_edid_property(&intel_output->base, 80 drm_mode_connector_update_edid_property(&intel_encoder->base,
81 edid); 81 edid);
82 ret = drm_add_edid_modes(&intel_output->base, edid); 82 ret = drm_add_edid_modes(&intel_encoder->base, edid);
83 intel_output->base.display_info.raw_edid = NULL; 83 intel_encoder->base.display_info.raw_edid = NULL;
84 kfree(edid); 84 kfree(edid);
85 } 85 }
86 86
diff --git a/drivers/gpu/drm/i915/intel_sdvo.c b/drivers/gpu/drm/i915/intel_sdvo.c
index 48daee5c9c63..ea6de3b14954 100644
--- a/drivers/gpu/drm/i915/intel_sdvo.c
+++ b/drivers/gpu/drm/i915/intel_sdvo.c
@@ -161,18 +161,18 @@ struct intel_sdvo_priv {
161}; 161};
162 162
163static bool 163static bool
164intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags); 164intel_sdvo_output_setup(struct intel_encoder *intel_encoder, uint16_t flags);
165 165
166/** 166/**
167 * Writes the SDVOB or SDVOC with the given value, but always writes both 167 * Writes the SDVOB or SDVOC with the given value, but always writes both
168 * SDVOB and SDVOC to work around apparent hardware issues (according to 168 * SDVOB and SDVOC to work around apparent hardware issues (according to
169 * comments in the BIOS). 169 * comments in the BIOS).
170 */ 170 */
171static void intel_sdvo_write_sdvox(struct intel_output *intel_output, u32 val) 171static void intel_sdvo_write_sdvox(struct intel_encoder *intel_encoder, u32 val)
172{ 172{
173 struct drm_device *dev = intel_output->base.dev; 173 struct drm_device *dev = intel_encoder->base.dev;
174 struct drm_i915_private *dev_priv = dev->dev_private; 174 struct drm_i915_private *dev_priv = dev->dev_private;
175 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 175 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
176 u32 bval = val, cval = val; 176 u32 bval = val, cval = val;
177 int i; 177 int i;
178 178
@@ -195,10 +195,10 @@ static void intel_sdvo_write_sdvox(struct intel_output *intel_output, u32 val)
195 } 195 }
196} 196}
197 197
198static bool intel_sdvo_read_byte(struct intel_output *intel_output, u8 addr, 198static bool intel_sdvo_read_byte(struct intel_encoder *intel_encoder, u8 addr,
199 u8 *ch) 199 u8 *ch)
200{ 200{
201 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 201 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
202 u8 out_buf[2]; 202 u8 out_buf[2];
203 u8 buf[2]; 203 u8 buf[2];
204 int ret; 204 int ret;
@@ -221,7 +221,7 @@ static bool intel_sdvo_read_byte(struct intel_output *intel_output, u8 addr,
221 out_buf[0] = addr; 221 out_buf[0] = addr;
222 out_buf[1] = 0; 222 out_buf[1] = 0;
223 223
224 if ((ret = i2c_transfer(intel_output->i2c_bus, msgs, 2)) == 2) 224 if ((ret = i2c_transfer(intel_encoder->i2c_bus, msgs, 2)) == 2)
225 { 225 {
226 *ch = buf[0]; 226 *ch = buf[0];
227 return true; 227 return true;
@@ -231,10 +231,10 @@ static bool intel_sdvo_read_byte(struct intel_output *intel_output, u8 addr,
231 return false; 231 return false;
232} 232}
233 233
234static bool intel_sdvo_write_byte(struct intel_output *intel_output, int addr, 234static bool intel_sdvo_write_byte(struct intel_encoder *intel_encoder, int addr,
235 u8 ch) 235 u8 ch)
236{ 236{
237 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 237 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
238 u8 out_buf[2]; 238 u8 out_buf[2];
239 struct i2c_msg msgs[] = { 239 struct i2c_msg msgs[] = {
240 { 240 {
@@ -248,7 +248,7 @@ static bool intel_sdvo_write_byte(struct intel_output *intel_output, int addr,
248 out_buf[0] = addr; 248 out_buf[0] = addr;
249 out_buf[1] = ch; 249 out_buf[1] = ch;
250 250
251 if (i2c_transfer(intel_output->i2c_bus, msgs, 1) == 1) 251 if (i2c_transfer(intel_encoder->i2c_bus, msgs, 1) == 1)
252 { 252 {
253 return true; 253 return true;
254 } 254 }
@@ -355,10 +355,10 @@ static const struct _sdvo_cmd_name {
355#define SDVO_NAME(dev_priv) ((dev_priv)->output_device == SDVOB ? "SDVOB" : "SDVOC") 355#define SDVO_NAME(dev_priv) ((dev_priv)->output_device == SDVOB ? "SDVOB" : "SDVOC")
356#define SDVO_PRIV(output) ((struct intel_sdvo_priv *) (output)->dev_priv) 356#define SDVO_PRIV(output) ((struct intel_sdvo_priv *) (output)->dev_priv)
357 357
358static void intel_sdvo_debug_write(struct intel_output *intel_output, u8 cmd, 358static void intel_sdvo_debug_write(struct intel_encoder *intel_encoder, u8 cmd,
359 void *args, int args_len) 359 void *args, int args_len)
360{ 360{
361 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 361 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
362 int i; 362 int i;
363 363
364 DRM_DEBUG_KMS("%s: W: %02X ", 364 DRM_DEBUG_KMS("%s: W: %02X ",
@@ -378,19 +378,19 @@ static void intel_sdvo_debug_write(struct intel_output *intel_output, u8 cmd,
378 DRM_LOG_KMS("\n"); 378 DRM_LOG_KMS("\n");
379} 379}
380 380
381static void intel_sdvo_write_cmd(struct intel_output *intel_output, u8 cmd, 381static void intel_sdvo_write_cmd(struct intel_encoder *intel_encoder, u8 cmd,
382 void *args, int args_len) 382 void *args, int args_len)
383{ 383{
384 int i; 384 int i;
385 385
386 intel_sdvo_debug_write(intel_output, cmd, args, args_len); 386 intel_sdvo_debug_write(intel_encoder, cmd, args, args_len);
387 387
388 for (i = 0; i < args_len; i++) { 388 for (i = 0; i < args_len; i++) {
389 intel_sdvo_write_byte(intel_output, SDVO_I2C_ARG_0 - i, 389 intel_sdvo_write_byte(intel_encoder, SDVO_I2C_ARG_0 - i,
390 ((u8*)args)[i]); 390 ((u8*)args)[i]);
391 } 391 }
392 392
393 intel_sdvo_write_byte(intel_output, SDVO_I2C_OPCODE, cmd); 393 intel_sdvo_write_byte(intel_encoder, SDVO_I2C_OPCODE, cmd);
394} 394}
395 395
396static const char *cmd_status_names[] = { 396static const char *cmd_status_names[] = {
@@ -403,11 +403,11 @@ static const char *cmd_status_names[] = {
403 "Scaling not supported" 403 "Scaling not supported"
404}; 404};
405 405
406static void intel_sdvo_debug_response(struct intel_output *intel_output, 406static void intel_sdvo_debug_response(struct intel_encoder *intel_encoder,
407 void *response, int response_len, 407 void *response, int response_len,
408 u8 status) 408 u8 status)
409{ 409{
410 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 410 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
411 int i; 411 int i;
412 412
413 DRM_DEBUG_KMS("%s: R: ", SDVO_NAME(sdvo_priv)); 413 DRM_DEBUG_KMS("%s: R: ", SDVO_NAME(sdvo_priv));
@@ -422,7 +422,7 @@ static void intel_sdvo_debug_response(struct intel_output *intel_output,
422 DRM_LOG_KMS("\n"); 422 DRM_LOG_KMS("\n");
423} 423}
424 424
425static u8 intel_sdvo_read_response(struct intel_output *intel_output, 425static u8 intel_sdvo_read_response(struct intel_encoder *intel_encoder,
426 void *response, int response_len) 426 void *response, int response_len)
427{ 427{
428 int i; 428 int i;
@@ -432,16 +432,16 @@ static u8 intel_sdvo_read_response(struct intel_output *intel_output,
432 while (retry--) { 432 while (retry--) {
433 /* Read the command response */ 433 /* Read the command response */
434 for (i = 0; i < response_len; i++) { 434 for (i = 0; i < response_len; i++) {
435 intel_sdvo_read_byte(intel_output, 435 intel_sdvo_read_byte(intel_encoder,
436 SDVO_I2C_RETURN_0 + i, 436 SDVO_I2C_RETURN_0 + i,
437 &((u8 *)response)[i]); 437 &((u8 *)response)[i]);
438 } 438 }
439 439
440 /* read the return status */ 440 /* read the return status */
441 intel_sdvo_read_byte(intel_output, SDVO_I2C_CMD_STATUS, 441 intel_sdvo_read_byte(intel_encoder, SDVO_I2C_CMD_STATUS,
442 &status); 442 &status);
443 443
444 intel_sdvo_debug_response(intel_output, response, response_len, 444 intel_sdvo_debug_response(intel_encoder, response, response_len,
445 status); 445 status);
446 if (status != SDVO_CMD_STATUS_PENDING) 446 if (status != SDVO_CMD_STATUS_PENDING)
447 return status; 447 return status;
@@ -469,10 +469,10 @@ static int intel_sdvo_get_pixel_multiplier(struct drm_display_mode *mode)
469 * another I2C transaction after issuing the DDC bus switch, it will be 469 * another I2C transaction after issuing the DDC bus switch, it will be
470 * switched to the internal SDVO register. 470 * switched to the internal SDVO register.
471 */ 471 */
472static void intel_sdvo_set_control_bus_switch(struct intel_output *intel_output, 472static void intel_sdvo_set_control_bus_switch(struct intel_encoder *intel_encoder,
473 u8 target) 473 u8 target)
474{ 474{
475 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 475 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
476 u8 out_buf[2], cmd_buf[2], ret_value[2], ret; 476 u8 out_buf[2], cmd_buf[2], ret_value[2], ret;
477 struct i2c_msg msgs[] = { 477 struct i2c_msg msgs[] = {
478 { 478 {
@@ -496,10 +496,10 @@ static void intel_sdvo_set_control_bus_switch(struct intel_output *intel_output,
496 }, 496 },
497 }; 497 };
498 498
499 intel_sdvo_debug_write(intel_output, SDVO_CMD_SET_CONTROL_BUS_SWITCH, 499 intel_sdvo_debug_write(intel_encoder, SDVO_CMD_SET_CONTROL_BUS_SWITCH,
500 &target, 1); 500 &target, 1);
501 /* write the DDC switch command argument */ 501 /* write the DDC switch command argument */
502 intel_sdvo_write_byte(intel_output, SDVO_I2C_ARG_0, target); 502 intel_sdvo_write_byte(intel_encoder, SDVO_I2C_ARG_0, target);
503 503
504 out_buf[0] = SDVO_I2C_OPCODE; 504 out_buf[0] = SDVO_I2C_OPCODE;
505 out_buf[1] = SDVO_CMD_SET_CONTROL_BUS_SWITCH; 505 out_buf[1] = SDVO_CMD_SET_CONTROL_BUS_SWITCH;
@@ -508,7 +508,7 @@ static void intel_sdvo_set_control_bus_switch(struct intel_output *intel_output,
508 ret_value[0] = 0; 508 ret_value[0] = 0;
509 ret_value[1] = 0; 509 ret_value[1] = 0;
510 510
511 ret = i2c_transfer(intel_output->i2c_bus, msgs, 3); 511 ret = i2c_transfer(intel_encoder->i2c_bus, msgs, 3);
512 if (ret != 3) { 512 if (ret != 3) {
513 /* failure in I2C transfer */ 513 /* failure in I2C transfer */
514 DRM_DEBUG_KMS("I2c transfer returned %d\n", ret); 514 DRM_DEBUG_KMS("I2c transfer returned %d\n", ret);
@@ -522,7 +522,7 @@ static void intel_sdvo_set_control_bus_switch(struct intel_output *intel_output,
522 return; 522 return;
523} 523}
524 524
525static bool intel_sdvo_set_target_input(struct intel_output *intel_output, bool target_0, bool target_1) 525static bool intel_sdvo_set_target_input(struct intel_encoder *intel_encoder, bool target_0, bool target_1)
526{ 526{
527 struct intel_sdvo_set_target_input_args targets = {0}; 527 struct intel_sdvo_set_target_input_args targets = {0};
528 u8 status; 528 u8 status;
@@ -533,10 +533,10 @@ static bool intel_sdvo_set_target_input(struct intel_output *intel_output, bool
533 if (target_1) 533 if (target_1)
534 targets.target_1 = 1; 534 targets.target_1 = 1;
535 535
536 intel_sdvo_write_cmd(intel_output, SDVO_CMD_SET_TARGET_INPUT, &targets, 536 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_SET_TARGET_INPUT, &targets,
537 sizeof(targets)); 537 sizeof(targets));
538 538
539 status = intel_sdvo_read_response(intel_output, NULL, 0); 539 status = intel_sdvo_read_response(intel_encoder, NULL, 0);
540 540
541 return (status == SDVO_CMD_STATUS_SUCCESS); 541 return (status == SDVO_CMD_STATUS_SUCCESS);
542} 542}
@@ -547,13 +547,13 @@ static bool intel_sdvo_set_target_input(struct intel_output *intel_output, bool
547 * This function is making an assumption about the layout of the response, 547 * This function is making an assumption about the layout of the response,
548 * which should be checked against the docs. 548 * which should be checked against the docs.
549 */ 549 */
550static bool intel_sdvo_get_trained_inputs(struct intel_output *intel_output, bool *input_1, bool *input_2) 550static bool intel_sdvo_get_trained_inputs(struct intel_encoder *intel_encoder, bool *input_1, bool *input_2)
551{ 551{
552 struct intel_sdvo_get_trained_inputs_response response; 552 struct intel_sdvo_get_trained_inputs_response response;
553 u8 status; 553 u8 status;
554 554
555 intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_TRAINED_INPUTS, NULL, 0); 555 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_TRAINED_INPUTS, NULL, 0);
556 status = intel_sdvo_read_response(intel_output, &response, sizeof(response)); 556 status = intel_sdvo_read_response(intel_encoder, &response, sizeof(response));
557 if (status != SDVO_CMD_STATUS_SUCCESS) 557 if (status != SDVO_CMD_STATUS_SUCCESS)
558 return false; 558 return false;
559 559
@@ -562,29 +562,29 @@ static bool intel_sdvo_get_trained_inputs(struct intel_output *intel_output, boo
562 return true; 562 return true;
563} 563}
564 564
565static bool intel_sdvo_get_active_outputs(struct intel_output *intel_output, 565static bool intel_sdvo_get_active_outputs(struct intel_encoder *intel_encoder,
566 u16 *outputs) 566 u16 *outputs)
567{ 567{
568 u8 status; 568 u8 status;
569 569
570 intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_ACTIVE_OUTPUTS, NULL, 0); 570 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_ACTIVE_OUTPUTS, NULL, 0);
571 status = intel_sdvo_read_response(intel_output, outputs, sizeof(*outputs)); 571 status = intel_sdvo_read_response(intel_encoder, outputs, sizeof(*outputs));
572 572
573 return (status == SDVO_CMD_STATUS_SUCCESS); 573 return (status == SDVO_CMD_STATUS_SUCCESS);
574} 574}
575 575
576static bool intel_sdvo_set_active_outputs(struct intel_output *intel_output, 576static bool intel_sdvo_set_active_outputs(struct intel_encoder *intel_encoder,
577 u16 outputs) 577 u16 outputs)
578{ 578{
579 u8 status; 579 u8 status;
580 580
581 intel_sdvo_write_cmd(intel_output, SDVO_CMD_SET_ACTIVE_OUTPUTS, &outputs, 581 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_SET_ACTIVE_OUTPUTS, &outputs,
582 sizeof(outputs)); 582 sizeof(outputs));
583 status = intel_sdvo_read_response(intel_output, NULL, 0); 583 status = intel_sdvo_read_response(intel_encoder, NULL, 0);
584 return (status == SDVO_CMD_STATUS_SUCCESS); 584 return (status == SDVO_CMD_STATUS_SUCCESS);
585} 585}
586 586
587static bool intel_sdvo_set_encoder_power_state(struct intel_output *intel_output, 587static bool intel_sdvo_set_encoder_power_state(struct intel_encoder *intel_encoder,
588 int mode) 588 int mode)
589{ 589{
590 u8 status, state = SDVO_ENCODER_STATE_ON; 590 u8 status, state = SDVO_ENCODER_STATE_ON;
@@ -604,24 +604,24 @@ static bool intel_sdvo_set_encoder_power_state(struct intel_output *intel_output
604 break; 604 break;
605 } 605 }
606 606
607 intel_sdvo_write_cmd(intel_output, SDVO_CMD_SET_ENCODER_POWER_STATE, &state, 607 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_SET_ENCODER_POWER_STATE, &state,
608 sizeof(state)); 608 sizeof(state));
609 status = intel_sdvo_read_response(intel_output, NULL, 0); 609 status = intel_sdvo_read_response(intel_encoder, NULL, 0);
610 610
611 return (status == SDVO_CMD_STATUS_SUCCESS); 611 return (status == SDVO_CMD_STATUS_SUCCESS);
612} 612}
613 613
614static bool intel_sdvo_get_input_pixel_clock_range(struct intel_output *intel_output, 614static bool intel_sdvo_get_input_pixel_clock_range(struct intel_encoder *intel_encoder,
615 int *clock_min, 615 int *clock_min,
616 int *clock_max) 616 int *clock_max)
617{ 617{
618 struct intel_sdvo_pixel_clock_range clocks; 618 struct intel_sdvo_pixel_clock_range clocks;
619 u8 status; 619 u8 status;
620 620
621 intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_INPUT_PIXEL_CLOCK_RANGE, 621 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_INPUT_PIXEL_CLOCK_RANGE,
622 NULL, 0); 622 NULL, 0);
623 623
624 status = intel_sdvo_read_response(intel_output, &clocks, sizeof(clocks)); 624 status = intel_sdvo_read_response(intel_encoder, &clocks, sizeof(clocks));
625 625
626 if (status != SDVO_CMD_STATUS_SUCCESS) 626 if (status != SDVO_CMD_STATUS_SUCCESS)
627 return false; 627 return false;
@@ -633,31 +633,31 @@ static bool intel_sdvo_get_input_pixel_clock_range(struct intel_output *intel_ou
633 return true; 633 return true;
634} 634}
635 635
636static bool intel_sdvo_set_target_output(struct intel_output *intel_output, 636static bool intel_sdvo_set_target_output(struct intel_encoder *intel_encoder,
637 u16 outputs) 637 u16 outputs)
638{ 638{
639 u8 status; 639 u8 status;
640 640
641 intel_sdvo_write_cmd(intel_output, SDVO_CMD_SET_TARGET_OUTPUT, &outputs, 641 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_SET_TARGET_OUTPUT, &outputs,
642 sizeof(outputs)); 642 sizeof(outputs));
643 643
644 status = intel_sdvo_read_response(intel_output, NULL, 0); 644 status = intel_sdvo_read_response(intel_encoder, NULL, 0);
645 return (status == SDVO_CMD_STATUS_SUCCESS); 645 return (status == SDVO_CMD_STATUS_SUCCESS);
646} 646}
647 647
648static bool intel_sdvo_get_timing(struct intel_output *intel_output, u8 cmd, 648static bool intel_sdvo_get_timing(struct intel_encoder *intel_encoder, u8 cmd,
649 struct intel_sdvo_dtd *dtd) 649 struct intel_sdvo_dtd *dtd)
650{ 650{
651 u8 status; 651 u8 status;
652 652
653 intel_sdvo_write_cmd(intel_output, cmd, NULL, 0); 653 intel_sdvo_write_cmd(intel_encoder, cmd, NULL, 0);
654 status = intel_sdvo_read_response(intel_output, &dtd->part1, 654 status = intel_sdvo_read_response(intel_encoder, &dtd->part1,
655 sizeof(dtd->part1)); 655 sizeof(dtd->part1));
656 if (status != SDVO_CMD_STATUS_SUCCESS) 656 if (status != SDVO_CMD_STATUS_SUCCESS)
657 return false; 657 return false;
658 658
659 intel_sdvo_write_cmd(intel_output, cmd + 1, NULL, 0); 659 intel_sdvo_write_cmd(intel_encoder, cmd + 1, NULL, 0);
660 status = intel_sdvo_read_response(intel_output, &dtd->part2, 660 status = intel_sdvo_read_response(intel_encoder, &dtd->part2,
661 sizeof(dtd->part2)); 661 sizeof(dtd->part2));
662 if (status != SDVO_CMD_STATUS_SUCCESS) 662 if (status != SDVO_CMD_STATUS_SUCCESS)
663 return false; 663 return false;
@@ -665,54 +665,54 @@ static bool intel_sdvo_get_timing(struct intel_output *intel_output, u8 cmd,
665 return true; 665 return true;
666} 666}
667 667
668static bool intel_sdvo_get_input_timing(struct intel_output *intel_output, 668static bool intel_sdvo_get_input_timing(struct intel_encoder *intel_encoder,
669 struct intel_sdvo_dtd *dtd) 669 struct intel_sdvo_dtd *dtd)
670{ 670{
671 return intel_sdvo_get_timing(intel_output, 671 return intel_sdvo_get_timing(intel_encoder,
672 SDVO_CMD_GET_INPUT_TIMINGS_PART1, dtd); 672 SDVO_CMD_GET_INPUT_TIMINGS_PART1, dtd);
673} 673}
674 674
675static bool intel_sdvo_get_output_timing(struct intel_output *intel_output, 675static bool intel_sdvo_get_output_timing(struct intel_encoder *intel_encoder,
676 struct intel_sdvo_dtd *dtd) 676 struct intel_sdvo_dtd *dtd)
677{ 677{
678 return intel_sdvo_get_timing(intel_output, 678 return intel_sdvo_get_timing(intel_encoder,
679 SDVO_CMD_GET_OUTPUT_TIMINGS_PART1, dtd); 679 SDVO_CMD_GET_OUTPUT_TIMINGS_PART1, dtd);
680} 680}
681 681
682static bool intel_sdvo_set_timing(struct intel_output *intel_output, u8 cmd, 682static bool intel_sdvo_set_timing(struct intel_encoder *intel_encoder, u8 cmd,
683 struct intel_sdvo_dtd *dtd) 683 struct intel_sdvo_dtd *dtd)
684{ 684{
685 u8 status; 685 u8 status;
686 686
687 intel_sdvo_write_cmd(intel_output, cmd, &dtd->part1, sizeof(dtd->part1)); 687 intel_sdvo_write_cmd(intel_encoder, cmd, &dtd->part1, sizeof(dtd->part1));
688 status = intel_sdvo_read_response(intel_output, NULL, 0); 688 status = intel_sdvo_read_response(intel_encoder, NULL, 0);
689 if (status != SDVO_CMD_STATUS_SUCCESS) 689 if (status != SDVO_CMD_STATUS_SUCCESS)
690 return false; 690 return false;
691 691
692 intel_sdvo_write_cmd(intel_output, cmd + 1, &dtd->part2, sizeof(dtd->part2)); 692 intel_sdvo_write_cmd(intel_encoder, cmd + 1, &dtd->part2, sizeof(dtd->part2));
693 status = intel_sdvo_read_response(intel_output, NULL, 0); 693 status = intel_sdvo_read_response(intel_encoder, NULL, 0);
694 if (status != SDVO_CMD_STATUS_SUCCESS) 694 if (status != SDVO_CMD_STATUS_SUCCESS)
695 return false; 695 return false;
696 696
697 return true; 697 return true;
698} 698}
699 699
700static bool intel_sdvo_set_input_timing(struct intel_output *intel_output, 700static bool intel_sdvo_set_input_timing(struct intel_encoder *intel_encoder,
701 struct intel_sdvo_dtd *dtd) 701 struct intel_sdvo_dtd *dtd)
702{ 702{
703 return intel_sdvo_set_timing(intel_output, 703 return intel_sdvo_set_timing(intel_encoder,
704 SDVO_CMD_SET_INPUT_TIMINGS_PART1, dtd); 704 SDVO_CMD_SET_INPUT_TIMINGS_PART1, dtd);
705} 705}
706 706
707static bool intel_sdvo_set_output_timing(struct intel_output *intel_output, 707static bool intel_sdvo_set_output_timing(struct intel_encoder *intel_encoder,
708 struct intel_sdvo_dtd *dtd) 708 struct intel_sdvo_dtd *dtd)
709{ 709{
710 return intel_sdvo_set_timing(intel_output, 710 return intel_sdvo_set_timing(intel_encoder,
711 SDVO_CMD_SET_OUTPUT_TIMINGS_PART1, dtd); 711 SDVO_CMD_SET_OUTPUT_TIMINGS_PART1, dtd);
712} 712}
713 713
714static bool 714static bool
715intel_sdvo_create_preferred_input_timing(struct intel_output *output, 715intel_sdvo_create_preferred_input_timing(struct intel_encoder *output,
716 uint16_t clock, 716 uint16_t clock,
717 uint16_t width, 717 uint16_t width,
718 uint16_t height) 718 uint16_t height)
@@ -741,7 +741,7 @@ intel_sdvo_create_preferred_input_timing(struct intel_output *output,
741 return true; 741 return true;
742} 742}
743 743
744static bool intel_sdvo_get_preferred_input_timing(struct intel_output *output, 744static bool intel_sdvo_get_preferred_input_timing(struct intel_encoder *output,
745 struct intel_sdvo_dtd *dtd) 745 struct intel_sdvo_dtd *dtd)
746{ 746{
747 bool status; 747 bool status;
@@ -765,12 +765,12 @@ static bool intel_sdvo_get_preferred_input_timing(struct intel_output *output,
765 return false; 765 return false;
766} 766}
767 767
768static int intel_sdvo_get_clock_rate_mult(struct intel_output *intel_output) 768static int intel_sdvo_get_clock_rate_mult(struct intel_encoder *intel_encoder)
769{ 769{
770 u8 response, status; 770 u8 response, status;
771 771
772 intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_CLOCK_RATE_MULT, NULL, 0); 772 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_CLOCK_RATE_MULT, NULL, 0);
773 status = intel_sdvo_read_response(intel_output, &response, 1); 773 status = intel_sdvo_read_response(intel_encoder, &response, 1);
774 774
775 if (status != SDVO_CMD_STATUS_SUCCESS) { 775 if (status != SDVO_CMD_STATUS_SUCCESS) {
776 DRM_DEBUG_KMS("Couldn't get SDVO clock rate multiplier\n"); 776 DRM_DEBUG_KMS("Couldn't get SDVO clock rate multiplier\n");
@@ -782,12 +782,12 @@ static int intel_sdvo_get_clock_rate_mult(struct intel_output *intel_output)
782 return response; 782 return response;
783} 783}
784 784
785static bool intel_sdvo_set_clock_rate_mult(struct intel_output *intel_output, u8 val) 785static bool intel_sdvo_set_clock_rate_mult(struct intel_encoder *intel_encoder, u8 val)
786{ 786{
787 u8 status; 787 u8 status;
788 788
789 intel_sdvo_write_cmd(intel_output, SDVO_CMD_SET_CLOCK_RATE_MULT, &val, 1); 789 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_SET_CLOCK_RATE_MULT, &val, 1);
790 status = intel_sdvo_read_response(intel_output, NULL, 0); 790 status = intel_sdvo_read_response(intel_encoder, NULL, 0);
791 if (status != SDVO_CMD_STATUS_SUCCESS) 791 if (status != SDVO_CMD_STATUS_SUCCESS)
792 return false; 792 return false;
793 793
@@ -876,7 +876,7 @@ static void intel_sdvo_get_mode_from_dtd(struct drm_display_mode * mode,
876 mode->flags |= DRM_MODE_FLAG_PVSYNC; 876 mode->flags |= DRM_MODE_FLAG_PVSYNC;
877} 877}
878 878
879static bool intel_sdvo_get_supp_encode(struct intel_output *output, 879static bool intel_sdvo_get_supp_encode(struct intel_encoder *output,
880 struct intel_sdvo_encode *encode) 880 struct intel_sdvo_encode *encode)
881{ 881{
882 uint8_t status; 882 uint8_t status;
@@ -891,7 +891,7 @@ static bool intel_sdvo_get_supp_encode(struct intel_output *output,
891 return true; 891 return true;
892} 892}
893 893
894static bool intel_sdvo_set_encode(struct intel_output *output, uint8_t mode) 894static bool intel_sdvo_set_encode(struct intel_encoder *output, uint8_t mode)
895{ 895{
896 uint8_t status; 896 uint8_t status;
897 897
@@ -901,7 +901,7 @@ static bool intel_sdvo_set_encode(struct intel_output *output, uint8_t mode)
901 return (status == SDVO_CMD_STATUS_SUCCESS); 901 return (status == SDVO_CMD_STATUS_SUCCESS);
902} 902}
903 903
904static bool intel_sdvo_set_colorimetry(struct intel_output *output, 904static bool intel_sdvo_set_colorimetry(struct intel_encoder *output,
905 uint8_t mode) 905 uint8_t mode)
906{ 906{
907 uint8_t status; 907 uint8_t status;
@@ -913,7 +913,7 @@ static bool intel_sdvo_set_colorimetry(struct intel_output *output,
913} 913}
914 914
915#if 0 915#if 0
916static void intel_sdvo_dump_hdmi_buf(struct intel_output *output) 916static void intel_sdvo_dump_hdmi_buf(struct intel_encoder *output)
917{ 917{
918 int i, j; 918 int i, j;
919 uint8_t set_buf_index[2]; 919 uint8_t set_buf_index[2];
@@ -943,7 +943,7 @@ static void intel_sdvo_dump_hdmi_buf(struct intel_output *output)
943} 943}
944#endif 944#endif
945 945
946static void intel_sdvo_set_hdmi_buf(struct intel_output *output, int index, 946static void intel_sdvo_set_hdmi_buf(struct intel_encoder *output, int index,
947 uint8_t *data, int8_t size, uint8_t tx_rate) 947 uint8_t *data, int8_t size, uint8_t tx_rate)
948{ 948{
949 uint8_t set_buf_index[2]; 949 uint8_t set_buf_index[2];
@@ -1033,7 +1033,7 @@ struct dip_infoframe {
1033 } __attribute__ ((packed)) u; 1033 } __attribute__ ((packed)) u;
1034} __attribute__((packed)); 1034} __attribute__((packed));
1035 1035
1036static void intel_sdvo_set_avi_infoframe(struct intel_output *output, 1036static void intel_sdvo_set_avi_infoframe(struct intel_encoder *output,
1037 struct drm_display_mode * mode) 1037 struct drm_display_mode * mode)
1038{ 1038{
1039 struct dip_infoframe avi_if = { 1039 struct dip_infoframe avi_if = {
@@ -1048,7 +1048,7 @@ static void intel_sdvo_set_avi_infoframe(struct intel_output *output,
1048 SDVO_HBUF_TX_VSYNC); 1048 SDVO_HBUF_TX_VSYNC);
1049} 1049}
1050 1050
1051static void intel_sdvo_set_tv_format(struct intel_output *output) 1051static void intel_sdvo_set_tv_format(struct intel_encoder *output)
1052{ 1052{
1053 1053
1054 struct intel_sdvo_tv_format format; 1054 struct intel_sdvo_tv_format format;
@@ -1078,7 +1078,7 @@ static bool intel_sdvo_mode_fixup(struct drm_encoder *encoder,
1078 struct drm_display_mode *mode, 1078 struct drm_display_mode *mode,
1079 struct drm_display_mode *adjusted_mode) 1079 struct drm_display_mode *adjusted_mode)
1080{ 1080{
1081 struct intel_output *output = enc_to_intel_output(encoder); 1081 struct intel_encoder *output = enc_to_intel_encoder(encoder);
1082 struct intel_sdvo_priv *dev_priv = output->dev_priv; 1082 struct intel_sdvo_priv *dev_priv = output->dev_priv;
1083 1083
1084 if (dev_priv->is_tv) { 1084 if (dev_priv->is_tv) {
@@ -1181,7 +1181,7 @@ static void intel_sdvo_mode_set(struct drm_encoder *encoder,
1181 struct drm_i915_private *dev_priv = dev->dev_private; 1181 struct drm_i915_private *dev_priv = dev->dev_private;
1182 struct drm_crtc *crtc = encoder->crtc; 1182 struct drm_crtc *crtc = encoder->crtc;
1183 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1183 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1184 struct intel_output *output = enc_to_intel_output(encoder); 1184 struct intel_encoder *output = enc_to_intel_encoder(encoder);
1185 struct intel_sdvo_priv *sdvo_priv = output->dev_priv; 1185 struct intel_sdvo_priv *sdvo_priv = output->dev_priv;
1186 u32 sdvox = 0; 1186 u32 sdvox = 0;
1187 int sdvo_pixel_multiply; 1187 int sdvo_pixel_multiply;
@@ -1305,19 +1305,19 @@ static void intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
1305{ 1305{
1306 struct drm_device *dev = encoder->dev; 1306 struct drm_device *dev = encoder->dev;
1307 struct drm_i915_private *dev_priv = dev->dev_private; 1307 struct drm_i915_private *dev_priv = dev->dev_private;
1308 struct intel_output *intel_output = enc_to_intel_output(encoder); 1308 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1309 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1309 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1310 u32 temp; 1310 u32 temp;
1311 1311
1312 if (mode != DRM_MODE_DPMS_ON) { 1312 if (mode != DRM_MODE_DPMS_ON) {
1313 intel_sdvo_set_active_outputs(intel_output, 0); 1313 intel_sdvo_set_active_outputs(intel_encoder, 0);
1314 if (0) 1314 if (0)
1315 intel_sdvo_set_encoder_power_state(intel_output, mode); 1315 intel_sdvo_set_encoder_power_state(intel_encoder, mode);
1316 1316
1317 if (mode == DRM_MODE_DPMS_OFF) { 1317 if (mode == DRM_MODE_DPMS_OFF) {
1318 temp = I915_READ(sdvo_priv->output_device); 1318 temp = I915_READ(sdvo_priv->output_device);
1319 if ((temp & SDVO_ENABLE) != 0) { 1319 if ((temp & SDVO_ENABLE) != 0) {
1320 intel_sdvo_write_sdvox(intel_output, temp & ~SDVO_ENABLE); 1320 intel_sdvo_write_sdvox(intel_encoder, temp & ~SDVO_ENABLE);
1321 } 1321 }
1322 } 1322 }
1323 } else { 1323 } else {
@@ -1327,11 +1327,11 @@ static void intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
1327 1327
1328 temp = I915_READ(sdvo_priv->output_device); 1328 temp = I915_READ(sdvo_priv->output_device);
1329 if ((temp & SDVO_ENABLE) == 0) 1329 if ((temp & SDVO_ENABLE) == 0)
1330 intel_sdvo_write_sdvox(intel_output, temp | SDVO_ENABLE); 1330 intel_sdvo_write_sdvox(intel_encoder, temp | SDVO_ENABLE);
1331 for (i = 0; i < 2; i++) 1331 for (i = 0; i < 2; i++)
1332 intel_wait_for_vblank(dev); 1332 intel_wait_for_vblank(dev);
1333 1333
1334 status = intel_sdvo_get_trained_inputs(intel_output, &input1, 1334 status = intel_sdvo_get_trained_inputs(intel_encoder, &input1,
1335 &input2); 1335 &input2);
1336 1336
1337 1337
@@ -1345,8 +1345,8 @@ static void intel_sdvo_dpms(struct drm_encoder *encoder, int mode)
1345 } 1345 }
1346 1346
1347 if (0) 1347 if (0)
1348 intel_sdvo_set_encoder_power_state(intel_output, mode); 1348 intel_sdvo_set_encoder_power_state(intel_encoder, mode);
1349 intel_sdvo_set_active_outputs(intel_output, sdvo_priv->controlled_output); 1349 intel_sdvo_set_active_outputs(intel_encoder, sdvo_priv->controlled_output);
1350 } 1350 }
1351 return; 1351 return;
1352} 1352}
@@ -1355,22 +1355,22 @@ static void intel_sdvo_save(struct drm_connector *connector)
1355{ 1355{
1356 struct drm_device *dev = connector->dev; 1356 struct drm_device *dev = connector->dev;
1357 struct drm_i915_private *dev_priv = dev->dev_private; 1357 struct drm_i915_private *dev_priv = dev->dev_private;
1358 struct intel_output *intel_output = to_intel_output(connector); 1358 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1359 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1359 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1360 int o; 1360 int o;
1361 1361
1362 sdvo_priv->save_sdvo_mult = intel_sdvo_get_clock_rate_mult(intel_output); 1362 sdvo_priv->save_sdvo_mult = intel_sdvo_get_clock_rate_mult(intel_encoder);
1363 intel_sdvo_get_active_outputs(intel_output, &sdvo_priv->save_active_outputs); 1363 intel_sdvo_get_active_outputs(intel_encoder, &sdvo_priv->save_active_outputs);
1364 1364
1365 if (sdvo_priv->caps.sdvo_inputs_mask & 0x1) { 1365 if (sdvo_priv->caps.sdvo_inputs_mask & 0x1) {
1366 intel_sdvo_set_target_input(intel_output, true, false); 1366 intel_sdvo_set_target_input(intel_encoder, true, false);
1367 intel_sdvo_get_input_timing(intel_output, 1367 intel_sdvo_get_input_timing(intel_encoder,
1368 &sdvo_priv->save_input_dtd_1); 1368 &sdvo_priv->save_input_dtd_1);
1369 } 1369 }
1370 1370
1371 if (sdvo_priv->caps.sdvo_inputs_mask & 0x2) { 1371 if (sdvo_priv->caps.sdvo_inputs_mask & 0x2) {
1372 intel_sdvo_set_target_input(intel_output, false, true); 1372 intel_sdvo_set_target_input(intel_encoder, false, true);
1373 intel_sdvo_get_input_timing(intel_output, 1373 intel_sdvo_get_input_timing(intel_encoder,
1374 &sdvo_priv->save_input_dtd_2); 1374 &sdvo_priv->save_input_dtd_2);
1375 } 1375 }
1376 1376
@@ -1379,8 +1379,8 @@ static void intel_sdvo_save(struct drm_connector *connector)
1379 u16 this_output = (1 << o); 1379 u16 this_output = (1 << o);
1380 if (sdvo_priv->caps.output_flags & this_output) 1380 if (sdvo_priv->caps.output_flags & this_output)
1381 { 1381 {
1382 intel_sdvo_set_target_output(intel_output, this_output); 1382 intel_sdvo_set_target_output(intel_encoder, this_output);
1383 intel_sdvo_get_output_timing(intel_output, 1383 intel_sdvo_get_output_timing(intel_encoder,
1384 &sdvo_priv->save_output_dtd[o]); 1384 &sdvo_priv->save_output_dtd[o]);
1385 } 1385 }
1386 } 1386 }
@@ -1394,60 +1394,60 @@ static void intel_sdvo_save(struct drm_connector *connector)
1394static void intel_sdvo_restore(struct drm_connector *connector) 1394static void intel_sdvo_restore(struct drm_connector *connector)
1395{ 1395{
1396 struct drm_device *dev = connector->dev; 1396 struct drm_device *dev = connector->dev;
1397 struct intel_output *intel_output = to_intel_output(connector); 1397 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1398 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1398 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1399 int o; 1399 int o;
1400 int i; 1400 int i;
1401 bool input1, input2; 1401 bool input1, input2;
1402 u8 status; 1402 u8 status;
1403 1403
1404 intel_sdvo_set_active_outputs(intel_output, 0); 1404 intel_sdvo_set_active_outputs(intel_encoder, 0);
1405 1405
1406 for (o = SDVO_OUTPUT_FIRST; o <= SDVO_OUTPUT_LAST; o++) 1406 for (o = SDVO_OUTPUT_FIRST; o <= SDVO_OUTPUT_LAST; o++)
1407 { 1407 {
1408 u16 this_output = (1 << o); 1408 u16 this_output = (1 << o);
1409 if (sdvo_priv->caps.output_flags & this_output) { 1409 if (sdvo_priv->caps.output_flags & this_output) {
1410 intel_sdvo_set_target_output(intel_output, this_output); 1410 intel_sdvo_set_target_output(intel_encoder, this_output);
1411 intel_sdvo_set_output_timing(intel_output, &sdvo_priv->save_output_dtd[o]); 1411 intel_sdvo_set_output_timing(intel_encoder, &sdvo_priv->save_output_dtd[o]);
1412 } 1412 }
1413 } 1413 }
1414 1414
1415 if (sdvo_priv->caps.sdvo_inputs_mask & 0x1) { 1415 if (sdvo_priv->caps.sdvo_inputs_mask & 0x1) {
1416 intel_sdvo_set_target_input(intel_output, true, false); 1416 intel_sdvo_set_target_input(intel_encoder, true, false);
1417 intel_sdvo_set_input_timing(intel_output, &sdvo_priv->save_input_dtd_1); 1417 intel_sdvo_set_input_timing(intel_encoder, &sdvo_priv->save_input_dtd_1);
1418 } 1418 }
1419 1419
1420 if (sdvo_priv->caps.sdvo_inputs_mask & 0x2) { 1420 if (sdvo_priv->caps.sdvo_inputs_mask & 0x2) {
1421 intel_sdvo_set_target_input(intel_output, false, true); 1421 intel_sdvo_set_target_input(intel_encoder, false, true);
1422 intel_sdvo_set_input_timing(intel_output, &sdvo_priv->save_input_dtd_2); 1422 intel_sdvo_set_input_timing(intel_encoder, &sdvo_priv->save_input_dtd_2);
1423 } 1423 }
1424 1424
1425 intel_sdvo_set_clock_rate_mult(intel_output, sdvo_priv->save_sdvo_mult); 1425 intel_sdvo_set_clock_rate_mult(intel_encoder, sdvo_priv->save_sdvo_mult);
1426 1426
1427 if (sdvo_priv->is_tv) { 1427 if (sdvo_priv->is_tv) {
1428 /* XXX: Restore TV format/enhancements. */ 1428 /* XXX: Restore TV format/enhancements. */
1429 } 1429 }
1430 1430
1431 intel_sdvo_write_sdvox(intel_output, sdvo_priv->save_SDVOX); 1431 intel_sdvo_write_sdvox(intel_encoder, sdvo_priv->save_SDVOX);
1432 1432
1433 if (sdvo_priv->save_SDVOX & SDVO_ENABLE) 1433 if (sdvo_priv->save_SDVOX & SDVO_ENABLE)
1434 { 1434 {
1435 for (i = 0; i < 2; i++) 1435 for (i = 0; i < 2; i++)
1436 intel_wait_for_vblank(dev); 1436 intel_wait_for_vblank(dev);
1437 status = intel_sdvo_get_trained_inputs(intel_output, &input1, &input2); 1437 status = intel_sdvo_get_trained_inputs(intel_encoder, &input1, &input2);
1438 if (status == SDVO_CMD_STATUS_SUCCESS && !input1) 1438 if (status == SDVO_CMD_STATUS_SUCCESS && !input1)
1439 DRM_DEBUG_KMS("First %s output reported failure to " 1439 DRM_DEBUG_KMS("First %s output reported failure to "
1440 "sync\n", SDVO_NAME(sdvo_priv)); 1440 "sync\n", SDVO_NAME(sdvo_priv));
1441 } 1441 }
1442 1442
1443 intel_sdvo_set_active_outputs(intel_output, sdvo_priv->save_active_outputs); 1443 intel_sdvo_set_active_outputs(intel_encoder, sdvo_priv->save_active_outputs);
1444} 1444}
1445 1445
1446static int intel_sdvo_mode_valid(struct drm_connector *connector, 1446static int intel_sdvo_mode_valid(struct drm_connector *connector,
1447 struct drm_display_mode *mode) 1447 struct drm_display_mode *mode)
1448{ 1448{
1449 struct intel_output *intel_output = to_intel_output(connector); 1449 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1450 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1450 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1451 1451
1452 if (mode->flags & DRM_MODE_FLAG_DBLSCAN) 1452 if (mode->flags & DRM_MODE_FLAG_DBLSCAN)
1453 return MODE_NO_DBLESCAN; 1453 return MODE_NO_DBLESCAN;
@@ -1472,12 +1472,12 @@ static int intel_sdvo_mode_valid(struct drm_connector *connector,
1472 return MODE_OK; 1472 return MODE_OK;
1473} 1473}
1474 1474
1475static bool intel_sdvo_get_capabilities(struct intel_output *intel_output, struct intel_sdvo_caps *caps) 1475static bool intel_sdvo_get_capabilities(struct intel_encoder *intel_encoder, struct intel_sdvo_caps *caps)
1476{ 1476{
1477 u8 status; 1477 u8 status;
1478 1478
1479 intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_DEVICE_CAPS, NULL, 0); 1479 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_DEVICE_CAPS, NULL, 0);
1480 status = intel_sdvo_read_response(intel_output, caps, sizeof(*caps)); 1480 status = intel_sdvo_read_response(intel_encoder, caps, sizeof(*caps));
1481 if (status != SDVO_CMD_STATUS_SUCCESS) 1481 if (status != SDVO_CMD_STATUS_SUCCESS)
1482 return false; 1482 return false;
1483 1483
@@ -1487,12 +1487,12 @@ static bool intel_sdvo_get_capabilities(struct intel_output *intel_output, struc
1487struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB) 1487struct drm_connector* intel_sdvo_find(struct drm_device *dev, int sdvoB)
1488{ 1488{
1489 struct drm_connector *connector = NULL; 1489 struct drm_connector *connector = NULL;
1490 struct intel_output *iout = NULL; 1490 struct intel_encoder *iout = NULL;
1491 struct intel_sdvo_priv *sdvo; 1491 struct intel_sdvo_priv *sdvo;
1492 1492
1493 /* find the sdvo connector */ 1493 /* find the sdvo connector */
1494 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 1494 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
1495 iout = to_intel_output(connector); 1495 iout = to_intel_encoder(connector);
1496 1496
1497 if (iout->type != INTEL_OUTPUT_SDVO) 1497 if (iout->type != INTEL_OUTPUT_SDVO)
1498 continue; 1498 continue;
@@ -1514,16 +1514,16 @@ int intel_sdvo_supports_hotplug(struct drm_connector *connector)
1514{ 1514{
1515 u8 response[2]; 1515 u8 response[2];
1516 u8 status; 1516 u8 status;
1517 struct intel_output *intel_output; 1517 struct intel_encoder *intel_encoder;
1518 DRM_DEBUG_KMS("\n"); 1518 DRM_DEBUG_KMS("\n");
1519 1519
1520 if (!connector) 1520 if (!connector)
1521 return 0; 1521 return 0;
1522 1522
1523 intel_output = to_intel_output(connector); 1523 intel_encoder = to_intel_encoder(connector);
1524 1524
1525 intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_HOT_PLUG_SUPPORT, NULL, 0); 1525 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_HOT_PLUG_SUPPORT, NULL, 0);
1526 status = intel_sdvo_read_response(intel_output, &response, 2); 1526 status = intel_sdvo_read_response(intel_encoder, &response, 2);
1527 1527
1528 if (response[0] !=0) 1528 if (response[0] !=0)
1529 return 1; 1529 return 1;
@@ -1535,30 +1535,30 @@ void intel_sdvo_set_hotplug(struct drm_connector *connector, int on)
1535{ 1535{
1536 u8 response[2]; 1536 u8 response[2];
1537 u8 status; 1537 u8 status;
1538 struct intel_output *intel_output = to_intel_output(connector); 1538 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1539 1539
1540 intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_ACTIVE_HOT_PLUG, NULL, 0); 1540 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_ACTIVE_HOT_PLUG, NULL, 0);
1541 intel_sdvo_read_response(intel_output, &response, 2); 1541 intel_sdvo_read_response(intel_encoder, &response, 2);
1542 1542
1543 if (on) { 1543 if (on) {
1544 intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_HOT_PLUG_SUPPORT, NULL, 0); 1544 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_HOT_PLUG_SUPPORT, NULL, 0);
1545 status = intel_sdvo_read_response(intel_output, &response, 2); 1545 status = intel_sdvo_read_response(intel_encoder, &response, 2);
1546 1546
1547 intel_sdvo_write_cmd(intel_output, SDVO_CMD_SET_ACTIVE_HOT_PLUG, &response, 2); 1547 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_SET_ACTIVE_HOT_PLUG, &response, 2);
1548 } else { 1548 } else {
1549 response[0] = 0; 1549 response[0] = 0;
1550 response[1] = 0; 1550 response[1] = 0;
1551 intel_sdvo_write_cmd(intel_output, SDVO_CMD_SET_ACTIVE_HOT_PLUG, &response, 2); 1551 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_SET_ACTIVE_HOT_PLUG, &response, 2);
1552 } 1552 }
1553 1553
1554 intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_ACTIVE_HOT_PLUG, NULL, 0); 1554 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_ACTIVE_HOT_PLUG, NULL, 0);
1555 intel_sdvo_read_response(intel_output, &response, 2); 1555 intel_sdvo_read_response(intel_encoder, &response, 2);
1556} 1556}
1557 1557
1558static bool 1558static bool
1559intel_sdvo_multifunc_encoder(struct intel_output *intel_output) 1559intel_sdvo_multifunc_encoder(struct intel_encoder *intel_encoder)
1560{ 1560{
1561 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1561 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1562 int caps = 0; 1562 int caps = 0;
1563 1563
1564 if (sdvo_priv->caps.output_flags & 1564 if (sdvo_priv->caps.output_flags &
@@ -1592,11 +1592,11 @@ static struct drm_connector *
1592intel_find_analog_connector(struct drm_device *dev) 1592intel_find_analog_connector(struct drm_device *dev)
1593{ 1593{
1594 struct drm_connector *connector; 1594 struct drm_connector *connector;
1595 struct intel_output *intel_output; 1595 struct intel_encoder *intel_encoder;
1596 1596
1597 list_for_each_entry(connector, &dev->mode_config.connector_list, head) { 1597 list_for_each_entry(connector, &dev->mode_config.connector_list, head) {
1598 intel_output = to_intel_output(connector); 1598 intel_encoder = to_intel_encoder(connector);
1599 if (intel_output->type == INTEL_OUTPUT_ANALOG) 1599 if (intel_encoder->type == INTEL_OUTPUT_ANALOG)
1600 return connector; 1600 return connector;
1601 } 1601 }
1602 return NULL; 1602 return NULL;
@@ -1621,16 +1621,16 @@ intel_analog_is_connected(struct drm_device *dev)
1621enum drm_connector_status 1621enum drm_connector_status
1622intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response) 1622intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
1623{ 1623{
1624 struct intel_output *intel_output = to_intel_output(connector); 1624 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1625 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1625 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1626 enum drm_connector_status status = connector_status_connected; 1626 enum drm_connector_status status = connector_status_connected;
1627 struct edid *edid = NULL; 1627 struct edid *edid = NULL;
1628 1628
1629 edid = drm_get_edid(&intel_output->base, 1629 edid = drm_get_edid(&intel_encoder->base,
1630 intel_output->ddc_bus); 1630 intel_encoder->ddc_bus);
1631 1631
1632 /* This is only applied to SDVO cards with multiple outputs */ 1632 /* This is only applied to SDVO cards with multiple outputs */
1633 if (edid == NULL && intel_sdvo_multifunc_encoder(intel_output)) { 1633 if (edid == NULL && intel_sdvo_multifunc_encoder(intel_encoder)) {
1634 uint8_t saved_ddc, temp_ddc; 1634 uint8_t saved_ddc, temp_ddc;
1635 saved_ddc = sdvo_priv->ddc_bus; 1635 saved_ddc = sdvo_priv->ddc_bus;
1636 temp_ddc = sdvo_priv->ddc_bus >> 1; 1636 temp_ddc = sdvo_priv->ddc_bus >> 1;
@@ -1640,8 +1640,8 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
1640 */ 1640 */
1641 while(temp_ddc > 1) { 1641 while(temp_ddc > 1) {
1642 sdvo_priv->ddc_bus = temp_ddc; 1642 sdvo_priv->ddc_bus = temp_ddc;
1643 edid = drm_get_edid(&intel_output->base, 1643 edid = drm_get_edid(&intel_encoder->base,
1644 intel_output->ddc_bus); 1644 intel_encoder->ddc_bus);
1645 if (edid) { 1645 if (edid) {
1646 /* 1646 /*
1647 * When we can get the EDID, maybe it is the 1647 * When we can get the EDID, maybe it is the
@@ -1660,8 +1660,8 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
1660 */ 1660 */
1661 if (edid == NULL && 1661 if (edid == NULL &&
1662 sdvo_priv->analog_ddc_bus && 1662 sdvo_priv->analog_ddc_bus &&
1663 !intel_analog_is_connected(intel_output->base.dev)) 1663 !intel_analog_is_connected(intel_encoder->base.dev))
1664 edid = drm_get_edid(&intel_output->base, 1664 edid = drm_get_edid(&intel_encoder->base,
1665 sdvo_priv->analog_ddc_bus); 1665 sdvo_priv->analog_ddc_bus);
1666 if (edid != NULL) { 1666 if (edid != NULL) {
1667 /* Don't report the output as connected if it's a DVI-I 1667 /* Don't report the output as connected if it's a DVI-I
@@ -1676,7 +1676,7 @@ intel_sdvo_hdmi_sink_detect(struct drm_connector *connector, u16 response)
1676 } 1676 }
1677 1677
1678 kfree(edid); 1678 kfree(edid);
1679 intel_output->base.display_info.raw_edid = NULL; 1679 intel_encoder->base.display_info.raw_edid = NULL;
1680 1680
1681 } else if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1)) 1681 } else if (response & (SDVO_OUTPUT_TMDS0 | SDVO_OUTPUT_TMDS1))
1682 status = connector_status_disconnected; 1682 status = connector_status_disconnected;
@@ -1688,16 +1688,16 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect
1688{ 1688{
1689 uint16_t response; 1689 uint16_t response;
1690 u8 status; 1690 u8 status;
1691 struct intel_output *intel_output = to_intel_output(connector); 1691 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1692 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1692 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1693 1693
1694 intel_sdvo_write_cmd(intel_output, 1694 intel_sdvo_write_cmd(intel_encoder,
1695 SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0); 1695 SDVO_CMD_GET_ATTACHED_DISPLAYS, NULL, 0);
1696 if (sdvo_priv->is_tv) { 1696 if (sdvo_priv->is_tv) {
1697 /* add 30ms delay when the output type is SDVO-TV */ 1697 /* add 30ms delay when the output type is SDVO-TV */
1698 mdelay(30); 1698 mdelay(30);
1699 } 1699 }
1700 status = intel_sdvo_read_response(intel_output, &response, 2); 1700 status = intel_sdvo_read_response(intel_encoder, &response, 2);
1701 1701
1702 DRM_DEBUG_KMS("SDVO response %d %d\n", response & 0xff, response >> 8); 1702 DRM_DEBUG_KMS("SDVO response %d %d\n", response & 0xff, response >> 8);
1703 1703
@@ -1707,10 +1707,10 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect
1707 if (response == 0) 1707 if (response == 0)
1708 return connector_status_disconnected; 1708 return connector_status_disconnected;
1709 1709
1710 if (intel_sdvo_multifunc_encoder(intel_output) && 1710 if (intel_sdvo_multifunc_encoder(intel_encoder) &&
1711 sdvo_priv->attached_output != response) { 1711 sdvo_priv->attached_output != response) {
1712 if (sdvo_priv->controlled_output != response && 1712 if (sdvo_priv->controlled_output != response &&
1713 intel_sdvo_output_setup(intel_output, response) != true) 1713 intel_sdvo_output_setup(intel_encoder, response) != true)
1714 return connector_status_unknown; 1714 return connector_status_unknown;
1715 sdvo_priv->attached_output = response; 1715 sdvo_priv->attached_output = response;
1716 } 1716 }
@@ -1719,12 +1719,12 @@ static enum drm_connector_status intel_sdvo_detect(struct drm_connector *connect
1719 1719
1720static void intel_sdvo_get_ddc_modes(struct drm_connector *connector) 1720static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)
1721{ 1721{
1722 struct intel_output *intel_output = to_intel_output(connector); 1722 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1723 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1723 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1724 int num_modes; 1724 int num_modes;
1725 1725
1726 /* set the bus switch and get the modes */ 1726 /* set the bus switch and get the modes */
1727 num_modes = intel_ddc_get_modes(intel_output); 1727 num_modes = intel_ddc_get_modes(intel_encoder);
1728 1728
1729 /* 1729 /*
1730 * Mac mini hack. On this device, the DVI-I connector shares one DDC 1730 * Mac mini hack. On this device, the DVI-I connector shares one DDC
@@ -1734,17 +1734,17 @@ static void intel_sdvo_get_ddc_modes(struct drm_connector *connector)
1734 */ 1734 */
1735 if (num_modes == 0 && 1735 if (num_modes == 0 &&
1736 sdvo_priv->analog_ddc_bus && 1736 sdvo_priv->analog_ddc_bus &&
1737 !intel_analog_is_connected(intel_output->base.dev)) { 1737 !intel_analog_is_connected(intel_encoder->base.dev)) {
1738 struct i2c_adapter *digital_ddc_bus; 1738 struct i2c_adapter *digital_ddc_bus;
1739 1739
1740 /* Switch to the analog ddc bus and try that 1740 /* Switch to the analog ddc bus and try that
1741 */ 1741 */
1742 digital_ddc_bus = intel_output->ddc_bus; 1742 digital_ddc_bus = intel_encoder->ddc_bus;
1743 intel_output->ddc_bus = sdvo_priv->analog_ddc_bus; 1743 intel_encoder->ddc_bus = sdvo_priv->analog_ddc_bus;
1744 1744
1745 (void) intel_ddc_get_modes(intel_output); 1745 (void) intel_ddc_get_modes(intel_encoder);
1746 1746
1747 intel_output->ddc_bus = digital_ddc_bus; 1747 intel_encoder->ddc_bus = digital_ddc_bus;
1748 } 1748 }
1749} 1749}
1750 1750
@@ -1815,7 +1815,7 @@ struct drm_display_mode sdvo_tv_modes[] = {
1815 1815
1816static void intel_sdvo_get_tv_modes(struct drm_connector *connector) 1816static void intel_sdvo_get_tv_modes(struct drm_connector *connector)
1817{ 1817{
1818 struct intel_output *output = to_intel_output(connector); 1818 struct intel_encoder *output = to_intel_encoder(connector);
1819 struct intel_sdvo_priv *sdvo_priv = output->dev_priv; 1819 struct intel_sdvo_priv *sdvo_priv = output->dev_priv;
1820 struct intel_sdvo_sdtv_resolution_request tv_res; 1820 struct intel_sdvo_sdtv_resolution_request tv_res;
1821 uint32_t reply = 0, format_map = 0; 1821 uint32_t reply = 0, format_map = 0;
@@ -1857,9 +1857,9 @@ static void intel_sdvo_get_tv_modes(struct drm_connector *connector)
1857 1857
1858static void intel_sdvo_get_lvds_modes(struct drm_connector *connector) 1858static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
1859{ 1859{
1860 struct intel_output *intel_output = to_intel_output(connector); 1860 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1861 struct drm_i915_private *dev_priv = connector->dev->dev_private; 1861 struct drm_i915_private *dev_priv = connector->dev->dev_private;
1862 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1862 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1863 struct drm_display_mode *newmode; 1863 struct drm_display_mode *newmode;
1864 1864
1865 /* 1865 /*
@@ -1867,7 +1867,7 @@ static void intel_sdvo_get_lvds_modes(struct drm_connector *connector)
1867 * Assume that the preferred modes are 1867 * Assume that the preferred modes are
1868 * arranged in priority order. 1868 * arranged in priority order.
1869 */ 1869 */
1870 intel_ddc_get_modes(intel_output); 1870 intel_ddc_get_modes(intel_encoder);
1871 if (list_empty(&connector->probed_modes) == false) 1871 if (list_empty(&connector->probed_modes) == false)
1872 goto end; 1872 goto end;
1873 1873
@@ -1896,7 +1896,7 @@ end:
1896 1896
1897static int intel_sdvo_get_modes(struct drm_connector *connector) 1897static int intel_sdvo_get_modes(struct drm_connector *connector)
1898{ 1898{
1899 struct intel_output *output = to_intel_output(connector); 1899 struct intel_encoder *output = to_intel_encoder(connector);
1900 struct intel_sdvo_priv *sdvo_priv = output->dev_priv; 1900 struct intel_sdvo_priv *sdvo_priv = output->dev_priv;
1901 1901
1902 if (sdvo_priv->is_tv) 1902 if (sdvo_priv->is_tv)
@@ -1914,8 +1914,8 @@ static int intel_sdvo_get_modes(struct drm_connector *connector)
1914static 1914static
1915void intel_sdvo_destroy_enhance_property(struct drm_connector *connector) 1915void intel_sdvo_destroy_enhance_property(struct drm_connector *connector)
1916{ 1916{
1917 struct intel_output *intel_output = to_intel_output(connector); 1917 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1918 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1918 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1919 struct drm_device *dev = connector->dev; 1919 struct drm_device *dev = connector->dev;
1920 1920
1921 if (sdvo_priv->is_tv) { 1921 if (sdvo_priv->is_tv) {
@@ -1952,13 +1952,13 @@ void intel_sdvo_destroy_enhance_property(struct drm_connector *connector)
1952 1952
1953static void intel_sdvo_destroy(struct drm_connector *connector) 1953static void intel_sdvo_destroy(struct drm_connector *connector)
1954{ 1954{
1955 struct intel_output *intel_output = to_intel_output(connector); 1955 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1956 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1956 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1957 1957
1958 if (intel_output->i2c_bus) 1958 if (intel_encoder->i2c_bus)
1959 intel_i2c_destroy(intel_output->i2c_bus); 1959 intel_i2c_destroy(intel_encoder->i2c_bus);
1960 if (intel_output->ddc_bus) 1960 if (intel_encoder->ddc_bus)
1961 intel_i2c_destroy(intel_output->ddc_bus); 1961 intel_i2c_destroy(intel_encoder->ddc_bus);
1962 if (sdvo_priv->analog_ddc_bus) 1962 if (sdvo_priv->analog_ddc_bus)
1963 intel_i2c_destroy(sdvo_priv->analog_ddc_bus); 1963 intel_i2c_destroy(sdvo_priv->analog_ddc_bus);
1964 1964
@@ -1976,7 +1976,7 @@ static void intel_sdvo_destroy(struct drm_connector *connector)
1976 drm_sysfs_connector_remove(connector); 1976 drm_sysfs_connector_remove(connector);
1977 drm_connector_cleanup(connector); 1977 drm_connector_cleanup(connector);
1978 1978
1979 kfree(intel_output); 1979 kfree(intel_encoder);
1980} 1980}
1981 1981
1982static int 1982static int
@@ -1984,9 +1984,9 @@ intel_sdvo_set_property(struct drm_connector *connector,
1984 struct drm_property *property, 1984 struct drm_property *property,
1985 uint64_t val) 1985 uint64_t val)
1986{ 1986{
1987 struct intel_output *intel_output = to_intel_output(connector); 1987 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1988 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 1988 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
1989 struct drm_encoder *encoder = &intel_output->enc; 1989 struct drm_encoder *encoder = &intel_encoder->enc;
1990 struct drm_crtc *crtc = encoder->crtc; 1990 struct drm_crtc *crtc = encoder->crtc;
1991 int ret = 0; 1991 int ret = 0;
1992 bool changed = false; 1992 bool changed = false;
@@ -2094,8 +2094,8 @@ intel_sdvo_set_property(struct drm_connector *connector,
2094 sdvo_priv->cur_brightness = temp_value; 2094 sdvo_priv->cur_brightness = temp_value;
2095 } 2095 }
2096 if (cmd) { 2096 if (cmd) {
2097 intel_sdvo_write_cmd(intel_output, cmd, &temp_value, 2); 2097 intel_sdvo_write_cmd(intel_encoder, cmd, &temp_value, 2);
2098 status = intel_sdvo_read_response(intel_output, 2098 status = intel_sdvo_read_response(intel_encoder,
2099 NULL, 0); 2099 NULL, 0);
2100 if (status != SDVO_CMD_STATUS_SUCCESS) { 2100 if (status != SDVO_CMD_STATUS_SUCCESS) {
2101 DRM_DEBUG_KMS("Incorrect SDVO command \n"); 2101 DRM_DEBUG_KMS("Incorrect SDVO command \n");
@@ -2190,7 +2190,7 @@ intel_sdvo_select_ddc_bus(struct intel_sdvo_priv *dev_priv)
2190} 2190}
2191 2191
2192static bool 2192static bool
2193intel_sdvo_get_digital_encoding_mode(struct intel_output *output) 2193intel_sdvo_get_digital_encoding_mode(struct intel_encoder *output)
2194{ 2194{
2195 struct intel_sdvo_priv *sdvo_priv = output->dev_priv; 2195 struct intel_sdvo_priv *sdvo_priv = output->dev_priv;
2196 uint8_t status; 2196 uint8_t status;
@@ -2204,42 +2204,42 @@ intel_sdvo_get_digital_encoding_mode(struct intel_output *output)
2204 return true; 2204 return true;
2205} 2205}
2206 2206
2207static struct intel_output * 2207static struct intel_encoder *
2208intel_sdvo_chan_to_intel_output(struct intel_i2c_chan *chan) 2208intel_sdvo_chan_to_intel_encoder(struct intel_i2c_chan *chan)
2209{ 2209{
2210 struct drm_device *dev = chan->drm_dev; 2210 struct drm_device *dev = chan->drm_dev;
2211 struct drm_connector *connector; 2211 struct drm_connector *connector;
2212 struct intel_output *intel_output = NULL; 2212 struct intel_encoder *intel_encoder = NULL;
2213 2213
2214 list_for_each_entry(connector, 2214 list_for_each_entry(connector,
2215 &dev->mode_config.connector_list, head) { 2215 &dev->mode_config.connector_list, head) {
2216 if (to_intel_output(connector)->ddc_bus == &chan->adapter) { 2216 if (to_intel_encoder(connector)->ddc_bus == &chan->adapter) {
2217 intel_output = to_intel_output(connector); 2217 intel_encoder = to_intel_encoder(connector);
2218 break; 2218 break;
2219 } 2219 }
2220 } 2220 }
2221 return intel_output; 2221 return intel_encoder;
2222} 2222}
2223 2223
2224static int intel_sdvo_master_xfer(struct i2c_adapter *i2c_adap, 2224static int intel_sdvo_master_xfer(struct i2c_adapter *i2c_adap,
2225 struct i2c_msg msgs[], int num) 2225 struct i2c_msg msgs[], int num)
2226{ 2226{
2227 struct intel_output *intel_output; 2227 struct intel_encoder *intel_encoder;
2228 struct intel_sdvo_priv *sdvo_priv; 2228 struct intel_sdvo_priv *sdvo_priv;
2229 struct i2c_algo_bit_data *algo_data; 2229 struct i2c_algo_bit_data *algo_data;
2230 const struct i2c_algorithm *algo; 2230 const struct i2c_algorithm *algo;
2231 2231
2232 algo_data = (struct i2c_algo_bit_data *)i2c_adap->algo_data; 2232 algo_data = (struct i2c_algo_bit_data *)i2c_adap->algo_data;
2233 intel_output = 2233 intel_encoder =
2234 intel_sdvo_chan_to_intel_output( 2234 intel_sdvo_chan_to_intel_encoder(
2235 (struct intel_i2c_chan *)(algo_data->data)); 2235 (struct intel_i2c_chan *)(algo_data->data));
2236 if (intel_output == NULL) 2236 if (intel_encoder == NULL)
2237 return -EINVAL; 2237 return -EINVAL;
2238 2238
2239 sdvo_priv = intel_output->dev_priv; 2239 sdvo_priv = intel_encoder->dev_priv;
2240 algo = intel_output->i2c_bus->algo; 2240 algo = intel_encoder->i2c_bus->algo;
2241 2241
2242 intel_sdvo_set_control_bus_switch(intel_output, sdvo_priv->ddc_bus); 2242 intel_sdvo_set_control_bus_switch(intel_encoder, sdvo_priv->ddc_bus);
2243 return algo->master_xfer(i2c_adap, msgs, num); 2243 return algo->master_xfer(i2c_adap, msgs, num);
2244} 2244}
2245 2245
@@ -2304,15 +2304,15 @@ static struct dmi_system_id intel_sdvo_bad_tv[] = {
2304}; 2304};
2305 2305
2306static bool 2306static bool
2307intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags) 2307intel_sdvo_output_setup(struct intel_encoder *intel_encoder, uint16_t flags)
2308{ 2308{
2309 struct drm_connector *connector = &intel_output->base; 2309 struct drm_connector *connector = &intel_encoder->base;
2310 struct drm_encoder *encoder = &intel_output->enc; 2310 struct drm_encoder *encoder = &intel_encoder->enc;
2311 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 2311 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
2312 bool ret = true, registered = false; 2312 bool ret = true, registered = false;
2313 2313
2314 sdvo_priv->is_tv = false; 2314 sdvo_priv->is_tv = false;
2315 intel_output->needs_tv_clock = false; 2315 intel_encoder->needs_tv_clock = false;
2316 sdvo_priv->is_lvds = false; 2316 sdvo_priv->is_lvds = false;
2317 2317
2318 if (device_is_registered(&connector->kdev)) { 2318 if (device_is_registered(&connector->kdev)) {
@@ -2330,16 +2330,16 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags)
2330 encoder->encoder_type = DRM_MODE_ENCODER_TMDS; 2330 encoder->encoder_type = DRM_MODE_ENCODER_TMDS;
2331 connector->connector_type = DRM_MODE_CONNECTOR_DVID; 2331 connector->connector_type = DRM_MODE_CONNECTOR_DVID;
2332 2332
2333 if (intel_sdvo_get_supp_encode(intel_output, 2333 if (intel_sdvo_get_supp_encode(intel_encoder,
2334 &sdvo_priv->encode) && 2334 &sdvo_priv->encode) &&
2335 intel_sdvo_get_digital_encoding_mode(intel_output) && 2335 intel_sdvo_get_digital_encoding_mode(intel_encoder) &&
2336 sdvo_priv->is_hdmi) { 2336 sdvo_priv->is_hdmi) {
2337 /* enable hdmi encoding mode if supported */ 2337 /* enable hdmi encoding mode if supported */
2338 intel_sdvo_set_encode(intel_output, SDVO_ENCODE_HDMI); 2338 intel_sdvo_set_encode(intel_encoder, SDVO_ENCODE_HDMI);
2339 intel_sdvo_set_colorimetry(intel_output, 2339 intel_sdvo_set_colorimetry(intel_encoder,
2340 SDVO_COLORIMETRY_RGB256); 2340 SDVO_COLORIMETRY_RGB256);
2341 connector->connector_type = DRM_MODE_CONNECTOR_HDMIA; 2341 connector->connector_type = DRM_MODE_CONNECTOR_HDMIA;
2342 intel_output->clone_mask = 2342 intel_encoder->clone_mask =
2343 (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | 2343 (1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
2344 (1 << INTEL_ANALOG_CLONE_BIT); 2344 (1 << INTEL_ANALOG_CLONE_BIT);
2345 } 2345 }
@@ -2350,21 +2350,21 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags)
2350 encoder->encoder_type = DRM_MODE_ENCODER_TVDAC; 2350 encoder->encoder_type = DRM_MODE_ENCODER_TVDAC;
2351 connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO; 2351 connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO;
2352 sdvo_priv->is_tv = true; 2352 sdvo_priv->is_tv = true;
2353 intel_output->needs_tv_clock = true; 2353 intel_encoder->needs_tv_clock = true;
2354 intel_output->clone_mask = 1 << INTEL_SDVO_TV_CLONE_BIT; 2354 intel_encoder->clone_mask = 1 << INTEL_SDVO_TV_CLONE_BIT;
2355 } else if (flags & SDVO_OUTPUT_RGB0) { 2355 } else if (flags & SDVO_OUTPUT_RGB0) {
2356 2356
2357 sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0; 2357 sdvo_priv->controlled_output = SDVO_OUTPUT_RGB0;
2358 encoder->encoder_type = DRM_MODE_ENCODER_DAC; 2358 encoder->encoder_type = DRM_MODE_ENCODER_DAC;
2359 connector->connector_type = DRM_MODE_CONNECTOR_VGA; 2359 connector->connector_type = DRM_MODE_CONNECTOR_VGA;
2360 intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | 2360 intel_encoder->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
2361 (1 << INTEL_ANALOG_CLONE_BIT); 2361 (1 << INTEL_ANALOG_CLONE_BIT);
2362 } else if (flags & SDVO_OUTPUT_RGB1) { 2362 } else if (flags & SDVO_OUTPUT_RGB1) {
2363 2363
2364 sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1; 2364 sdvo_priv->controlled_output = SDVO_OUTPUT_RGB1;
2365 encoder->encoder_type = DRM_MODE_ENCODER_DAC; 2365 encoder->encoder_type = DRM_MODE_ENCODER_DAC;
2366 connector->connector_type = DRM_MODE_CONNECTOR_VGA; 2366 connector->connector_type = DRM_MODE_CONNECTOR_VGA;
2367 intel_output->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) | 2367 intel_encoder->clone_mask = (1 << INTEL_SDVO_NON_TV_CLONE_BIT) |
2368 (1 << INTEL_ANALOG_CLONE_BIT); 2368 (1 << INTEL_ANALOG_CLONE_BIT);
2369 } else if (flags & SDVO_OUTPUT_CVBS0) { 2369 } else if (flags & SDVO_OUTPUT_CVBS0) {
2370 2370
@@ -2372,15 +2372,15 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags)
2372 encoder->encoder_type = DRM_MODE_ENCODER_TVDAC; 2372 encoder->encoder_type = DRM_MODE_ENCODER_TVDAC;
2373 connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO; 2373 connector->connector_type = DRM_MODE_CONNECTOR_SVIDEO;
2374 sdvo_priv->is_tv = true; 2374 sdvo_priv->is_tv = true;
2375 intel_output->needs_tv_clock = true; 2375 intel_encoder->needs_tv_clock = true;
2376 intel_output->clone_mask = 1 << INTEL_SDVO_TV_CLONE_BIT; 2376 intel_encoder->clone_mask = 1 << INTEL_SDVO_TV_CLONE_BIT;
2377 } else if (flags & SDVO_OUTPUT_LVDS0) { 2377 } else if (flags & SDVO_OUTPUT_LVDS0) {
2378 2378
2379 sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS0; 2379 sdvo_priv->controlled_output = SDVO_OUTPUT_LVDS0;
2380 encoder->encoder_type = DRM_MODE_ENCODER_LVDS; 2380 encoder->encoder_type = DRM_MODE_ENCODER_LVDS;
2381 connector->connector_type = DRM_MODE_CONNECTOR_LVDS; 2381 connector->connector_type = DRM_MODE_CONNECTOR_LVDS;
2382 sdvo_priv->is_lvds = true; 2382 sdvo_priv->is_lvds = true;
2383 intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT) | 2383 intel_encoder->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT) |
2384 (1 << INTEL_SDVO_LVDS_CLONE_BIT); 2384 (1 << INTEL_SDVO_LVDS_CLONE_BIT);
2385 } else if (flags & SDVO_OUTPUT_LVDS1) { 2385 } else if (flags & SDVO_OUTPUT_LVDS1) {
2386 2386
@@ -2388,7 +2388,7 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags)
2388 encoder->encoder_type = DRM_MODE_ENCODER_LVDS; 2388 encoder->encoder_type = DRM_MODE_ENCODER_LVDS;
2389 connector->connector_type = DRM_MODE_CONNECTOR_LVDS; 2389 connector->connector_type = DRM_MODE_CONNECTOR_LVDS;
2390 sdvo_priv->is_lvds = true; 2390 sdvo_priv->is_lvds = true;
2391 intel_output->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT) | 2391 intel_encoder->clone_mask = (1 << INTEL_ANALOG_CLONE_BIT) |
2392 (1 << INTEL_SDVO_LVDS_CLONE_BIT); 2392 (1 << INTEL_SDVO_LVDS_CLONE_BIT);
2393 } else { 2393 } else {
2394 2394
@@ -2401,7 +2401,7 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags)
2401 bytes[0], bytes[1]); 2401 bytes[0], bytes[1]);
2402 ret = false; 2402 ret = false;
2403 } 2403 }
2404 intel_output->crtc_mask = (1 << 0) | (1 << 1); 2404 intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
2405 2405
2406 if (ret && registered) 2406 if (ret && registered)
2407 ret = drm_sysfs_connector_add(connector) == 0 ? true : false; 2407 ret = drm_sysfs_connector_add(connector) == 0 ? true : false;
@@ -2413,18 +2413,18 @@ intel_sdvo_output_setup(struct intel_output *intel_output, uint16_t flags)
2413 2413
2414static void intel_sdvo_tv_create_property(struct drm_connector *connector) 2414static void intel_sdvo_tv_create_property(struct drm_connector *connector)
2415{ 2415{
2416 struct intel_output *intel_output = to_intel_output(connector); 2416 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
2417 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 2417 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
2418 struct intel_sdvo_tv_format format; 2418 struct intel_sdvo_tv_format format;
2419 uint32_t format_map, i; 2419 uint32_t format_map, i;
2420 uint8_t status; 2420 uint8_t status;
2421 2421
2422 intel_sdvo_set_target_output(intel_output, 2422 intel_sdvo_set_target_output(intel_encoder,
2423 sdvo_priv->controlled_output); 2423 sdvo_priv->controlled_output);
2424 2424
2425 intel_sdvo_write_cmd(intel_output, 2425 intel_sdvo_write_cmd(intel_encoder,
2426 SDVO_CMD_GET_SUPPORTED_TV_FORMATS, NULL, 0); 2426 SDVO_CMD_GET_SUPPORTED_TV_FORMATS, NULL, 0);
2427 status = intel_sdvo_read_response(intel_output, 2427 status = intel_sdvo_read_response(intel_encoder,
2428 &format, sizeof(format)); 2428 &format, sizeof(format));
2429 if (status != SDVO_CMD_STATUS_SUCCESS) 2429 if (status != SDVO_CMD_STATUS_SUCCESS)
2430 return; 2430 return;
@@ -2462,16 +2462,16 @@ static void intel_sdvo_tv_create_property(struct drm_connector *connector)
2462 2462
2463static void intel_sdvo_create_enhance_property(struct drm_connector *connector) 2463static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2464{ 2464{
2465 struct intel_output *intel_output = to_intel_output(connector); 2465 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
2466 struct intel_sdvo_priv *sdvo_priv = intel_output->dev_priv; 2466 struct intel_sdvo_priv *sdvo_priv = intel_encoder->dev_priv;
2467 struct intel_sdvo_enhancements_reply sdvo_data; 2467 struct intel_sdvo_enhancements_reply sdvo_data;
2468 struct drm_device *dev = connector->dev; 2468 struct drm_device *dev = connector->dev;
2469 uint8_t status; 2469 uint8_t status;
2470 uint16_t response, data_value[2]; 2470 uint16_t response, data_value[2];
2471 2471
2472 intel_sdvo_write_cmd(intel_output, SDVO_CMD_GET_SUPPORTED_ENHANCEMENTS, 2472 intel_sdvo_write_cmd(intel_encoder, SDVO_CMD_GET_SUPPORTED_ENHANCEMENTS,
2473 NULL, 0); 2473 NULL, 0);
2474 status = intel_sdvo_read_response(intel_output, &sdvo_data, 2474 status = intel_sdvo_read_response(intel_encoder, &sdvo_data,
2475 sizeof(sdvo_data)); 2475 sizeof(sdvo_data));
2476 if (status != SDVO_CMD_STATUS_SUCCESS) { 2476 if (status != SDVO_CMD_STATUS_SUCCESS) {
2477 DRM_DEBUG_KMS(" incorrect response is returned\n"); 2477 DRM_DEBUG_KMS(" incorrect response is returned\n");
@@ -2487,18 +2487,18 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2487 * property 2487 * property
2488 */ 2488 */
2489 if (sdvo_data.overscan_h) { 2489 if (sdvo_data.overscan_h) {
2490 intel_sdvo_write_cmd(intel_output, 2490 intel_sdvo_write_cmd(intel_encoder,
2491 SDVO_CMD_GET_MAX_OVERSCAN_H, NULL, 0); 2491 SDVO_CMD_GET_MAX_OVERSCAN_H, NULL, 0);
2492 status = intel_sdvo_read_response(intel_output, 2492 status = intel_sdvo_read_response(intel_encoder,
2493 &data_value, 4); 2493 &data_value, 4);
2494 if (status != SDVO_CMD_STATUS_SUCCESS) { 2494 if (status != SDVO_CMD_STATUS_SUCCESS) {
2495 DRM_DEBUG_KMS("Incorrect SDVO max " 2495 DRM_DEBUG_KMS("Incorrect SDVO max "
2496 "h_overscan\n"); 2496 "h_overscan\n");
2497 return; 2497 return;
2498 } 2498 }
2499 intel_sdvo_write_cmd(intel_output, 2499 intel_sdvo_write_cmd(intel_encoder,
2500 SDVO_CMD_GET_OVERSCAN_H, NULL, 0); 2500 SDVO_CMD_GET_OVERSCAN_H, NULL, 0);
2501 status = intel_sdvo_read_response(intel_output, 2501 status = intel_sdvo_read_response(intel_encoder,
2502 &response, 2); 2502 &response, 2);
2503 if (status != SDVO_CMD_STATUS_SUCCESS) { 2503 if (status != SDVO_CMD_STATUS_SUCCESS) {
2504 DRM_DEBUG_KMS("Incorrect SDVO h_overscan\n"); 2504 DRM_DEBUG_KMS("Incorrect SDVO h_overscan\n");
@@ -2528,18 +2528,18 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2528 data_value[0], data_value[1], response); 2528 data_value[0], data_value[1], response);
2529 } 2529 }
2530 if (sdvo_data.overscan_v) { 2530 if (sdvo_data.overscan_v) {
2531 intel_sdvo_write_cmd(intel_output, 2531 intel_sdvo_write_cmd(intel_encoder,
2532 SDVO_CMD_GET_MAX_OVERSCAN_V, NULL, 0); 2532 SDVO_CMD_GET_MAX_OVERSCAN_V, NULL, 0);
2533 status = intel_sdvo_read_response(intel_output, 2533 status = intel_sdvo_read_response(intel_encoder,
2534 &data_value, 4); 2534 &data_value, 4);
2535 if (status != SDVO_CMD_STATUS_SUCCESS) { 2535 if (status != SDVO_CMD_STATUS_SUCCESS) {
2536 DRM_DEBUG_KMS("Incorrect SDVO max " 2536 DRM_DEBUG_KMS("Incorrect SDVO max "
2537 "v_overscan\n"); 2537 "v_overscan\n");
2538 return; 2538 return;
2539 } 2539 }
2540 intel_sdvo_write_cmd(intel_output, 2540 intel_sdvo_write_cmd(intel_encoder,
2541 SDVO_CMD_GET_OVERSCAN_V, NULL, 0); 2541 SDVO_CMD_GET_OVERSCAN_V, NULL, 0);
2542 status = intel_sdvo_read_response(intel_output, 2542 status = intel_sdvo_read_response(intel_encoder,
2543 &response, 2); 2543 &response, 2);
2544 if (status != SDVO_CMD_STATUS_SUCCESS) { 2544 if (status != SDVO_CMD_STATUS_SUCCESS) {
2545 DRM_DEBUG_KMS("Incorrect SDVO v_overscan\n"); 2545 DRM_DEBUG_KMS("Incorrect SDVO v_overscan\n");
@@ -2569,17 +2569,17 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2569 data_value[0], data_value[1], response); 2569 data_value[0], data_value[1], response);
2570 } 2570 }
2571 if (sdvo_data.position_h) { 2571 if (sdvo_data.position_h) {
2572 intel_sdvo_write_cmd(intel_output, 2572 intel_sdvo_write_cmd(intel_encoder,
2573 SDVO_CMD_GET_MAX_POSITION_H, NULL, 0); 2573 SDVO_CMD_GET_MAX_POSITION_H, NULL, 0);
2574 status = intel_sdvo_read_response(intel_output, 2574 status = intel_sdvo_read_response(intel_encoder,
2575 &data_value, 4); 2575 &data_value, 4);
2576 if (status != SDVO_CMD_STATUS_SUCCESS) { 2576 if (status != SDVO_CMD_STATUS_SUCCESS) {
2577 DRM_DEBUG_KMS("Incorrect SDVO Max h_pos\n"); 2577 DRM_DEBUG_KMS("Incorrect SDVO Max h_pos\n");
2578 return; 2578 return;
2579 } 2579 }
2580 intel_sdvo_write_cmd(intel_output, 2580 intel_sdvo_write_cmd(intel_encoder,
2581 SDVO_CMD_GET_POSITION_H, NULL, 0); 2581 SDVO_CMD_GET_POSITION_H, NULL, 0);
2582 status = intel_sdvo_read_response(intel_output, 2582 status = intel_sdvo_read_response(intel_encoder,
2583 &response, 2); 2583 &response, 2);
2584 if (status != SDVO_CMD_STATUS_SUCCESS) { 2584 if (status != SDVO_CMD_STATUS_SUCCESS) {
2585 DRM_DEBUG_KMS("Incorrect SDVO get h_postion\n"); 2585 DRM_DEBUG_KMS("Incorrect SDVO get h_postion\n");
@@ -2600,17 +2600,17 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2600 data_value[0], data_value[1], response); 2600 data_value[0], data_value[1], response);
2601 } 2601 }
2602 if (sdvo_data.position_v) { 2602 if (sdvo_data.position_v) {
2603 intel_sdvo_write_cmd(intel_output, 2603 intel_sdvo_write_cmd(intel_encoder,
2604 SDVO_CMD_GET_MAX_POSITION_V, NULL, 0); 2604 SDVO_CMD_GET_MAX_POSITION_V, NULL, 0);
2605 status = intel_sdvo_read_response(intel_output, 2605 status = intel_sdvo_read_response(intel_encoder,
2606 &data_value, 4); 2606 &data_value, 4);
2607 if (status != SDVO_CMD_STATUS_SUCCESS) { 2607 if (status != SDVO_CMD_STATUS_SUCCESS) {
2608 DRM_DEBUG_KMS("Incorrect SDVO Max v_pos\n"); 2608 DRM_DEBUG_KMS("Incorrect SDVO Max v_pos\n");
2609 return; 2609 return;
2610 } 2610 }
2611 intel_sdvo_write_cmd(intel_output, 2611 intel_sdvo_write_cmd(intel_encoder,
2612 SDVO_CMD_GET_POSITION_V, NULL, 0); 2612 SDVO_CMD_GET_POSITION_V, NULL, 0);
2613 status = intel_sdvo_read_response(intel_output, 2613 status = intel_sdvo_read_response(intel_encoder,
2614 &response, 2); 2614 &response, 2);
2615 if (status != SDVO_CMD_STATUS_SUCCESS) { 2615 if (status != SDVO_CMD_STATUS_SUCCESS) {
2616 DRM_DEBUG_KMS("Incorrect SDVO get v_postion\n"); 2616 DRM_DEBUG_KMS("Incorrect SDVO get v_postion\n");
@@ -2633,17 +2633,17 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2633 } 2633 }
2634 if (sdvo_priv->is_tv) { 2634 if (sdvo_priv->is_tv) {
2635 if (sdvo_data.saturation) { 2635 if (sdvo_data.saturation) {
2636 intel_sdvo_write_cmd(intel_output, 2636 intel_sdvo_write_cmd(intel_encoder,
2637 SDVO_CMD_GET_MAX_SATURATION, NULL, 0); 2637 SDVO_CMD_GET_MAX_SATURATION, NULL, 0);
2638 status = intel_sdvo_read_response(intel_output, 2638 status = intel_sdvo_read_response(intel_encoder,
2639 &data_value, 4); 2639 &data_value, 4);
2640 if (status != SDVO_CMD_STATUS_SUCCESS) { 2640 if (status != SDVO_CMD_STATUS_SUCCESS) {
2641 DRM_DEBUG_KMS("Incorrect SDVO Max sat\n"); 2641 DRM_DEBUG_KMS("Incorrect SDVO Max sat\n");
2642 return; 2642 return;
2643 } 2643 }
2644 intel_sdvo_write_cmd(intel_output, 2644 intel_sdvo_write_cmd(intel_encoder,
2645 SDVO_CMD_GET_SATURATION, NULL, 0); 2645 SDVO_CMD_GET_SATURATION, NULL, 0);
2646 status = intel_sdvo_read_response(intel_output, 2646 status = intel_sdvo_read_response(intel_encoder,
2647 &response, 2); 2647 &response, 2);
2648 if (status != SDVO_CMD_STATUS_SUCCESS) { 2648 if (status != SDVO_CMD_STATUS_SUCCESS) {
2649 DRM_DEBUG_KMS("Incorrect SDVO get sat\n"); 2649 DRM_DEBUG_KMS("Incorrect SDVO get sat\n");
@@ -2665,17 +2665,17 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2665 data_value[0], data_value[1], response); 2665 data_value[0], data_value[1], response);
2666 } 2666 }
2667 if (sdvo_data.contrast) { 2667 if (sdvo_data.contrast) {
2668 intel_sdvo_write_cmd(intel_output, 2668 intel_sdvo_write_cmd(intel_encoder,
2669 SDVO_CMD_GET_MAX_CONTRAST, NULL, 0); 2669 SDVO_CMD_GET_MAX_CONTRAST, NULL, 0);
2670 status = intel_sdvo_read_response(intel_output, 2670 status = intel_sdvo_read_response(intel_encoder,
2671 &data_value, 4); 2671 &data_value, 4);
2672 if (status != SDVO_CMD_STATUS_SUCCESS) { 2672 if (status != SDVO_CMD_STATUS_SUCCESS) {
2673 DRM_DEBUG_KMS("Incorrect SDVO Max contrast\n"); 2673 DRM_DEBUG_KMS("Incorrect SDVO Max contrast\n");
2674 return; 2674 return;
2675 } 2675 }
2676 intel_sdvo_write_cmd(intel_output, 2676 intel_sdvo_write_cmd(intel_encoder,
2677 SDVO_CMD_GET_CONTRAST, NULL, 0); 2677 SDVO_CMD_GET_CONTRAST, NULL, 0);
2678 status = intel_sdvo_read_response(intel_output, 2678 status = intel_sdvo_read_response(intel_encoder,
2679 &response, 2); 2679 &response, 2);
2680 if (status != SDVO_CMD_STATUS_SUCCESS) { 2680 if (status != SDVO_CMD_STATUS_SUCCESS) {
2681 DRM_DEBUG_KMS("Incorrect SDVO get contrast\n"); 2681 DRM_DEBUG_KMS("Incorrect SDVO get contrast\n");
@@ -2696,17 +2696,17 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2696 data_value[0], data_value[1], response); 2696 data_value[0], data_value[1], response);
2697 } 2697 }
2698 if (sdvo_data.hue) { 2698 if (sdvo_data.hue) {
2699 intel_sdvo_write_cmd(intel_output, 2699 intel_sdvo_write_cmd(intel_encoder,
2700 SDVO_CMD_GET_MAX_HUE, NULL, 0); 2700 SDVO_CMD_GET_MAX_HUE, NULL, 0);
2701 status = intel_sdvo_read_response(intel_output, 2701 status = intel_sdvo_read_response(intel_encoder,
2702 &data_value, 4); 2702 &data_value, 4);
2703 if (status != SDVO_CMD_STATUS_SUCCESS) { 2703 if (status != SDVO_CMD_STATUS_SUCCESS) {
2704 DRM_DEBUG_KMS("Incorrect SDVO Max hue\n"); 2704 DRM_DEBUG_KMS("Incorrect SDVO Max hue\n");
2705 return; 2705 return;
2706 } 2706 }
2707 intel_sdvo_write_cmd(intel_output, 2707 intel_sdvo_write_cmd(intel_encoder,
2708 SDVO_CMD_GET_HUE, NULL, 0); 2708 SDVO_CMD_GET_HUE, NULL, 0);
2709 status = intel_sdvo_read_response(intel_output, 2709 status = intel_sdvo_read_response(intel_encoder,
2710 &response, 2); 2710 &response, 2);
2711 if (status != SDVO_CMD_STATUS_SUCCESS) { 2711 if (status != SDVO_CMD_STATUS_SUCCESS) {
2712 DRM_DEBUG_KMS("Incorrect SDVO get hue\n"); 2712 DRM_DEBUG_KMS("Incorrect SDVO get hue\n");
@@ -2729,17 +2729,17 @@ static void intel_sdvo_create_enhance_property(struct drm_connector *connector)
2729 } 2729 }
2730 if (sdvo_priv->is_tv || sdvo_priv->is_lvds) { 2730 if (sdvo_priv->is_tv || sdvo_priv->is_lvds) {
2731 if (sdvo_data.brightness) { 2731 if (sdvo_data.brightness) {
2732 intel_sdvo_write_cmd(intel_output, 2732 intel_sdvo_write_cmd(intel_encoder,
2733 SDVO_CMD_GET_MAX_BRIGHTNESS, NULL, 0); 2733 SDVO_CMD_GET_MAX_BRIGHTNESS, NULL, 0);
2734 status = intel_sdvo_read_response(intel_output, 2734 status = intel_sdvo_read_response(intel_encoder,
2735 &data_value, 4); 2735 &data_value, 4);
2736 if (status != SDVO_CMD_STATUS_SUCCESS) { 2736 if (status != SDVO_CMD_STATUS_SUCCESS) {
2737 DRM_DEBUG_KMS("Incorrect SDVO Max bright\n"); 2737 DRM_DEBUG_KMS("Incorrect SDVO Max bright\n");
2738 return; 2738 return;
2739 } 2739 }
2740 intel_sdvo_write_cmd(intel_output, 2740 intel_sdvo_write_cmd(intel_encoder,
2741 SDVO_CMD_GET_BRIGHTNESS, NULL, 0); 2741 SDVO_CMD_GET_BRIGHTNESS, NULL, 0);
2742 status = intel_sdvo_read_response(intel_output, 2742 status = intel_sdvo_read_response(intel_encoder,
2743 &response, 2); 2743 &response, 2);
2744 if (status != SDVO_CMD_STATUS_SUCCESS) { 2744 if (status != SDVO_CMD_STATUS_SUCCESS) {
2745 DRM_DEBUG_KMS("Incorrect SDVO get brigh\n"); 2745 DRM_DEBUG_KMS("Incorrect SDVO get brigh\n");
@@ -2768,40 +2768,40 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
2768{ 2768{
2769 struct drm_i915_private *dev_priv = dev->dev_private; 2769 struct drm_i915_private *dev_priv = dev->dev_private;
2770 struct drm_connector *connector; 2770 struct drm_connector *connector;
2771 struct intel_output *intel_output; 2771 struct intel_encoder *intel_encoder;
2772 struct intel_sdvo_priv *sdvo_priv; 2772 struct intel_sdvo_priv *sdvo_priv;
2773 2773
2774 u8 ch[0x40]; 2774 u8 ch[0x40];
2775 int i; 2775 int i;
2776 2776
2777 intel_output = kcalloc(sizeof(struct intel_output)+sizeof(struct intel_sdvo_priv), 1, GFP_KERNEL); 2777 intel_encoder = kcalloc(sizeof(struct intel_encoder)+sizeof(struct intel_sdvo_priv), 1, GFP_KERNEL);
2778 if (!intel_output) { 2778 if (!intel_encoder) {
2779 return false; 2779 return false;
2780 } 2780 }
2781 2781
2782 sdvo_priv = (struct intel_sdvo_priv *)(intel_output + 1); 2782 sdvo_priv = (struct intel_sdvo_priv *)(intel_encoder + 1);
2783 sdvo_priv->output_device = output_device; 2783 sdvo_priv->output_device = output_device;
2784 2784
2785 intel_output->dev_priv = sdvo_priv; 2785 intel_encoder->dev_priv = sdvo_priv;
2786 intel_output->type = INTEL_OUTPUT_SDVO; 2786 intel_encoder->type = INTEL_OUTPUT_SDVO;
2787 2787
2788 /* setup the DDC bus. */ 2788 /* setup the DDC bus. */
2789 if (output_device == SDVOB) 2789 if (output_device == SDVOB)
2790 intel_output->i2c_bus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOB"); 2790 intel_encoder->i2c_bus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOB");
2791 else 2791 else
2792 intel_output->i2c_bus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOC"); 2792 intel_encoder->i2c_bus = intel_i2c_create(dev, GPIOE, "SDVOCTRL_E for SDVOC");
2793 2793
2794 if (!intel_output->i2c_bus) 2794 if (!intel_encoder->i2c_bus)
2795 goto err_inteloutput; 2795 goto err_inteloutput;
2796 2796
2797 sdvo_priv->slave_addr = intel_sdvo_get_slave_addr(dev, output_device); 2797 sdvo_priv->slave_addr = intel_sdvo_get_slave_addr(dev, output_device);
2798 2798
2799 /* Save the bit-banging i2c functionality for use by the DDC wrapper */ 2799 /* Save the bit-banging i2c functionality for use by the DDC wrapper */
2800 intel_sdvo_i2c_bit_algo.functionality = intel_output->i2c_bus->algo->functionality; 2800 intel_sdvo_i2c_bit_algo.functionality = intel_encoder->i2c_bus->algo->functionality;
2801 2801
2802 /* Read the regs to test if we can talk to the device */ 2802 /* Read the regs to test if we can talk to the device */
2803 for (i = 0; i < 0x40; i++) { 2803 for (i = 0; i < 0x40; i++) {
2804 if (!intel_sdvo_read_byte(intel_output, i, &ch[i])) { 2804 if (!intel_sdvo_read_byte(intel_encoder, i, &ch[i])) {
2805 DRM_DEBUG_KMS("No SDVO device found on SDVO%c\n", 2805 DRM_DEBUG_KMS("No SDVO device found on SDVO%c\n",
2806 output_device == SDVOB ? 'B' : 'C'); 2806 output_device == SDVOB ? 'B' : 'C');
2807 goto err_i2c; 2807 goto err_i2c;
@@ -2810,27 +2810,27 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
2810 2810
2811 /* setup the DDC bus. */ 2811 /* setup the DDC bus. */
2812 if (output_device == SDVOB) { 2812 if (output_device == SDVOB) {
2813 intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS"); 2813 intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOB DDC BUS");
2814 sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, 2814 sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA,
2815 "SDVOB/VGA DDC BUS"); 2815 "SDVOB/VGA DDC BUS");
2816 dev_priv->hotplug_supported_mask |= SDVOB_HOTPLUG_INT_STATUS; 2816 dev_priv->hotplug_supported_mask |= SDVOB_HOTPLUG_INT_STATUS;
2817 } else { 2817 } else {
2818 intel_output->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS"); 2818 intel_encoder->ddc_bus = intel_i2c_create(dev, GPIOE, "SDVOC DDC BUS");
2819 sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA, 2819 sdvo_priv->analog_ddc_bus = intel_i2c_create(dev, GPIOA,
2820 "SDVOC/VGA DDC BUS"); 2820 "SDVOC/VGA DDC BUS");
2821 dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS; 2821 dev_priv->hotplug_supported_mask |= SDVOC_HOTPLUG_INT_STATUS;
2822 } 2822 }
2823 2823
2824 if (intel_output->ddc_bus == NULL) 2824 if (intel_encoder->ddc_bus == NULL)
2825 goto err_i2c; 2825 goto err_i2c;
2826 2826
2827 /* Wrap with our custom algo which switches to DDC mode */ 2827 /* Wrap with our custom algo which switches to DDC mode */
2828 intel_output->ddc_bus->algo = &intel_sdvo_i2c_bit_algo; 2828 intel_encoder->ddc_bus->algo = &intel_sdvo_i2c_bit_algo;
2829 2829
2830 /* In default case sdvo lvds is false */ 2830 /* In default case sdvo lvds is false */
2831 intel_sdvo_get_capabilities(intel_output, &sdvo_priv->caps); 2831 intel_sdvo_get_capabilities(intel_encoder, &sdvo_priv->caps);
2832 2832
2833 if (intel_sdvo_output_setup(intel_output, 2833 if (intel_sdvo_output_setup(intel_encoder,
2834 sdvo_priv->caps.output_flags) != true) { 2834 sdvo_priv->caps.output_flags) != true) {
2835 DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n", 2835 DRM_DEBUG_KMS("SDVO output failed to setup on SDVO%c\n",
2836 output_device == SDVOB ? 'B' : 'C'); 2836 output_device == SDVOB ? 'B' : 'C');
@@ -2838,7 +2838,7 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
2838 } 2838 }
2839 2839
2840 2840
2841 connector = &intel_output->base; 2841 connector = &intel_encoder->base;
2842 drm_connector_init(dev, connector, &intel_sdvo_connector_funcs, 2842 drm_connector_init(dev, connector, &intel_sdvo_connector_funcs,
2843 connector->connector_type); 2843 connector->connector_type);
2844 2844
@@ -2847,12 +2847,12 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
2847 connector->doublescan_allowed = 0; 2847 connector->doublescan_allowed = 0;
2848 connector->display_info.subpixel_order = SubPixelHorizontalRGB; 2848 connector->display_info.subpixel_order = SubPixelHorizontalRGB;
2849 2849
2850 drm_encoder_init(dev, &intel_output->enc, 2850 drm_encoder_init(dev, &intel_encoder->enc,
2851 &intel_sdvo_enc_funcs, intel_output->enc.encoder_type); 2851 &intel_sdvo_enc_funcs, intel_encoder->enc.encoder_type);
2852 2852
2853 drm_encoder_helper_add(&intel_output->enc, &intel_sdvo_helper_funcs); 2853 drm_encoder_helper_add(&intel_encoder->enc, &intel_sdvo_helper_funcs);
2854 2854
2855 drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); 2855 drm_mode_connector_attach_encoder(&intel_encoder->base, &intel_encoder->enc);
2856 if (sdvo_priv->is_tv) 2856 if (sdvo_priv->is_tv)
2857 intel_sdvo_tv_create_property(connector); 2857 intel_sdvo_tv_create_property(connector);
2858 2858
@@ -2864,9 +2864,9 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
2864 intel_sdvo_select_ddc_bus(sdvo_priv); 2864 intel_sdvo_select_ddc_bus(sdvo_priv);
2865 2865
2866 /* Set the input timing to the screen. Assume always input 0. */ 2866 /* Set the input timing to the screen. Assume always input 0. */
2867 intel_sdvo_set_target_input(intel_output, true, false); 2867 intel_sdvo_set_target_input(intel_encoder, true, false);
2868 2868
2869 intel_sdvo_get_input_pixel_clock_range(intel_output, 2869 intel_sdvo_get_input_pixel_clock_range(intel_encoder,
2870 &sdvo_priv->pixel_clock_min, 2870 &sdvo_priv->pixel_clock_min,
2871 &sdvo_priv->pixel_clock_max); 2871 &sdvo_priv->pixel_clock_max);
2872 2872
@@ -2893,12 +2893,12 @@ bool intel_sdvo_init(struct drm_device *dev, int output_device)
2893err_i2c: 2893err_i2c:
2894 if (sdvo_priv->analog_ddc_bus != NULL) 2894 if (sdvo_priv->analog_ddc_bus != NULL)
2895 intel_i2c_destroy(sdvo_priv->analog_ddc_bus); 2895 intel_i2c_destroy(sdvo_priv->analog_ddc_bus);
2896 if (intel_output->ddc_bus != NULL) 2896 if (intel_encoder->ddc_bus != NULL)
2897 intel_i2c_destroy(intel_output->ddc_bus); 2897 intel_i2c_destroy(intel_encoder->ddc_bus);
2898 if (intel_output->i2c_bus != NULL) 2898 if (intel_encoder->i2c_bus != NULL)
2899 intel_i2c_destroy(intel_output->i2c_bus); 2899 intel_i2c_destroy(intel_encoder->i2c_bus);
2900err_inteloutput: 2900err_inteloutput:
2901 kfree(intel_output); 2901 kfree(intel_encoder);
2902 2902
2903 return false; 2903 return false;
2904} 2904}
diff --git a/drivers/gpu/drm/i915/intel_tv.c b/drivers/gpu/drm/i915/intel_tv.c
index 552ec110b741..d7d39b2327df 100644
--- a/drivers/gpu/drm/i915/intel_tv.c
+++ b/drivers/gpu/drm/i915/intel_tv.c
@@ -921,8 +921,8 @@ intel_tv_save(struct drm_connector *connector)
921{ 921{
922 struct drm_device *dev = connector->dev; 922 struct drm_device *dev = connector->dev;
923 struct drm_i915_private *dev_priv = dev->dev_private; 923 struct drm_i915_private *dev_priv = dev->dev_private;
924 struct intel_output *intel_output = to_intel_output(connector); 924 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
925 struct intel_tv_priv *tv_priv = intel_output->dev_priv; 925 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
926 int i; 926 int i;
927 927
928 tv_priv->save_TV_H_CTL_1 = I915_READ(TV_H_CTL_1); 928 tv_priv->save_TV_H_CTL_1 = I915_READ(TV_H_CTL_1);
@@ -971,8 +971,8 @@ intel_tv_restore(struct drm_connector *connector)
971{ 971{
972 struct drm_device *dev = connector->dev; 972 struct drm_device *dev = connector->dev;
973 struct drm_i915_private *dev_priv = dev->dev_private; 973 struct drm_i915_private *dev_priv = dev->dev_private;
974 struct intel_output *intel_output = to_intel_output(connector); 974 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
975 struct intel_tv_priv *tv_priv = intel_output->dev_priv; 975 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
976 struct drm_crtc *crtc = connector->encoder->crtc; 976 struct drm_crtc *crtc = connector->encoder->crtc;
977 struct intel_crtc *intel_crtc; 977 struct intel_crtc *intel_crtc;
978 int i; 978 int i;
@@ -1068,9 +1068,9 @@ intel_tv_mode_lookup (char *tv_format)
1068} 1068}
1069 1069
1070static const struct tv_mode * 1070static const struct tv_mode *
1071intel_tv_mode_find (struct intel_output *intel_output) 1071intel_tv_mode_find (struct intel_encoder *intel_encoder)
1072{ 1072{
1073 struct intel_tv_priv *tv_priv = intel_output->dev_priv; 1073 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
1074 1074
1075 return intel_tv_mode_lookup(tv_priv->tv_format); 1075 return intel_tv_mode_lookup(tv_priv->tv_format);
1076} 1076}
@@ -1078,8 +1078,8 @@ intel_tv_mode_find (struct intel_output *intel_output)
1078static enum drm_mode_status 1078static enum drm_mode_status
1079intel_tv_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode) 1079intel_tv_mode_valid(struct drm_connector *connector, struct drm_display_mode *mode)
1080{ 1080{
1081 struct intel_output *intel_output = to_intel_output(connector); 1081 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1082 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); 1082 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
1083 1083
1084 /* Ensure TV refresh is close to desired refresh */ 1084 /* Ensure TV refresh is close to desired refresh */
1085 if (tv_mode && abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000) 1085 if (tv_mode && abs(tv_mode->refresh - drm_mode_vrefresh(mode) * 1000)
@@ -1095,8 +1095,8 @@ intel_tv_mode_fixup(struct drm_encoder *encoder, struct drm_display_mode *mode,
1095{ 1095{
1096 struct drm_device *dev = encoder->dev; 1096 struct drm_device *dev = encoder->dev;
1097 struct drm_mode_config *drm_config = &dev->mode_config; 1097 struct drm_mode_config *drm_config = &dev->mode_config;
1098 struct intel_output *intel_output = enc_to_intel_output(encoder); 1098 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1099 const struct tv_mode *tv_mode = intel_tv_mode_find (intel_output); 1099 const struct tv_mode *tv_mode = intel_tv_mode_find (intel_encoder);
1100 struct drm_encoder *other_encoder; 1100 struct drm_encoder *other_encoder;
1101 1101
1102 if (!tv_mode) 1102 if (!tv_mode)
@@ -1121,9 +1121,9 @@ intel_tv_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
1121 struct drm_i915_private *dev_priv = dev->dev_private; 1121 struct drm_i915_private *dev_priv = dev->dev_private;
1122 struct drm_crtc *crtc = encoder->crtc; 1122 struct drm_crtc *crtc = encoder->crtc;
1123 struct intel_crtc *intel_crtc = to_intel_crtc(crtc); 1123 struct intel_crtc *intel_crtc = to_intel_crtc(crtc);
1124 struct intel_output *intel_output = enc_to_intel_output(encoder); 1124 struct intel_encoder *intel_encoder = enc_to_intel_encoder(encoder);
1125 struct intel_tv_priv *tv_priv = intel_output->dev_priv; 1125 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
1126 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); 1126 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
1127 u32 tv_ctl; 1127 u32 tv_ctl;
1128 u32 hctl1, hctl2, hctl3; 1128 u32 hctl1, hctl2, hctl3;
1129 u32 vctl1, vctl2, vctl3, vctl4, vctl5, vctl6, vctl7; 1129 u32 vctl1, vctl2, vctl3, vctl4, vctl5, vctl6, vctl7;
@@ -1360,9 +1360,9 @@ static const struct drm_display_mode reported_modes[] = {
1360 * \return false if TV is disconnected. 1360 * \return false if TV is disconnected.
1361 */ 1361 */
1362static int 1362static int
1363intel_tv_detect_type (struct drm_crtc *crtc, struct intel_output *intel_output) 1363intel_tv_detect_type (struct drm_crtc *crtc, struct intel_encoder *intel_encoder)
1364{ 1364{
1365 struct drm_encoder *encoder = &intel_output->enc; 1365 struct drm_encoder *encoder = &intel_encoder->enc;
1366 struct drm_device *dev = encoder->dev; 1366 struct drm_device *dev = encoder->dev;
1367 struct drm_i915_private *dev_priv = dev->dev_private; 1367 struct drm_i915_private *dev_priv = dev->dev_private;
1368 unsigned long irqflags; 1368 unsigned long irqflags;
@@ -1441,9 +1441,9 @@ intel_tv_detect_type (struct drm_crtc *crtc, struct intel_output *intel_output)
1441 */ 1441 */
1442static void intel_tv_find_better_format(struct drm_connector *connector) 1442static void intel_tv_find_better_format(struct drm_connector *connector)
1443{ 1443{
1444 struct intel_output *intel_output = to_intel_output(connector); 1444 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1445 struct intel_tv_priv *tv_priv = intel_output->dev_priv; 1445 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
1446 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); 1446 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
1447 int i; 1447 int i;
1448 1448
1449 if ((tv_priv->type == DRM_MODE_CONNECTOR_Component) == 1449 if ((tv_priv->type == DRM_MODE_CONNECTOR_Component) ==
@@ -1475,9 +1475,9 @@ intel_tv_detect(struct drm_connector *connector)
1475{ 1475{
1476 struct drm_crtc *crtc; 1476 struct drm_crtc *crtc;
1477 struct drm_display_mode mode; 1477 struct drm_display_mode mode;
1478 struct intel_output *intel_output = to_intel_output(connector); 1478 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1479 struct intel_tv_priv *tv_priv = intel_output->dev_priv; 1479 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
1480 struct drm_encoder *encoder = &intel_output->enc; 1480 struct drm_encoder *encoder = &intel_encoder->enc;
1481 int dpms_mode; 1481 int dpms_mode;
1482 int type = tv_priv->type; 1482 int type = tv_priv->type;
1483 1483
@@ -1485,12 +1485,12 @@ intel_tv_detect(struct drm_connector *connector)
1485 drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V); 1485 drm_mode_set_crtcinfo(&mode, CRTC_INTERLACE_HALVE_V);
1486 1486
1487 if (encoder->crtc && encoder->crtc->enabled) { 1487 if (encoder->crtc && encoder->crtc->enabled) {
1488 type = intel_tv_detect_type(encoder->crtc, intel_output); 1488 type = intel_tv_detect_type(encoder->crtc, intel_encoder);
1489 } else { 1489 } else {
1490 crtc = intel_get_load_detect_pipe(intel_output, &mode, &dpms_mode); 1490 crtc = intel_get_load_detect_pipe(intel_encoder, &mode, &dpms_mode);
1491 if (crtc) { 1491 if (crtc) {
1492 type = intel_tv_detect_type(crtc, intel_output); 1492 type = intel_tv_detect_type(crtc, intel_encoder);
1493 intel_release_load_detect_pipe(intel_output, dpms_mode); 1493 intel_release_load_detect_pipe(intel_encoder, dpms_mode);
1494 } else 1494 } else
1495 type = -1; 1495 type = -1;
1496 } 1496 }
@@ -1525,8 +1525,8 @@ static void
1525intel_tv_chose_preferred_modes(struct drm_connector *connector, 1525intel_tv_chose_preferred_modes(struct drm_connector *connector,
1526 struct drm_display_mode *mode_ptr) 1526 struct drm_display_mode *mode_ptr)
1527{ 1527{
1528 struct intel_output *intel_output = to_intel_output(connector); 1528 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1529 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); 1529 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
1530 1530
1531 if (tv_mode->nbr_end < 480 && mode_ptr->vdisplay == 480) 1531 if (tv_mode->nbr_end < 480 && mode_ptr->vdisplay == 480)
1532 mode_ptr->type |= DRM_MODE_TYPE_PREFERRED; 1532 mode_ptr->type |= DRM_MODE_TYPE_PREFERRED;
@@ -1550,8 +1550,8 @@ static int
1550intel_tv_get_modes(struct drm_connector *connector) 1550intel_tv_get_modes(struct drm_connector *connector)
1551{ 1551{
1552 struct drm_display_mode *mode_ptr; 1552 struct drm_display_mode *mode_ptr;
1553 struct intel_output *intel_output = to_intel_output(connector); 1553 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1554 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_output); 1554 const struct tv_mode *tv_mode = intel_tv_mode_find(intel_encoder);
1555 int j, count = 0; 1555 int j, count = 0;
1556 u64 tmp; 1556 u64 tmp;
1557 1557
@@ -1604,11 +1604,11 @@ intel_tv_get_modes(struct drm_connector *connector)
1604static void 1604static void
1605intel_tv_destroy (struct drm_connector *connector) 1605intel_tv_destroy (struct drm_connector *connector)
1606{ 1606{
1607 struct intel_output *intel_output = to_intel_output(connector); 1607 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1608 1608
1609 drm_sysfs_connector_remove(connector); 1609 drm_sysfs_connector_remove(connector);
1610 drm_connector_cleanup(connector); 1610 drm_connector_cleanup(connector);
1611 kfree(intel_output); 1611 kfree(intel_encoder);
1612} 1612}
1613 1613
1614 1614
@@ -1617,9 +1617,9 @@ intel_tv_set_property(struct drm_connector *connector, struct drm_property *prop
1617 uint64_t val) 1617 uint64_t val)
1618{ 1618{
1619 struct drm_device *dev = connector->dev; 1619 struct drm_device *dev = connector->dev;
1620 struct intel_output *intel_output = to_intel_output(connector); 1620 struct intel_encoder *intel_encoder = to_intel_encoder(connector);
1621 struct intel_tv_priv *tv_priv = intel_output->dev_priv; 1621 struct intel_tv_priv *tv_priv = intel_encoder->dev_priv;
1622 struct drm_encoder *encoder = &intel_output->enc; 1622 struct drm_encoder *encoder = &intel_encoder->enc;
1623 struct drm_crtc *crtc = encoder->crtc; 1623 struct drm_crtc *crtc = encoder->crtc;
1624 int ret = 0; 1624 int ret = 0;
1625 bool changed = false; 1625 bool changed = false;
@@ -1740,7 +1740,7 @@ intel_tv_init(struct drm_device *dev)
1740{ 1740{
1741 struct drm_i915_private *dev_priv = dev->dev_private; 1741 struct drm_i915_private *dev_priv = dev->dev_private;
1742 struct drm_connector *connector; 1742 struct drm_connector *connector;
1743 struct intel_output *intel_output; 1743 struct intel_encoder *intel_encoder;
1744 struct intel_tv_priv *tv_priv; 1744 struct intel_tv_priv *tv_priv;
1745 u32 tv_dac_on, tv_dac_off, save_tv_dac; 1745 u32 tv_dac_on, tv_dac_off, save_tv_dac;
1746 char **tv_format_names; 1746 char **tv_format_names;
@@ -1780,28 +1780,28 @@ intel_tv_init(struct drm_device *dev)
1780 (tv_dac_off & TVDAC_STATE_CHG_EN) != 0) 1780 (tv_dac_off & TVDAC_STATE_CHG_EN) != 0)
1781 return; 1781 return;
1782 1782
1783 intel_output = kzalloc(sizeof(struct intel_output) + 1783 intel_encoder = kzalloc(sizeof(struct intel_encoder) +
1784 sizeof(struct intel_tv_priv), GFP_KERNEL); 1784 sizeof(struct intel_tv_priv), GFP_KERNEL);
1785 if (!intel_output) { 1785 if (!intel_encoder) {
1786 return; 1786 return;
1787 } 1787 }
1788 1788
1789 connector = &intel_output->base; 1789 connector = &intel_encoder->base;
1790 1790
1791 drm_connector_init(dev, connector, &intel_tv_connector_funcs, 1791 drm_connector_init(dev, connector, &intel_tv_connector_funcs,
1792 DRM_MODE_CONNECTOR_SVIDEO); 1792 DRM_MODE_CONNECTOR_SVIDEO);
1793 1793
1794 drm_encoder_init(dev, &intel_output->enc, &intel_tv_enc_funcs, 1794 drm_encoder_init(dev, &intel_encoder->enc, &intel_tv_enc_funcs,
1795 DRM_MODE_ENCODER_TVDAC); 1795 DRM_MODE_ENCODER_TVDAC);
1796 1796
1797 drm_mode_connector_attach_encoder(&intel_output->base, &intel_output->enc); 1797 drm_mode_connector_attach_encoder(&intel_encoder->base, &intel_encoder->enc);
1798 tv_priv = (struct intel_tv_priv *)(intel_output + 1); 1798 tv_priv = (struct intel_tv_priv *)(intel_encoder + 1);
1799 intel_output->type = INTEL_OUTPUT_TVOUT; 1799 intel_encoder->type = INTEL_OUTPUT_TVOUT;
1800 intel_output->crtc_mask = (1 << 0) | (1 << 1); 1800 intel_encoder->crtc_mask = (1 << 0) | (1 << 1);
1801 intel_output->clone_mask = (1 << INTEL_TV_CLONE_BIT); 1801 intel_encoder->clone_mask = (1 << INTEL_TV_CLONE_BIT);
1802 intel_output->enc.possible_crtcs = ((1 << 0) | (1 << 1)); 1802 intel_encoder->enc.possible_crtcs = ((1 << 0) | (1 << 1));
1803 intel_output->enc.possible_clones = (1 << INTEL_OUTPUT_TVOUT); 1803 intel_encoder->enc.possible_clones = (1 << INTEL_OUTPUT_TVOUT);
1804 intel_output->dev_priv = tv_priv; 1804 intel_encoder->dev_priv = tv_priv;
1805 tv_priv->type = DRM_MODE_CONNECTOR_Unknown; 1805 tv_priv->type = DRM_MODE_CONNECTOR_Unknown;
1806 1806
1807 /* BIOS margin values */ 1807 /* BIOS margin values */
@@ -1812,7 +1812,7 @@ intel_tv_init(struct drm_device *dev)
1812 1812
1813 tv_priv->tv_format = kstrdup(tv_modes[initial_mode].name, GFP_KERNEL); 1813 tv_priv->tv_format = kstrdup(tv_modes[initial_mode].name, GFP_KERNEL);
1814 1814
1815 drm_encoder_helper_add(&intel_output->enc, &intel_tv_helper_funcs); 1815 drm_encoder_helper_add(&intel_encoder->enc, &intel_tv_helper_funcs);
1816 drm_connector_helper_add(connector, &intel_tv_connector_helper_funcs); 1816 drm_connector_helper_add(connector, &intel_tv_connector_helper_funcs);
1817 connector->interlace_allowed = false; 1817 connector->interlace_allowed = false;
1818 connector->doublescan_allowed = false; 1818 connector->doublescan_allowed = false;