Source-Changes-HG archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
[src/trunk]: src/sys/arch/arm/allwinner For DDC, we don't have a real I2C bus...
details: https://anonhg.NetBSD.org/src/rev/9df7ef22ff12
branches: trunk
changeset: 339500:9df7ef22ff12
user: jmcneill <jmcneill%NetBSD.org@localhost>
date: Sat Jul 25 15:19:54 2015 +0000
description:
For DDC, we don't have a real I2C bus, but instead read an EDID block at
a time. Read the blocks ourselves instead of pulling in ddc_read_edid.
diffstat:
sys/arch/arm/allwinner/awin_hdmi.c | 33 +++++++++++++++++++++++++++++----
sys/arch/arm/allwinner/files.awin | 4 ++--
2 files changed, 31 insertions(+), 6 deletions(-)
diffs (93 lines):
diff -r c14eb14767f3 -r 9df7ef22ff12 sys/arch/arm/allwinner/awin_hdmi.c
--- a/sys/arch/arm/allwinner/awin_hdmi.c Sat Jul 25 13:01:06 2015 +0000
+++ b/sys/arch/arm/allwinner/awin_hdmi.c Sat Jul 25 15:19:54 2015 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: awin_hdmi.c,v 1.15 2014/11/17 10:00:14 jmcneill Exp $ */
+/* $NetBSD: awin_hdmi.c,v 1.16 2015/07/25 15:19:54 jmcneill Exp $ */
/*-
* Copyright (c) 2014 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -32,7 +32,7 @@
#define AWIN_HDMI_PLL 3 /* PLL7 or PLL3 */
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: awin_hdmi.c,v 1.15 2014/11/17 10:00:14 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: awin_hdmi.c,v 1.16 2015/07/25 15:19:54 jmcneill Exp $");
#include <sys/param.h>
#include <sys/bus.h>
@@ -99,6 +99,8 @@
static void awin_hdmi_enable(struct awin_hdmi_softc *);
static void awin_hdmi_read_edid(struct awin_hdmi_softc *);
+static int awin_hdmi_read_edid_block(struct awin_hdmi_softc *, uint8_t *,
+ uint8_t);
static u_int awin_hdmi_get_display_mode(struct awin_hdmi_softc *,
const struct edid_info *);
static void awin_hdmi_video_enable(struct awin_hdmi_softc *, bool);
@@ -486,6 +488,29 @@
delay(1000);
}
+static int
+awin_hdmi_read_edid_block(struct awin_hdmi_softc *sc, uint8_t *data,
+ uint8_t block)
+{
+ i2c_tag_t tag = &sc->sc_ic;
+ uint8_t wbuf[2];
+ int error;
+
+ if ((error = iic_acquire_bus(tag, I2C_F_POLL)) != 0)
+ return error;
+
+ wbuf[0] = block; /* start address */
+
+ if ((error = iic_exec(tag, I2C_OP_READ_WITH_STOP, DDC_ADDR, wbuf, 1,
+ data, 128, I2C_F_POLL)) != 0) {
+ iic_release_bus(tag, I2C_F_POLL);
+ return error;
+ }
+ iic_release_bus(tag, I2C_F_POLL);
+
+ return 0;
+}
+
static void
awin_hdmi_read_edid(struct awin_hdmi_softc *sc)
{
@@ -499,7 +524,7 @@
memset(&ei, 0, sizeof(ei));
while (--retry > 0) {
- if (!ddc_read_edid_block(&sc->sc_ic, edid, sizeof(edid), 0))
+ if (!awin_hdmi_read_edid_block(sc, edid, 0))
break;
}
if (retry == 0) {
@@ -566,7 +591,7 @@
* found in that, assume HDMI mode.
*/
for (n = 1; n <= MIN(ei->edid_ext_block_count, 4); n++) {
- if (ddc_read_edid_block(&sc->sc_ic, edid, sizeof(edid), n)) {
+ if (awin_hdmi_read_edid_block(sc, edid, n)) {
#ifdef AWIN_HDMI_DEBUG
device_printf(sc->sc_dev,
"Failed to read EDID block %d\n", n);
diff -r c14eb14767f3 -r 9df7ef22ff12 sys/arch/arm/allwinner/files.awin
--- a/sys/arch/arm/allwinner/files.awin Sat Jul 25 13:01:06 2015 +0000
+++ b/sys/arch/arm/allwinner/files.awin Sat Jul 25 15:19:54 2015 +0000
@@ -1,4 +1,4 @@
-# $NetBSD: files.awin,v 1.31 2015/04/20 01:33:22 matt Exp $
+# $NetBSD: files.awin,v 1.32 2015/07/25 15:19:54 jmcneill Exp $
#
# Configuration info for Allwinner ARM Peripherals
#
@@ -140,7 +140,7 @@
file arch/arm/allwinner/awin_ac.c awin_ac
# A20/A31 HDMI
-device awinhdmi: edid, ddc_read_edid, videomode
+device awinhdmi: edid, videomode
attach awinhdmi at awinio with awin_hdmi
file arch/arm/allwinner/awin_hdmi.c awin_hdmi
Home |
Main Index |
Thread Index |
Old Index