[Nouveau] [PATCH v3 4/6] kms/nv50: read out display max clocks

Karol Herbst kherbst at redhat.com
Fri Aug 3 12:19:37 UTC 2018


Signed-off-by: Karol Herbst <kherbst at redhat.com>
---
 drm/nouveau/dispnv50/core.h     |  9 +++++++++
 drm/nouveau/dispnv50/core907d.c |  5 +++++
 drm/nouveau/dispnv50/core957d.c | 20 +++++++++++++++++++-
 3 files changed, 33 insertions(+), 1 deletion(-)

diff --git a/drm/nouveau/dispnv50/core.h b/drm/nouveau/dispnv50/core.h
index 4738447a..4283d269 100644
--- a/drm/nouveau/dispnv50/core.h
+++ b/drm/nouveau/dispnv50/core.h
@@ -11,8 +11,17 @@ struct nv50_core {
 struct nv50_core_caps {
 	struct {
 		struct {
+			uint16_t max_mhz;
 			bool no_interlace;
 		} dp;
+
+		struct {
+			uint16_t max_mhz;
+		} lvds;
+
+		struct {
+			uint16_t max_mhz;
+		} tmds;
 	} sor[8];
 };
 
diff --git a/drm/nouveau/dispnv50/core907d.c b/drm/nouveau/dispnv50/core907d.c
index 854aa48e..79e5df31 100644
--- a/drm/nouveau/dispnv50/core907d.c
+++ b/drm/nouveau/dispnv50/core907d.c
@@ -37,6 +37,11 @@ core907d_caps_parse(struct nv50_disp *disp, struct nv50_core_caps *caps)
 	for (i = 0; i < 8; ++i) {
 		uint32_t data = nouveau_bo_rd32(disp->sync, 0x14 + i * 2);
 		caps->sor[i].dp.no_interlace |= !(data & (1 << 26));
+
+		data = nouveau_bo_rd32(disp->sync, 0x15 + i * 2);
+		caps->sor[i].dp.max_mhz = (data & 0xff) * 10;
+		caps->sor[i].tmds.max_mhz = ((data >> 16) & 0xff) * 10;
+		caps->sor[i].lvds.max_mhz = caps->sor[i].tmds.max_mhz;
 	}
 
 	return true;
diff --git a/drm/nouveau/dispnv50/core957d.c b/drm/nouveau/dispnv50/core957d.c
index a31b1941..bd03eb6e 100644
--- a/drm/nouveau/dispnv50/core957d.c
+++ b/drm/nouveau/dispnv50/core957d.c
@@ -22,6 +22,24 @@
 #include "core.h"
 #include "head.h"
 
+#include "nouveau_bo.h"
+
+static bool
+core957d_caps_parse(struct nv50_disp *disp, struct nv50_core_caps *caps)
+{
+	int i;
+
+	if (!core907d_caps_parse(disp, caps))
+		return false;
+
+	for (i = 0; i < 8; ++i) {
+		uint32_t data = nouveau_bo_rd32(disp->sync, 0x15 + i * 2);
+		caps->sor[i].lvds.max_mhz = (data >> 24) * 10;
+	}
+
+	return true;
+}
+
 static const struct nv50_core_func
 core957d = {
 	.init = core507d_init,
@@ -29,7 +47,7 @@ core957d = {
 	.ntfy_wait_done = core507d_ntfy_wait_done,
 	.update = core507d_update,
 	.caps_fetch = core507d_caps_fetch,
-	.caps_parse = core907d_caps_parse,
+	.caps_parse = core957d_caps_parse,
 	.head = &head917d,
 	.dac = &dac907d,
 	.sor = &sor907d,
-- 
2.17.1



More information about the Nouveau mailing list