[Nouveau] [PATCH 6/6] kms/nv50: detect LVDS max MHz correctly

Karol Herbst
2018-07-20T15:17:29Z

drm/nouveau/dispnv50/disp.c     | 5 ++++-
 drm/nouveau/nouveau_connector.c | 5 ++++-
 drm/nouveau/nouveau_encoder.h   | 4 ++++
 3 files changed, 12 insertions(+), 2 deletions(-)

diff --git a/drm/nouveau/dispnv50/disp.c b/drm/nouveau/dispnv50/disp.c
index 3a960664..96fc8915 100644
--- a/drm/nouveau/dispnv50/disp.c
+++ b/drm/nouveau/dispnv50/disp.c
@@ -1430,7 +1430,10 @@ nv50_sor_create(struct drm_connector *connector, struct
dcb_output *dcbe,
 	nv_encoder->update = nv50_sor_update;

 	switch (dcbe->type) {
-	case DCB_OUTPUT_LVDS: type = DRM_MODE_ENCODER_LVDS; break;
+	case DCB_OUTPUT_LVDS:
+		nv_encoder->lvds.max_mhz = caps->lvds[or].max_mhz;
+		type = DRM_MODE_ENCODER_LVDS;
+		break;
 	case DCB_OUTPUT_DP:
 		nv_encoder->dp.no_interlace = caps->dp[or].no_interlace;
 		type = DRM_MODE_ENCODER_TMDS;
diff --git a/drm/nouveau/nouveau_connector.c b/drm/nouveau/nouveau_connector.c
index a955f225..946cc624 100644
--- a/drm/nouveau/nouveau_connector.c
+++ b/drm/nouveau/nouveau_connector.c
@@ -1029,7 +1029,10 @@ nouveau_connector_mode_valid(struct drm_connector
*connector,
 			return MODE_PANEL;

 		min_clock = 0;
-		max_clock = 400000;
+		if (nv_encoder->lvds.max_mhz)
+			max_clock = nv_encoder->lvds.max_mhz * 1000;
+		else
+			max_clock = 400000;
 		break;
 	case DCB_OUTPUT_TMDS:
 		hdmi = drm_detect_hdmi_monitor(nv_connector->edid);
diff --git a/drm/nouveau/nouveau_encoder.h b/drm/nouveau/nouveau_encoder.h
index fbef9dc0..6961bdfc 100644
--- a/drm/nouveau/nouveau_encoder.h
+++ b/drm/nouveau/nouveau_encoder.h
@@ -66,6 +66,10 @@ struct nouveau_encoder {
 			bool no_interlace;
 		} dp;

+		struct {
+			uint16_t max_mhz;
+		} lvds;
+
 		struct {
 			uint16_t max_mhz;
 		} tmds;
--
2.17.1