Commit a002fece authored by Ben Skeggs's avatar Ben Skeggs

drm/nouveau/dp: pass in required datarate to link training

Not used currently, but it will be used in preference to pre-determined
lane/bandwidth numbers at a later point.
Signed-off-by: default avatarBen Skeggs <bskeggs@redhat.com>
parent a8e415d3
...@@ -507,7 +507,7 @@ nouveau_dp_link_train_commit(struct drm_encoder *encoder, uint8_t *config) ...@@ -507,7 +507,7 @@ nouveau_dp_link_train_commit(struct drm_encoder *encoder, uint8_t *config)
} }
bool bool
nouveau_dp_link_train(struct drm_encoder *encoder) nouveau_dp_link_train(struct drm_encoder *encoder, u32 datarate)
{ {
struct drm_device *dev = encoder->dev; struct drm_device *dev = encoder->dev;
struct drm_nouveau_private *dev_priv = dev->dev_private; struct drm_nouveau_private *dev_priv = dev->dev_private;
......
...@@ -1100,7 +1100,7 @@ int nouveau_ttm_mmap(struct file *, struct vm_area_struct *); ...@@ -1100,7 +1100,7 @@ int nouveau_ttm_mmap(struct file *, struct vm_area_struct *);
int nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr, int nouveau_dp_auxch(struct nouveau_i2c_chan *auxch, int cmd, int addr,
uint8_t *data, int data_nr); uint8_t *data, int data_nr);
bool nouveau_dp_detect(struct drm_encoder *); bool nouveau_dp_detect(struct drm_encoder *);
bool nouveau_dp_link_train(struct drm_encoder *); bool nouveau_dp_link_train(struct drm_encoder *, u32 datarate);
void nouveau_dp_tu_update(struct drm_device *, int, int, u32, u32); void nouveau_dp_tu_update(struct drm_device *, int, int, u32, u32);
/* nv04_fb.c */ /* nv04_fb.c */
......
...@@ -53,6 +53,7 @@ struct nouveau_encoder { ...@@ -53,6 +53,7 @@ struct nouveau_encoder {
int link_nr; int link_nr;
int link_bw; int link_bw;
bool enhanced_frame; bool enhanced_frame;
u32 datarate;
} dp; } dp;
}; };
}; };
......
...@@ -124,7 +124,7 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode) ...@@ -124,7 +124,7 @@ nv50_sor_dpms(struct drm_encoder *encoder, int mode)
if (mode == DRM_MODE_DPMS_ON) { if (mode == DRM_MODE_DPMS_ON) {
u8 status = DP_SET_POWER_D0; u8 status = DP_SET_POWER_D0;
nouveau_dp_auxch(auxch, 8, DP_SET_POWER, &status, 1); nouveau_dp_auxch(auxch, 8, DP_SET_POWER, &status, 1);
nouveau_dp_link_train(encoder); nouveau_dp_link_train(encoder, nv_encoder->dp.datarate);
} else { } else {
u8 status = DP_SET_POWER_D3; u8 status = DP_SET_POWER_D3;
nouveau_dp_auxch(auxch, 8, DP_SET_POWER, &status, 1); nouveau_dp_auxch(auxch, 8, DP_SET_POWER, &status, 1);
...@@ -194,8 +194,6 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, ...@@ -194,8 +194,6 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
NV_DEBUG_KMS(dev, "or %d type %d -> crtc %d\n", NV_DEBUG_KMS(dev, "or %d type %d -> crtc %d\n",
nv_encoder->or, nv_encoder->dcb->type, crtc->index); nv_encoder->or, nv_encoder->dcb->type, crtc->index);
nv50_sor_dpms(encoder, DRM_MODE_DPMS_ON);
switch (nv_encoder->dcb->type) { switch (nv_encoder->dcb->type) {
case OUTPUT_TMDS: case OUTPUT_TMDS:
if (nv_encoder->dcb->sorconf.link & 1) { if (nv_encoder->dcb->sorconf.link & 1) {
...@@ -208,10 +206,13 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, ...@@ -208,10 +206,13 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
break; break;
case OUTPUT_DP: case OUTPUT_DP:
nv_connector = nouveau_encoder_connector_get(nv_encoder); nv_connector = nouveau_encoder_connector_get(nv_encoder);
if (nv_connector && nv_connector->base.display_info.bpc == 6) if (nv_connector && nv_connector->base.display_info.bpc == 6) {
nv_encoder->dp.datarate = crtc->mode->clock * 18 / 8;
mode_ctl |= 0x00020000; mode_ctl |= 0x00020000;
else } else {
nv_encoder->dp.datarate = crtc->mode->clock * 24 / 8;
mode_ctl |= 0x00050000; mode_ctl |= 0x00050000;
}
if (nv_encoder->dcb->sorconf.link & 1) if (nv_encoder->dcb->sorconf.link & 1)
mode_ctl |= 0x00000800; mode_ctl |= 0x00000800;
...@@ -233,6 +234,8 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode, ...@@ -233,6 +234,8 @@ nv50_sor_mode_set(struct drm_encoder *encoder, struct drm_display_mode *mode,
if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC) if (adjusted_mode->flags & DRM_MODE_FLAG_NVSYNC)
mode_ctl |= NV50_EVO_SOR_MODE_CTRL_NVSYNC; mode_ctl |= NV50_EVO_SOR_MODE_CTRL_NVSYNC;
nv50_sor_dpms(encoder, DRM_MODE_DPMS_ON);
ret = RING_SPACE(evo, 2); ret = RING_SPACE(evo, 2);
if (ret) { if (ret) {
NV_ERROR(dev, "no space while connecting SOR\n"); NV_ERROR(dev, "no space while connecting SOR\n");
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment