0903551
From eb4668302adce316f53896b0fd8144ffe380a3ad Mon Sep 17 00:00:00 2001
0903551
From: Fedora Kernel Team <kernel-team@fedoraproject.org>
0903551
Date: Mon, 20 Jun 2016 14:52:06 +0200
0903551
Subject: [PATCH 4/6] drm/nouveau/disp/sor/gm107: training pattern registers
0903551
 are like gm200
0903551
0903551
Upstream: drm-fixes for 4.7 (and cc'd 4.6-stable)
0903551
commit 4691409b3e2250ed66aa8dcefa23fe765daf7add
0903551
0903551
Author:     Ben Skeggs <bskeggs@redhat.com>
0903551
AuthorDate: Fri Jun 3 15:05:52 2016 +1000
0903551
Commit:     Ben Skeggs <bskeggs@redhat.com>
0903551
CommitDate: Tue Jun 7 08:11:25 2016 +1000
0903551
0903551
    drm/nouveau/disp/sor/gm107: training pattern registers are like gm200
0903551
0903551
    Signed-off-by: Ben Skeggs <bskeggs@redhat.com>
0903551
    Cc: stable@vger.kernel.org
0903551
---
0903551
 drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild    |  1 +
0903551
 drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c   |  2 +-
0903551
 drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h  |  9 +++-
0903551
 .../gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c    |  2 +-
0903551
 .../nvkm/engine/disp/{gm107.c => sorgm107.c}       | 50 +++++++++++-----------
0903551
 .../gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c    | 15 +------
0903551
 6 files changed, 36 insertions(+), 43 deletions(-)
0903551
 copy drivers/gpu/drm/nouveau/nvkm/engine/disp/{gm107.c => sorgm107.c} (55%)
0903551
0903551
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
0903551
index a74c5dd..e2a64ed 100644
0903551
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
0903551
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/Kbuild
0903551
@@ -18,6 +18,7 @@ nvkm-y += nvkm/engine/disp/piornv50.o
0903551
 nvkm-y += nvkm/engine/disp/sornv50.o
0903551
 nvkm-y += nvkm/engine/disp/sorg94.o
0903551
 nvkm-y += nvkm/engine/disp/sorgf119.o
0903551
+nvkm-y += nvkm/engine/disp/sorgm107.o
0903551
 nvkm-y += nvkm/engine/disp/sorgm200.o
0903551
 nvkm-y += nvkm/engine/disp/dport.o
0903551
 
0903551
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c
0903551
index b694414..f4b9cf8 100644
0903551
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c
0903551
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c
0903551
@@ -36,7 +36,7 @@ gm107_disp = {
0903551
 	.outp.internal.crt = nv50_dac_output_new,
0903551
 	.outp.internal.tmds = nv50_sor_output_new,
0903551
 	.outp.internal.lvds = nv50_sor_output_new,
0903551
-	.outp.internal.dp = gf119_sor_dp_new,
0903551
+	.outp.internal.dp = gm107_sor_dp_new,
0903551
 	.dac.nr = 3,
0903551
 	.dac.power = nv50_dac_power,
0903551
 	.dac.sense = nv50_dac_sense,
0903551
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h
0903551
index e9067ba..4e983f6 100644
0903551
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h
0903551
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/outpdp.h
0903551
@@ -62,7 +62,12 @@ int g94_sor_dp_lnk_pwr(struct nvkm_output_dp *, int);
0903551
 int gf119_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *,
0903551
 		     struct nvkm_output **);
0903551
 int gf119_sor_dp_lnk_ctl(struct nvkm_output_dp *, int, int, bool);
0903551
+int gf119_sor_dp_drv_ctl(struct nvkm_output_dp *, int, int, int, int);
0903551
 
0903551
-int  gm200_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *,
0903551
-		      struct nvkm_output **);
0903551
+int gm107_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *,
0903551
+		     struct nvkm_output **);
0903551
+int gm107_sor_dp_pattern(struct nvkm_output_dp *, int);
0903551
+
0903551
+int gm200_sor_dp_new(struct nvkm_disp *, int, struct dcb_output *,
0903551
+		     struct nvkm_output **);
0903551
 #endif
0903551
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c
0903551
index 5111560..22706c0 100644
0903551
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c
0903551
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgf119.c
0903551
@@ -63,7 +63,7 @@ gf119_sor_dp_lnk_ctl(struct nvkm_output_dp *outp, int nr, int bw, bool ef)
0903551
 	return 0;
0903551
 }
0903551
 
0903551
-static int
0903551
+int
0903551
 gf119_sor_dp_drv_ctl(struct nvkm_output_dp *outp,
0903551
 		     int ln, int vs, int pe, int pc)
0903551
 {
0903551
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c
0903551
similarity index 55%
0903551
copy from drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c
0903551
copy to drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c
0903551
index b694414..37790b2 100644
0903551
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/gm107.c
0903551
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm107.c
0903551
@@ -1,5 +1,5 @@
0903551
 /*
0903551
- * Copyright 2012 Red Hat Inc.
0903551
+ * Copyright 2016 Red Hat Inc.
0903551
  *
0903551
  * Permission is hereby granted, free of charge, to any person obtaining a
0903551
  * copy of this software and associated documentation files (the "Software"),
0903551
@@ -19,35 +19,35 @@
0903551
  * ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
0903551
  * OTHER DEALINGS IN THE SOFTWARE.
0903551
  *
0903551
- * Authors: Ben Skeggs
0903551
+ * Authors: Ben Skeggs <bskeggs@redhat.com>
0903551
  */
0903551
 #include "nv50.h"
0903551
-#include "rootnv50.h"
0903551
+#include "outpdp.h"
0903551
 
0903551
-static const struct nv50_disp_func
0903551
-gm107_disp = {
0903551
-	.intr = gf119_disp_intr,
0903551
-	.uevent = &gf119_disp_chan_uevent,
0903551
-	.super = gf119_disp_intr_supervisor,
0903551
-	.root = &gm107_disp_root_oclass,
0903551
-	.head.vblank_init = gf119_disp_vblank_init,
0903551
-	.head.vblank_fini = gf119_disp_vblank_fini,
0903551
-	.head.scanoutpos = gf119_disp_root_scanoutpos,
0903551
-	.outp.internal.crt = nv50_dac_output_new,
0903551
-	.outp.internal.tmds = nv50_sor_output_new,
0903551
-	.outp.internal.lvds = nv50_sor_output_new,
0903551
-	.outp.internal.dp = gf119_sor_dp_new,
0903551
-	.dac.nr = 3,
0903551
-	.dac.power = nv50_dac_power,
0903551
-	.dac.sense = nv50_dac_sense,
0903551
-	.sor.nr = 4,
0903551
-	.sor.power = nv50_sor_power,
0903551
-	.sor.hda_eld = gf119_hda_eld,
0903551
-	.sor.hdmi = gk104_hdmi_ctrl,
0903551
+int
0903551
+gm107_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern)
0903551
+{
0903551
+	struct nvkm_device *device = outp->base.disp->engine.subdev.device;
0903551
+	const u32 soff = outp->base.or * 0x800;
0903551
+	const u32 data = 0x01010101 * pattern;
0903551
+	if (outp->base.info.sorconf.link & 1)
0903551
+		nvkm_mask(device, 0x61c110 + soff, 0x0f0f0f0f, data);
0903551
+	else
0903551
+		nvkm_mask(device, 0x61c12c + soff, 0x0f0f0f0f, data);
0903551
+	return 0;
0903551
+}
0903551
+
0903551
+static const struct nvkm_output_dp_func
0903551
+gm107_sor_dp_func = {
0903551
+	.pattern = gm107_sor_dp_pattern,
0903551
+	.lnk_pwr = g94_sor_dp_lnk_pwr,
0903551
+	.lnk_ctl = gf119_sor_dp_lnk_ctl,
0903551
+	.drv_ctl = gf119_sor_dp_drv_ctl,
0903551
 };
0903551
 
0903551
 int
0903551
-gm107_disp_new(struct nvkm_device *device, int index, struct nvkm_disp **pdisp)
0903551
+gm107_sor_dp_new(struct nvkm_disp *disp, int index,
0903551
+		 struct dcb_output *dcbE, struct nvkm_output **poutp)
0903551
 {
0903551
-	return gf119_disp_new_(&gm107_disp, device, index, pdisp);
0903551
+	return nvkm_output_dp_new_(&gm107_sor_dp_func, disp, index, dcbE, poutp);
0903551
 }
0903551
diff --git a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c
0903551
index 2cfbef9..c44fa7e 100644
0903551
--- a/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c
0903551
+++ b/drivers/gpu/drm/nouveau/nvkm/engine/disp/sorgm200.c
0903551
@@ -57,19 +57,6 @@ gm200_sor_dp_lane_map(struct nvkm_device *device, u8 lane)
0903551
 }
0903551
 
0903551
 static int
0903551
-gm200_sor_dp_pattern(struct nvkm_output_dp *outp, int pattern)
0903551
-{
0903551
-	struct nvkm_device *device = outp->base.disp->engine.subdev.device;
0903551
-	const u32 soff = gm200_sor_soff(outp);
0903551
-	const u32 data = 0x01010101 * pattern;
0903551
-	if (outp->base.info.sorconf.link & 1)
0903551
-		nvkm_mask(device, 0x61c110 + soff, 0x0f0f0f0f, data);
0903551
-	else
0903551
-		nvkm_mask(device, 0x61c12c + soff, 0x0f0f0f0f, data);
0903551
-	return 0;
0903551
-}
0903551
-
0903551
-static int
0903551
 gm200_sor_dp_lnk_pwr(struct nvkm_output_dp *outp, int nr)
0903551
 {
0903551
 	struct nvkm_device *device = outp->base.disp->engine.subdev.device;
0903551
@@ -129,7 +116,7 @@ gm200_sor_dp_drv_ctl(struct nvkm_output_dp *outp,
0903551
 
0903551
 static const struct nvkm_output_dp_func
0903551
 gm200_sor_dp_func = {
0903551
-	.pattern = gm200_sor_dp_pattern,
0903551
+	.pattern = gm107_sor_dp_pattern,
0903551
 	.lnk_pwr = gm200_sor_dp_lnk_pwr,
0903551
 	.lnk_ctl = gf119_sor_dp_lnk_ctl,
0903551
 	.drv_ctl = gm200_sor_dp_drv_ctl,
0903551
-- 
0903551
2.7.4
0903551