summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorgonzo <gonzo@FreeBSD.org>2015-01-25 22:08:36 +0000
committergonzo <gonzo@FreeBSD.org>2015-01-25 22:08:36 +0000
commitfad3fbbf45006174f321fd2ba796cece12a8b6f3 (patch)
treeea28c5a41d263a0f1e21f9e6bed2a99b34283ebd
parent71eba92ca59be0af74c0d1ed3e68559add33521c (diff)
downloadFreeBSD-src-fad3fbbf45006174f321fd2ba796cece12a8b6f3.zip
FreeBSD-src-fad3fbbf45006174f321fd2ba796cece12a8b6f3.tar.gz
Add vt(4) support to AM335x LCDC driver
-rw-r--r--sys/arm/ti/am335x/am335x_lcd.c51
-rw-r--r--sys/arm/ti/am335x/files.am335x2
2 files changed, 49 insertions, 4 deletions
diff --git a/sys/arm/ti/am335x/am335x_lcd.c b/sys/arm/ti/am335x/am335x_lcd.c
index 4fd811c..053567e 100644
--- a/sys/arm/ti/am335x/am335x_lcd.c
+++ b/sys/arm/ti/am335x/am335x_lcd.c
@@ -27,6 +27,7 @@
#include <sys/cdefs.h>
__FBSDID("$FreeBSD$");
+#include "opt_syscons.h"
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/kernel.h>
@@ -41,8 +42,6 @@ __FBSDID("$FreeBSD$");
#include <sys/sysctl.h>
#include <vm/vm.h>
#include <vm/pmap.h>
-
-/* syscons bits */
#include <sys/fbio.h>
#include <sys/consio.h>
@@ -54,7 +53,11 @@ __FBSDID("$FreeBSD$");
#include <dev/ofw/ofw_bus_subr.h>
#include <dev/fb/fbreg.h>
+#ifdef DEV_SC
#include <dev/syscons/syscons.h>
+#else /* VT */
+#include <dev/vt/vt.h>
+#endif
#include <arm/ti/ti_prcm.h>
#include <arm/ti/ti_scm.h>
@@ -62,6 +65,8 @@ __FBSDID("$FreeBSD$");
#include "am335x_lcd.h"
#include "am335x_pwm.h"
+#include "fb_if.h"
+
#define LCD_PID 0x00
#define LCD_CTRL 0x04
#define CTRL_DIV_MASK 0xff
@@ -178,6 +183,7 @@ __FBSDID("$FreeBSD$");
struct am335x_lcd_softc {
device_t sc_dev;
+ struct fb_info sc_fb_info;
struct resource *sc_mem_res;
struct resource *sc_irq_res;
void *sc_intr_hl;
@@ -410,7 +416,9 @@ done:
static int
am335x_lcd_probe(device_t dev)
{
+#ifdef DEV_SC
int err;
+#endif
if (!ofw_bus_status_okay(dev))
return (ENXIO);
@@ -420,10 +428,12 @@ am335x_lcd_probe(device_t dev)
device_set_desc(dev, "AM335x LCD controller");
+#ifdef DEV_SC
err = sc_probe_unit(device_get_unit(dev),
device_get_flags(dev) | SC_AUTODETECT_KBD);
if (err != 0)
return (err);
+#endif
return (BUS_PROBE_DEFAULT);
}
@@ -670,6 +680,16 @@ am335x_lcd_attach(device_t dev)
PWM_PERIOD, PWM_PERIOD) == 0)
sc->sc_backlight = 100;
+ sc->sc_fb_info.fb_name = device_get_nameunit(sc->sc_dev);
+ sc->sc_fb_info.fb_vbase = (intptr_t)sc->sc_fb_base;
+ sc->sc_fb_info.fb_pbase = sc->sc_fb_phys;
+ sc->sc_fb_info.fb_size = sc->sc_fb_size;
+ sc->sc_fb_info.fb_bpp = sc->sc_fb_info.fb_depth = panel.bpp;
+ sc->sc_fb_info.fb_stride = panel.panel_width*panel.bpp / 8;
+ sc->sc_fb_info.fb_width = panel.panel_width;
+ sc->sc_fb_info.fb_height = panel.panel_height;
+
+#ifdef DEV_SC
err = (sc_attach_unit(device_get_unit(dev),
device_get_flags(dev) | SC_AUTODETECT_KBD));
@@ -679,6 +699,18 @@ am335x_lcd_attach(device_t dev)
}
am335x_lcd_syscons_setup((vm_offset_t)sc->sc_fb_base, sc->sc_fb_phys, &panel);
+#else /* VT */
+ device_t fbd = device_add_child(dev, "fbd",
+ device_get_unit(dev));
+ if (fbd == NULL) {
+ device_printf(dev, "Failed to add fbd child\n");
+ goto fail;
+ }
+ if (device_probe_and_attach(fbd) != 0) {
+ device_printf(dev, "Failed to attach fbd device\n");
+ goto fail;
+ }
+#endif
return (0);
@@ -693,16 +725,29 @@ am335x_lcd_detach(device_t dev)
return (EBUSY);
}
+static struct fb_info *
+am335x_lcd_fb_getinfo(device_t dev)
+{
+ struct am335x_lcd_softc *sc;
+
+ sc = device_get_softc(dev);
+
+ return (&sc->sc_fb_info);
+}
+
static device_method_t am335x_lcd_methods[] = {
DEVMETHOD(device_probe, am335x_lcd_probe),
DEVMETHOD(device_attach, am335x_lcd_attach),
DEVMETHOD(device_detach, am335x_lcd_detach),
+ /* Framebuffer service methods */
+ DEVMETHOD(fb_getinfo, am335x_lcd_fb_getinfo),
+
DEVMETHOD_END
};
static driver_t am335x_lcd_driver = {
- "am335x_lcd",
+ "fb",
am335x_lcd_methods,
sizeof(struct am335x_lcd_softc),
};
diff --git a/sys/arm/ti/am335x/files.am335x b/sys/arm/ti/am335x/files.am335x
index 465a7fc..aee414f 100644
--- a/sys/arm/ti/am335x/files.am335x
+++ b/sys/arm/ti/am335x/files.am335x
@@ -4,7 +4,7 @@ arm/ti/aintc.c standard
arm/ti/am335x/am335x_dmtimer.c standard
arm/ti/am335x/am335x_gpio.c optional gpio
-arm/ti/am335x/am335x_lcd.c optional sc
+arm/ti/am335x/am335x_lcd.c optional sc | vt
arm/ti/am335x/am335x_lcd_syscons.c optional sc
arm/ti/am335x/am335x_pmic.c optional am335x_pmic
arm/ti/am335x/am335x_prcm.c standard
OpenPOWER on IntegriCloud