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