aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlex Deucher <alexdeucher@gmail.com>2009-12-04 14:45:27 -0500
committerDave Airlie <airlied@redhat.com>2009-12-07 19:46:28 -0500
commiteed45b30cd1423f8dc10b4312700773cac13c1c8 (patch)
treef47c667d753ce1fc2abd116449ca7c2ce290cecf
parent53c1e09fea4cf3fc0ec1f735a5fcab78c43cb55d (diff)
drm/radeon/kms: get HPD info for connectors
This populates the connectors with HPD (Hot Plug Detect) information. This will be used in subsequent patches for automatic digital monitor connect/disconnect handling. Signed-off-by: Alex Deucher <alexdeucher@gmail.com> Signed-off-by: Dave Airlie <airlied@redhat.com>
-rw-r--r--drivers/gpu/drm/radeon/atombios.h2
-rw-r--r--drivers/gpu/drm/radeon/r500_reg.h2
-rw-r--r--drivers/gpu/drm/radeon/radeon_atombios.c190
-rw-r--r--drivers/gpu/drm/radeon/radeon_combios.c176
-rw-r--r--drivers/gpu/drm/radeon/radeon_connectors.c8
-rw-r--r--drivers/gpu/drm/radeon/radeon_display.c12
-rw-r--r--drivers/gpu/drm/radeon/radeon_mode.h24
7 files changed, 330 insertions, 84 deletions
diff --git a/drivers/gpu/drm/radeon/atombios.h b/drivers/gpu/drm/radeon/atombios.h
index c11ddddfb3b6..e83927644de4 100644
--- a/drivers/gpu/drm/radeon/atombios.h
+++ b/drivers/gpu/drm/radeon/atombios.h
@@ -2680,7 +2680,7 @@ typedef struct _ATOM_I2C_RECORD {
2680typedef struct _ATOM_HPD_INT_RECORD { 2680typedef struct _ATOM_HPD_INT_RECORD {
2681 ATOM_COMMON_RECORD_HEADER sheader; 2681 ATOM_COMMON_RECORD_HEADER sheader;
2682 UCHAR ucHPDIntGPIOID; /* Corresponding block in GPIO_PIN_INFO table gives the pin info */ 2682 UCHAR ucHPDIntGPIOID; /* Corresponding block in GPIO_PIN_INFO table gives the pin info */
2683 UCHAR ucPluggged_PinState; 2683 UCHAR ucPlugged_PinState;
2684} ATOM_HPD_INT_RECORD; 2684} ATOM_HPD_INT_RECORD;
2685 2685
2686typedef struct _ATOM_OUTPUT_PROTECTION_RECORD { 2686typedef struct _ATOM_OUTPUT_PROTECTION_RECORD {
diff --git a/drivers/gpu/drm/radeon/r500_reg.h b/drivers/gpu/drm/radeon/r500_reg.h
index 7baa73955563..74ad89bdf2b5 100644
--- a/drivers/gpu/drm/radeon/r500_reg.h
+++ b/drivers/gpu/drm/radeon/r500_reg.h
@@ -716,6 +716,8 @@
716 716
717#define AVIVO_DVOA_BIT_DEPTH_CONTROL 0x7988 717#define AVIVO_DVOA_BIT_DEPTH_CONTROL 0x7988
718 718
719#define AVIVO_DC_GPIO_HPD_A 0x7e94
720
719#define AVIVO_GPIO_0 0x7e30 721#define AVIVO_GPIO_0 0x7e30
720#define AVIVO_GPIO_1 0x7e40 722#define AVIVO_GPIO_1 0x7e40
721#define AVIVO_GPIO_2 0x7e50 723#define AVIVO_GPIO_2 0x7e50
diff --git a/drivers/gpu/drm/radeon/radeon_atombios.c b/drivers/gpu/drm/radeon/radeon_atombios.c
index 87bf6b9d10a4..d7b0feb7d47f 100644
--- a/drivers/gpu/drm/radeon/radeon_atombios.c
+++ b/drivers/gpu/drm/radeon/radeon_atombios.c
@@ -47,7 +47,8 @@ radeon_add_atom_connector(struct drm_device *dev,
47 int connector_type, 47 int connector_type,
48 struct radeon_i2c_bus_rec *i2c_bus, 48 struct radeon_i2c_bus_rec *i2c_bus,
49 bool linkb, uint32_t igp_lane_info, 49 bool linkb, uint32_t igp_lane_info,
50 uint16_t connector_object_id); 50 uint16_t connector_object_id,
51 struct radeon_hpd *hpd);
51 52
52/* from radeon_legacy_encoder.c */ 53/* from radeon_legacy_encoder.c */
53extern void 54extern void
@@ -60,10 +61,9 @@ union atom_supported_devices {
60 struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1; 61 struct _ATOM_SUPPORTED_DEVICES_INFO_2d1 info_2d1;
61}; 62};
62 63
63static inline struct radeon_i2c_bus_rec radeon_lookup_gpio(struct drm_device *dev, 64static inline struct radeon_i2c_bus_rec radeon_lookup_i2c_gpio(struct radeon_device *rdev,
64 uint8_t id) 65 uint8_t id)
65{ 66{
66 struct radeon_device *rdev = dev->dev_private;
67 struct atom_context *ctx = rdev->mode_info.atom_context; 67 struct atom_context *ctx = rdev->mode_info.atom_context;
68 ATOM_GPIO_I2C_ASSIGMENT *gpio; 68 ATOM_GPIO_I2C_ASSIGMENT *gpio;
69 struct radeon_i2c_bus_rec i2c; 69 struct radeon_i2c_bus_rec i2c;
@@ -114,11 +114,80 @@ static inline struct radeon_i2c_bus_rec radeon_lookup_gpio(struct drm_device *de
114 return i2c; 114 return i2c;
115} 115}
116 116
117static inline struct radeon_gpio_rec radeon_lookup_gpio(struct radeon_device *rdev,
118 u8 id)
119{
120 struct atom_context *ctx = rdev->mode_info.atom_context;
121 struct radeon_gpio_rec gpio;
122 int index = GetIndexIntoMasterTable(DATA, GPIO_Pin_LUT);
123 struct _ATOM_GPIO_PIN_LUT *gpio_info;
124 ATOM_GPIO_PIN_ASSIGNMENT *pin;
125 u16 data_offset, size;
126 int i, num_indices;
127
128 memset(&gpio, 0, sizeof(struct radeon_gpio_rec));
129 gpio.valid = false;
130
131 atom_parse_data_header(ctx, index, &size, NULL, NULL, &data_offset);
132
133 gpio_info = (struct _ATOM_GPIO_PIN_LUT *)(ctx->bios + data_offset);
134
135 num_indices = (size - sizeof(ATOM_COMMON_TABLE_HEADER)) / sizeof(ATOM_GPIO_PIN_ASSIGNMENT);
136
137 for (i = 0; i < num_indices; i++) {
138 pin = &gpio_info->asGPIO_Pin[i];
139 if (id == pin->ucGPIO_ID) {
140 gpio.id = pin->ucGPIO_ID;
141 gpio.reg = pin->usGpioPin_AIndex * 4;
142 gpio.mask = (1 << pin->ucGpioPinBitShift);
143 gpio.valid = true;
144 break;
145 }
146 }
147
148 return gpio;
149}
150
151static struct radeon_hpd radeon_atom_get_hpd_info_from_gpio(struct radeon_device *rdev,
152 struct radeon_gpio_rec *gpio)
153{
154 struct radeon_hpd hpd;
155 hpd.gpio = *gpio;
156 if (gpio->reg == AVIVO_DC_GPIO_HPD_A) {
157 switch(gpio->mask) {
158 case (1 << 0):
159 hpd.hpd = RADEON_HPD_1;
160 break;
161 case (1 << 8):
162 hpd.hpd = RADEON_HPD_2;
163 break;
164 case (1 << 16):
165 hpd.hpd = RADEON_HPD_3;
166 break;
167 case (1 << 24):
168 hpd.hpd = RADEON_HPD_4;
169 break;
170 case (1 << 26):
171 hpd.hpd = RADEON_HPD_5;
172 break;
173 case (1 << 28):
174 hpd.hpd = RADEON_HPD_6;
175 break;
176 default:
177 hpd.hpd = RADEON_HPD_NONE;
178 break;
179 }
180 } else
181 hpd.hpd = RADEON_HPD_NONE;
182 return hpd;
183}
184
117static bool radeon_atom_apply_quirks(struct drm_device *dev, 185static bool radeon_atom_apply_quirks(struct drm_device *dev,
118 uint32_t supported_device, 186 uint32_t supported_device,
119 int *connector_type, 187 int *connector_type,
120 struct radeon_i2c_bus_rec *i2c_bus, 188 struct radeon_i2c_bus_rec *i2c_bus,
121 uint16_t *line_mux) 189 uint16_t *line_mux,
190 struct radeon_hpd *hpd)
122{ 191{
123 192
124 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */ 193 /* Asus M2A-VM HDMI board lists the DVI port as HDMI */
@@ -279,16 +348,19 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
279 struct radeon_mode_info *mode_info = &rdev->mode_info; 348 struct radeon_mode_info *mode_info = &rdev->mode_info;
280 struct atom_context *ctx = mode_info->atom_context; 349 struct atom_context *ctx = mode_info->atom_context;
281 int index = GetIndexIntoMasterTable(DATA, Object_Header); 350 int index = GetIndexIntoMasterTable(DATA, Object_Header);
282 uint16_t size, data_offset; 351 u16 size, data_offset;
283 uint8_t frev, crev, line_mux = 0; 352 u8 frev, crev;
284 ATOM_CONNECTOR_OBJECT_TABLE *con_obj; 353 ATOM_CONNECTOR_OBJECT_TABLE *con_obj;
285 ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj; 354 ATOM_DISPLAY_OBJECT_PATH_TABLE *path_obj;
286 ATOM_OBJECT_HEADER *obj_header; 355 ATOM_OBJECT_HEADER *obj_header;
287 int i, j, path_size, device_support; 356 int i, j, path_size, device_support;
288 int connector_type; 357 int connector_type;
289 uint16_t igp_lane_info, conn_id, connector_object_id; 358 u16 igp_lane_info, conn_id, connector_object_id;
290 bool linkb; 359 bool linkb;
291 struct radeon_i2c_bus_rec ddc_bus; 360 struct radeon_i2c_bus_rec ddc_bus;
361 struct radeon_gpio_rec gpio;
362 struct radeon_hpd hpd;
363
292 atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset); 364 atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset);
293 365
294 if (data_offset == 0) 366 if (data_offset == 0)
@@ -414,10 +486,9 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
414 } 486 }
415 } 487 }
416 488
417 /* look up gpio for ddc */ 489 /* look up gpio for ddc, hpd */
418 if ((le16_to_cpu(path->usDeviceTag) & 490 if ((le16_to_cpu(path->usDeviceTag) &
419 (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT)) 491 (ATOM_DEVICE_TV_SUPPORT | ATOM_DEVICE_CV_SUPPORT)) == 0) {
420 == 0) {
421 for (j = 0; j < con_obj->ucNumberOfObjects; j++) { 492 for (j = 0; j < con_obj->ucNumberOfObjects; j++) {
422 if (le16_to_cpu(path->usConnObjectId) == 493 if (le16_to_cpu(path->usConnObjectId) ==
423 le16_to_cpu(con_obj->asObjects[j]. 494 le16_to_cpu(con_obj->asObjects[j].
@@ -431,21 +502,31 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
431 asObjects[j]. 502 asObjects[j].
432 usRecordOffset)); 503 usRecordOffset));
433 ATOM_I2C_RECORD *i2c_record; 504 ATOM_I2C_RECORD *i2c_record;
505 ATOM_HPD_INT_RECORD *hpd_record;
506 hpd.hpd = RADEON_HPD_NONE;
434 507
435 while (record->ucRecordType > 0 508 while (record->ucRecordType > 0
436 && record-> 509 && record->
437 ucRecordType <= 510 ucRecordType <=
438 ATOM_MAX_OBJECT_RECORD_NUMBER) { 511 ATOM_MAX_OBJECT_RECORD_NUMBER) {
439 switch (record-> 512 switch (record->ucRecordType) {
440 ucRecordType) {
441 case ATOM_I2C_RECORD_TYPE: 513 case ATOM_I2C_RECORD_TYPE:
442 i2c_record = 514 i2c_record =
443 (ATOM_I2C_RECORD 515 (ATOM_I2C_RECORD *)
444 *) record; 516 record;
445 line_mux = 517 ddc_bus = radeon_lookup_i2c_gpio(rdev,
446 i2c_record-> 518 i2c_record->
447 sucI2cId. 519 sucI2cId.
448 bfI2C_LineMux; 520 bfI2C_LineMux);
521 break;
522 case ATOM_HPD_INT_RECORD_TYPE:
523 hpd_record =
524 (ATOM_HPD_INT_RECORD *)
525 record;
526 gpio = radeon_lookup_gpio(rdev,
527 hpd_record->ucHPDIntGPIOID);
528 hpd = radeon_atom_get_hpd_info_from_gpio(rdev, &gpio);
529 hpd.plugged_state = hpd_record->ucPlugged_PinState;
449 break; 530 break;
450 } 531 }
451 record = 532 record =
@@ -458,24 +539,16 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
458 break; 539 break;
459 } 540 }
460 } 541 }
461 } else 542 } else {
462 line_mux = 0; 543 hpd.hpd = RADEON_HPD_NONE;
463
464 if ((le16_to_cpu(path->usDeviceTag) ==
465 ATOM_DEVICE_TV1_SUPPORT)
466 || (le16_to_cpu(path->usDeviceTag) ==
467 ATOM_DEVICE_TV2_SUPPORT)
468 || (le16_to_cpu(path->usDeviceTag) ==
469 ATOM_DEVICE_CV_SUPPORT))
470 ddc_bus.valid = false; 544 ddc_bus.valid = false;
471 else 545 }
472 ddc_bus = radeon_lookup_gpio(dev, line_mux);
473 546
474 conn_id = le16_to_cpu(path->usConnObjectId); 547 conn_id = le16_to_cpu(path->usConnObjectId);
475 548
476 if (!radeon_atom_apply_quirks 549 if (!radeon_atom_apply_quirks
477 (dev, le16_to_cpu(path->usDeviceTag), &connector_type, 550 (dev, le16_to_cpu(path->usDeviceTag), &connector_type,
478 &ddc_bus, &conn_id)) 551 &ddc_bus, &conn_id, &hpd))
479 continue; 552 continue;
480 553
481 radeon_add_atom_connector(dev, 554 radeon_add_atom_connector(dev,
@@ -484,7 +557,8 @@ bool radeon_get_atom_connector_info_from_object_table(struct drm_device *dev)
484 usDeviceTag), 557 usDeviceTag),
485 connector_type, &ddc_bus, 558 connector_type, &ddc_bus,
486 linkb, igp_lane_info, 559 linkb, igp_lane_info,
487 connector_object_id); 560 connector_object_id,
561 &hpd);
488 562
489 } 563 }
490 } 564 }
@@ -539,6 +613,7 @@ struct bios_connector {
539 uint16_t devices; 613 uint16_t devices;
540 int connector_type; 614 int connector_type;
541 struct radeon_i2c_bus_rec ddc_bus; 615 struct radeon_i2c_bus_rec ddc_bus;
616 struct radeon_hpd hpd;
542}; 617};
543 618
544bool radeon_get_atom_connector_info_from_supported_devices_table(struct 619bool radeon_get_atom_connector_info_from_supported_devices_table(struct
@@ -554,7 +629,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
554 uint16_t device_support; 629 uint16_t device_support;
555 uint8_t dac; 630 uint8_t dac;
556 union atom_supported_devices *supported_devices; 631 union atom_supported_devices *supported_devices;
557 int i, j; 632 int i, j, max_device;
558 struct bios_connector bios_connectors[ATOM_MAX_SUPPORTED_DEVICE]; 633 struct bios_connector bios_connectors[ATOM_MAX_SUPPORTED_DEVICE];
559 634
560 atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset); 635 atom_parse_data_header(ctx, index, &size, &frev, &crev, &data_offset);
@@ -564,7 +639,12 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
564 639
565 device_support = le16_to_cpu(supported_devices->info.usDeviceSupport); 640 device_support = le16_to_cpu(supported_devices->info.usDeviceSupport);
566 641
567 for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { 642 if (frev > 1)
643 max_device = ATOM_MAX_SUPPORTED_DEVICE;
644 else
645 max_device = ATOM_MAX_SUPPORTED_DEVICE_INFO;
646
647 for (i = 0; i < max_device; i++) {
568 ATOM_CONNECTOR_INFO_I2C ci = 648 ATOM_CONNECTOR_INFO_I2C ci =
569 supported_devices->info.asConnInfo[i]; 649 supported_devices->info.asConnInfo[i];
570 650
@@ -619,8 +699,30 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
619 bios_connectors[i].line_mux = 52; 699 bios_connectors[i].line_mux = 52;
620 } else 700 } else
621 bios_connectors[i].ddc_bus = 701 bios_connectors[i].ddc_bus =
622 radeon_lookup_gpio(dev, 702 radeon_lookup_i2c_gpio(rdev,
623 bios_connectors[i].line_mux); 703 bios_connectors[i].line_mux);
704
705 if ((crev > 1) && (frev > 1)) {
706 u8 isb = supported_devices->info_2d1.asIntSrcInfo[i].ucIntSrcBitmap;
707 switch (isb) {
708 case 0x4:
709 bios_connectors[i].hpd.hpd = RADEON_HPD_1;
710 break;
711 case 0xa:
712 bios_connectors[i].hpd.hpd = RADEON_HPD_2;
713 break;
714 default:
715 bios_connectors[i].hpd.hpd = RADEON_HPD_NONE;
716 break;
717 }
718 } else {
719 if (i == ATOM_DEVICE_DFP1_INDEX)
720 bios_connectors[i].hpd.hpd = RADEON_HPD_1;
721 else if (i == ATOM_DEVICE_DFP2_INDEX)
722 bios_connectors[i].hpd.hpd = RADEON_HPD_2;
723 else
724 bios_connectors[i].hpd.hpd = RADEON_HPD_NONE;
725 }
624 726
625 /* Always set the connector type to VGA for CRT1/CRT2. if they are 727 /* Always set the connector type to VGA for CRT1/CRT2. if they are
626 * shared with a DVI port, we'll pick up the DVI connector when we 728 * shared with a DVI port, we'll pick up the DVI connector when we
@@ -632,7 +734,8 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
632 734
633 if (!radeon_atom_apply_quirks 735 if (!radeon_atom_apply_quirks
634 (dev, (1 << i), &bios_connectors[i].connector_type, 736 (dev, (1 << i), &bios_connectors[i].connector_type,
635 &bios_connectors[i].ddc_bus, &bios_connectors[i].line_mux)) 737 &bios_connectors[i].ddc_bus, &bios_connectors[i].line_mux,
738 &bios_connectors[i].hpd))
636 continue; 739 continue;
637 740
638 bios_connectors[i].valid = true; 741 bios_connectors[i].valid = true;
@@ -654,9 +757,9 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
654 } 757 }
655 758
656 /* combine shared connectors */ 759 /* combine shared connectors */
657 for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { 760 for (i = 0; i < max_device; i++) {
658 if (bios_connectors[i].valid) { 761 if (bios_connectors[i].valid) {
659 for (j = 0; j < ATOM_MAX_SUPPORTED_DEVICE; j++) { 762 for (j = 0; j < max_device; j++) {
660 if (bios_connectors[j].valid && (i != j)) { 763 if (bios_connectors[j].valid && (i != j)) {
661 if (bios_connectors[i].line_mux == 764 if (bios_connectors[i].line_mux ==
662 bios_connectors[j].line_mux) { 765 bios_connectors[j].line_mux) {
@@ -680,6 +783,10 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
680 bios_connectors[i]. 783 bios_connectors[i].
681 connector_type = 784 connector_type =
682 DRM_MODE_CONNECTOR_DVII; 785 DRM_MODE_CONNECTOR_DVII;
786 if (bios_connectors[j].devices &
787 (ATOM_DEVICE_DFP_SUPPORT))
788 bios_connectors[i].hpd =
789 bios_connectors[j].hpd;
683 bios_connectors[j]. 790 bios_connectors[j].
684 valid = false; 791 valid = false;
685 } 792 }
@@ -690,7 +797,7 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
690 } 797 }
691 798
692 /* add the connectors */ 799 /* add the connectors */
693 for (i = 0; i < ATOM_MAX_SUPPORTED_DEVICE; i++) { 800 for (i = 0; i < max_device; i++) {
694 if (bios_connectors[i].valid) { 801 if (bios_connectors[i].valid) {
695 uint16_t connector_object_id = 802 uint16_t connector_object_id =
696 atombios_get_connector_object_id(dev, 803 atombios_get_connector_object_id(dev,
@@ -703,7 +810,8 @@ bool radeon_get_atom_connector_info_from_supported_devices_table(struct
703 connector_type, 810 connector_type,
704 &bios_connectors[i].ddc_bus, 811 &bios_connectors[i].ddc_bus,
705 false, 0, 812 false, 0,
706 connector_object_id); 813 connector_object_id,
814 &bios_connectors[i].hpd);
707 } 815 }
708 } 816 }
709 817
diff --git a/drivers/gpu/drm/radeon/radeon_combios.c b/drivers/gpu/drm/radeon/radeon_combios.c
index b6761cde1ecb..c5021a3445de 100644
--- a/drivers/gpu/drm/radeon/radeon_combios.c
+++ b/drivers/gpu/drm/radeon/radeon_combios.c
@@ -50,7 +50,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
50 uint32_t supported_device, 50 uint32_t supported_device,
51 int connector_type, 51 int connector_type,
52 struct radeon_i2c_bus_rec *i2c_bus, 52 struct radeon_i2c_bus_rec *i2c_bus,
53 uint16_t connector_object_id); 53 uint16_t connector_object_id,
54 struct radeon_hpd *hpd);
54 55
55/* from radeon_legacy_encoder.c */ 56/* from radeon_legacy_encoder.c */
56extern void 57extern void
@@ -1226,6 +1227,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1226{ 1227{
1227 struct radeon_device *rdev = dev->dev_private; 1228 struct radeon_device *rdev = dev->dev_private;
1228 struct radeon_i2c_bus_rec ddc_i2c; 1229 struct radeon_i2c_bus_rec ddc_i2c;
1230 struct radeon_hpd hpd;
1229 1231
1230 rdev->mode_info.connector_table = radeon_connector_table; 1232 rdev->mode_info.connector_table = radeon_connector_table;
1231 if (rdev->mode_info.connector_table == CT_NONE) { 1233 if (rdev->mode_info.connector_table == CT_NONE) {
@@ -1287,6 +1289,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1287 if (rdev->flags & RADEON_SINGLE_CRTC) { 1289 if (rdev->flags & RADEON_SINGLE_CRTC) {
1288 /* VGA - primary dac */ 1290 /* VGA - primary dac */
1289 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); 1291 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC);
1292 hpd.hpd = RADEON_HPD_NONE;
1290 radeon_add_legacy_encoder(dev, 1293 radeon_add_legacy_encoder(dev,
1291 radeon_get_encoder_id(dev, 1294 radeon_get_encoder_id(dev,
1292 ATOM_DEVICE_CRT1_SUPPORT, 1295 ATOM_DEVICE_CRT1_SUPPORT,
@@ -1296,10 +1299,12 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1296 ATOM_DEVICE_CRT1_SUPPORT, 1299 ATOM_DEVICE_CRT1_SUPPORT,
1297 DRM_MODE_CONNECTOR_VGA, 1300 DRM_MODE_CONNECTOR_VGA,
1298 &ddc_i2c, 1301 &ddc_i2c,
1299 CONNECTOR_OBJECT_ID_VGA); 1302 CONNECTOR_OBJECT_ID_VGA,
1303 &hpd);
1300 } else if (rdev->flags & RADEON_IS_MOBILITY) { 1304 } else if (rdev->flags & RADEON_IS_MOBILITY) {
1301 /* LVDS */ 1305 /* LVDS */
1302 ddc_i2c = combios_setup_i2c_bus(rdev, 0); 1306 ddc_i2c = combios_setup_i2c_bus(rdev, 0);
1307 hpd.hpd = RADEON_HPD_NONE;
1303 radeon_add_legacy_encoder(dev, 1308 radeon_add_legacy_encoder(dev,
1304 radeon_get_encoder_id(dev, 1309 radeon_get_encoder_id(dev,
1305 ATOM_DEVICE_LCD1_SUPPORT, 1310 ATOM_DEVICE_LCD1_SUPPORT,
@@ -1309,10 +1314,12 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1309 ATOM_DEVICE_LCD1_SUPPORT, 1314 ATOM_DEVICE_LCD1_SUPPORT,
1310 DRM_MODE_CONNECTOR_LVDS, 1315 DRM_MODE_CONNECTOR_LVDS,
1311 &ddc_i2c, 1316 &ddc_i2c,
1312 CONNECTOR_OBJECT_ID_LVDS); 1317 CONNECTOR_OBJECT_ID_LVDS,
1318 &hpd);
1313 1319
1314 /* VGA - primary dac */ 1320 /* VGA - primary dac */
1315 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); 1321 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC);
1322 hpd.hpd = RADEON_HPD_NONE;
1316 radeon_add_legacy_encoder(dev, 1323 radeon_add_legacy_encoder(dev,
1317 radeon_get_encoder_id(dev, 1324 radeon_get_encoder_id(dev,
1318 ATOM_DEVICE_CRT1_SUPPORT, 1325 ATOM_DEVICE_CRT1_SUPPORT,
@@ -1322,10 +1329,12 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1322 ATOM_DEVICE_CRT1_SUPPORT, 1329 ATOM_DEVICE_CRT1_SUPPORT,
1323 DRM_MODE_CONNECTOR_VGA, 1330 DRM_MODE_CONNECTOR_VGA,
1324 &ddc_i2c, 1331 &ddc_i2c,
1325 CONNECTOR_OBJECT_ID_VGA); 1332 CONNECTOR_OBJECT_ID_VGA,
1333 &hpd);
1326 } else { 1334 } else {
1327 /* DVI-I - tv dac, int tmds */ 1335 /* DVI-I - tv dac, int tmds */
1328 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); 1336 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC);
1337 hpd.hpd = RADEON_HPD_1;
1329 radeon_add_legacy_encoder(dev, 1338 radeon_add_legacy_encoder(dev,
1330 radeon_get_encoder_id(dev, 1339 radeon_get_encoder_id(dev,
1331 ATOM_DEVICE_DFP1_SUPPORT, 1340 ATOM_DEVICE_DFP1_SUPPORT,
@@ -1341,10 +1350,12 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1341 ATOM_DEVICE_CRT2_SUPPORT, 1350 ATOM_DEVICE_CRT2_SUPPORT,
1342 DRM_MODE_CONNECTOR_DVII, 1351 DRM_MODE_CONNECTOR_DVII,
1343 &ddc_i2c, 1352 &ddc_i2c,
1344 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); 1353 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
1354 &hpd);
1345 1355
1346 /* VGA - primary dac */ 1356 /* VGA - primary dac */
1347 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); 1357 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC);
1358 hpd.hpd = RADEON_HPD_NONE;
1348 radeon_add_legacy_encoder(dev, 1359 radeon_add_legacy_encoder(dev,
1349 radeon_get_encoder_id(dev, 1360 radeon_get_encoder_id(dev,
1350 ATOM_DEVICE_CRT1_SUPPORT, 1361 ATOM_DEVICE_CRT1_SUPPORT,
@@ -1354,11 +1365,14 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1354 ATOM_DEVICE_CRT1_SUPPORT, 1365 ATOM_DEVICE_CRT1_SUPPORT,
1355 DRM_MODE_CONNECTOR_VGA, 1366 DRM_MODE_CONNECTOR_VGA,
1356 &ddc_i2c, 1367 &ddc_i2c,
1357 CONNECTOR_OBJECT_ID_VGA); 1368 CONNECTOR_OBJECT_ID_VGA,
1369 &hpd);
1358 } 1370 }
1359 1371
1360 if (rdev->family != CHIP_R100 && rdev->family != CHIP_R200) { 1372 if (rdev->family != CHIP_R100 && rdev->family != CHIP_R200) {
1361 /* TV - tv dac */ 1373 /* TV - tv dac */
1374 ddc_i2c.valid = false;
1375 hpd.hpd = RADEON_HPD_NONE;
1362 radeon_add_legacy_encoder(dev, 1376 radeon_add_legacy_encoder(dev,
1363 radeon_get_encoder_id(dev, 1377 radeon_get_encoder_id(dev,
1364 ATOM_DEVICE_TV1_SUPPORT, 1378 ATOM_DEVICE_TV1_SUPPORT,
@@ -1368,7 +1382,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1368 ATOM_DEVICE_TV1_SUPPORT, 1382 ATOM_DEVICE_TV1_SUPPORT,
1369 DRM_MODE_CONNECTOR_SVIDEO, 1383 DRM_MODE_CONNECTOR_SVIDEO,
1370 &ddc_i2c, 1384 &ddc_i2c,
1371 CONNECTOR_OBJECT_ID_SVIDEO); 1385 CONNECTOR_OBJECT_ID_SVIDEO,
1386 &hpd);
1372 } 1387 }
1373 break; 1388 break;
1374 case CT_IBOOK: 1389 case CT_IBOOK:
@@ -1376,6 +1391,7 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1376 rdev->mode_info.connector_table); 1391 rdev->mode_info.connector_table);
1377 /* LVDS */ 1392 /* LVDS */
1378 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); 1393 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC);
1394 hpd.hpd = RADEON_HPD_NONE;
1379 radeon_add_legacy_encoder(dev, 1395 radeon_add_legacy_encoder(dev,
1380 radeon_get_encoder_id(dev, 1396 radeon_get_encoder_id(dev,
1381 ATOM_DEVICE_LCD1_SUPPORT, 1397 ATOM_DEVICE_LCD1_SUPPORT,
@@ -1383,9 +1399,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1383 ATOM_DEVICE_LCD1_SUPPORT); 1399 ATOM_DEVICE_LCD1_SUPPORT);
1384 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, 1400 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT,
1385 DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, 1401 DRM_MODE_CONNECTOR_LVDS, &ddc_i2c,
1386 CONNECTOR_OBJECT_ID_LVDS); 1402 CONNECTOR_OBJECT_ID_LVDS,
1403 &hpd);
1387 /* VGA - TV DAC */ 1404 /* VGA - TV DAC */
1388 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); 1405 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC);
1406 hpd.hpd = RADEON_HPD_NONE;
1389 radeon_add_legacy_encoder(dev, 1407 radeon_add_legacy_encoder(dev,
1390 radeon_get_encoder_id(dev, 1408 radeon_get_encoder_id(dev,
1391 ATOM_DEVICE_CRT2_SUPPORT, 1409 ATOM_DEVICE_CRT2_SUPPORT,
@@ -1393,8 +1411,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1393 ATOM_DEVICE_CRT2_SUPPORT); 1411 ATOM_DEVICE_CRT2_SUPPORT);
1394 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT, 1412 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT,
1395 DRM_MODE_CONNECTOR_VGA, &ddc_i2c, 1413 DRM_MODE_CONNECTOR_VGA, &ddc_i2c,
1396 CONNECTOR_OBJECT_ID_VGA); 1414 CONNECTOR_OBJECT_ID_VGA,
1415 &hpd);
1397 /* TV - TV DAC */ 1416 /* TV - TV DAC */
1417 ddc_i2c.valid = false;
1418 hpd.hpd = RADEON_HPD_NONE;
1398 radeon_add_legacy_encoder(dev, 1419 radeon_add_legacy_encoder(dev,
1399 radeon_get_encoder_id(dev, 1420 radeon_get_encoder_id(dev,
1400 ATOM_DEVICE_TV1_SUPPORT, 1421 ATOM_DEVICE_TV1_SUPPORT,
@@ -1403,13 +1424,15 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1403 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, 1424 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT,
1404 DRM_MODE_CONNECTOR_SVIDEO, 1425 DRM_MODE_CONNECTOR_SVIDEO,
1405 &ddc_i2c, 1426 &ddc_i2c,
1406 CONNECTOR_OBJECT_ID_SVIDEO); 1427 CONNECTOR_OBJECT_ID_SVIDEO,
1428 &hpd);
1407 break; 1429 break;
1408 case CT_POWERBOOK_EXTERNAL: 1430 case CT_POWERBOOK_EXTERNAL:
1409 DRM_INFO("Connector Table: %d (powerbook external tmds)\n", 1431 DRM_INFO("Connector Table: %d (powerbook external tmds)\n",
1410 rdev->mode_info.connector_table); 1432 rdev->mode_info.connector_table);
1411 /* LVDS */ 1433 /* LVDS */
1412 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); 1434 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC);
1435 hpd.hpd = RADEON_HPD_NONE;
1413 radeon_add_legacy_encoder(dev, 1436 radeon_add_legacy_encoder(dev,
1414 radeon_get_encoder_id(dev, 1437 radeon_get_encoder_id(dev,
1415 ATOM_DEVICE_LCD1_SUPPORT, 1438 ATOM_DEVICE_LCD1_SUPPORT,
@@ -1417,9 +1440,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1417 ATOM_DEVICE_LCD1_SUPPORT); 1440 ATOM_DEVICE_LCD1_SUPPORT);
1418 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, 1441 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT,
1419 DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, 1442 DRM_MODE_CONNECTOR_LVDS, &ddc_i2c,
1420 CONNECTOR_OBJECT_ID_LVDS); 1443 CONNECTOR_OBJECT_ID_LVDS,
1444 &hpd);
1421 /* DVI-I - primary dac, ext tmds */ 1445 /* DVI-I - primary dac, ext tmds */
1422 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); 1446 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC);
1447 hpd.hpd = RADEON_HPD_2; /* ??? */
1423 radeon_add_legacy_encoder(dev, 1448 radeon_add_legacy_encoder(dev,
1424 radeon_get_encoder_id(dev, 1449 radeon_get_encoder_id(dev,
1425 ATOM_DEVICE_DFP2_SUPPORT, 1450 ATOM_DEVICE_DFP2_SUPPORT,
@@ -1435,8 +1460,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1435 ATOM_DEVICE_DFP2_SUPPORT | 1460 ATOM_DEVICE_DFP2_SUPPORT |
1436 ATOM_DEVICE_CRT1_SUPPORT, 1461 ATOM_DEVICE_CRT1_SUPPORT,
1437 DRM_MODE_CONNECTOR_DVII, &ddc_i2c, 1462 DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
1438 CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I); 1463 CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I,
1464 &hpd);
1439 /* TV - TV DAC */ 1465 /* TV - TV DAC */
1466 ddc_i2c.valid = false;
1467 hpd.hpd = RADEON_HPD_NONE;
1440 radeon_add_legacy_encoder(dev, 1468 radeon_add_legacy_encoder(dev,
1441 radeon_get_encoder_id(dev, 1469 radeon_get_encoder_id(dev,
1442 ATOM_DEVICE_TV1_SUPPORT, 1470 ATOM_DEVICE_TV1_SUPPORT,
@@ -1445,13 +1473,15 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1445 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, 1473 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT,
1446 DRM_MODE_CONNECTOR_SVIDEO, 1474 DRM_MODE_CONNECTOR_SVIDEO,
1447 &ddc_i2c, 1475 &ddc_i2c,
1448 CONNECTOR_OBJECT_ID_SVIDEO); 1476 CONNECTOR_OBJECT_ID_SVIDEO,
1477 &hpd);
1449 break; 1478 break;
1450 case CT_POWERBOOK_INTERNAL: 1479 case CT_POWERBOOK_INTERNAL:
1451 DRM_INFO("Connector Table: %d (powerbook internal tmds)\n", 1480 DRM_INFO("Connector Table: %d (powerbook internal tmds)\n",
1452 rdev->mode_info.connector_table); 1481 rdev->mode_info.connector_table);
1453 /* LVDS */ 1482 /* LVDS */
1454 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); 1483 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC);
1484 hpd.hpd = RADEON_HPD_NONE;
1455 radeon_add_legacy_encoder(dev, 1485 radeon_add_legacy_encoder(dev,
1456 radeon_get_encoder_id(dev, 1486 radeon_get_encoder_id(dev,
1457 ATOM_DEVICE_LCD1_SUPPORT, 1487 ATOM_DEVICE_LCD1_SUPPORT,
@@ -1459,9 +1489,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1459 ATOM_DEVICE_LCD1_SUPPORT); 1489 ATOM_DEVICE_LCD1_SUPPORT);
1460 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, 1490 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT,
1461 DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, 1491 DRM_MODE_CONNECTOR_LVDS, &ddc_i2c,
1462 CONNECTOR_OBJECT_ID_LVDS); 1492 CONNECTOR_OBJECT_ID_LVDS,
1493 &hpd);
1463 /* DVI-I - primary dac, int tmds */ 1494 /* DVI-I - primary dac, int tmds */
1464 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); 1495 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC);
1496 hpd.hpd = RADEON_HPD_1; /* ??? */
1465 radeon_add_legacy_encoder(dev, 1497 radeon_add_legacy_encoder(dev,
1466 radeon_get_encoder_id(dev, 1498 radeon_get_encoder_id(dev,
1467 ATOM_DEVICE_DFP1_SUPPORT, 1499 ATOM_DEVICE_DFP1_SUPPORT,
@@ -1476,8 +1508,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1476 ATOM_DEVICE_DFP1_SUPPORT | 1508 ATOM_DEVICE_DFP1_SUPPORT |
1477 ATOM_DEVICE_CRT1_SUPPORT, 1509 ATOM_DEVICE_CRT1_SUPPORT,
1478 DRM_MODE_CONNECTOR_DVII, &ddc_i2c, 1510 DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
1479 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); 1511 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
1512 &hpd);
1480 /* TV - TV DAC */ 1513 /* TV - TV DAC */
1514 ddc_i2c.valid = false;
1515 hpd.hpd = RADEON_HPD_NONE;
1481 radeon_add_legacy_encoder(dev, 1516 radeon_add_legacy_encoder(dev,
1482 radeon_get_encoder_id(dev, 1517 radeon_get_encoder_id(dev,
1483 ATOM_DEVICE_TV1_SUPPORT, 1518 ATOM_DEVICE_TV1_SUPPORT,
@@ -1486,13 +1521,15 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1486 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, 1521 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT,
1487 DRM_MODE_CONNECTOR_SVIDEO, 1522 DRM_MODE_CONNECTOR_SVIDEO,
1488 &ddc_i2c, 1523 &ddc_i2c,
1489 CONNECTOR_OBJECT_ID_SVIDEO); 1524 CONNECTOR_OBJECT_ID_SVIDEO,
1525 &hpd);
1490 break; 1526 break;
1491 case CT_POWERBOOK_VGA: 1527 case CT_POWERBOOK_VGA:
1492 DRM_INFO("Connector Table: %d (powerbook vga)\n", 1528 DRM_INFO("Connector Table: %d (powerbook vga)\n",
1493 rdev->mode_info.connector_table); 1529 rdev->mode_info.connector_table);
1494 /* LVDS */ 1530 /* LVDS */
1495 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); 1531 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC);
1532 hpd.hpd = RADEON_HPD_NONE;
1496 radeon_add_legacy_encoder(dev, 1533 radeon_add_legacy_encoder(dev,
1497 radeon_get_encoder_id(dev, 1534 radeon_get_encoder_id(dev,
1498 ATOM_DEVICE_LCD1_SUPPORT, 1535 ATOM_DEVICE_LCD1_SUPPORT,
@@ -1500,9 +1537,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1500 ATOM_DEVICE_LCD1_SUPPORT); 1537 ATOM_DEVICE_LCD1_SUPPORT);
1501 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT, 1538 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_LCD1_SUPPORT,
1502 DRM_MODE_CONNECTOR_LVDS, &ddc_i2c, 1539 DRM_MODE_CONNECTOR_LVDS, &ddc_i2c,
1503 CONNECTOR_OBJECT_ID_LVDS); 1540 CONNECTOR_OBJECT_ID_LVDS,
1541 &hpd);
1504 /* VGA - primary dac */ 1542 /* VGA - primary dac */
1505 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); 1543 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC);
1544 hpd.hpd = RADEON_HPD_NONE;
1506 radeon_add_legacy_encoder(dev, 1545 radeon_add_legacy_encoder(dev,
1507 radeon_get_encoder_id(dev, 1546 radeon_get_encoder_id(dev,
1508 ATOM_DEVICE_CRT1_SUPPORT, 1547 ATOM_DEVICE_CRT1_SUPPORT,
@@ -1510,8 +1549,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1510 ATOM_DEVICE_CRT1_SUPPORT); 1549 ATOM_DEVICE_CRT1_SUPPORT);
1511 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT1_SUPPORT, 1550 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT1_SUPPORT,
1512 DRM_MODE_CONNECTOR_VGA, &ddc_i2c, 1551 DRM_MODE_CONNECTOR_VGA, &ddc_i2c,
1513 CONNECTOR_OBJECT_ID_VGA); 1552 CONNECTOR_OBJECT_ID_VGA,
1553 &hpd);
1514 /* TV - TV DAC */ 1554 /* TV - TV DAC */
1555 ddc_i2c.valid = false;
1556 hpd.hpd = RADEON_HPD_NONE;
1515 radeon_add_legacy_encoder(dev, 1557 radeon_add_legacy_encoder(dev,
1516 radeon_get_encoder_id(dev, 1558 radeon_get_encoder_id(dev,
1517 ATOM_DEVICE_TV1_SUPPORT, 1559 ATOM_DEVICE_TV1_SUPPORT,
@@ -1520,13 +1562,15 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1520 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, 1562 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT,
1521 DRM_MODE_CONNECTOR_SVIDEO, 1563 DRM_MODE_CONNECTOR_SVIDEO,
1522 &ddc_i2c, 1564 &ddc_i2c,
1523 CONNECTOR_OBJECT_ID_SVIDEO); 1565 CONNECTOR_OBJECT_ID_SVIDEO,
1566 &hpd);
1524 break; 1567 break;
1525 case CT_MINI_EXTERNAL: 1568 case CT_MINI_EXTERNAL:
1526 DRM_INFO("Connector Table: %d (mini external tmds)\n", 1569 DRM_INFO("Connector Table: %d (mini external tmds)\n",
1527 rdev->mode_info.connector_table); 1570 rdev->mode_info.connector_table);
1528 /* DVI-I - tv dac, ext tmds */ 1571 /* DVI-I - tv dac, ext tmds */
1529 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); 1572 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC);
1573 hpd.hpd = RADEON_HPD_2; /* ??? */
1530 radeon_add_legacy_encoder(dev, 1574 radeon_add_legacy_encoder(dev,
1531 radeon_get_encoder_id(dev, 1575 radeon_get_encoder_id(dev,
1532 ATOM_DEVICE_DFP2_SUPPORT, 1576 ATOM_DEVICE_DFP2_SUPPORT,
@@ -1542,8 +1586,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1542 ATOM_DEVICE_DFP2_SUPPORT | 1586 ATOM_DEVICE_DFP2_SUPPORT |
1543 ATOM_DEVICE_CRT2_SUPPORT, 1587 ATOM_DEVICE_CRT2_SUPPORT,
1544 DRM_MODE_CONNECTOR_DVII, &ddc_i2c, 1588 DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
1545 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); 1589 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
1590 &hpd);
1546 /* TV - TV DAC */ 1591 /* TV - TV DAC */
1592 ddc_i2c.valid = false;
1593 hpd.hpd = RADEON_HPD_NONE;
1547 radeon_add_legacy_encoder(dev, 1594 radeon_add_legacy_encoder(dev,
1548 radeon_get_encoder_id(dev, 1595 radeon_get_encoder_id(dev,
1549 ATOM_DEVICE_TV1_SUPPORT, 1596 ATOM_DEVICE_TV1_SUPPORT,
@@ -1552,13 +1599,15 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1552 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_TV1_SUPPORT, 1599 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_TV1_SUPPORT,
1553 DRM_MODE_CONNECTOR_SVIDEO, 1600 DRM_MODE_CONNECTOR_SVIDEO,
1554 &ddc_i2c, 1601 &ddc_i2c,
1555 CONNECTOR_OBJECT_ID_SVIDEO); 1602 CONNECTOR_OBJECT_ID_SVIDEO,
1603 &hpd);
1556 break; 1604 break;
1557 case CT_MINI_INTERNAL: 1605 case CT_MINI_INTERNAL:
1558 DRM_INFO("Connector Table: %d (mini internal tmds)\n", 1606 DRM_INFO("Connector Table: %d (mini internal tmds)\n",
1559 rdev->mode_info.connector_table); 1607 rdev->mode_info.connector_table);
1560 /* DVI-I - tv dac, int tmds */ 1608 /* DVI-I - tv dac, int tmds */
1561 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); 1609 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC);
1610 hpd.hpd = RADEON_HPD_1; /* ??? */
1562 radeon_add_legacy_encoder(dev, 1611 radeon_add_legacy_encoder(dev,
1563 radeon_get_encoder_id(dev, 1612 radeon_get_encoder_id(dev,
1564 ATOM_DEVICE_DFP1_SUPPORT, 1613 ATOM_DEVICE_DFP1_SUPPORT,
@@ -1573,8 +1622,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1573 ATOM_DEVICE_DFP1_SUPPORT | 1622 ATOM_DEVICE_DFP1_SUPPORT |
1574 ATOM_DEVICE_CRT2_SUPPORT, 1623 ATOM_DEVICE_CRT2_SUPPORT,
1575 DRM_MODE_CONNECTOR_DVII, &ddc_i2c, 1624 DRM_MODE_CONNECTOR_DVII, &ddc_i2c,
1576 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); 1625 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
1626 &hpd);
1577 /* TV - TV DAC */ 1627 /* TV - TV DAC */
1628 ddc_i2c.valid = false;
1629 hpd.hpd = RADEON_HPD_NONE;
1578 radeon_add_legacy_encoder(dev, 1630 radeon_add_legacy_encoder(dev,
1579 radeon_get_encoder_id(dev, 1631 radeon_get_encoder_id(dev,
1580 ATOM_DEVICE_TV1_SUPPORT, 1632 ATOM_DEVICE_TV1_SUPPORT,
@@ -1583,13 +1635,15 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1583 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_TV1_SUPPORT, 1635 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_TV1_SUPPORT,
1584 DRM_MODE_CONNECTOR_SVIDEO, 1636 DRM_MODE_CONNECTOR_SVIDEO,
1585 &ddc_i2c, 1637 &ddc_i2c,
1586 CONNECTOR_OBJECT_ID_SVIDEO); 1638 CONNECTOR_OBJECT_ID_SVIDEO,
1639 &hpd);
1587 break; 1640 break;
1588 case CT_IMAC_G5_ISIGHT: 1641 case CT_IMAC_G5_ISIGHT:
1589 DRM_INFO("Connector Table: %d (imac g5 isight)\n", 1642 DRM_INFO("Connector Table: %d (imac g5 isight)\n",
1590 rdev->mode_info.connector_table); 1643 rdev->mode_info.connector_table);
1591 /* DVI-D - int tmds */ 1644 /* DVI-D - int tmds */
1592 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID); 1645 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_MONID);
1646 hpd.hpd = RADEON_HPD_1; /* ??? */
1593 radeon_add_legacy_encoder(dev, 1647 radeon_add_legacy_encoder(dev,
1594 radeon_get_encoder_id(dev, 1648 radeon_get_encoder_id(dev,
1595 ATOM_DEVICE_DFP1_SUPPORT, 1649 ATOM_DEVICE_DFP1_SUPPORT,
@@ -1597,9 +1651,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1597 ATOM_DEVICE_DFP1_SUPPORT); 1651 ATOM_DEVICE_DFP1_SUPPORT);
1598 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_DFP1_SUPPORT, 1652 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_DFP1_SUPPORT,
1599 DRM_MODE_CONNECTOR_DVID, &ddc_i2c, 1653 DRM_MODE_CONNECTOR_DVID, &ddc_i2c,
1600 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D); 1654 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D,
1655 &hpd);
1601 /* VGA - tv dac */ 1656 /* VGA - tv dac */
1602 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); 1657 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC);
1658 hpd.hpd = RADEON_HPD_NONE;
1603 radeon_add_legacy_encoder(dev, 1659 radeon_add_legacy_encoder(dev,
1604 radeon_get_encoder_id(dev, 1660 radeon_get_encoder_id(dev,
1605 ATOM_DEVICE_CRT2_SUPPORT, 1661 ATOM_DEVICE_CRT2_SUPPORT,
@@ -1607,8 +1663,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1607 ATOM_DEVICE_CRT2_SUPPORT); 1663 ATOM_DEVICE_CRT2_SUPPORT);
1608 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT, 1664 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT,
1609 DRM_MODE_CONNECTOR_VGA, &ddc_i2c, 1665 DRM_MODE_CONNECTOR_VGA, &ddc_i2c,
1610 CONNECTOR_OBJECT_ID_VGA); 1666 CONNECTOR_OBJECT_ID_VGA,
1667 &hpd);
1611 /* TV - TV DAC */ 1668 /* TV - TV DAC */
1669 ddc_i2c.valid = false;
1670 hpd.hpd = RADEON_HPD_NONE;
1612 radeon_add_legacy_encoder(dev, 1671 radeon_add_legacy_encoder(dev,
1613 radeon_get_encoder_id(dev, 1672 radeon_get_encoder_id(dev,
1614 ATOM_DEVICE_TV1_SUPPORT, 1673 ATOM_DEVICE_TV1_SUPPORT,
@@ -1617,13 +1676,15 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1617 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, 1676 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT,
1618 DRM_MODE_CONNECTOR_SVIDEO, 1677 DRM_MODE_CONNECTOR_SVIDEO,
1619 &ddc_i2c, 1678 &ddc_i2c,
1620 CONNECTOR_OBJECT_ID_SVIDEO); 1679 CONNECTOR_OBJECT_ID_SVIDEO,
1680 &hpd);
1621 break; 1681 break;
1622 case CT_EMAC: 1682 case CT_EMAC:
1623 DRM_INFO("Connector Table: %d (emac)\n", 1683 DRM_INFO("Connector Table: %d (emac)\n",
1624 rdev->mode_info.connector_table); 1684 rdev->mode_info.connector_table);
1625 /* VGA - primary dac */ 1685 /* VGA - primary dac */
1626 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); 1686 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC);
1687 hpd.hpd = RADEON_HPD_NONE;
1627 radeon_add_legacy_encoder(dev, 1688 radeon_add_legacy_encoder(dev,
1628 radeon_get_encoder_id(dev, 1689 radeon_get_encoder_id(dev,
1629 ATOM_DEVICE_CRT1_SUPPORT, 1690 ATOM_DEVICE_CRT1_SUPPORT,
@@ -1631,9 +1692,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1631 ATOM_DEVICE_CRT1_SUPPORT); 1692 ATOM_DEVICE_CRT1_SUPPORT);
1632 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_CRT1_SUPPORT, 1693 radeon_add_legacy_connector(dev, 0, ATOM_DEVICE_CRT1_SUPPORT,
1633 DRM_MODE_CONNECTOR_VGA, &ddc_i2c, 1694 DRM_MODE_CONNECTOR_VGA, &ddc_i2c,
1634 CONNECTOR_OBJECT_ID_VGA); 1695 CONNECTOR_OBJECT_ID_VGA,
1696 &hpd);
1635 /* VGA - tv dac */ 1697 /* VGA - tv dac */
1636 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC); 1698 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_CRT2_DDC);
1699 hpd.hpd = RADEON_HPD_NONE;
1637 radeon_add_legacy_encoder(dev, 1700 radeon_add_legacy_encoder(dev,
1638 radeon_get_encoder_id(dev, 1701 radeon_get_encoder_id(dev,
1639 ATOM_DEVICE_CRT2_SUPPORT, 1702 ATOM_DEVICE_CRT2_SUPPORT,
@@ -1641,8 +1704,11 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1641 ATOM_DEVICE_CRT2_SUPPORT); 1704 ATOM_DEVICE_CRT2_SUPPORT);
1642 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT, 1705 radeon_add_legacy_connector(dev, 1, ATOM_DEVICE_CRT2_SUPPORT,
1643 DRM_MODE_CONNECTOR_VGA, &ddc_i2c, 1706 DRM_MODE_CONNECTOR_VGA, &ddc_i2c,
1644 CONNECTOR_OBJECT_ID_VGA); 1707 CONNECTOR_OBJECT_ID_VGA,
1708 &hpd);
1645 /* TV - TV DAC */ 1709 /* TV - TV DAC */
1710 ddc_i2c.valid = false;
1711 hpd.hpd = RADEON_HPD_NONE;
1646 radeon_add_legacy_encoder(dev, 1712 radeon_add_legacy_encoder(dev,
1647 radeon_get_encoder_id(dev, 1713 radeon_get_encoder_id(dev,
1648 ATOM_DEVICE_TV1_SUPPORT, 1714 ATOM_DEVICE_TV1_SUPPORT,
@@ -1651,7 +1717,8 @@ bool radeon_get_legacy_connector_info_from_table(struct drm_device *dev)
1651 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT, 1717 radeon_add_legacy_connector(dev, 2, ATOM_DEVICE_TV1_SUPPORT,
1652 DRM_MODE_CONNECTOR_SVIDEO, 1718 DRM_MODE_CONNECTOR_SVIDEO,
1653 &ddc_i2c, 1719 &ddc_i2c,
1654 CONNECTOR_OBJECT_ID_SVIDEO); 1720 CONNECTOR_OBJECT_ID_SVIDEO,
1721 &hpd);
1655 break; 1722 break;
1656 default: 1723 default:
1657 DRM_INFO("Connector table: %d (invalid)\n", 1724 DRM_INFO("Connector table: %d (invalid)\n",
@@ -1668,7 +1735,8 @@ static bool radeon_apply_legacy_quirks(struct drm_device *dev,
1668 int bios_index, 1735 int bios_index,
1669 enum radeon_combios_connector 1736 enum radeon_combios_connector
1670 *legacy_connector, 1737 *legacy_connector,
1671 struct radeon_i2c_bus_rec *ddc_i2c) 1738 struct radeon_i2c_bus_rec *ddc_i2c,
1739 struct radeon_hpd *hpd)
1672{ 1740{
1673 struct radeon_device *rdev = dev->dev_private; 1741 struct radeon_device *rdev = dev->dev_private;
1674 1742
@@ -1792,6 +1860,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
1792 enum radeon_combios_connector connector; 1860 enum radeon_combios_connector connector;
1793 int i = 0; 1861 int i = 0;
1794 struct radeon_i2c_bus_rec ddc_i2c; 1862 struct radeon_i2c_bus_rec ddc_i2c;
1863 struct radeon_hpd hpd;
1795 1864
1796 if (rdev->bios == NULL) 1865 if (rdev->bios == NULL)
1797 return false; 1866 return false;
@@ -1830,8 +1899,22 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
1830 break; 1899 break;
1831 } 1900 }
1832 1901
1902 switch (connector) {
1903 case CONNECTOR_PROPRIETARY_LEGACY:
1904 case CONNECTOR_DVI_I_LEGACY:
1905 case CONNECTOR_DVI_D_LEGACY:
1906 if ((tmp >> 4) & 0x1)
1907 hpd.hpd = RADEON_HPD_2;
1908 else
1909 hpd.hpd = RADEON_HPD_1;
1910 break;
1911 default:
1912 hpd.hpd = RADEON_HPD_NONE;
1913 break;
1914 }
1915
1833 if (!radeon_apply_legacy_quirks(dev, i, &connector, 1916 if (!radeon_apply_legacy_quirks(dev, i, &connector,
1834 &ddc_i2c)) 1917 &ddc_i2c, &hpd))
1835 continue; 1918 continue;
1836 1919
1837 switch (connector) { 1920 switch (connector) {
@@ -1848,7 +1931,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
1848 legacy_connector_convert 1931 legacy_connector_convert
1849 [connector], 1932 [connector],
1850 &ddc_i2c, 1933 &ddc_i2c,
1851 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D); 1934 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_D,
1935 &hpd);
1852 break; 1936 break;
1853 case CONNECTOR_CRT_LEGACY: 1937 case CONNECTOR_CRT_LEGACY:
1854 if (tmp & 0x1) { 1938 if (tmp & 0x1) {
@@ -1874,7 +1958,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
1874 legacy_connector_convert 1958 legacy_connector_convert
1875 [connector], 1959 [connector],
1876 &ddc_i2c, 1960 &ddc_i2c,
1877 CONNECTOR_OBJECT_ID_VGA); 1961 CONNECTOR_OBJECT_ID_VGA,
1962 &hpd);
1878 break; 1963 break;
1879 case CONNECTOR_DVI_I_LEGACY: 1964 case CONNECTOR_DVI_I_LEGACY:
1880 devices = 0; 1965 devices = 0;
@@ -1920,7 +2005,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
1920 legacy_connector_convert 2005 legacy_connector_convert
1921 [connector], 2006 [connector],
1922 &ddc_i2c, 2007 &ddc_i2c,
1923 connector_object_id); 2008 connector_object_id,
2009 &hpd);
1924 break; 2010 break;
1925 case CONNECTOR_DVI_D_LEGACY: 2011 case CONNECTOR_DVI_D_LEGACY:
1926 if ((tmp >> 4) & 0x1) { 2012 if ((tmp >> 4) & 0x1) {
@@ -1938,7 +2024,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
1938 legacy_connector_convert 2024 legacy_connector_convert
1939 [connector], 2025 [connector],
1940 &ddc_i2c, 2026 &ddc_i2c,
1941 connector_object_id); 2027 connector_object_id,
2028 &hpd);
1942 break; 2029 break;
1943 case CONNECTOR_CTV_LEGACY: 2030 case CONNECTOR_CTV_LEGACY:
1944 case CONNECTOR_STV_LEGACY: 2031 case CONNECTOR_STV_LEGACY:
@@ -1953,7 +2040,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
1953 legacy_connector_convert 2040 legacy_connector_convert
1954 [connector], 2041 [connector],
1955 &ddc_i2c, 2042 &ddc_i2c,
1956 CONNECTOR_OBJECT_ID_SVIDEO); 2043 CONNECTOR_OBJECT_ID_SVIDEO,
2044 &hpd);
1957 break; 2045 break;
1958 default: 2046 default:
1959 DRM_ERROR("Unknown connector type: %d\n", 2047 DRM_ERROR("Unknown connector type: %d\n",
@@ -1980,13 +2068,15 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
1980 ATOM_DEVICE_DFP1_SUPPORT); 2068 ATOM_DEVICE_DFP1_SUPPORT);
1981 2069
1982 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC); 2070 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_DVI_DDC);
2071 hpd.hpd = RADEON_HPD_NONE;
1983 radeon_add_legacy_connector(dev, 2072 radeon_add_legacy_connector(dev,
1984 0, 2073 0,
1985 ATOM_DEVICE_CRT1_SUPPORT | 2074 ATOM_DEVICE_CRT1_SUPPORT |
1986 ATOM_DEVICE_DFP1_SUPPORT, 2075 ATOM_DEVICE_DFP1_SUPPORT,
1987 DRM_MODE_CONNECTOR_DVII, 2076 DRM_MODE_CONNECTOR_DVII,
1988 &ddc_i2c, 2077 &ddc_i2c,
1989 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I); 2078 CONNECTOR_OBJECT_ID_SINGLE_LINK_DVI_I,
2079 &hpd);
1990 } else { 2080 } else {
1991 uint16_t crt_info = 2081 uint16_t crt_info =
1992 combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE); 2082 combios_get_table_offset(dev, COMBIOS_CRT_INFO_TABLE);
@@ -1998,12 +2088,14 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
1998 1), 2088 1),
1999 ATOM_DEVICE_CRT1_SUPPORT); 2089 ATOM_DEVICE_CRT1_SUPPORT);
2000 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC); 2090 ddc_i2c = combios_setup_i2c_bus(rdev, RADEON_GPIO_VGA_DDC);
2091 hpd.hpd = RADEON_HPD_NONE;
2001 radeon_add_legacy_connector(dev, 2092 radeon_add_legacy_connector(dev,
2002 0, 2093 0,
2003 ATOM_DEVICE_CRT1_SUPPORT, 2094 ATOM_DEVICE_CRT1_SUPPORT,
2004 DRM_MODE_CONNECTOR_VGA, 2095 DRM_MODE_CONNECTOR_VGA,
2005 &ddc_i2c, 2096 &ddc_i2c,
2006 CONNECTOR_OBJECT_ID_VGA); 2097 CONNECTOR_OBJECT_ID_VGA,
2098 &hpd);
2007 } else { 2099 } else {
2008 DRM_DEBUG("No connector info found\n"); 2100 DRM_DEBUG("No connector info found\n");
2009 return false; 2101 return false;
@@ -2098,12 +2190,14 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
2098 } else 2190 } else
2099 ddc_i2c.valid = false; 2191 ddc_i2c.valid = false;
2100 2192
2193 hpd.hpd = RADEON_HPD_NONE;
2101 radeon_add_legacy_connector(dev, 2194 radeon_add_legacy_connector(dev,
2102 5, 2195 5,
2103 ATOM_DEVICE_LCD1_SUPPORT, 2196 ATOM_DEVICE_LCD1_SUPPORT,
2104 DRM_MODE_CONNECTOR_LVDS, 2197 DRM_MODE_CONNECTOR_LVDS,
2105 &ddc_i2c, 2198 &ddc_i2c,
2106 CONNECTOR_OBJECT_ID_LVDS); 2199 CONNECTOR_OBJECT_ID_LVDS,
2200 &hpd);
2107 } 2201 }
2108 } 2202 }
2109 2203
@@ -2114,6 +2208,7 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
2114 if (tv_info) { 2208 if (tv_info) {
2115 if (RBIOS8(tv_info + 6) == 'T') { 2209 if (RBIOS8(tv_info + 6) == 'T') {
2116 if (radeon_apply_legacy_tv_quirks(dev)) { 2210 if (radeon_apply_legacy_tv_quirks(dev)) {
2211 hpd.hpd = RADEON_HPD_NONE;
2117 radeon_add_legacy_encoder(dev, 2212 radeon_add_legacy_encoder(dev,
2118 radeon_get_encoder_id 2213 radeon_get_encoder_id
2119 (dev, 2214 (dev,
@@ -2124,7 +2219,8 @@ bool radeon_get_legacy_connector_info_from_bios(struct drm_device *dev)
2124 ATOM_DEVICE_TV1_SUPPORT, 2219 ATOM_DEVICE_TV1_SUPPORT,
2125 DRM_MODE_CONNECTOR_SVIDEO, 2220 DRM_MODE_CONNECTOR_SVIDEO,
2126 &ddc_i2c, 2221 &ddc_i2c,
2127 CONNECTOR_OBJECT_ID_SVIDEO); 2222 CONNECTOR_OBJECT_ID_SVIDEO,
2223 &hpd);
2128 } 2224 }
2129 } 2225 }
2130 } 2226 }
diff --git a/drivers/gpu/drm/radeon/radeon_connectors.c b/drivers/gpu/drm/radeon/radeon_connectors.c
index 563847213609..7328d1528a85 100644
--- a/drivers/gpu/drm/radeon/radeon_connectors.c
+++ b/drivers/gpu/drm/radeon/radeon_connectors.c
@@ -989,7 +989,8 @@ radeon_add_atom_connector(struct drm_device *dev,
989 struct radeon_i2c_bus_rec *i2c_bus, 989 struct radeon_i2c_bus_rec *i2c_bus,
990 bool linkb, 990 bool linkb,
991 uint32_t igp_lane_info, 991 uint32_t igp_lane_info,
992 uint16_t connector_object_id) 992 uint16_t connector_object_id,
993 struct radeon_hpd *hpd)
993{ 994{
994 struct radeon_device *rdev = dev->dev_private; 995 struct radeon_device *rdev = dev->dev_private;
995 struct drm_connector *connector; 996 struct drm_connector *connector;
@@ -1029,6 +1030,7 @@ radeon_add_atom_connector(struct drm_device *dev,
1029 radeon_connector->devices = supported_device; 1030 radeon_connector->devices = supported_device;
1030 radeon_connector->shared_ddc = shared_ddc; 1031 radeon_connector->shared_ddc = shared_ddc;
1031 radeon_connector->connector_object_id = connector_object_id; 1032 radeon_connector->connector_object_id = connector_object_id;
1033 radeon_connector->hpd = *hpd;
1032 switch (connector_type) { 1034 switch (connector_type) {
1033 case DRM_MODE_CONNECTOR_VGA: 1035 case DRM_MODE_CONNECTOR_VGA:
1034 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); 1036 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
@@ -1186,7 +1188,8 @@ radeon_add_legacy_connector(struct drm_device *dev,
1186 uint32_t supported_device, 1188 uint32_t supported_device,
1187 int connector_type, 1189 int connector_type,
1188 struct radeon_i2c_bus_rec *i2c_bus, 1190 struct radeon_i2c_bus_rec *i2c_bus,
1189 uint16_t connector_object_id) 1191 uint16_t connector_object_id,
1192 struct radeon_hpd *hpd)
1190{ 1193{
1191 struct radeon_device *rdev = dev->dev_private; 1194 struct radeon_device *rdev = dev->dev_private;
1192 struct drm_connector *connector; 1195 struct drm_connector *connector;
@@ -1216,6 +1219,7 @@ radeon_add_legacy_connector(struct drm_device *dev,
1216 radeon_connector->connector_id = connector_id; 1219 radeon_connector->connector_id = connector_id;
1217 radeon_connector->devices = supported_device; 1220 radeon_connector->devices = supported_device;
1218 radeon_connector->connector_object_id = connector_object_id; 1221 radeon_connector->connector_object_id = connector_object_id;
1222 radeon_connector->hpd = *hpd;
1219 switch (connector_type) { 1223 switch (connector_type) {
1220 case DRM_MODE_CONNECTOR_VGA: 1224 case DRM_MODE_CONNECTOR_VGA:
1221 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type); 1225 drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
diff --git a/drivers/gpu/drm/radeon/radeon_display.c b/drivers/gpu/drm/radeon/radeon_display.c
index 62c929e5b089..d4f4fb1c54c7 100644
--- a/drivers/gpu/drm/radeon/radeon_display.c
+++ b/drivers/gpu/drm/radeon/radeon_display.c
@@ -250,6 +250,16 @@ static const char *connector_names[13] = {
250 "HDMI-B", 250 "HDMI-B",
251}; 251};
252 252
253static const char *hpd_names[7] = {
254 "NONE",
255 "HPD1",
256 "HPD2",
257 "HPD3",
258 "HPD4",
259 "HPD5",
260 "HPD6",
261};
262
253static void radeon_print_display_setup(struct drm_device *dev) 263static void radeon_print_display_setup(struct drm_device *dev)
254{ 264{
255 struct drm_connector *connector; 265 struct drm_connector *connector;
@@ -264,6 +274,8 @@ static void radeon_print_display_setup(struct drm_device *dev)
264 radeon_connector = to_radeon_connector(connector); 274 radeon_connector = to_radeon_connector(connector);
265 DRM_INFO("Connector %d:\n", i); 275 DRM_INFO("Connector %d:\n", i);
266 DRM_INFO(" %s\n", connector_names[connector->connector_type]); 276 DRM_INFO(" %s\n", connector_names[connector->connector_type]);
277 if (radeon_connector->hpd.hpd != RADEON_HPD_NONE)
278 DRM_INFO(" %s\n", hpd_names[radeon_connector->hpd.hpd]);
267 if (radeon_connector->ddc_bus) 279 if (radeon_connector->ddc_bus)
268 DRM_INFO(" DDC: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n", 280 DRM_INFO(" DDC: 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x 0x%x\n",
269 radeon_connector->ddc_bus->rec.mask_clk_reg, 281 radeon_connector->ddc_bus->rec.mask_clk_reg,
diff --git a/drivers/gpu/drm/radeon/radeon_mode.h b/drivers/gpu/drm/radeon/radeon_mode.h
index a2633628dbb8..61b90343f794 100644
--- a/drivers/gpu/drm/radeon/radeon_mode.h
+++ b/drivers/gpu/drm/radeon/radeon_mode.h
@@ -347,6 +347,29 @@ struct radeon_connector_atom_dig {
347 int dp_lane_count; 347 int dp_lane_count;
348}; 348};
349 349
350struct radeon_gpio_rec {
351 bool valid;
352 u8 id;
353 u32 reg;
354 u32 mask;
355};
356
357enum radeon_hpd_id {
358 RADEON_HPD_NONE = 0,
359 RADEON_HPD_1,
360 RADEON_HPD_2,
361 RADEON_HPD_3,
362 RADEON_HPD_4,
363 RADEON_HPD_5,
364 RADEON_HPD_6,
365};
366
367struct radeon_hpd {
368 enum radeon_hpd_id hpd;
369 u8 plugged_state;
370 struct radeon_gpio_rec gpio;
371};
372
350struct radeon_connector { 373struct radeon_connector {
351 struct drm_connector base; 374 struct drm_connector base;
352 uint32_t connector_id; 375 uint32_t connector_id;
@@ -361,6 +384,7 @@ struct radeon_connector {
361 void *con_priv; 384 void *con_priv;
362 bool dac_load_detect; 385 bool dac_load_detect;
363 uint16_t connector_object_id; 386 uint16_t connector_object_id;
387 struct radeon_hpd hpd;
364}; 388};
365 389
366struct radeon_framebuffer { 390struct radeon_framebuffer {