ipaq_lcd.c revision 1.3.8.2 1 1.3.8.2 nathanw /* $NetBSD: ipaq_lcd.c,v 1.3.8.2 2002/01/08 00:24:51 nathanw Exp $ */
2 1.3.8.2 nathanw #define IPAQ_LCD_DEBUG
3 1.3.8.2 nathanw
4 1.3.8.2 nathanw /*
5 1.3.8.2 nathanw * Copyright (c) 2001 The NetBSD Foundation, Inc.
6 1.3.8.2 nathanw * All rights reserved.
7 1.3.8.2 nathanw *
8 1.3.8.2 nathanw * This code is derived from software contributed to The NetBSD Foundation
9 1.3.8.2 nathanw * by Ichiro FUKUHARA (ichiro (at) ichiro.org).
10 1.3.8.2 nathanw *
11 1.3.8.2 nathanw * Redistribution and use in source and binary forms, with or without
12 1.3.8.2 nathanw * modification, are permitted provided that the following conditions
13 1.3.8.2 nathanw * are met:
14 1.3.8.2 nathanw * 1. Redistributions of source code must retain the above copyright
15 1.3.8.2 nathanw * notice, this list of conditions and the following disclaimer.
16 1.3.8.2 nathanw * 2. Redistributions in binary form must reproduce the above copyright
17 1.3.8.2 nathanw * notice, this list of conditions and the following disclaimer in the
18 1.3.8.2 nathanw * documentation and/or other materials provided with the distribution.
19 1.3.8.2 nathanw * 3. All advertising materials mentioning features or use of this software
20 1.3.8.2 nathanw * must display the following acknowledgement:
21 1.3.8.2 nathanw * This product includes software developed by the NetBSD
22 1.3.8.2 nathanw * Foundation, Inc. and its contributors.
23 1.3.8.2 nathanw * 4. Neither the name of The NetBSD Foundation nor the names of its
24 1.3.8.2 nathanw * contributors may be used to endorse or promote products derived
25 1.3.8.2 nathanw * from this software without specific prior written permission.
26 1.3.8.2 nathanw *
27 1.3.8.2 nathanw * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
28 1.3.8.2 nathanw * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
29 1.3.8.2 nathanw * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
30 1.3.8.2 nathanw * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
31 1.3.8.2 nathanw * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
32 1.3.8.2 nathanw * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
33 1.3.8.2 nathanw * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
34 1.3.8.2 nathanw * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
35 1.3.8.2 nathanw * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
36 1.3.8.2 nathanw * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
37 1.3.8.2 nathanw * POSSIBILITY OF SUCH DAMAGE.
38 1.3.8.2 nathanw */
39 1.3.8.2 nathanw
40 1.3.8.2 nathanw #include <sys/types.h>
41 1.3.8.2 nathanw #include <sys/param.h>
42 1.3.8.2 nathanw #include <sys/systm.h>
43 1.3.8.2 nathanw #include <sys/kernel.h>
44 1.3.8.2 nathanw #include <sys/time.h>
45 1.3.8.2 nathanw #include <sys/device.h>
46 1.3.8.2 nathanw
47 1.3.8.2 nathanw #include <uvm/uvm_extern.h>
48 1.3.8.2 nathanw
49 1.3.8.2 nathanw #include <dev/wscons/wsconsio.h>
50 1.3.8.2 nathanw
51 1.3.8.2 nathanw #include <machine/bootinfo.h>
52 1.3.8.2 nathanw #include <machine/bus.h>
53 1.3.8.2 nathanw #include <machine/intr.h>
54 1.3.8.2 nathanw #include <arm/cpufunc.h>
55 1.3.8.2 nathanw #include <arm/arm32/katelib.h>
56 1.3.8.2 nathanw
57 1.3.8.2 nathanw #include <hpcarm/sa11x0/sa11x0_reg.h>
58 1.3.8.2 nathanw #include <hpcarm/sa11x0/sa11x0_gpioreg.h>
59 1.3.8.2 nathanw
60 1.3.8.2 nathanw #include <hpcarm/dev/ipaq_gpioreg.h>
61 1.3.8.2 nathanw #include <hpcarm/dev/ipaq_saipvar.h>
62 1.3.8.2 nathanw #include <hpcarm/dev/ipaq_lcdreg.h>
63 1.3.8.2 nathanw #include <hpcarm/dev/ipaq_lcdvar.h>
64 1.3.8.2 nathanw
65 1.3.8.2 nathanw #ifdef IPAQ_LCD_DEBUG
66 1.3.8.2 nathanw #define DPRINTFN(n, x) if (ipaqlcddebug > (n)) printf x
67 1.3.8.2 nathanw int ipaqlcddebug = 0xff;
68 1.3.8.2 nathanw #else
69 1.3.8.2 nathanw #define DPRINTFN(n, x)
70 1.3.8.2 nathanw #endif
71 1.3.8.2 nathanw #define DPRINTF(x) DPRINTFN(0, x)
72 1.3.8.2 nathanw
73 1.3.8.2 nathanw static int ipaqlcd_match(struct device *, struct cfdata *, void *);
74 1.3.8.2 nathanw static void ipaqlcd_attach(struct device *, struct device *, void *);
75 1.3.8.2 nathanw static void ipaqlcd_init(struct ipaqlcd_softc *);
76 1.3.8.2 nathanw static int ipaqlcd_fbinit(struct ipaqlcd_softc *);
77 1.3.8.2 nathanw static int ipaqlcd_ioctl(void *, u_long, caddr_t, int, struct proc *);
78 1.3.8.2 nathanw static paddr_t ipaqlcd_mmap(void *, off_t offset, int);
79 1.3.8.2 nathanw
80 1.3.8.2 nathanw #if defined __mips__ || defined __sh__ || defined __arm__
81 1.3.8.2 nathanw #define __BTOP(x) ((paddr_t)(x) >> PGSHIFT)
82 1.3.8.2 nathanw #define __PTOB(x) ((paddr_t)(x) << PGSHIFT)
83 1.3.8.2 nathanw #else
84 1.3.8.2 nathanw #error "define btop, ptob."
85 1.3.8.2 nathanw #endif
86 1.3.8.2 nathanw
87 1.3.8.2 nathanw struct cfattach ipaqlcd_ca = {
88 1.3.8.2 nathanw sizeof(struct ipaqlcd_softc), ipaqlcd_match, ipaqlcd_attach
89 1.3.8.2 nathanw };
90 1.3.8.2 nathanw
91 1.3.8.2 nathanw struct hpcfb_accessops ipaqlcd_ha = {
92 1.3.8.2 nathanw ipaqlcd_ioctl, ipaqlcd_mmap
93 1.3.8.2 nathanw };
94 1.3.8.2 nathanw static int console_flag = 0;
95 1.3.8.2 nathanw
96 1.3.8.2 nathanw static int
97 1.3.8.2 nathanw ipaqlcd_match(parent, match, aux)
98 1.3.8.2 nathanw struct device *parent;
99 1.3.8.2 nathanw struct cfdata *match;
100 1.3.8.2 nathanw void *aux;
101 1.3.8.2 nathanw {
102 1.3.8.2 nathanw return (1);
103 1.3.8.2 nathanw }
104 1.3.8.2 nathanw
105 1.3.8.2 nathanw void
106 1.3.8.2 nathanw ipaqlcd_attach(parent, self, aux)
107 1.3.8.2 nathanw struct device *parent;
108 1.3.8.2 nathanw struct device *self;
109 1.3.8.2 nathanw void *aux;
110 1.3.8.2 nathanw {
111 1.3.8.2 nathanw struct ipaqlcd_softc *sc = (struct ipaqlcd_softc*)self;
112 1.3.8.2 nathanw struct hpcfb_attach_args ha;
113 1.3.8.2 nathanw struct ipaq_softc *psc = (struct ipaq_softc *)parent;
114 1.3.8.2 nathanw
115 1.3.8.2 nathanw sc->sc_iot = psc->sc_iot;
116 1.3.8.2 nathanw sc->sc_parent = (struct ipaq_softc *)parent;
117 1.3.8.2 nathanw
118 1.3.8.2 nathanw ipaqlcd_init(sc);
119 1.3.8.2 nathanw ipaqlcd_fbinit(sc);
120 1.3.8.2 nathanw
121 1.3.8.2 nathanw printf("\n");
122 1.3.8.2 nathanw printf("%s: iPAQ internal LCD controller\n", sc->sc_dev.dv_xname);
123 1.3.8.2 nathanw
124 1.3.8.2 nathanw DPRINTF(("framebuffer_baseaddr=%lx\n", (u_long)bootinfo->fb_addr));
125 1.3.8.2 nathanw
126 1.3.8.2 nathanw ha.ha_console = console_flag;
127 1.3.8.2 nathanw ha.ha_accessops = &ipaqlcd_ha;
128 1.3.8.2 nathanw ha.ha_accessctx = sc;
129 1.3.8.2 nathanw ha.ha_curfbconf = 0;
130 1.3.8.2 nathanw ha.ha_nfbconf = 1;
131 1.3.8.2 nathanw ha.ha_fbconflist = &sc->sc_fbconf;
132 1.3.8.2 nathanw ha.ha_curdspconf = 0;
133 1.3.8.2 nathanw ha.ha_ndspconf = 1;
134 1.3.8.2 nathanw ha.ha_dspconflist = &sc->sc_dspconf;
135 1.3.8.2 nathanw
136 1.3.8.2 nathanw config_found(&sc->sc_dev, &ha, hpcfbprint);
137 1.3.8.2 nathanw }
138 1.3.8.2 nathanw
139 1.3.8.2 nathanw void
140 1.3.8.2 nathanw ipaqlcd_init(sc)
141 1.3.8.2 nathanw struct ipaqlcd_softc *sc;
142 1.3.8.2 nathanw {
143 1.3.8.2 nathanw /* Initialization of Extended GPIO */
144 1.3.8.2 nathanw sc->sc_parent->ipaq_egpio |= EGPIO_LCD_INIT;
145 1.3.8.2 nathanw bus_space_write_2(sc->sc_iot, sc->sc_parent->sc_egpioh,
146 1.3.8.2 nathanw 0, sc->sc_parent->ipaq_egpio);
147 1.3.8.2 nathanw
148 1.3.8.2 nathanw if (bus_space_map(sc->sc_iot, SALCD_BASE, SALCD_NPORTS,
149 1.3.8.2 nathanw 0, &sc->sc_ioh))
150 1.3.8.2 nathanw panic("ipaqlcd_init:Cannot map registers\n");
151 1.3.8.2 nathanw
152 1.3.8.2 nathanw (u_long)bootinfo->fb_addr =
153 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_BA1);
154 1.3.8.2 nathanw
155 1.3.8.2 nathanw /*
156 1.3.8.2 nathanw * Initialize LCD Control Register 0 - 3
157 1.3.8.2 nathanw * must initialize DMA Channel Base Address Register
158 1.3.8.2 nathanw * before enabling LCD(LEN = 1)
159 1.3.8.2 nathanw */
160 1.3.8.2 nathanw bus_space_write_4(sc->sc_iot, sc->sc_ioh,
161 1.3.8.2 nathanw SALCD_CR1, IPAQ_LCCR1);
162 1.3.8.2 nathanw bus_space_write_4(sc->sc_iot, sc->sc_ioh,
163 1.3.8.2 nathanw SALCD_CR2, IPAQ_LCCR2);
164 1.3.8.2 nathanw bus_space_write_4(sc->sc_iot, sc->sc_ioh,
165 1.3.8.2 nathanw SALCD_CR3, IPAQ_LCCR3);
166 1.3.8.2 nathanw bus_space_write_4(sc->sc_iot, sc->sc_ioh,
167 1.3.8.2 nathanw SALCD_CR0, IPAQ_LCCR0);
168 1.3.8.2 nathanw
169 1.3.8.2 nathanw DPRINTF(("\n"
170 1.3.8.2 nathanw "DMA_BASE= %08x : DMA_CUR = %08x \n"
171 1.3.8.2 nathanw "LCCR0 = %08x : LCCR1 = %08x \n"
172 1.3.8.2 nathanw "LCCR2 = %08x : LCCR3 = %08x",
173 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_BA1),
174 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CA1),
175 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR0),
176 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR1),
177 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR2),
178 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR3)));
179 1.3.8.2 nathanw
180 1.3.8.2 nathanw }
181 1.3.8.2 nathanw
182 1.3.8.2 nathanw int
183 1.3.8.2 nathanw ipaqlcd_fbinit(sc)
184 1.3.8.2 nathanw struct ipaqlcd_softc *sc;
185 1.3.8.2 nathanw {
186 1.3.8.2 nathanw struct hpcfb_fbconf *fb;
187 1.3.8.2 nathanw
188 1.3.8.2 nathanw fb = &sc->sc_fbconf;
189 1.3.8.2 nathanw
190 1.3.8.2 nathanw /* Initialize fb */
191 1.3.8.2 nathanw memset(fb, 0, sizeof(*fb));
192 1.3.8.2 nathanw
193 1.3.8.2 nathanw fb->hf_conf_index = 0; /* configuration index */
194 1.3.8.2 nathanw fb->hf_nconfs = 1;
195 1.3.8.2 nathanw strcpy(fb->hf_name, "built-in video");
196 1.3.8.2 nathanw strcpy(fb->hf_conf_name, "LCD");
197 1.3.8.2 nathanw /* configuration name */
198 1.3.8.2 nathanw fb->hf_height = bootinfo->fb_height;
199 1.3.8.2 nathanw fb->hf_width = bootinfo->fb_width;
200 1.3.8.2 nathanw
201 1.3.8.2 nathanw if (bus_space_map(sc->sc_iot, (bus_addr_t)bootinfo->fb_addr,
202 1.3.8.2 nathanw bootinfo->fb_height * bootinfo->fb_line_bytes,
203 1.3.8.2 nathanw 0, &fb->hf_baseaddr)) {
204 1.3.8.2 nathanw printf("unable to map framebuffer\n");
205 1.3.8.2 nathanw return (-1);
206 1.3.8.2 nathanw }
207 1.3.8.2 nathanw
208 1.3.8.2 nathanw fb->hf_offset = (u_long)bootinfo->fb_addr -
209 1.3.8.2 nathanw __PTOB(__BTOP(bootinfo->fb_addr));
210 1.3.8.2 nathanw /* frame buffer start offset */
211 1.3.8.2 nathanw fb->hf_bytes_per_line = bootinfo->fb_line_bytes;
212 1.3.8.2 nathanw fb->hf_nplanes = 1;
213 1.3.8.2 nathanw fb->hf_bytes_per_plane = bootinfo->fb_height *
214 1.3.8.2 nathanw bootinfo->fb_line_bytes;
215 1.3.8.2 nathanw
216 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_BYTE;
217 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_WORD;
218 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_DWORD;
219 1.3.8.2 nathanw
220 1.3.8.2 nathanw switch (bootinfo->fb_type) {
221 1.3.8.2 nathanw /*
222 1.3.8.2 nathanw * gray scale
223 1.3.8.2 nathanw */
224 1.3.8.2 nathanw case BIFB_D2_M2L_3:
225 1.3.8.2 nathanw case BIFB_D2_M2L_3x2:
226 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_REVERSE;
227 1.3.8.2 nathanw case BIFB_D2_M2L_0:
228 1.3.8.2 nathanw case BIFB_D2_M2L_0x2:
229 1.3.8.2 nathanw fb->hf_class = HPCFB_CLASS_GRAYSCALE;
230 1.3.8.2 nathanw break;
231 1.3.8.2 nathanw case BIFB_D4_M2L_F:
232 1.3.8.2 nathanw case BIFB_D4_M2L_Fx2:
233 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_REVERSE;
234 1.3.8.2 nathanw case BIFB_D4_M2L_0:
235 1.3.8.2 nathanw case BIFB_D4_M2L_0x2:
236 1.3.8.2 nathanw fb->hf_class = HPCFB_CLASS_GRAYSCALE;
237 1.3.8.2 nathanw break;
238 1.3.8.2 nathanw /*
239 1.3.8.2 nathanw * indexed color
240 1.3.8.2 nathanw */
241 1.3.8.2 nathanw case BIFB_D8_FF:
242 1.3.8.2 nathanw case BIFB_D8_00:
243 1.3.8.2 nathanw fb->hf_offset = 0x200;
244 1.3.8.2 nathanw break;
245 1.3.8.2 nathanw /*
246 1.3.8.2 nathanw * RGB color
247 1.3.8.2 nathanw */
248 1.3.8.2 nathanw case BIFB_D16_FFFF:
249 1.3.8.2 nathanw case BIFB_D16_0000:
250 1.3.8.2 nathanw fb->hf_class = HPCFB_CLASS_RGBCOLOR;
251 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_STATIC;
252 1.3.8.2 nathanw fb->hf_order_flags = HPCFB_REVORDER_BYTE;
253 1.3.8.2 nathanw fb->hf_pack_width = 16;
254 1.3.8.2 nathanw fb->hf_pixels_per_pack = 1;
255 1.3.8.2 nathanw fb->hf_pixel_width = 16;
256 1.3.8.2 nathanw
257 1.3.8.2 nathanw fb->hf_class_data_length = sizeof(struct hf_rgb_tag);
258 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_flags = 0;
259 1.3.8.2 nathanw /* reserved for future use */
260 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_red_width = 5;
261 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_red_shift = 11;
262 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_green_width = 6;
263 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_green_shift = 5;
264 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_blue_width = 5;
265 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_blue_shift = 0;
266 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_alpha_width = 0;
267 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_alpha_shift = 0;
268 1.3.8.2 nathanw break;
269 1.3.8.2 nathanw default :
270 1.3.8.2 nathanw printf("unknown type (=%d).\n", bootinfo->fb_type);
271 1.3.8.2 nathanw return (-1);
272 1.3.8.2 nathanw break;
273 1.3.8.2 nathanw }
274 1.3.8.2 nathanw
275 1.3.8.2 nathanw return(0);
276 1.3.8.2 nathanw }
277 1.3.8.2 nathanw
278 1.3.8.2 nathanw int
279 1.3.8.2 nathanw ipaqlcd_ioctl(v, cmd, data, flag, p)
280 1.3.8.2 nathanw void *v;
281 1.3.8.2 nathanw u_long cmd;
282 1.3.8.2 nathanw caddr_t data;
283 1.3.8.2 nathanw int flag;
284 1.3.8.2 nathanw struct proc *p;
285 1.3.8.2 nathanw {
286 1.3.8.2 nathanw struct ipaqlcd_softc *sc = (struct ipaqlcd_softc *)v;
287 1.3.8.2 nathanw struct hpcfb_fbconf *fbconf;
288 1.3.8.2 nathanw struct hpcfb_dspconf *dspconf;
289 1.3.8.2 nathanw struct wsdisplay_cmap *cmap;
290 1.3.8.2 nathanw struct wsdisplay_param *dispparam;
291 1.3.8.2 nathanw
292 1.3.8.2 nathanw switch (cmd) {
293 1.3.8.2 nathanw case WSDISPLAYIO_GETCMAP:
294 1.3.8.2 nathanw cmap = (struct wsdisplay_cmap*)data;
295 1.3.8.2 nathanw
296 1.3.8.2 nathanw if (sc->sc_fbconf.hf_class != HPCFB_CLASS_INDEXCOLOR ||
297 1.3.8.2 nathanw sc->sc_fbconf.hf_pack_width != 8 ||
298 1.3.8.2 nathanw 256 <= cmap->index ||
299 1.3.8.2 nathanw 256 < (cmap->index + cmap->count))
300 1.3.8.2 nathanw return (EINVAL);
301 1.3.8.2 nathanw return (0);
302 1.3.8.2 nathanw case WSDISPLAYIO_PUTCMAP:
303 1.3.8.2 nathanw return (EINVAL);
304 1.3.8.2 nathanw case WSDISPLAYIO_GETPARAM:
305 1.3.8.2 nathanw dispparam = (struct wsdisplay_param*)data;
306 1.3.8.2 nathanw switch (dispparam->param) {
307 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_BACKLIGHT:
308 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:BACKLIGHT\n"));
309 1.3.8.2 nathanw return (EINVAL);
310 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_CONTRAST:
311 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:CONTRAST\n"));
312 1.3.8.2 nathanw return (EINVAL);
313 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_BRIGHTNESS:
314 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:BRIGHTNESS\n"));
315 1.3.8.2 nathanw return (EINVAL);
316 1.3.8.2 nathanw default:
317 1.3.8.2 nathanw return (EINVAL);
318 1.3.8.2 nathanw }
319 1.3.8.2 nathanw return (0);
320 1.3.8.2 nathanw case WSDISPLAYIO_SETPARAM:
321 1.3.8.2 nathanw dispparam = (struct wsdisplay_param*)data;
322 1.3.8.2 nathanw switch (dispparam->param) {
323 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_BACKLIGHT:
324 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:BACKLIGHT\n"));
325 1.3.8.2 nathanw return (EINVAL);
326 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_CONTRAST:
327 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:CONTRAST\n"));
328 1.3.8.2 nathanw return (EINVAL);
329 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_BRIGHTNESS:
330 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:BRIGHTNESS\n"));
331 1.3.8.2 nathanw return (EINVAL);
332 1.3.8.2 nathanw default:
333 1.3.8.2 nathanw return (EINVAL);
334 1.3.8.2 nathanw }
335 1.3.8.2 nathanw return (0);
336 1.3.8.2 nathanw
337 1.3.8.2 nathanw case HPCFBIO_GCONF:
338 1.3.8.2 nathanw fbconf = (struct hpcfb_fbconf *)data;
339 1.3.8.2 nathanw if (fbconf->hf_conf_index != 0 &&
340 1.3.8.2 nathanw fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
341 1.3.8.2 nathanw return (EINVAL);
342 1.3.8.2 nathanw }
343 1.3.8.2 nathanw *fbconf = sc->sc_fbconf; /* structure assignment */
344 1.3.8.2 nathanw return (0);
345 1.3.8.2 nathanw case HPCFBIO_SCONF:
346 1.3.8.2 nathanw fbconf = (struct hpcfb_fbconf *)data;
347 1.3.8.2 nathanw if (fbconf->hf_conf_index != 0 &&
348 1.3.8.2 nathanw fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
349 1.3.8.2 nathanw return (EINVAL);
350 1.3.8.2 nathanw }
351 1.3.8.2 nathanw /*
352 1.3.8.2 nathanw * nothing to do because we have only one configration
353 1.3.8.2 nathanw */
354 1.3.8.2 nathanw return (0);
355 1.3.8.2 nathanw case HPCFBIO_GDSPCONF:
356 1.3.8.2 nathanw dspconf = (struct hpcfb_dspconf *)data;
357 1.3.8.2 nathanw if ((dspconf->hd_unit_index != 0 &&
358 1.3.8.2 nathanw dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
359 1.3.8.2 nathanw (dspconf->hd_conf_index != 0 &&
360 1.3.8.2 nathanw dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
361 1.3.8.2 nathanw return (EINVAL);
362 1.3.8.2 nathanw }
363 1.3.8.2 nathanw *dspconf = sc->sc_dspconf; /* structure assignment */
364 1.3.8.2 nathanw return (0);
365 1.3.8.2 nathanw case HPCFBIO_SDSPCONF:
366 1.3.8.2 nathanw dspconf = (struct hpcfb_dspconf *)data;
367 1.3.8.2 nathanw if ((dspconf->hd_unit_index != 0 &&
368 1.3.8.2 nathanw dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
369 1.3.8.2 nathanw (dspconf->hd_conf_index != 0 &&
370 1.3.8.2 nathanw dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
371 1.3.8.2 nathanw return (EINVAL);
372 1.3.8.2 nathanw }
373 1.3.8.2 nathanw /*
374 1.3.8.2 nathanw * nothing to do
375 1.3.8.2 nathanw * because we have only one unit and one configration
376 1.3.8.2 nathanw */
377 1.3.8.2 nathanw return (0);
378 1.3.8.2 nathanw
379 1.3.8.2 nathanw case HPCFBIO_GOP:
380 1.3.8.2 nathanw case HPCFBIO_SOP:
381 1.3.8.2 nathanw return (EINVAL);
382 1.3.8.2 nathanw }
383 1.3.8.2 nathanw return (ENOTTY);
384 1.3.8.2 nathanw }
385 1.3.8.2 nathanw
386 1.3.8.2 nathanw paddr_t
387 1.3.8.2 nathanw ipaqlcd_mmap(ctx, offset, prot)
388 1.3.8.2 nathanw void *ctx;
389 1.3.8.2 nathanw off_t offset;
390 1.3.8.2 nathanw int prot;
391 1.3.8.2 nathanw {
392 1.3.8.2 nathanw struct ipaqlcd_softc *sc = (struct ipaqlcd_softc *)ctx;
393 1.3.8.2 nathanw
394 1.3.8.2 nathanw if (offset < 0 ||
395 1.3.8.2 nathanw (sc->sc_fbconf.hf_bytes_per_plane +
396 1.3.8.2 nathanw sc->sc_fbconf.hf_offset) < offset)
397 1.3.8.2 nathanw return -1;
398 1.3.8.2 nathanw
399 1.3.8.2 nathanw return __BTOP((u_long)bootinfo->fb_addr + offset);
400 1.3.8.2 nathanw }
401