]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
drm/nouveau/disp/dp: only check for re-train when the link is active
authorBen Skeggs <bskeggs@redhat.com>
Fri, 19 May 2017 13:59:35 +0000 (23:59 +1000)
committerBen Skeggs <bskeggs@redhat.com>
Fri, 16 Jun 2017 04:04:52 +0000 (14:04 +1000)
An upcoming commit will limit link training to only when the sink is
meant to be displaying an image.

We still need IRQs enabled even when the link isn't trained (for MST
messages), but don't want to train the link unnecessarily.

Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/dp.h
drivers/gpu/drm/nouveau/nvkm/engine/disp/gf119.c
drivers/gpu/drm/nouveau/nvkm/engine/disp/nv50.c

index 090567d94876841afc1e6071452c9361288515c3..a67192ad5cf31a6e1cef3a5a7ceac08b25134ee6 100644 (file)
@@ -491,7 +491,13 @@ nvkm_dp_hpd(struct nvkm_notify *notify)
        struct nvif_notify_conn_rep_v0 rep = {};
 
        OUTP_DBG(&dp->outp, "HPD: %d", line->mask);
-       nvkm_dp_enable(dp, true);
+       if (line->mask & NVKM_I2C_IRQ) {
+               if (atomic_read(&dp->lt.done))
+                       nvkm_output_dp_train(&dp->outp, 0);
+               rep.mask |= NVIF_NOTIFY_CONN_V0_IRQ;
+       } else {
+               nvkm_dp_enable(dp, true);
+       }
 
        if (line->mask & NVKM_I2C_UNPLUG)
                rep.mask |= NVIF_NOTIFY_CONN_V0_UNPLUG;
@@ -502,30 +508,11 @@ nvkm_dp_hpd(struct nvkm_notify *notify)
        return NVKM_NOTIFY_KEEP;
 }
 
-static int
-nvkm_dp_irq(struct nvkm_notify *notify)
-{
-       const struct nvkm_i2c_ntfy_rep *line = notify->data;
-       struct nvkm_dp *dp = container_of(notify, typeof(*dp), irq);
-       struct nvkm_conn *conn = dp->outp.conn;
-       struct nvkm_disp *disp = dp->outp.disp;
-       struct nvif_notify_conn_rep_v0 rep = {
-               .mask = NVIF_NOTIFY_CONN_V0_IRQ,
-       };
-
-       OUTP_DBG(&dp->outp, "IRQ: %d", line->mask);
-       nvkm_output_dp_train(&dp->outp, 0);
-
-       nvkm_event_send(&disp->hpd, rep.mask, conn->index, &rep, sizeof(rep));
-       return NVKM_NOTIFY_KEEP;
-}
-
 static void
 nvkm_dp_fini(struct nvkm_outp *outp)
 {
        struct nvkm_dp *dp = nvkm_dp(outp);
        nvkm_notify_put(&dp->hpd);
-       nvkm_notify_put(&dp->irq);
        nvkm_dp_enable(dp, false);
 }
 
@@ -535,7 +522,6 @@ nvkm_dp_init(struct nvkm_outp *outp)
        struct nvkm_dp *dp = nvkm_dp(outp);
        nvkm_notify_put(&dp->outp.conn->hpd);
        nvkm_dp_enable(dp, true);
-       nvkm_notify_get(&dp->irq);
        nvkm_notify_get(&dp->hpd);
 }
 
@@ -544,7 +530,6 @@ nvkm_dp_dtor(struct nvkm_outp *outp)
 {
        struct nvkm_dp *dp = nvkm_dp(outp);
        nvkm_notify_fini(&dp->hpd);
-       nvkm_notify_fini(&dp->irq);
        return dp;
 }
 
@@ -588,27 +573,11 @@ nvkm_dp_ctor(struct nvkm_disp *disp, int index, struct dcb_output *dcbE,
        OUTP_DBG(&dp->outp, "bios dp %02x %02x %02x %02x",
                 dp->version, hdr, cnt, len);
 
-       /* link maintenance */
-       ret = nvkm_notify_init(NULL, &i2c->event, nvkm_dp_irq, true,
-                              &(struct nvkm_i2c_ntfy_req) {
-                               .mask = NVKM_I2C_IRQ,
-                               .port = dp->aux->id,
-                              },
-                              sizeof(struct nvkm_i2c_ntfy_req),
-                              sizeof(struct nvkm_i2c_ntfy_rep),
-                              &dp->irq);
-       if (ret) {
-               OUTP_ERR(&dp->outp, "error monitoring aux irq: %d", ret);
-               return ret;
-       }
-
-       mutex_init(&dp->mutex);
-       atomic_set(&dp->lt.done, 0);
-
        /* hotplug detect, replaces gpio-based mechanism with aux events */
        ret = nvkm_notify_init(NULL, &i2c->event, nvkm_dp_hpd, true,
                               &(struct nvkm_i2c_ntfy_req) {
-                               .mask = NVKM_I2C_PLUG | NVKM_I2C_UNPLUG,
+                               .mask = NVKM_I2C_PLUG | NVKM_I2C_UNPLUG |
+                                       NVKM_I2C_IRQ,
                                .port = dp->aux->id,
                               },
                               sizeof(struct nvkm_i2c_ntfy_req),
@@ -619,6 +588,8 @@ nvkm_dp_ctor(struct nvkm_disp *disp, int index, struct dcb_output *dcbE,
                return ret;
        }
 
+       mutex_init(&dp->mutex);
+       atomic_set(&dp->lt.done, 0);
        return 0;
 }
 
index 65d6b478eb5650b869ce26731328a93a8958c109..9d18aed75b105b4909572188aa2298d2d700cf49 100644 (file)
@@ -19,7 +19,6 @@ struct nvkm_dp {
 
        struct nvkm_i2c_aux *aux;
 
-       struct nvkm_notify irq;
        struct nvkm_notify hpd;
        bool present;
        u8 dpcd[16];
index 50dd13596939abef07dbcb09bad3c706aba462e9..94eb6b29e14cb7996155449c03fe9285d884d5b9 100644 (file)
@@ -201,9 +201,8 @@ gf119_disp_intr_unk2_0(struct nv50_disp *disp, int head)
                                .execute = 1,
                        };
 
-                       nvkm_notify_put(&outpdp->irq);
-                       nvbios_exec(&init);
                        atomic_set(&outpdp->lt.done, 0);
+                       nvbios_exec(&init);
                }
        }
 }
index bd67335d5466712e48e155bb9f6cf815fa2da95c..acc663061ceb911a753d1d13411aac0899ae9f5d 100644 (file)
@@ -661,9 +661,8 @@ nv50_disp_intr_unk20_0(struct nv50_disp *disp, int head)
                        .execute = 1,
                };
 
-               nvkm_notify_put(&outpdp->irq);
-               nvbios_exec(&init);
                atomic_set(&outpdp->lt.done, 0);
+               nvbios_exec(&init);
        }
 }