Home | History | Annotate | Line # | Download | only in xscale
pxa2x0_lcd.h revision 1.3.10.1
      1  1.3.10.1  elad /* $NetBSD: pxa2x0_lcd.h,v 1.3.10.1 2006/04/19 02:32:15 elad Exp $ */
      2       1.1   bsh /*
      3       1.1   bsh  * Copyright (c) 2002  Genetec Corporation.  All rights reserved.
      4       1.1   bsh  * Written by Hiroyuki Bessho for Genetec Corporation.
      5       1.1   bsh  *
      6       1.1   bsh  * Redistribution and use in source and binary forms, with or without
      7       1.1   bsh  * modification, are permitted provided that the following conditions
      8       1.1   bsh  * are met:
      9       1.1   bsh  * 1. Redistributions of source code must retain the above copyright
     10       1.1   bsh  *    notice, this list of conditions and the following disclaimer.
     11       1.1   bsh  * 2. Redistributions in binary form must reproduce the above copyright
     12       1.1   bsh  *    notice, this list of conditions and the following disclaimer in the
     13       1.1   bsh  *    documentation and/or other materials provided with the distribution.
     14       1.1   bsh  * 3. All advertising materials mentioning features or use of this software
     15       1.1   bsh  *    must display the following acknowledgement:
     16       1.1   bsh  *	This product includes software developed for the NetBSD Project by
     17       1.1   bsh  *	Genetec Corporation.
     18       1.1   bsh  * 4. The name of Genetec Corporation may not be used to endorse or
     19       1.1   bsh  *    promote products derived from this software without specific prior
     20       1.1   bsh  *    written permission.
     21       1.1   bsh  *
     22       1.1   bsh  * THIS SOFTWARE IS PROVIDED BY GENETEC CORPORATION ``AS IS'' AND
     23       1.1   bsh  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
     24       1.1   bsh  * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
     25       1.1   bsh  * PURPOSE ARE DISCLAIMED.  IN NO EVENT SHALL GENETEC CORPORATION
     26       1.1   bsh  * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
     27       1.1   bsh  * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
     28       1.1   bsh  * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
     29       1.1   bsh  * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
     30       1.1   bsh  * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
     31       1.1   bsh  * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
     32       1.1   bsh  * POSSIBILITY OF SUCH DAMAGE.
     33       1.1   bsh  */
     34       1.1   bsh 
     35       1.1   bsh 
     36       1.1   bsh #ifndef _ARM_XSCALE_PXA2X0_LCD_H
     37       1.1   bsh #define _ARM_XSCALE_PXA2X0_LCD_H
     38       1.1   bsh 
     39       1.1   bsh #include <dev/rasops/rasops.h>
     40       1.1   bsh #include <machine/bus.h>
     41       1.1   bsh 
     42       1.1   bsh /* LCD Contoroller */
     43       1.1   bsh 
     44       1.1   bsh struct	lcd_dma_descriptor {
     45       1.1   bsh 	uint32_t	fdadr;	/* next frame descriptor */
     46       1.1   bsh 	uint32_t	fsadr;	/* frame start address */
     47       1.1   bsh 	uint32_t	fidr;	/* frame ID */
     48       1.1   bsh 	uint32_t	ldcmd;	/* DMA command */
     49       1.1   bsh #define	LDCMD_PAL	(1U<<26)	/* Pallet buffer */
     50       1.1   bsh #define LDCMD_SOFINT	(1U<<22)	/* Start of Frame interrupt */
     51       1.1   bsh #define LDCMD_EOFINT	(1U<<21)	/* End of Frame interrupt */
     52       1.1   bsh };
     53       1.1   bsh 
     54       1.1   bsh 
     55       1.1   bsh struct pxa2x0_lcd_screen {
     56       1.1   bsh 	LIST_ENTRY(pxa2x0_lcd_screen) link;
     57       1.1   bsh 
     58       1.1   bsh 	/* Frame buffer */
     59       1.1   bsh 	bus_dmamap_t dma;
     60       1.1   bsh 	bus_dma_segment_t segs[1];
     61       1.1   bsh 	int 	nsegs;
     62       1.1   bsh 	size_t  buf_size;
     63       1.1   bsh 	size_t  map_size;
     64       1.1   bsh 	void 	*buf_va;
     65       1.1   bsh 	int	depth;
     66       1.1   bsh 
     67       1.1   bsh 	/* DMA frame descriptor */
     68       1.1   bsh 	struct	lcd_dma_descriptor *dma_desc;
     69       1.1   bsh 	paddr_t	dma_desc_pa;
     70       1.1   bsh 
     71       1.1   bsh 	/* rasterop */
     72       1.1   bsh 	struct rasops_info rinfo;
     73       1.1   bsh };
     74       1.1   bsh 
     75       1.1   bsh struct pxa2x0_lcd_softc {
     76       1.1   bsh 	struct device  dev;
     77       1.1   bsh 	/* control register */
     78       1.1   bsh 	bus_space_tag_t  	iot;
     79       1.1   bsh 	bus_space_handle_t	ioh;
     80       1.1   bsh 	bus_dma_tag_t    	dma_tag;
     81       1.1   bsh 
     82       1.1   bsh 	const struct lcd_panel_geometry *geometry;
     83       1.1   bsh 
     84       1.1   bsh 	int n_screens;
     85       1.1   bsh 	LIST_HEAD(, pxa2x0_lcd_screen) screens;
     86       1.1   bsh 	struct pxa2x0_lcd_screen *active;
     87       1.1   bsh 	void *ih;			/* interrupt handler */
     88       1.1   bsh };
     89       1.1   bsh 
     90       1.2   bsh void pxa2x0_lcd_attach_sub(struct pxa2x0_lcd_softc *, struct pxaip_attach_args *,
     91       1.2   bsh 			   const struct lcd_panel_geometry *);
     92       1.2   bsh void pxa2x0_lcd_start_dma(struct pxa2x0_lcd_softc *, struct pxa2x0_lcd_screen *);
     93       1.1   bsh 
     94       1.1   bsh struct lcd_panel_geometry {
     95       1.1   bsh 	short panel_width;
     96       1.1   bsh 	short panel_height;
     97       1.1   bsh 	short extra_lines;
     98       1.1   bsh 
     99       1.1   bsh 	short panel_info;
    100       1.1   bsh #define LCDPANEL_VSP	(1<<0)		/* L_FCLK pin is active low */
    101       1.1   bsh #define LCDPANEL_HSP	(1<<1)		/* L_LCLK pin is active low */
    102       1.1   bsh #define LCDPANEL_PCP	(1<<2)		/* use L_PCLK falling edge */
    103       1.1   bsh #define LCDPANEL_OEP	(1<<3)		/* L_BIAS pin is active low */
    104       1.1   bsh #define LCDPANEL_DPC	(1<<4)		/* double pixel clock mode */
    105       1.1   bsh 
    106       1.1   bsh #define LCDPANEL_DUAL	(1<<5)		/* Dual or single */
    107       1.1   bsh #define LCDPANEL_SINGLE 0
    108       1.1   bsh #define LCDPANEL_ACTIVE	(1<<6)		/* Active or Passive */
    109       1.1   bsh #define LCDPANEL_PASSIVE 0
    110       1.1   bsh #define LCDPANEL_MONOCHROME (1<<7)	/* depth=1 */
    111       1.1   bsh 
    112       1.1   bsh 	short pixel_clock_div;		/* pixel clock divider */
    113       1.1   bsh 	short ac_bias;			/* AC bias pin frequency */
    114       1.1   bsh 
    115       1.1   bsh 	short hsync_pulse_width;	/* Horizontao sync pulse width */
    116       1.1   bsh 	short beg_line_wait;		/* beginning of line wait (BLW) */
    117       1.1   bsh 	short end_line_wait;		/* end of line pxel wait (ELW) */
    118       1.1   bsh 
    119       1.1   bsh 	short vsync_pulse_width;	/* vertical sync pulse width */
    120       1.1   bsh 	short beg_frame_wait;		/* beginning of frame wait (BFW) */
    121       1.1   bsh 	short end_frame_wait;		/* end of frame wait (EFW) */
    122       1.1   bsh };
    123       1.1   bsh 
    124       1.2   bsh void pxa2x0_lcd_geometry(struct pxa2x0_lcd_softc *,
    125       1.1   bsh 		          const struct lcd_panel_geometry *);
    126       1.1   bsh struct pxa2x0_lcd_screen *pxa2x0_lcd_new_screen(
    127       1.2   bsh 	struct pxa2x0_lcd_softc *, int depth);
    128       1.1   bsh 
    129       1.1   bsh /*
    130       1.1   bsh  * we need bits-per-pixel value to configure wsdisplay screen
    131       1.1   bsh  */
    132       1.1   bsh struct pxa2x0_wsscreen_descr {
    133       1.1   bsh 	struct wsscreen_descr  c;	/* standard descriptor */
    134       1.1   bsh 	int depth;			/* bits per pixel */
    135       1.1   bsh };
    136       1.1   bsh 
    137       1.1   bsh int pxa2x0_lcd_setup_wsscreen(struct pxa2x0_wsscreen_descr *,
    138       1.1   bsh     const struct lcd_panel_geometry *, const char * );
    139       1.1   bsh 
    140       1.1   bsh int pxa2x0_lcd_show_screen(void *, void *, int, void (*)(void *, int, int), void *);
    141  1.3.10.1  elad int pxa2x0_lcd_ioctl(void *v, void *, u_long cmd, caddr_t data, int flag, struct lwp *l);
    142  1.3.10.1  elad paddr_t	pxa2x0_lcd_mmap(void *, void *, off_t, int);
    143       1.1   bsh int pxa2x0_lcd_alloc_screen(void *, const struct wsscreen_descr *,
    144       1.1   bsh 	    void **, int *, int *, long *);
    145       1.1   bsh void pxa2x0_lcd_free_screen(void *, void *);
    146       1.1   bsh 
    147       1.1   bsh extern const struct wsdisplay_emulops pxa2x0_lcd_emulops;
    148       1.1   bsh 
    149       1.1   bsh #endif /* _ARM_XSCALE_PXA2X0_LCD_H */
    150