Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/evbarm/beagle Read EDID data on Beagleboard and pas...
details: https://anonhg.NetBSD.org/src/rev/b2639d25b67f
branches: trunk
changeset: 783632:b2639d25b67f
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Tue Jan 01 23:21:26 2013 +0000
description:
Read EDID data on Beagleboard and pass it to omapfb driver if found.
diffstat:
sys/arch/evbarm/beagle/beagle_machdep.c | 52 +++++++++++++++++++++++++++++++-
1 files changed, 50 insertions(+), 2 deletions(-)
diffs (92 lines):
diff -r 149a3d550e92 -r b2639d25b67f sys/arch/evbarm/beagle/beagle_machdep.c
--- a/sys/arch/evbarm/beagle/beagle_machdep.c Tue Jan 01 23:20:24 2013 +0000
+++ b/sys/arch/evbarm/beagle/beagle_machdep.c Tue Jan 01 23:21:26 2013 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: beagle_machdep.c,v 1.32 2012/12/31 13:20:16 jmcneill Exp $ */
+/* $NetBSD: beagle_machdep.c,v 1.33 2013/01/01 23:21:26 jmcneill Exp $ */
/*
* Machine dependent functions for kernel setup for TI OSK5912 board.
@@ -125,7 +125,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.32 2012/12/31 13:20:16 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: beagle_machdep.c,v 1.33 2013/01/01 23:21:26 jmcneill Exp $");
#include "opt_machdep.h"
#include "opt_ddb.h"
@@ -181,6 +181,9 @@
#include <evbarm/include/autoconf.h>
#include <evbarm/beagle/beagle.h>
+#include <dev/i2c/i2cvar.h>
+#include <dev/i2c/ddcreg.h>
+
#include "prcm.h"
#include "omapwdt32k.h"
@@ -195,6 +198,8 @@
char *boot_args = beagle_default_boot_args;
char *boot_file = NULL;
+static uint8_t beagle_edid[128]; /* EDID storage */
+
u_int uboot_args[4] = { 0 }; /* filled in by beagle_start.S (not in bss) */
/* Same things, but for the free (unused by the kernel) memory. */
@@ -681,6 +686,40 @@
}
#endif
+/*
+ * EDID can be read from DVI-D (HDMI) port on BeagleBoard from
+ * If EDID data is present, this function fills in the supplied edid_buf
+ * and returns true. Otherwise, it returns false and the contents of the
+ * buffer are undefined.
+ */
+static bool
+beagle_read_edid(uint8_t *edid_buf, size_t edid_buflen)
+{
+ i2c_tag_t ic = NULL;
+ uint8_t reg;
+ int error;
+
+#if defined(OMAP_3530)
+ /* On Beagleboard, EDID is accessed using I2C2 ("omapiic2"). */
+ extern i2c_tag_t omap3_i2c_get_tag(device_t);
+ ic = omap3_i2c_get_tag(device_find_by_xname("omapiic2"));
+#endif
+
+ if (ic == NULL)
+ return false;
+
+ iic_acquire_bus(ic, 0);
+ for (reg = DDC_EDID_START; reg < edid_buflen; reg++) {
+ error = iic_exec(ic, I2C_OP_READ_WITH_STOP, DDC_ADDR,
+ ®, sizeof(reg), &edid_buf[reg], 1, 0);
+ if (error)
+ break;
+ }
+ iic_release_bus(ic, 0);
+
+ return error == 0 ? true : false;
+}
+
void
beagle_device_register(device_t self, void *aux)
{
@@ -737,4 +776,13 @@
#endif
return;
}
+
+ if (device_is_a(self, "omapfb")) {
+ if (beagle_read_edid(beagle_edid, sizeof(beagle_edid))) {
+ prop_dictionary_set(dict, "EDID",
+ prop_data_create_data(beagle_edid,
+ sizeof(beagle_edid)));
+ }
+ return;
+ }
}
Home |
Main Index |
Thread Index |
Old Index