aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/nouveau/nouveau_dp.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/gpu/drm/nouveau/nouveau_dp.c')
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_dp.c41
1 files changed, 39 insertions, 2 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_dp.c b/drivers/gpu/drm/nouveau/nouveau_dp.c
index deeb21c6865c..33742b11188b 100644
--- a/drivers/gpu/drm/nouveau/nouveau_dp.c
+++ b/drivers/gpu/drm/nouveau/nouveau_dp.c
@@ -23,8 +23,10 @@
23 */ 23 */
24 24
25#include "drmP.h" 25#include "drmP.h"
26
26#include "nouveau_drv.h" 27#include "nouveau_drv.h"
27#include "nouveau_i2c.h" 28#include "nouveau_i2c.h"
29#include "nouveau_connector.h"
28#include "nouveau_encoder.h" 30#include "nouveau_encoder.h"
29 31
30static int 32static int
@@ -270,13 +272,39 @@ bool
270nouveau_dp_link_train(struct drm_encoder *encoder) 272nouveau_dp_link_train(struct drm_encoder *encoder)
271{ 273{
272 struct drm_device *dev = encoder->dev; 274 struct drm_device *dev = encoder->dev;
275 struct drm_nouveau_private *dev_priv = dev->dev_private;
276 struct nouveau_gpio_engine *pgpio = &dev_priv->engine.gpio;
273 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder); 277 struct nouveau_encoder *nv_encoder = nouveau_encoder(encoder);
274 uint8_t config[4]; 278 struct nouveau_connector *nv_connector;
275 uint8_t status[3]; 279 struct bit_displayport_encoder_table *dpe;
280 int dpe_headerlen;
281 uint8_t config[4], status[3];
276 bool cr_done, cr_max_vs, eq_done; 282 bool cr_done, cr_max_vs, eq_done;
277 int ret = 0, i, tries, voltage; 283 int ret = 0, i, tries, voltage;
278 284
279 NV_DEBUG_KMS(dev, "link training!!\n"); 285 NV_DEBUG_KMS(dev, "link training!!\n");
286
287 nv_connector = nouveau_encoder_connector_get(nv_encoder);
288 if (!nv_connector)
289 return false;
290
291 dpe = nouveau_bios_dp_table(dev, nv_encoder->dcb, &dpe_headerlen);
292 if (!dpe) {
293 NV_ERROR(dev, "SOR-%d: no DP encoder table!\n", nv_encoder->or);
294 return false;
295 }
296
297 /* disable hotplug detect, this flips around on some panels during
298 * link training.
299 */
300 pgpio->irq_enable(dev, nv_connector->dcb->gpio_tag, false);
301
302 if (dpe->script0) {
303 NV_DEBUG_KMS(dev, "SOR-%d: running DP script 0\n", nv_encoder->or);
304 nouveau_bios_run_init_table(dev, le16_to_cpu(dpe->script0),
305 nv_encoder->dcb);
306 }
307
280train: 308train:
281 cr_done = eq_done = false; 309 cr_done = eq_done = false;
282 310
@@ -403,6 +431,15 @@ stop:
403 } 431 }
404 } 432 }
405 433
434 if (dpe->script1) {
435 NV_DEBUG_KMS(dev, "SOR-%d: running DP script 1\n", nv_encoder->or);
436 nouveau_bios_run_init_table(dev, le16_to_cpu(dpe->script1),
437 nv_encoder->dcb);
438 }
439
440 /* re-enable hotplug detect */
441 pgpio->irq_enable(dev, nv_connector->dcb->gpio_tag, true);
442
406 return eq_done; 443 return eq_done;
407} 444}
408 445