void
lcd_attach(device_t parent, device_t self, void *aux)
{
	struct s3c24x0_lcd_softc *sc = device_private(self);
	bus_space_tag_t iot =  s3c2xx0_softc->sc_iot;
	bus_space_handle_t gpio_ioh = s3c2xx0_softc->sc_gpio_ioh;
#if NWSDISPLAY > 0
	struct wsemuldisplaydev_attach_args aa;
#else
	struct s3c24x0_lcd_screen *screen;
#endif


	sc->sc_dev = self;
	aprint_normal( "\n" );

	/* setup GPIO ports for LCD */
	/* XXX: some LCD panels may not need all VD signals */
	gpio_ioh = s3c2xx0_softc->sc_gpio_ioh;
	bus_space_write_4(iot, gpio_ioh, GPIO_PCUP, ~0);
	bus_space_write_4(iot, gpio_ioh, GPIO_PCCON, 0xaaaaaaaa);
	bus_space_write_4(iot, gpio_ioh, GPIO_PDUP, ~0);
	bus_space_write_4(iot, gpio_ioh, GPIO_PDCON, 0xaaaaaaaa);

	s3c24x0_lcd_attach_sub(sc, aux, &samsung_LTS350Q1);

#if NWSDISPLAY > 0

	aa.console = 0;
	aa.scrdata = &lcd_screen_list;
	aa.accessops = &lcd_accessops;
	aa.accesscookie = sc;


	(void) config_found(self, &aa, wsemuldisplaydevprint);
#else

	screen = s3c24x0_lcd_new_screen(sc, 240, 320, 16);

	if( screen ){
		sc->active = screen;
		s3c24x0_lcd_start_dma(sc, screen);
		s3c24x0_lcd_power(sc, 1);
	}
#endif /* NWSDISPLAY */

}
Ejemplo n.º 2
0
int
s3c24x0_lcd_alloc_screen(void *v, const struct wsscreen_descr *_type,
    void **cookiep, int *curxp, int *curyp, long *attrp)
{
	struct s3c24x0_lcd_softc *sc = v;
	struct s3c24x0_lcd_screen *scr;
	const struct s3c24x0_wsscreen_descr *type =
	    (const struct s3c24x0_wsscreen_descr *)_type;

	int width, height;

	width = type->c.ncols * type->c.fontwidth;
	height = type->c.nrows * type->c.fontwidth;

	if (width < sc->panel_info->panel_width)
		width =   sc->panel_info->panel_width;
	if (height < sc->panel_info->panel_height)
		height =   sc->panel_info->panel_height;


	scr = s3c24x0_lcd_new_screen(sc, width, height, type->depth);
	if (scr == NULL)
		return -1;
	
	/*
	 * initialize raster operation for this screen.
	 */
	scr->rinfo.ri_flg = 0;
	scr->rinfo.ri_depth = type->depth;
	scr->rinfo.ri_bits = scr->buf_va;
	scr->rinfo.ri_width = width;
	scr->rinfo.ri_height = height;
	scr->rinfo.ri_stride = scr->stride;

	if (type->c.fontwidth || type->c.fontheight) {
		/* 
		 * find a font with specified size
		 */
		int cookie;

		wsfont_init();

		cookie = wsfont_find(NULL, type->c.fontwidth, 
		    type->c.fontheight, 0, WSDISPLAY_FONTORDER_L2R,
		    WSDISPLAY_FONTORDER_L2R);

		if (cookie > 0) {
			if (wsfont_lock(cookie, &scr->rinfo.ri_font))
				scr->rinfo.ri_wsfcookie = cookie;
		}
	}

	rasops_init(&scr->rinfo, type->c.nrows, type->c.ncols);

	(* scr->rinfo.ri_ops.allocattr)(&scr->rinfo, 0, 0, 0, attrp);

	if (type->c.nrows != scr->rinfo.ri_rows ||
	    type->c.ncols != scr->rinfo.ri_cols) {

		aprint_error("%s: can't allocate a screen with requested size:"
		    "%d x %d -> %d x %d\n",
		    sc->dev.dv_xname,
		    type->c.ncols, type->c.nrows,
		    scr->rinfo.ri_cols, scr->rinfo.ri_rows);
	}

	*cookiep = scr;
	*curxp = 0;
	*curyp = 0;

	return 0;
}