fix LCD drivers for Lubbock and Twintail.

- pass correct attach args to pxa2x0_lcd_attach_sub()
  - make this driver compile without wsdisplay again.
This commit is contained in:
bsh 2010-03-13 11:15:52 +00:00
parent 622048aac2
commit b58b20fe01
3 changed files with 48 additions and 21 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: pxa2x0_lcd.c,v 1.27 2009/01/29 12:28:15 nonaka Exp $ */
/* $NetBSD: pxa2x0_lcd.c,v 1.28 2010/03/13 11:15:52 bsh Exp $ */
/*
* Copyright (c) 2002 Genetec Corporation. All rights reserved.
@ -38,7 +38,7 @@
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: pxa2x0_lcd.c,v 1.27 2009/01/29 12:28:15 nonaka Exp $");
__KERNEL_RCSID(0, "$NetBSD: pxa2x0_lcd.c,v 1.28 2010/03/13 11:15:52 bsh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -82,9 +82,11 @@ int lcdintr(void *);
static void pxa2x0_lcd_initialize(struct pxa2x0_lcd_softc *,
const struct lcd_panel_geometry *);
#if NWSDISPLAY > 0
static void pxa2x0_lcd_setup_rasops(struct pxa2x0_lcd_softc *,
struct rasops_info *, struct pxa2x0_wsscreen_descr *,
const struct lcd_panel_geometry *);
#endif
void
pxa2x0_lcd_geometry(struct pxa2x0_lcd_softc *sc,
@ -249,6 +251,7 @@ pxa2x0_lcd_attach_sub(struct pxa2x0_lcd_softc *sc,
pxa2x0_lcd_initialize(sc, geom);
#if NWSDISPLAY > 0
if (pxa2x0_lcd_console.is_console) {
struct pxa2x0_wsscreen_descr *descr = pxa2x0_lcd_console.descr;
struct pxa2x0_lcd_screen *scr;
@ -278,6 +281,7 @@ pxa2x0_lcd_attach_sub(struct pxa2x0_lcd_softc *sc,
aprint_normal_dev(sc->dev, "console\n");
}
#endif
}
int
@ -368,7 +372,6 @@ pxa2x0_lcd_start_dma(struct pxa2x0_lcd_softc *sc,
restore_interrupts(save);
}
#if NWSDISPLAY > 0
/*
* Disable screen refresh.
*/
@ -391,7 +394,6 @@ pxa2x0_lcd_stop_dma(struct pxa2x0_lcd_softc *sc)
~LCCR0_DIS &
bus_space_read_4(sc->iot, sc->ioh, LCDC_LCCR0));
}
#endif
#define _rgb(r,g,b) (((r)<<11) | ((g)<<5) | b)
#define rgb(r,g,b) _rgb((r)>>1,g,(b)>>1)
@ -604,6 +606,7 @@ pxa2x0_lcd_new_screen(struct pxa2x0_lcd_softc *sc, int depth,
return error;
}
#if NWSDISPLAY > 0
/*
* Initialize rasops for a screen, as well as struct wsscreen_descr if this
* is the first screen creation.
@ -645,6 +648,7 @@ pxa2x0_lcd_setup_rasops(struct pxa2x0_lcd_softc *sc, struct rasops_info *rinfo,
descr->c.capabilities = rinfo->ri_caps;
descr->c.textops = &rinfo->ri_ops;
}
#endif
/*
* Power management

View File

@ -1,4 +1,4 @@
/* $NetBSD: g42xxeb_lcd.c,v 1.12 2009/01/29 12:28:15 nonaka Exp $ */
/* $NetBSD: g42xxeb_lcd.c,v 1.13 2010/03/13 11:15:52 bsh Exp $ */
/*-
* Copyright (c) 2001, 2002, 2005 Genetec corp.
@ -127,7 +127,7 @@ dev_type_ioctl(lcdioctl);
dev_type_mmap(lcdmmap);
const struct cdevsw lcd_cdevsw = {
lcdopen, lcdclose, noread, nowrite,
lcdioctl, nostop, notty, nopoll, lcdmmap, D_TTY
lcdioctl, nostop, notty, nopoll, lcdmmap, nokqfilter, D_TTY
};
#endif
@ -188,19 +188,27 @@ const struct lcd_panel_geometry toshiba_LTM035 =
};
#endif /* G4250_LCD_TOSHIBA_LTM035 */
void lcd_attach( device_t parent, device_t self, void *aux )
void lcd_attach(device_t parent, device_t self, void *aux)
{
struct pxa2x0_lcd_softc *sc = device_private(self);
struct pxaip_attach_args paa;
struct obio_attach_args *oba = aux;
sc->dev = self;
paa.pxa_name = "obio";
paa.pxa_iot = oba->oba_iot;
paa.pxa_addr = oba->oba_addr;
paa.pxa_size = 0; /* XXX */
paa.pxa_intr = oba->oba_intr;
#ifdef G4250_LCD_TOSHIBA_LTM035
# define PANEL toshiba_LTM035
#else
# define PANEL nec_NL3224BC35
#endif
pxa2x0_lcd_attach_sub(sc, aux, &PANEL);
pxa2x0_lcd_attach_sub(sc, &paa, &PANEL);
#if NWSDISPLAY > 0
@ -218,8 +226,6 @@ void lcd_attach( device_t parent, device_t self, void *aux )
aa.accessops = &lcd_accessops;
aa.accesscookie = sc;
printf("\n");
(void) config_found(self, &aa, wsemuldisplaydevprint);
}
#else
@ -232,8 +238,6 @@ void lcd_attach( device_t parent, device_t self, void *aux )
sc->active = screen;
pxa2x0_lcd_start_dma(sc, screen);
}
printf("\n");
}
#endif
@ -246,8 +250,9 @@ void lcd_attach( device_t parent, device_t self, void *aux )
int
lcd_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
{
struct pxa2x0_lcd_softc *sc = v;
struct obio_softc *osc =
(struct obio_softc *) device_parent((struct device *)v);
device_private(device_parent(sc->dev));
uint16_t reg;
switch (cmd) {
@ -273,8 +278,9 @@ int
lcd_show_screen(void *v, void *cookie, int waitok,
void (*cb)(void *, int, int), void *cbarg)
{
struct pxa2x0_lcd_softc *sc = v;
struct obio_softc *osc =
(struct obio_softc *) device_parent((struct device *)v);
device_private(device_parent(sc->dev));
uint16_t reg;
pxa2x0_lcd_show_screen(v,cookie,waitok,cb,cbarg);
@ -295,6 +301,19 @@ lcd_show_screen(void *v, void *cookie, int waitok,
int
lcdopen(dev_t dev, int oflags, int devtype, struct lwp *l)
{
struct pxa2x0_lcd_softc *sc =
device_lookup_private(&lcd_cd, minor(dev));
struct obio_softc *osc =
device_private(device_parent(sc->dev));
uint16_t reg;
/* Turn on LCD backlight.
XXX: with fixed blightness. want new ioctl to set blightness. */
reg = bus_space_read_2(osc->sc_iot, osc->sc_obioreg_ioh, G42XXEB_LCDCTL);
bus_space_write_2(osc->sc_iot, osc->sc_obioreg_ioh, G42XXEB_LCDCTL,
(reg & ~LCDCTL_BL_PWN) | 0x4000 | LCDCTL_BL_ON);
return 0;
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: lubbock_lcd.c,v 1.10 2009/05/29 14:15:44 rjs Exp $ */
/* $NetBSD: lubbock_lcd.c,v 1.11 2010/03/13 11:15:52 bsh Exp $ */
/*
* Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved.
@ -40,7 +40,7 @@
* LCD panel geometry
*/
#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: lubbock_lcd.c,v 1.10 2009/05/29 14:15:44 rjs Exp $");
__KERNEL_RCSID(0, "$NetBSD: lubbock_lcd.c,v 1.11 2010/03/13 11:15:52 bsh Exp $");
#include <sys/param.h>
#include <sys/systm.h>
@ -174,10 +174,18 @@ static const struct lcd_panel_geometry sharp_LM8V31 =
void lcd_attach( device_t parent, device_t self, void *aux )
{
struct pxa2x0_lcd_softc *sc = device_private(self);
struct obio_attach_args *oba = aux;
struct pxaip_attach_args paa;
sc->dev = self;
pxa2x0_lcd_attach_sub(sc, aux, &sharp_LM8V31);
paa.pxa_name = "obio";
paa.pxa_iot = oba->oba_iot;
paa.pxa_addr = oba->oba_addr;
paa.pxa_size = 0; /* XXX */
paa.pxa_intr = oba->oba_intr;
pxa2x0_lcd_attach_sub(sc, &paa, &sharp_LM8V31);
#if NWSDISPLAY > 0
@ -195,8 +203,6 @@ void lcd_attach( device_t parent, device_t self, void *aux )
aa.accessops = &lcd_accessops;
aa.accesscookie = sc;
printf( "\n" );
(void) config_found(self, &aa, wsemuldisplaydevprint);
}
#else
@ -209,8 +215,6 @@ void lcd_attach( device_t parent, device_t self, void *aux )
sc->active = screen;
pxa2x0_lcd_start_dma( sc, screen );
}
printf( "\n" );
}
#endif