Source-Changes-HG archive

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

[src/trunk]: src/sys/arch Rewritten to take advantage of genfb(4).



details:   https://anonhg.NetBSD.org/src/rev/a005b5748c53
branches:  trunk
changeset: 342416:a005b5748c53
user:      hkenken <hkenken%NetBSD.org@localhost>
date:      Mon Dec 21 04:26:28 2015 +0000

description:
Rewritten to take advantage of genfb(4).

diffstat:

 sys/arch/arm/imx/files.imx51                       |   11 +-
 sys/arch/arm/imx/imx51_ipuv3.c                     |  506 +++-----------------
 sys/arch/arm/imx/imx51_ipuv3var.h                  |   42 +-
 sys/arch/arm/imx/imx51var.h                        |   43 +-
 sys/arch/arm/imx/imx_genfb.c                       |  197 ++++++++
 sys/arch/evbarm/conf/NETWALKER                     |   20 +-
 sys/arch/evbarm/conf/files.netwalker               |    4 +-
 sys/arch/evbarm/netwalker/netwalker_backlight.c    |   90 +++-
 sys/arch/evbarm/netwalker/netwalker_backlightvar.h |    6 +-
 sys/arch/evbarm/netwalker/netwalker_lcd.c          |  136 +-----
 sys/arch/evbarm/netwalker/netwalker_machdep.c      |   49 +-
 11 files changed, 489 insertions(+), 615 deletions(-)

diffs (truncated from 1592 to 300 lines):

diff -r a7f2f3f6f2ec -r a005b5748c53 sys/arch/arm/imx/files.imx51
--- a/sys/arch/arm/imx/files.imx51      Mon Dec 21 03:34:34 2015 +0000
+++ b/sys/arch/arm/imx/files.imx51      Mon Dec 21 04:26:28 2015 +0000
@@ -1,4 +1,4 @@
-#      $NetBSD: files.imx51,v 1.13 2015/05/07 04:13:47 hkenken Exp $
+#      $NetBSD: files.imx51,v 1.14 2015/12/21 04:26:28 hkenken Exp $
 #
 # Configuration info for the Freescale i.MX5x
 #
@@ -76,11 +76,14 @@
 # defparam opt_imx50_epdc.h            EPDC_DEBUG
 
 # IPU v3 controller
-device ipu : bus_dma_generic, wsemuldisplaydev, rasops16, rasops8, rasops4, rasops_rotation, vcons
-file   arch/arm/imx/imx51_ipuv3.c      ipu      needs-flag
-defflag        opt_imx51_ipuv3.h               IMXIPUCONSOLE
+device ipu { }
+file   arch/arm/imx/imx51_ipuv3.c      imx_ipuv3       needs-flag
 defparam opt_imx51_ipuv3.h             IPUV3_DEBUG
 
+# Framebuffer console
+attach genfb at ipu with imx_genfb
+file   arch/arm/imx/imx_genfb.c        imx_genfb
+
 # iMX M3IF - Multi Master Memory Interface
 # iMX ESDCTL/MDDRC - Enhanced SDRAM/LPDDR memory controller
 # iMX PCMCIA - PCMCIA memory controller
diff -r a7f2f3f6f2ec -r a005b5748c53 sys/arch/arm/imx/imx51_ipuv3.c
--- a/sys/arch/arm/imx/imx51_ipuv3.c    Mon Dec 21 03:34:34 2015 +0000
+++ b/sys/arch/arm/imx/imx51_ipuv3.c    Mon Dec 21 04:26:28 2015 +0000
@@ -1,4 +1,4 @@
-/*     $NetBSD: imx51_ipuv3.c,v 1.3 2014/11/07 11:54:18 hkenken Exp $  */
+/*     $NetBSD: imx51_ipuv3.c,v 1.4 2015/12/21 04:26:28 hkenken Exp $  */
 
 /*
  * Copyright (c) 2011, 2012  Genetec Corporation.  All rights reserved.
@@ -27,7 +27,9 @@
  */
 
 #include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: imx51_ipuv3.c,v 1.3 2014/11/07 11:54:18 hkenken Exp $");
+__KERNEL_RCSID(0, "$NetBSD: imx51_ipuv3.c,v 1.4 2015/12/21 04:26:28 hkenken Exp $");
+
+#include "opt_imx51_ipuv3.h"
 
 #include <sys/param.h>
 #include <sys/systm.h>
@@ -35,17 +37,6 @@
 #include <sys/uio.h>
 #include <sys/malloc.h>
 #include <sys/kernel.h>                        /* for cold */
-#include <sys/pmf.h>
-
-#include <uvm/uvm_extern.h>
-
-#include <dev/cons.h>
-#include <dev/wscons/wsconsio.h>
-#include <dev/wscons/wsdisplayvar.h>
-#include <dev/wscons/wscons_callbacks.h>
-#include <dev/rasops/rasops.h>
-#include <dev/wsfont/wsfont.h>
-#include <dev/wscons/wsdisplay_vconsvar.h>
 
 #include <sys/bus.h>
 #include <machine/cpu.h>
@@ -59,19 +50,6 @@
 #include <arm/imx/imx51_ccmreg.h>
 
 #include "imxccm.h"    /* if CCM driver is configured into the kernel */
-#include "wsdisplay.h"
-#include "opt_imx51_ipuv3.h"
-
-/*
- * Console variables. These are necessary since console is setup very early,
- * before devices get attached.
- */
-struct {
-       int is_console;
-       struct imx51_wsscreen_descr *descr;
-       struct wsdisplay_accessops *accessops;
-       const struct lcd_panel_geometry *geom;
-} imx51_ipuv3_console;
 
 #define        IPUV3_READ(ipuv3, module, reg)                                        \
        bus_space_read_4((ipuv3)->iot, (ipuv3)->module##_ioh, (reg))
@@ -89,16 +67,8 @@
 
 static void imx51_ipuv3_initialize(struct imx51_ipuv3_softc *,
     const struct lcd_panel_geometry *);
-#if NWSDISPLAY > 0
-static void imx51_ipuv3_setup_rasops(struct imx51_ipuv3_softc *,
-    struct rasops_info *, struct imx51_wsscreen_descr *,
-    const struct lcd_panel_geometry *);
-#endif
 static void imx51_ipuv3_set_idma_param(uint32_t *, uint32_t, uint32_t);
 
-static bool imx51_ipuv3_resume(device_t, const pmf_qual_t *);
-static bool imx51_ipuv3_suspend(device_t, const pmf_qual_t *);
-
 #ifdef IPUV3_DEBUG
 static void
 imx51_ipuv3_dump(struct imx51_ipuv3_softc *sc)
@@ -581,34 +551,14 @@
        IPUV3_WRITE(sc, cm, IPU_CM_DISP_GEN, reg);
 }
 
-static void
-imx51_ipuv3_init_screen(void *cookie, struct vcons_screen *scr,
-                   int existing, long *defattr)
+static int
+imx51_ipuv3_print(void *aux, const char *pnp)
 {
-       DPRINTFN(5, ("%s : %d\n", __func__, __LINE__));
-
-       struct imx51_ipuv3_softc *sc = cookie;
-       struct rasops_info *ri = &scr->scr_ri;
-       struct imx51_wsscreen_descr *descr = imx51_ipuv3_console.descr;
-
-       if ((scr == &sc->console) && (sc->vd.active != NULL))
-               return;
+       const struct imxfb_attach_args * const ifb = aux;
 
-       ri->ri_bits = sc->active->buf_va;
-
-       scr->scr_flags |= VCONS_DONT_READ;
-       if (existing)
-               ri->ri_flg |= RI_CLEAR;
-
-       imx51_ipuv3_setup_rasops(sc, ri, descr, sc->geometry);
+       aprint_normal(" output %s", device_xname(ifb->ifb_outputdev));
 
-       ri->ri_caps = WSSCREEN_WSCOLORS;
-
-       rasops_reconfig(ri,
-           ri->ri_height / ri->ri_font->fontheight,
-           ri->ri_width / ri->ri_font->fontwidth);
-
-       ri->ri_hw = scr;
+       return UNCONF;
 }
 
 /*
@@ -621,7 +571,6 @@
        DPRINTFN(5, ("%s : %d\n", __func__, __LINE__));
 
        bus_space_tag_t iot = axia->aa_iot;
-       bus_space_handle_t ioh;
        int error;
 
        aprint_normal(": i.MX51 IPUV3 controller\n");
@@ -633,52 +582,44 @@
        sc->dma_tag = &imx_bus_dma_tag;
 
        /* map controller registers */
-       error = bus_space_map(iot, IPU_CM_BASE, IPU_CM_SIZE, 0, &ioh);
+       error = bus_space_map(iot, IPU_CM_BASE, IPU_CM_SIZE, 0, &sc->cm_ioh);
        if (error)
                goto fail_retarn_cm;
-       sc->cm_ioh = ioh;
 
        /* map Display Multi FIFO Controller registers */
-       error = bus_space_map(iot, IPU_DMFC_BASE, IPU_DMFC_SIZE, 0, &ioh);
+       error = bus_space_map(iot, IPU_DMFC_BASE, IPU_DMFC_SIZE, 0, &sc->dmfc_ioh);
        if (error)
                goto fail_retarn_dmfc;
-       sc->dmfc_ioh = ioh;
 
        /* map Display Interface registers */
-       error = bus_space_map(iot, IPU_DI0_BASE, IPU_DI0_SIZE, 0, &ioh);
+       error = bus_space_map(iot, IPU_DI0_BASE, IPU_DI0_SIZE, 0, &sc->di0_ioh);
        if (error)
                goto fail_retarn_di0;
-       sc->di0_ioh = ioh;
 
        /* map Display Processor registers */
-       error = bus_space_map(iot, IPU_DP_BASE, IPU_DP_SIZE, 0, &ioh);
+       error = bus_space_map(iot, IPU_DP_BASE, IPU_DP_SIZE, 0, &sc->dp_ioh);
        if (error)
                goto fail_retarn_dp;
-       sc->dp_ioh = ioh;
 
        /* map Display Controller registers */
-       error = bus_space_map(iot, IPU_DC_BASE, IPU_DC_SIZE, 0, &ioh);
+       error = bus_space_map(iot, IPU_DC_BASE, IPU_DC_SIZE, 0, &sc->dc_ioh);
        if (error)
                goto fail_retarn_dc;
-       sc->dc_ioh = ioh;
 
        /* map Image DMA Controller registers */
-       error = bus_space_map(iot, IPU_IDMAC_BASE, IPU_IDMAC_SIZE, 0, &ioh);
+       error = bus_space_map(iot, IPU_IDMAC_BASE, IPU_IDMAC_SIZE, 0, &sc->idmac_ioh);
        if (error)
                goto fail_retarn_idmac;
-       sc->idmac_ioh = ioh;
 
        /* map CPMEM registers */
-       error = bus_space_map(iot, IPU_CPMEM_BASE, IPU_CPMEM_SIZE, 0, &ioh);
+       error = bus_space_map(iot, IPU_CPMEM_BASE, IPU_CPMEM_SIZE, 0, &sc->cpmem_ioh);
        if (error)
                goto fail_retarn_cpmem;
-       sc->cpmem_ioh = ioh;
 
        /* map DCTEMPL registers */
-       error = bus_space_map(iot, IPU_DCTMPL_BASE, IPU_DCTMPL_SIZE, 0, &ioh);
+       error = bus_space_map(iot, IPU_DCTMPL_BASE, IPU_DCTMPL_SIZE, 0, &sc->dctmpl_ioh);
        if (error)
                goto fail_retarn_dctmpl;
-       sc->dctmpl_ioh = ioh;
 
 #ifdef notyet
        sc->ih = imx51_ipuv3_intr_establish(IMX51_INT_IPUV3, IPL_BIO,
@@ -693,12 +634,8 @@
 
        imx51_ipuv3_initialize(sc, geom);
 
-#if NWSDISPLAY > 0
-       struct imx51_wsscreen_descr *descr = imx51_ipuv3_console.descr;
        struct imx51_ipuv3_screen *scr;
-
-       sc->mode = WSDISPLAYIO_MODE_EMUL;
-       error = imx51_ipuv3_new_screen(sc, descr->depth, &scr);
+       error = imx51_ipuv3_new_screen(sc, &scr);
        if (error) {
                aprint_error_dev(sc->dev,
                    "unable to create new screen (errno=%d)", error);
@@ -706,41 +643,22 @@
        }
        sc->active = scr;
 
-       vcons_init(&sc->vd, sc, &descr->c,
-           imx51_ipuv3_console.accessops);
-       sc->vd.init_screen = imx51_ipuv3_init_screen;
-
-#ifdef IPUV3_DEBUG
-       printf("%s: IPUV3 console ? %d\n", __func__, imx51_ipuv3_console.is_console);
-#endif
-
-       struct rasops_info *ri;
-       long defattr;
-       ri = &sc->console.scr_ri;
-
-       vcons_init_screen(&sc->vd, &sc->console, 1,
-           &defattr);
-       sc->console.scr_flags |= VCONS_SCREEN_IS_STATIC;
+       imx51_ipuv3_start_dma(sc, scr);
 
-       descr->c.nrows = ri->ri_rows;
-       descr->c.ncols = ri->ri_cols;
-       descr->c.textops = &ri->ri_ops;
-       descr->c.capabilities = ri->ri_caps;
-
-       if (imx51_ipuv3_console.is_console) {
-               wsdisplay_cnattach(&descr->c, ri, 0, 0, defattr);
-               aprint_normal_dev(sc->dev, "console\n");
-       }
+       struct imxfb_attach_args ifb = {
+               .ifb_dmat      = sc->dma_tag,
+               .ifb_dmamap    = scr->dma,
+               .ifb_dmasegs   = scr->segs,
+               .ifb_ndmasegs  = scr->nsegs,
+               .ifb_fb        = scr->buf_va,
+               .ifb_width     = geom->panel_width,
+               .ifb_height    = geom->panel_height,
+               .ifb_depth     = scr->depth,
+               .ifb_stride    = geom->panel_width * (scr->depth / 8),
+               .ifb_outputdev = sc->dev,
+       };
 
-       vcons_replay_msgbuf(&sc->console);
-
-       imx51_ipuv3_start_dma(sc, scr);
-#endif
-
-       if (!pmf_device_register(sc->dev, imx51_ipuv3_suspend,
-               imx51_ipuv3_resume)) {
-               aprint_error_dev(sc->dev, "can't establish power hook\n");
-       }
+       sc->fbdev = config_found_ia(sc->dev, "ipu", &ifb, imx51_ipuv3_print);
 
        return;
 
@@ -764,19 +682,6 @@
        return;
 }
 
-int
-imx51_ipuv3_cnattach(bool isconsole, struct imx51_wsscreen_descr *descr,
-    struct wsdisplay_accessops *accessops,
-    const struct lcd_panel_geometry *geom)
-{
-       DPRINTFN(5, ("%s : %d\n", __func__, __LINE__));
-       imx51_ipuv3_console.descr = descr;
-       imx51_ipuv3_console.geom = geom;
-       imx51_ipuv3_console.accessops = accessops;
-       imx51_ipuv3_console.is_console = isconsole;
-       return 0;
-}
-
 #ifdef notyet
 /*



Home | Main Index | Thread Index | Old Index