Add vt(4) support to AM335x LCDC driver
This commit is contained in:
parent
2aa533b91d
commit
72584f4cba
@ -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 @@ am335x_lcd_intr(void *arg)
|
||||
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),
|
||||
};
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user