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 Update unused tifb. wscons is working.
details: https://anonhg.NetBSD.org/src/rev/55631478eb61
branches: trunk
changeset: 348429:55631478eb61
user: kiyohara <kiyohara%NetBSD.org@localhost>
date: Tue Oct 18 14:14:51 2016 +0000
description:
Update unused tifb. wscons is working.
Tested on PEPPER and VTC100.
diffstat:
sys/arch/arm/omap/tifb.c | 601 +++++++++++++++++++++----------------------
sys/arch/arm/omap/tifbreg.h | 64 ++-
sys/arch/arm/omap/tifbvar.h | 55 ++++
3 files changed, 387 insertions(+), 333 deletions(-)
diffs (truncated from 1124 to 300 lines):
diff -r 45dd8f4d1f11 -r 55631478eb61 sys/arch/arm/omap/tifb.c
--- a/sys/arch/arm/omap/tifb.c Tue Oct 18 14:08:53 2016 +0000
+++ b/sys/arch/arm/omap/tifb.c Tue Oct 18 14:14:51 2016 +0000
@@ -1,4 +1,4 @@
-/* $NetBSD: tifb.c,v 1.5 2015/04/12 20:00:42 bouyer Exp $ */
+/* $NetBSD: tifb.c,v 1.6 2016/10/18 14:14:51 kiyohara Exp $ */
/*
* Copyright (c) 2010 Michael Lorenz
@@ -57,7 +57,7 @@
*/
#include <sys/cdefs.h>
-__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.5 2015/04/12 20:00:42 bouyer Exp $");
+__KERNEL_RCSID(0, "$NetBSD: tifb.c,v 1.6 2016/10/18 14:14:51 kiyohara Exp $");
#include "opt_omap.h"
@@ -76,6 +76,7 @@
#include <sys/bus.h>
#include <arm/omap/tifbreg.h>
+#include <arm/omap/tifbvar.h>
#include <arm/omap/omap_var.h>
#include <arm/omap/omap2_obiovar.h>
#include <arm/omap/omap2_obioreg.h>
@@ -92,55 +93,8 @@
#include <dev/rasops/rasops.h>
#include <dev/wscons/wsdisplay_vconsvar.h>
-#include <dev/videomode/edidvar.h>
-
#include "locators.h"
-struct panel_info {
- uint32_t panel_width;
- uint32_t panel_height;
- uint32_t panel_hfp;
- uint32_t panel_hbp;
- uint32_t panel_hsw;
- uint32_t panel_vfp;
- uint32_t panel_vbp;
- uint32_t panel_vsw;
- uint32_t ac_bias;
- uint32_t ac_bias_intrpt;
- uint32_t dma_burst_sz;
- uint32_t bpp;
- uint32_t fdd;
- uint32_t invert_line_clock;
- uint32_t invert_frm_clock;
- uint32_t sync_edge;
- uint32_t sync_ctrl;
- uint32_t panel_pxl_clk;
- uint32_t panel_invert_pxl_clk;
-};
-
-/* for chalk elec cape with 12" panel */
-struct panel_info default_panel_info = {
- .panel_width = 1280,
- .panel_height = 800,
- .panel_hfp = 48,
- .panel_hbp = 80,
- .panel_hsw = 32,
- .panel_vfp = 2,
- .panel_vbp = 15,
- .panel_vsw = 6,
- .ac_bias = 255,
- .ac_bias_intrpt = 0,
- .dma_burst_sz = 16,
- .bpp = 16,
- .fdd = 16,
- .invert_line_clock = 0,
- .invert_frm_clock = 0,
- .sync_edge = 0,
- .sync_ctrl = 1,
- .panel_pxl_clk = 69300000,
- .panel_invert_pxl_clk = 0,
-};
-
struct tifb_softc {
device_t sc_dev;
@@ -154,9 +108,7 @@
size_t sc_palettesize;
int sc_stride;
- int sc_locked;
void *sc_fbaddr, *sc_vramaddr;
- void *sc_shadowfb;
bus_addr_t sc_fbhwaddr;
uint16_t *sc_palette;
@@ -170,14 +122,12 @@
uint8_t sc_cmap_red[256], sc_cmap_green[256], sc_cmap_blue[256];
void (*sc_putchar)(void *, int, int, u_int, long);
- uint8_t sc_edid_data[1024];
- size_t sc_edid_size;
-
- struct panel_info *sc_panel;
+ struct tifb_panel_info *sc_pi;
};
-#define TIFB_READ(sc, reg) bus_space_read_4(sc->sc_iot, sc->sc_regh, reg)
-#define TIFB_WRITE(sc, reg, val) bus_space_write_4(sc->sc_iot, sc->sc_regh, reg, val)
+#define TIFB_READ(sc, reg) bus_space_read_4(sc->sc_iot, sc->sc_regh, reg)
+#define TIFB_WRITE(sc, reg, val) \
+ bus_space_write_4(sc->sc_iot, sc->sc_regh, reg, val)
static int tifb_match(device_t, cfdata_t, void *);
static void tifb_attach(device_t, device_t, void *);
@@ -193,18 +143,15 @@
CFATTACH_DECL_NEW(tifb, sizeof(struct tifb_softc),
tifb_match, tifb_attach, NULL, NULL);
-static int tifb_ioctl(void *, void *, u_long, void *, int,
- struct lwp *);
+static int tifb_ioctl(void *, void *, u_long, void *, int, struct lwp *);
static paddr_t tifb_mmap(void *, void *, off_t, int);
static void tifb_init_screen(void *, struct vcons_screen *, int, long *);
static int tifb_putcmap(struct tifb_softc *, struct wsdisplay_cmap *);
static int tifb_getcmap(struct tifb_softc *, struct wsdisplay_cmap *);
+static void tifb_restore_palette(struct tifb_softc *, int, int);
+
#if 0
-static void tifb_restore_palette(struct tifb_softc *);
-static void tifb_putpalreg(struct tifb_softc *, int, uint8_t,
- uint8_t, uint8_t);
-
static int tifb_set_depth(struct tifb_softc *, int);
#endif
static void tifb_set_video(struct tifb_softc *, int);
@@ -239,9 +186,9 @@
/* Raster mode case: divisors are in range from 2 to 255 */
for (div = 2; div < 255; div++)
if (reference/div <= freq)
- return (div);
+ return div;
- return (255);
+ return 255;
}
static int
@@ -249,7 +196,8 @@
{
struct obio_attach_args *obio = aux;
- if ((obio->obio_addr == -1) || (obio->obio_size == 0))
+ if ((obio->obio_addr == OBIOCF_ADDR_DEFAULT) ||
+ (obio->obio_size == OBIOCF_SIZE_DEFAULT))
return 0;
return 1;
}
@@ -261,12 +209,12 @@
struct obio_attach_args *obio = aux;
struct rasops_info *ri;
struct wsemuldisplaydev_attach_args aa;
- prop_dictionary_t dict;
- /* prop_data_t edid_data; XXX */
+ prop_dictionary_t dict = device_properties(self);
+ prop_object_t panel_info;
unsigned long defattr;
bool is_console = false;
uint32_t reg, timing0, timing1, timing2, burst_log;
- int segs, i, div, ref_freq;
+ int segs, i, j, n, div, ref_freq;
#ifdef TI_AM335X
int ret;
@@ -310,6 +258,15 @@
};
#endif
+ prop_dictionary_get_bool(dict, "is_console", &is_console);
+ panel_info = prop_dictionary_get(dict, "panel-info");
+ if (panel_info == NULL) {
+ aprint_error_dev(self, "no panel-info property\n");
+ return;
+ }
+ KASSERT(prop_object_type(panel_info) == PROP_TYPE_DATA);
+ sc->sc_pi = __UNCONST(prop_data_data_nocopy(panel_info));
+
evcnt_attach_dynamic(&ev_sync_lost, EVCNT_TYPE_MISC, NULL,
"lcd", "sync lost");
evcnt_attach_dynamic(&ev_palette, EVCNT_TYPE_MISC, NULL,
@@ -337,22 +294,40 @@
return;
}
- sc->sc_panel = &default_panel_info;/* XXX */
-
- switch(sc->sc_panel->bpp) {
+ sc->sc_palettesize = 32;
+ switch (sc->sc_pi->panel_bpp) {
+ case 24:
+ if (!sc->sc_pi->panel_tft) {
+ aprint_error_dev(self,
+ "bpp 24 only support tft, not attaching\n");
+ return;
+ }
+ break;
+ case 12:
case 16:
- case 24:
- case 32:
+ if (sc->sc_pi->panel_mono) {
+ aprint_error_dev(self,
+ "bpp 12/16 only support color, not attaching\n");
+ return;
+ }
+ case 8:
+ sc->sc_palettesize = 512;
+ break;
+ case 4:
+ case 2:
+ case 1:
break;
default:
- aprint_error_dev(self, "bogus display bpp, not attaching\n");
+ aprint_error_dev(self,
+ "bogus display bpp, not attaching: bpp %d\n",
+ sc->sc_pi->panel_bpp);
return;
}
- sc->sc_stride = sc->sc_panel->panel_width * sc->sc_panel->bpp / 8;
+ sc->sc_stride = sc->sc_pi->panel_width * sc->sc_pi->panel_bpp / 8;
- if (sc->sc_panel->panel_width == 0 ||
- sc->sc_panel->panel_height == 0) {
+ if (sc->sc_pi->panel_width == 0 ||
+ sc->sc_pi->panel_height == 0) {
aprint_error_dev(self, "bogus display size, not attaching\n");
return;
}
@@ -367,49 +342,16 @@
tifb_intr, sc);
KASSERT(sc->sc_ih != NULL);
- dict = device_properties(self);
- prop_dictionary_get_bool(dict, "is_console", &is_console);
-#if 0
- edid_data = prop_dictionary_get(dict, "EDID");
- if (edid_data != NULL) {
- struct edid_info ei;
-
- sc->sc_edid_size = min(prop_data_size(edid_data), 1024);
- memset(sc->sc_edid_data, 0, sizeof(sc->sc_edid_data));
- memcpy(sc->sc_edid_data, prop_data_data_nocopy(edid_data),
- sc->sc_edid_size);
-
- edid_parse(sc->sc_edid_data, &ei);
- edid_print(&ei);
- }
-#endif
+ /* setup video DMA */
+ sc->sc_vramsize = sc->sc_palettesize +
+ sc->sc_stride * sc->sc_pi->panel_height;
- /* setup video DMA */
- switch(sc->sc_panel->bpp) {
- case 8:
- sc->sc_palettesize = 512;
- break;
- default:
- sc->sc_palettesize = 32;
- break;
- }
-
- sc->sc_vramsize = sc->sc_palettesize +
- sc->sc_stride * sc->sc_panel->panel_height;
-
- sc->sc_shadowfb = kmem_alloc(sc->sc_vramsize - sc->sc_palettesize,
- KM_NOSLEEP);
- if (sc->sc_shadowfb == NULL) {
- aprint_error_dev(sc->sc_dev,
- "warning: failed to allocate shadow framebuffer\n");
- }
if (bus_dmamem_alloc(sc->sc_dmat, sc->sc_vramsize, 0, 0,
sc->sc_dmamem, 1, &segs, BUS_DMA_NOWAIT) != 0) {
aprint_error_dev(sc->sc_dev,
"failed to allocate video memory\n");
return;
}
-
if (bus_dmamem_map(sc->sc_dmat, sc->sc_dmamem, 1, sc->sc_vramsize,
&sc->sc_vramaddr, BUS_DMA_NOWAIT | BUS_DMA_PREFETCHABLE) != 0) {
aprint_error_dev(sc->sc_dev, "failed to map video RAM\n");
@@ -431,38 +373,49 @@
}
memset((void *)sc->sc_vramaddr, 0, sc->sc_vramsize);
-
- sc->sc_palette[0] = 0x4000;
-#if 0 /* XXX */
- if (sc->sc_panel->bpp == 8) {
+ switch (sc->sc_pi->panel_bpp) {
+ case 8:
Home |
Main Index |
Thread Index |
Old Index