Lines Matching +full:native +full:- +full:mode

55 	const struct drm_connector_helper_funcs *helper = connector->helper_private;  in nouveau_conn_native_mode()
56 struct nouveau_drm *drm = nouveau_drm(connector->dev); in nouveau_conn_native_mode()
57 struct drm_device *dev = connector->dev; in nouveau_conn_native_mode()
58 struct drm_display_mode *mode, *largest = NULL; in nouveau_conn_native_mode() local
61 list_for_each_entry(mode, &connector->probed_modes, head) { in nouveau_conn_native_mode()
62 if (helper->mode_valid(connector, mode) != MODE_OK || in nouveau_conn_native_mode()
63 (mode->flags & DRM_MODE_FLAG_INTERLACE)) in nouveau_conn_native_mode()
66 /* Use preferred mode if there is one.. */ in nouveau_conn_native_mode()
67 if (mode->type & DRM_MODE_TYPE_PREFERRED) { in nouveau_conn_native_mode()
68 NV_DEBUG(drm, "native mode from preferred\n"); in nouveau_conn_native_mode()
69 return drm_mode_duplicate(dev, mode); in nouveau_conn_native_mode()
75 if (mode->hdisplay < high_w) in nouveau_conn_native_mode()
78 if (mode->hdisplay == high_w && mode->vdisplay < high_h) in nouveau_conn_native_mode()
81 if (mode->hdisplay == high_w && mode->vdisplay == high_h && in nouveau_conn_native_mode()
82 drm_mode_vrefresh(mode) < high_v) in nouveau_conn_native_mode()
85 high_w = mode->hdisplay; in nouveau_conn_native_mode()
86 high_h = mode->vdisplay; in nouveau_conn_native_mode()
87 high_v = drm_mode_vrefresh(mode); in nouveau_conn_native_mode()
88 largest = mode; in nouveau_conn_native_mode()
91 NV_DEBUG(drm, "native mode from largest: %dx%d@%d\n", in nouveau_conn_native_mode()
102 struct nouveau_display *disp = nouveau_display(connector->dev); in nouveau_conn_atomic_get_property()
103 struct drm_device *dev = connector->dev; in nouveau_conn_atomic_get_property()
105 if (property == dev->mode_config.scaling_mode_property) in nouveau_conn_atomic_get_property()
106 *val = asyc->scaler.mode; in nouveau_conn_atomic_get_property()
107 else if (property == disp->underscan_property) in nouveau_conn_atomic_get_property()
108 *val = asyc->scaler.underscan.mode; in nouveau_conn_atomic_get_property()
109 else if (property == disp->underscan_hborder_property) in nouveau_conn_atomic_get_property()
110 *val = asyc->scaler.underscan.hborder; in nouveau_conn_atomic_get_property()
111 else if (property == disp->underscan_vborder_property) in nouveau_conn_atomic_get_property()
112 *val = asyc->scaler.underscan.vborder; in nouveau_conn_atomic_get_property()
113 else if (property == disp->dithering_mode) in nouveau_conn_atomic_get_property()
114 *val = asyc->dither.mode; in nouveau_conn_atomic_get_property()
115 else if (property == disp->dithering_depth) in nouveau_conn_atomic_get_property()
116 *val = asyc->dither.depth; in nouveau_conn_atomic_get_property()
117 else if (property == disp->vibrant_hue_property) in nouveau_conn_atomic_get_property()
118 *val = asyc->procamp.vibrant_hue; in nouveau_conn_atomic_get_property()
119 else if (property == disp->color_vibrance_property) in nouveau_conn_atomic_get_property()
120 *val = asyc->procamp.color_vibrance; in nouveau_conn_atomic_get_property()
122 return -EINVAL; in nouveau_conn_atomic_get_property()
132 struct drm_device *dev = connector->dev; in nouveau_conn_atomic_set_property()
136 if (property == dev->mode_config.scaling_mode_property) { in nouveau_conn_atomic_set_property()
141 * rates, which people might want to use for power- in nouveau_conn_atomic_set_property()
144 * Non-EDID modes will force the use of GPU scaling in nouveau_conn_atomic_set_property()
145 * to the native mode regardless of this setting. in nouveau_conn_atomic_set_property()
147 switch (connector->connector_type) { in nouveau_conn_atomic_set_property()
153 if (disp->disp.object.oclass < NV50_DISP) in nouveau_conn_atomic_set_property()
154 return -EINVAL; in nouveau_conn_atomic_set_property()
165 return -EINVAL; in nouveau_conn_atomic_set_property()
168 if (asyc->scaler.mode != val) { in nouveau_conn_atomic_set_property()
169 asyc->scaler.mode = val; in nouveau_conn_atomic_set_property()
170 asyc->set.scaler = true; in nouveau_conn_atomic_set_property()
173 if (property == disp->underscan_property) { in nouveau_conn_atomic_set_property()
174 if (asyc->scaler.underscan.mode != val) { in nouveau_conn_atomic_set_property()
175 asyc->scaler.underscan.mode = val; in nouveau_conn_atomic_set_property()
176 asyc->set.scaler = true; in nouveau_conn_atomic_set_property()
179 if (property == disp->underscan_hborder_property) { in nouveau_conn_atomic_set_property()
180 if (asyc->scaler.underscan.hborder != val) { in nouveau_conn_atomic_set_property()
181 asyc->scaler.underscan.hborder = val; in nouveau_conn_atomic_set_property()
182 asyc->set.scaler = true; in nouveau_conn_atomic_set_property()
185 if (property == disp->underscan_vborder_property) { in nouveau_conn_atomic_set_property()
186 if (asyc->scaler.underscan.vborder != val) { in nouveau_conn_atomic_set_property()
187 asyc->scaler.underscan.vborder = val; in nouveau_conn_atomic_set_property()
188 asyc->set.scaler = true; in nouveau_conn_atomic_set_property()
191 if (property == disp->dithering_mode) { in nouveau_conn_atomic_set_property()
192 if (asyc->dither.mode != val) { in nouveau_conn_atomic_set_property()
193 asyc->dither.mode = val; in nouveau_conn_atomic_set_property()
194 asyc->set.dither = true; in nouveau_conn_atomic_set_property()
197 if (property == disp->dithering_depth) { in nouveau_conn_atomic_set_property()
198 if (asyc->dither.mode != val) { in nouveau_conn_atomic_set_property()
199 asyc->dither.depth = val; in nouveau_conn_atomic_set_property()
200 asyc->set.dither = true; in nouveau_conn_atomic_set_property()
203 if (property == disp->vibrant_hue_property) { in nouveau_conn_atomic_set_property()
204 if (asyc->procamp.vibrant_hue != val) { in nouveau_conn_atomic_set_property()
205 asyc->procamp.vibrant_hue = val; in nouveau_conn_atomic_set_property()
206 asyc->set.procamp = true; in nouveau_conn_atomic_set_property()
209 if (property == disp->color_vibrance_property) { in nouveau_conn_atomic_set_property()
210 if (asyc->procamp.color_vibrance != val) { in nouveau_conn_atomic_set_property()
211 asyc->procamp.color_vibrance = val; in nouveau_conn_atomic_set_property()
212 asyc->set.procamp = true; in nouveau_conn_atomic_set_property()
215 return -EINVAL; in nouveau_conn_atomic_set_property()
226 __drm_atomic_helper_connector_destroy_state(&asyc->state); in nouveau_conn_atomic_destroy_state()
233 struct nouveau_conn_atom *armc = nouveau_conn_atom(connector->state); in nouveau_conn_atomic_duplicate_state()
237 __drm_atomic_helper_connector_duplicate_state(connector, &asyc->state); in nouveau_conn_atomic_duplicate_state()
238 asyc->dither = armc->dither; in nouveau_conn_atomic_duplicate_state()
239 asyc->scaler = armc->scaler; in nouveau_conn_atomic_duplicate_state()
240 asyc->procamp = armc->procamp; in nouveau_conn_atomic_duplicate_state()
241 asyc->set.mask = 0; in nouveau_conn_atomic_duplicate_state()
242 return &asyc->state; in nouveau_conn_atomic_duplicate_state()
251 if (drm_drv_uses_atomic_modeset(connector->dev)) { in nouveau_conn_reset()
255 if (connector->state) in nouveau_conn_reset()
257 connector->state); in nouveau_conn_reset()
259 __drm_atomic_helper_connector_reset(connector, &asyc->state); in nouveau_conn_reset()
261 asyc = &nv_connector->properties_state; in nouveau_conn_reset()
264 asyc->dither.mode = DITHERING_MODE_AUTO; in nouveau_conn_reset()
265 asyc->dither.depth = DITHERING_DEPTH_AUTO; in nouveau_conn_reset()
266 asyc->scaler.mode = DRM_MODE_SCALE_NONE; in nouveau_conn_reset()
267 asyc->scaler.underscan.mode = UNDERSCAN_OFF; in nouveau_conn_reset()
268 asyc->procamp.color_vibrance = 150; in nouveau_conn_reset()
269 asyc->procamp.vibrant_hue = 90; in nouveau_conn_reset()
271 if (nouveau_display(connector->dev)->disp.object.oclass < NV50_DISP) { in nouveau_conn_reset()
272 switch (connector->connector_type) { in nouveau_conn_reset()
275 asyc->scaler.mode = DRM_MODE_SCALE_FULLSCREEN; in nouveau_conn_reset()
286 struct drm_device *dev = connector->dev; in nouveau_conn_attach_properties()
291 if (drm_drv_uses_atomic_modeset(connector->dev)) in nouveau_conn_attach_properties()
292 armc = nouveau_conn_atom(connector->state); in nouveau_conn_attach_properties()
294 armc = &nv_connector->properties_state; in nouveau_conn_attach_properties()
296 /* Init DVI-I specific properties. */ in nouveau_conn_attach_properties()
297 if (connector->connector_type == DRM_MODE_CONNECTOR_DVII) in nouveau_conn_attach_properties()
298 drm_object_attach_property(&connector->base, dev->mode_config. in nouveau_conn_attach_properties()
302 if (disp->underscan_property && in nouveau_conn_attach_properties()
303 (connector->connector_type == DRM_MODE_CONNECTOR_DVID || in nouveau_conn_attach_properties()
304 connector->connector_type == DRM_MODE_CONNECTOR_DVII || in nouveau_conn_attach_properties()
305 connector->connector_type == DRM_MODE_CONNECTOR_HDMIA || in nouveau_conn_attach_properties()
306 connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort)) { in nouveau_conn_attach_properties()
307 drm_object_attach_property(&connector->base, in nouveau_conn_attach_properties()
308 disp->underscan_property, in nouveau_conn_attach_properties()
310 drm_object_attach_property(&connector->base, in nouveau_conn_attach_properties()
311 disp->underscan_hborder_property, 0); in nouveau_conn_attach_properties()
312 drm_object_attach_property(&connector->base, in nouveau_conn_attach_properties()
313 disp->underscan_vborder_property, 0); in nouveau_conn_attach_properties()
317 if (disp->vibrant_hue_property) in nouveau_conn_attach_properties()
318 drm_object_attach_property(&connector->base, in nouveau_conn_attach_properties()
319 disp->vibrant_hue_property, in nouveau_conn_attach_properties()
320 armc->procamp.vibrant_hue); in nouveau_conn_attach_properties()
321 if (disp->color_vibrance_property) in nouveau_conn_attach_properties()
322 drm_object_attach_property(&connector->base, in nouveau_conn_attach_properties()
323 disp->color_vibrance_property, in nouveau_conn_attach_properties()
324 armc->procamp.color_vibrance); in nouveau_conn_attach_properties()
326 /* Scaling mode property. */ in nouveau_conn_attach_properties()
327 switch (connector->connector_type) { in nouveau_conn_attach_properties()
331 if (disp->disp.object.oclass < NV50_DISP) in nouveau_conn_attach_properties()
335 drm_object_attach_property(&connector->base, dev->mode_config. in nouveau_conn_attach_properties()
337 armc->scaler.mode); in nouveau_conn_attach_properties()
342 switch (connector->connector_type) { in nouveau_conn_attach_properties()
347 if (disp->dithering_mode) { in nouveau_conn_attach_properties()
348 drm_object_attach_property(&connector->base, in nouveau_conn_attach_properties()
349 disp->dithering_mode, in nouveau_conn_attach_properties()
350 armc->dither.mode); in nouveau_conn_attach_properties()
352 if (disp->dithering_depth) { in nouveau_conn_attach_properties()
353 drm_object_attach_property(&connector->base, in nouveau_conn_attach_properties()
354 disp->dithering_depth, in nouveau_conn_attach_properties()
355 armc->dither.depth); in nouveau_conn_attach_properties()
361 MODULE_PARM_DESC(tv_disable, "Disable TV-out detection");
369 MODULE_PARM_DESC(duallink, "Allow dual-link TMDS (default: enabled)");
387 (nv_encoder->dcb && nv_encoder->dcb->type == type)) in find_encoder()
398 nvif_event_dtor(&nv_connector->irq); in nouveau_connector_destroy()
399 nvif_event_dtor(&nv_connector->hpd); in nouveau_connector_destroy()
400 kfree(nv_connector->edid); in nouveau_connector_destroy()
403 if (nv_connector->aux.transfer) { in nouveau_connector_destroy()
404 drm_dp_cec_unregister_connector(&nv_connector->aux); in nouveau_connector_destroy()
405 kfree(nv_connector->aux.name); in nouveau_connector_destroy()
407 nvif_conn_dtor(&nv_connector->conn); in nouveau_connector_destroy()
414 struct drm_device *dev = connector->dev; in nouveau_connector_ddc_detect()
415 struct pci_dev *pdev = to_pci_dev(dev->dev); in nouveau_connector_ddc_detect()
424 switch (nv_encoder->dcb->type) { in nouveau_connector_ddc_detect()
439 if (!nv_encoder->i2c) in nouveau_connector_ddc_detect()
444 if (nvkm_probe_i2c(nv_encoder->i2c, 0x50)) in nouveau_connector_ddc_detect()
462 struct drm_device *dev = connector->dev; in nouveau_connector_of_detect()
465 struct pci_dev *pdev = to_pci_dev(dev->dev); in nouveau_connector_of_detect()
476 int idx = name ? name[strlen(name) - 1] - 'A' : 0; in nouveau_connector_of_detect()
478 if (nv_encoder->dcb->i2c_index == idx && edid) { in nouveau_connector_of_detect()
479 nv_connector->edid = in nouveau_connector_of_detect()
494 struct nouveau_drm *drm = nouveau_drm(connector->dev); in nouveau_connector_set_encoder()
495 struct drm_device *dev = connector->dev; in nouveau_connector_set_encoder()
496 struct pci_dev *pdev = to_pci_dev(dev->dev); in nouveau_connector_set_encoder()
498 if (nv_connector->detected_encoder == nv_encoder) in nouveau_connector_set_encoder()
500 nv_connector->detected_encoder = nv_encoder; in nouveau_connector_set_encoder()
502 if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_TESLA) { in nouveau_connector_set_encoder()
503 if (nv_encoder->dcb->type == DCB_OUTPUT_DP) in nouveau_connector_set_encoder()
504 connector->interlace_allowed = in nouveau_connector_set_encoder()
505 nv_encoder->caps.dp_interlace; in nouveau_connector_set_encoder()
507 connector->interlace_allowed = in nouveau_connector_set_encoder()
508 drm->client.device.info.family < NV_DEVICE_INFO_V0_VOLTA; in nouveau_connector_set_encoder()
509 connector->doublescan_allowed = true; in nouveau_connector_set_encoder()
511 if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS || in nouveau_connector_set_encoder()
512 nv_encoder->dcb->type == DCB_OUTPUT_TMDS) { in nouveau_connector_set_encoder()
513 connector->doublescan_allowed = false; in nouveau_connector_set_encoder()
514 connector->interlace_allowed = false; in nouveau_connector_set_encoder()
516 connector->doublescan_allowed = true; in nouveau_connector_set_encoder()
517 if (drm->client.device.info.family == NV_DEVICE_INFO_V0_KELVIN || in nouveau_connector_set_encoder()
518 (drm->client.device.info.family == NV_DEVICE_INFO_V0_CELSIUS && in nouveau_connector_set_encoder()
519 (pdev->device & 0x0ff0) != 0x0100 && in nouveau_connector_set_encoder()
520 (pdev->device & 0x0ff0) != 0x0150)) in nouveau_connector_set_encoder()
522 connector->interlace_allowed = false; in nouveau_connector_set_encoder()
524 connector->interlace_allowed = true; in nouveau_connector_set_encoder()
527 if (nv_connector->type == DCB_CONNECTOR_DVI_I) { in nouveau_connector_set_encoder()
528 drm_object_property_set_value(&connector->base, in nouveau_connector_set_encoder()
529 dev->mode_config.dvi_i_subconnector_property, in nouveau_connector_set_encoder()
530 nv_encoder->dcb->type == DCB_OUTPUT_TMDS ? in nouveau_connector_set_encoder()
540 if (nv_connector->edid != edid) { in nouveau_connector_set_edid()
541 struct edid *old_edid = nv_connector->edid; in nouveau_connector_set_edid()
543 drm_connector_update_edid_property(&nv_connector->base, edid); in nouveau_connector_set_edid()
545 nv_connector->edid = edid; in nouveau_connector_set_edid()
552 struct drm_device *dev = connector->dev; in nouveau_connector_detect()
569 pm_runtime_get_noresume(dev->dev); in nouveau_connector_detect()
571 ret = pm_runtime_get_sync(dev->dev); in nouveau_connector_detect()
572 if (ret < 0 && ret != -EACCES) { in nouveau_connector_detect()
573 pm_runtime_put_autosuspend(dev->dev); in nouveau_connector_detect()
580 if (nv_encoder && (i2c = nv_encoder->i2c) != NULL) { in nouveau_connector_detect()
585 nv_connector->type == DCB_CONNECTOR_LVDS) in nouveau_connector_detect()
591 if (!nv_connector->edid) { in nouveau_connector_detect()
593 connector->name); in nouveau_connector_detect()
597 /* Override encoder type for DVI-I based on whether EDID in nouveau_connector_detect()
603 if (nv_encoder->dcb->type == DCB_OUTPUT_TMDS) in nouveau_connector_detect()
605 if (nv_encoder->dcb->type == DCB_OUTPUT_ANALOG) in nouveau_connector_detect()
608 if (nv_partner && ((nv_encoder->dcb->type == DCB_OUTPUT_ANALOG && in nouveau_connector_detect()
609 nv_partner->dcb->type == DCB_OUTPUT_TMDS) || in nouveau_connector_detect()
610 (nv_encoder->dcb->type == DCB_OUTPUT_TMDS && in nouveau_connector_detect()
611 nv_partner->dcb->type == DCB_OUTPUT_ANALOG))) { in nouveau_connector_detect()
612 if (nv_connector->edid->input & DRM_EDID_INPUT_DIGITAL) in nouveau_connector_detect()
623 if (nv_encoder->dcb->type == DCB_OUTPUT_DP) in nouveau_connector_detect()
624 drm_dp_cec_set_edid(&nv_connector->aux, nv_connector->edid); in nouveau_connector_detect()
645 encoder->helper_private; in nouveau_connector_detect()
647 if (helper->detect(encoder, connector) == in nouveau_connector_detect()
656 if (!nv_connector->edid) in nouveau_connector_detect()
657 drm_dp_cec_unset_edid(&nv_connector->aux); in nouveau_connector_detect()
659 pm_runtime_mark_last_busy(dev->dev); in nouveau_connector_detect()
660 pm_runtime_put_autosuspend(dev->dev); in nouveau_connector_detect()
668 struct drm_device *dev = connector->dev; in nouveau_connector_detect_lvds()
680 if (!drm->vbios.fp_no_ddc) { in nouveau_connector_detect_lvds()
683 edid = nv_connector->edid; in nouveau_connector_detect_lvds()
694 * the nouveau decides an entry in the VBIOS FP mode table is in nouveau_connector_detect_lvds()
695 * valid - it's not (rh#613284) in nouveau_connector_detect_lvds()
697 if (nv_encoder->dcb->lvdsconf.use_acpi_for_edid) { in nouveau_connector_detect_lvds()
707 * native mode and exit. in nouveau_connector_detect_lvds()
709 if (nouveau_bios_fp_mode(dev, NULL) && (drm->vbios.fp_no_ddc || in nouveau_connector_detect_lvds()
710 nv_encoder->dcb->lvdsconf.use_straps_for_mode)) { in nouveau_connector_detect_lvds()
718 if (!drm->vbios.fp_no_ddc) { in nouveau_connector_detect_lvds()
744 struct nouveau_drm *drm = nouveau_drm(connector->dev); in nouveau_connector_force()
749 if (nv_connector->type == DCB_CONNECTOR_DVI_I) { in nouveau_connector_force()
750 if (connector->force == DRM_FORCE_ON_DIGITAL) in nouveau_connector_force()
760 connector->name); in nouveau_connector_force()
761 connector->status = connector_status_disconnected; in nouveau_connector_force()
773 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; in nouveau_connector_set_property()
774 struct nouveau_conn_atom *asyc = &nv_connector->properties_state; in nouveau_connector_set_property()
778 ret = connector->funcs->atomic_set_property(&nv_connector->base, in nouveau_connector_set_property()
779 &asyc->state, in nouveau_connector_set_property()
782 if (nv_encoder && nv_encoder->dcb->type == DCB_OUTPUT_TV) in nouveau_connector_set_property()
783 return get_slave_funcs(encoder)->set_property( in nouveau_connector_set_property()
788 nv_connector->scaling_mode = asyc->scaler.mode; in nouveau_connector_set_property()
789 nv_connector->dithering_mode = asyc->dither.mode; in nouveau_connector_set_property()
791 if (connector->encoder && connector->encoder->crtc) { in nouveau_connector_set_property()
792 ret = drm_crtc_helper_set_mode(connector->encoder->crtc, in nouveau_connector_set_property()
793 &connector->encoder->crtc->mode, in nouveau_connector_set_property()
794 connector->encoder->crtc->x, in nouveau_connector_set_property()
795 connector->encoder->crtc->y, in nouveau_connector_set_property()
798 return -EINVAL; in nouveau_connector_set_property()
831 struct drm_display_mode *native = nv_connector->native_mode, *m; in nouveau_connector_scaler_modes_add() local
832 struct drm_device *dev = connector->dev; in nouveau_connector_scaler_modes_add()
833 struct moderec *mode = &scaler_modes[0]; in nouveau_connector_scaler_modes_add() local
836 if (!native) in nouveau_connector_scaler_modes_add()
839 while (mode->hdisplay) { in nouveau_connector_scaler_modes_add()
840 if (mode->hdisplay <= native->hdisplay && in nouveau_connector_scaler_modes_add()
841 mode->vdisplay <= native->vdisplay && in nouveau_connector_scaler_modes_add()
842 (mode->hdisplay != native->hdisplay || in nouveau_connector_scaler_modes_add()
843 mode->vdisplay != native->vdisplay)) { in nouveau_connector_scaler_modes_add()
844 m = drm_cvt_mode(dev, mode->hdisplay, mode->vdisplay, in nouveau_connector_scaler_modes_add()
845 drm_mode_vrefresh(native), false, in nouveau_connector_scaler_modes_add()
854 mode++; in nouveau_connector_scaler_modes_add()
863 struct nouveau_drm *drm = nouveau_drm(connector->dev); in nouveau_connector_detect_depth()
865 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; in nouveau_connector_detect_depth()
866 struct nvbios *bios = &drm->vbios; in nouveau_connector_detect_depth()
867 struct drm_display_mode *mode = nv_connector->native_mode; in nouveau_connector_detect_depth() local
871 if (nv_connector->edid && connector->display_info.bpc) in nouveau_connector_detect_depth()
875 if (nv_connector->type == DCB_CONNECTOR_eDP) { in nouveau_connector_detect_depth()
876 connector->display_info.bpc = 6; in nouveau_connector_detect_depth()
881 if (nv_encoder->dcb->type != DCB_OUTPUT_LVDS) { in nouveau_connector_detect_depth()
882 connector->display_info.bpc = 8; in nouveau_connector_detect_depth()
886 connector->display_info.bpc = 6; in nouveau_connector_detect_depth()
889 if (bios->fp_no_ddc) { in nouveau_connector_detect_depth()
890 if (bios->fp.if_is_24bit) in nouveau_connector_detect_depth()
891 connector->display_info.bpc = 8; in nouveau_connector_detect_depth()
898 if (nv_connector->edid && in nouveau_connector_detect_depth()
899 nv_connector->type == DCB_CONNECTOR_LVDS_SPWG) in nouveau_connector_detect_depth()
900 duallink = ((u8 *)nv_connector->edid)[121] == 2; in nouveau_connector_detect_depth()
902 duallink = mode->clock >= bios->fp.duallink_transition_clk; in nouveau_connector_detect_depth()
904 if ((!duallink && (bios->fp.strapless_is_24bit & 1)) || in nouveau_connector_detect_depth()
905 ( duallink && (bios->fp.strapless_is_24bit & 2))) in nouveau_connector_detect_depth()
906 connector->display_info.bpc = 8; in nouveau_connector_detect_depth()
918 if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || in nouveau_connector_late_register()
919 connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) { in nouveau_connector_late_register()
920 ret = drm_dp_aux_register(&nouveau_connector(connector)->aux); in nouveau_connector_late_register()
934 if (connector->connector_type == DRM_MODE_CONNECTOR_eDP || in nouveau_connector_early_unregister()
935 connector->connector_type == DRM_MODE_CONNECTOR_DisplayPort) in nouveau_connector_early_unregister()
936 drm_dp_aux_unregister(&nouveau_connector(connector)->aux); in nouveau_connector_early_unregister()
944 struct drm_device *dev = connector->dev; in nouveau_connector_get_modes()
947 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; in nouveau_connector_get_modes()
951 /* destroy the native mode, the attached monitor could have changed. in nouveau_connector_get_modes()
953 if (nv_connector->native_mode) { in nouveau_connector_get_modes()
954 drm_mode_destroy(dev, nv_connector->native_mode); in nouveau_connector_get_modes()
955 nv_connector->native_mode = NULL; in nouveau_connector_get_modes()
958 if (nv_connector->edid) in nouveau_connector_get_modes()
959 ret = drm_add_edid_modes(connector, nv_connector->edid); in nouveau_connector_get_modes()
961 if (nv_encoder->dcb->type == DCB_OUTPUT_LVDS && in nouveau_connector_get_modes()
962 (nv_encoder->dcb->lvdsconf.use_straps_for_mode || in nouveau_connector_get_modes()
963 drm->vbios.fp_no_ddc) && nouveau_bios_fp_mode(dev, NULL)) { in nouveau_connector_get_modes()
964 struct drm_display_mode mode; in nouveau_connector_get_modes() local
966 nouveau_bios_fp_mode(dev, &mode); in nouveau_connector_get_modes()
967 nv_connector->native_mode = drm_mode_duplicate(dev, &mode); in nouveau_connector_get_modes()
973 if (connector->connector_type != DRM_MODE_CONNECTOR_LVDS) in nouveau_connector_get_modes()
976 /* Find the native mode if this is a digital panel, if we didn't in nouveau_connector_get_modes()
977 * find any modes through DDC previously add the native mode to in nouveau_connector_get_modes()
980 if (!nv_connector->native_mode) in nouveau_connector_get_modes()
981 nv_connector->native_mode = nouveau_conn_native_mode(connector); in nouveau_connector_get_modes()
982 if (ret == 0 && nv_connector->native_mode) { in nouveau_connector_get_modes()
983 struct drm_display_mode *mode; in nouveau_connector_get_modes() local
985 mode = drm_mode_duplicate(dev, nv_connector->native_mode); in nouveau_connector_get_modes()
986 if (!mode) in nouveau_connector_get_modes()
989 drm_mode_probed_add(connector, mode); in nouveau_connector_get_modes()
994 * "native" mode as some VBIOS tables require us to use the in nouveau_connector_get_modes()
997 if (connector->connector_type == DRM_MODE_CONNECTOR_LVDS && nv_connector->native_mode) in nouveau_connector_get_modes()
1000 if (nv_encoder->dcb->type == DCB_OUTPUT_TV) in nouveau_connector_get_modes()
1001 ret = get_slave_funcs(encoder)->get_modes(encoder, connector); in nouveau_connector_get_modes()
1003 if (nv_connector->type == DCB_CONNECTOR_LVDS || in nouveau_connector_get_modes()
1004 nv_connector->type == DCB_CONNECTOR_LVDS_SPWG || in nouveau_connector_get_modes()
1005 nv_connector->type == DCB_CONNECTOR_eDP) in nouveau_connector_get_modes()
1015 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; in get_tmds_link_bandwidth()
1016 struct nouveau_drm *drm = nouveau_drm(connector->dev); in get_tmds_link_bandwidth()
1017 struct dcb_output *dcb = nv_connector->detected_encoder->dcb; in get_tmds_link_bandwidth()
1020 nouveau_duallink && nv_encoder->dcb->duallink_possible ? 2 : 1; in get_tmds_link_bandwidth()
1022 if (drm_detect_hdmi_monitor(nv_connector->edid)) { in get_tmds_link_bandwidth()
1023 info = &nv_connector->base.display_info; in get_tmds_link_bandwidth()
1033 if (drm->client.device.info.chipset >= 0x120) { in get_tmds_link_bandwidth()
1035 info->hdmi.scdc.scrambling.supported ? in get_tmds_link_bandwidth()
1037 return info->max_tmds_clock ? in get_tmds_link_bandwidth()
1038 min(info->max_tmds_clock, max_tmds_clock) : in get_tmds_link_bandwidth()
1041 if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_KEPLER) in get_tmds_link_bandwidth()
1043 if (drm->client.device.info.family >= NV_DEVICE_INFO_V0_FERMI) in get_tmds_link_bandwidth()
1047 if (dcb->location != DCB_LOC_ON_CHIP || in get_tmds_link_bandwidth()
1048 drm->client.device.info.chipset >= 0x46) in get_tmds_link_bandwidth()
1050 else if (drm->client.device.info.chipset >= 0x40) in get_tmds_link_bandwidth()
1052 else if (drm->client.device.info.chipset >= 0x18) in get_tmds_link_bandwidth()
1060 struct drm_display_mode *mode) in nouveau_connector_mode_valid() argument
1063 struct nouveau_encoder *nv_encoder = nv_connector->detected_encoder; in nouveau_connector_mode_valid()
1065 unsigned int min_clock = 25000, max_clock = min_clock, clock = mode->clock; in nouveau_connector_mode_valid()
1067 switch (nv_encoder->dcb->type) { in nouveau_connector_mode_valid()
1069 if (nv_connector->native_mode && in nouveau_connector_mode_valid()
1070 (mode->hdisplay > nv_connector->native_mode->hdisplay || in nouveau_connector_mode_valid()
1071 mode->vdisplay > nv_connector->native_mode->vdisplay)) in nouveau_connector_mode_valid()
1081 max_clock = nv_encoder->dcb->crtconf.maxfreq; in nouveau_connector_mode_valid()
1086 return get_slave_funcs(encoder)->mode_valid(encoder, mode); in nouveau_connector_mode_valid()
1088 return nv50_dp_mode_valid(nv_encoder, mode, NULL); in nouveau_connector_mode_valid()
1094 if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING) in nouveau_connector_mode_valid()
1110 if (nv_connector->detected_encoder) in nouveau_connector_best_encoder()
1111 return to_drm_encoder(nv_connector->detected_encoder); in nouveau_connector_best_encoder()
1123 if (!nv_conn->dp_encoder || !nv50_has_mst(nouveau_drm(connector->dev))) in nouveau_connector_atomic_check()
1126 return drm_dp_mst_root_conn_atomic_check(conn_state, &nv_conn->dp_encoder->dp.mstm->mgr); in nouveau_connector_atomic_check()
1174 struct nouveau_drm *drm = nouveau_drm(nv_connector->base.dev); in nouveau_connector_hpd()
1175 u32 mask = drm_connector_mask(&nv_connector->base); in nouveau_connector_hpd()
1178 spin_lock_irqsave(&drm->hpd_lock, flags); in nouveau_connector_hpd()
1179 if (!(drm->hpd_pending & mask)) { in nouveau_connector_hpd()
1180 nv_connector->hpd_pending |= bits; in nouveau_connector_hpd()
1181 drm->hpd_pending |= mask; in nouveau_connector_hpd()
1182 schedule_work(&drm->hpd_work); in nouveau_connector_hpd()
1184 spin_unlock_irqrestore(&drm->hpd_lock, flags); in nouveau_connector_hpd()
1192 schedule_work(&nv_connector->irq_work); in nouveau_connector_irq()
1202 nouveau_connector_hpd(nv_connector, rep->types); in nouveau_connector_hotplug()
1213 u8 size = msg->size; in nouveau_connector_aux_xfer()
1216 nv_encoder = find_encoder(&nv_connector->base, DCB_OUTPUT_DP); in nouveau_connector_aux_xfer()
1217 if (!nv_encoder || !(aux = nv_encoder->aux)) in nouveau_connector_aux_xfer()
1218 return -ENODEV; in nouveau_connector_aux_xfer()
1219 if (WARN_ON(msg->size > 16)) in nouveau_connector_aux_xfer()
1220 return -E2BIG; in nouveau_connector_aux_xfer()
1226 ret = nvkm_i2c_aux_xfer(aux, false, msg->request, msg->address, in nouveau_connector_aux_xfer()
1227 msg->buffer, &size); in nouveau_connector_aux_xfer()
1230 msg->reply = ret; in nouveau_connector_aux_xfer()
1279 int index = dcbe->connector; in nouveau_connector_create()
1286 if (nv_connector->index == index) { in nouveau_connector_create()
1295 return ERR_PTR(-ENOMEM); in nouveau_connector_create()
1297 connector = &nv_connector->base; in nouveau_connector_create()
1298 nv_connector->index = index; in nouveau_connector_create()
1299 INIT_WORK(&nv_connector->irq_work, nouveau_dp_irq); in nouveau_connector_create()
1302 nv_connector->dcb = olddcb_conn(dev, index); in nouveau_connector_create()
1303 if (nv_connector->dcb) { in nouveau_connector_create()
1304 u32 entry = ROM16(nv_connector->dcb[0]); in nouveau_connector_create()
1306 entry |= (u32)ROM16(nv_connector->dcb[2]) << 16; in nouveau_connector_create()
1308 nv_connector->type = nv_connector->dcb[0]; in nouveau_connector_create()
1309 if (drm_conntype_from_dcb(nv_connector->type) == in nouveau_connector_create()
1312 nv_connector->type); in nouveau_connector_create()
1313 nv_connector->type = DCB_CONNECTOR_NONE; in nouveau_connector_create()
1318 if (nv_connector->type == DCB_CONNECTOR_HDMI_1) in nouveau_connector_create()
1319 nv_connector->type = DCB_CONNECTOR_DVI_I; in nouveau_connector_create()
1322 /* Gigabyte GV-NX86T512H */ in nouveau_connector_create()
1324 if (nv_connector->type == DCB_CONNECTOR_HDMI_1) in nouveau_connector_create()
1325 nv_connector->type = DCB_CONNECTOR_DVI_I; in nouveau_connector_create()
1328 nv_connector->type = DCB_CONNECTOR_NONE; in nouveau_connector_create()
1331 /* no vbios data, or an unknown dcb connector type - attempt to in nouveau_connector_create()
1334 if (nv_connector->type == DCB_CONNECTOR_NONE) { in nouveau_connector_create()
1336 struct dcb_table *dcbt = &drm->vbios.dcb; in nouveau_connector_create()
1340 for (i = 0; i < dcbt->entries; i++) { in nouveau_connector_create()
1341 if (dcbt->entry[i].connector == nv_connector->index) in nouveau_connector_create()
1342 encoders |= (1 << dcbt->entry[i].type); in nouveau_connector_create()
1347 nv_connector->type = DCB_CONNECTOR_DP; in nouveau_connector_create()
1349 nv_connector->type = DCB_CONNECTOR_eDP; in nouveau_connector_create()
1353 nv_connector->type = DCB_CONNECTOR_DVI_I; in nouveau_connector_create()
1355 nv_connector->type = DCB_CONNECTOR_DVI_D; in nouveau_connector_create()
1358 nv_connector->type = DCB_CONNECTOR_VGA; in nouveau_connector_create()
1361 nv_connector->type = DCB_CONNECTOR_LVDS; in nouveau_connector_create()
1364 nv_connector->type = DCB_CONNECTOR_TV_0; in nouveau_connector_create()
1368 switch ((type = drm_conntype_from_dcb(nv_connector->type))) { in nouveau_connector_create()
1381 nv_connector->aux.dev = connector->kdev; in nouveau_connector_create()
1382 nv_connector->aux.drm_dev = dev; in nouveau_connector_create()
1383 nv_connector->aux.transfer = nouveau_connector_aux_xfer; in nouveau_connector_create()
1384 snprintf(aux_name, sizeof(aux_name), "sor-%04x-%04x", in nouveau_connector_create()
1385 dcbe->hasht, dcbe->hashm); in nouveau_connector_create()
1386 nv_connector->aux.name = kstrdup(aux_name, GFP_KERNEL); in nouveau_connector_create()
1387 if (!nv_connector->aux.name) { in nouveau_connector_create()
1389 return ERR_PTR(-ENOMEM); in nouveau_connector_create()
1391 drm_dp_aux_init(&nv_connector->aux); in nouveau_connector_create()
1399 if ((disp->disp.object.oclass >= G82_DISP) in nouveau_connector_create()
1403 connector->stereo_allowed = true; in nouveau_connector_create()
1406 connector->interlace_allowed = false; in nouveau_connector_create()
1407 connector->doublescan_allowed = false; in nouveau_connector_create()
1411 connector->polled = DRM_CONNECTOR_POLL_CONNECT; in nouveau_connector_create()
1413 if (nv_connector->dcb && (disp->disp.conn_mask & BIT(nv_connector->index))) { in nouveau_connector_create()
1414 ret = nvif_conn_ctor(&disp->disp, nv_connector->base.name, nv_connector->index, in nouveau_connector_create()
1415 &nv_connector->conn); in nouveau_connector_create()
1420 ret = nvif_conn_event_ctor(&nv_connector->conn, "kmsHotplug", in nouveau_connector_create()
1423 &nv_connector->hpd); in nouveau_connector_create()
1425 connector->polled = DRM_CONNECTOR_POLL_HPD; in nouveau_connector_create()
1427 if (nv_connector->aux.transfer) { in nouveau_connector_create()
1428 ret = nvif_conn_event_ctor(&nv_connector->conn, "kmsDpIrq", in nouveau_connector_create()
1430 &nv_connector->irq); in nouveau_connector_create()
1432 nvif_event_dtor(&nv_connector->hpd); in nouveau_connector_create()
1433 nvif_conn_dtor(&nv_connector->conn); in nouveau_connector_create()
1439 connector->funcs->reset(connector); in nouveau_connector_create()
1442 /* Default scaling mode */ in nouveau_connector_create()
1443 switch (nv_connector->type) { in nouveau_connector_create()
1448 if (disp->disp.object.oclass < NV50_DISP) { in nouveau_connector_create()
1449 nv_connector->scaling_mode = DRM_MODE_SCALE_FULLSCREEN; in nouveau_connector_create()
1452 nv_connector->scaling_mode = DRM_MODE_SCALE_NONE; in nouveau_connector_create()
1455 nv_connector->scaling_mode = DRM_MODE_SCALE_NONE; in nouveau_connector_create()
1460 switch (nv_connector->type) { in nouveau_connector_create()
1467 nv_connector->dithering_mode = DITHERING_MODE_AUTO; in nouveau_connector_create()
1473 nv_connector->dp_encoder = find_encoder(&nv_connector->base, DCB_OUTPUT_DP); in nouveau_connector_create()
1476 drm_dp_cec_register_connector(&nv_connector->aux, connector); in nouveau_connector_create()