···160160 return ret;161161}162162163163-static int164164-auxch_rd(struct drm_encoder *encoder, int address, uint8_t *buf, int size)165165-{166166- struct drm_device *dev = encoder->dev;167167- struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);168168- struct nouveau_i2c_chan *auxch;169169- int ret;170170-171171- auxch = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);172172- if (!auxch)173173- return -ENODEV;174174-175175- ret = nouveau_dp_auxch(auxch, 9, address, buf, size);176176- if (ret)177177- return ret;178178-179179- return 0;180180-}181181-182163static u32183164dp_link_bw_get(struct drm_device *dev, int or, int link)184165{···279298 int crtc;280299 int or;281300 int link;282282- int enh_frame;301301+ u8 *dpcd;283302 int link_nr;284303 u32 link_bw;285304 u8 stat[6];···324343 /* configure lane count on the source */325344 dp_ctrl = ((1 << dp->link_nr) - 1) << 16;326345 sink[1] = dp->link_nr;327327- if (dp->enh_frame) {346346+ if (dp->dpcd[2] & DP_ENHANCED_FRAME_CAP) {328347 dp_ctrl |= 0x00004000;329348 sink[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN;330349 }···486505 const u32 *link_bw = bw_list;487506 struct dp_state dp;488507 u8 *bios, headerlen;489489- u16 script;490508491509 auxch = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);492510 if (!auxch)···500520 dp.auxch = auxch->rd;501521 dp.or = nv_encoder->or;502522 dp.link = !(nv_encoder->dcb->sorconf.link & 1);503503- dp.enh_frame = nv_encoder->dp.enhanced_frame;523523+ dp.dpcd = nv_encoder->dp.dpcd;504524505525 /* some sinks toggle hotplug in response to some of the actions506526 * we take during link training (DP_SET_POWER is one), we need507527 * to ignore them for the moment to avoid races.508528 */509529 pgpio->irq_enable(dev, nv_connector->dcb->gpio_tag, false);530530+531531+ /* enable down-spreading, if possible */532532+ if (headerlen >= 16) {533533+ u16 script = ROM16(bios[14]);534534+ if (nv_encoder->dp.dpcd[3] & 1)535535+ script = ROM16(bios[12]);536536+537537+ nouveau_bios_run_init_table(dev, script, dp.dcb, dp.crtc);538538+ }510539511540 /* execute pre-train script from vbios */512541 nouveau_bios_run_init_table(dev, ROM16(bios[6]), dp.dcb, dp.crtc);···564575{565576 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);566577 struct drm_device *dev = encoder->dev;567567- uint8_t dpcd[4];578578+ struct nouveau_i2c_chan *auxch;579579+ u8 *dpcd = nv_encoder->dp.dpcd;568580 int ret;569581570570- ret = auxch_rd(encoder, 0x0000, dpcd, 4);582582+ auxch = nouveau_i2c_find(dev, nv_encoder->dcb->i2c_index);583583+ if (!auxch)584584+ return false;585585+586586+ ret = auxch_tx(dev, auxch->rd, 9, DP_DPCD_REV, dpcd, 8);571587 if (ret)572588 return false;573589574574- nv_encoder->dp.dpcd_version = dpcd[0];575590 nv_encoder->dp.link_bw = 27000 * dpcd[1];576591 nv_encoder->dp.link_nr = dpcd[2] & DP_MAX_LANE_COUNT_MASK;577577- nv_encoder->dp.enhanced_frame = dpcd[2] & DP_ENHANCED_FRAME_CAP;578592579593 NV_DEBUG_KMS(dev, "display: %dx%d dpcd 0x%02x\n",580594 nv_encoder->dp.link_nr, nv_encoder->dp.link_bw, dpcd[0]);
+1-2
drivers/gpu/drm/nouveau/nouveau_encoder.h
···49495050 union {5151 struct {5252- int dpcd_version;5252+ u8 dpcd[8];5353 int link_nr;5454 int link_bw;5555- bool enhanced_frame;5655 u32 datarate;5756 } dp;5857 };