Unless you plan on implementing a better fix, I'm going to commit something like this (not compile tested) to restore HDMI audio functionality for A20 and A31.

Index: awin_debe.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/allwinner/awin_debe.c,v
retrieving revision 1.15
diff -u -p -r1.15 awin_debe.c
--- awin_debe.c 5 Oct 2015 14:42:19 -0000       1.15
+++ awin_debe.c 8 Oct 2015 22:16:59 -0000
@@ -75,6 +75,8 @@ struct awin_debe_softc {
        int sc_hot_x, sc_hot_y;
        uint8_t sc_cursor_bitmap[8 * AWIN_DEBE_CURMAX];
        uint8_t sc_cursor_mask[8 * AWIN_DEBE_CURMAX];
+
+       bool sc_audio_supp;
 };

 #define DEBE_READ(sc, reg) \
@@ -249,7 +251,7 @@ awin_debe_attach(device_t parent, device
 #endif

 #ifdef AWIN_DEBE_FWINIT
-       awin_debe_set_videomode(&mode);
+       awin_debe_set_videomode(&mode, false);
        awin_debe_enable(true);
 #endif
 }
@@ -472,7 +474,7 @@ awin_debe_enable(bool enable)
 }

 void
-awin_debe_set_videomode(const struct videomode *mode)
+awin_debe_set_videomode(const struct videomode *mode, bool audio_supp)
 {
        struct awin_debe_softc *sc;
        device_t dev;
@@ -485,6 +487,8 @@ awin_debe_set_videomode(const struct vid
        }
        sc = device_private(dev);

+       sc->sc_audio_supp = audio_supp;
+
        if (mode) {
                const u_int interlace_p = !!(mode->flags & VID_INTERLACE);
                const u_int width = mode->hdisplay;
@@ -582,7 +586,9 @@ awin_debe_ioctl(device_t self, u_long cm
                        val &= ~AWIN_DEBE_MODCTL_HWC_EN;
                }
                DEBE_WRITE(sc, AWIN_DEBE_MODCTL_REG, val);
-               awin_tcon_enable(enable);
+               if (sc->sc_audio_supp == false) {
+                       awin_tcon_enable(enable);
+               }
                return 0;
        case WSDISPLAYIO_GVIDEO:
                val = DEBE_READ(sc, AWIN_DEBE_MODCTL_REG);
Index: awin_hdmi.c
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/allwinner/awin_hdmi.c,v
retrieving revision 1.16
diff -u -p -r1.16 awin_hdmi.c
--- awin_hdmi.c 25 Jul 2015 15:19:54 -0000      1.16
+++ awin_hdmi.c 8 Oct 2015 22:16:59 -0000
@@ -565,7 +565,8 @@ awin_hdmi_read_edid(struct awin_hdmi_sof
                awin_tcon_enable(false);
                delay(20000);

-               awin_debe_set_videomode(mode);
+               awin_debe_set_videomode(mode,
+                   display_mode == DISPLAY_MODE_HDMI);
                awin_tcon_set_videomode(mode);
                awin_hdmi_set_videomode(sc, mode, display_mode);
                awin_hdmi_set_audiomode(sc, mode, display_mode);
Index: awin_var.h
===================================================================
RCS file: /cvsroot/src/sys/arch/arm/allwinner/awin_var.h,v
retrieving revision 1.35
diff -u -p -r1.35 awin_var.h
--- awin_var.h  20 Apr 2015 01:33:22 -0000      1.35
+++ awin_var.h  8 Oct 2015 22:16:59 -0000
@@ -140,7 +140,7 @@ unsigned int awin_tcon_get_clk_div(void)
 bool   awin_tcon_get_clk_dbl(void);
 void   awin_tcon_set_videomode(const struct videomode *);
 void   awin_tcon_enable(bool);
-void   awin_debe_set_videomode(const struct videomode *);
+void   awin_debe_set_videomode(const struct videomode *, bool);
 void   awin_debe_enable(bool);
 int    awin_debe_ioctl(device_t, u_long, void *);
 int    awin_mp_ioctl(device_t, u_long, void *);

Reply via email to