Module Name:    src
Committed By:   jmcneill
Date:           Thu Jul 23 15:43:06 UTC 2015

Modified Files:
        src/sys/arch/arm/nvidia: tegra_hdmi.c

Log Message:
no need for exact match on tmds mode, just use the closest match


To generate a diff of this commit:
cvs rdiff -u -r1.4 -r1.5 src/sys/arch/arm/nvidia/tegra_hdmi.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sys/arch/arm/nvidia/tegra_hdmi.c
diff -u src/sys/arch/arm/nvidia/tegra_hdmi.c:1.4 src/sys/arch/arm/nvidia/tegra_hdmi.c:1.5
--- src/sys/arch/arm/nvidia/tegra_hdmi.c:1.4	Thu Jul 23 14:31:05 2015
+++ src/sys/arch/arm/nvidia/tegra_hdmi.c	Thu Jul 23 15:43:06 2015
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_hdmi.c,v 1.4 2015/07/23 14:31:05 jmcneill Exp $ */
+/* $NetBSD: tegra_hdmi.c,v 1.5 2015/07/23 15:43:06 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcne...@invisible.ca>
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_hdmi.c,v 1.4 2015/07/23 14:31:05 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_hdmi.c,v 1.5 2015/07/23 15:43:06 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -252,11 +252,15 @@ tegra_hdmi_enable(struct tegra_hdmi_soft
 	tegra_car_hdmi_enable(mode->dot_clock * 1000);
 
 	for (n = 0; n < __arraycount(tegra_hdmi_tmds_config); n++) {
-		if (tegra_hdmi_tmds_config[n].dot_clock == mode->dot_clock) {
-			tmds = &tegra_hdmi_tmds_config[n];
+		if (tegra_hdmi_tmds_config[n].dot_clock >= mode->dot_clock) {
 			break;
 		}
 	}
+	if (n < __arraycount(tegra_hdmi_tmds_config)) {
+		tmds = &tegra_hdmi_tmds_config[n];
+	} else {
+		tmds = &tegra_hdmi_tmds_config[__arraycount(tegra_hdmi_tmds_config) - 1];
+	}
 	if (tmds != NULL) {
 		HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_PLL0_REG, tmds->sor_pll0);
 		HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_PLL1_REG, tmds->sor_pll1);

Reply via email to