Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

drm/nouveau/dp: execute some more vbios tables relating to link rate

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>

+21 -5
+21 -5
drivers/gpu/drm/nouveau/nouveau_dp.c
··· 308 308 static void 309 309 dp_set_link_config(struct drm_device *dev, struct dp_state *dp) 310 310 { 311 + struct drm_nouveau_private *dev_priv = dev->dev_private; 311 312 int or = dp->or, link = dp->link; 312 - u32 clk_sor, dp_ctrl; 313 - u8 sink[2]; 313 + u8 *bios, headerlen, sink[2]; 314 + u32 dp_ctrl; 314 315 315 316 NV_DEBUG_KMS(dev, "%d lanes at %d KB/s\n", dp->link_nr, dp->link_bw); 316 317 318 + /* set selected link rate on source */ 317 319 switch (dp->link_bw) { 318 320 case 270000: 319 - clk_sor = 0x00040000; 321 + nv_mask(dev, 0x614300 + (or * 0x800), 0x000c0000, 0x00040000); 320 322 sink[0] = DP_LINK_BW_2_7; 321 323 break; 322 324 default: 323 - clk_sor = 0x00000000; 325 + nv_mask(dev, 0x614300 + (or * 0x800), 0x000c0000, 0x00000000); 324 326 sink[0] = DP_LINK_BW_1_62; 325 327 break; 326 328 } 327 329 330 + /* offset +0x0a of each dp encoder table entry is a pointer to another 331 + * table, that has (among other things) pointers to more scripts that 332 + * need to be executed, this time depending on link speed. 333 + */ 334 + bios = nouveau_bios_dp_table(dev, dp->dcb, &headerlen); 335 + if (bios && (bios = ROMPTR(&dev_priv->vbios, bios[10]))) { 336 + u16 script = ROM16(bios[2]); 337 + if (dp->link_bw != 270000) 338 + script = ROM16(bios[6]); 339 + 340 + nouveau_bios_run_init_table(dev, script, dp->dcb, dp->crtc); 341 + } 342 + 343 + /* configure lane count on the source */ 328 344 dp_ctrl = ((1 << dp->link_nr) - 1) << 16; 329 345 sink[1] = dp->link_nr; 330 346 if (dp->enh_frame) { ··· 348 332 sink[1] |= DP_LANE_COUNT_ENHANCED_FRAME_EN; 349 333 } 350 334 351 - nv_mask(dev, 0x614300 + (or * 0x800), 0x000c0000, clk_sor); 352 335 nv_mask(dev, NV50_SOR_DP_CTRL(or, link), 0x001f4000, dp_ctrl); 353 336 337 + /* inform the sink of the new configuration */ 354 338 auxch_tx(dev, dp->auxch, 8, DP_LINK_BW_SET, sink, 2); 355 339 } 356 340