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 struct nouveau_encoder *
41 find_encoder_by_type(struct drm_connector *connector, int type)
43 struct drm_device *dev = connector->dev;
44 struct nouveau_encoder *nv_encoder;
45 struct drm_mode_object *obj;
48 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
49 id = connector->encoder_ids[i];
53 obj = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER);
56 nv_encoder = nouveau_encoder(obj_to_encoder(obj));
58 if (type == OUTPUT_ANY || nv_encoder->dcb->type == type)
65 struct nouveau_connector *
66 nouveau_encoder_connector_get(struct nouveau_encoder *encoder)
68 struct drm_device *dev = to_drm_encoder(encoder)->dev;
69 struct drm_connector *drm_connector;
71 list_for_each_entry(drm_connector, &dev->mode_config.connector_list, head) {
72 if (drm_connector->encoder == to_drm_encoder(encoder))
73 return nouveau_connector(drm_connector);
81 nouveau_connector_destroy(struct drm_connector *drm_connector)
83 struct nouveau_connector *nv_connector =
84 nouveau_connector(drm_connector);
85 struct drm_device *dev;
90 dev = nv_connector->base.dev;
91 NV_DEBUG_KMS(dev, "\n");
93 kfree(nv_connector->edid);
94 drm_sysfs_connector_remove(drm_connector);
95 drm_connector_cleanup(drm_connector);
99 static struct nouveau_i2c_chan *
100 nouveau_connector_ddc_detect(struct drm_connector *connector,
101 struct nouveau_encoder **pnv_encoder)
103 struct drm_device *dev = connector->dev;
106 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
107 struct nouveau_i2c_chan *i2c;
108 struct nouveau_encoder *nv_encoder;
109 struct drm_mode_object *obj;
112 id = connector->encoder_ids[i];
116 obj = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER);
119 nv_encoder = nouveau_encoder(obj_to_encoder(obj));
120 i2c = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);
122 if (i2c && nouveau_probe_i2c_addr(i2c, 0x50)) {
123 *pnv_encoder = nv_encoder;
132 nouveau_connector_set_encoder(struct drm_connector *connector,
133 struct nouveau_encoder *nv_encoder)
135 struct nouveau_connector *nv_connector = nouveau_connector(connector);
136 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
137 struct drm_device *dev = connector->dev;
139 if (nv_connector->detected_encoder == nv_encoder)
141 nv_connector->detected_encoder = nv_encoder;
143 if (nv_encoder->dcb->type == OUTPUT_LVDS ||
144 nv_encoder->dcb->type == OUTPUT_TMDS) {
145 connector->doublescan_allowed = false;
146 connector->interlace_allowed = false;
148 connector->doublescan_allowed = true;
149 if (dev_priv->card_type == NV_20 ||
150 (dev_priv->card_type == NV_10 &&
151 (dev->pci_device & 0x0ff0) != 0x0100 &&
152 (dev->pci_device & 0x0ff0) != 0x0150))
154 connector->interlace_allowed = false;
156 connector->interlace_allowed = true;
159 if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
160 drm_connector_property_set_value(connector,
161 dev->mode_config.dvi_i_subconnector_property,
162 nv_encoder->dcb->type == OUTPUT_TMDS ?
163 DRM_MODE_SUBCONNECTOR_DVID :
164 DRM_MODE_SUBCONNECTOR_DVIA);
168 static enum drm_connector_status
169 nouveau_connector_detect(struct drm_connector *connector)
171 struct drm_device *dev = connector->dev;
172 struct nouveau_connector *nv_connector = nouveau_connector(connector);
173 struct nouveau_encoder *nv_encoder = NULL;
174 struct nouveau_i2c_chan *i2c;
177 /* Cleanup the previous EDID block. */
178 if (nv_connector->edid) {
179 drm_mode_connector_update_edid_property(connector, NULL);
180 kfree(nv_connector->edid);
181 nv_connector->edid = NULL;
184 i2c = nouveau_connector_ddc_detect(connector, &nv_encoder);
186 nv_connector->edid = drm_get_edid(connector, &i2c->adapter);
187 drm_mode_connector_update_edid_property(connector,
189 if (!nv_connector->edid) {
190 NV_ERROR(dev, "DDC responded, but no EDID for %s\n",
191 drm_get_connector_name(connector));
195 if (nv_encoder->dcb->type == OUTPUT_DP &&
196 !nouveau_dp_detect(to_drm_encoder(nv_encoder))) {
197 NV_ERROR(dev, "Detected %s, but failed init\n",
198 drm_get_connector_name(connector));
199 return connector_status_disconnected;
202 /* Override encoder type for DVI-I based on whether EDID
203 * says the display is digital or analog, both use the
204 * same i2c channel so the value returned from ddc_detect
205 * isn't necessarily correct.
207 if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
208 if (nv_connector->edid->input & DRM_EDID_INPUT_DIGITAL)
211 type = OUTPUT_ANALOG;
213 nv_encoder = find_encoder_by_type(connector, type);
215 NV_ERROR(dev, "Detected %d encoder on %s, "
216 "but no object!\n", type,
217 drm_get_connector_name(connector));
218 return connector_status_disconnected;
222 nouveau_connector_set_encoder(connector, nv_encoder);
223 return connector_status_connected;
227 nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG);
228 if (!nv_encoder && !nouveau_tv_disable)
229 nv_encoder = find_encoder_by_type(connector, OUTPUT_TV);
231 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
232 struct drm_encoder_helper_funcs *helper =
233 encoder->helper_private;
235 if (helper->detect(encoder, connector) ==
236 connector_status_connected) {
237 nouveau_connector_set_encoder(connector, nv_encoder);
238 return connector_status_connected;
243 return connector_status_disconnected;
246 static enum drm_connector_status
247 nouveau_connector_detect_lvds(struct drm_connector *connector)
249 struct drm_device *dev = connector->dev;
250 struct drm_nouveau_private *dev_priv = dev->dev_private;
251 struct nouveau_connector *nv_connector = nouveau_connector(connector);
252 struct nouveau_encoder *nv_encoder = NULL;
253 enum drm_connector_status status = connector_status_disconnected;
255 /* Cleanup the previous EDID block. */
256 if (nv_connector->edid) {
257 drm_mode_connector_update_edid_property(connector, NULL);
258 kfree(nv_connector->edid);
259 nv_connector->edid = NULL;
262 nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS);
264 return connector_status_disconnected;
266 /* Try retrieving EDID via DDC */
267 if (!dev_priv->vbios.fp_no_ddc) {
268 status = nouveau_connector_detect(connector);
269 if (status == connector_status_connected)
273 /* On some laptops (Sony, i'm looking at you) there appears to
274 * be no direct way of accessing the panel's EDID. The only
275 * option available to us appears to be to ask ACPI for help..
277 * It's important this check's before trying straps, one of the
278 * said manufacturer's laptops are configured in such a way
279 * the nouveau decides an entry in the VBIOS FP mode table is
280 * valid - it's not (rh#613284)
282 if (nv_encoder->dcb->lvdsconf.use_acpi_for_edid) {
283 if (!nouveau_acpi_edid(dev, connector)) {
284 status = connector_status_connected;
289 /* If no EDID found above, and the VBIOS indicates a hardcoded
290 * modeline is avalilable for the panel, set it as the panel's
291 * native mode and exit.
293 if (nouveau_bios_fp_mode(dev, NULL) && (dev_priv->vbios.fp_no_ddc ||
294 nv_encoder->dcb->lvdsconf.use_straps_for_mode)) {
295 status = connector_status_connected;
299 /* Still nothing, some VBIOS images have a hardcoded EDID block
300 * stored for the panel stored in them.
302 if (!dev_priv->vbios.fp_no_ddc) {
304 (struct edid *)nouveau_bios_embedded_edid(dev);
306 nv_connector->edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
307 *(nv_connector->edid) = *edid;
308 status = connector_status_connected;
313 #if defined(CONFIG_ACPI_BUTTON) || \
314 (defined(CONFIG_ACPI_BUTTON_MODULE) && defined(MODULE))
315 if (status == connector_status_connected &&
316 !nouveau_ignorelid && !acpi_lid_open())
317 status = connector_status_unknown;
320 drm_mode_connector_update_edid_property(connector, nv_connector->edid);
321 nouveau_connector_set_encoder(connector, nv_encoder);
326 nouveau_connector_force(struct drm_connector *connector)
328 struct nouveau_connector *nv_connector = nouveau_connector(connector);
329 struct nouveau_encoder *nv_encoder;
332 if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
333 if (connector->force == DRM_FORCE_ON_DIGITAL)
336 type = OUTPUT_ANALOG;
340 nv_encoder = find_encoder_by_type(connector, type);
342 NV_ERROR(connector->dev, "can't find encoder to force %s on!\n",
343 drm_get_connector_name(connector));
344 connector->status = connector_status_disconnected;
348 nouveau_connector_set_encoder(connector, nv_encoder);
352 nouveau_connector_set_property(struct drm_connector *connector,
353 struct drm_property *property, uint64_t value)
355 struct nouveau_connector *nv_connector = nouveau_connector(connector);
356 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
357 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
358 struct drm_device *dev = connector->dev;
362 if (property == dev->mode_config.scaling_mode_property) {
363 struct nouveau_crtc *nv_crtc = NULL;
364 bool modeset = false;
367 case DRM_MODE_SCALE_NONE:
368 case DRM_MODE_SCALE_FULLSCREEN:
369 case DRM_MODE_SCALE_CENTER:
370 case DRM_MODE_SCALE_ASPECT:
376 /* LVDS always needs gpu scaling */
377 if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS &&
378 value == DRM_MODE_SCALE_NONE)
381 /* Changing between GPU and panel scaling requires a full
384 if ((nv_connector->scaling_mode == DRM_MODE_SCALE_NONE) ||
385 (value == DRM_MODE_SCALE_NONE))
387 nv_connector->scaling_mode = value;
389 if (connector->encoder && connector->encoder->crtc)
390 nv_crtc = nouveau_crtc(connector->encoder->crtc);
394 if (modeset || !nv_crtc->set_scale) {
395 ret = drm_crtc_helper_set_mode(&nv_crtc->base,
398 nv_crtc->base.y, NULL);
402 ret = nv_crtc->set_scale(nv_crtc, value, true);
411 if (property == dev->mode_config.dithering_mode_property) {
412 struct nouveau_crtc *nv_crtc = NULL;
414 if (value == DRM_MODE_DITHERING_ON)
415 nv_connector->use_dithering = true;
417 nv_connector->use_dithering = false;
419 if (connector->encoder && connector->encoder->crtc)
420 nv_crtc = nouveau_crtc(connector->encoder->crtc);
422 if (!nv_crtc || !nv_crtc->set_dither)
425 return nv_crtc->set_dither(nv_crtc, nv_connector->use_dithering,
429 if (nv_encoder && nv_encoder->dcb->type == OUTPUT_TV)
430 return get_slave_funcs(encoder)->set_property(
431 encoder, connector, property, value);
436 static struct drm_display_mode *
437 nouveau_connector_native_mode(struct drm_connector *connector)
439 struct drm_connector_helper_funcs *helper = connector->helper_private;
440 struct nouveau_connector *nv_connector = nouveau_connector(connector);
441 struct drm_device *dev = connector->dev;
442 struct drm_display_mode *mode, *largest = NULL;
443 int high_w = 0, high_h = 0, high_v = 0;
445 list_for_each_entry(mode, &nv_connector->base.probed_modes, head) {
446 if (helper->mode_valid(connector, mode) != MODE_OK ||
447 (mode->flags & DRM_MODE_FLAG_INTERLACE))
450 /* Use preferred mode if there is one.. */
451 if (mode->type & DRM_MODE_TYPE_PREFERRED) {
452 NV_DEBUG_KMS(dev, "native mode from preferred\n");
453 return drm_mode_duplicate(dev, mode);
456 /* Otherwise, take the resolution with the largest width, then
457 * height, then vertical refresh
459 if (mode->hdisplay < high_w)
462 if (mode->hdisplay == high_w && mode->vdisplay < high_h)
465 if (mode->hdisplay == high_w && mode->vdisplay == high_h &&
466 mode->vrefresh < high_v)
469 high_w = mode->hdisplay;
470 high_h = mode->vdisplay;
471 high_v = mode->vrefresh;
475 NV_DEBUG_KMS(dev, "native mode from largest: %dx%d@%d\n",
476 high_w, high_h, high_v);
477 return largest ? drm_mode_duplicate(dev, largest) : NULL;
485 static struct moderec scaler_modes[] = {
504 nouveau_connector_scaler_modes_add(struct drm_connector *connector)
506 struct nouveau_connector *nv_connector = nouveau_connector(connector);
507 struct drm_display_mode *native = nv_connector->native_mode, *m;
508 struct drm_device *dev = connector->dev;
509 struct moderec *mode = &scaler_modes[0];
515 while (mode->hdisplay) {
516 if (mode->hdisplay <= native->hdisplay &&
517 mode->vdisplay <= native->vdisplay) {
518 m = drm_cvt_mode(dev, mode->hdisplay, mode->vdisplay,
519 drm_mode_vrefresh(native), false,
524 m->type |= DRM_MODE_TYPE_DRIVER;
526 drm_mode_probed_add(connector, m);
537 nouveau_connector_get_modes(struct drm_connector *connector)
539 struct drm_device *dev = connector->dev;
540 struct drm_nouveau_private *dev_priv = dev->dev_private;
541 struct nouveau_connector *nv_connector = nouveau_connector(connector);
542 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
543 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
546 /* destroy the native mode, the attached monitor could have changed.
548 if (nv_connector->native_mode) {
549 drm_mode_destroy(dev, nv_connector->native_mode);
550 nv_connector->native_mode = NULL;
553 if (nv_connector->edid)
554 ret = drm_add_edid_modes(connector, nv_connector->edid);
556 if (nv_encoder->dcb->type == OUTPUT_LVDS &&
557 (nv_encoder->dcb->lvdsconf.use_straps_for_mode ||
558 dev_priv->vbios.fp_no_ddc) && nouveau_bios_fp_mode(dev, NULL)) {
559 nv_connector->native_mode = drm_mode_create(dev);
560 nouveau_bios_fp_mode(dev, nv_connector->native_mode);
563 /* Find the native mode if this is a digital panel, if we didn't
564 * find any modes through DDC previously add the native mode to
567 if (!nv_connector->native_mode)
568 nv_connector->native_mode =
569 nouveau_connector_native_mode(connector);
570 if (ret == 0 && nv_connector->native_mode) {
571 struct drm_display_mode *mode;
573 mode = drm_mode_duplicate(dev, nv_connector->native_mode);
574 drm_mode_probed_add(connector, mode);
578 if (nv_encoder->dcb->type == OUTPUT_TV)
579 ret = get_slave_funcs(encoder)->get_modes(encoder, connector);
581 if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS ||
582 nv_connector->dcb->type == DCB_CONNECTOR_eDP)
583 ret += nouveau_connector_scaler_modes_add(connector);
589 nouveau_connector_mode_valid(struct drm_connector *connector,
590 struct drm_display_mode *mode)
592 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
593 struct nouveau_connector *nv_connector = nouveau_connector(connector);
594 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
595 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
596 unsigned min_clock = 25000, max_clock = min_clock;
597 unsigned clock = mode->clock;
599 switch (nv_encoder->dcb->type) {
601 if (nv_connector->native_mode &&
602 (mode->hdisplay > nv_connector->native_mode->hdisplay ||
603 mode->vdisplay > nv_connector->native_mode->vdisplay))
610 if ((dev_priv->card_type >= NV_50 && !nouveau_duallink) ||
611 !nv_encoder->dcb->duallink_possible)
617 max_clock = nv_encoder->dcb->crtconf.maxfreq;
622 return get_slave_funcs(encoder)->mode_valid(encoder, mode);
624 if (nv_encoder->dp.link_bw == DP_LINK_BW_2_7)
625 max_clock = nv_encoder->dp.link_nr * 270000;
627 max_clock = nv_encoder->dp.link_nr * 162000;
636 if (clock < min_clock)
637 return MODE_CLOCK_LOW;
639 if (clock > max_clock)
640 return MODE_CLOCK_HIGH;
645 static struct drm_encoder *
646 nouveau_connector_best_encoder(struct drm_connector *connector)
648 struct nouveau_connector *nv_connector = nouveau_connector(connector);
650 if (nv_connector->detected_encoder)
651 return to_drm_encoder(nv_connector->detected_encoder);
657 nouveau_connector_set_polling(struct drm_connector *connector)
659 struct drm_device *dev = connector->dev;
660 struct drm_nouveau_private *dev_priv = dev->dev_private;
661 struct drm_crtc *crtc;
662 bool spare_crtc = false;
664 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
665 spare_crtc |= !crtc->enabled;
667 connector->polled = 0;
669 switch (connector->connector_type) {
670 case DRM_MODE_CONNECTOR_VGA:
671 case DRM_MODE_CONNECTOR_TV:
672 if (dev_priv->card_type >= NV_50 ||
673 (nv_gf4_disp_arch(dev) && spare_crtc))
674 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
677 case DRM_MODE_CONNECTOR_DVII:
678 case DRM_MODE_CONNECTOR_DVID:
679 case DRM_MODE_CONNECTOR_HDMIA:
680 case DRM_MODE_CONNECTOR_DisplayPort:
681 case DRM_MODE_CONNECTOR_eDP:
682 if (dev_priv->card_type >= NV_50)
683 connector->polled = DRM_CONNECTOR_POLL_HPD;
684 else if (connector->connector_type == DRM_MODE_CONNECTOR_DVID ||
686 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
694 static const struct drm_connector_helper_funcs
695 nouveau_connector_helper_funcs = {
696 .get_modes = nouveau_connector_get_modes,
697 .mode_valid = nouveau_connector_mode_valid,
698 .best_encoder = nouveau_connector_best_encoder,
701 static const struct drm_connector_funcs
702 nouveau_connector_funcs = {
703 .dpms = drm_helper_connector_dpms,
706 .detect = nouveau_connector_detect,
707 .destroy = nouveau_connector_destroy,
708 .fill_modes = drm_helper_probe_single_connector_modes,
709 .set_property = nouveau_connector_set_property,
710 .force = nouveau_connector_force
713 static const struct drm_connector_funcs
714 nouveau_connector_funcs_lvds = {
715 .dpms = drm_helper_connector_dpms,
718 .detect = nouveau_connector_detect_lvds,
719 .destroy = nouveau_connector_destroy,
720 .fill_modes = drm_helper_probe_single_connector_modes,
721 .set_property = nouveau_connector_set_property,
722 .force = nouveau_connector_force
725 struct drm_connector *
726 nouveau_connector_create(struct drm_device *dev, int index)
728 const struct drm_connector_funcs *funcs = &nouveau_connector_funcs;
729 struct drm_nouveau_private *dev_priv = dev->dev_private;
730 struct nouveau_connector *nv_connector = NULL;
731 struct dcb_connector_table_entry *dcb = NULL;
732 struct drm_connector *connector;
735 NV_DEBUG_KMS(dev, "\n");
737 if (index >= dev_priv->vbios.dcb.connector.entries)
738 return ERR_PTR(-EINVAL);
740 dcb = &dev_priv->vbios.dcb.connector.entry[index];
745 case DCB_CONNECTOR_VGA:
746 type = DRM_MODE_CONNECTOR_VGA;
748 case DCB_CONNECTOR_TV_0:
749 case DCB_CONNECTOR_TV_1:
750 case DCB_CONNECTOR_TV_3:
751 type = DRM_MODE_CONNECTOR_TV;
753 case DCB_CONNECTOR_DVI_I:
754 type = DRM_MODE_CONNECTOR_DVII;
756 case DCB_CONNECTOR_DVI_D:
757 type = DRM_MODE_CONNECTOR_DVID;
759 case DCB_CONNECTOR_HDMI_0:
760 case DCB_CONNECTOR_HDMI_1:
761 type = DRM_MODE_CONNECTOR_HDMIA;
763 case DCB_CONNECTOR_LVDS:
764 type = DRM_MODE_CONNECTOR_LVDS;
765 funcs = &nouveau_connector_funcs_lvds;
767 case DCB_CONNECTOR_DP:
768 type = DRM_MODE_CONNECTOR_DisplayPort;
770 case DCB_CONNECTOR_eDP:
771 type = DRM_MODE_CONNECTOR_eDP;
774 NV_ERROR(dev, "unknown connector type: 0x%02x!!\n", dcb->type);
775 return ERR_PTR(-EINVAL);
778 nv_connector = kzalloc(sizeof(*nv_connector), GFP_KERNEL);
780 return ERR_PTR(-ENOMEM);
781 nv_connector->dcb = dcb;
782 connector = &nv_connector->base;
784 /* defaults, will get overridden in detect() */
785 connector->interlace_allowed = false;
786 connector->doublescan_allowed = false;
788 drm_connector_init(dev, connector, funcs, type);
789 drm_connector_helper_add(connector, &nouveau_connector_helper_funcs);
791 /* Check if we need dithering enabled */
792 if (dcb->type == DCB_CONNECTOR_LVDS) {
793 bool dummy, is_24bit = false;
795 ret = nouveau_bios_parse_lvds_table(dev, 0, &dummy, &is_24bit);
797 NV_ERROR(dev, "Error parsing LVDS table, disabling "
802 nv_connector->use_dithering = !is_24bit;
805 /* Init DVI-I specific properties */
806 if (dcb->type == DCB_CONNECTOR_DVI_I) {
807 drm_mode_create_dvi_i_properties(dev);
808 drm_connector_attach_property(connector, dev->mode_config.dvi_i_subconnector_property, 0);
809 drm_connector_attach_property(connector, dev->mode_config.dvi_i_select_subconnector_property, 0);
813 case DCB_CONNECTOR_VGA:
814 if (dev_priv->card_type >= NV_50) {
815 drm_connector_attach_property(connector,
816 dev->mode_config.scaling_mode_property,
817 nv_connector->scaling_mode);
820 case DCB_CONNECTOR_TV_0:
821 case DCB_CONNECTOR_TV_1:
822 case DCB_CONNECTOR_TV_3:
823 nv_connector->scaling_mode = DRM_MODE_SCALE_NONE;
826 nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN;
828 drm_connector_attach_property(connector,
829 dev->mode_config.scaling_mode_property,
830 nv_connector->scaling_mode);
831 drm_connector_attach_property(connector,
832 dev->mode_config.dithering_mode_property,
833 nv_connector->use_dithering ?
834 DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF);
838 nouveau_connector_set_polling(connector);
840 drm_sysfs_connector_add(connector);
841 dcb->drm = connector;
845 drm_connector_cleanup(connector);