Lines Matching refs:dp
71 ret = nvkm_rdaux(outp->dp.aux, addr, <->stat[0], 3); in nvkm_dp_train_sense()
80 ret = nvkm_rdaux(outp->dp.aux, addr, <->stat[4], 2); in nvkm_dp_train_sense()
85 ret = nvkm_rdaux(outp->dp.aux, DPCD_LS0C, <->pc2stat, 1); in nvkm_dp_train_sense()
110 for (i = 0; i < ior->dp.nr; i++) { in nvkm_dp_train_drive()
147 ior->func->dp->drive(ior, i, ocfg.pc, ocfg.dc, ocfg.pe, ocfg.tx_pu); in nvkm_dp_train_drive()
155 ret = nvkm_wraux(outp->dp.aux, addr, lt->conf, 4); in nvkm_dp_train_drive()
160 ret = nvkm_wraux(outp->dp.aux, DPCD_LC0F, lt->pc2conf, 2); in nvkm_dp_train_drive()
176 outp->ior->func->dp->pattern(outp->ior, pattern); in nvkm_dp_train_pattern()
183 nvkm_rdaux(outp->dp.aux, addr, &sink_tp, 1); in nvkm_dp_train_pattern()
191 nvkm_wraux(outp->dp.aux, addr, &sink_tp, 1); in nvkm_dp_train_pattern()
197 struct nvkm_i2c_aux *aux = lt->outp->dp.aux; in nvkm_dp_train_eq()
208 if (lt->outp->dp.dpcd[DPCD_RC00_DPCD_REV] >= 0x14 && in nvkm_dp_train_eq()
209 lt->outp->dp.dpcd[DPCD_RC03] & DPCD_RC03_TPS4_SUPPORTED) in nvkm_dp_train_eq()
212 if (lt->outp->dp.dpcd[DPCD_RC00_DPCD_REV] >= 0x12 && in nvkm_dp_train_eq()
213 lt->outp->dp.dpcd[DPCD_RC02] & DPCD_RC02_TPS3_SUPPORTED) in nvkm_dp_train_eq()
218 usec = (lt->outp->dp.dpcd[DPCD_RC0E] & DPCD_RC0E_AUX_RD_INTERVAL) * 4000; in nvkm_dp_train_eq()
228 for (i = 0; i < lt->outp->ior->dp.nr && eq_done; i++) { in nvkm_dp_train_eq()
250 if (lt->outp->dp.dpcd[DPCD_RC00_DPCD_REV] < 0x14 && !lt->repeater) in nvkm_dp_train_cr()
251 usec = (lt->outp->dp.dpcd[DPCD_RC0E] & DPCD_RC0E_AUX_RD_INTERVAL) * 4000; in nvkm_dp_train_cr()
259 for (i = 0; i < lt->outp->ior->dp.nr; i++) { in nvkm_dp_train_cr()
284 .pc2 = outp->dp.dpcd[DPCD_RC02] & DPCD_RC02_TPS3_SUPPORTED, in nvkm_dp_train_link()
289 OUTP_DBG(outp, "training %dx%02x", ior->dp.nr, ior->dp.bw); in nvkm_dp_train_link()
294 if (outp->dp.lttpr[0] >= 0x14) { in nvkm_dp_train_link()
296 nvkm_wraux(outp->dp.aux, DPCD_LTTPR_MODE, &data, sizeof(data)); in nvkm_dp_train_link()
298 if (outp->dp.lttprs) { in nvkm_dp_train_link()
300 nvkm_wraux(outp->dp.aux, DPCD_LTTPR_MODE, &data, sizeof(data)); in nvkm_dp_train_link()
301 lt.repeaters = outp->dp.lttprs; in nvkm_dp_train_link()
306 sink[0] = (outp->dp.rate[rate].dpcd < 0) ? ior->dp.bw : 0; in nvkm_dp_train_link()
307 sink[1] = ior->dp.nr; in nvkm_dp_train_link()
308 if (ior->dp.ef) in nvkm_dp_train_link()
311 ret = nvkm_wraux(outp->dp.aux, DPCD_LC00_LINK_BW_SET, sink, 2); in nvkm_dp_train_link()
315 if (outp->dp.rate[rate].dpcd >= 0) { in nvkm_dp_train_link()
316 ret = nvkm_rdaux(outp->dp.aux, DPCD_LC15_LINK_RATE_SET, &sink[0], sizeof(sink[0])); in nvkm_dp_train_link()
321 sink[0] |= outp->dp.rate[rate].dpcd; in nvkm_dp_train_link()
323 ret = nvkm_wraux(outp->dp.aux, DPCD_LC15_LINK_RATE_SET, &sink[0], sizeof(sink[0])); in nvkm_dp_train_link()
355 OUTP_DBG(outp, "programming link for %dx%02x", ior->dp.nr, ior->dp.bw); in nvkm_dp_train_links()
359 outp->dp.dpcd[DPCD_RC03] &= ~DPCD_RC03_TPS4_SUPPORTED; in nvkm_dp_train_links()
361 outp->dp.dpcd[DPCD_RC02] &= ~DPCD_RC02_TPS3_SUPPORTED; in nvkm_dp_train_links()
363 if (AMPERE_IED_HACK(disp) && (lnkcmp = outp->dp.info.script[0])) { in nvkm_dp_train_links()
365 while (ior->dp.bw < nvbios_rd08(bios, lnkcmp)) in nvkm_dp_train_links()
377 if ((lnkcmp = outp->dp.info.lnkcmp)) { in nvkm_dp_train_links()
378 if (outp->dp.version < 0x30) { in nvkm_dp_train_links()
379 while ((ior->dp.bw * 2700) < nvbios_rd16(bios, lnkcmp)) in nvkm_dp_train_links()
383 while (ior->dp.bw < nvbios_rd08(bios, lnkcmp)) in nvkm_dp_train_links()
395 ret = ior->func->dp->links(ior, outp->dp.aux); in nvkm_dp_train_links()
404 ior->func->dp->power(ior, ior->dp.nr); in nvkm_dp_train_links()
414 nvbios_init(&outp->disp->engine.subdev, outp->dp.info.script[1], in nvkm_dp_train_fini()
425 if (outp->dp.dpcd[DPCD_RC03] & DPCD_RC03_MAX_DOWNSPREAD) { in nvkm_dp_train_init()
426 nvbios_init(&outp->disp->engine.subdev, outp->dp.info.script[2], in nvkm_dp_train_init()
432 nvbios_init(&outp->disp->engine.subdev, outp->dp.info.script[3], in nvkm_dp_train_init()
441 nvbios_init(&outp->disp->engine.subdev, outp->dp.info.script[0], in nvkm_dp_train_init()
457 if (atomic_read(&outp->dp.lt.done)) { in nvkm_dp_train()
458 for (rate = 0; rate < outp->dp.rates; rate++) { in nvkm_dp_train()
459 if (outp->dp.rate[rate].rate == ior->dp.bw * 27000) in nvkm_dp_train()
467 if (!nvkm_rdaux(outp->dp.aux, DPCD_SC00, &pwr, 1)) { in nvkm_dp_train()
471 nvkm_wraux(outp->dp.aux, DPCD_SC00, &pwr, 1); in nvkm_dp_train()
475 ior->dp.mst = outp->dp.lt.mst; in nvkm_dp_train()
476 ior->dp.ef = outp->dp.dpcd[DPCD_RC02] & DPCD_RC02_ENHANCED_FRAME_CAP; in nvkm_dp_train()
477 ior->dp.nr = 0; in nvkm_dp_train()
484 if (outp->dp.lt.nr) { in nvkm_dp_train()
485 for (nr = outp->dp.links; ret < 0 && nr; nr >>= 1) { in nvkm_dp_train()
486 for (rate = 0; nr == outp->dp.lt.nr && rate < outp->dp.rates; rate++) { in nvkm_dp_train()
487 if (outp->dp.rate[rate].rate / 27000 == outp->dp.lt.bw) { in nvkm_dp_train()
488 ior->dp.bw = outp->dp.rate[rate].rate / 27000; in nvkm_dp_train()
489 ior->dp.nr = nr; in nvkm_dp_train()
497 for (nr = outp->dp.links; ret < 0 && nr; nr >>= 1) { in nvkm_dp_train()
498 for (rate = 0; ret < 0 && rate < outp->dp.rates; rate++) { in nvkm_dp_train()
499 if (outp->dp.rate[rate].rate * nr >= dataKBps || WARN_ON(!ior->dp.nr)) { in nvkm_dp_train()
501 ior->dp.bw = outp->dp.rate[rate].rate / 27000; in nvkm_dp_train()
502 ior->dp.nr = nr; in nvkm_dp_train()
514 atomic_set(&outp->dp.lt.done, 1); in nvkm_dp_train()
522 nvbios_init(&ior->disp->engine.subdev, outp->dp.info.script[4], in nvkm_dp_disable()
533 atomic_set(&outp->dp.lt.done, 0); in nvkm_dp_release()
534 outp->ior->dp.nr = 0; in nvkm_dp_release()
549 mutex_lock(&outp->dp.mutex); in nvkm_dp_acquire()
559 linkKBps = ior->dp.bw * 27000 * ior->dp.nr; in nvkm_dp_acquire()
562 dataKBps, linkKBps, ior->dp.mst, outp->dp.lt.mst); in nvkm_dp_acquire()
563 if (linkKBps < dataKBps || ior->dp.mst != outp->dp.lt.mst) { in nvkm_dp_acquire()
569 ret = nvkm_rdaux(outp->dp.aux, DPCD_LS02, stat, 3); in nvkm_dp_acquire()
576 for (i = 0; i < ior->dp.nr; i++) { in nvkm_dp_acquire()
591 if (retrain || !atomic_read(&outp->dp.lt.done)) in nvkm_dp_acquire()
593 mutex_unlock(&outp->dp.mutex); in nvkm_dp_acquire()
604 outp->dp.dpcd[DPCD_RC00_DPCD_REV] < 0x13 || in nvkm_dp_enable_supported_link_rates()
605 nvkm_rdaux(outp->dp.aux, DPCD_RC10_SUPPORTED_LINK_RATES(0), in nvkm_dp_enable_supported_link_rates()
612 if (!rate || WARN_ON(outp->dp.rates == ARRAY_SIZE(outp->dp.rate))) in nvkm_dp_enable_supported_link_rates()
620 for (j = 0; j < outp->dp.rates; j++) { in nvkm_dp_enable_supported_link_rates()
621 if (rate > outp->dp.rate[j].rate) { in nvkm_dp_enable_supported_link_rates()
622 for (k = outp->dp.rates; k > j; k--) in nvkm_dp_enable_supported_link_rates()
623 outp->dp.rate[k] = outp->dp.rate[k - 1]; in nvkm_dp_enable_supported_link_rates()
628 outp->dp.rate[j].dpcd = i / 2; in nvkm_dp_enable_supported_link_rates()
629 outp->dp.rate[j].rate = rate; in nvkm_dp_enable_supported_link_rates()
630 outp->dp.rates++; in nvkm_dp_enable_supported_link_rates()
633 for (i = 0; i < outp->dp.rates; i++) in nvkm_dp_enable_supported_link_rates()
634 OUTP_DBG(outp, "link_rate[%d] = %d", outp->dp.rate[i].dpcd, outp->dp.rate[i].rate); in nvkm_dp_enable_supported_link_rates()
636 return outp->dp.rates != 0; in nvkm_dp_enable_supported_link_rates()
646 struct nvkm_i2c_aux *aux = outp->dp.aux; in nvkm_dp_read_dpcd_caps()
650 ret = nvkm_rdaux(aux, DPCD_RC00_DPCD_REV, outp->dp.dpcd, DP_RECEIVER_CAP_SIZE); in nvkm_dp_read_dpcd_caps()
661 if (!(outp->dp.dpcd[DP_TRAINING_AUX_RD_INTERVAL] & in nvkm_dp_read_dpcd_caps()
669 if (outp->dp.dpcd[DP_DPCD_REV] > dpcd_ext[DP_DPCD_REV]) { in nvkm_dp_read_dpcd_caps()
671 outp->dp.dpcd[DP_DPCD_REV], dpcd_ext[DP_DPCD_REV]); in nvkm_dp_read_dpcd_caps()
675 if (!memcmp(outp->dp.dpcd, dpcd_ext, sizeof(dpcd_ext))) in nvkm_dp_read_dpcd_caps()
678 memcpy(outp->dp.dpcd, dpcd_ext, sizeof(dpcd_ext)); in nvkm_dp_read_dpcd_caps()
687 struct nvkm_i2c_aux *aux = outp->dp.aux; in nvkm_dp_enable()
689 if (auxpwr && !outp->dp.aux_pwr) { in nvkm_dp_enable()
698 outp->dp.aux_pwr_pu = true; in nvkm_dp_enable()
713 outp->dp.aux_pwr = true; in nvkm_dp_enable()
716 if (!nvkm_rdaux(aux, DPCD_LTTPR_REV, outp->dp.lttpr, sizeof(outp->dp.lttpr)) && in nvkm_dp_enable()
717 outp->dp.lttpr[0] >= 0x14 && outp->dp.lttpr[2]) { in nvkm_dp_enable()
718 switch (outp->dp.lttpr[2]) { in nvkm_dp_enable()
719 case 0x80: outp->dp.lttprs = 1; break; in nvkm_dp_enable()
720 case 0x40: outp->dp.lttprs = 2; break; in nvkm_dp_enable()
721 case 0x20: outp->dp.lttprs = 3; break; in nvkm_dp_enable()
722 case 0x10: outp->dp.lttprs = 4; break; in nvkm_dp_enable()
723 case 0x08: outp->dp.lttprs = 5; break; in nvkm_dp_enable()
724 case 0x04: outp->dp.lttprs = 6; break; in nvkm_dp_enable()
725 case 0x02: outp->dp.lttprs = 7; break; in nvkm_dp_enable()
726 case 0x01: outp->dp.lttprs = 8; break; in nvkm_dp_enable()
730 outp->dp.lttprs = 0; in nvkm_dp_enable()
735 memset(outp->dp.lttpr, 0x00, sizeof(outp->dp.lttpr)); in nvkm_dp_enable()
743 outp->dp.rates = 0; in nvkm_dp_enable()
744 outp->dp.links = outp->dp.dpcd[DPCD_RC02] & DPCD_RC02_MAX_LANE_COUNT; in nvkm_dp_enable()
745 outp->dp.links = min(outp->dp.links, outp->info.dpconf.link_nr); in nvkm_dp_enable()
746 if (outp->dp.lttprs && outp->dp.lttpr[4]) in nvkm_dp_enable()
747 outp->dp.links = min_t(int, outp->dp.links, outp->dp.lttpr[4]); in nvkm_dp_enable()
749 rate_max = outp->dp.dpcd[DPCD_RC01_MAX_LINK_RATE]; in nvkm_dp_enable()
751 if (outp->dp.lttprs && outp->dp.lttpr[1]) in nvkm_dp_enable()
752 rate_max = min_t(int, rate_max, outp->dp.lttpr[1]); in nvkm_dp_enable()
759 if (WARN_ON(outp->dp.rates == ARRAY_SIZE(outp->dp.rate))) in nvkm_dp_enable()
762 outp->dp.rate[outp->dp.rates].dpcd = -1; in nvkm_dp_enable()
763 outp->dp.rate[outp->dp.rates].rate = *rate * 27000; in nvkm_dp_enable()
764 outp->dp.rates++; in nvkm_dp_enable()
769 if (!auxpwr && outp->dp.aux_pwr) { in nvkm_dp_enable()
772 outp->dp.aux_pwr = false; in nvkm_dp_enable()
773 atomic_set(&outp->dp.lt.done, 0); in nvkm_dp_enable()
779 if (outp->dp.aux_pwr_pu) { in nvkm_dp_enable()
781 outp->dp.aux_pwr_pu = false; in nvkm_dp_enable()
796 nvkm_dp_enable(outp, outp->dp.enabled); in nvkm_dp_init()
832 outp->dp.aux = nvkm_i2c_aux_find(i2c, NVKM_I2C_AUX_CCB(dcbE->i2c_index)); in nvkm_dp_new()
834 outp->dp.aux = nvkm_i2c_aux_find(i2c, NVKM_I2C_AUX_EXT(dcbE->extdev)); in nvkm_dp_new()
835 if (!outp->dp.aux) { in nvkm_dp_new()
842 &outp->dp.version, &hdr, &cnt, &len, &outp->dp.info); in nvkm_dp_new()
848 OUTP_DBG(outp, "bios dp %02x %02x %02x %02x", outp->dp.version, hdr, cnt, len); in nvkm_dp_new()
850 mutex_init(&outp->dp.mutex); in nvkm_dp_new()
851 atomic_set(&outp->dp.lt.done, 0); in nvkm_dp_new()