Lines Matching +full:aux +full:- +full:bus

34 MODULE_PARM_DESC(mst, "Enable DisplayPort multi-stream (default: enabled)");
42 return drm_dp_read_sink_count_cap(connector, outp->dp.dpcd, &outp->dp.desc); in nouveau_dp_has_sink_count()
51 ret = nvif_outp_dp_aux_xfer(&outp->outp, DP_AUX_NATIVE_READ, &size, in nouveau_dp_probe_lttpr()
64 struct drm_connector *connector = &nv_connector->base; in nouveau_dp_probe_dpcd()
65 struct drm_dp_aux *aux = &nv_connector->aux; in nouveau_dp_probe_dpcd() local
69 u8 *dpcd = outp->dp.dpcd; in nouveau_dp_probe_dpcd()
71 outp->dp.lttpr.nr = 0; in nouveau_dp_probe_dpcd()
72 outp->dp.rate_nr = 0; in nouveau_dp_probe_dpcd()
73 outp->dp.link_nr = 0; in nouveau_dp_probe_dpcd()
74 outp->dp.link_bw = 0; in nouveau_dp_probe_dpcd()
76 if (connector->connector_type != DRM_MODE_CONNECTOR_eDP && in nouveau_dp_probe_dpcd()
78 !drm_dp_read_dpcd_caps(aux, dpcd) && in nouveau_dp_probe_dpcd()
79 !drm_dp_read_lttpr_common_caps(aux, dpcd, outp->dp.lttpr.caps)) { in nouveau_dp_probe_dpcd()
80 int nr = drm_dp_lttpr_count(outp->dp.lttpr.caps); in nouveau_dp_probe_dpcd()
83 drm_dp_dpcd_writeb(aux, DP_PHY_REPEATER_MODE, in nouveau_dp_probe_dpcd()
87 ret = drm_dp_dpcd_writeb(aux, DP_PHY_REPEATER_MODE, in nouveau_dp_probe_dpcd()
90 drm_dp_dpcd_writeb(aux, DP_PHY_REPEATER_MODE, in nouveau_dp_probe_dpcd()
93 outp->dp.lttpr.nr = nr; in nouveau_dp_probe_dpcd()
99 ret = drm_dp_read_dpcd_caps(aux, dpcd); in nouveau_dp_probe_dpcd()
103 outp->dp.link_nr = dpcd[DP_MAX_LANE_COUNT] & DP_MAX_LANE_COUNT_MASK; in nouveau_dp_probe_dpcd()
104 if (outp->dcb->dpconf.link_nr < outp->dp.link_nr) in nouveau_dp_probe_dpcd()
105 outp->dp.link_nr = outp->dcb->dpconf.link_nr; in nouveau_dp_probe_dpcd()
107 if (outp->dp.lttpr.nr) { in nouveau_dp_probe_dpcd()
108 int links = drm_dp_lttpr_max_lane_count(outp->dp.lttpr.caps); in nouveau_dp_probe_dpcd()
110 if (links && links < outp->dp.link_nr) in nouveau_dp_probe_dpcd()
111 outp->dp.link_nr = links; in nouveau_dp_probe_dpcd()
114 if (connector->connector_type == DRM_MODE_CONNECTOR_eDP && dpcd[DP_DPCD_REV] >= 0x13) { in nouveau_dp_probe_dpcd()
117 ret = drm_dp_dpcd_read(aux, DP_SUPPORTED_LINK_RATES, rates, sizeof(rates)); in nouveau_dp_probe_dpcd()
126 for (j = 0; j < outp->dp.rate_nr; j++) { in nouveau_dp_probe_dpcd()
127 if (rate > outp->dp.rate[j].rate) { in nouveau_dp_probe_dpcd()
128 for (int k = outp->dp.rate_nr; k > j; k--) in nouveau_dp_probe_dpcd()
129 outp->dp.rate[k] = outp->dp.rate[k - 1]; in nouveau_dp_probe_dpcd()
134 outp->dp.rate[j].dpcd = i; in nouveau_dp_probe_dpcd()
135 outp->dp.rate[j].rate = rate; in nouveau_dp_probe_dpcd()
136 outp->dp.rate_nr++; in nouveau_dp_probe_dpcd()
141 if (!outp->dp.rate_nr) { in nouveau_dp_probe_dpcd()
145 if (outp->dp.lttpr.nr) { in nouveau_dp_probe_dpcd()
146 int rate = drm_dp_lttpr_max_link_rate(outp->dp.lttpr.caps); in nouveau_dp_probe_dpcd()
152 max_rate = min_t(int, max_rate, outp->dcb->dpconf.link_bw); in nouveau_dp_probe_dpcd()
156 outp->dp.rate[outp->dp.rate_nr].dpcd = -1; in nouveau_dp_probe_dpcd()
157 outp->dp.rate[outp->dp.rate_nr].rate = rates[i]; in nouveau_dp_probe_dpcd()
158 outp->dp.rate_nr++; in nouveau_dp_probe_dpcd()
162 if (WARN_ON(!outp->dp.rate_nr)) in nouveau_dp_probe_dpcd()
166 ret = nvif_outp_dp_rates(&outp->outp, outp->dp.rate, outp->dp.rate_nr); in nouveau_dp_probe_dpcd()
170 for (int i = 0; i < outp->dp.rate_nr; i++) { in nouveau_dp_probe_dpcd()
171 u32 link_bw = outp->dp.rate[i].rate; in nouveau_dp_probe_dpcd()
173 if (link_bw > outp->dp.link_bw) in nouveau_dp_probe_dpcd()
174 outp->dp.link_bw = link_bw; in nouveau_dp_probe_dpcd()
177 ret = drm_dp_read_desc(aux, &outp->dp.desc, drm_dp_is_branch(dpcd)); in nouveau_dp_probe_dpcd()
182 mstm = outp->dp.mstm; in nouveau_dp_probe_dpcd()
184 mstm->can_mst = drm_dp_read_mst_cap(aux, dpcd) == DRM_DP_MST; in nouveau_dp_probe_dpcd()
188 ret = drm_dp_read_sink_count(aux); in nouveau_dp_probe_dpcd()
192 outp->dp.sink_count = ret; in nouveau_dp_probe_dpcd()
198 if (!outp->dp.sink_count) in nouveau_dp_probe_dpcd()
202 ret = drm_dp_read_downstream_info(aux, dpcd, in nouveau_dp_probe_dpcd()
203 outp->dp.downstream_ports); in nouveau_dp_probe_dpcd()
211 outp->dp.sink_count = 0; in nouveau_dp_probe_dpcd()
220 struct drm_device *dev = nv_encoder->base.base.dev; in nouveau_dp_detect()
222 struct drm_connector *connector = &nv_connector->base; in nouveau_dp_detect()
223 struct nv50_mstm *mstm = nv_encoder->dp.mstm; in nouveau_dp_detect()
225 u8 *dpcd = nv_encoder->dp.dpcd; in nouveau_dp_detect()
228 /* eDP ports don't support hotplugging - so there's no point in probing eDP ports unless we in nouveau_dp_detect()
231 if (connector->connector_type == DRM_MODE_CONNECTOR_eDP) { in nouveau_dp_detect()
232 if (connector->status == connector_status_connected) in nouveau_dp_detect()
234 else if (connector->status == connector_status_disconnected) in nouveau_dp_detect()
238 // Ensure that the aux bus is enabled for probing in nouveau_dp_detect()
239 drm_dp_dpcd_set_powered(&nv_connector->aux, true); in nouveau_dp_detect()
241 mutex_lock(&nv_encoder->dp.hpd_irq_lock); in nouveau_dp_detect()
247 if (mstm->suspended) { in nouveau_dp_detect()
248 if (mstm->is_mst) in nouveau_dp_detect()
250 else if (connector->status == in nouveau_dp_detect()
258 hpd = nvif_outp_detect(&nv_encoder->outp); in nouveau_dp_detect()
260 nvif_outp_dp_aux_pwr(&nv_encoder->outp, false); in nouveau_dp_detect()
263 nvif_outp_dp_aux_pwr(&nv_encoder->outp, true); in nouveau_dp_detect()
267 nvif_outp_dp_aux_pwr(&nv_encoder->outp, false); in nouveau_dp_detect()
272 if (mstm && mstm->can_mst && mstm->is_mst) { in nouveau_dp_detect()
278 for (int i = 0; i < nv_encoder->dp.rate_nr; i++) in nouveau_dp_detect()
279 NV_DEBUG(drm, "sink rate %d: %d\n", i, nv_encoder->dp.rate[i].rate); in nouveau_dp_detect()
281 NV_DEBUG(drm, "encoder: %dx%d\n", nv_encoder->dcb->dpconf.link_nr, in nouveau_dp_detect()
282 nv_encoder->dcb->dpconf.link_bw); in nouveau_dp_detect()
283 NV_DEBUG(drm, "maximum: %dx%d\n", nv_encoder->dp.link_nr, in nouveau_dp_detect()
284 nv_encoder->dp.link_bw); in nouveau_dp_detect()
286 if (mstm && mstm->can_mst) { in nouveau_dp_detect()
292 nvif_outp_dp_aux_pwr(&nv_encoder->outp, false); in nouveau_dp_detect()
299 if (mstm && !mstm->suspended && ret != NOUVEAU_DP_MST) in nouveau_dp_detect()
302 /* GSP doesn't like when we try to do aux transactions on a port it considers disconnected, in nouveau_dp_detect()
303 * and since we don't really have a usecase for that anyway - just disable the aux bus here in nouveau_dp_detect()
307 drm_dp_dpcd_set_powered(&nv_connector->aux, false); in nouveau_dp_detect()
309 mutex_unlock(&nv_encoder->dp.hpd_irq_lock); in nouveau_dp_detect()
316 struct drm_dp_aux *aux = &outp->conn->aux; in nouveau_dp_power_down() local
320 mutex_lock(&outp->dp.hpd_irq_lock); in nouveau_dp_power_down()
322 ret = drm_dp_dpcd_readb(aux, DP_SET_POWER, &pwr); in nouveau_dp_power_down()
326 drm_dp_dpcd_writeb(aux, DP_SET_POWER, pwr); in nouveau_dp_power_down()
329 outp->dp.lt.nr = 0; in nouveau_dp_power_down()
330 mutex_unlock(&outp->dp.hpd_irq_lock); in nouveau_dp_power_down()
336 struct drm_dp_aux *aux = &outp->conn->aux; in nouveau_dp_train_link() local
340 if ( (outp->dp.dpcd[DP_MAX_LANE_COUNT] & 0x20) && in nouveau_dp_train_link()
341 !(outp->dp.dpcd[DP_MAX_DOWNSPREAD] & DP_TPS4_SUPPORTED)) in nouveau_dp_train_link()
345 ret = nvif_outp_dp_train(&outp->outp, outp->dp.dpcd, in nouveau_dp_train_link()
346 outp->dp.lttpr.nr, in nouveau_dp_train_link()
347 outp->dp.lt.nr, in nouveau_dp_train_link()
348 outp->dp.lt.bw, in nouveau_dp_train_link()
349 outp->dp.lt.mst, in nouveau_dp_train_link()
360 ret = drm_dp_dpcd_read_phy_link_status(aux, DP_PHY_DPRX, stat); in nouveau_dp_train_link()
365 if (!drm_dp_channel_eq_ok(stat, outp->dp.lt.nr)) { in nouveau_dp_train_link()
377 ret = drm_dp_dpcd_read_phy_link_status(aux, DP_PHY_DPRX, stat); in nouveau_dp_train_link()
390 for (int i = 0; i < outp->dp.lt.nr; i++) { in nouveau_dp_train_link()
397 ret = nvif_outp_dp_drive(&outp->outp, outp->dp.lt.nr, pe, vs); in nouveau_dp_train_link()
405 if (drm_dp_dpcd_readb(aux, DP_LANE_COUNT_SET, &tmp) == 1) { in nouveau_dp_train_link()
407 drm_dp_dpcd_writeb(aux, DP_LANE_COUNT_SET, tmp); in nouveau_dp_train_link()
420 struct nouveau_drm *drm = nouveau_drm(outp->base.base.dev); in nouveau_dp_train()
421 struct drm_dp_aux *aux = &outp->conn->aux; in nouveau_dp_train() local
427 min_rate = outp->dp.link_nr * outp->dp.rate[0].rate; in nouveau_dp_train()
432 outp->base.base.name, mst, min_rate); in nouveau_dp_train()
434 mutex_lock(&outp->dp.hpd_irq_lock); in nouveau_dp_train()
436 if (drm_dp_dpcd_readb(aux, DP_SET_POWER, &pwr) == 1) { in nouveau_dp_train()
440 drm_dp_dpcd_writeb(aux, DP_SET_POWER, pwr); in nouveau_dp_train()
444 for (int nr = outp->dp.link_nr; nr; nr >>= 1) { in nouveau_dp_train()
445 for (int rate = 0; rate < outp->dp.rate_nr; rate++) { in nouveau_dp_train()
446 if (outp->dp.rate[rate].rate * nr >= min_rate) { in nouveau_dp_train()
447 outp->dp.lt.nr = nr; in nouveau_dp_train()
448 outp->dp.lt.bw = outp->dp.rate[rate].rate; in nouveau_dp_train()
449 outp->dp.lt.mst = mst; in nouveau_dp_train()
458 mutex_unlock(&outp->dp.hpd_irq_lock); in nouveau_dp_train()
467 if (!outp || !outp->dp.lt.nr) in nouveau_dp_link_check_locked()
470 if (drm_dp_dpcd_read_phy_link_status(&outp->conn->aux, DP_PHY_DPRX, link_status) < 0) in nouveau_dp_link_check_locked()
473 if (drm_dp_channel_eq_ok(link_status, outp->dp.lt.nr)) in nouveau_dp_link_check_locked()
482 struct nouveau_encoder *outp = nv_connector->dp_encoder; in nouveau_dp_link_check()
486 mutex_lock(&outp->dp.hpd_irq_lock); in nouveau_dp_link_check()
487 if (outp->dp.lt.nr) in nouveau_dp_link_check()
489 mutex_unlock(&outp->dp.hpd_irq_lock); in nouveau_dp_link_check()
500 struct drm_connector *connector = &nv_connector->base; in nouveau_dp_irq()
502 struct nouveau_drm *drm = nouveau_drm(outp->base.base.dev); in nouveau_dp_irq()
510 mstm = outp->dp.mstm; in nouveau_dp_irq()
511 NV_DEBUG(drm, "service %s\n", connector->name); in nouveau_dp_irq()
513 mutex_lock(&outp->dp.hpd_irq_lock); in nouveau_dp_irq()
515 if (mstm && mstm->is_mst) { in nouveau_dp_irq()
519 drm_dp_cec_irq(&nv_connector->aux); in nouveau_dp_irq()
522 ret = drm_dp_read_sink_count(&nv_connector->aux); in nouveau_dp_irq()
523 if (ret != outp->dp.sink_count) in nouveau_dp_irq()
526 outp->dp.sink_count = ret; in nouveau_dp_irq()
530 mutex_unlock(&outp->dp.hpd_irq_lock); in nouveau_dp_irq()
536 * - Validate against the DP caps advertised by the GPU (we don't check these
545 unsigned int max_rate, mode_rate, ds_max_dotclock, clock = mode->clock; in nv50_dp_mode_valid()
552 if (mode->flags & DRM_MODE_FLAG_INTERLACE && !outp->caps.dp_interlace) in nv50_dp_mode_valid()
555 if ((mode->flags & DRM_MODE_FLAG_3D_MASK) == DRM_MODE_FLAG_3D_FRAME_PACKING) in nv50_dp_mode_valid()
558 max_rate = outp->dp.link_nr * outp->dp.link_bw; in nv50_dp_mode_valid()
563 ds_max_dotclock = drm_dp_downstream_max_dotclock(outp->dp.dpcd, outp->dp.downstream_ports); in nv50_dp_mode_valid()