Home | History | Annotate | Line # | Download | only in s3c2xx0
s3c24x0_lcd.h revision 1.5.2.1
      1  1.5.2.1      yamt /* $NetBSD: s3c24x0_lcd.h,v 1.5.2.1 2012/04/17 00:06:07 yamt Exp $ */
      2      1.1       bsh 
      3      1.1       bsh /*
      4      1.1       bsh  * Copyright (c) 2004  Genetec Corporation.  All rights reserved.
      5      1.1       bsh  * Written by Hiroyuki Bessho for Genetec Corporation.
      6      1.1       bsh  *
      7      1.1       bsh  * Redistribution and use in source and binary forms, with or without
      8      1.1       bsh  * modification, are permitted provided that the following conditions
      9      1.1       bsh  * are met:
     10      1.1       bsh  * 1. Redistributions of source code must retain the above copyright
     11      1.1       bsh  *    notice, this list of conditions and the following disclaimer.
     12      1.1       bsh  * 2. Redistributions in binary form must reproduce the above copyright
     13      1.1       bsh  *    notice, this list of conditions and the following disclaimer in the
     14      1.1       bsh  *    documentation and/or other materials provided with the distribution.
     15      1.1       bsh  * 3. The name of Genetec Corporation may not be used to endorse or
     16      1.1       bsh  *    promote products derived from this software without specific prior
     17      1.1       bsh  *    written permission.
     18      1.1       bsh  *
     19      1.1       bsh  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
     20      1.1       bsh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     21      1.1       bsh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     22      1.1       bsh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
     23      1.1       bsh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     24      1.1       bsh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     25      1.1       bsh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     26      1.1       bsh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     27      1.1       bsh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     28      1.1       bsh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     29      1.1       bsh  * POSSIBILITY OF SUCH DAMAGE.
     30      1.1       bsh  */
     31      1.1       bsh 
     32      1.1       bsh 
     33      1.1       bsh #ifndef _ARM_S3C2XX0_S3C24X0_LCD_H
     34      1.1       bsh #define	_ARM_S3C2XX0_S3C24X0_LCD_H
     35      1.1       bsh 
     36      1.1       bsh #include <dev/rasops/rasops.h>
     37      1.5    dyoung #include <sys/bus.h>
     38      1.1       bsh 
     39      1.1       bsh /* LCD Contoroller */
     40      1.1       bsh 
     41      1.1       bsh struct s3c24x0_lcd_screen {
     42      1.1       bsh 	LIST_ENTRY(s3c24x0_lcd_screen) link;
     43      1.1       bsh 
     44      1.1       bsh 	/* Frame buffer */
     45      1.1       bsh 	bus_dmamap_t dma;
     46      1.1       bsh 	bus_dma_segment_t segs[1];
     47      1.1       bsh 	int 	nsegs;
     48      1.1       bsh 	size_t  buf_size;
     49      1.1       bsh 	size_t  map_size;
     50      1.1       bsh 	void 	*buf_va;
     51      1.1       bsh 	int	depth;
     52      1.1       bsh 	int	stride;
     53      1.1       bsh 
     54      1.1       bsh 	/* rasterop */
     55      1.1       bsh 	struct rasops_info rinfo;
     56      1.1       bsh };
     57      1.1       bsh 
     58      1.1       bsh struct s3c24x0_lcd_softc {
     59  1.5.2.1      yamt 	device_t		sc_dev;
     60      1.1       bsh 
     61      1.1       bsh 	/* control registers */
     62      1.1       bsh 	bus_space_tag_t  	iot;
     63      1.1       bsh 	bus_space_handle_t	ioh;
     64      1.1       bsh 	bus_dma_tag_t    	dma_tag;
     65      1.1       bsh 
     66      1.1       bsh 	const struct s3c24x0_lcd_panel_info *panel_info;
     67      1.1       bsh 
     68      1.1       bsh 	LIST_HEAD(, s3c24x0_lcd_screen) screens;
     69      1.1       bsh 	struct s3c24x0_lcd_screen *active;
     70      1.1       bsh 	void *ih;			/* interrupt handler */
     71      1.1       bsh 
     72      1.1       bsh 	int n_screens;
     73      1.1       bsh 	int lcd_on;			/* LCD is turned on */
     74      1.1       bsh };
     75      1.1       bsh 
     76      1.1       bsh void s3c24x0_lcd_attach_sub(struct s3c24x0_lcd_softc *,
     77      1.1       bsh     struct s3c2xx0_attach_args *, const struct s3c24x0_lcd_panel_info *);
     78      1.1       bsh int s3c24x0_lcd_start_dma(struct s3c24x0_lcd_softc *,
     79      1.1       bsh     struct s3c24x0_lcd_screen *);
     80      1.1       bsh 
     81      1.1       bsh struct s3c24x0_lcd_panel_info {
     82      1.1       bsh 	short panel_width;
     83      1.1       bsh 	short panel_height;
     84      1.1       bsh 	int   pixel_clock;		/* in Hz */
     85      1.1       bsh 
     86      1.1       bsh 	/* Initial values to go to LCD controll registers */
     87      1.1       bsh 	uint32_t lcdcon1;
     88      1.1       bsh 	uint32_t lcdcon2;
     89      1.1       bsh 	uint32_t lcdcon3;
     90      1.1       bsh 	uint32_t lcdcon4;
     91      1.1       bsh 	uint32_t lcdcon5;
     92      1.1       bsh 	uint32_t lpcsel;
     93      1.1       bsh 
     94      1.1       bsh #define	s3c24x0_lcd_panel_tft(info)	\
     95      1.1       bsh 	(((info)->lcdcon1 & LCDCON1_PNRMODE_MASK) == LCDCON1_PNRMODE_TFT)
     96      1.1       bsh };
     97      1.1       bsh 
     98      1.1       bsh void s3c24x0_set_lcd_panel_info(struct s3c24x0_lcd_softc *,
     99      1.1       bsh     const struct s3c24x0_lcd_panel_info *);
    100      1.1       bsh 
    101      1.1       bsh struct s3c24x0_lcd_screen *s3c24x0_lcd_new_screen(struct s3c24x0_lcd_softc *,
    102      1.1       bsh     int, int, int);
    103      1.1       bsh 
    104      1.1       bsh /*
    105      1.1       bsh  * we need bits-per-pixel value to configure wsdisplay screen
    106      1.1       bsh  */
    107      1.1       bsh struct s3c24x0_wsscreen_descr {
    108      1.1       bsh 	struct wsscreen_descr  c;	/* standard descriptor */
    109      1.1       bsh 	int depth;			/* bits per pixel */
    110      1.1       bsh };
    111      1.1       bsh 
    112      1.1       bsh int s3c24x0_lcd_show_screen(void *, void *, int, void (*)(void *, int, int),
    113      1.1       bsh     void *);
    114      1.4  christos int s3c24x0_lcd_ioctl(void *v, void *vs, u_long cmd, void *data, int flag,
    115      1.3      jmmv     struct lwp *p);
    116      1.3      jmmv paddr_t	s3c24x0_lcd_mmap(void *, void *, off_t, int);
    117      1.1       bsh int s3c24x0_lcd_alloc_screen(void *, const struct wsscreen_descr *, void **,
    118      1.1       bsh     int *, int *, long *);
    119      1.1       bsh void s3c24x0_lcd_free_screen(void *, void *);
    120      1.1       bsh void s3c24x0_lcd_power(struct s3c24x0_lcd_softc *, int);
    121      1.1       bsh 
    122      1.1       bsh extern const struct wsdisplay_emulops s3c24x0_lcd_emulops;
    123      1.1       bsh 
    124      1.1       bsh #endif /* _ARM_S3C2XX0_S3C24X0_LCD_H */
    125