Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/arch/arm/nvidia expose EDID to userland



details:   https://anonhg.NetBSD.org/src/rev/61867c279360
branches:  trunk
changeset: 339249:61867c279360
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Wed Jul 08 01:23:28 2015 +0000

description:
expose EDID to userland

diffstat:

 sys/arch/arm/nvidia/tegra_dc.c   |  13 ++++++++++---
 sys/arch/arm/nvidia/tegra_hdmi.c |  20 +++++++++++---------
 sys/arch/arm/nvidia/tegra_var.h  |   5 +++--
 3 files changed, 24 insertions(+), 14 deletions(-)

diffs (144 lines):

diff -r 5c56dd94e78c -r 61867c279360 sys/arch/arm/nvidia/tegra_dc.c
--- a/sys/arch/arm/nvidia/tegra_dc.c    Wed Jul 08 01:12:48 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_dc.c    Wed Jul 08 01:23:28 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_dc.c,v 1.1 2015/05/18 19:32:48 jmcneill Exp $ */
+/* $NetBSD: tegra_dc.c,v 1.2 2015/07/08 01:23:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_dc.c,v 1.1 2015/05/18 19:32:48 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_dc.c,v 1.2 2015/07/08 01:23:28 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -296,7 +296,7 @@
 
 int
 tegra_dc_enable(device_t dev, device_t outputdev,
-    const struct videomode *mode)
+    const struct videomode *mode, const uint8_t *edid)
 {
        struct tegra_dc_softc * const sc = device_private(dev);
        prop_dictionary_t prop = device_properties(dev);
@@ -339,6 +339,13 @@
 
        sc->sc_fbdev = config_found(sc->sc_dev, &tfb, tegra_dc_print);
 
+       if (sc->sc_fbdev != NULL && edid != NULL) {
+               prop_data_t data = prop_data_create_data(edid, 128);
+               prop_dictionary_set(device_properties(sc->sc_fbdev),
+                   "EDID", data);
+               prop_object_release(data);
+       }
+
        return 0;
 }
 
diff -r 5c56dd94e78c -r 61867c279360 sys/arch/arm/nvidia/tegra_hdmi.c
--- a/sys/arch/arm/nvidia/tegra_hdmi.c  Wed Jul 08 01:12:48 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_hdmi.c  Wed Jul 08 01:23:28 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_hdmi.c,v 1.2 2015/05/18 21:03:36 jmcneill Exp $ */
+/* $NetBSD: tegra_hdmi.c,v 1.3 2015/07/08 01:23:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -29,7 +29,7 @@
 #include "locators.h"
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tegra_hdmi.c,v 1.2 2015/05/18 21:03:36 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tegra_hdmi.c,v 1.3 2015/07/08 01:23:28 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -92,7 +92,7 @@
 static void    tegra_hdmi_hpd(struct tegra_hdmi_softc *);
 static void    tegra_hdmi_connect(struct tegra_hdmi_softc *);
 static void    tegra_hdmi_disconnect(struct tegra_hdmi_softc *);
-static void    tegra_hdmi_enable(struct tegra_hdmi_softc *);
+static void    tegra_hdmi_enable(struct tegra_hdmi_softc *, const uint8_t *);
 static int     tegra_hdmi_sor_start(struct tegra_hdmi_softc *);
 
 CFATTACH_DECL_NEW(tegra_hdmi, sizeof(struct tegra_hdmi_softc),
@@ -190,13 +190,14 @@
 tegra_hdmi_connect(struct tegra_hdmi_softc *sc)
 {
        const struct videomode *mode;
-       char edid[128];
+       char edid[128], *pedid = NULL;
        struct edid_info ei;
        int retry = 4, error;
 
+       memset(&ei, 0, sizeof(ei));
+
        if (sc->sc_ddcdev) {
                memset(edid, 0, sizeof(edid));
-               memset(&ei, 0, sizeof(ei));
 
                while (--retry > 0) {
                        error = ddc_dev_read_edid(sc->sc_ddcdev, edid,
@@ -212,10 +213,11 @@
                        if (edid_parse(edid, &ei) != 0) {
                                device_printf(sc->sc_dev,
                                    "failed to parse EDID\n");
+                       } else {
 #ifdef TEGRA_HDMI_DEBUG
-                       } else {
                                edid_print(&ei);
 #endif
+                               pedid = edid;
                        }
                }
        }
@@ -226,7 +228,7 @@
        }
 
        sc->sc_curmode = mode;
-       tegra_hdmi_enable(sc);
+       tegra_hdmi_enable(sc, pedid);
 }
 
 static void
@@ -235,7 +237,7 @@
 }
 
 static void
-tegra_hdmi_enable(struct tegra_hdmi_softc *sc)
+tegra_hdmi_enable(struct tegra_hdmi_softc *sc, const uint8_t *edid)
 {
        const struct tegra_hdmi_tmds_config *tmds = NULL;
        const struct videomode *mode = sc->sc_curmode;
@@ -266,7 +268,7 @@
                    tmds->sor_pad_ctls0);
        }
 
-       tegra_dc_enable(sc->sc_displaydev, sc->sc_dev, mode);
+       tegra_dc_enable(sc->sc_displaydev, sc->sc_dev, mode, edid);
 
        const u_int div = (mode->dot_clock / 1000) * 4;
        HDMI_WRITE(sc, HDMI_NV_PDISP_SOR_REFCLK_REG,
diff -r 5c56dd94e78c -r 61867c279360 sys/arch/arm/nvidia/tegra_var.h
--- a/sys/arch/arm/nvidia/tegra_var.h   Wed Jul 08 01:12:48 2015 +0000
+++ b/sys/arch/arm/nvidia/tegra_var.h   Wed Jul 08 01:23:28 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tegra_var.h,v 1.21 2015/05/31 14:41:59 jmcneill Exp $ */
+/* $NetBSD: tegra_var.h,v 1.22 2015/07/08 01:23:28 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2015 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -148,7 +148,8 @@
 
 struct videomode;
 int    tegra_dc_port(device_t);
-int    tegra_dc_enable(device_t, device_t, const struct videomode *);
+int    tegra_dc_enable(device_t, device_t, const struct videomode *,
+                       const uint8_t *);
 void   tegra_dc_hdmi_start(device_t);
 
 #define TEGRA_CPUFREQ_MAX      16



Home | Main Index | Thread Index | Old Index