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