2 * Copyright (C) 2008 Maarten Maathuis.
5 * Permission is hereby granted, free of charge, to any person obtaining
6 * a copy of this software and associated documentation files (the
7 * "Software"), to deal in the Software without restriction, including
8 * without limitation the rights to use, copy, modify, merge, publish,
9 * distribute, sublicense, and/or sell copies of the Software, and to
10 * permit persons to whom the Software is furnished to do so, subject to
11 * the following conditions:
13 * The above copyright notice and this permission notice (including the
14 * next paragraph) shall be included in all copies or substantial
15 * portions of the Software.
17 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
18 * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
19 * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
20 * IN NO EVENT SHALL THE COPYRIGHT OWNER(S) AND/OR ITS SUPPLIERS BE
21 * LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
22 * OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
23 * WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
27 #include <acpi/button.h>
31 #include "drm_crtc_helper.h"
33 #include "nouveau_reg.h"
34 #include "nouveau_drv.h"
35 #include "nouveau_encoder.h"
36 #include "nouveau_crtc.h"
37 #include "nouveau_connector.h"
38 #include "nouveau_hw.h"
40 static inline struct drm_encoder_slave_funcs *
41 get_slave_funcs(struct nouveau_encoder *enc)
43 return to_encoder_slave(to_drm_encoder(enc))->slave_funcs;
46 static struct nouveau_encoder *
47 find_encoder_by_type(struct drm_connector *connector, int type)
49 struct drm_device *dev = connector->dev;
50 struct nouveau_encoder *nv_encoder;
51 struct drm_mode_object *obj;
54 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
55 id = connector->encoder_ids[i];
59 obj = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER);
62 nv_encoder = nouveau_encoder(obj_to_encoder(obj));
64 if (type == OUTPUT_ANY || nv_encoder->dcb->type == type)
71 struct nouveau_connector *
72 nouveau_encoder_connector_get(struct nouveau_encoder *encoder)
74 struct drm_device *dev = to_drm_encoder(encoder)->dev;
75 struct drm_connector *drm_connector;
77 list_for_each_entry(drm_connector, &dev->mode_config.connector_list, head) {
78 if (drm_connector->encoder == to_drm_encoder(encoder))
79 return nouveau_connector(drm_connector);
87 nouveau_connector_destroy(struct drm_connector *drm_connector)
89 struct nouveau_connector *nv_connector =
90 nouveau_connector(drm_connector);
91 struct drm_device *dev;
96 dev = nv_connector->base.dev;
97 NV_DEBUG_KMS(dev, "\n");
99 kfree(nv_connector->edid);
100 drm_sysfs_connector_remove(drm_connector);
101 drm_connector_cleanup(drm_connector);
102 kfree(drm_connector);
106 nouveau_connector_ddc_prepare(struct drm_connector *connector, int *flags)
108 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
110 if (dev_priv->card_type >= NV_50)
114 if (NVLockVgaCrtcs(dev_priv->dev, false))
116 if (nv_heads_tied(dev_priv->dev))
120 NVSetOwner(dev_priv->dev, 0); /* necessary? */
124 nouveau_connector_ddc_finish(struct drm_connector *connector, int flags)
126 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
128 if (dev_priv->card_type >= NV_50)
132 NVSetOwner(dev_priv->dev, 4);
134 NVLockVgaCrtcs(dev_priv->dev, true);
137 static struct nouveau_i2c_chan *
138 nouveau_connector_ddc_detect(struct drm_connector *connector,
139 struct nouveau_encoder **pnv_encoder)
141 struct drm_device *dev = connector->dev;
142 uint8_t out_buf[] = { 0x0, 0x0}, buf[2];
145 struct i2c_msg msgs[] = {
160 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
161 struct nouveau_i2c_chan *i2c = NULL;
162 struct nouveau_encoder *nv_encoder;
163 struct drm_mode_object *obj;
166 id = connector->encoder_ids[i];
170 obj = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER);
173 nv_encoder = nouveau_encoder(obj_to_encoder(obj));
175 if (nv_encoder->dcb->i2c_index < 0xf)
176 i2c = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);
180 nouveau_connector_ddc_prepare(connector, &flags);
181 ret = i2c_transfer(&i2c->adapter, msgs, 2);
182 nouveau_connector_ddc_finish(connector, flags);
185 *pnv_encoder = nv_encoder;
194 nouveau_connector_set_encoder(struct drm_connector *connector,
195 struct nouveau_encoder *nv_encoder)
197 struct nouveau_connector *nv_connector = nouveau_connector(connector);
198 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
199 struct drm_device *dev = connector->dev;
201 if (nv_connector->detected_encoder == nv_encoder)
203 nv_connector->detected_encoder = nv_encoder;
205 if (nv_encoder->dcb->type == OUTPUT_LVDS ||
206 nv_encoder->dcb->type == OUTPUT_TMDS) {
207 connector->doublescan_allowed = false;
208 connector->interlace_allowed = false;
210 connector->doublescan_allowed = true;
211 if (dev_priv->card_type == NV_20 ||
212 (dev_priv->card_type == NV_10 &&
213 (dev->pci_device & 0x0ff0) != 0x0100 &&
214 (dev->pci_device & 0x0ff0) != 0x0150))
216 connector->interlace_allowed = false;
218 connector->interlace_allowed = true;
221 if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
222 drm_connector_property_set_value(connector,
223 dev->mode_config.dvi_i_subconnector_property,
224 nv_encoder->dcb->type == OUTPUT_TMDS ?
225 DRM_MODE_SUBCONNECTOR_DVID :
226 DRM_MODE_SUBCONNECTOR_DVIA);
230 static enum drm_connector_status
231 nouveau_connector_detect(struct drm_connector *connector)
233 struct drm_device *dev = connector->dev;
234 struct nouveau_connector *nv_connector = nouveau_connector(connector);
235 struct nouveau_encoder *nv_encoder = NULL;
236 struct nouveau_i2c_chan *i2c;
239 if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS)
240 nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS);
241 if (nv_encoder && nv_connector->native_mode) {
242 unsigned status = connector_status_connected;
244 #if defined(CONFIG_ACPI_BUTTON) || \
245 (defined(CONFIG_ACPI_BUTTON_MODULE) && defined(MODULE))
246 if (!nouveau_ignorelid && !acpi_lid_open())
247 status = connector_status_unknown;
249 nouveau_connector_set_encoder(connector, nv_encoder);
253 /* Cleanup the previous EDID block. */
254 if (nv_connector->edid) {
255 drm_mode_connector_update_edid_property(connector, NULL);
256 kfree(nv_connector->edid);
257 nv_connector->edid = NULL;
260 i2c = nouveau_connector_ddc_detect(connector, &nv_encoder);
262 nouveau_connector_ddc_prepare(connector, &flags);
263 nv_connector->edid = drm_get_edid(connector, &i2c->adapter);
264 nouveau_connector_ddc_finish(connector, flags);
265 drm_mode_connector_update_edid_property(connector,
267 if (!nv_connector->edid) {
268 NV_ERROR(dev, "DDC responded, but no EDID for %s\n",
269 drm_get_connector_name(connector));
273 if (nv_encoder->dcb->type == OUTPUT_DP &&
274 !nouveau_dp_detect(to_drm_encoder(nv_encoder))) {
275 NV_ERROR(dev, "Detected %s, but failed init\n",
276 drm_get_connector_name(connector));
277 return connector_status_disconnected;
280 /* Override encoder type for DVI-I based on whether EDID
281 * says the display is digital or analog, both use the
282 * same i2c channel so the value returned from ddc_detect
283 * isn't necessarily correct.
285 if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
286 if (nv_connector->edid->input & DRM_EDID_INPUT_DIGITAL)
289 type = OUTPUT_ANALOG;
291 nv_encoder = find_encoder_by_type(connector, type);
293 NV_ERROR(dev, "Detected %d encoder on %s, "
294 "but no object!\n", type,
295 drm_get_connector_name(connector));
296 return connector_status_disconnected;
300 nouveau_connector_set_encoder(connector, nv_encoder);
301 return connector_status_connected;
305 nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG);
306 if (!nv_encoder && !nouveau_tv_disable)
307 nv_encoder = find_encoder_by_type(connector, OUTPUT_TV);
309 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
310 struct drm_encoder_helper_funcs *helper =
311 encoder->helper_private;
313 if (helper->detect(encoder, connector) ==
314 connector_status_connected) {
315 nouveau_connector_set_encoder(connector, nv_encoder);
316 return connector_status_connected;
321 return connector_status_disconnected;
325 nouveau_connector_force(struct drm_connector *connector)
327 struct nouveau_connector *nv_connector = nouveau_connector(connector);
328 struct nouveau_encoder *nv_encoder;
331 if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
332 if (connector->force == DRM_FORCE_ON_DIGITAL)
335 type = OUTPUT_ANALOG;
339 nv_encoder = find_encoder_by_type(connector, type);
341 NV_ERROR(connector->dev, "can't find encoder to force %s on!\n",
342 drm_get_connector_name(connector));
343 connector->status = connector_status_disconnected;
347 nouveau_connector_set_encoder(connector, nv_encoder);
351 nouveau_connector_set_property(struct drm_connector *connector,
352 struct drm_property *property, uint64_t value)
354 struct nouveau_connector *nv_connector = nouveau_connector(connector);
355 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
356 struct drm_device *dev = connector->dev;
360 if (property == dev->mode_config.scaling_mode_property) {
361 struct nouveau_crtc *nv_crtc = NULL;
362 bool modeset = false;
365 case DRM_MODE_SCALE_NONE:
366 case DRM_MODE_SCALE_FULLSCREEN:
367 case DRM_MODE_SCALE_CENTER:
368 case DRM_MODE_SCALE_ASPECT:
374 /* LVDS always needs gpu scaling */
375 if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS &&
376 value == DRM_MODE_SCALE_NONE)
379 /* Changing between GPU and panel scaling requires a full
382 if ((nv_connector->scaling_mode == DRM_MODE_SCALE_NONE) ||
383 (value == DRM_MODE_SCALE_NONE))
385 nv_connector->scaling_mode = value;
387 if (connector->encoder && connector->encoder->crtc)
388 nv_crtc = nouveau_crtc(connector->encoder->crtc);
392 if (modeset || !nv_crtc->set_scale) {
393 ret = drm_crtc_helper_set_mode(&nv_crtc->base,
396 nv_crtc->base.y, NULL);
400 ret = nv_crtc->set_scale(nv_crtc, value, true);
409 if (property == dev->mode_config.dithering_mode_property) {
410 struct nouveau_crtc *nv_crtc = NULL;
412 if (value == DRM_MODE_DITHERING_ON)
413 nv_connector->use_dithering = true;
415 nv_connector->use_dithering = false;
417 if (connector->encoder && connector->encoder->crtc)
418 nv_crtc = nouveau_crtc(connector->encoder->crtc);
420 if (!nv_crtc || !nv_crtc->set_dither)
423 return nv_crtc->set_dither(nv_crtc, nv_connector->use_dithering,
427 if (nv_encoder && nv_encoder->dcb->type == OUTPUT_TV)
428 return get_slave_funcs(nv_encoder)->
429 set_property(to_drm_encoder(nv_encoder), connector, property, value);
434 static struct drm_display_mode *
435 nouveau_connector_native_mode(struct drm_connector *connector)
437 struct drm_connector_helper_funcs *helper = connector->helper_private;
438 struct nouveau_connector *nv_connector = nouveau_connector(connector);
439 struct drm_device *dev = connector->dev;
440 struct drm_display_mode *mode, *largest = NULL;
441 int high_w = 0, high_h = 0, high_v = 0;
443 list_for_each_entry(mode, &nv_connector->base.probed_modes, head) {
444 if (helper->mode_valid(connector, mode) != MODE_OK)
447 /* Use preferred mode if there is one.. */
448 if (mode->type & DRM_MODE_TYPE_PREFERRED) {
449 NV_DEBUG_KMS(dev, "native mode from preferred\n");
450 return drm_mode_duplicate(dev, mode);
453 /* Otherwise, take the resolution with the largest width, then
454 * height, then vertical refresh
456 if (mode->hdisplay < high_w)
459 if (mode->hdisplay == high_w && mode->vdisplay < high_h)
462 if (mode->hdisplay == high_w && mode->vdisplay == high_h &&
463 mode->vrefresh < high_v)
466 high_w = mode->hdisplay;
467 high_h = mode->vdisplay;
468 high_v = mode->vrefresh;
472 NV_DEBUG_KMS(dev, "native mode from largest: %dx%d@%d\n",
473 high_w, high_h, high_v);
474 return largest ? drm_mode_duplicate(dev, largest) : NULL;
482 static struct moderec scaler_modes[] = {
501 nouveau_connector_scaler_modes_add(struct drm_connector *connector)
503 struct nouveau_connector *nv_connector = nouveau_connector(connector);
504 struct drm_display_mode *native = nv_connector->native_mode, *m;
505 struct drm_device *dev = connector->dev;
506 struct moderec *mode = &scaler_modes[0];
512 while (mode->hdisplay) {
513 if (mode->hdisplay <= native->hdisplay &&
514 mode->vdisplay <= native->vdisplay) {
515 m = drm_cvt_mode(dev, mode->hdisplay, mode->vdisplay,
516 drm_mode_vrefresh(native), false,
521 m->type |= DRM_MODE_TYPE_DRIVER;
523 drm_mode_probed_add(connector, m);
534 nouveau_connector_get_modes(struct drm_connector *connector)
536 struct drm_device *dev = connector->dev;
537 struct nouveau_connector *nv_connector = nouveau_connector(connector);
538 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
541 /* If we're not LVDS, destroy the previous native mode, the attached
542 * monitor could have changed.
544 if (nv_connector->dcb->type != DCB_CONNECTOR_LVDS &&
545 nv_connector->native_mode) {
546 drm_mode_destroy(dev, nv_connector->native_mode);
547 nv_connector->native_mode = NULL;
550 if (nv_connector->edid)
551 ret = drm_add_edid_modes(connector, nv_connector->edid);
553 /* Find the native mode if this is a digital panel, if we didn't
554 * find any modes through DDC previously add the native mode to
557 if (!nv_connector->native_mode)
558 nv_connector->native_mode =
559 nouveau_connector_native_mode(connector);
560 if (ret == 0 && nv_connector->native_mode) {
561 struct drm_display_mode *mode;
563 mode = drm_mode_duplicate(dev, nv_connector->native_mode);
564 drm_mode_probed_add(connector, mode);
568 if (nv_encoder->dcb->type == OUTPUT_TV)
569 ret = get_slave_funcs(nv_encoder)->
570 get_modes(to_drm_encoder(nv_encoder), connector);
572 if (nv_encoder->dcb->type == OUTPUT_LVDS)
573 ret += nouveau_connector_scaler_modes_add(connector);
579 nouveau_connector_mode_valid(struct drm_connector *connector,
580 struct drm_display_mode *mode)
582 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
583 struct nouveau_connector *nv_connector = nouveau_connector(connector);
584 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
585 unsigned min_clock = 25000, max_clock = min_clock;
586 unsigned clock = mode->clock;
588 switch (nv_encoder->dcb->type) {
590 if (nv_connector->native_mode &&
591 (mode->hdisplay > nv_connector->native_mode->hdisplay ||
592 mode->vdisplay > nv_connector->native_mode->vdisplay))
599 if ((dev_priv->card_type >= NV_50 && !nouveau_duallink) ||
600 !nv_encoder->dcb->duallink_possible)
606 max_clock = nv_encoder->dcb->crtconf.maxfreq;
611 return get_slave_funcs(nv_encoder)->
612 mode_valid(to_drm_encoder(nv_encoder), mode);
614 if (nv_encoder->dp.link_bw == DP_LINK_BW_2_7)
615 max_clock = nv_encoder->dp.link_nr * 270000;
617 max_clock = nv_encoder->dp.link_nr * 162000;
626 if (clock < min_clock)
627 return MODE_CLOCK_LOW;
629 if (clock > max_clock)
630 return MODE_CLOCK_HIGH;
635 static struct drm_encoder *
636 nouveau_connector_best_encoder(struct drm_connector *connector)
638 struct nouveau_connector *nv_connector = nouveau_connector(connector);
640 if (nv_connector->detected_encoder)
641 return to_drm_encoder(nv_connector->detected_encoder);
646 static const struct drm_connector_helper_funcs
647 nouveau_connector_helper_funcs = {
648 .get_modes = nouveau_connector_get_modes,
649 .mode_valid = nouveau_connector_mode_valid,
650 .best_encoder = nouveau_connector_best_encoder,
653 static const struct drm_connector_funcs
654 nouveau_connector_funcs = {
655 .dpms = drm_helper_connector_dpms,
658 .detect = nouveau_connector_detect,
659 .destroy = nouveau_connector_destroy,
660 .fill_modes = drm_helper_probe_single_connector_modes,
661 .set_property = nouveau_connector_set_property,
662 .force = nouveau_connector_force
666 nouveau_connector_create_lvds(struct drm_device *dev,
667 struct drm_connector *connector)
669 struct nouveau_connector *nv_connector = nouveau_connector(connector);
670 struct drm_nouveau_private *dev_priv = dev->dev_private;
671 struct nouveau_i2c_chan *i2c = NULL;
672 struct nouveau_encoder *nv_encoder;
673 struct drm_display_mode native, *mode, *temp;
674 bool dummy, if_is_24bit = false;
677 nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS);
681 ret = nouveau_bios_parse_lvds_table(dev, 0, &dummy, &if_is_24bit);
683 NV_ERROR(dev, "Error parsing LVDS table, disabling LVDS\n");
686 nv_connector->use_dithering = !if_is_24bit;
688 /* Firstly try getting EDID over DDC, if allowed and I2C channel
691 if (!dev_priv->vbios.fp_no_ddc && nv_encoder->dcb->i2c_index < 0xf)
692 i2c = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);
695 nouveau_connector_ddc_prepare(connector, &flags);
696 nv_connector->edid = drm_get_edid(connector, &i2c->adapter);
697 nouveau_connector_ddc_finish(connector, flags);
700 /* If no EDID found above, and the VBIOS indicates a hardcoded
701 * modeline is avalilable for the panel, set it as the panel's
702 * native mode and exit.
704 if (!nv_connector->edid && nouveau_bios_fp_mode(dev, &native) &&
705 (nv_encoder->dcb->lvdsconf.use_straps_for_mode ||
706 dev_priv->vbios.fp_no_ddc)) {
707 nv_connector->native_mode = drm_mode_duplicate(dev, &native);
711 /* Still nothing, some VBIOS images have a hardcoded EDID block
712 * stored for the panel stored in them.
714 if (!nv_connector->edid && !nv_connector->native_mode &&
715 !dev_priv->vbios.fp_no_ddc) {
717 (struct edid *)nouveau_bios_embedded_edid(dev);
719 nv_connector->edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
720 *(nv_connector->edid) = *edid;
724 if (!nv_connector->edid)
727 /* We didn't find/use a panel mode from the VBIOS, so parse the EDID
728 * block and look for the preferred mode there.
730 ret = drm_add_edid_modes(connector, nv_connector->edid);
733 nv_connector->detected_encoder = nv_encoder;
734 nv_connector->native_mode = nouveau_connector_native_mode(connector);
735 list_for_each_entry_safe(mode, temp, &connector->probed_modes, head)
736 drm_mode_remove(connector, mode);
739 if (!nv_connector->native_mode) {
740 NV_ERROR(dev, "LVDS present in DCB table, but couldn't "
741 "determine its native mode. Disabling.\n");
745 drm_mode_connector_update_edid_property(connector, nv_connector->edid);
750 nouveau_connector_create(struct drm_device *dev,
751 struct dcb_connector_table_entry *dcb)
753 struct drm_nouveau_private *dev_priv = dev->dev_private;
754 struct nouveau_connector *nv_connector = NULL;
755 struct drm_connector *connector;
756 struct drm_encoder *encoder;
759 NV_DEBUG_KMS(dev, "\n");
762 case DCB_CONNECTOR_NONE:
764 case DCB_CONNECTOR_VGA:
765 NV_INFO(dev, "Detected a VGA connector\n");
766 type = DRM_MODE_CONNECTOR_VGA;
768 case DCB_CONNECTOR_TV_0:
769 case DCB_CONNECTOR_TV_1:
770 case DCB_CONNECTOR_TV_3:
771 NV_INFO(dev, "Detected a TV connector\n");
772 type = DRM_MODE_CONNECTOR_TV;
774 case DCB_CONNECTOR_DVI_I:
775 NV_INFO(dev, "Detected a DVI-I connector\n");
776 type = DRM_MODE_CONNECTOR_DVII;
778 case DCB_CONNECTOR_DVI_D:
779 NV_INFO(dev, "Detected a DVI-D connector\n");
780 type = DRM_MODE_CONNECTOR_DVID;
782 case DCB_CONNECTOR_HDMI_0:
783 case DCB_CONNECTOR_HDMI_1:
784 NV_INFO(dev, "Detected a HDMI connector\n");
785 type = DRM_MODE_CONNECTOR_HDMIA;
787 case DCB_CONNECTOR_LVDS:
788 NV_INFO(dev, "Detected a LVDS connector\n");
789 type = DRM_MODE_CONNECTOR_LVDS;
791 case DCB_CONNECTOR_DP:
792 NV_INFO(dev, "Detected a DisplayPort connector\n");
793 type = DRM_MODE_CONNECTOR_DisplayPort;
795 case DCB_CONNECTOR_eDP:
796 NV_INFO(dev, "Detected an eDP connector\n");
797 type = DRM_MODE_CONNECTOR_eDP;
800 NV_ERROR(dev, "unknown connector type: 0x%02x!!\n", dcb->type);
804 nv_connector = kzalloc(sizeof(*nv_connector), GFP_KERNEL);
807 nv_connector->dcb = dcb;
808 connector = &nv_connector->base;
810 /* defaults, will get overridden in detect() */
811 connector->interlace_allowed = false;
812 connector->doublescan_allowed = false;
814 drm_connector_init(dev, connector, &nouveau_connector_funcs, type);
815 drm_connector_helper_add(connector, &nouveau_connector_helper_funcs);
817 /* attach encoders */
818 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
819 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
821 if (nv_encoder->dcb->connector != dcb->index)
824 if (get_slave_funcs(nv_encoder))
825 get_slave_funcs(nv_encoder)->create_resources(encoder, connector);
827 drm_mode_connector_attach_encoder(connector, encoder);
830 if (!connector->encoder_ids[0]) {
831 NV_WARN(dev, " no encoders, ignoring\n");
832 drm_connector_cleanup(connector);
837 /* Init DVI-I specific properties */
838 if (dcb->type == DCB_CONNECTOR_DVI_I) {
839 drm_mode_create_dvi_i_properties(dev);
840 drm_connector_attach_property(connector, dev->mode_config.dvi_i_subconnector_property, 0);
841 drm_connector_attach_property(connector, dev->mode_config.dvi_i_select_subconnector_property, 0);
844 if (dcb->type != DCB_CONNECTOR_LVDS)
845 nv_connector->use_dithering = false;
848 case DCB_CONNECTOR_VGA:
849 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
850 if (dev_priv->card_type >= NV_50) {
851 drm_connector_attach_property(connector,
852 dev->mode_config.scaling_mode_property,
853 nv_connector->scaling_mode);
856 case DCB_CONNECTOR_TV_0:
857 case DCB_CONNECTOR_TV_1:
858 case DCB_CONNECTOR_TV_3:
859 nv_connector->scaling_mode = DRM_MODE_SCALE_NONE;
861 case DCB_CONNECTOR_DP:
862 case DCB_CONNECTOR_eDP:
863 case DCB_CONNECTOR_HDMI_0:
864 case DCB_CONNECTOR_HDMI_1:
865 case DCB_CONNECTOR_DVI_I:
866 case DCB_CONNECTOR_DVI_D:
867 if (dev_priv->card_type >= NV_50)
868 connector->polled = DRM_CONNECTOR_POLL_HPD;
870 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
873 nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN;
875 drm_connector_attach_property(connector,
876 dev->mode_config.scaling_mode_property,
877 nv_connector->scaling_mode);
878 drm_connector_attach_property(connector,
879 dev->mode_config.dithering_mode_property,
880 nv_connector->use_dithering ?
881 DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF);
885 drm_sysfs_connector_add(connector);
887 if (dcb->type == DCB_CONNECTOR_LVDS) {
888 ret = nouveau_connector_create_lvds(dev, connector);
890 connector->funcs->destroy(connector);