2 * Copyright 2007-8 Advanced Micro Devices, Inc.
3 * Copyright 2008 Red Hat Inc.
5 * Permission is hereby granted, free of charge, to any person obtaining a
6 * copy of this software and associated documentation files (the "Software"),
7 * to deal in the Software without restriction, including without limitation
8 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
9 * and/or sell copies of the Software, and to permit persons to whom the
10 * Software is furnished to do so, subject to the following conditions:
12 * The above copyright notice and this permission notice shall be included in
13 * all copies or substantial portions of the Software.
15 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
18 * THE COPYRIGHT HOLDER(S) OR AUTHOR(S) BE LIABLE FOR ANY CLAIM, DAMAGES OR
19 * OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE,
20 * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
21 * OTHER DEALINGS IN THE SOFTWARE.
23 * Authors: Dave Airlie
27 #include <drm/drm_edid.h>
28 #include <drm/drm_crtc_helper.h>
29 #include <drm/drm_fb_helper.h>
30 #include <drm/drm_dp_mst_helper.h>
31 #include <drm/radeon_drm.h>
33 #include "radeon_audio.h"
36 #include <linux/pm_runtime.h>
38 static int radeon_dp_handle_hpd(struct drm_connector
*connector
)
40 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
43 ret
= radeon_dp_mst_check_status(radeon_connector
);
48 void radeon_connector_hotplug(struct drm_connector
*connector
)
50 struct drm_device
*dev
= connector
->dev
;
51 struct radeon_device
*rdev
= dev
->dev_private
;
52 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
54 if (connector
->connector_type
== DRM_MODE_CONNECTOR_DisplayPort
) {
55 struct radeon_connector_atom_dig
*dig_connector
=
56 radeon_connector
->con_priv
;
58 if (radeon_connector
->is_mst_connector
)
60 if (dig_connector
->is_mst
) {
61 radeon_dp_handle_hpd(connector
);
65 /* bail if the connector does not have hpd pin, e.g.,
68 if (radeon_connector
->hpd
.hpd
== RADEON_HPD_NONE
)
71 radeon_hpd_set_polarity(rdev
, radeon_connector
->hpd
.hpd
);
73 /* if the connector is already off, don't turn it back on */
74 /* FIXME: This access isn't protected by any locks. */
75 if (connector
->dpms
!= DRM_MODE_DPMS_ON
)
78 /* just deal with DP (not eDP) here. */
79 if (connector
->connector_type
== DRM_MODE_CONNECTOR_DisplayPort
) {
80 struct radeon_connector_atom_dig
*dig_connector
=
81 radeon_connector
->con_priv
;
83 /* if existing sink type was not DP no need to retrain */
84 if (dig_connector
->dp_sink_type
!= CONNECTOR_OBJECT_ID_DISPLAYPORT
)
87 /* first get sink type as it may be reset after (un)plug */
88 dig_connector
->dp_sink_type
= radeon_dp_getsinktype(radeon_connector
);
89 /* don't do anything if sink is not display port, i.e.,
90 * passive dp->(dvi|hdmi) adaptor
92 if (dig_connector
->dp_sink_type
== CONNECTOR_OBJECT_ID_DISPLAYPORT
) {
93 int saved_dpms
= connector
->dpms
;
94 /* Only turn off the display if it's physically disconnected */
95 if (!radeon_hpd_sense(rdev
, radeon_connector
->hpd
.hpd
)) {
96 drm_helper_connector_dpms(connector
, DRM_MODE_DPMS_OFF
);
97 } else if (radeon_dp_needs_link_train(radeon_connector
)) {
98 /* Don't try to start link training before we
100 if (!radeon_dp_getdpcd(radeon_connector
))
103 /* set it to OFF so that drm_helper_connector_dpms()
104 * won't return immediately since the current state
105 * is ON at this point.
107 connector
->dpms
= DRM_MODE_DPMS_OFF
;
108 drm_helper_connector_dpms(connector
, DRM_MODE_DPMS_ON
);
110 connector
->dpms
= saved_dpms
;
115 static void radeon_property_change_mode(struct drm_encoder
*encoder
)
117 struct drm_crtc
*crtc
= encoder
->crtc
;
119 if (crtc
&& crtc
->enabled
) {
120 drm_crtc_helper_set_mode(crtc
, &crtc
->mode
,
121 crtc
->x
, crtc
->y
, crtc
->primary
->fb
);
125 int radeon_get_monitor_bpc(struct drm_connector
*connector
)
127 struct drm_device
*dev
= connector
->dev
;
128 struct radeon_device
*rdev
= dev
->dev_private
;
129 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
130 struct radeon_connector_atom_dig
*dig_connector
;
132 int mode_clock
, max_tmds_clock
;
134 switch (connector
->connector_type
) {
135 case DRM_MODE_CONNECTOR_DVII
:
136 case DRM_MODE_CONNECTOR_HDMIB
:
137 if (radeon_connector
->use_digital
) {
138 if (drm_detect_hdmi_monitor(radeon_connector_edid(connector
))) {
139 if (connector
->display_info
.bpc
)
140 bpc
= connector
->display_info
.bpc
;
144 case DRM_MODE_CONNECTOR_DVID
:
145 case DRM_MODE_CONNECTOR_HDMIA
:
146 if (drm_detect_hdmi_monitor(radeon_connector_edid(connector
))) {
147 if (connector
->display_info
.bpc
)
148 bpc
= connector
->display_info
.bpc
;
151 case DRM_MODE_CONNECTOR_DisplayPort
:
152 dig_connector
= radeon_connector
->con_priv
;
153 if ((dig_connector
->dp_sink_type
== CONNECTOR_OBJECT_ID_DISPLAYPORT
) ||
154 (dig_connector
->dp_sink_type
== CONNECTOR_OBJECT_ID_eDP
) ||
155 drm_detect_hdmi_monitor(radeon_connector_edid(connector
))) {
156 if (connector
->display_info
.bpc
)
157 bpc
= connector
->display_info
.bpc
;
160 case DRM_MODE_CONNECTOR_eDP
:
161 case DRM_MODE_CONNECTOR_LVDS
:
162 if (connector
->display_info
.bpc
)
163 bpc
= connector
->display_info
.bpc
;
164 else if (ASIC_IS_DCE41(rdev
) || ASIC_IS_DCE5(rdev
)) {
165 const struct drm_connector_helper_funcs
*connector_funcs
=
166 connector
->helper_private
;
167 struct drm_encoder
*encoder
= connector_funcs
->best_encoder(connector
);
168 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
169 struct radeon_encoder_atom_dig
*dig
= radeon_encoder
->enc_priv
;
171 if (dig
->lcd_misc
& ATOM_PANEL_MISC_V13_6BIT_PER_COLOR
)
173 else if (dig
->lcd_misc
& ATOM_PANEL_MISC_V13_8BIT_PER_COLOR
)
179 if (drm_detect_hdmi_monitor(radeon_connector_edid(connector
))) {
180 /* hdmi deep color only implemented on DCE4+ */
181 if ((bpc
> 8) && !ASIC_IS_DCE4(rdev
)) {
182 DRM_DEBUG("%s: HDMI deep color %d bpc unsupported. Using 8 bpc.\n",
183 connector
->name
, bpc
);
188 * Pre DCE-8 hw can't handle > 12 bpc, and more than 12 bpc doesn't make
189 * much sense without support for > 12 bpc framebuffers. RGB 4:4:4 at
190 * 12 bpc is always supported on hdmi deep color sinks, as this is
191 * required by the HDMI-1.3 spec. Clamp to a safe 12 bpc maximum.
194 DRM_DEBUG("%s: HDMI deep color %d bpc unsupported. Using 12 bpc.\n",
195 connector
->name
, bpc
);
199 /* Any defined maximum tmds clock limit we must not exceed? */
200 if (connector
->max_tmds_clock
> 0) {
201 /* mode_clock is clock in kHz for mode to be modeset on this connector */
202 mode_clock
= radeon_connector
->pixelclock_for_modeset
;
204 /* Maximum allowable input clock in kHz */
205 max_tmds_clock
= connector
->max_tmds_clock
* 1000;
207 DRM_DEBUG("%s: hdmi mode dotclock %d kHz, max tmds input clock %d kHz.\n",
208 connector
->name
, mode_clock
, max_tmds_clock
);
210 /* Check if bpc is within clock limit. Try to degrade gracefully otherwise */
211 if ((bpc
== 12) && (mode_clock
* 3/2 > max_tmds_clock
)) {
212 if ((connector
->display_info
.edid_hdmi_dc_modes
& DRM_EDID_HDMI_DC_30
) &&
213 (mode_clock
* 5/4 <= max_tmds_clock
))
218 DRM_DEBUG("%s: HDMI deep color 12 bpc exceeds max tmds clock. Using %d bpc.\n",
219 connector
->name
, bpc
);
222 if ((bpc
== 10) && (mode_clock
* 5/4 > max_tmds_clock
)) {
224 DRM_DEBUG("%s: HDMI deep color 10 bpc exceeds max tmds clock. Using %d bpc.\n",
225 connector
->name
, bpc
);
229 /* max_tmds_clock missing, but hdmi spec mandates it for deep color. */
230 DRM_DEBUG("%s: Required max tmds clock for HDMI deep color missing. Using 8 bpc.\n",
236 if ((radeon_deep_color
== 0) && (bpc
> 8)) {
237 DRM_DEBUG("%s: Deep color disabled. Set radeon module param deep_color=1 to enable.\n",
242 DRM_DEBUG("%s: Display bpc=%d, returned bpc=%d\n",
243 connector
->name
, connector
->display_info
.bpc
, bpc
);
249 radeon_connector_update_scratch_regs(struct drm_connector
*connector
, enum drm_connector_status status
)
251 struct drm_device
*dev
= connector
->dev
;
252 struct radeon_device
*rdev
= dev
->dev_private
;
253 struct drm_encoder
*best_encoder
= NULL
;
254 struct drm_encoder
*encoder
= NULL
;
255 const struct drm_connector_helper_funcs
*connector_funcs
= connector
->helper_private
;
259 best_encoder
= connector_funcs
->best_encoder(connector
);
261 for (i
= 0; i
< DRM_CONNECTOR_MAX_ENCODER
; i
++) {
262 if (connector
->encoder_ids
[i
] == 0)
265 encoder
= drm_encoder_find(connector
->dev
,
266 connector
->encoder_ids
[i
]);
270 if ((encoder
== best_encoder
) && (status
== connector_status_connected
))
275 if (rdev
->is_atom_bios
)
276 radeon_atombios_connected_scratch_regs(connector
, encoder
, connected
);
278 radeon_combios_connected_scratch_regs(connector
, encoder
, connected
);
283 static struct drm_encoder
*radeon_find_encoder(struct drm_connector
*connector
, int encoder_type
)
285 struct drm_encoder
*encoder
;
288 for (i
= 0; i
< DRM_CONNECTOR_MAX_ENCODER
; i
++) {
289 if (connector
->encoder_ids
[i
] == 0)
292 encoder
= drm_encoder_find(connector
->dev
, connector
->encoder_ids
[i
]);
296 if (encoder
->encoder_type
== encoder_type
)
302 struct edid
*radeon_connector_edid(struct drm_connector
*connector
)
304 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
305 struct drm_property_blob
*edid_blob
= connector
->edid_blob_ptr
;
307 if (radeon_connector
->edid
) {
308 return radeon_connector
->edid
;
309 } else if (edid_blob
) {
310 struct edid
*edid
= kmemdup(edid_blob
->data
, edid_blob
->length
, GFP_KERNEL
);
312 radeon_connector
->edid
= edid
;
314 return radeon_connector
->edid
;
317 static void radeon_connector_get_edid(struct drm_connector
*connector
)
319 struct drm_device
*dev
= connector
->dev
;
320 struct radeon_device
*rdev
= dev
->dev_private
;
321 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
323 if (radeon_connector
->edid
)
326 /* on hw with routers, select right port */
327 if (radeon_connector
->router
.ddc_valid
)
328 radeon_router_select_ddc_port(radeon_connector
);
330 if ((radeon_connector_encoder_get_dp_bridge_encoder_id(connector
) !=
331 ENCODER_OBJECT_ID_NONE
) &&
332 radeon_connector
->ddc_bus
->has_aux
) {
333 radeon_connector
->edid
= drm_get_edid(connector
,
334 &radeon_connector
->ddc_bus
->aux
.ddc
);
335 } else if ((connector
->connector_type
== DRM_MODE_CONNECTOR_DisplayPort
) ||
336 (connector
->connector_type
== DRM_MODE_CONNECTOR_eDP
)) {
337 struct radeon_connector_atom_dig
*dig
= radeon_connector
->con_priv
;
339 if ((dig
->dp_sink_type
== CONNECTOR_OBJECT_ID_DISPLAYPORT
||
340 dig
->dp_sink_type
== CONNECTOR_OBJECT_ID_eDP
) &&
341 radeon_connector
->ddc_bus
->has_aux
)
342 radeon_connector
->edid
= drm_get_edid(&radeon_connector
->base
,
343 &radeon_connector
->ddc_bus
->aux
.ddc
);
344 else if (radeon_connector
->ddc_bus
)
345 radeon_connector
->edid
= drm_get_edid(&radeon_connector
->base
,
346 &radeon_connector
->ddc_bus
->adapter
);
347 } else if (radeon_connector
->ddc_bus
) {
348 radeon_connector
->edid
= drm_get_edid(&radeon_connector
->base
,
349 &radeon_connector
->ddc_bus
->adapter
);
352 if (!radeon_connector
->edid
) {
353 /* don't fetch the edid from the vbios if ddc fails and runpm is
354 * enabled so we report disconnected.
356 if ((rdev
->flags
& RADEON_IS_PX
) && (radeon_runtime_pm
!= 0))
359 if (rdev
->is_atom_bios
) {
360 /* some laptops provide a hardcoded edid in rom for LCDs */
361 if (((connector
->connector_type
== DRM_MODE_CONNECTOR_LVDS
) ||
362 (connector
->connector_type
== DRM_MODE_CONNECTOR_eDP
)))
363 radeon_connector
->edid
= radeon_bios_get_hardcoded_edid(rdev
);
365 /* some servers provide a hardcoded edid in rom for KVMs */
366 radeon_connector
->edid
= radeon_bios_get_hardcoded_edid(rdev
);
371 static void radeon_connector_free_edid(struct drm_connector
*connector
)
373 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
375 if (radeon_connector
->edid
) {
376 kfree(radeon_connector
->edid
);
377 radeon_connector
->edid
= NULL
;
381 static int radeon_ddc_get_modes(struct drm_connector
*connector
)
383 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
386 if (radeon_connector
->edid
) {
387 drm_mode_connector_update_edid_property(connector
, radeon_connector
->edid
);
388 ret
= drm_add_edid_modes(connector
, radeon_connector
->edid
);
389 drm_edid_to_eld(connector
, radeon_connector
->edid
);
392 drm_mode_connector_update_edid_property(connector
, NULL
);
396 static struct drm_encoder
*radeon_best_single_encoder(struct drm_connector
*connector
)
398 int enc_id
= connector
->encoder_ids
[0];
399 /* pick the encoder ids */
401 return drm_encoder_find(connector
->dev
, enc_id
);
405 static void radeon_get_native_mode(struct drm_connector
*connector
)
407 struct drm_encoder
*encoder
= radeon_best_single_encoder(connector
);
408 struct radeon_encoder
*radeon_encoder
;
413 radeon_encoder
= to_radeon_encoder(encoder
);
415 if (!list_empty(&connector
->probed_modes
)) {
416 struct drm_display_mode
*preferred_mode
=
417 list_first_entry(&connector
->probed_modes
,
418 struct drm_display_mode
, head
);
420 radeon_encoder
->native_mode
= *preferred_mode
;
422 radeon_encoder
->native_mode
.clock
= 0;
427 * radeon_connector_analog_encoder_conflict_solve
428 * - search for other connectors sharing this encoder
429 * if priority is true, then set them disconnected if this is connected
430 * if priority is false, set us disconnected if they are connected
432 static enum drm_connector_status
433 radeon_connector_analog_encoder_conflict_solve(struct drm_connector
*connector
,
434 struct drm_encoder
*encoder
,
435 enum drm_connector_status current_status
,
438 struct drm_device
*dev
= connector
->dev
;
439 struct drm_connector
*conflict
;
440 struct radeon_connector
*radeon_conflict
;
443 list_for_each_entry(conflict
, &dev
->mode_config
.connector_list
, head
) {
444 if (conflict
== connector
)
447 radeon_conflict
= to_radeon_connector(conflict
);
448 for (i
= 0; i
< DRM_CONNECTOR_MAX_ENCODER
; i
++) {
449 if (conflict
->encoder_ids
[i
] == 0)
452 /* if the IDs match */
453 if (conflict
->encoder_ids
[i
] == encoder
->base
.id
) {
454 if (conflict
->status
!= connector_status_connected
)
457 if (radeon_conflict
->use_digital
)
460 if (priority
== true) {
461 DRM_DEBUG_KMS("1: conflicting encoders switching off %s\n",
463 DRM_DEBUG_KMS("in favor of %s\n",
465 conflict
->status
= connector_status_disconnected
;
466 radeon_connector_update_scratch_regs(conflict
, connector_status_disconnected
);
468 DRM_DEBUG_KMS("2: conflicting encoders switching off %s\n",
470 DRM_DEBUG_KMS("in favor of %s\n",
472 current_status
= connector_status_disconnected
;
478 return current_status
;
482 static struct drm_display_mode
*radeon_fp_native_mode(struct drm_encoder
*encoder
)
484 struct drm_device
*dev
= encoder
->dev
;
485 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
486 struct drm_display_mode
*mode
= NULL
;
487 struct drm_display_mode
*native_mode
= &radeon_encoder
->native_mode
;
489 if (native_mode
->hdisplay
!= 0 &&
490 native_mode
->vdisplay
!= 0 &&
491 native_mode
->clock
!= 0) {
492 mode
= drm_mode_duplicate(dev
, native_mode
);
493 mode
->type
= DRM_MODE_TYPE_PREFERRED
| DRM_MODE_TYPE_DRIVER
;
494 drm_mode_set_name(mode
);
496 DRM_DEBUG_KMS("Adding native panel mode %s\n", mode
->name
);
497 } else if (native_mode
->hdisplay
!= 0 &&
498 native_mode
->vdisplay
!= 0) {
499 /* mac laptops without an edid */
500 /* Note that this is not necessarily the exact panel mode,
501 * but an approximation based on the cvt formula. For these
502 * systems we should ideally read the mode info out of the
503 * registers or add a mode table, but this works and is much
506 mode
= drm_cvt_mode(dev
, native_mode
->hdisplay
, native_mode
->vdisplay
, 60, true, false, false);
507 mode
->type
= DRM_MODE_TYPE_PREFERRED
| DRM_MODE_TYPE_DRIVER
;
508 DRM_DEBUG_KMS("Adding cvt approximation of native panel mode %s\n", mode
->name
);
513 static void radeon_add_common_modes(struct drm_encoder
*encoder
, struct drm_connector
*connector
)
515 struct drm_device
*dev
= encoder
->dev
;
516 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
517 struct drm_display_mode
*mode
= NULL
;
518 struct drm_display_mode
*native_mode
= &radeon_encoder
->native_mode
;
523 } common_modes
[17] = {
543 for (i
= 0; i
< 17; i
++) {
544 if (radeon_encoder
->devices
& (ATOM_DEVICE_TV_SUPPORT
)) {
545 if (common_modes
[i
].w
> 1024 ||
546 common_modes
[i
].h
> 768)
549 if (radeon_encoder
->devices
& (ATOM_DEVICE_LCD_SUPPORT
)) {
550 if (common_modes
[i
].w
> native_mode
->hdisplay
||
551 common_modes
[i
].h
> native_mode
->vdisplay
||
552 (common_modes
[i
].w
== native_mode
->hdisplay
&&
553 common_modes
[i
].h
== native_mode
->vdisplay
))
556 if (common_modes
[i
].w
< 320 || common_modes
[i
].h
< 200)
559 mode
= drm_cvt_mode(dev
, common_modes
[i
].w
, common_modes
[i
].h
, 60, false, false, false);
560 drm_mode_probed_add(connector
, mode
);
564 static int radeon_connector_set_property(struct drm_connector
*connector
, struct drm_property
*property
,
567 struct drm_device
*dev
= connector
->dev
;
568 struct radeon_device
*rdev
= dev
->dev_private
;
569 struct drm_encoder
*encoder
;
570 struct radeon_encoder
*radeon_encoder
;
572 if (property
== rdev
->mode_info
.coherent_mode_property
) {
573 struct radeon_encoder_atom_dig
*dig
;
574 bool new_coherent_mode
;
576 /* need to find digital encoder on connector */
577 encoder
= radeon_find_encoder(connector
, DRM_MODE_ENCODER_TMDS
);
581 radeon_encoder
= to_radeon_encoder(encoder
);
583 if (!radeon_encoder
->enc_priv
)
586 dig
= radeon_encoder
->enc_priv
;
587 new_coherent_mode
= val
? true : false;
588 if (dig
->coherent_mode
!= new_coherent_mode
) {
589 dig
->coherent_mode
= new_coherent_mode
;
590 radeon_property_change_mode(&radeon_encoder
->base
);
594 if (property
== rdev
->mode_info
.audio_property
) {
595 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
596 /* need to find digital encoder on connector */
597 encoder
= radeon_find_encoder(connector
, DRM_MODE_ENCODER_TMDS
);
601 radeon_encoder
= to_radeon_encoder(encoder
);
603 if (radeon_connector
->audio
!= val
) {
604 radeon_connector
->audio
= val
;
605 radeon_property_change_mode(&radeon_encoder
->base
);
609 if (property
== rdev
->mode_info
.dither_property
) {
610 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
611 /* need to find digital encoder on connector */
612 encoder
= radeon_find_encoder(connector
, DRM_MODE_ENCODER_TMDS
);
616 radeon_encoder
= to_radeon_encoder(encoder
);
618 if (radeon_connector
->dither
!= val
) {
619 radeon_connector
->dither
= val
;
620 radeon_property_change_mode(&radeon_encoder
->base
);
624 if (property
== rdev
->mode_info
.underscan_property
) {
625 /* need to find digital encoder on connector */
626 encoder
= radeon_find_encoder(connector
, DRM_MODE_ENCODER_TMDS
);
630 radeon_encoder
= to_radeon_encoder(encoder
);
632 if (radeon_encoder
->underscan_type
!= val
) {
633 radeon_encoder
->underscan_type
= val
;
634 radeon_property_change_mode(&radeon_encoder
->base
);
638 if (property
== rdev
->mode_info
.underscan_hborder_property
) {
639 /* need to find digital encoder on connector */
640 encoder
= radeon_find_encoder(connector
, DRM_MODE_ENCODER_TMDS
);
644 radeon_encoder
= to_radeon_encoder(encoder
);
646 if (radeon_encoder
->underscan_hborder
!= val
) {
647 radeon_encoder
->underscan_hborder
= val
;
648 radeon_property_change_mode(&radeon_encoder
->base
);
652 if (property
== rdev
->mode_info
.underscan_vborder_property
) {
653 /* need to find digital encoder on connector */
654 encoder
= radeon_find_encoder(connector
, DRM_MODE_ENCODER_TMDS
);
658 radeon_encoder
= to_radeon_encoder(encoder
);
660 if (radeon_encoder
->underscan_vborder
!= val
) {
661 radeon_encoder
->underscan_vborder
= val
;
662 radeon_property_change_mode(&radeon_encoder
->base
);
666 if (property
== rdev
->mode_info
.tv_std_property
) {
667 encoder
= radeon_find_encoder(connector
, DRM_MODE_ENCODER_TVDAC
);
669 encoder
= radeon_find_encoder(connector
, DRM_MODE_ENCODER_DAC
);
675 radeon_encoder
= to_radeon_encoder(encoder
);
676 if (!radeon_encoder
->enc_priv
)
678 if (ASIC_IS_AVIVO(rdev
) || radeon_r4xx_atom
) {
679 struct radeon_encoder_atom_dac
*dac_int
;
680 dac_int
= radeon_encoder
->enc_priv
;
681 dac_int
->tv_std
= val
;
683 struct radeon_encoder_tv_dac
*dac_int
;
684 dac_int
= radeon_encoder
->enc_priv
;
685 dac_int
->tv_std
= val
;
687 radeon_property_change_mode(&radeon_encoder
->base
);
690 if (property
== rdev
->mode_info
.load_detect_property
) {
691 struct radeon_connector
*radeon_connector
=
692 to_radeon_connector(connector
);
695 radeon_connector
->dac_load_detect
= false;
697 radeon_connector
->dac_load_detect
= true;
700 if (property
== rdev
->mode_info
.tmds_pll_property
) {
701 struct radeon_encoder_int_tmds
*tmds
= NULL
;
703 /* need to find digital encoder on connector */
704 encoder
= radeon_find_encoder(connector
, DRM_MODE_ENCODER_TMDS
);
708 radeon_encoder
= to_radeon_encoder(encoder
);
710 tmds
= radeon_encoder
->enc_priv
;
715 if (rdev
->is_atom_bios
)
716 ret
= radeon_atombios_get_tmds_info(radeon_encoder
, tmds
);
718 ret
= radeon_legacy_get_tmds_info_from_combios(radeon_encoder
, tmds
);
720 if (val
== 1 || ret
== false) {
721 radeon_legacy_get_tmds_info_from_table(radeon_encoder
, tmds
);
723 radeon_property_change_mode(&radeon_encoder
->base
);
726 if (property
== dev
->mode_config
.scaling_mode_property
) {
727 enum radeon_rmx_type rmx_type
;
729 if (connector
->encoder
)
730 radeon_encoder
= to_radeon_encoder(connector
->encoder
);
732 const struct drm_connector_helper_funcs
*connector_funcs
= connector
->helper_private
;
733 radeon_encoder
= to_radeon_encoder(connector_funcs
->best_encoder(connector
));
738 case DRM_MODE_SCALE_NONE
: rmx_type
= RMX_OFF
; break;
739 case DRM_MODE_SCALE_CENTER
: rmx_type
= RMX_CENTER
; break;
740 case DRM_MODE_SCALE_ASPECT
: rmx_type
= RMX_ASPECT
; break;
741 case DRM_MODE_SCALE_FULLSCREEN
: rmx_type
= RMX_FULL
; break;
743 if (radeon_encoder
->rmx_type
== rmx_type
)
746 if ((rmx_type
!= DRM_MODE_SCALE_NONE
) &&
747 (radeon_encoder
->native_mode
.clock
== 0))
750 radeon_encoder
->rmx_type
= rmx_type
;
752 radeon_property_change_mode(&radeon_encoder
->base
);
755 if (property
== rdev
->mode_info
.output_csc_property
) {
756 if (connector
->encoder
)
757 radeon_encoder
= to_radeon_encoder(connector
->encoder
);
759 const struct drm_connector_helper_funcs
*connector_funcs
= connector
->helper_private
;
760 radeon_encoder
= to_radeon_encoder(connector_funcs
->best_encoder(connector
));
763 if (radeon_encoder
->output_csc
== val
)
766 radeon_encoder
->output_csc
= val
;
768 if (connector
->encoder
->crtc
) {
769 struct drm_crtc
*crtc
= connector
->encoder
->crtc
;
770 const struct drm_crtc_helper_funcs
*crtc_funcs
= crtc
->helper_private
;
771 struct radeon_crtc
*radeon_crtc
= to_radeon_crtc(crtc
);
773 radeon_crtc
->output_csc
= radeon_encoder
->output_csc
;
775 (*crtc_funcs
->load_lut
)(crtc
);
782 static void radeon_fixup_lvds_native_mode(struct drm_encoder
*encoder
,
783 struct drm_connector
*connector
)
785 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
786 struct drm_display_mode
*native_mode
= &radeon_encoder
->native_mode
;
787 struct drm_display_mode
*t
, *mode
;
789 /* If the EDID preferred mode doesn't match the native mode, use it */
790 list_for_each_entry_safe(mode
, t
, &connector
->probed_modes
, head
) {
791 if (mode
->type
& DRM_MODE_TYPE_PREFERRED
) {
792 if (mode
->hdisplay
!= native_mode
->hdisplay
||
793 mode
->vdisplay
!= native_mode
->vdisplay
)
794 memcpy(native_mode
, mode
, sizeof(*mode
));
798 /* Try to get native mode details from EDID if necessary */
799 if (!native_mode
->clock
) {
800 list_for_each_entry_safe(mode
, t
, &connector
->probed_modes
, head
) {
801 if (mode
->hdisplay
== native_mode
->hdisplay
&&
802 mode
->vdisplay
== native_mode
->vdisplay
) {
803 *native_mode
= *mode
;
804 drm_mode_set_crtcinfo(native_mode
, CRTC_INTERLACE_HALVE_V
);
805 DRM_DEBUG_KMS("Determined LVDS native mode details from EDID\n");
811 if (!native_mode
->clock
) {
812 DRM_DEBUG_KMS("No LVDS native mode details, disabling RMX\n");
813 radeon_encoder
->rmx_type
= RMX_OFF
;
817 static int radeon_lvds_get_modes(struct drm_connector
*connector
)
819 struct drm_encoder
*encoder
;
821 struct drm_display_mode
*mode
;
823 radeon_connector_get_edid(connector
);
824 ret
= radeon_ddc_get_modes(connector
);
826 encoder
= radeon_best_single_encoder(connector
);
828 radeon_fixup_lvds_native_mode(encoder
, connector
);
829 /* add scaled modes */
830 radeon_add_common_modes(encoder
, connector
);
835 encoder
= radeon_best_single_encoder(connector
);
839 /* we have no EDID modes */
840 mode
= radeon_fp_native_mode(encoder
);
843 drm_mode_probed_add(connector
, mode
);
844 /* add the width/height from vbios tables if available */
845 connector
->display_info
.width_mm
= mode
->width_mm
;
846 connector
->display_info
.height_mm
= mode
->height_mm
;
847 /* add scaled modes */
848 radeon_add_common_modes(encoder
, connector
);
854 static int radeon_lvds_mode_valid(struct drm_connector
*connector
,
855 struct drm_display_mode
*mode
)
857 struct drm_encoder
*encoder
= radeon_best_single_encoder(connector
);
859 if ((mode
->hdisplay
< 320) || (mode
->vdisplay
< 240))
863 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
864 struct drm_display_mode
*native_mode
= &radeon_encoder
->native_mode
;
866 /* AVIVO hardware supports downscaling modes larger than the panel
867 * to the panel size, but I'm not sure this is desirable.
869 if ((mode
->hdisplay
> native_mode
->hdisplay
) ||
870 (mode
->vdisplay
> native_mode
->vdisplay
))
873 /* if scaling is disabled, block non-native modes */
874 if (radeon_encoder
->rmx_type
== RMX_OFF
) {
875 if ((mode
->hdisplay
!= native_mode
->hdisplay
) ||
876 (mode
->vdisplay
!= native_mode
->vdisplay
))
884 static enum drm_connector_status
885 radeon_lvds_detect(struct drm_connector
*connector
, bool force
)
887 struct drm_device
*dev
= connector
->dev
;
888 struct radeon_device
*rdev
= dev
->dev_private
;
889 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
890 struct drm_encoder
*encoder
= radeon_best_single_encoder(connector
);
891 enum drm_connector_status ret
= connector_status_disconnected
;
894 r
= pm_runtime_get_sync(connector
->dev
->dev
);
896 return connector_status_disconnected
;
899 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
900 struct drm_display_mode
*native_mode
= &radeon_encoder
->native_mode
;
902 /* check if panel is valid */
903 if (native_mode
->hdisplay
>= 320 && native_mode
->vdisplay
>= 240)
904 ret
= connector_status_connected
;
905 /* don't fetch the edid from the vbios if ddc fails and runpm is
906 * enabled so we report disconnected.
908 if ((rdev
->flags
& RADEON_IS_PX
) && (radeon_runtime_pm
!= 0))
909 ret
= connector_status_disconnected
;
912 /* check for edid as well */
913 radeon_connector_get_edid(connector
);
914 if (radeon_connector
->edid
)
915 ret
= connector_status_connected
;
916 /* check acpi lid status ??? */
918 radeon_connector_update_scratch_regs(connector
, ret
);
919 pm_runtime_mark_last_busy(connector
->dev
->dev
);
920 pm_runtime_put_autosuspend(connector
->dev
->dev
);
924 static void radeon_connector_destroy(struct drm_connector
*connector
)
926 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
928 radeon_connector_free_edid(connector
);
929 kfree(radeon_connector
->con_priv
);
930 drm_connector_unregister(connector
);
931 drm_connector_cleanup(connector
);
935 static int radeon_lvds_set_property(struct drm_connector
*connector
,
936 struct drm_property
*property
,
939 struct drm_device
*dev
= connector
->dev
;
940 struct radeon_encoder
*radeon_encoder
;
941 enum radeon_rmx_type rmx_type
;
944 if (property
!= dev
->mode_config
.scaling_mode_property
)
947 if (connector
->encoder
)
948 radeon_encoder
= to_radeon_encoder(connector
->encoder
);
950 const struct drm_connector_helper_funcs
*connector_funcs
= connector
->helper_private
;
951 radeon_encoder
= to_radeon_encoder(connector_funcs
->best_encoder(connector
));
955 case DRM_MODE_SCALE_NONE
: rmx_type
= RMX_OFF
; break;
956 case DRM_MODE_SCALE_CENTER
: rmx_type
= RMX_CENTER
; break;
957 case DRM_MODE_SCALE_ASPECT
: rmx_type
= RMX_ASPECT
; break;
959 case DRM_MODE_SCALE_FULLSCREEN
: rmx_type
= RMX_FULL
; break;
961 if (radeon_encoder
->rmx_type
== rmx_type
)
964 radeon_encoder
->rmx_type
= rmx_type
;
966 radeon_property_change_mode(&radeon_encoder
->base
);
971 static const struct drm_connector_helper_funcs radeon_lvds_connector_helper_funcs
= {
972 .get_modes
= radeon_lvds_get_modes
,
973 .mode_valid
= radeon_lvds_mode_valid
,
974 .best_encoder
= radeon_best_single_encoder
,
977 static const struct drm_connector_funcs radeon_lvds_connector_funcs
= {
978 .dpms
= drm_helper_connector_dpms
,
979 .detect
= radeon_lvds_detect
,
980 .fill_modes
= drm_helper_probe_single_connector_modes
,
981 .destroy
= radeon_connector_destroy
,
982 .set_property
= radeon_lvds_set_property
,
985 static int radeon_vga_get_modes(struct drm_connector
*connector
)
989 radeon_connector_get_edid(connector
);
990 ret
= radeon_ddc_get_modes(connector
);
992 radeon_get_native_mode(connector
);
997 static int radeon_vga_mode_valid(struct drm_connector
*connector
,
998 struct drm_display_mode
*mode
)
1000 struct drm_device
*dev
= connector
->dev
;
1001 struct radeon_device
*rdev
= dev
->dev_private
;
1003 /* XXX check mode bandwidth */
1005 if ((mode
->clock
/ 10) > rdev
->clock
.max_pixel_clock
)
1006 return MODE_CLOCK_HIGH
;
1011 static enum drm_connector_status
1012 radeon_vga_detect(struct drm_connector
*connector
, bool force
)
1014 struct drm_device
*dev
= connector
->dev
;
1015 struct radeon_device
*rdev
= dev
->dev_private
;
1016 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
1017 struct drm_encoder
*encoder
;
1018 const struct drm_encoder_helper_funcs
*encoder_funcs
;
1020 enum drm_connector_status ret
= connector_status_disconnected
;
1023 r
= pm_runtime_get_sync(connector
->dev
->dev
);
1025 return connector_status_disconnected
;
1027 encoder
= radeon_best_single_encoder(connector
);
1029 ret
= connector_status_disconnected
;
1031 if (radeon_connector
->ddc_bus
)
1032 dret
= radeon_ddc_probe(radeon_connector
, false);
1034 radeon_connector
->detected_by_load
= false;
1035 radeon_connector_free_edid(connector
);
1036 radeon_connector_get_edid(connector
);
1038 if (!radeon_connector
->edid
) {
1039 DRM_ERROR("%s: probed a monitor but no|invalid EDID\n",
1041 ret
= connector_status_connected
;
1043 radeon_connector
->use_digital
=
1044 !!(radeon_connector
->edid
->input
& DRM_EDID_INPUT_DIGITAL
);
1046 /* some oems have boards with separate digital and analog connectors
1047 * with a shared ddc line (often vga + hdmi)
1049 if (radeon_connector
->use_digital
&& radeon_connector
->shared_ddc
) {
1050 radeon_connector_free_edid(connector
);
1051 ret
= connector_status_disconnected
;
1053 ret
= connector_status_connected
;
1058 /* if we aren't forcing don't do destructive polling */
1060 /* only return the previous status if we last
1061 * detected a monitor via load.
1063 if (radeon_connector
->detected_by_load
)
1064 ret
= connector
->status
;
1068 if (radeon_connector
->dac_load_detect
&& encoder
) {
1069 encoder_funcs
= encoder
->helper_private
;
1070 ret
= encoder_funcs
->detect(encoder
, connector
);
1071 if (ret
!= connector_status_disconnected
)
1072 radeon_connector
->detected_by_load
= true;
1076 if (ret
== connector_status_connected
)
1077 ret
= radeon_connector_analog_encoder_conflict_solve(connector
, encoder
, ret
, true);
1079 /* RN50 and some RV100 asics in servers often have a hardcoded EDID in the
1080 * vbios to deal with KVMs. If we have one and are not able to detect a monitor
1081 * by other means, assume the CRT is connected and use that EDID.
1083 if ((!rdev
->is_atom_bios
) &&
1084 (ret
== connector_status_disconnected
) &&
1085 rdev
->mode_info
.bios_hardcoded_edid_size
) {
1086 ret
= connector_status_connected
;
1089 radeon_connector_update_scratch_regs(connector
, ret
);
1092 pm_runtime_mark_last_busy(connector
->dev
->dev
);
1093 pm_runtime_put_autosuspend(connector
->dev
->dev
);
1098 static const struct drm_connector_helper_funcs radeon_vga_connector_helper_funcs
= {
1099 .get_modes
= radeon_vga_get_modes
,
1100 .mode_valid
= radeon_vga_mode_valid
,
1101 .best_encoder
= radeon_best_single_encoder
,
1104 static const struct drm_connector_funcs radeon_vga_connector_funcs
= {
1105 .dpms
= drm_helper_connector_dpms
,
1106 .detect
= radeon_vga_detect
,
1107 .fill_modes
= drm_helper_probe_single_connector_modes
,
1108 .destroy
= radeon_connector_destroy
,
1109 .set_property
= radeon_connector_set_property
,
1112 static int radeon_tv_get_modes(struct drm_connector
*connector
)
1114 struct drm_device
*dev
= connector
->dev
;
1115 struct radeon_device
*rdev
= dev
->dev_private
;
1116 struct drm_display_mode
*tv_mode
;
1117 struct drm_encoder
*encoder
;
1119 encoder
= radeon_best_single_encoder(connector
);
1123 /* avivo chips can scale any mode */
1124 if (rdev
->family
>= CHIP_RS600
)
1125 /* add scaled modes */
1126 radeon_add_common_modes(encoder
, connector
);
1128 /* only 800x600 is supported right now on pre-avivo chips */
1129 tv_mode
= drm_cvt_mode(dev
, 800, 600, 60, false, false, false);
1130 tv_mode
->type
= DRM_MODE_TYPE_DRIVER
| DRM_MODE_TYPE_PREFERRED
;
1131 drm_mode_probed_add(connector
, tv_mode
);
1136 static int radeon_tv_mode_valid(struct drm_connector
*connector
,
1137 struct drm_display_mode
*mode
)
1139 if ((mode
->hdisplay
> 1024) || (mode
->vdisplay
> 768))
1140 return MODE_CLOCK_RANGE
;
1144 static enum drm_connector_status
1145 radeon_tv_detect(struct drm_connector
*connector
, bool force
)
1147 struct drm_encoder
*encoder
;
1148 const struct drm_encoder_helper_funcs
*encoder_funcs
;
1149 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
1150 enum drm_connector_status ret
= connector_status_disconnected
;
1153 if (!radeon_connector
->dac_load_detect
)
1156 r
= pm_runtime_get_sync(connector
->dev
->dev
);
1158 return connector_status_disconnected
;
1160 encoder
= radeon_best_single_encoder(connector
);
1162 ret
= connector_status_disconnected
;
1164 encoder_funcs
= encoder
->helper_private
;
1165 ret
= encoder_funcs
->detect(encoder
, connector
);
1167 if (ret
== connector_status_connected
)
1168 ret
= radeon_connector_analog_encoder_conflict_solve(connector
, encoder
, ret
, false);
1169 radeon_connector_update_scratch_regs(connector
, ret
);
1170 pm_runtime_mark_last_busy(connector
->dev
->dev
);
1171 pm_runtime_put_autosuspend(connector
->dev
->dev
);
1175 static const struct drm_connector_helper_funcs radeon_tv_connector_helper_funcs
= {
1176 .get_modes
= radeon_tv_get_modes
,
1177 .mode_valid
= radeon_tv_mode_valid
,
1178 .best_encoder
= radeon_best_single_encoder
,
1181 static const struct drm_connector_funcs radeon_tv_connector_funcs
= {
1182 .dpms
= drm_helper_connector_dpms
,
1183 .detect
= radeon_tv_detect
,
1184 .fill_modes
= drm_helper_probe_single_connector_modes
,
1185 .destroy
= radeon_connector_destroy
,
1186 .set_property
= radeon_connector_set_property
,
1189 static bool radeon_check_hpd_status_unchanged(struct drm_connector
*connector
)
1191 struct drm_device
*dev
= connector
->dev
;
1192 struct radeon_device
*rdev
= dev
->dev_private
;
1193 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
1194 enum drm_connector_status status
;
1196 /* We only trust HPD on R600 and newer ASICS. */
1197 if (rdev
->family
>= CHIP_R600
1198 && radeon_connector
->hpd
.hpd
!= RADEON_HPD_NONE
) {
1199 if (radeon_hpd_sense(rdev
, radeon_connector
->hpd
.hpd
))
1200 status
= connector_status_connected
;
1202 status
= connector_status_disconnected
;
1203 if (connector
->status
== status
)
1211 * DVI is complicated
1212 * Do a DDC probe, if DDC probe passes, get the full EDID so
1213 * we can do analog/digital monitor detection at this point.
1214 * If the monitor is an analog monitor or we got no DDC,
1215 * we need to find the DAC encoder object for this connector.
1216 * If we got no DDC, we do load detection on the DAC encoder object.
1217 * If we got analog DDC or load detection passes on the DAC encoder
1218 * we have to check if this analog encoder is shared with anyone else (TV)
1219 * if its shared we have to set the other connector to disconnected.
1221 static enum drm_connector_status
1222 radeon_dvi_detect(struct drm_connector
*connector
, bool force
)
1224 struct drm_device
*dev
= connector
->dev
;
1225 struct radeon_device
*rdev
= dev
->dev_private
;
1226 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
1227 struct drm_encoder
*encoder
= NULL
;
1228 const struct drm_encoder_helper_funcs
*encoder_funcs
;
1230 enum drm_connector_status ret
= connector_status_disconnected
;
1231 bool dret
= false, broken_edid
= false;
1233 r
= pm_runtime_get_sync(connector
->dev
->dev
);
1235 return connector_status_disconnected
;
1237 if (radeon_connector
->detected_hpd_without_ddc
) {
1239 radeon_connector
->detected_hpd_without_ddc
= false;
1242 if (!force
&& radeon_check_hpd_status_unchanged(connector
)) {
1243 ret
= connector
->status
;
1247 if (radeon_connector
->ddc_bus
) {
1248 dret
= radeon_ddc_probe(radeon_connector
, false);
1250 /* Sometimes the pins required for the DDC probe on DVI
1251 * connectors don't make contact at the same time that the ones
1252 * for HPD do. If the DDC probe fails even though we had an HPD
1253 * signal, try again later */
1254 if (!dret
&& !force
&&
1255 connector
->status
!= connector_status_connected
) {
1256 DRM_DEBUG_KMS("hpd detected without ddc, retrying in 1 second\n");
1257 radeon_connector
->detected_hpd_without_ddc
= true;
1258 schedule_delayed_work(&rdev
->hotplug_work
,
1259 msecs_to_jiffies(1000));
1264 radeon_connector
->detected_by_load
= false;
1265 radeon_connector_free_edid(connector
);
1266 radeon_connector_get_edid(connector
);
1268 if (!radeon_connector
->edid
) {
1269 DRM_ERROR("%s: probed a monitor but no|invalid EDID\n",
1271 /* rs690 seems to have a problem with connectors not existing and always
1272 * return a block of 0's. If we see this just stop polling on this output */
1273 if ((rdev
->family
== CHIP_RS690
|| rdev
->family
== CHIP_RS740
) &&
1274 radeon_connector
->base
.null_edid_counter
) {
1275 ret
= connector_status_disconnected
;
1276 DRM_ERROR("%s: detected RS690 floating bus bug, stopping ddc detect\n",
1278 radeon_connector
->ddc_bus
= NULL
;
1280 ret
= connector_status_connected
;
1281 broken_edid
= true; /* defer use_digital to later */
1284 radeon_connector
->use_digital
=
1285 !!(radeon_connector
->edid
->input
& DRM_EDID_INPUT_DIGITAL
);
1287 /* some oems have boards with separate digital and analog connectors
1288 * with a shared ddc line (often vga + hdmi)
1290 if ((!radeon_connector
->use_digital
) && radeon_connector
->shared_ddc
) {
1291 radeon_connector_free_edid(connector
);
1292 ret
= connector_status_disconnected
;
1294 ret
= connector_status_connected
;
1296 /* This gets complicated. We have boards with VGA + HDMI with a
1297 * shared DDC line and we have boards with DVI-D + HDMI with a shared
1298 * DDC line. The latter is more complex because with DVI<->HDMI adapters
1299 * you don't really know what's connected to which port as both are digital.
1301 if (radeon_connector
->shared_ddc
&& (ret
== connector_status_connected
)) {
1302 struct drm_connector
*list_connector
;
1303 struct radeon_connector
*list_radeon_connector
;
1304 list_for_each_entry(list_connector
, &dev
->mode_config
.connector_list
, head
) {
1305 if (connector
== list_connector
)
1307 list_radeon_connector
= to_radeon_connector(list_connector
);
1308 if (list_radeon_connector
->shared_ddc
&&
1309 (list_radeon_connector
->ddc_bus
->rec
.i2c_id
==
1310 radeon_connector
->ddc_bus
->rec
.i2c_id
)) {
1311 /* cases where both connectors are digital */
1312 if (list_connector
->connector_type
!= DRM_MODE_CONNECTOR_VGA
) {
1313 /* hpd is our only option in this case */
1314 if (!radeon_hpd_sense(rdev
, radeon_connector
->hpd
.hpd
)) {
1315 radeon_connector_free_edid(connector
);
1316 ret
= connector_status_disconnected
;
1325 if ((ret
== connector_status_connected
) && (radeon_connector
->use_digital
== true))
1328 /* DVI-D and HDMI-A are digital only */
1329 if ((connector
->connector_type
== DRM_MODE_CONNECTOR_DVID
) ||
1330 (connector
->connector_type
== DRM_MODE_CONNECTOR_HDMIA
))
1333 /* if we aren't forcing don't do destructive polling */
1335 /* only return the previous status if we last
1336 * detected a monitor via load.
1338 if (radeon_connector
->detected_by_load
)
1339 ret
= connector
->status
;
1343 /* find analog encoder */
1344 if (radeon_connector
->dac_load_detect
) {
1345 for (i
= 0; i
< DRM_CONNECTOR_MAX_ENCODER
; i
++) {
1346 if (connector
->encoder_ids
[i
] == 0)
1349 encoder
= drm_encoder_find(connector
->dev
,
1350 connector
->encoder_ids
[i
]);
1354 if (encoder
->encoder_type
!= DRM_MODE_ENCODER_DAC
&&
1355 encoder
->encoder_type
!= DRM_MODE_ENCODER_TVDAC
)
1358 encoder_funcs
= encoder
->helper_private
;
1359 if (encoder_funcs
->detect
) {
1361 if (ret
!= connector_status_connected
) {
1362 /* deal with analog monitors without DDC */
1363 ret
= encoder_funcs
->detect(encoder
, connector
);
1364 if (ret
== connector_status_connected
) {
1365 radeon_connector
->use_digital
= false;
1367 if (ret
!= connector_status_disconnected
)
1368 radeon_connector
->detected_by_load
= true;
1371 enum drm_connector_status lret
;
1372 /* assume digital unless load detected otherwise */
1373 radeon_connector
->use_digital
= true;
1374 lret
= encoder_funcs
->detect(encoder
, connector
);
1375 DRM_DEBUG_KMS("load_detect %x returned: %x\n",encoder
->encoder_type
,lret
);
1376 if (lret
== connector_status_connected
)
1377 radeon_connector
->use_digital
= false;
1384 if ((ret
== connector_status_connected
) && (radeon_connector
->use_digital
== false) &&
1386 ret
= radeon_connector_analog_encoder_conflict_solve(connector
, encoder
, ret
, true);
1389 /* RN50 and some RV100 asics in servers often have a hardcoded EDID in the
1390 * vbios to deal with KVMs. If we have one and are not able to detect a monitor
1391 * by other means, assume the DFP is connected and use that EDID. In most
1392 * cases the DVI port is actually a virtual KVM port connected to the service
1396 if ((!rdev
->is_atom_bios
) &&
1397 (ret
== connector_status_disconnected
) &&
1398 rdev
->mode_info
.bios_hardcoded_edid_size
) {
1399 radeon_connector
->use_digital
= true;
1400 ret
= connector_status_connected
;
1403 /* updated in get modes as well since we need to know if it's analog or digital */
1404 radeon_connector_update_scratch_regs(connector
, ret
);
1406 if ((radeon_audio
!= 0) && radeon_connector
->use_digital
) {
1407 const struct drm_connector_helper_funcs
*connector_funcs
=
1408 connector
->helper_private
;
1410 encoder
= connector_funcs
->best_encoder(connector
);
1411 if (encoder
&& (encoder
->encoder_type
== DRM_MODE_ENCODER_TMDS
)) {
1412 radeon_connector_get_edid(connector
);
1413 radeon_audio_detect(connector
, encoder
, ret
);
1418 pm_runtime_mark_last_busy(connector
->dev
->dev
);
1419 pm_runtime_put_autosuspend(connector
->dev
->dev
);
1424 /* okay need to be smart in here about which encoder to pick */
1425 static struct drm_encoder
*radeon_dvi_encoder(struct drm_connector
*connector
)
1427 int enc_id
= connector
->encoder_ids
[0];
1428 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
1429 struct drm_encoder
*encoder
;
1431 for (i
= 0; i
< DRM_CONNECTOR_MAX_ENCODER
; i
++) {
1432 if (connector
->encoder_ids
[i
] == 0)
1435 encoder
= drm_encoder_find(connector
->dev
, connector
->encoder_ids
[i
]);
1439 if (radeon_connector
->use_digital
== true) {
1440 if (encoder
->encoder_type
== DRM_MODE_ENCODER_TMDS
)
1443 if (encoder
->encoder_type
== DRM_MODE_ENCODER_DAC
||
1444 encoder
->encoder_type
== DRM_MODE_ENCODER_TVDAC
)
1449 /* see if we have a default encoder TODO */
1451 /* then check use digitial */
1452 /* pick the first one */
1454 return drm_encoder_find(connector
->dev
, enc_id
);
1458 static void radeon_dvi_force(struct drm_connector
*connector
)
1460 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
1461 if (connector
->force
== DRM_FORCE_ON
)
1462 radeon_connector
->use_digital
= false;
1463 if (connector
->force
== DRM_FORCE_ON_DIGITAL
)
1464 radeon_connector
->use_digital
= true;
1467 static int radeon_dvi_mode_valid(struct drm_connector
*connector
,
1468 struct drm_display_mode
*mode
)
1470 struct drm_device
*dev
= connector
->dev
;
1471 struct radeon_device
*rdev
= dev
->dev_private
;
1472 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
1474 /* XXX check mode bandwidth */
1476 /* clocks over 135 MHz have heat issues with DVI on RV100 */
1477 if (radeon_connector
->use_digital
&&
1478 (rdev
->family
== CHIP_RV100
) &&
1479 (mode
->clock
> 135000))
1480 return MODE_CLOCK_HIGH
;
1482 if (radeon_connector
->use_digital
&& (mode
->clock
> 165000)) {
1483 if ((radeon_connector
->connector_object_id
== CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_I
) ||
1484 (radeon_connector
->connector_object_id
== CONNECTOR_OBJECT_ID_DUAL_LINK_DVI_D
) ||
1485 (radeon_connector
->connector_object_id
== CONNECTOR_OBJECT_ID_HDMI_TYPE_B
))
1487 else if (ASIC_IS_DCE6(rdev
) && drm_detect_hdmi_monitor(radeon_connector_edid(connector
))) {
1488 /* HDMI 1.3+ supports max clock of 340 Mhz */
1489 if (mode
->clock
> 340000)
1490 return MODE_CLOCK_HIGH
;
1494 return MODE_CLOCK_HIGH
;
1498 /* check against the max pixel clock */
1499 if ((mode
->clock
/ 10) > rdev
->clock
.max_pixel_clock
)
1500 return MODE_CLOCK_HIGH
;
1505 static const struct drm_connector_helper_funcs radeon_dvi_connector_helper_funcs
= {
1506 .get_modes
= radeon_vga_get_modes
,
1507 .mode_valid
= radeon_dvi_mode_valid
,
1508 .best_encoder
= radeon_dvi_encoder
,
1511 static const struct drm_connector_funcs radeon_dvi_connector_funcs
= {
1512 .dpms
= drm_helper_connector_dpms
,
1513 .detect
= radeon_dvi_detect
,
1514 .fill_modes
= drm_helper_probe_single_connector_modes
,
1515 .set_property
= radeon_connector_set_property
,
1516 .destroy
= radeon_connector_destroy
,
1517 .force
= radeon_dvi_force
,
1520 static int radeon_dp_get_modes(struct drm_connector
*connector
)
1522 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
1523 struct radeon_connector_atom_dig
*radeon_dig_connector
= radeon_connector
->con_priv
;
1524 struct drm_encoder
*encoder
= radeon_best_single_encoder(connector
);
1527 if ((connector
->connector_type
== DRM_MODE_CONNECTOR_eDP
) ||
1528 (connector
->connector_type
== DRM_MODE_CONNECTOR_LVDS
)) {
1529 struct drm_display_mode
*mode
;
1531 if (connector
->connector_type
== DRM_MODE_CONNECTOR_eDP
) {
1532 if (!radeon_dig_connector
->edp_on
)
1533 atombios_set_edp_panel_power(connector
,
1534 ATOM_TRANSMITTER_ACTION_POWER_ON
);
1535 radeon_connector_get_edid(connector
);
1536 ret
= radeon_ddc_get_modes(connector
);
1537 if (!radeon_dig_connector
->edp_on
)
1538 atombios_set_edp_panel_power(connector
,
1539 ATOM_TRANSMITTER_ACTION_POWER_OFF
);
1541 /* need to setup ddc on the bridge */
1542 if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector
) !=
1543 ENCODER_OBJECT_ID_NONE
) {
1545 radeon_atom_ext_encoder_setup_ddc(encoder
);
1547 radeon_connector_get_edid(connector
);
1548 ret
= radeon_ddc_get_modes(connector
);
1553 radeon_fixup_lvds_native_mode(encoder
, connector
);
1554 /* add scaled modes */
1555 radeon_add_common_modes(encoder
, connector
);
1563 /* we have no EDID modes */
1564 mode
= radeon_fp_native_mode(encoder
);
1567 drm_mode_probed_add(connector
, mode
);
1568 /* add the width/height from vbios tables if available */
1569 connector
->display_info
.width_mm
= mode
->width_mm
;
1570 connector
->display_info
.height_mm
= mode
->height_mm
;
1571 /* add scaled modes */
1572 radeon_add_common_modes(encoder
, connector
);
1575 /* need to setup ddc on the bridge */
1576 if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector
) !=
1577 ENCODER_OBJECT_ID_NONE
) {
1579 radeon_atom_ext_encoder_setup_ddc(encoder
);
1581 radeon_connector_get_edid(connector
);
1582 ret
= radeon_ddc_get_modes(connector
);
1584 radeon_get_native_mode(connector
);
1590 u16
radeon_connector_encoder_get_dp_bridge_encoder_id(struct drm_connector
*connector
)
1592 struct drm_encoder
*encoder
;
1593 struct radeon_encoder
*radeon_encoder
;
1596 for (i
= 0; i
< DRM_CONNECTOR_MAX_ENCODER
; i
++) {
1597 if (connector
->encoder_ids
[i
] == 0)
1600 encoder
= drm_encoder_find(connector
->dev
, connector
->encoder_ids
[i
]);
1604 radeon_encoder
= to_radeon_encoder(encoder
);
1606 switch (radeon_encoder
->encoder_id
) {
1607 case ENCODER_OBJECT_ID_TRAVIS
:
1608 case ENCODER_OBJECT_ID_NUTMEG
:
1609 return radeon_encoder
->encoder_id
;
1615 return ENCODER_OBJECT_ID_NONE
;
1618 static bool radeon_connector_encoder_is_hbr2(struct drm_connector
*connector
)
1620 struct drm_encoder
*encoder
;
1621 struct radeon_encoder
*radeon_encoder
;
1625 for (i
= 0; i
< DRM_CONNECTOR_MAX_ENCODER
; i
++) {
1626 if (connector
->encoder_ids
[i
] == 0)
1629 encoder
= drm_encoder_find(connector
->dev
, connector
->encoder_ids
[i
]);
1633 radeon_encoder
= to_radeon_encoder(encoder
);
1634 if (radeon_encoder
->caps
& ATOM_ENCODER_CAP_RECORD_HBR2
)
1641 bool radeon_connector_is_dp12_capable(struct drm_connector
*connector
)
1643 struct drm_device
*dev
= connector
->dev
;
1644 struct radeon_device
*rdev
= dev
->dev_private
;
1646 if (ASIC_IS_DCE5(rdev
) &&
1647 (rdev
->clock
.default_dispclk
>= 53900) &&
1648 radeon_connector_encoder_is_hbr2(connector
)) {
1655 static enum drm_connector_status
1656 radeon_dp_detect(struct drm_connector
*connector
, bool force
)
1658 struct drm_device
*dev
= connector
->dev
;
1659 struct radeon_device
*rdev
= dev
->dev_private
;
1660 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
1661 enum drm_connector_status ret
= connector_status_disconnected
;
1662 struct radeon_connector_atom_dig
*radeon_dig_connector
= radeon_connector
->con_priv
;
1663 struct drm_encoder
*encoder
= radeon_best_single_encoder(connector
);
1666 if (radeon_dig_connector
->is_mst
)
1667 return connector_status_disconnected
;
1669 r
= pm_runtime_get_sync(connector
->dev
->dev
);
1671 return connector_status_disconnected
;
1673 if (!force
&& radeon_check_hpd_status_unchanged(connector
)) {
1674 ret
= connector
->status
;
1678 radeon_connector_free_edid(connector
);
1680 if ((connector
->connector_type
== DRM_MODE_CONNECTOR_eDP
) ||
1681 (connector
->connector_type
== DRM_MODE_CONNECTOR_LVDS
)) {
1683 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
1684 struct drm_display_mode
*native_mode
= &radeon_encoder
->native_mode
;
1686 /* check if panel is valid */
1687 if (native_mode
->hdisplay
>= 320 && native_mode
->vdisplay
>= 240)
1688 ret
= connector_status_connected
;
1689 /* don't fetch the edid from the vbios if ddc fails and runpm is
1690 * enabled so we report disconnected.
1692 if ((rdev
->flags
& RADEON_IS_PX
) && (radeon_runtime_pm
!= 0))
1693 ret
= connector_status_disconnected
;
1695 /* eDP is always DP */
1696 radeon_dig_connector
->dp_sink_type
= CONNECTOR_OBJECT_ID_DISPLAYPORT
;
1697 if (!radeon_dig_connector
->edp_on
)
1698 atombios_set_edp_panel_power(connector
,
1699 ATOM_TRANSMITTER_ACTION_POWER_ON
);
1700 if (radeon_dp_getdpcd(radeon_connector
))
1701 ret
= connector_status_connected
;
1702 if (!radeon_dig_connector
->edp_on
)
1703 atombios_set_edp_panel_power(connector
,
1704 ATOM_TRANSMITTER_ACTION_POWER_OFF
);
1705 } else if (radeon_connector_encoder_get_dp_bridge_encoder_id(connector
) !=
1706 ENCODER_OBJECT_ID_NONE
) {
1707 /* DP bridges are always DP */
1708 radeon_dig_connector
->dp_sink_type
= CONNECTOR_OBJECT_ID_DISPLAYPORT
;
1709 /* get the DPCD from the bridge */
1710 radeon_dp_getdpcd(radeon_connector
);
1713 /* setup ddc on the bridge */
1714 radeon_atom_ext_encoder_setup_ddc(encoder
);
1715 /* bridge chips are always aux */
1716 if (radeon_ddc_probe(radeon_connector
, true)) /* try DDC */
1717 ret
= connector_status_connected
;
1718 else if (radeon_connector
->dac_load_detect
) { /* try load detection */
1719 const struct drm_encoder_helper_funcs
*encoder_funcs
= encoder
->helper_private
;
1720 ret
= encoder_funcs
->detect(encoder
, connector
);
1724 radeon_dig_connector
->dp_sink_type
= radeon_dp_getsinktype(radeon_connector
);
1725 if (radeon_hpd_sense(rdev
, radeon_connector
->hpd
.hpd
)) {
1726 ret
= connector_status_connected
;
1727 if (radeon_dig_connector
->dp_sink_type
== CONNECTOR_OBJECT_ID_DISPLAYPORT
) {
1728 radeon_dp_getdpcd(radeon_connector
);
1729 r
= radeon_dp_mst_probe(radeon_connector
);
1731 ret
= connector_status_disconnected
;
1734 if (radeon_dig_connector
->dp_sink_type
== CONNECTOR_OBJECT_ID_DISPLAYPORT
) {
1735 if (radeon_dp_getdpcd(radeon_connector
)) {
1736 r
= radeon_dp_mst_probe(radeon_connector
);
1738 ret
= connector_status_disconnected
;
1740 ret
= connector_status_connected
;
1743 /* try non-aux ddc (DP to DVI/HDMI/etc. adapter) */
1744 if (radeon_ddc_probe(radeon_connector
, false))
1745 ret
= connector_status_connected
;
1750 radeon_connector_update_scratch_regs(connector
, ret
);
1752 if ((radeon_audio
!= 0) && encoder
) {
1753 radeon_connector_get_edid(connector
);
1754 radeon_audio_detect(connector
, encoder
, ret
);
1758 pm_runtime_mark_last_busy(connector
->dev
->dev
);
1759 pm_runtime_put_autosuspend(connector
->dev
->dev
);
1764 static int radeon_dp_mode_valid(struct drm_connector
*connector
,
1765 struct drm_display_mode
*mode
)
1767 struct drm_device
*dev
= connector
->dev
;
1768 struct radeon_device
*rdev
= dev
->dev_private
;
1769 struct radeon_connector
*radeon_connector
= to_radeon_connector(connector
);
1770 struct radeon_connector_atom_dig
*radeon_dig_connector
= radeon_connector
->con_priv
;
1772 /* XXX check mode bandwidth */
1774 if ((connector
->connector_type
== DRM_MODE_CONNECTOR_eDP
) ||
1775 (connector
->connector_type
== DRM_MODE_CONNECTOR_LVDS
)) {
1776 struct drm_encoder
*encoder
= radeon_best_single_encoder(connector
);
1778 if ((mode
->hdisplay
< 320) || (mode
->vdisplay
< 240))
1782 struct radeon_encoder
*radeon_encoder
= to_radeon_encoder(encoder
);
1783 struct drm_display_mode
*native_mode
= &radeon_encoder
->native_mode
;
1785 /* AVIVO hardware supports downscaling modes larger than the panel
1786 * to the panel size, but I'm not sure this is desirable.
1788 if ((mode
->hdisplay
> native_mode
->hdisplay
) ||
1789 (mode
->vdisplay
> native_mode
->vdisplay
))
1792 /* if scaling is disabled, block non-native modes */
1793 if (radeon_encoder
->rmx_type
== RMX_OFF
) {
1794 if ((mode
->hdisplay
!= native_mode
->hdisplay
) ||
1795 (mode
->vdisplay
!= native_mode
->vdisplay
))
1800 if ((radeon_dig_connector
->dp_sink_type
== CONNECTOR_OBJECT_ID_DISPLAYPORT
) ||
1801 (radeon_dig_connector
->dp_sink_type
== CONNECTOR_OBJECT_ID_eDP
)) {
1802 return radeon_dp_mode_valid_helper(connector
, mode
);
1804 if (ASIC_IS_DCE6(rdev
) && drm_detect_hdmi_monitor(radeon_connector_edid(connector
))) {
1805 /* HDMI 1.3+ supports max clock of 340 Mhz */
1806 if (mode
->clock
> 340000)
1807 return MODE_CLOCK_HIGH
;
1809 if (mode
->clock
> 165000)
1810 return MODE_CLOCK_HIGH
;
1818 static const struct drm_connector_helper_funcs radeon_dp_connector_helper_funcs
= {
1819 .get_modes
= radeon_dp_get_modes
,
1820 .mode_valid
= radeon_dp_mode_valid
,
1821 .best_encoder
= radeon_dvi_encoder
,
1824 static const struct drm_connector_funcs radeon_dp_connector_funcs
= {
1825 .dpms
= drm_helper_connector_dpms
,
1826 .detect
= radeon_dp_detect
,
1827 .fill_modes
= drm_helper_probe_single_connector_modes
,
1828 .set_property
= radeon_connector_set_property
,
1829 .destroy
= radeon_connector_destroy
,
1830 .force
= radeon_dvi_force
,
1833 static const struct drm_connector_funcs radeon_edp_connector_funcs
= {
1834 .dpms
= drm_helper_connector_dpms
,
1835 .detect
= radeon_dp_detect
,
1836 .fill_modes
= drm_helper_probe_single_connector_modes
,
1837 .set_property
= radeon_lvds_set_property
,
1838 .destroy
= radeon_connector_destroy
,
1839 .force
= radeon_dvi_force
,
1842 static const struct drm_connector_funcs radeon_lvds_bridge_connector_funcs
= {
1843 .dpms
= drm_helper_connector_dpms
,
1844 .detect
= radeon_dp_detect
,
1845 .fill_modes
= drm_helper_probe_single_connector_modes
,
1846 .set_property
= radeon_lvds_set_property
,
1847 .destroy
= radeon_connector_destroy
,
1848 .force
= radeon_dvi_force
,
1852 radeon_add_atom_connector(struct drm_device
*dev
,
1853 uint32_t connector_id
,
1854 uint32_t supported_device
,
1856 struct radeon_i2c_bus_rec
*i2c_bus
,
1857 uint32_t igp_lane_info
,
1858 uint16_t connector_object_id
,
1859 struct radeon_hpd
*hpd
,
1860 struct radeon_router
*router
)
1862 struct radeon_device
*rdev
= dev
->dev_private
;
1863 struct drm_connector
*connector
;
1864 struct radeon_connector
*radeon_connector
;
1865 struct radeon_connector_atom_dig
*radeon_dig_connector
;
1866 struct drm_encoder
*encoder
;
1867 struct radeon_encoder
*radeon_encoder
;
1868 uint32_t subpixel_order
= SubPixelNone
;
1869 bool shared_ddc
= false;
1870 bool is_dp_bridge
= false;
1871 bool has_aux
= false;
1873 if (connector_type
== DRM_MODE_CONNECTOR_Unknown
)
1876 /* if the user selected tv=0 don't try and add the connector */
1877 if (((connector_type
== DRM_MODE_CONNECTOR_SVIDEO
) ||
1878 (connector_type
== DRM_MODE_CONNECTOR_Composite
) ||
1879 (connector_type
== DRM_MODE_CONNECTOR_9PinDIN
)) &&
1883 /* see if we already added it */
1884 list_for_each_entry(connector
, &dev
->mode_config
.connector_list
, head
) {
1885 radeon_connector
= to_radeon_connector(connector
);
1886 if (radeon_connector
->connector_id
== connector_id
) {
1887 radeon_connector
->devices
|= supported_device
;
1890 if (radeon_connector
->ddc_bus
&& i2c_bus
->valid
) {
1891 if (radeon_connector
->ddc_bus
->rec
.i2c_id
== i2c_bus
->i2c_id
) {
1892 radeon_connector
->shared_ddc
= true;
1895 if (radeon_connector
->router_bus
&& router
->ddc_valid
&&
1896 (radeon_connector
->router
.router_id
== router
->router_id
)) {
1897 radeon_connector
->shared_ddc
= false;
1903 /* check if it's a dp bridge */
1904 list_for_each_entry(encoder
, &dev
->mode_config
.encoder_list
, head
) {
1905 radeon_encoder
= to_radeon_encoder(encoder
);
1906 if (radeon_encoder
->devices
& supported_device
) {
1907 switch (radeon_encoder
->encoder_id
) {
1908 case ENCODER_OBJECT_ID_TRAVIS
:
1909 case ENCODER_OBJECT_ID_NUTMEG
:
1910 is_dp_bridge
= true;
1918 radeon_connector
= kzalloc(sizeof(struct radeon_connector
), GFP_KERNEL
);
1919 if (!radeon_connector
)
1922 connector
= &radeon_connector
->base
;
1924 radeon_connector
->connector_id
= connector_id
;
1925 radeon_connector
->devices
= supported_device
;
1926 radeon_connector
->shared_ddc
= shared_ddc
;
1927 radeon_connector
->connector_object_id
= connector_object_id
;
1928 radeon_connector
->hpd
= *hpd
;
1930 radeon_connector
->router
= *router
;
1931 if (router
->ddc_valid
|| router
->cd_valid
) {
1932 radeon_connector
->router_bus
= radeon_i2c_lookup(rdev
, &router
->i2c_info
);
1933 if (!radeon_connector
->router_bus
)
1934 DRM_ERROR("Failed to assign router i2c bus! Check dmesg for i2c errors.\n");
1938 radeon_dig_connector
= kzalloc(sizeof(struct radeon_connector_atom_dig
), GFP_KERNEL
);
1939 if (!radeon_dig_connector
)
1941 radeon_dig_connector
->igp_lane_info
= igp_lane_info
;
1942 radeon_connector
->con_priv
= radeon_dig_connector
;
1943 if (i2c_bus
->valid
) {
1944 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
1945 if (radeon_connector
->ddc_bus
)
1948 DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
1950 switch (connector_type
) {
1951 case DRM_MODE_CONNECTOR_VGA
:
1952 case DRM_MODE_CONNECTOR_DVIA
:
1954 drm_connector_init(dev
, &radeon_connector
->base
,
1955 &radeon_dp_connector_funcs
, connector_type
);
1956 drm_connector_helper_add(&radeon_connector
->base
,
1957 &radeon_dp_connector_helper_funcs
);
1958 connector
->interlace_allowed
= true;
1959 connector
->doublescan_allowed
= true;
1960 radeon_connector
->dac_load_detect
= true;
1961 drm_object_attach_property(&radeon_connector
->base
.base
,
1962 rdev
->mode_info
.load_detect_property
,
1964 drm_object_attach_property(&radeon_connector
->base
.base
,
1965 dev
->mode_config
.scaling_mode_property
,
1966 DRM_MODE_SCALE_NONE
);
1967 if (ASIC_IS_DCE5(rdev
))
1968 drm_object_attach_property(&radeon_connector
->base
.base
,
1969 rdev
->mode_info
.output_csc_property
,
1970 RADEON_OUTPUT_CSC_BYPASS
);
1972 case DRM_MODE_CONNECTOR_DVII
:
1973 case DRM_MODE_CONNECTOR_DVID
:
1974 case DRM_MODE_CONNECTOR_HDMIA
:
1975 case DRM_MODE_CONNECTOR_HDMIB
:
1976 case DRM_MODE_CONNECTOR_DisplayPort
:
1977 drm_connector_init(dev
, &radeon_connector
->base
,
1978 &radeon_dp_connector_funcs
, connector_type
);
1979 drm_connector_helper_add(&radeon_connector
->base
,
1980 &radeon_dp_connector_helper_funcs
);
1981 drm_object_attach_property(&radeon_connector
->base
.base
,
1982 rdev
->mode_info
.underscan_property
,
1984 drm_object_attach_property(&radeon_connector
->base
.base
,
1985 rdev
->mode_info
.underscan_hborder_property
,
1987 drm_object_attach_property(&radeon_connector
->base
.base
,
1988 rdev
->mode_info
.underscan_vborder_property
,
1991 drm_object_attach_property(&radeon_connector
->base
.base
,
1992 dev
->mode_config
.scaling_mode_property
,
1993 DRM_MODE_SCALE_NONE
);
1995 drm_object_attach_property(&radeon_connector
->base
.base
,
1996 rdev
->mode_info
.dither_property
,
1997 RADEON_FMT_DITHER_DISABLE
);
1999 if (radeon_audio
!= 0)
2000 drm_object_attach_property(&radeon_connector
->base
.base
,
2001 rdev
->mode_info
.audio_property
,
2003 if (ASIC_IS_DCE5(rdev
))
2004 drm_object_attach_property(&radeon_connector
->base
.base
,
2005 rdev
->mode_info
.output_csc_property
,
2006 RADEON_OUTPUT_CSC_BYPASS
);
2008 subpixel_order
= SubPixelHorizontalRGB
;
2009 connector
->interlace_allowed
= true;
2010 if (connector_type
== DRM_MODE_CONNECTOR_HDMIB
)
2011 connector
->doublescan_allowed
= true;
2013 connector
->doublescan_allowed
= false;
2014 if (connector_type
== DRM_MODE_CONNECTOR_DVII
) {
2015 radeon_connector
->dac_load_detect
= true;
2016 drm_object_attach_property(&radeon_connector
->base
.base
,
2017 rdev
->mode_info
.load_detect_property
,
2021 case DRM_MODE_CONNECTOR_LVDS
:
2022 case DRM_MODE_CONNECTOR_eDP
:
2023 drm_connector_init(dev
, &radeon_connector
->base
,
2024 &radeon_lvds_bridge_connector_funcs
, connector_type
);
2025 drm_connector_helper_add(&radeon_connector
->base
,
2026 &radeon_dp_connector_helper_funcs
);
2027 drm_object_attach_property(&radeon_connector
->base
.base
,
2028 dev
->mode_config
.scaling_mode_property
,
2029 DRM_MODE_SCALE_FULLSCREEN
);
2030 subpixel_order
= SubPixelHorizontalRGB
;
2031 connector
->interlace_allowed
= false;
2032 connector
->doublescan_allowed
= false;
2036 switch (connector_type
) {
2037 case DRM_MODE_CONNECTOR_VGA
:
2038 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_vga_connector_funcs
, connector_type
);
2039 drm_connector_helper_add(&radeon_connector
->base
, &radeon_vga_connector_helper_funcs
);
2040 if (i2c_bus
->valid
) {
2041 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2042 if (!radeon_connector
->ddc_bus
)
2043 DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2045 radeon_connector
->dac_load_detect
= true;
2046 drm_object_attach_property(&radeon_connector
->base
.base
,
2047 rdev
->mode_info
.load_detect_property
,
2049 if (ASIC_IS_AVIVO(rdev
))
2050 drm_object_attach_property(&radeon_connector
->base
.base
,
2051 dev
->mode_config
.scaling_mode_property
,
2052 DRM_MODE_SCALE_NONE
);
2053 if (ASIC_IS_DCE5(rdev
))
2054 drm_object_attach_property(&radeon_connector
->base
.base
,
2055 rdev
->mode_info
.output_csc_property
,
2056 RADEON_OUTPUT_CSC_BYPASS
);
2057 /* no HPD on analog connectors */
2058 radeon_connector
->hpd
.hpd
= RADEON_HPD_NONE
;
2059 connector
->polled
= DRM_CONNECTOR_POLL_CONNECT
;
2060 connector
->interlace_allowed
= true;
2061 connector
->doublescan_allowed
= true;
2063 case DRM_MODE_CONNECTOR_DVIA
:
2064 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_vga_connector_funcs
, connector_type
);
2065 drm_connector_helper_add(&radeon_connector
->base
, &radeon_vga_connector_helper_funcs
);
2066 if (i2c_bus
->valid
) {
2067 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2068 if (!radeon_connector
->ddc_bus
)
2069 DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2071 radeon_connector
->dac_load_detect
= true;
2072 drm_object_attach_property(&radeon_connector
->base
.base
,
2073 rdev
->mode_info
.load_detect_property
,
2075 if (ASIC_IS_AVIVO(rdev
))
2076 drm_object_attach_property(&radeon_connector
->base
.base
,
2077 dev
->mode_config
.scaling_mode_property
,
2078 DRM_MODE_SCALE_NONE
);
2079 if (ASIC_IS_DCE5(rdev
))
2080 drm_object_attach_property(&radeon_connector
->base
.base
,
2081 rdev
->mode_info
.output_csc_property
,
2082 RADEON_OUTPUT_CSC_BYPASS
);
2083 /* no HPD on analog connectors */
2084 radeon_connector
->hpd
.hpd
= RADEON_HPD_NONE
;
2085 connector
->interlace_allowed
= true;
2086 connector
->doublescan_allowed
= true;
2088 case DRM_MODE_CONNECTOR_DVII
:
2089 case DRM_MODE_CONNECTOR_DVID
:
2090 radeon_dig_connector
= kzalloc(sizeof(struct radeon_connector_atom_dig
), GFP_KERNEL
);
2091 if (!radeon_dig_connector
)
2093 radeon_dig_connector
->igp_lane_info
= igp_lane_info
;
2094 radeon_connector
->con_priv
= radeon_dig_connector
;
2095 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_dvi_connector_funcs
, connector_type
);
2096 drm_connector_helper_add(&radeon_connector
->base
, &radeon_dvi_connector_helper_funcs
);
2097 if (i2c_bus
->valid
) {
2098 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2099 if (!radeon_connector
->ddc_bus
)
2100 DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2102 subpixel_order
= SubPixelHorizontalRGB
;
2103 drm_object_attach_property(&radeon_connector
->base
.base
,
2104 rdev
->mode_info
.coherent_mode_property
,
2106 if (ASIC_IS_AVIVO(rdev
)) {
2107 drm_object_attach_property(&radeon_connector
->base
.base
,
2108 rdev
->mode_info
.underscan_property
,
2110 drm_object_attach_property(&radeon_connector
->base
.base
,
2111 rdev
->mode_info
.underscan_hborder_property
,
2113 drm_object_attach_property(&radeon_connector
->base
.base
,
2114 rdev
->mode_info
.underscan_vborder_property
,
2116 drm_object_attach_property(&radeon_connector
->base
.base
,
2117 rdev
->mode_info
.dither_property
,
2118 RADEON_FMT_DITHER_DISABLE
);
2119 drm_object_attach_property(&radeon_connector
->base
.base
,
2120 dev
->mode_config
.scaling_mode_property
,
2121 DRM_MODE_SCALE_NONE
);
2123 if (ASIC_IS_DCE2(rdev
) && (radeon_audio
!= 0)) {
2124 drm_object_attach_property(&radeon_connector
->base
.base
,
2125 rdev
->mode_info
.audio_property
,
2128 if (connector_type
== DRM_MODE_CONNECTOR_DVII
) {
2129 radeon_connector
->dac_load_detect
= true;
2130 drm_object_attach_property(&radeon_connector
->base
.base
,
2131 rdev
->mode_info
.load_detect_property
,
2134 if (ASIC_IS_DCE5(rdev
))
2135 drm_object_attach_property(&radeon_connector
->base
.base
,
2136 rdev
->mode_info
.output_csc_property
,
2137 RADEON_OUTPUT_CSC_BYPASS
);
2138 connector
->interlace_allowed
= true;
2139 if (connector_type
== DRM_MODE_CONNECTOR_DVII
)
2140 connector
->doublescan_allowed
= true;
2142 connector
->doublescan_allowed
= false;
2144 case DRM_MODE_CONNECTOR_HDMIA
:
2145 case DRM_MODE_CONNECTOR_HDMIB
:
2146 radeon_dig_connector
= kzalloc(sizeof(struct radeon_connector_atom_dig
), GFP_KERNEL
);
2147 if (!radeon_dig_connector
)
2149 radeon_dig_connector
->igp_lane_info
= igp_lane_info
;
2150 radeon_connector
->con_priv
= radeon_dig_connector
;
2151 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_dvi_connector_funcs
, connector_type
);
2152 drm_connector_helper_add(&radeon_connector
->base
, &radeon_dvi_connector_helper_funcs
);
2153 if (i2c_bus
->valid
) {
2154 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2155 if (!radeon_connector
->ddc_bus
)
2156 DRM_ERROR("HDMI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2158 drm_object_attach_property(&radeon_connector
->base
.base
,
2159 rdev
->mode_info
.coherent_mode_property
,
2161 if (ASIC_IS_AVIVO(rdev
)) {
2162 drm_object_attach_property(&radeon_connector
->base
.base
,
2163 rdev
->mode_info
.underscan_property
,
2165 drm_object_attach_property(&radeon_connector
->base
.base
,
2166 rdev
->mode_info
.underscan_hborder_property
,
2168 drm_object_attach_property(&radeon_connector
->base
.base
,
2169 rdev
->mode_info
.underscan_vborder_property
,
2171 drm_object_attach_property(&radeon_connector
->base
.base
,
2172 rdev
->mode_info
.dither_property
,
2173 RADEON_FMT_DITHER_DISABLE
);
2174 drm_object_attach_property(&radeon_connector
->base
.base
,
2175 dev
->mode_config
.scaling_mode_property
,
2176 DRM_MODE_SCALE_NONE
);
2178 if (ASIC_IS_DCE2(rdev
) && (radeon_audio
!= 0)) {
2179 drm_object_attach_property(&radeon_connector
->base
.base
,
2180 rdev
->mode_info
.audio_property
,
2183 if (ASIC_IS_DCE5(rdev
))
2184 drm_object_attach_property(&radeon_connector
->base
.base
,
2185 rdev
->mode_info
.output_csc_property
,
2186 RADEON_OUTPUT_CSC_BYPASS
);
2187 subpixel_order
= SubPixelHorizontalRGB
;
2188 connector
->interlace_allowed
= true;
2189 if (connector_type
== DRM_MODE_CONNECTOR_HDMIB
)
2190 connector
->doublescan_allowed
= true;
2192 connector
->doublescan_allowed
= false;
2194 case DRM_MODE_CONNECTOR_DisplayPort
:
2195 radeon_dig_connector
= kzalloc(sizeof(struct radeon_connector_atom_dig
), GFP_KERNEL
);
2196 if (!radeon_dig_connector
)
2198 radeon_dig_connector
->igp_lane_info
= igp_lane_info
;
2199 radeon_connector
->con_priv
= radeon_dig_connector
;
2200 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_dp_connector_funcs
, connector_type
);
2201 drm_connector_helper_add(&radeon_connector
->base
, &radeon_dp_connector_helper_funcs
);
2202 if (i2c_bus
->valid
) {
2203 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2204 if (radeon_connector
->ddc_bus
)
2207 DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2209 subpixel_order
= SubPixelHorizontalRGB
;
2210 drm_object_attach_property(&radeon_connector
->base
.base
,
2211 rdev
->mode_info
.coherent_mode_property
,
2213 if (ASIC_IS_AVIVO(rdev
)) {
2214 drm_object_attach_property(&radeon_connector
->base
.base
,
2215 rdev
->mode_info
.underscan_property
,
2217 drm_object_attach_property(&radeon_connector
->base
.base
,
2218 rdev
->mode_info
.underscan_hborder_property
,
2220 drm_object_attach_property(&radeon_connector
->base
.base
,
2221 rdev
->mode_info
.underscan_vborder_property
,
2223 drm_object_attach_property(&radeon_connector
->base
.base
,
2224 rdev
->mode_info
.dither_property
,
2225 RADEON_FMT_DITHER_DISABLE
);
2226 drm_object_attach_property(&radeon_connector
->base
.base
,
2227 dev
->mode_config
.scaling_mode_property
,
2228 DRM_MODE_SCALE_NONE
);
2230 if (ASIC_IS_DCE2(rdev
) && (radeon_audio
!= 0)) {
2231 drm_object_attach_property(&radeon_connector
->base
.base
,
2232 rdev
->mode_info
.audio_property
,
2235 if (ASIC_IS_DCE5(rdev
))
2236 drm_object_attach_property(&radeon_connector
->base
.base
,
2237 rdev
->mode_info
.output_csc_property
,
2238 RADEON_OUTPUT_CSC_BYPASS
);
2239 connector
->interlace_allowed
= true;
2240 /* in theory with a DP to VGA converter... */
2241 connector
->doublescan_allowed
= false;
2243 case DRM_MODE_CONNECTOR_eDP
:
2244 radeon_dig_connector
= kzalloc(sizeof(struct radeon_connector_atom_dig
), GFP_KERNEL
);
2245 if (!radeon_dig_connector
)
2247 radeon_dig_connector
->igp_lane_info
= igp_lane_info
;
2248 radeon_connector
->con_priv
= radeon_dig_connector
;
2249 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_edp_connector_funcs
, connector_type
);
2250 drm_connector_helper_add(&radeon_connector
->base
, &radeon_dp_connector_helper_funcs
);
2251 if (i2c_bus
->valid
) {
2252 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2253 if (radeon_connector
->ddc_bus
)
2256 DRM_ERROR("DP: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2258 drm_object_attach_property(&radeon_connector
->base
.base
,
2259 dev
->mode_config
.scaling_mode_property
,
2260 DRM_MODE_SCALE_FULLSCREEN
);
2261 subpixel_order
= SubPixelHorizontalRGB
;
2262 connector
->interlace_allowed
= false;
2263 connector
->doublescan_allowed
= false;
2265 case DRM_MODE_CONNECTOR_SVIDEO
:
2266 case DRM_MODE_CONNECTOR_Composite
:
2267 case DRM_MODE_CONNECTOR_9PinDIN
:
2268 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_tv_connector_funcs
, connector_type
);
2269 drm_connector_helper_add(&radeon_connector
->base
, &radeon_tv_connector_helper_funcs
);
2270 radeon_connector
->dac_load_detect
= true;
2271 drm_object_attach_property(&radeon_connector
->base
.base
,
2272 rdev
->mode_info
.load_detect_property
,
2274 drm_object_attach_property(&radeon_connector
->base
.base
,
2275 rdev
->mode_info
.tv_std_property
,
2276 radeon_atombios_get_tv_info(rdev
));
2277 /* no HPD on analog connectors */
2278 radeon_connector
->hpd
.hpd
= RADEON_HPD_NONE
;
2279 connector
->interlace_allowed
= false;
2280 connector
->doublescan_allowed
= false;
2282 case DRM_MODE_CONNECTOR_LVDS
:
2283 radeon_dig_connector
= kzalloc(sizeof(struct radeon_connector_atom_dig
), GFP_KERNEL
);
2284 if (!radeon_dig_connector
)
2286 radeon_dig_connector
->igp_lane_info
= igp_lane_info
;
2287 radeon_connector
->con_priv
= radeon_dig_connector
;
2288 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_lvds_connector_funcs
, connector_type
);
2289 drm_connector_helper_add(&radeon_connector
->base
, &radeon_lvds_connector_helper_funcs
);
2290 if (i2c_bus
->valid
) {
2291 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2292 if (!radeon_connector
->ddc_bus
)
2293 DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2295 drm_object_attach_property(&radeon_connector
->base
.base
,
2296 dev
->mode_config
.scaling_mode_property
,
2297 DRM_MODE_SCALE_FULLSCREEN
);
2298 subpixel_order
= SubPixelHorizontalRGB
;
2299 connector
->interlace_allowed
= false;
2300 connector
->doublescan_allowed
= false;
2305 if (radeon_connector
->hpd
.hpd
== RADEON_HPD_NONE
) {
2307 connector
->polled
= DRM_CONNECTOR_POLL_CONNECT
;
2309 connector
->polled
= DRM_CONNECTOR_POLL_HPD
;
2311 connector
->display_info
.subpixel_order
= subpixel_order
;
2312 drm_connector_register(connector
);
2315 radeon_dp_aux_init(radeon_connector
);
2320 drm_connector_cleanup(connector
);
2325 radeon_add_legacy_connector(struct drm_device
*dev
,
2326 uint32_t connector_id
,
2327 uint32_t supported_device
,
2329 struct radeon_i2c_bus_rec
*i2c_bus
,
2330 uint16_t connector_object_id
,
2331 struct radeon_hpd
*hpd
)
2333 struct radeon_device
*rdev
= dev
->dev_private
;
2334 struct drm_connector
*connector
;
2335 struct radeon_connector
*radeon_connector
;
2336 uint32_t subpixel_order
= SubPixelNone
;
2338 if (connector_type
== DRM_MODE_CONNECTOR_Unknown
)
2341 /* if the user selected tv=0 don't try and add the connector */
2342 if (((connector_type
== DRM_MODE_CONNECTOR_SVIDEO
) ||
2343 (connector_type
== DRM_MODE_CONNECTOR_Composite
) ||
2344 (connector_type
== DRM_MODE_CONNECTOR_9PinDIN
)) &&
2348 /* see if we already added it */
2349 list_for_each_entry(connector
, &dev
->mode_config
.connector_list
, head
) {
2350 radeon_connector
= to_radeon_connector(connector
);
2351 if (radeon_connector
->connector_id
== connector_id
) {
2352 radeon_connector
->devices
|= supported_device
;
2357 radeon_connector
= kzalloc(sizeof(struct radeon_connector
), GFP_KERNEL
);
2358 if (!radeon_connector
)
2361 connector
= &radeon_connector
->base
;
2363 radeon_connector
->connector_id
= connector_id
;
2364 radeon_connector
->devices
= supported_device
;
2365 radeon_connector
->connector_object_id
= connector_object_id
;
2366 radeon_connector
->hpd
= *hpd
;
2368 switch (connector_type
) {
2369 case DRM_MODE_CONNECTOR_VGA
:
2370 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_vga_connector_funcs
, connector_type
);
2371 drm_connector_helper_add(&radeon_connector
->base
, &radeon_vga_connector_helper_funcs
);
2372 if (i2c_bus
->valid
) {
2373 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2374 if (!radeon_connector
->ddc_bus
)
2375 DRM_ERROR("VGA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2377 radeon_connector
->dac_load_detect
= true;
2378 drm_object_attach_property(&radeon_connector
->base
.base
,
2379 rdev
->mode_info
.load_detect_property
,
2381 /* no HPD on analog connectors */
2382 radeon_connector
->hpd
.hpd
= RADEON_HPD_NONE
;
2383 connector
->polled
= DRM_CONNECTOR_POLL_CONNECT
;
2384 connector
->interlace_allowed
= true;
2385 connector
->doublescan_allowed
= true;
2387 case DRM_MODE_CONNECTOR_DVIA
:
2388 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_vga_connector_funcs
, connector_type
);
2389 drm_connector_helper_add(&radeon_connector
->base
, &radeon_vga_connector_helper_funcs
);
2390 if (i2c_bus
->valid
) {
2391 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2392 if (!radeon_connector
->ddc_bus
)
2393 DRM_ERROR("DVIA: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2395 radeon_connector
->dac_load_detect
= true;
2396 drm_object_attach_property(&radeon_connector
->base
.base
,
2397 rdev
->mode_info
.load_detect_property
,
2399 /* no HPD on analog connectors */
2400 radeon_connector
->hpd
.hpd
= RADEON_HPD_NONE
;
2401 connector
->interlace_allowed
= true;
2402 connector
->doublescan_allowed
= true;
2404 case DRM_MODE_CONNECTOR_DVII
:
2405 case DRM_MODE_CONNECTOR_DVID
:
2406 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_dvi_connector_funcs
, connector_type
);
2407 drm_connector_helper_add(&radeon_connector
->base
, &radeon_dvi_connector_helper_funcs
);
2408 if (i2c_bus
->valid
) {
2409 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2410 if (!radeon_connector
->ddc_bus
)
2411 DRM_ERROR("DVI: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2413 if (connector_type
== DRM_MODE_CONNECTOR_DVII
) {
2414 radeon_connector
->dac_load_detect
= true;
2415 drm_object_attach_property(&radeon_connector
->base
.base
,
2416 rdev
->mode_info
.load_detect_property
,
2419 subpixel_order
= SubPixelHorizontalRGB
;
2420 connector
->interlace_allowed
= true;
2421 if (connector_type
== DRM_MODE_CONNECTOR_DVII
)
2422 connector
->doublescan_allowed
= true;
2424 connector
->doublescan_allowed
= false;
2426 case DRM_MODE_CONNECTOR_SVIDEO
:
2427 case DRM_MODE_CONNECTOR_Composite
:
2428 case DRM_MODE_CONNECTOR_9PinDIN
:
2429 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_tv_connector_funcs
, connector_type
);
2430 drm_connector_helper_add(&radeon_connector
->base
, &radeon_tv_connector_helper_funcs
);
2431 radeon_connector
->dac_load_detect
= true;
2432 /* RS400,RC410,RS480 chipset seems to report a lot
2433 * of false positive on load detect, we haven't yet
2434 * found a way to make load detect reliable on those
2435 * chipset, thus just disable it for TV.
2437 if (rdev
->family
== CHIP_RS400
|| rdev
->family
== CHIP_RS480
)
2438 radeon_connector
->dac_load_detect
= false;
2439 drm_object_attach_property(&radeon_connector
->base
.base
,
2440 rdev
->mode_info
.load_detect_property
,
2441 radeon_connector
->dac_load_detect
);
2442 drm_object_attach_property(&radeon_connector
->base
.base
,
2443 rdev
->mode_info
.tv_std_property
,
2444 radeon_combios_get_tv_info(rdev
));
2445 /* no HPD on analog connectors */
2446 radeon_connector
->hpd
.hpd
= RADEON_HPD_NONE
;
2447 connector
->interlace_allowed
= false;
2448 connector
->doublescan_allowed
= false;
2450 case DRM_MODE_CONNECTOR_LVDS
:
2451 drm_connector_init(dev
, &radeon_connector
->base
, &radeon_lvds_connector_funcs
, connector_type
);
2452 drm_connector_helper_add(&radeon_connector
->base
, &radeon_lvds_connector_helper_funcs
);
2453 if (i2c_bus
->valid
) {
2454 radeon_connector
->ddc_bus
= radeon_i2c_lookup(rdev
, i2c_bus
);
2455 if (!radeon_connector
->ddc_bus
)
2456 DRM_ERROR("LVDS: Failed to assign ddc bus! Check dmesg for i2c errors.\n");
2458 drm_object_attach_property(&radeon_connector
->base
.base
,
2459 dev
->mode_config
.scaling_mode_property
,
2460 DRM_MODE_SCALE_FULLSCREEN
);
2461 subpixel_order
= SubPixelHorizontalRGB
;
2462 connector
->interlace_allowed
= false;
2463 connector
->doublescan_allowed
= false;
2467 if (radeon_connector
->hpd
.hpd
== RADEON_HPD_NONE
) {
2469 connector
->polled
= DRM_CONNECTOR_POLL_CONNECT
;
2471 connector
->polled
= DRM_CONNECTOR_POLL_HPD
;
2472 connector
->display_info
.subpixel_order
= subpixel_order
;
2473 drm_connector_register(connector
);
2476 void radeon_setup_mst_connector(struct drm_device
*dev
)
2478 struct radeon_device
*rdev
= dev
->dev_private
;
2479 struct drm_connector
*connector
;
2480 struct radeon_connector
*radeon_connector
;
2482 if (!ASIC_IS_DCE5(rdev
))
2485 if (radeon_mst
== 0)
2488 list_for_each_entry(connector
, &dev
->mode_config
.connector_list
, head
) {
2491 radeon_connector
= to_radeon_connector(connector
);
2493 if (connector
->connector_type
!= DRM_MODE_CONNECTOR_DisplayPort
)
2496 ret
= radeon_dp_mst_init(radeon_connector
);