void s3c24x0_lcd_free_screen(void *v, void *cookie) { struct s3c24x0_lcd_softc *sc = v; struct s3c24x0_lcd_screen *scr = cookie; LIST_REMOVE(scr, link); sc->n_screens--; if (scr == sc->active) { sc->active = NULL; /* XXX: We need a good procedure to shutdown the LCD. */ s3c24x0_lcd_stop_dma(sc); s3c24x0_lcd_power(sc, 0); } if (scr->buf_va) bus_dmamem_unmap(sc->dma_tag, scr->buf_va, scr->map_size); if (scr->nsegs > 0) bus_dmamem_free(sc->dma_tag, scr->segs, scr->nsegs); free(scr, M_DEVBUF); }
int s3c24x0_lcd_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l) { struct s3c24x0_lcd_softc *sc = v; struct wsdisplay_fbinfo *wsdisp_info; struct s3c24x0_lcd_screen *scr; switch (cmd) { case WSDISPLAYIO_GTYPE: *(u_int *)data = WSDISPLAY_TYPE_UNKNOWN; /* XXX */ return 0; case WSDISPLAYIO_GINFO: wsdisp_info = (struct wsdisplay_fbinfo *)data; wsdisp_info->height = sc->panel_info->panel_height; wsdisp_info->width = sc->panel_info->panel_width; wsdisp_info->depth = 16; /* XXX */ wsdisp_info->cmsize = 0; return 0; case WSDISPLAYIO_GETCMAP: case WSDISPLAYIO_PUTCMAP: return EPASSTHROUGH; /* XXX Colormap */ case WSDISPLAYIO_SVIDEO: if (*(int *)data == WSDISPLAYIO_VIDEO_ON) { scr = sc->active; if (scr == NULL) scr = LIST_FIRST(&sc->screens); if (scr == NULL) return ENXIO; s3c24x0_lcd_show_screen(sc, scr, 1, NULL, NULL); } else { s3c24x0_lcd_stop_dma(sc); s3c24x0_lcd_power(sc, 0); } return 0; case WSDISPLAYIO_GVIDEO: *(u_int *)data = sc->lcd_on; return 0; case WSDISPLAYIO_GCURPOS: case WSDISPLAYIO_SCURPOS: case WSDISPLAYIO_GCURMAX: case WSDISPLAYIO_GCURSOR: case WSDISPLAYIO_SCURSOR: return EPASSTHROUGH; /* XXX */ } return EPASSTHROUGH; }
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 */ }
int s3c24x0_lcd_show_screen(void *v, void *cookie, int waitok, void (*cb)(void *, int, int), void *cbarg) { struct s3c24x0_lcd_softc *sc = v; struct s3c24x0_lcd_screen *scr = cookie, *old; /* XXX: make sure the clock is provided for LCD controller */ old = sc->active; if (old == scr && sc->lcd_on) return 0; if (old) s3c24x0_lcd_stop_dma(sc); s3c24x0_lcd_start_dma(sc, scr); sc->active = scr; s3c24x0_lcd_power(sc, 1); /* XXX: callback */ return 0; }