Skip to content

Commit

Permalink
drm/nouveau/disp/dp: ensure sink is powered up before attempting link…
Browse files Browse the repository at this point in the history
… training

This can happen under some annoying circumstances, and is a quick fix
until more substantial changes can be made.

Fixed eDP mode changes on (at least) the Lenovo P50.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
Cc: stable@vger.kernel.org
  • Loading branch information
Ben Skeggs committed Feb 25, 2016
1 parent 870571a commit 95664e6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 0 deletions.
10 changes: 10 additions & 0 deletions drivers/gpu/drm/nouveau/nvkm/engine/disp/dport.c
Original file line number Diff line number Diff line change
Expand Up @@ -328,6 +328,7 @@ nvkm_dp_train(struct work_struct *w)
.outp = outp,
}, *dp = &_dp;
u32 datarate = 0;
u8 pwr;
int ret;

if (!outp->base.info.location && disp->func->sor.magic)
Expand Down Expand Up @@ -355,6 +356,15 @@ nvkm_dp_train(struct work_struct *w)
/* disable link interrupt handling during link training */
nvkm_notify_put(&outp->irq);

/* ensure sink is not in a low-power state */
if (!nvkm_rdaux(outp->aux, DPCD_SC00, &pwr, 1)) {
if ((pwr & DPCD_SC00_SET_POWER) != DPCD_SC00_SET_POWER_D0) {
pwr &= ~DPCD_SC00_SET_POWER;
pwr |= DPCD_SC00_SET_POWER_D0;
nvkm_wraux(outp->aux, DPCD_SC00, &pwr, 1);
}
}

/* enable down-spreading and execute pre-train script from vbios */
dp_link_train_init(dp, outp->dpcd[3] & 0x01);

Expand Down
6 changes: 6 additions & 0 deletions drivers/gpu/drm/nouveau/nvkm/engine/disp/dport.h
Original file line number Diff line number Diff line change
Expand Up @@ -71,5 +71,11 @@
#define DPCD_LS0C_LANE1_POST_CURSOR2 0x0c
#define DPCD_LS0C_LANE0_POST_CURSOR2 0x03

/* DPCD Sink Control */
#define DPCD_SC00 0x00600
#define DPCD_SC00_SET_POWER 0x03
#define DPCD_SC00_SET_POWER_D0 0x01
#define DPCD_SC00_SET_POWER_D3 0x03

void nvkm_dp_train(struct work_struct *);
#endif

0 comments on commit 95664e6

Please sign in to comment.