Source-Changes-HG archive

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

[src/trunk]: src/sys/arch/arm/omap support WSDISPLAYIO_SVIDEO and _GVIDEO, no...



details:   https://anonhg.NetBSD.org/src/rev/9a735aa7acaa
branches:  trunk
changeset: 784555:9a735aa7acaa
user:      macallan <macallan%NetBSD.org@localhost>
date:      Fri Feb 01 02:53:47 2013 +0000

description:
support WSDISPLAYIO_SVIDEO and _GVIDEO, now screen blanking in X works

diffstat:

 sys/arch/arm/omap/omapfb.c |  57 ++++++++++++++++++++++++++++++++++++++++++++-
 1 files changed, 55 insertions(+), 2 deletions(-)

diffs (120 lines):

diff -r 68e81f3c1d25 -r 9a735aa7acaa sys/arch/arm/omap/omapfb.c
--- a/sys/arch/arm/omap/omapfb.c        Fri Feb 01 00:17:24 2013 +0000
+++ b/sys/arch/arm/omap/omapfb.c        Fri Feb 01 02:53:47 2013 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: omapfb.c,v 1.17 2013/01/31 21:10:37 macallan Exp $     */
+/*     $NetBSD: omapfb.c,v 1.18 2013/02/01 02:53:47 macallan Exp $     */
 
 /*
  * Copyright (c) 2010 Michael Lorenz
@@ -31,7 +31,7 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.17 2013/01/31 21:10:37 macallan Exp $");
+__KERNEL_RCSID(0, "$NetBSD: omapfb.c,v 1.18 2013/02/01 02:53:47 macallan Exp $");
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -77,6 +77,8 @@
        void *sc_fbaddr, *sc_vramaddr;
        bus_addr_t sc_fbhwaddr;
        uint32_t *sc_clut;
+       uint32_t sc_dispc_config;
+       int sc_video_is_on;
        struct vcons_screen sc_console_screen;
        struct wsscreen_descr sc_defaultscreen_descr;
        const struct wsscreen_descr *sc_screens[1];
@@ -108,6 +110,7 @@
                            uint8_t, uint8_t);
 
 static int     omapfb_set_depth(struct omapfb_softc *, int);
+static void    omapfb_set_video(struct omapfb_softc *, int);
 
 #if NOMAPDMA > 0
 static void    omapfb_init(struct omapfb_softc *);
@@ -186,6 +189,8 @@
                return;
        }
 
+       sc->sc_video_is_on = 1;
+
        /*
         * XXX
         * different u-boot versions initialize the graphics controller in
@@ -301,6 +306,7 @@
        reg = bus_space_read_4(sc->sc_iot, sc->sc_regh, OMAPFB_DISPC_CONFIG);
        reg = OMAP_DISPC_CTRL_ACTIVE_MTRX;
        bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPFB_DISPC_CONFIG, reg);
+       sc->sc_dispc_config = reg;
 
        sc->sc_fbhwaddr = sc->sc_dmamem->ds_addr + 0x1000;
        bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPFB_DISPC_GFX_BASE_0, 
@@ -498,6 +504,7 @@
                                }
                        }
                        return 0;
+
                case WSDISPLAYIO_GET_FBINFO:
                        {
                                struct wsdisplayio_fbinfo *fbi = data;
@@ -522,6 +529,20 @@
 
                        }
                        return 0;
+
+               case WSDISPLAYIO_GVIDEO:
+                       {
+                               int *on = data;
+                               *on = sc->sc_video_is_on;
+                       }
+                       return 0;
+
+               case WSDISPLAYIO_SVIDEO:
+                       {
+                               int *on = data;
+                               omapfb_set_video(sc, *on);
+                       }
+                       return 0;
        }
        return EPASSTHROUGH;
 }
@@ -713,6 +734,38 @@
        return 0;
 }
 
+static void
+omapfb_set_video(struct omapfb_softc *sc, int on)
+{
+       uint32_t reg;
+
+       if (on == sc->sc_video_is_on)
+               return;
+       if (on) {
+               bus_space_write_4(sc->sc_iot, sc->sc_regh,
+                   OMAPFB_DISPC_CONFIG, sc->sc_dispc_config);
+               on = 1;
+       } else {
+               bus_space_write_4(sc->sc_iot, sc->sc_regh,
+                   OMAPFB_DISPC_CONFIG, sc->sc_dispc_config |
+                   OMAP_DISPC_CFG_VSYNC_GATED | OMAP_DISPC_CFG_HSYNC_GATED |
+                   OMAP_DISPC_CFG_PIXELCLK_GATED |
+                   OMAP_DISPC_CFG_PIXELDATA_GATED);
+       }
+
+       /*
+        * now tell the video controller that we're done mucking around and 
+        * actually update its settings
+        */
+       reg = bus_space_read_4(sc->sc_iot, sc->sc_regh, OMAPFB_DISPC_CONTROL);
+       bus_space_write_4(sc->sc_iot, sc->sc_regh, OMAPFB_DISPC_CONTROL,
+           reg | OMAP_DISPC_CTRL_GO_LCD | OMAP_DISPC_CTRL_GO_DIGITAL);
+
+       aprint_debug_dev(sc->sc_dev, "%s %08x\n", __func__,
+           bus_space_read_4(sc->sc_iot, sc->sc_regh, OMAPFB_DISPC_CONFIG));
+       sc->sc_video_is_on = on;
+}
+
 #if NOMAPDMA > 0
 static void
 omapfb_init(struct omapfb_softc *sc)



Home | Main Index | Thread Index | Old Index