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);
105 static struct nouveau_i2c_chan *
106 nouveau_connector_ddc_detect(struct drm_connector *connector,
107 struct nouveau_encoder **pnv_encoder)
109 struct drm_device *dev = connector->dev;
112 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
113 struct nouveau_i2c_chan *i2c;
114 struct nouveau_encoder *nv_encoder;
115 struct drm_mode_object *obj;
118 id = connector->encoder_ids[i];
122 obj = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER);
125 nv_encoder = nouveau_encoder(obj_to_encoder(obj));
126 i2c = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);
128 if (i2c && nouveau_probe_i2c_addr(i2c, 0x50)) {
129 *pnv_encoder = nv_encoder;
138 nouveau_connector_set_encoder(struct drm_connector *connector,
139 struct nouveau_encoder *nv_encoder)
141 struct nouveau_connector *nv_connector = nouveau_connector(connector);
142 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
143 struct drm_device *dev = connector->dev;
145 if (nv_connector->detected_encoder == nv_encoder)
147 nv_connector->detected_encoder = nv_encoder;
149 if (nv_encoder->dcb->type == OUTPUT_LVDS ||
150 nv_encoder->dcb->type == OUTPUT_TMDS) {
151 connector->doublescan_allowed = false;
152 connector->interlace_allowed = false;
154 connector->doublescan_allowed = true;
155 if (dev_priv->card_type == NV_20 ||
156 (dev_priv->card_type == NV_10 &&
157 (dev->pci_device & 0x0ff0) != 0x0100 &&
158 (dev->pci_device & 0x0ff0) != 0x0150))
160 connector->interlace_allowed = false;
162 connector->interlace_allowed = true;
165 if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
166 drm_connector_property_set_value(connector,
167 dev->mode_config.dvi_i_subconnector_property,
168 nv_encoder->dcb->type == OUTPUT_TMDS ?
169 DRM_MODE_SUBCONNECTOR_DVID :
170 DRM_MODE_SUBCONNECTOR_DVIA);
174 static enum drm_connector_status
175 nouveau_connector_detect(struct drm_connector *connector)
177 struct drm_device *dev = connector->dev;
178 struct nouveau_connector *nv_connector = nouveau_connector(connector);
179 struct nouveau_encoder *nv_encoder = NULL;
180 struct nouveau_i2c_chan *i2c;
183 /* Cleanup the previous EDID block. */
184 if (nv_connector->edid) {
185 drm_mode_connector_update_edid_property(connector, NULL);
186 kfree(nv_connector->edid);
187 nv_connector->edid = NULL;
190 i2c = nouveau_connector_ddc_detect(connector, &nv_encoder);
192 nv_connector->edid = drm_get_edid(connector, &i2c->adapter);
193 drm_mode_connector_update_edid_property(connector,
195 if (!nv_connector->edid) {
196 NV_ERROR(dev, "DDC responded, but no EDID for %s\n",
197 drm_get_connector_name(connector));
201 if (nv_encoder->dcb->type == OUTPUT_DP &&
202 !nouveau_dp_detect(to_drm_encoder(nv_encoder))) {
203 NV_ERROR(dev, "Detected %s, but failed init\n",
204 drm_get_connector_name(connector));
205 return connector_status_disconnected;
208 /* Override encoder type for DVI-I based on whether EDID
209 * says the display is digital or analog, both use the
210 * same i2c channel so the value returned from ddc_detect
211 * isn't necessarily correct.
213 if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
214 if (nv_connector->edid->input & DRM_EDID_INPUT_DIGITAL)
217 type = OUTPUT_ANALOG;
219 nv_encoder = find_encoder_by_type(connector, type);
221 NV_ERROR(dev, "Detected %d encoder on %s, "
222 "but no object!\n", type,
223 drm_get_connector_name(connector));
224 return connector_status_disconnected;
228 nouveau_connector_set_encoder(connector, nv_encoder);
229 return connector_status_connected;
233 nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG);
234 if (!nv_encoder && !nouveau_tv_disable)
235 nv_encoder = find_encoder_by_type(connector, OUTPUT_TV);
237 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
238 struct drm_encoder_helper_funcs *helper =
239 encoder->helper_private;
241 if (helper->detect(encoder, connector) ==
242 connector_status_connected) {
243 nouveau_connector_set_encoder(connector, nv_encoder);
244 return connector_status_connected;
249 return connector_status_disconnected;
252 static enum drm_connector_status
253 nouveau_connector_detect_lvds(struct drm_connector *connector)
255 struct drm_device *dev = connector->dev;
256 struct drm_nouveau_private *dev_priv = dev->dev_private;
257 struct nouveau_connector *nv_connector = nouveau_connector(connector);
258 struct nouveau_encoder *nv_encoder = NULL;
259 enum drm_connector_status status = connector_status_disconnected;
261 /* Cleanup the previous EDID block. */
262 if (nv_connector->edid) {
263 drm_mode_connector_update_edid_property(connector, NULL);
264 kfree(nv_connector->edid);
265 nv_connector->edid = NULL;
268 nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS);
270 return connector_status_disconnected;
272 /* Try retrieving EDID via DDC */
273 if (!dev_priv->vbios.fp_no_ddc) {
274 status = nouveau_connector_detect(connector);
275 if (status == connector_status_connected)
279 /* On some laptops (Sony, i'm looking at you) there appears to
280 * be no direct way of accessing the panel's EDID. The only
281 * option available to us appears to be to ask ACPI for help..
283 * It's important this check's before trying straps, one of the
284 * said manufacturer's laptops are configured in such a way
285 * the nouveau decides an entry in the VBIOS FP mode table is
286 * valid - it's not (rh#613284)
288 if (nv_encoder->dcb->lvdsconf.use_acpi_for_edid) {
289 if (!nouveau_acpi_edid(dev, connector)) {
290 status = connector_status_connected;
295 /* If no EDID found above, and the VBIOS indicates a hardcoded
296 * modeline is avalilable for the panel, set it as the panel's
297 * native mode and exit.
299 if (nouveau_bios_fp_mode(dev, NULL) && (dev_priv->vbios.fp_no_ddc ||
300 nv_encoder->dcb->lvdsconf.use_straps_for_mode)) {
301 status = connector_status_connected;
305 /* Still nothing, some VBIOS images have a hardcoded EDID block
306 * stored for the panel stored in them.
308 if (!dev_priv->vbios.fp_no_ddc) {
310 (struct edid *)nouveau_bios_embedded_edid(dev);
312 nv_connector->edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
313 *(nv_connector->edid) = *edid;
314 status = connector_status_connected;
319 #if defined(CONFIG_ACPI_BUTTON) || \
320 (defined(CONFIG_ACPI_BUTTON_MODULE) && defined(MODULE))
321 if (status == connector_status_connected &&
322 !nouveau_ignorelid && !acpi_lid_open())
323 status = connector_status_unknown;
326 drm_mode_connector_update_edid_property(connector, nv_connector->edid);
327 nouveau_connector_set_encoder(connector, nv_encoder);
332 nouveau_connector_force(struct drm_connector *connector)
334 struct nouveau_connector *nv_connector = nouveau_connector(connector);
335 struct nouveau_encoder *nv_encoder;
338 if (nv_connector->dcb->type == DCB_CONNECTOR_DVI_I) {
339 if (connector->force == DRM_FORCE_ON_DIGITAL)
342 type = OUTPUT_ANALOG;
346 nv_encoder = find_encoder_by_type(connector, type);
348 NV_ERROR(connector->dev, "can't find encoder to force %s on!\n",
349 drm_get_connector_name(connector));
350 connector->status = connector_status_disconnected;
354 nouveau_connector_set_encoder(connector, nv_encoder);
358 nouveau_connector_set_property(struct drm_connector *connector,
359 struct drm_property *property, uint64_t value)
361 struct nouveau_connector *nv_connector = nouveau_connector(connector);
362 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
363 struct drm_device *dev = connector->dev;
367 if (property == dev->mode_config.scaling_mode_property) {
368 struct nouveau_crtc *nv_crtc = NULL;
369 bool modeset = false;
372 case DRM_MODE_SCALE_NONE:
373 case DRM_MODE_SCALE_FULLSCREEN:
374 case DRM_MODE_SCALE_CENTER:
375 case DRM_MODE_SCALE_ASPECT:
381 /* LVDS always needs gpu scaling */
382 if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS &&
383 value == DRM_MODE_SCALE_NONE)
386 /* Changing between GPU and panel scaling requires a full
389 if ((nv_connector->scaling_mode == DRM_MODE_SCALE_NONE) ||
390 (value == DRM_MODE_SCALE_NONE))
392 nv_connector->scaling_mode = value;
394 if (connector->encoder && connector->encoder->crtc)
395 nv_crtc = nouveau_crtc(connector->encoder->crtc);
399 if (modeset || !nv_crtc->set_scale) {
400 ret = drm_crtc_helper_set_mode(&nv_crtc->base,
403 nv_crtc->base.y, NULL);
407 ret = nv_crtc->set_scale(nv_crtc, value, true);
416 if (property == dev->mode_config.dithering_mode_property) {
417 struct nouveau_crtc *nv_crtc = NULL;
419 if (value == DRM_MODE_DITHERING_ON)
420 nv_connector->use_dithering = true;
422 nv_connector->use_dithering = false;
424 if (connector->encoder && connector->encoder->crtc)
425 nv_crtc = nouveau_crtc(connector->encoder->crtc);
427 if (!nv_crtc || !nv_crtc->set_dither)
430 return nv_crtc->set_dither(nv_crtc, nv_connector->use_dithering,
434 if (nv_encoder && nv_encoder->dcb->type == OUTPUT_TV)
435 return get_slave_funcs(nv_encoder)->
436 set_property(to_drm_encoder(nv_encoder), connector, property, value);
441 static struct drm_display_mode *
442 nouveau_connector_native_mode(struct drm_connector *connector)
444 struct drm_connector_helper_funcs *helper = connector->helper_private;
445 struct nouveau_connector *nv_connector = nouveau_connector(connector);
446 struct drm_device *dev = connector->dev;
447 struct drm_display_mode *mode, *largest = NULL;
448 int high_w = 0, high_h = 0, high_v = 0;
450 list_for_each_entry(mode, &nv_connector->base.probed_modes, head) {
451 if (helper->mode_valid(connector, mode) != MODE_OK ||
452 (mode->flags & DRM_MODE_FLAG_INTERLACE))
455 /* Use preferred mode if there is one.. */
456 if (mode->type & DRM_MODE_TYPE_PREFERRED) {
457 NV_DEBUG_KMS(dev, "native mode from preferred\n");
458 return drm_mode_duplicate(dev, mode);
461 /* Otherwise, take the resolution with the largest width, then
462 * height, then vertical refresh
464 if (mode->hdisplay < high_w)
467 if (mode->hdisplay == high_w && mode->vdisplay < high_h)
470 if (mode->hdisplay == high_w && mode->vdisplay == high_h &&
471 mode->vrefresh < high_v)
474 high_w = mode->hdisplay;
475 high_h = mode->vdisplay;
476 high_v = mode->vrefresh;
480 NV_DEBUG_KMS(dev, "native mode from largest: %dx%d@%d\n",
481 high_w, high_h, high_v);
482 return largest ? drm_mode_duplicate(dev, largest) : NULL;
490 static struct moderec scaler_modes[] = {
509 nouveau_connector_scaler_modes_add(struct drm_connector *connector)
511 struct nouveau_connector *nv_connector = nouveau_connector(connector);
512 struct drm_display_mode *native = nv_connector->native_mode, *m;
513 struct drm_device *dev = connector->dev;
514 struct moderec *mode = &scaler_modes[0];
520 while (mode->hdisplay) {
521 if (mode->hdisplay <= native->hdisplay &&
522 mode->vdisplay <= native->vdisplay) {
523 m = drm_cvt_mode(dev, mode->hdisplay, mode->vdisplay,
524 drm_mode_vrefresh(native), false,
529 m->type |= DRM_MODE_TYPE_DRIVER;
531 drm_mode_probed_add(connector, m);
542 nouveau_connector_get_modes(struct drm_connector *connector)
544 struct drm_device *dev = connector->dev;
545 struct drm_nouveau_private *dev_priv = dev->dev_private;
546 struct nouveau_connector *nv_connector = nouveau_connector(connector);
547 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
550 /* destroy the native mode, the attached monitor could have changed.
552 if (nv_connector->native_mode) {
553 drm_mode_destroy(dev, nv_connector->native_mode);
554 nv_connector->native_mode = NULL;
557 if (nv_connector->edid)
558 ret = drm_add_edid_modes(connector, nv_connector->edid);
560 if (nv_encoder->dcb->type == OUTPUT_LVDS &&
561 (nv_encoder->dcb->lvdsconf.use_straps_for_mode ||
562 dev_priv->vbios.fp_no_ddc) && nouveau_bios_fp_mode(dev, NULL)) {
563 nv_connector->native_mode = drm_mode_create(dev);
564 nouveau_bios_fp_mode(dev, nv_connector->native_mode);
567 /* Find the native mode if this is a digital panel, if we didn't
568 * find any modes through DDC previously add the native mode to
571 if (!nv_connector->native_mode)
572 nv_connector->native_mode =
573 nouveau_connector_native_mode(connector);
574 if (ret == 0 && nv_connector->native_mode) {
575 struct drm_display_mode *mode;
577 mode = drm_mode_duplicate(dev, nv_connector->native_mode);
578 drm_mode_probed_add(connector, mode);
582 if (nv_encoder->dcb->type == OUTPUT_TV)
583 ret = get_slave_funcs(nv_encoder)->
584 get_modes(to_drm_encoder(nv_encoder), connector);
586 if (nv_connector->dcb->type == DCB_CONNECTOR_LVDS ||
587 nv_connector->dcb->type == DCB_CONNECTOR_eDP)
588 ret += nouveau_connector_scaler_modes_add(connector);
594 nouveau_connector_mode_valid(struct drm_connector *connector,
595 struct drm_display_mode *mode)
597 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
598 struct nouveau_connector *nv_connector = nouveau_connector(connector);
599 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
600 unsigned min_clock = 25000, max_clock = min_clock;
601 unsigned clock = mode->clock;
603 switch (nv_encoder->dcb->type) {
605 if (nv_connector->native_mode &&
606 (mode->hdisplay > nv_connector->native_mode->hdisplay ||
607 mode->vdisplay > nv_connector->native_mode->vdisplay))
614 if ((dev_priv->card_type >= NV_50 && !nouveau_duallink) ||
615 !nv_encoder->dcb->duallink_possible)
621 max_clock = nv_encoder->dcb->crtconf.maxfreq;
626 return get_slave_funcs(nv_encoder)->
627 mode_valid(to_drm_encoder(nv_encoder), mode);
629 if (nv_encoder->dp.link_bw == DP_LINK_BW_2_7)
630 max_clock = nv_encoder->dp.link_nr * 270000;
632 max_clock = nv_encoder->dp.link_nr * 162000;
641 if (clock < min_clock)
642 return MODE_CLOCK_LOW;
644 if (clock > max_clock)
645 return MODE_CLOCK_HIGH;
650 static struct drm_encoder *
651 nouveau_connector_best_encoder(struct drm_connector *connector)
653 struct nouveau_connector *nv_connector = nouveau_connector(connector);
655 if (nv_connector->detected_encoder)
656 return to_drm_encoder(nv_connector->detected_encoder);
662 nouveau_connector_set_polling(struct drm_connector *connector)
664 struct drm_device *dev = connector->dev;
665 struct drm_nouveau_private *dev_priv = dev->dev_private;
666 struct drm_crtc *crtc;
667 bool spare_crtc = false;
669 list_for_each_entry(crtc, &dev->mode_config.crtc_list, head)
670 spare_crtc |= !crtc->enabled;
672 connector->polled = 0;
674 switch (connector->connector_type) {
675 case DRM_MODE_CONNECTOR_VGA:
676 case DRM_MODE_CONNECTOR_TV:
677 if (dev_priv->card_type >= NV_50 ||
678 (nv_gf4_disp_arch(dev) && spare_crtc))
679 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
682 case DRM_MODE_CONNECTOR_DVII:
683 case DRM_MODE_CONNECTOR_DVID:
684 case DRM_MODE_CONNECTOR_HDMIA:
685 case DRM_MODE_CONNECTOR_DisplayPort:
686 case DRM_MODE_CONNECTOR_eDP:
687 if (dev_priv->card_type >= NV_50)
688 connector->polled = DRM_CONNECTOR_POLL_HPD;
689 else if (connector->connector_type == DRM_MODE_CONNECTOR_DVID ||
691 connector->polled = DRM_CONNECTOR_POLL_CONNECT;
699 static const struct drm_connector_helper_funcs
700 nouveau_connector_helper_funcs = {
701 .get_modes = nouveau_connector_get_modes,
702 .mode_valid = nouveau_connector_mode_valid,
703 .best_encoder = nouveau_connector_best_encoder,
706 static const struct drm_connector_funcs
707 nouveau_connector_funcs = {
708 .dpms = drm_helper_connector_dpms,
711 .detect = nouveau_connector_detect,
712 .destroy = nouveau_connector_destroy,
713 .fill_modes = drm_helper_probe_single_connector_modes,
714 .set_property = nouveau_connector_set_property,
715 .force = nouveau_connector_force
718 static const struct drm_connector_funcs
719 nouveau_connector_funcs_lvds = {
720 .dpms = drm_helper_connector_dpms,
723 .detect = nouveau_connector_detect_lvds,
724 .destroy = nouveau_connector_destroy,
725 .fill_modes = drm_helper_probe_single_connector_modes,
726 .set_property = nouveau_connector_set_property,
727 .force = nouveau_connector_force
730 struct drm_connector *
731 nouveau_connector_create(struct drm_device *dev, int index)
733 const struct drm_connector_funcs *funcs = &nouveau_connector_funcs;
734 struct drm_nouveau_private *dev_priv = dev->dev_private;
735 struct nouveau_connector *nv_connector = NULL;
736 struct dcb_connector_table_entry *dcb = NULL;
737 struct drm_connector *connector;
740 NV_DEBUG_KMS(dev, "\n");
742 if (index >= dev_priv->vbios.dcb.connector.entries)
743 return ERR_PTR(-EINVAL);
745 dcb = &dev_priv->vbios.dcb.connector.entry[index];
750 case DCB_CONNECTOR_VGA:
751 type = DRM_MODE_CONNECTOR_VGA;
753 case DCB_CONNECTOR_TV_0:
754 case DCB_CONNECTOR_TV_1:
755 case DCB_CONNECTOR_TV_3:
756 type = DRM_MODE_CONNECTOR_TV;
758 case DCB_CONNECTOR_DVI_I:
759 type = DRM_MODE_CONNECTOR_DVII;
761 case DCB_CONNECTOR_DVI_D:
762 type = DRM_MODE_CONNECTOR_DVID;
764 case DCB_CONNECTOR_HDMI_0:
765 case DCB_CONNECTOR_HDMI_1:
766 type = DRM_MODE_CONNECTOR_HDMIA;
768 case DCB_CONNECTOR_LVDS:
769 type = DRM_MODE_CONNECTOR_LVDS;
770 funcs = &nouveau_connector_funcs_lvds;
772 case DCB_CONNECTOR_DP:
773 type = DRM_MODE_CONNECTOR_DisplayPort;
775 case DCB_CONNECTOR_eDP:
776 type = DRM_MODE_CONNECTOR_eDP;
779 NV_ERROR(dev, "unknown connector type: 0x%02x!!\n", dcb->type);
780 return ERR_PTR(-EINVAL);
783 nv_connector = kzalloc(sizeof(*nv_connector), GFP_KERNEL);
785 return ERR_PTR(-ENOMEM);
786 nv_connector->dcb = dcb;
787 connector = &nv_connector->base;
789 /* defaults, will get overridden in detect() */
790 connector->interlace_allowed = false;
791 connector->doublescan_allowed = false;
793 drm_connector_init(dev, connector, funcs, type);
794 drm_connector_helper_add(connector, &nouveau_connector_helper_funcs);
796 /* Check if we need dithering enabled */
797 if (dcb->type == DCB_CONNECTOR_LVDS) {
798 bool dummy, is_24bit = false;
800 ret = nouveau_bios_parse_lvds_table(dev, 0, &dummy, &is_24bit);
802 NV_ERROR(dev, "Error parsing LVDS table, disabling "
807 nv_connector->use_dithering = !is_24bit;
810 /* Init DVI-I specific properties */
811 if (dcb->type == DCB_CONNECTOR_DVI_I) {
812 drm_mode_create_dvi_i_properties(dev);
813 drm_connector_attach_property(connector, dev->mode_config.dvi_i_subconnector_property, 0);
814 drm_connector_attach_property(connector, dev->mode_config.dvi_i_select_subconnector_property, 0);
818 case DCB_CONNECTOR_VGA:
819 if (dev_priv->card_type >= NV_50) {
820 drm_connector_attach_property(connector,
821 dev->mode_config.scaling_mode_property,
822 nv_connector->scaling_mode);
825 case DCB_CONNECTOR_TV_0:
826 case DCB_CONNECTOR_TV_1:
827 case DCB_CONNECTOR_TV_3:
828 nv_connector->scaling_mode = DRM_MODE_SCALE_NONE;
831 nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN;
833 drm_connector_attach_property(connector,
834 dev->mode_config.scaling_mode_property,
835 nv_connector->scaling_mode);
836 drm_connector_attach_property(connector,
837 dev->mode_config.dithering_mode_property,
838 nv_connector->use_dithering ?
839 DRM_MODE_DITHERING_ON : DRM_MODE_DITHERING_OFF);
843 nouveau_connector_set_polling(connector);
845 drm_sysfs_connector_add(connector);
846 dcb->drm = connector;
850 drm_connector_cleanup(connector);