Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/sunxi Improve compatibility with newer A64 DE2 ...



details:   https://anonhg.NetBSD.org/src/rev/971811cc266f
branches:  trunk
changeset: 1007187:971811cc266f
user:      jakllsch <jakllsch%NetBSD.org@localhost>
date:      Sun Feb 09 15:22:25 2020 +0000

description:
Improve compatibility with newer A64 DE2 DTB endpoint numbers.

Should fix video output with new Linux 5.5rc DTBs on A64/H2/H3/H5-based SoCs.

diffstat:

 sys/arch/arm/sunxi/sunxi_mixer.c |  38 +++++++++++++++++++++++++++++++-------
 1 files changed, 31 insertions(+), 7 deletions(-)

diffs (81 lines):

diff -r b0de7859d883 -r 971811cc266f sys/arch/arm/sunxi/sunxi_mixer.c
--- a/sys/arch/arm/sunxi/sunxi_mixer.c  Sun Feb 09 15:13:28 2020 +0000
+++ b/sys/arch/arm/sunxi/sunxi_mixer.c  Sun Feb 09 15:22:25 2020 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: sunxi_mixer.c,v 1.10 2019/11/23 23:47:57 jmcneill Exp $ */
+/* $NetBSD: sunxi_mixer.c,v 1.11 2020/02/09 15:22:25 jakllsch Exp $ */
 
 /*-
  * Copyright (c) 2019 Jared D. McNeill <jmcneill%invisible.ca@localhost>
@@ -27,7 +27,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.10 2019/11/23 23:47:57 jmcneill Exp $");
+__KERNEL_RCSID(0, "$NetBSD: sunxi_mixer.c,v 1.11 2020/02/09 15:22:25 jakllsch Exp $");
 
 #include <sys/param.h>
 #include <sys/bus.h>
@@ -173,10 +173,25 @@
        MIXER_PORT_OUTPUT = 1,
 };
 
+struct sunxi_mixer_compat_data {
+       uint8_t ovl_ui_count;
+       uint8_t mixer_index;
+};
+
+struct sunxi_mixer_compat_data mixer0_data = {
+       .ovl_ui_count = 3,
+       .mixer_index = 0,
+};
+
+struct sunxi_mixer_compat_data mixer1_data = {
+       .ovl_ui_count = 1,
+       .mixer_index = 1,
+};
+
 static const struct of_compat_data compat_data[] = {
-       { "allwinner,sun8i-h3-de2-mixer-0",     3 },
-       { "allwinner,sun50i-a64-de2-mixer-0",   3 },
-       { "allwinner,sun50i-a64-de2-mixer-1",   1 },
+       { "allwinner,sun8i-h3-de2-mixer-0",     (uintptr_t)&mixer0_data },
+       { "allwinner,sun50i-a64-de2-mixer-0",   (uintptr_t)&mixer0_data },
+       { "allwinner,sun50i-a64-de2-mixer-1",   (uintptr_t)&mixer1_data },
        { NULL }
 };
 
@@ -1230,6 +1245,8 @@
        struct fdt_attach_args * const faa = aux;
        struct fdt_endpoint *out_ep;
        const int phandle = faa->faa_phandle;
+       const struct sunxi_mixer_compat_data * const cd =
+           (const void *)of_search_compatible(phandle, compat_data)->data;
        struct clk *clk_bus, *clk_mod;
        struct fdtbus_reset *rst;
        bus_addr_t addr;
@@ -1267,7 +1284,7 @@
                return;
        }
        sc->sc_phandle = faa->faa_phandle;
-       sc->sc_ovl_ui_count = of_search_compatible(phandle, compat_data)->data;
+       sc->sc_ovl_ui_count = cd->ovl_ui_count;
 
        aprint_naive("\n");
        aprint_normal(": Display Engine Mixer\n");
@@ -1276,7 +1293,14 @@
        sc->sc_ports.dp_ep_get_data = sunxi_mixer_ep_get_data;
        fdt_ports_register(&sc->sc_ports, self, phandle, EP_DRM_CRTC);
 
-       out_ep = fdt_endpoint_get_from_index(&sc->sc_ports, MIXER_PORT_OUTPUT, 0);
+       out_ep = fdt_endpoint_get_from_index(&sc->sc_ports,
+           MIXER_PORT_OUTPUT, cd->mixer_index);
+       if (out_ep == NULL) {
+               /* Couldn't find new-style DE2 endpoint, try old style. */
+               out_ep = fdt_endpoint_get_from_index(&sc->sc_ports,
+                   MIXER_PORT_OUTPUT, 0);
+       }
+
        if (out_ep != NULL)
                sunxi_drm_register_endpoint(phandle, out_ep);
 }



Home | Main Index | Thread Index | Old Index