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 = nv_connector->base.dev;
93 NV_DEBUG_KMS(dev, "\n");
98 kfree(nv_connector->edid);
99 drm_sysfs_connector_remove(drm_connector);
100 drm_connector_cleanup(drm_connector);
101 kfree(drm_connector);
105 nouveau_connector_ddc_prepare(struct drm_connector *connector, int *flags)
107 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
109 if (dev_priv->card_type >= NV_50)
113 if (NVLockVgaCrtcs(dev_priv->dev, false))
115 if (nv_heads_tied(dev_priv->dev))
119 NVSetOwner(dev_priv->dev, 0); /* necessary? */
123 nouveau_connector_ddc_finish(struct drm_connector *connector, int flags)
125 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
127 if (dev_priv->card_type >= NV_50)
131 NVSetOwner(dev_priv->dev, 4);
133 NVLockVgaCrtcs(dev_priv->dev, true);
136 static struct nouveau_i2c_chan *
137 nouveau_connector_ddc_detect(struct drm_connector *connector,
138 struct nouveau_encoder **pnv_encoder)
140 struct drm_device *dev = connector->dev;
141 uint8_t out_buf[] = { 0x0, 0x0}, buf[2];
144 struct i2c_msg msgs[] = {
159 for (i = 0; i < DRM_CONNECTOR_MAX_ENCODER; i++) {
160 struct nouveau_i2c_chan *i2c = NULL;
161 struct nouveau_encoder *nv_encoder;
162 struct drm_mode_object *obj;
165 id = connector->encoder_ids[i];
169 obj = drm_mode_object_find(dev, id, DRM_MODE_OBJECT_ENCODER);
172 nv_encoder = nouveau_encoder(obj_to_encoder(obj));
174 if (nv_encoder->dcb->i2c_index < 0xf)
175 i2c = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);
179 nouveau_connector_ddc_prepare(connector, &flags);
180 ret = i2c_transfer(&i2c->adapter, msgs, 2);
181 nouveau_connector_ddc_finish(connector, flags);
184 *pnv_encoder = nv_encoder;
193 nouveau_connector_set_encoder(struct drm_connector *connector,
194 struct nouveau_encoder *nv_encoder)
196 struct nouveau_connector *nv_connector = nouveau_connector(connector);
197 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
198 struct drm_device *dev = connector->dev;
200 if (nv_connector->detected_encoder == nv_encoder)
202 nv_connector->detected_encoder = nv_encoder;
204 if (nv_encoder->dcb->type == OUTPUT_LVDS ||
205 nv_encoder->dcb->type == OUTPUT_TMDS) {
206 connector->doublescan_allowed = false;
207 connector->interlace_allowed = false;
209 connector->doublescan_allowed = true;
210 if (dev_priv->card_type == NV_20 ||
211 (dev_priv->card_type == NV_10 &&
212 (dev->pci_device & 0x0ff0) != 0x0100 &&
213 (dev->pci_device & 0x0ff0) != 0x0150))
215 connector->interlace_allowed = false;
217 connector->interlace_allowed = true;
220 if (connector->connector_type == DRM_MODE_CONNECTOR_DVII) {
221 drm_connector_property_set_value(connector,
222 dev->mode_config.dvi_i_subconnector_property,
223 nv_encoder->dcb->type == OUTPUT_TMDS ?
224 DRM_MODE_SUBCONNECTOR_DVID :
225 DRM_MODE_SUBCONNECTOR_DVIA);
229 static enum drm_connector_status
230 nouveau_connector_detect(struct drm_connector *connector)
232 struct drm_device *dev = connector->dev;
233 struct nouveau_connector *nv_connector = nouveau_connector(connector);
234 struct nouveau_encoder *nv_encoder = NULL;
235 struct nouveau_i2c_chan *i2c;
238 if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
239 nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS);
240 if (nv_encoder && nv_connector->native_mode) {
242 if (!nouveau_ignorelid && !acpi_lid_open())
243 return connector_status_disconnected;
245 nouveau_connector_set_encoder(connector, nv_encoder);
246 return connector_status_connected;
249 /* Cleanup the previous EDID block. */
250 if (nv_connector->edid) {
251 drm_mode_connector_update_edid_property(connector, NULL);
252 kfree(nv_connector->edid);
253 nv_connector->edid = NULL;
256 i2c = nouveau_connector_ddc_detect(connector, &nv_encoder);
258 nouveau_connector_ddc_prepare(connector, &flags);
259 nv_connector->edid = drm_get_edid(connector, &i2c->adapter);
260 nouveau_connector_ddc_finish(connector, flags);
261 drm_mode_connector_update_edid_property(connector,
263 if (!nv_connector->edid) {
264 NV_ERROR(dev, "DDC responded, but no EDID for %s\n",
265 drm_get_connector_name(connector));
269 if (nv_encoder->dcb->type == OUTPUT_DP &&
270 !nouveau_dp_detect(to_drm_encoder(nv_encoder))) {
271 NV_ERROR(dev, "Detected %s, but failed init\n",
272 drm_get_connector_name(connector));
273 return connector_status_disconnected;
276 /* Override encoder type for DVI-I based on whether EDID
277 * says the display is digital or analog, both use the
278 * same i2c channel so the value returned from ddc_detect
279 * isn't necessarily correct.
281 if (connector->connector_type == DRM_MODE_CONNECTOR_DVII) {
282 if (nv_connector->edid->input & DRM_EDID_INPUT_DIGITAL)
285 type = OUTPUT_ANALOG;
287 nv_encoder = find_encoder_by_type(connector, type);
289 NV_ERROR(dev, "Detected %d encoder on %s, "
290 "but no object!\n", type,
291 drm_get_connector_name(connector));
292 return connector_status_disconnected;
296 nouveau_connector_set_encoder(connector, nv_encoder);
297 return connector_status_connected;
301 nv_encoder = find_encoder_by_type(connector, OUTPUT_ANALOG);
303 nv_encoder = find_encoder_by_type(connector, OUTPUT_TV);
305 struct drm_encoder *encoder = to_drm_encoder(nv_encoder);
306 struct drm_encoder_helper_funcs *helper =
307 encoder->helper_private;
309 if (helper->detect(encoder, connector) ==
310 connector_status_connected) {
311 nouveau_connector_set_encoder(connector, nv_encoder);
312 return connector_status_connected;
317 return connector_status_disconnected;
321 nouveau_connector_force(struct drm_connector *connector)
323 struct drm_device *dev = connector->dev;
324 struct nouveau_encoder *nv_encoder;
327 if (connector->connector_type == DRM_MODE_CONNECTOR_DVII) {
328 if (connector->force == DRM_FORCE_ON_DIGITAL)
331 type = OUTPUT_ANALOG;
335 nv_encoder = find_encoder_by_type(connector, type);
337 NV_ERROR(dev, "can't find encoder to force %s on!\n",
338 drm_get_connector_name(connector));
339 connector->status = connector_status_disconnected;
343 nouveau_connector_set_encoder(connector, nv_encoder);
347 nouveau_connector_set_property(struct drm_connector *connector,
348 struct drm_property *property, uint64_t value)
350 struct nouveau_connector *nv_connector = nouveau_connector(connector);
351 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
352 struct drm_device *dev = connector->dev;
356 if (property == dev->mode_config.scaling_mode_property) {
357 struct nouveau_crtc *nv_crtc = NULL;
358 bool modeset = false;
361 case DRM_MODE_SCALE_NONE:
362 case DRM_MODE_SCALE_FULLSCREEN:
363 case DRM_MODE_SCALE_CENTER:
364 case DRM_MODE_SCALE_ASPECT:
370 /* LVDS always needs gpu scaling */
371 if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS &&
372 value == DRM_MODE_SCALE_NONE)
375 /* Changing between GPU and panel scaling requires a full
378 if ((nv_connector->scaling_mode == DRM_MODE_SCALE_NONE) ||
379 (value == DRM_MODE_SCALE_NONE))
381 nv_connector->scaling_mode = value;
383 if (connector->encoder && connector->encoder->crtc)
384 nv_crtc = nouveau_crtc(connector->encoder->crtc);
388 if (modeset || !nv_crtc->set_scale) {
389 ret = drm_crtc_helper_set_mode(&nv_crtc->base,
392 nv_crtc->base.y, NULL);
396 ret = nv_crtc->set_scale(nv_crtc, value, true);
405 if (property == dev->mode_config.dithering_mode_property) {
406 struct nouveau_crtc *nv_crtc = NULL;
408 if (value == DRM_MODE_DITHERING_ON)
409 nv_connector->use_dithering = true;
411 nv_connector->use_dithering = false;
413 if (connector->encoder && connector->encoder->crtc)
414 nv_crtc = nouveau_crtc(connector->encoder->crtc);
416 if (!nv_crtc || !nv_crtc->set_dither)
419 return nv_crtc->set_dither(nv_crtc, nv_connector->use_dithering,
423 if (nv_encoder && nv_encoder->dcb->type == OUTPUT_TV)
424 return get_slave_funcs(nv_encoder)->
425 set_property(to_drm_encoder(nv_encoder), connector, property, value);
430 static struct drm_display_mode *
431 nouveau_connector_native_mode(struct nouveau_connector *connector)
433 struct drm_device *dev = connector->base.dev;
434 struct drm_display_mode *mode, *largest = NULL;
435 int high_w = 0, high_h = 0, high_v = 0;
437 /* Use preferred mode if there is one.. */
438 list_for_each_entry(mode, &connector->base.probed_modes, head) {
439 if (mode->type & DRM_MODE_TYPE_PREFERRED) {
440 NV_DEBUG_KMS(dev, "native mode from preferred\n");
441 return drm_mode_duplicate(dev, mode);
445 /* Otherwise, take the resolution with the largest width, then height,
446 * then vertical refresh
448 list_for_each_entry(mode, &connector->base.probed_modes, head) {
449 if (mode->hdisplay < high_w)
452 if (mode->hdisplay == high_w && mode->vdisplay < high_h)
455 if (mode->hdisplay == high_w && mode->vdisplay == high_h &&
456 mode->vrefresh < high_v)
459 high_w = mode->hdisplay;
460 high_h = mode->vdisplay;
461 high_v = mode->vrefresh;
465 NV_DEBUG_KMS(dev, "native mode from largest: %dx%d@%d\n",
466 high_w, high_h, high_v);
467 return largest ? drm_mode_duplicate(dev, largest) : NULL;
475 static struct moderec scaler_modes[] = {
494 nouveau_connector_scaler_modes_add(struct drm_connector *connector)
496 struct nouveau_connector *nv_connector = nouveau_connector(connector);
497 struct drm_display_mode *native = nv_connector->native_mode, *m;
498 struct drm_device *dev = connector->dev;
499 struct moderec *mode = &scaler_modes[0];
505 while (mode->hdisplay) {
506 if (mode->hdisplay <= native->hdisplay &&
507 mode->vdisplay <= native->vdisplay) {
508 m = drm_cvt_mode(dev, mode->hdisplay, mode->vdisplay,
509 drm_mode_vrefresh(native), false,
514 m->type |= DRM_MODE_TYPE_DRIVER;
516 drm_mode_probed_add(connector, m);
527 nouveau_connector_get_modes(struct drm_connector *connector)
529 struct drm_device *dev = connector->dev;
530 struct nouveau_connector *nv_connector = nouveau_connector(connector);
531 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
534 /* If we're not LVDS, destroy the previous native mode, the attached
535 * monitor could have changed.
537 if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS &&
538 nv_connector->native_mode) {
539 drm_mode_destroy(dev, nv_connector->native_mode);
540 nv_connector->native_mode = NULL;
543 if (nv_connector->edid)
544 ret = drm_add_edid_modes(connector, nv_connector->edid);
546 /* Find the native mode if this is a digital panel, if we didn't
547 * find any modes through DDC previously add the native mode to
550 if (!nv_connector->native_mode)
551 nv_connector->native_mode =
552 nouveau_connector_native_mode(nv_connector);
553 if (ret == 0 && nv_connector->native_mode) {
554 struct drm_display_mode *mode;
556 mode = drm_mode_duplicate(dev, nv_connector->native_mode);
557 drm_mode_probed_add(connector, mode);
561 if (nv_encoder->dcb->type == OUTPUT_TV)
562 ret = get_slave_funcs(nv_encoder)->
563 get_modes(to_drm_encoder(nv_encoder), connector);
565 if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS)
566 ret += nouveau_connector_scaler_modes_add(connector);
572 nouveau_connector_mode_valid(struct drm_connector *connector,
573 struct drm_display_mode *mode)
575 struct drm_nouveau_private *dev_priv = connector->dev->dev_private;
576 struct nouveau_connector *nv_connector = nouveau_connector(connector);
577 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder;
578 unsigned min_clock = 25000, max_clock = min_clock;
579 unsigned clock = mode->clock;
581 switch (nv_encoder->dcb->type) {
583 BUG_ON(!nv_connector->native_mode);
584 if (mode->hdisplay > nv_connector->native_mode->hdisplay ||
585 mode->vdisplay > nv_connector->native_mode->vdisplay)
592 if ((dev_priv->card_type >= NV_50 && !nouveau_duallink) ||
593 (dev_priv->card_type < NV_50 &&
594 !nv_encoder->dcb->duallink_possible))
600 max_clock = nv_encoder->dcb->crtconf.maxfreq;
605 return get_slave_funcs(nv_encoder)->
606 mode_valid(to_drm_encoder(nv_encoder), mode);
608 if (nv_encoder->dp.link_bw == DP_LINK_BW_2_7)
609 max_clock = nv_encoder->dp.link_nr * 270000;
611 max_clock = nv_encoder->dp.link_nr * 162000;
617 if (clock < min_clock)
618 return MODE_CLOCK_LOW;
620 if (clock > max_clock)
621 return MODE_CLOCK_HIGH;
626 static struct drm_encoder *
627 nouveau_connector_best_encoder(struct drm_connector *connector)
629 struct nouveau_connector *nv_connector = nouveau_connector(connector);
631 if (nv_connector->detected_encoder)
632 return to_drm_encoder(nv_connector->detected_encoder);
637 static const struct drm_connector_helper_funcs
638 nouveau_connector_helper_funcs = {
639 .get_modes = nouveau_connector_get_modes,
640 .mode_valid = nouveau_connector_mode_valid,
641 .best_encoder = nouveau_connector_best_encoder,
644 static const struct drm_connector_funcs
645 nouveau_connector_funcs = {
646 .dpms = drm_helper_connector_dpms,
649 .detect = nouveau_connector_detect,
650 .destroy = nouveau_connector_destroy,
651 .fill_modes = drm_helper_probe_single_connector_modes,
652 .set_property = nouveau_connector_set_property,
653 .force = nouveau_connector_force
657 nouveau_connector_create_lvds(struct drm_device *dev,
658 struct drm_connector *connector)
660 struct nouveau_connector *nv_connector = nouveau_connector(connector);
661 struct drm_nouveau_private *dev_priv = dev->dev_private;
662 struct nouveau_i2c_chan *i2c = NULL;
663 struct nouveau_encoder *nv_encoder;
664 struct drm_display_mode native, *mode, *temp;
665 bool dummy, if_is_24bit = false;
668 nv_encoder = find_encoder_by_type(connector, OUTPUT_LVDS);
672 ret = nouveau_bios_parse_lvds_table(dev, 0, &dummy, &if_is_24bit);
674 NV_ERROR(dev, "Error parsing LVDS table, disabling LVDS\n");
677 nv_connector->use_dithering = !if_is_24bit;
679 /* Firstly try getting EDID over DDC, if allowed and I2C channel
682 if (!dev_priv->VBIOS.pub.fp_no_ddc && nv_encoder->dcb->i2c_index < 0xf)
683 i2c = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);
686 nouveau_connector_ddc_prepare(connector, &flags);
687 nv_connector->edid = drm_get_edid(connector, &i2c->adapter);
688 nouveau_connector_ddc_finish(connector, flags);
691 /* If no EDID found above, and the VBIOS indicates a hardcoded
692 * modeline is avalilable for the panel, set it as the panel's
693 * native mode and exit.
695 if (!nv_connector->edid && nouveau_bios_fp_mode(dev, &native) &&
696 (nv_encoder->dcb->lvdsconf.use_straps_for_mode ||
697 dev_priv->VBIOS.pub.fp_no_ddc)) {
698 nv_connector->native_mode = drm_mode_duplicate(dev, &native);
702 /* Still nothing, some VBIOS images have a hardcoded EDID block
703 * stored for the panel stored in them.
705 if (!nv_connector->edid && !nv_connector->native_mode &&
706 !dev_priv->VBIOS.pub.fp_no_ddc) {
708 (struct edid *)nouveau_bios_embedded_edid(dev);
710 nv_connector->edid = kmalloc(EDID_LENGTH, GFP_KERNEL);
711 *(nv_connector->edid) = *edid;
715 if (!nv_connector->edid)
718 /* We didn't find/use a panel mode from the VBIOS, so parse the EDID
719 * block and look for the preferred mode there.
721 ret = drm_add_edid_modes(connector, nv_connector->edid);
724 nv_connector->detected_encoder = nv_encoder;
725 nv_connector->native_mode = nouveau_connector_native_mode(nv_connector);
726 list_for_each_entry_safe(mode, temp, &connector->probed_modes, head)
727 drm_mode_remove(connector, mode);
730 if (!nv_connector->native_mode) {
731 NV_ERROR(dev, "LVDS present in DCB table, but couldn't "
732 "determine its native mode. Disabling.\n");
736 drm_mode_connector_update_edid_property(connector, nv_connector->edid);
741 nouveau_connector_create(struct drm_device *dev, int index, int type)
743 struct drm_nouveau_private *dev_priv = dev->dev_private;
744 struct nouveau_connector *nv_connector = NULL;
745 struct drm_connector *connector;
746 struct drm_encoder *encoder;
749 NV_DEBUG_KMS(dev, "\n");
751 nv_connector = kzalloc(sizeof(*nv_connector), GFP_KERNEL);
754 nv_connector->dcb = nouveau_bios_connector_entry(dev, index);
755 connector = &nv_connector->base;
758 case DRM_MODE_CONNECTOR_VGA:
759 NV_INFO(dev, "Detected a VGA connector\n");
761 case DRM_MODE_CONNECTOR_DVID:
762 NV_INFO(dev, "Detected a DVI-D connector\n");
764 case DRM_MODE_CONNECTOR_DVII:
765 NV_INFO(dev, "Detected a DVI-I connector\n");
767 case DRM_MODE_CONNECTOR_LVDS:
768 NV_INFO(dev, "Detected a LVDS connector\n");
770 case DRM_MODE_CONNECTOR_TV:
771 NV_INFO(dev, "Detected a TV connector\n");
773 case DRM_MODE_CONNECTOR_DisplayPort:
774 NV_INFO(dev, "Detected a DisplayPort connector\n");
777 NV_ERROR(dev, "Unknown connector, this is not good.\n");
781 /* defaults, will get overridden in detect() */
782 connector->interlace_allowed = false;
783 connector->doublescan_allowed = false;
785 drm_connector_init(dev, connector, &nouveau_connector_funcs, type);
786 drm_connector_helper_add(connector, &nouveau_connector_helper_funcs);
788 /* Init DVI-I specific properties */
789 if (type == DRM_MODE_CONNECTOR_DVII) {
790 drm_mode_create_dvi_i_properties(dev);
791 drm_connector_attach_property(connector, dev->mode_config.dvi_i_subconnector_property, 0);
792 drm_connector_attach_property(connector, dev->mode_config.dvi_i_select_subconnector_property, 0);
795 if (type != DRM_MODE_CONNECTOR_LVDS)
796 nv_connector->use_dithering = false;
798 if (type == DRM_MODE_CONNECTOR_DVID ||
799 type == DRM_MODE_CONNECTOR_DVII ||
800 type == DRM_MODE_CONNECTOR_LVDS ||
801 type == DRM_MODE_CONNECTOR_DisplayPort) {
802 nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN;
804 drm_connector_attach_property(connector, dev->mode_config.scaling_mode_property,
805 nv_connector->scaling_mode);
806 drm_connector_attach_property(connector, dev->mode_config.dithering_mode_property,
807 nv_connector->use_dithering ? DRM_MODE_DITHERING_ON
808 : DRM_MODE_DITHERING_OFF);
811 nv_connector->scaling_mode = DRM_MODE_SCALE_NONE;
813 if (type == DRM_MODE_CONNECTOR_VGA &&
814 dev_priv->card_type >= NV_50) {
815 drm_connector_attach_property(connector,
816 dev->mode_config.scaling_mode_property,
817 nv_connector->scaling_mode);
821 /* attach encoders */
822 list_for_each_entry(encoder, &dev->mode_config.encoder_list, head) {
823 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
825 if (nv_encoder->dcb->connector != index)
828 if (get_slave_funcs(nv_encoder))
829 get_slave_funcs(nv_encoder)->create_resources(encoder, connector);
831 drm_mode_connector_attach_encoder(connector, encoder);
834 drm_sysfs_connector_add(connector);
836 if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS) {
837 ret = nouveau_connector_create_lvds(dev, connector);
839 connector->funcs->destroy(connector);