Subversion Repositories Kolibri OS

Rev

Rev 2160 | Rev 3120 | Go to most recent revision | Show entire file | Regard whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 2160 Rev 2997
Line 21... Line 21...
21
 * OTHER DEALINGS IN THE SOFTWARE.
21
 * OTHER DEALINGS IN THE SOFTWARE.
22
 *
22
 *
23
 * Authors: Dave Airlie
23
 * Authors: Dave Airlie
24
 *          Alex Deucher
24
 *          Alex Deucher
25
 */
25
 */
26
#include "drmP.h"
26
#include 
27
#include "drm_edid.h"
27
#include 
28
#include "drm_crtc_helper.h"
28
#include 
29
#include "drm_fb_helper.h"
29
#include 
30
#include "radeon_drm.h"
30
#include 
31
#include "radeon.h"
31
#include "radeon.h"
32
#include "atom.h"
32
#include "atom.h"
Line 33... Line 33...
33
 
33
 
34
extern void
34
extern void
Line 38... Line 38...
38
extern void
38
extern void
39
radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
39
radeon_atombios_connected_scratch_regs(struct drm_connector *connector,
40
				       struct drm_encoder *encoder,
40
				       struct drm_encoder *encoder,
41
				       bool connected);
41
				       bool connected);
Line 42... Line -...
42
 
-
 
43
extern void
-
 
44
radeon_legacy_backlight_init(struct radeon_encoder *radeon_encoder,
-
 
45
			     struct drm_connector *drm_connector);
-
 
46
 
-
 
47
bool radeon_connector_encoder_is_dp_bridge(struct drm_connector *connector);
-
 
48
 
42
 
49
void radeon_connector_hotplug(struct drm_connector *connector)
43
void radeon_connector_hotplug(struct drm_connector *connector)
50
{
44
{
51
	struct drm_device *dev = connector->dev;
45
	struct drm_device *dev = connector->dev;
52
	struct radeon_device *rdev = dev->dev_private;
46
	struct radeon_device *rdev = dev->dev_private;
Line 58... Line 52...
58
	if (radeon_connector->hpd.hpd == RADEON_HPD_NONE)
52
	if (radeon_connector->hpd.hpd == RADEON_HPD_NONE)
59
		return;
53
		return;
Line 60... Line 54...
60
 
54
 
Line 61... Line 55...
61
		radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
55
		radeon_hpd_set_polarity(rdev, radeon_connector->hpd.hpd);
62
 
-
 
63
	/* powering up/down the eDP panel generates hpd events which
-
 
64
	 * can interfere with modesetting.
56
 
65
	 */
57
	/* if the connector is already off, don't turn it back on */
Line -... Line 58...
-
 
58
	if (connector->dpms != DRM_MODE_DPMS_ON)
-
 
59
		return;
66
	if (connector->connector_type == DRM_MODE_CONNECTOR_eDP)
60
 
67
		return;
61
	/* just deal with DP (not eDP) here. */
-
 
62
	if (connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) {
68
 
63
		struct radeon_connector_atom_dig *dig_connector =
69
	/* pre-r600 did not always have the hpd pins mapped accurately to connectors */
64
			radeon_connector->con_priv;
-
 
65
 
-
 
66
		/* if existing sink type was not DP no need to retrain */
-
 
67
		if (dig_connector->dp_sink_type != CONNECTOR_OBJECT_ID_DISPLAYPORT)
-
 
68
			return;
-
 
69
 
-
 
70
		/* first get sink type as it may be reset after (un)plug */
70
	if (rdev->family >= CHIP_R600) {
71
		dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector);
-
 
72
		/* don't do anything if sink is not display port, i.e.,
-
 
73
		 * passive dp->(dvi|hdmi) adaptor
-
 
74
		 */
-
 
75
		if (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
71
		if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
76
		int saved_dpms = connector->dpms;
-
 
77
			/* Only turn off the display if it's physically disconnected */
-
 
78
			if (!radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
-
 
79
			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
-
 
80
			} else if (radeon_dp_needs_link_train(radeon_connector)) {
-
 
81
				/* set it to OFF so that drm_helper_connector_dpms()
-
 
82
				 * won't return immediately since the current state
-
 
83
				 * is ON at this point.
-
 
84
				 */
-
 
85
				connector->dpms = DRM_MODE_DPMS_OFF;
-
 
86
			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
72
			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_ON);
87
			}
73
		else
88
		connector->dpms = saved_dpms;
Line 74... Line 89...
74
			drm_helper_connector_dpms(connector, DRM_MODE_DPMS_OFF);
89
			}
75
			}
90
	}
Line 82... Line 97...
82
	if (crtc && crtc->enabled) {
97
	if (crtc && crtc->enabled) {
83
		drm_crtc_helper_set_mode(crtc, &crtc->mode,
98
		drm_crtc_helper_set_mode(crtc, &crtc->mode,
84
					 crtc->x, crtc->y, crtc->fb);
99
					 crtc->x, crtc->y, crtc->fb);
85
	}
100
	}
86
}
101
}
-
 
102
 
-
 
103
int radeon_get_monitor_bpc(struct drm_connector *connector)
-
 
104
{
-
 
105
	struct drm_device *dev = connector->dev;
-
 
106
	struct radeon_device *rdev = dev->dev_private;
-
 
107
	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
-
 
108
	struct radeon_connector_atom_dig *dig_connector;
-
 
109
	int bpc = 8;
-
 
110
 
-
 
111
	switch (connector->connector_type) {
-
 
112
	case DRM_MODE_CONNECTOR_DVII:
-
 
113
	case DRM_MODE_CONNECTOR_HDMIB:
-
 
114
		if (radeon_connector->use_digital) {
-
 
115
			if (drm_detect_hdmi_monitor(radeon_connector->edid)) {
-
 
116
				if (connector->display_info.bpc)
-
 
117
					bpc = connector->display_info.bpc;
-
 
118
			}
-
 
119
		}
-
 
120
		break;
-
 
121
	case DRM_MODE_CONNECTOR_DVID:
-
 
122
	case DRM_MODE_CONNECTOR_HDMIA:
-
 
123
		if (drm_detect_hdmi_monitor(radeon_connector->edid)) {
-
 
124
			if (connector->display_info.bpc)
-
 
125
				bpc = connector->display_info.bpc;
-
 
126
		}
-
 
127
		break;
-
 
128
	case DRM_MODE_CONNECTOR_DisplayPort:
-
 
129
		dig_connector = radeon_connector->con_priv;
-
 
130
		if ((dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) ||
-
 
131
		    (dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_eDP) ||
-
 
132
		    drm_detect_hdmi_monitor(radeon_connector->edid)) {
-
 
133
			if (connector->display_info.bpc)
-
 
134
				bpc = connector->display_info.bpc;
-
 
135
		}
-
 
136
		break;
-
 
137
	case DRM_MODE_CONNECTOR_eDP:
-
 
138
	case DRM_MODE_CONNECTOR_LVDS:
-
 
139
		if (connector->display_info.bpc)
-
 
140
			bpc = connector->display_info.bpc;
-
 
141
		else if (ASIC_IS_DCE41(rdev) || ASIC_IS_DCE5(rdev)) {
-
 
142
			struct drm_connector_helper_funcs *connector_funcs =
-
 
143
				connector->helper_private;
-
 
144
			struct drm_encoder *encoder = connector_funcs->best_encoder(connector);
-
 
145
			struct radeon_encoder *radeon_encoder = to_radeon_encoder(encoder);
-
 
146
			struct radeon_encoder_atom_dig *dig = radeon_encoder->enc_priv;
-
 
147
 
-
 
148
			if (dig->lcd_misc & ATOM_PANEL_MISC_V13_6BIT_PER_COLOR)
-
 
149
				bpc = 6;
-
 
150
			else if (dig->lcd_misc & ATOM_PANEL_MISC_V13_8BIT_PER_COLOR)
-
 
151
				bpc = 8;
-
 
152
		}
-
 
153
		break;
-
 
154
	}
-
 
155
	return bpc;
-
 
156
}
-
 
157
 
87
static void
158
static void
88
radeon_connector_update_scratch_regs(struct drm_connector *connector, enum drm_connector_status status)
159
radeon_connector_update_scratch_regs(struct drm_connector *connector, enum drm_connector_status status)
89
{
160
{
90
	struct drm_device *dev = connector->dev;
161
	struct drm_device *dev = connector->dev;
91
	struct radeon_device *rdev = dev->dev_private;
162
	struct radeon_device *rdev = dev->dev_private;
Line 121... Line 192...
121
			radeon_combios_connected_scratch_regs(connector, encoder, connected);
192
			radeon_combios_connected_scratch_regs(connector, encoder, connected);
Line 122... Line 193...
122
 
193
 
123
	}
194
	}
Line 124... Line 195...
124
}
195
}
125
 
196
 
126
struct drm_encoder *radeon_find_encoder(struct drm_connector *connector, int encoder_type)
197
static struct drm_encoder *radeon_find_encoder(struct drm_connector *connector, int encoder_type)
127
{
198
{
128
	struct drm_mode_object *obj;
199
	struct drm_mode_object *obj;
Line 142... Line 213...
142
			return encoder;
213
			return encoder;
143
	}
214
	}
144
	return NULL;
215
	return NULL;
145
}
216
}
Line 146... Line 217...
146
 
217
 
147
struct drm_encoder *radeon_best_single_encoder(struct drm_connector *connector)
218
static struct drm_encoder *radeon_best_single_encoder(struct drm_connector *connector)
148
{
219
{
149
	int enc_id = connector->encoder_ids[0];
220
	int enc_id = connector->encoder_ids[0];
150
	struct drm_mode_object *obj;
221
	struct drm_mode_object *obj;
Line 293... Line 364...
293
		mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h, 60, false, false, false);
364
		mode = drm_cvt_mode(dev, common_modes[i].w, common_modes[i].h, 60, false, false, false);
294
		drm_mode_probed_add(connector, mode);
365
		drm_mode_probed_add(connector, mode);
295
	}
366
	}
296
}
367
}
Line 297... Line 368...
297
 
368
 
298
int radeon_connector_set_property(struct drm_connector *connector, struct drm_property *property,
369
static int radeon_connector_set_property(struct drm_connector *connector, struct drm_property *property,
299
				  uint64_t val)
370
				  uint64_t val)
300
{
371
{
301
	struct drm_device *dev = connector->dev;
372
	struct drm_device *dev = connector->dev;
302
	struct radeon_device *rdev = dev->dev_private;
373
	struct radeon_device *rdev = dev->dev_private;
Line 428... Line 499...
428
	}
499
	}
Line 429... Line 500...
429
 
500
 
430
	return 0;
501
	return 0;
Line 431... Line -...
431
}
-
 
432
 
-
 
433
/*
-
 
434
 * Some integrated ATI Radeon chipset implementations (e. g.
-
 
435
 * Asus M2A-VM HDMI) may indicate the availability of a DDC,
-
 
436
 * even when there's no monitor connected. For these connectors
-
 
437
 * following DDC probe extension will be applied: check also for the
-
 
438
 * availability of EDID with at least a correct EDID header. Only then,
-
 
439
 * DDC is assumed to be available. This prevents drm_get_edid() and
-
 
440
 * drm_edid_block_valid() from periodically dumping data and kernel
-
 
441
 * errors into the logs and onto the terminal.
-
 
442
 */
-
 
443
static bool radeon_connector_needs_extended_probe(struct radeon_device *dev,
-
 
444
				     uint32_t supported_device,
-
 
445
				     int connector_type)
-
 
446
{
-
 
447
	/* Asus M2A-VM HDMI board sends data to i2c bus even,
-
 
448
	 * if HDMI add-on card is not plugged in or HDMI is disabled in
-
 
449
	 * BIOS. Valid DDC can only be assumed, if also a valid EDID header
-
 
450
	 * can be retrieved via i2c bus during DDC probe */
-
 
451
	if ((dev->pdev->device == 0x791e) &&
-
 
452
	    (dev->pdev->subsystem_vendor == 0x1043) &&
-
 
453
	    (dev->pdev->subsystem_device == 0x826d)) {
-
 
454
		if ((connector_type == DRM_MODE_CONNECTOR_HDMIA) &&
-
 
455
		    (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
-
 
456
			return true;
-
 
457
	}
-
 
458
	/* ECS A740GM-M with ATI RADEON 2100 sends data to i2c bus
-
 
459
	 * for a DVI connector that is not implemented */
-
 
460
	if ((dev->pdev->device == 0x796e) &&
-
 
461
	    (dev->pdev->subsystem_vendor == 0x1019) &&
-
 
462
	    (dev->pdev->subsystem_device == 0x2615)) {
-
 
463
		if ((connector_type == DRM_MODE_CONNECTOR_DVID) &&
-
 
464
		    (supported_device == ATOM_DEVICE_DFP2_SUPPORT))
-
 
465
			return true;
-
 
466
	}
-
 
467
 
-
 
468
	/* Default: no EDID header probe required for DDC probing */
-
 
469
	return false;
-
 
470
}
502
}
471
 
503
 
472
static void radeon_fixup_lvds_native_mode(struct drm_encoder *encoder,
504
static void radeon_fixup_lvds_native_mode(struct drm_encoder *encoder,
473
					  struct drm_connector *connector)
505
					  struct drm_connector *connector)
474
{
506
{
-
 
507
	struct radeon_encoder *radeon_encoder =	to_radeon_encoder(encoder);
-
 
508
	struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
-
 
509
	struct drm_display_mode *t, *mode;
-
 
510
 
-
 
511
	/* If the EDID preferred mode doesn't match the native mode, use it */
-
 
512
	list_for_each_entry_safe(mode, t, &connector->probed_modes, head) {
-
 
513
		if (mode->type & DRM_MODE_TYPE_PREFERRED) {
-
 
514
			if (mode->hdisplay != native_mode->hdisplay ||
-
 
515
			    mode->vdisplay != native_mode->vdisplay)
-
 
516
				memcpy(native_mode, mode, sizeof(*mode));
Line 475... Line 517...
475
	struct radeon_encoder *radeon_encoder =	to_radeon_encoder(encoder);
517
		}
476
	struct drm_display_mode *native_mode = &radeon_encoder->native_mode;
518
	}
477
 
-
 
478
	/* Try to get native mode details from EDID if necessary */
-
 
479
	if (!native_mode->clock) {
519
 
480
		struct drm_display_mode *t, *mode;
520
	/* Try to get native mode details from EDID if necessary */
481
 
521
	if (!native_mode->clock) {
482
		list_for_each_entry_safe(mode, t, &connector->probed_modes, head) {
522
		list_for_each_entry_safe(mode, t, &connector->probed_modes, head) {
483
			if (mode->hdisplay == native_mode->hdisplay &&
523
			if (mode->hdisplay == native_mode->hdisplay &&
484
			    mode->vdisplay == native_mode->vdisplay) {
524
			    mode->vdisplay == native_mode->vdisplay) {
485
				*native_mode = *mode;
525
				*native_mode = *mode;
486
				drm_mode_set_crtcinfo(native_mode, CRTC_INTERLACE_HALVE_V);
526
				drm_mode_set_crtcinfo(native_mode, CRTC_INTERLACE_HALVE_V);
487
				DRM_DEBUG_KMS("Determined LVDS native mode details from EDID\n");
527
				DRM_DEBUG_KMS("Determined LVDS native mode details from EDID\n");
488
				break;
528
				break;
-
 
529
			}
489
			}
530
		}
490
		}
531
	}
491
	}
532
 
492
	if (!native_mode->clock) {
533
	if (!native_mode->clock) {
493
		DRM_DEBUG_KMS("No LVDS native mode details, disabling RMX\n");
534
		DRM_DEBUG_KMS("No LVDS native mode details, disabling RMX\n");
Line 603... Line 644...
603
	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
644
	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
Line 604... Line 645...
604
 
645
 
605
	if (radeon_connector->edid)
646
	if (radeon_connector->edid)
606
		kfree(radeon_connector->edid);
647
		kfree(radeon_connector->edid);
607
	kfree(radeon_connector->con_priv);
648
	kfree(radeon_connector->con_priv);
608
	drm_sysfs_connector_remove(connector);
649
//   drm_sysfs_connector_remove(connector);
609
	drm_connector_cleanup(connector);
650
	drm_connector_cleanup(connector);
610
	kfree(connector);
651
	kfree(connector);
Line 611... Line 652...
611
}
652
}
Line 644... Line 685...
644
	radeon_property_change_mode(&radeon_encoder->base);
685
	radeon_property_change_mode(&radeon_encoder->base);
645
	return 0;
686
	return 0;
646
}
687
}
Line 647... Line 688...
647
 
688
 
648
 
689
 
649
struct drm_connector_helper_funcs radeon_lvds_connector_helper_funcs = {
690
static const struct drm_connector_helper_funcs radeon_lvds_connector_helper_funcs = {
650
	.get_modes = radeon_lvds_get_modes,
691
	.get_modes = radeon_lvds_get_modes,
651
	.mode_valid = radeon_lvds_mode_valid,
692
	.mode_valid = radeon_lvds_mode_valid,
Line 652... Line 693...
652
	.best_encoder = radeon_best_single_encoder,
693
	.best_encoder = radeon_best_single_encoder,
653
};
694
};
654
 
695
 
655
struct drm_connector_funcs radeon_lvds_connector_funcs = {
696
static const struct drm_connector_funcs radeon_lvds_connector_funcs = {
656
	.dpms = drm_helper_connector_dpms,
697
	.dpms = drm_helper_connector_dpms,
657
	.detect = radeon_lvds_detect,
698
	.detect = radeon_lvds_detect,
Line 698... Line 739...
698
	encoder = radeon_best_single_encoder(connector);
739
	encoder = radeon_best_single_encoder(connector);
699
	if (!encoder)
740
	if (!encoder)
700
		ret = connector_status_disconnected;
741
		ret = connector_status_disconnected;
Line 701... Line 742...
701
 
742
 
702
	if (radeon_connector->ddc_bus)
743
	if (radeon_connector->ddc_bus)
703
		dret = radeon_ddc_probe(radeon_connector,
-
 
704
					radeon_connector->requires_extended_probe);
744
		dret = radeon_ddc_probe(radeon_connector);
-
 
745
	if (dret) {
705
	if (dret) {
746
		radeon_connector->detected_by_load = false;
706
		if (radeon_connector->edid) {
747
		if (radeon_connector->edid) {
707
			kfree(radeon_connector->edid);
748
			kfree(radeon_connector->edid);
708
			radeon_connector->edid = NULL;
749
			radeon_connector->edid = NULL;
709
		}
750
		}
Line 727... Line 768...
727
		ret = connector_status_connected;
768
		ret = connector_status_connected;
728
		}
769
		}
729
	} else {
770
	} else {
Line 730... Line 771...
730
 
771
 
731
		/* if we aren't forcing don't do destructive polling */
772
		/* if we aren't forcing don't do destructive polling */
-
 
773
		if (!force) {
-
 
774
			/* only return the previous status if we last
-
 
775
			 * detected a monitor via load.
-
 
776
			 */
732
		if (!force)
777
			if (radeon_connector->detected_by_load)
-
 
778
			return connector->status;
-
 
779
			else
-
 
780
				return ret;
Line 733... Line 781...
733
			return connector->status;
781
		}
734
 
782
 
735
		if (radeon_connector->dac_load_detect && encoder) {
783
		if (radeon_connector->dac_load_detect && encoder) {
-
 
784
			encoder_funcs = encoder->helper_private;
-
 
785
			ret = encoder_funcs->detect(encoder, connector);
736
			encoder_funcs = encoder->helper_private;
786
			if (ret != connector_status_disconnected)
737
			ret = encoder_funcs->detect(encoder, connector);
787
				radeon_connector->detected_by_load = true;
Line 738... Line 788...
738
		}
788
		}
739
	}
789
	}
Line 753... Line 803...
753
 
803
 
754
	radeon_connector_update_scratch_regs(connector, ret);
804
	radeon_connector_update_scratch_regs(connector, ret);
755
	return ret;
805
	return ret;
Line 756... Line 806...
756
}
806
}
757
 
807
 
758
struct drm_connector_helper_funcs radeon_vga_connector_helper_funcs = {
808
static const struct drm_connector_helper_funcs radeon_vga_connector_helper_funcs = {
759
	.get_modes = radeon_vga_get_modes,
809
	.get_modes = radeon_vga_get_modes,
760
	.mode_valid = radeon_vga_mode_valid,
810
	.mode_valid = radeon_vga_mode_valid,
Line 761... Line 811...
761
	.best_encoder = radeon_best_single_encoder,
811
	.best_encoder = radeon_best_single_encoder,
762
};
812
};
763
 
813
 
764
struct drm_connector_funcs radeon_vga_connector_funcs = {
814
static const struct drm_connector_funcs radeon_vga_connector_funcs = {
765
	.dpms = drm_helper_connector_dpms,
815
	.dpms = drm_helper_connector_dpms,
766
	.detect = radeon_vga_detect,
816
	.detect = radeon_vga_detect,
Line 823... Line 873...
823
		ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, false);
873
		ret = radeon_connector_analog_encoder_conflict_solve(connector, encoder, ret, false);
824
	radeon_connector_update_scratch_regs(connector, ret);
874
	radeon_connector_update_scratch_regs(connector, ret);
825
	return ret;
875
	return ret;
826
}
876
}
Line 827... Line 877...
827
 
877
 
828
struct drm_connector_helper_funcs radeon_tv_connector_helper_funcs = {
878
static const struct drm_connector_helper_funcs radeon_tv_connector_helper_funcs = {
829
	.get_modes = radeon_tv_get_modes,
879
	.get_modes = radeon_tv_get_modes,
830
	.mode_valid = radeon_tv_mode_valid,
880
	.mode_valid = radeon_tv_mode_valid,
831
	.best_encoder = radeon_best_single_encoder,
881
	.best_encoder = radeon_best_single_encoder,
Line 832... Line 882...
832
};
882
};
833
 
883
 
834
struct drm_connector_funcs radeon_tv_connector_funcs = {
884
static const struct drm_connector_funcs radeon_tv_connector_funcs = {
835
	.dpms = drm_helper_connector_dpms,
885
	.dpms = drm_helper_connector_dpms,
836
	.detect = radeon_tv_detect,
886
	.detect = radeon_tv_detect,
837
	.fill_modes = drm_helper_probe_single_connector_modes,
887
	.fill_modes = drm_helper_probe_single_connector_modes,
Line 846... Line 896...
846
 
896
 
847
	ret = radeon_ddc_get_modes(radeon_connector);
897
	ret = radeon_ddc_get_modes(radeon_connector);
848
	return ret;
898
	return ret;
Line -... Line 899...
-
 
899
}
-
 
900
 
-
 
901
static bool radeon_check_hpd_status_unchanged(struct drm_connector *connector)
-
 
902
{
-
 
903
	struct drm_device *dev = connector->dev;
-
 
904
	struct radeon_device *rdev = dev->dev_private;
-
 
905
	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
-
 
906
	enum drm_connector_status status;
-
 
907
 
-
 
908
	/* We only trust HPD on R600 and newer ASICS. */
-
 
909
	if (rdev->family >= CHIP_R600
-
 
910
	  && radeon_connector->hpd.hpd != RADEON_HPD_NONE) {
-
 
911
		if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd))
-
 
912
			status = connector_status_connected;
-
 
913
		else
-
 
914
			status = connector_status_disconnected;
-
 
915
		if (connector->status == status)
-
 
916
			return true;
-
 
917
	}
-
 
918
 
-
 
919
	return false;
849
}
920
}
850
 
921
 
851
/*
922
/*
852
 * DVI is complicated
923
 * DVI is complicated
853
 * Do a DDC probe, if DDC probe passes, get the full EDID so
924
 * Do a DDC probe, if DDC probe passes, get the full EDID so
Line 870... Line 941...
870
	struct drm_mode_object *obj;
941
	struct drm_mode_object *obj;
871
	int i;
942
	int i;
872
	enum drm_connector_status ret = connector_status_disconnected;
943
	enum drm_connector_status ret = connector_status_disconnected;
873
	bool dret = false;
944
	bool dret = false;
Line -... Line 945...
-
 
945
 
-
 
946
	if (!force && radeon_check_hpd_status_unchanged(connector))
-
 
947
		return connector->status;
874
 
948
 
875
	if (radeon_connector->ddc_bus)
949
	if (radeon_connector->ddc_bus)
876
		dret = radeon_ddc_probe(radeon_connector,
-
 
877
					radeon_connector->requires_extended_probe);
950
		dret = radeon_ddc_probe(radeon_connector);
-
 
951
	if (dret) {
878
	if (dret) {
952
		radeon_connector->detected_by_load = false;
879
		if (radeon_connector->edid) {
953
		if (radeon_connector->edid) {
880
			kfree(radeon_connector->edid);
954
			kfree(radeon_connector->edid);
881
			radeon_connector->edid = NULL;
955
			radeon_connector->edid = NULL;
882
		}
956
		}
Line 936... Line 1010...
936
	}
1010
	}
Line 937... Line 1011...
937
 
1011
 
938
	if ((ret == connector_status_connected) && (radeon_connector->use_digital == true))
1012
	if ((ret == connector_status_connected) && (radeon_connector->use_digital == true))
Line -... Line 1013...
-
 
1013
		goto out;
-
 
1014
 
-
 
1015
	/* DVI-D and HDMI-A are digital only */
-
 
1016
	if ((connector->connector_type == DRM_MODE_CONNECTOR_DVID) ||
-
 
1017
	    (connector->connector_type == DRM_MODE_CONNECTOR_HDMIA))
-
 
1018
		goto out;
939
		goto out;
1019
 
-
 
1020
	/* if we aren't forcing don't do destructive polling */
-
 
1021
	if (!force) {
-
 
1022
		/* only return the previous status if we last
-
 
1023
		 * detected a monitor via load.
940
 
1024
		 */
941
	if (!force) {
1025
		if (radeon_connector->detected_by_load)
942
		ret = connector->status;
1026
		ret = connector->status;
Line 943... Line 1027...
943
		goto out;
1027
		goto out;
Line 955... Line 1039...
955
			if (!obj)
1039
			if (!obj)
956
				continue;
1040
				continue;
Line 957... Line 1041...
957
 
1041
 
Line -... Line 1042...
-
 
1042
			encoder = obj_to_encoder(obj);
-
 
1043
 
-
 
1044
			if (encoder->encoder_type != DRM_MODE_ENCODER_DAC &&
-
 
1045
			    encoder->encoder_type != DRM_MODE_ENCODER_TVDAC)
958
			encoder = obj_to_encoder(obj);
1046
				continue;
959
 
1047
 
960
			encoder_funcs = encoder->helper_private;
1048
			encoder_funcs = encoder->helper_private;
961
			if (encoder_funcs->detect) {
1049
			if (encoder_funcs->detect) {
962
				if (ret != connector_status_connected) {
1050
				if (ret != connector_status_connected) {
963
				ret = encoder_funcs->detect(encoder, connector);
1051
				ret = encoder_funcs->detect(encoder, connector);
964
				if (ret == connector_status_connected) {
1052
				if (ret == connector_status_connected) {
-
 
1053
						radeon_connector->use_digital = false;
-
 
1054
					}
965
						radeon_connector->use_digital = false;
1055
					if (ret != connector_status_disconnected)
966
					}
1056
						radeon_connector->detected_by_load = true;
967
				}
1057
				}
968
					break;
1058
					break;
969
				}
1059
				}
Line 979... Line 1069...
979
	 * vbios to deal with KVMs. If we have one and are not able to detect a monitor
1069
	 * vbios to deal with KVMs. If we have one and are not able to detect a monitor
980
	 * by other means, assume the DFP is connected and use that EDID.  In most
1070
	 * by other means, assume the DFP is connected and use that EDID.  In most
981
	 * cases the DVI port is actually a virtual KVM port connected to the service
1071
	 * cases the DVI port is actually a virtual KVM port connected to the service
982
	 * processor.
1072
	 * processor.
983
	 */
1073
	 */
-
 
1074
out:
984
	if ((!rdev->is_atom_bios) &&
1075
	if ((!rdev->is_atom_bios) &&
985
	    (ret == connector_status_disconnected) &&
1076
	    (ret == connector_status_disconnected) &&
986
	    rdev->mode_info.bios_hardcoded_edid_size) {
1077
	    rdev->mode_info.bios_hardcoded_edid_size) {
987
		radeon_connector->use_digital = true;
1078
		radeon_connector->use_digital = true;
988
		ret = connector_status_connected;
1079
		ret = connector_status_connected;
989
	}
1080
	}
Line 990... Line -...
990
 
-
 
991
out:
1081
 
992
	/* updated in get modes as well since we need to know if it's analog or digital */
1082
	/* updated in get modes as well since we need to know if it's analog or digital */
993
	radeon_connector_update_scratch_regs(connector, ret);
1083
	radeon_connector_update_scratch_regs(connector, ret);
994
	return ret;
1084
	return ret;
Line 995... Line 1085...
995
}
1085
}
996
 
1086
 
997
/* okay need to be smart in here about which encoder to pick */
1087
/* okay need to be smart in here about which encoder to pick */
998
struct drm_encoder *radeon_dvi_encoder(struct drm_connector *connector)
1088
static struct drm_encoder *radeon_dvi_encoder(struct drm_connector *connector)
999
{
1089
{
1000
	int enc_id = connector->encoder_ids[0];
1090
	int enc_id = connector->encoder_ids[0];
1001
	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
1091
	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
Line 1064... Line 1154...
1064
		if ((radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) ||
1154
		if ((radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I) ||
1065
		    (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
1155
		    (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D) ||
1066
		    (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B))
1156
		    (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_B))
1067
			return MODE_OK;
1157
			return MODE_OK;
1068
		else if (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_A) {
1158
		else if (radeon_connector->connector_object_id == CONNECTOR_OBJECT_ID_HDMI_TYPE_A) {
1069
			if (ASIC_IS_DCE3(rdev)) {
1159
			if (ASIC_IS_DCE6(rdev)) {
1070
				/* HDMI 1.3+ supports max clock of 340 Mhz */
1160
				/* HDMI 1.3+ supports max clock of 340 Mhz */
1071
				if (mode->clock > 340000)
1161
				if (mode->clock > 340000)
1072
					return MODE_CLOCK_HIGH;
1162
					return MODE_CLOCK_HIGH;
1073
		else
1163
		else
1074
					return MODE_OK;
1164
					return MODE_OK;
Line 1083... Line 1173...
1083
		return MODE_CLOCK_HIGH;
1173
		return MODE_CLOCK_HIGH;
Line 1084... Line 1174...
1084
 
1174
 
1085
	return MODE_OK;
1175
	return MODE_OK;
Line 1086... Line 1176...
1086
}
1176
}
1087
 
1177
 
1088
struct drm_connector_helper_funcs radeon_dvi_connector_helper_funcs = {
1178
static const struct drm_connector_helper_funcs radeon_dvi_connector_helper_funcs = {
1089
	.get_modes = radeon_dvi_get_modes,
1179
	.get_modes = radeon_dvi_get_modes,
1090
	.mode_valid = radeon_dvi_mode_valid,
1180
	.mode_valid = radeon_dvi_mode_valid,
Line 1091... Line 1181...
1091
	.best_encoder = radeon_dvi_encoder,
1181
	.best_encoder = radeon_dvi_encoder,
1092
};
1182
};
1093
 
1183
 
1094
struct drm_connector_funcs radeon_dvi_connector_funcs = {
1184
static const struct drm_connector_funcs radeon_dvi_connector_funcs = {
1095
	.dpms = drm_helper_connector_dpms,
1185
	.dpms = drm_helper_connector_dpms,
1096
	.detect = radeon_dvi_detect,
1186
	.detect = radeon_dvi_detect,
Line 1108... Line 1198...
1108
	if (radeon_connector->edid)
1198
	if (radeon_connector->edid)
1109
		kfree(radeon_connector->edid);
1199
		kfree(radeon_connector->edid);
1110
	if (radeon_dig_connector->dp_i2c_bus)
1200
	if (radeon_dig_connector->dp_i2c_bus)
1111
		radeon_i2c_destroy(radeon_dig_connector->dp_i2c_bus);
1201
		radeon_i2c_destroy(radeon_dig_connector->dp_i2c_bus);
1112
	kfree(radeon_connector->con_priv);
1202
	kfree(radeon_connector->con_priv);
1113
	drm_sysfs_connector_remove(connector);
1203
//   drm_sysfs_connector_remove(connector);
1114
	drm_connector_cleanup(connector);
1204
	drm_connector_cleanup(connector);
1115
	kfree(connector);
1205
	kfree(connector);
1116
}
1206
}
Line 1117... Line 1207...
1117
 
1207
 
Line 1124... Line 1214...
1124
 
1214
 
1125
	if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) ||
1215
	if ((connector->connector_type == DRM_MODE_CONNECTOR_eDP) ||
1126
	    (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) {
1216
	    (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)) {
Line -... Line 1217...
-
 
1217
		struct drm_display_mode *mode;
1127
		struct drm_display_mode *mode;
1218
 
1128
 
1219
		if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) {
1129
		if (!radeon_dig_connector->edp_on)
1220
		if (!radeon_dig_connector->edp_on)
1130
			atombios_set_edp_panel_power(connector,
1221
			atombios_set_edp_panel_power(connector,
1131
						     ATOM_TRANSMITTER_ACTION_POWER_ON);
1222
						     ATOM_TRANSMITTER_ACTION_POWER_ON);
1132
	ret = radeon_ddc_get_modes(radeon_connector);
1223
	ret = radeon_ddc_get_modes(radeon_connector);
1133
		if (!radeon_dig_connector->edp_on)
1224
		if (!radeon_dig_connector->edp_on)
-
 
1225
			atombios_set_edp_panel_power(connector,
-
 
1226
						     ATOM_TRANSMITTER_ACTION_POWER_OFF);
-
 
1227
		} else {
-
 
1228
			/* need to setup ddc on the bridge */
-
 
1229
			if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) !=
-
 
1230
			    ENCODER_OBJECT_ID_NONE) {
-
 
1231
				if (encoder)
-
 
1232
					radeon_atom_ext_encoder_setup_ddc(encoder);
-
 
1233
			}
Line 1134... Line 1234...
1134
			atombios_set_edp_panel_power(connector,
1234
			ret = radeon_ddc_get_modes(radeon_connector);
1135
						     ATOM_TRANSMITTER_ACTION_POWER_OFF);
1235
		}
1136
 
1236
 
1137
		if (ret > 0) {
1237
		if (ret > 0) {
1138
			if (encoder) {
1238
			if (encoder) {
1139
				radeon_fixup_lvds_native_mode(encoder, connector);
1239
				radeon_fixup_lvds_native_mode(encoder, connector);
1140
				/* add scaled modes */
1240
				/* add scaled modes */
1141
				radeon_add_common_modes(encoder, connector);
1241
				radeon_add_common_modes(encoder, connector);
Line 1142... Line -...
1142
			}
-
 
1143
			return ret;
1242
			}
1144
		}
1243
			return ret;
Line 1145... Line 1244...
1145
 
1244
		}
1146
		encoder = radeon_best_single_encoder(connector);
1245
 
Line 1158... Line 1257...
1158
			/* add scaled modes */
1257
			/* add scaled modes */
1159
			radeon_add_common_modes(encoder, connector);
1258
			radeon_add_common_modes(encoder, connector);
1160
	}
1259
	}
1161
	} else {
1260
	} else {
1162
		/* need to setup ddc on the bridge */
1261
		/* need to setup ddc on the bridge */
1163
		if (radeon_connector_encoder_is_dp_bridge(connector)) {
1262
		if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) !=
-
 
1263
			ENCODER_OBJECT_ID_NONE) {
1164
			if (encoder)
1264
			if (encoder)
1165
				radeon_atom_ext_encoder_setup_ddc(encoder);
1265
				radeon_atom_ext_encoder_setup_ddc(encoder);
1166
		}
1266
		}
1167
		ret = radeon_ddc_get_modes(radeon_connector);
1267
		ret = radeon_ddc_get_modes(radeon_connector);
1168
	}
1268
	}
Line 1169... Line 1269...
1169
 
1269
 
1170
	return ret;
1270
	return ret;
Line 1171... Line 1271...
1171
}
1271
}
1172
 
1272
 
1173
bool radeon_connector_encoder_is_dp_bridge(struct drm_connector *connector)
1273
u16 radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector *connector)
1174
{
1274
{
1175
	struct drm_mode_object *obj;
1275
	struct drm_mode_object *obj;
1176
	struct drm_encoder *encoder;
1276
	struct drm_encoder *encoder;
1177
	struct radeon_encoder *radeon_encoder;
-
 
Line 1178... Line 1277...
1178
	int i;
1277
	struct radeon_encoder *radeon_encoder;
1179
	bool found = false;
1278
	int i;
1180
 
1279
 
Line 1190... Line 1289...
1190
		radeon_encoder = to_radeon_encoder(encoder);
1289
		radeon_encoder = to_radeon_encoder(encoder);
Line 1191... Line 1290...
1191
 
1290
 
1192
		switch (radeon_encoder->encoder_id) {
1291
		switch (radeon_encoder->encoder_id) {
1193
		case ENCODER_OBJECT_ID_TRAVIS:
1292
		case ENCODER_OBJECT_ID_TRAVIS:
1194
		case ENCODER_OBJECT_ID_NUTMEG:
1293
		case ENCODER_OBJECT_ID_NUTMEG:
1195
			found = true;
-
 
1196
			break;
1294
			return radeon_encoder->encoder_id;
1197
		default:
1295
		default:
1198
			break;
1296
			break;
1199
		}
1297
		}
Line 1200... Line 1298...
1200
	}
1298
	}
1201
 
1299
 
Line 1202... Line 1300...
1202
	return found;
1300
	return ENCODER_OBJECT_ID_NONE;
1203
}
1301
}
1204
 
1302
 
Line 1249... Line 1347...
1249
	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
1347
	struct radeon_connector *radeon_connector = to_radeon_connector(connector);
1250
	enum drm_connector_status ret = connector_status_disconnected;
1348
	enum drm_connector_status ret = connector_status_disconnected;
1251
	struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv;
1349
	struct radeon_connector_atom_dig *radeon_dig_connector = radeon_connector->con_priv;
1252
	struct drm_encoder *encoder = radeon_best_single_encoder(connector);
1350
	struct drm_encoder *encoder = radeon_best_single_encoder(connector);
Line -... Line 1351...
-
 
1351
 
-
 
1352
	if (!force && radeon_check_hpd_status_unchanged(connector))
-
 
1353
		return connector->status;
1253
 
1354
 
1254
	if (radeon_connector->edid) {
1355
	if (radeon_connector->edid) {
1255
		kfree(radeon_connector->edid);
1356
		kfree(radeon_connector->edid);
1256
		radeon_connector->edid = NULL;
1357
		radeon_connector->edid = NULL;
Line 1274... Line 1375...
1274
		if (radeon_dp_getdpcd(radeon_connector))
1375
		if (radeon_dp_getdpcd(radeon_connector))
1275
			ret = connector_status_connected;
1376
			ret = connector_status_connected;
1276
		if (!radeon_dig_connector->edp_on)
1377
		if (!radeon_dig_connector->edp_on)
1277
			atombios_set_edp_panel_power(connector,
1378
			atombios_set_edp_panel_power(connector,
1278
						     ATOM_TRANSMITTER_ACTION_POWER_OFF);
1379
						     ATOM_TRANSMITTER_ACTION_POWER_OFF);
-
 
1380
	} else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector) !=
-
 
1381
		   ENCODER_OBJECT_ID_NONE) {
1279
	} else {
1382
		/* DP bridges are always DP */
-
 
1383
		radeon_dig_connector->dp_sink_type = CONNECTOR_OBJECT_ID_DISPLAYPORT;
1280
		/* need to setup ddc on the bridge */
1384
		/* get the DPCD from the bridge */
1281
		if (radeon_connector_encoder_is_dp_bridge(connector)) {
1385
		radeon_dp_getdpcd(radeon_connector);
-
 
1386
 
1282
			if (encoder)
1387
		if (encoder) {
-
 
1388
			/* setup ddc on the bridge */
1283
				radeon_atom_ext_encoder_setup_ddc(encoder);
1389
				radeon_atom_ext_encoder_setup_ddc(encoder);
-
 
1390
			if (radeon_ddc_probe(radeon_connector)) /* try DDC */
-
 
1391
				ret = connector_status_connected;
-
 
1392
			else if (radeon_connector->dac_load_detect) { /* try load detection */
-
 
1393
				struct drm_encoder_helper_funcs *encoder_funcs = encoder->helper_private;
-
 
1394
				ret = encoder_funcs->detect(encoder, connector);
-
 
1395
		}
1284
		}
1396
		}
-
 
1397
	} else {
1285
		radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector);
1398
		radeon_dig_connector->dp_sink_type = radeon_dp_getsinktype(radeon_connector);
1286
		if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
1399
		if (radeon_hpd_sense(rdev, radeon_connector->hpd.hpd)) {
1287
			ret = connector_status_connected;
1400
			ret = connector_status_connected;
1288
			if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT)
1401
			if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT)
1289
				radeon_dp_getdpcd(radeon_connector);
1402
				radeon_dp_getdpcd(radeon_connector);
1290
		} else {
1403
		} else {
1291
		if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
1404
		if (radeon_dig_connector->dp_sink_type == CONNECTOR_OBJECT_ID_DISPLAYPORT) {
1292
			if (radeon_dp_getdpcd(radeon_connector))
1405
			if (radeon_dp_getdpcd(radeon_connector))
1293
				ret = connector_status_connected;
1406
				ret = connector_status_connected;
1294
		} else {
1407
		} else {
1295
				if (radeon_ddc_probe(radeon_connector,
1408
				if (radeon_ddc_probe(radeon_connector))
1296
						     radeon_connector->requires_extended_probe))
-
 
1297
			ret = connector_status_connected;
1409
			ret = connector_status_connected;
1298
		}
1410
		}
1299
	}
1411
	}
1300
 
-
 
1301
		if ((ret == connector_status_disconnected) &&
-
 
1302
		    radeon_connector->dac_load_detect) {
-
 
1303
			struct drm_encoder *encoder = radeon_best_single_encoder(connector);
-
 
1304
			struct drm_encoder_helper_funcs *encoder_funcs;
-
 
1305
			if (encoder) {
-
 
1306
				encoder_funcs = encoder->helper_private;
-
 
1307
				ret = encoder_funcs->detect(encoder, connector);
-
 
1308
			}
-
 
1309
		}
-
 
1310
	}
1412
	}
Line 1311... Line 1413...
1311
 
1413
 
1312
	radeon_connector_update_scratch_regs(connector, ret);
1414
	radeon_connector_update_scratch_regs(connector, ret);
1313
	return ret;
1415
	return ret;
Line 1354... Line 1456...
1354
	else
1456
	else
1355
		return MODE_OK;
1457
		return MODE_OK;
1356
	}
1458
	}
1357
}
1459
}
Line 1358... Line 1460...
1358
 
1460
 
1359
struct drm_connector_helper_funcs radeon_dp_connector_helper_funcs = {
1461
static const struct drm_connector_helper_funcs radeon_dp_connector_helper_funcs = {
1360
	.get_modes = radeon_dp_get_modes,
1462
	.get_modes = radeon_dp_get_modes,
1361
	.mode_valid = radeon_dp_mode_valid,
1463
	.mode_valid = radeon_dp_mode_valid,
1362
	.best_encoder = radeon_dvi_encoder,
1464
	.best_encoder = radeon_dvi_encoder,
Line 1363... Line 1465...
1363
};
1465
};
1364
 
1466
 
1365
struct drm_connector_funcs radeon_dp_connector_funcs = {
1467
static const struct drm_connector_funcs radeon_dp_connector_funcs = {
1366
	.dpms = drm_helper_connector_dpms,
1468
	.dpms = drm_helper_connector_dpms,
1367
	.detect = radeon_dp_detect,
1469
	.detect = radeon_dp_detect,
1368
	.fill_modes = drm_helper_probe_single_connector_modes,
1470
	.fill_modes = drm_helper_probe_single_connector_modes,
Line 1446... Line 1548...
1446
	radeon_connector->connector_id = connector_id;
1548
	radeon_connector->connector_id = connector_id;
1447
	radeon_connector->devices = supported_device;
1549
	radeon_connector->devices = supported_device;
1448
	radeon_connector->shared_ddc = shared_ddc;
1550
	radeon_connector->shared_ddc = shared_ddc;
1449
	radeon_connector->connector_object_id = connector_object_id;
1551
	radeon_connector->connector_object_id = connector_object_id;
1450
	radeon_connector->hpd = *hpd;
1552
	radeon_connector->hpd = *hpd;
1451
	radeon_connector->requires_extended_probe =
-
 
1452
		radeon_connector_needs_extended_probe(rdev, supported_device,
-
 
1453
							connector_type);
-
 
-
 
1553
 
1454
	radeon_connector->router = *router;
1554
	radeon_connector->router = *router;
1455
	if (router->ddc_valid || router->cd_valid) {
1555
	if (router->ddc_valid || router->cd_valid) {
1456
		radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info);
1556
		radeon_connector->router_bus = radeon_i2c_lookup(rdev, &router->i2c_info);
1457
		if (!radeon_connector->router_bus)
1557
		if (!radeon_connector->router_bus)
1458
			DRM_ERROR("Failed to assign router i2c bus! Check dmesg for i2c errors.\n");
1558
			DRM_ERROR("Failed to assign router i2c bus! Check dmesg for i2c errors.\n");
Line 1744... Line 1844...
1744
			connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1844
			connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1745
	} else
1845
	} else
1746
		connector->polled = DRM_CONNECTOR_POLL_HPD;
1846
		connector->polled = DRM_CONNECTOR_POLL_HPD;
Line 1747... Line 1847...
1747
 
1847
 
1748
	connector->display_info.subpixel_order = subpixel_order;
1848
	connector->display_info.subpixel_order = subpixel_order;
1749
	drm_sysfs_connector_add(connector);
1849
//   drm_sysfs_connector_add(connector);
Line 1750... Line 1850...
1750
	return;
1850
	return;
1751
 
1851
 
1752
failed:
1852
failed:
Line 1795... Line 1895...
1795
 
1895
 
1796
	radeon_connector->connector_id = connector_id;
1896
	radeon_connector->connector_id = connector_id;
1797
	radeon_connector->devices = supported_device;
1897
	radeon_connector->devices = supported_device;
1798
	radeon_connector->connector_object_id = connector_object_id;
1898
	radeon_connector->connector_object_id = connector_object_id;
1799
	radeon_connector->hpd = *hpd;
-
 
1800
	radeon_connector->requires_extended_probe =
-
 
1801
		radeon_connector_needs_extended_probe(rdev, supported_device,
-
 
-
 
1899
	radeon_connector->hpd = *hpd;
1802
							connector_type);
1900
 
1803
	switch (connector_type) {
1901
	switch (connector_type) {
1804
	case DRM_MODE_CONNECTOR_VGA:
1902
	case DRM_MODE_CONNECTOR_VGA:
1805
		drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
1903
		drm_connector_init(dev, &radeon_connector->base, &radeon_vga_connector_funcs, connector_type);
1806
		drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs);
1904
		drm_connector_helper_add(&radeon_connector->base, &radeon_vga_connector_helper_funcs);
Line 1903... Line 2001...
1903
		if (i2c_bus->valid)
2001
		if (i2c_bus->valid)
1904
			connector->polled = DRM_CONNECTOR_POLL_CONNECT;
2002
			connector->polled = DRM_CONNECTOR_POLL_CONNECT;
1905
	} else
2003
	} else
1906
		connector->polled = DRM_CONNECTOR_POLL_HPD;
2004
		connector->polled = DRM_CONNECTOR_POLL_HPD;
1907
	connector->display_info.subpixel_order = subpixel_order;
2005
	connector->display_info.subpixel_order = subpixel_order;
1908
	drm_sysfs_connector_add(connector);
2006
//   drm_sysfs_connector_add(connector);
1909
	if (connector_type == DRM_MODE_CONNECTOR_LVDS) {
-
 
1910
		struct drm_encoder *drm_encoder;
-
 
1911
 
-
 
1912
		list_for_each_entry(drm_encoder, &dev->mode_config.encoder_list, head) {
-
 
1913
			struct radeon_encoder *radeon_encoder;
-
 
1914
 
-
 
1915
			radeon_encoder = to_radeon_encoder(drm_encoder);
-
 
1916
			if (radeon_encoder->encoder_id == ENCODER_OBJECT_ID_INTERNAL_LVDS)
-
 
1917
				radeon_legacy_backlight_init(radeon_encoder, connector);
-
 
1918
		}
-
 
1919
	}
-
 
1920
}
2007
}