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

Submitted by Karol Herbst on July 20, 2018, 3:17 p.m.

Details

Message ID 20180720151729.30291-5-kherbst@redhat.com
State New
Headers show
Series "improve feature detection" ( rev: 1 ) in Nouveau

Not browsing as part of any series.

Commit Message

Karol Herbst July 20, 2018, 3:17 p.m.
Signed-off-by: Karol Herbst <kherbst@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(-)

Patch hide | download patch | download mbox

diff --git a/drm/nouveau/dispnv50/core.h b/drm/nouveau/dispnv50/core.h
index a156be6e..60381362 100644
--- a/drm/nouveau/dispnv50/core.h
+++ b/drm/nouveau/dispnv50/core.h
@@ -10,8 +10,17 @@  struct nv50_core {
 
 struct nv50_core_caps {
 	struct {
+		uint16_t max_mhz;
 		bool no_interlace;
 	} dp[8];
+
+	struct {
+		uint16_t max_mhz;
+	} lvds[8];
+
+	struct {
+		uint16_t max_mhz;
+	} tmds[8];
 };
 
 int nv50_core_new(struct nouveau_drm *, struct nv50_core **);
diff --git a/drm/nouveau/dispnv50/core907d.c b/drm/nouveau/dispnv50/core907d.c
index 61dbdedc..22d8d2f7 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->dp[i].no_interlace |= !(data & (1 << 26));
+
+		data = nouveau_bo_rd32(disp->sync, 0x15 + i * 2);
+		caps->dp[i].max_mhz = (data & 0xff) * 10;
+		caps->tmds[i].max_mhz = ((data >> 16) & 0xff) * 10;
+		caps->lvds[i].max_mhz = caps->tmds[i].max_mhz;
 	}
 
 	return true;
diff --git a/drm/nouveau/dispnv50/core957d.c b/drm/nouveau/dispnv50/core957d.c
index a31b1941..9693cf22 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->lvds[i].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,