Source-Changes-HG archive

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

[src/trunk]: src/sys/dev/ic Allow bus glue to setup DDC clocks



details:   https://anonhg.NetBSD.org/src/rev/34f736d73c92
branches:  trunk
changeset: 846574:34f736d73c92
user:      jmcneill <jmcneill%NetBSD.org@localhost>
date:      Sat Nov 23 12:28:44 2019 +0000

description:
Allow bus glue to setup DDC clocks

diffstat:

 sys/dev/ic/dw_hdmi.c |  12 ++++++++++--
 sys/dev/ic/dw_hdmi.h |   4 +++-
 2 files changed, 13 insertions(+), 3 deletions(-)

diffs (65 lines):

diff -r 6eeee64456e7 -r 34f736d73c92 sys/dev/ic/dw_hdmi.c
--- a/sys/dev/ic/dw_hdmi.c      Sat Nov 23 08:30:39 2019 +0000
+++ b/sys/dev/ic/dw_hdmi.c      Sat Nov 23 12:28:44 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dw_hdmi.c,v 1.4 2019/11/16 13:10:07 jmcneill Exp $ */
+/* $NetBSD: dw_hdmi.c,v 1.5 2019/11/23 12:28:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.4 2019/11/16 13:10:07 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: dw_hdmi.c,v 1.5 2019/11/23 12:28:44 jmcneill Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -239,6 +239,8 @@
 #define        HDMI_I2CM_SOFTRSTZ      0x7e09
 #define         HDMI_I2CM_SOFTRSTZ_I2C_SOFTRST         __BIT(0)
 #define        HDMI_I2CM_SEGPTR        0x7e0a
+#define        HDMI_I2CM_SS_SCL_HCNT_0_ADDR 0x730c
+#define        HDMI_I2CM_SS_SCL_LCNT_0_ADDR 0x730e
 
 enum dwhdmi_dai_mixer_ctrl {
        DWHDMI_DAI_OUTPUT_CLASS,
@@ -291,6 +293,10 @@
 
        dwhdmi_write(sc, HDMI_I2CM_SOFTRSTZ, 0);
        dwhdmi_write(sc, HDMI_IH_I2CM_STAT0, dwhdmi_read(sc, HDMI_IH_I2CM_STAT0));
+       if (sc->sc_scl_hcnt)
+               dwhdmi_write(sc, HDMI_I2CM_SS_SCL_HCNT_0_ADDR, sc->sc_scl_hcnt);
+       if (sc->sc_scl_lcnt)
+               dwhdmi_write(sc, HDMI_I2CM_SS_SCL_LCNT_0_ADDR, sc->sc_scl_lcnt);
        dwhdmi_write(sc, HDMI_I2CM_DIV, 0);
        dwhdmi_write(sc, HDMI_I2CM_SLAVE, DDC_ADDR);
        dwhdmi_write(sc, HDMI_I2CM_SEGADDR, DDC_SEGMENT_ADDR);
@@ -299,6 +305,8 @@
        operation = block ? HDMI_I2CM_OPERATION_RD_EXT : HDMI_I2CM_OPERATION_RD;
        off = (block & 1) ? 128 : 0;
 
+       dwhdmi_write(sc, HDMI_I2CM_SEGPTR, block >> 1);
+
        for (n = 0; n < len; n++) {
                dwhdmi_write(sc, HDMI_I2CM_ADDRESS, n + off);
                dwhdmi_write(sc, HDMI_I2CM_OPERATION, operation);
diff -r 6eeee64456e7 -r 34f736d73c92 sys/dev/ic/dw_hdmi.h
--- a/sys/dev/ic/dw_hdmi.h      Sat Nov 23 08:30:39 2019 +0000
+++ b/sys/dev/ic/dw_hdmi.h      Sat Nov 23 12:28:44 2019 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: dw_hdmi.h,v 1.4 2019/11/16 13:10:07 jmcneill Exp $ */
+/* $NetBSD: dw_hdmi.h,v 1.5 2019/11/23 12:28:44 jmcneill Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -67,6 +67,8 @@
        u_int                   sc_reg_width;
        u_int                   sc_flags;
 #define        DWHDMI_USE_INTERNAL_PHY __BIT(0)
+       u_int                   sc_scl_hcnt;
+       u_int                   sc_scl_lcnt;
 
        u_int                   sc_phytype;
        u_int                   sc_version;



Home | Main Index | Thread Index | Old Index