ipaq_lcd.c revision 1.3.8.4 1 1.3.8.4 nathanw /* $NetBSD: ipaq_lcd.c,v 1.3.8.4 2002/10/18 02:36:59 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.4 nathanw CFATTACH_DECL(ipaqlcd, sizeof(struct ipaqlcd_softc),
88 1.3.8.4 nathanw ipaqlcd_match, ipaqlcd_attach, NULL, NULL);
89 1.3.8.2 nathanw
90 1.3.8.2 nathanw struct hpcfb_accessops ipaqlcd_ha = {
91 1.3.8.2 nathanw ipaqlcd_ioctl, ipaqlcd_mmap
92 1.3.8.2 nathanw };
93 1.3.8.2 nathanw static int console_flag = 0;
94 1.3.8.2 nathanw
95 1.3.8.2 nathanw static int
96 1.3.8.2 nathanw ipaqlcd_match(parent, match, aux)
97 1.3.8.2 nathanw struct device *parent;
98 1.3.8.2 nathanw struct cfdata *match;
99 1.3.8.2 nathanw void *aux;
100 1.3.8.2 nathanw {
101 1.3.8.2 nathanw return (1);
102 1.3.8.2 nathanw }
103 1.3.8.2 nathanw
104 1.3.8.2 nathanw void
105 1.3.8.2 nathanw ipaqlcd_attach(parent, self, aux)
106 1.3.8.2 nathanw struct device *parent;
107 1.3.8.2 nathanw struct device *self;
108 1.3.8.2 nathanw void *aux;
109 1.3.8.2 nathanw {
110 1.3.8.2 nathanw struct ipaqlcd_softc *sc = (struct ipaqlcd_softc*)self;
111 1.3.8.2 nathanw struct hpcfb_attach_args ha;
112 1.3.8.2 nathanw struct ipaq_softc *psc = (struct ipaq_softc *)parent;
113 1.3.8.2 nathanw
114 1.3.8.2 nathanw sc->sc_iot = psc->sc_iot;
115 1.3.8.2 nathanw sc->sc_parent = (struct ipaq_softc *)parent;
116 1.3.8.2 nathanw
117 1.3.8.2 nathanw ipaqlcd_init(sc);
118 1.3.8.2 nathanw ipaqlcd_fbinit(sc);
119 1.3.8.2 nathanw
120 1.3.8.2 nathanw printf("\n");
121 1.3.8.2 nathanw printf("%s: iPAQ internal LCD controller\n", sc->sc_dev.dv_xname);
122 1.3.8.2 nathanw
123 1.3.8.2 nathanw DPRINTF(("framebuffer_baseaddr=%lx\n", (u_long)bootinfo->fb_addr));
124 1.3.8.2 nathanw
125 1.3.8.2 nathanw ha.ha_console = console_flag;
126 1.3.8.2 nathanw ha.ha_accessops = &ipaqlcd_ha;
127 1.3.8.2 nathanw ha.ha_accessctx = sc;
128 1.3.8.2 nathanw ha.ha_curfbconf = 0;
129 1.3.8.2 nathanw ha.ha_nfbconf = 1;
130 1.3.8.2 nathanw ha.ha_fbconflist = &sc->sc_fbconf;
131 1.3.8.2 nathanw ha.ha_curdspconf = 0;
132 1.3.8.2 nathanw ha.ha_ndspconf = 1;
133 1.3.8.2 nathanw ha.ha_dspconflist = &sc->sc_dspconf;
134 1.3.8.2 nathanw
135 1.3.8.2 nathanw config_found(&sc->sc_dev, &ha, hpcfbprint);
136 1.3.8.2 nathanw }
137 1.3.8.2 nathanw
138 1.3.8.2 nathanw void
139 1.3.8.2 nathanw ipaqlcd_init(sc)
140 1.3.8.2 nathanw struct ipaqlcd_softc *sc;
141 1.3.8.2 nathanw {
142 1.3.8.2 nathanw /* Initialization of Extended GPIO */
143 1.3.8.2 nathanw sc->sc_parent->ipaq_egpio |= EGPIO_LCD_INIT;
144 1.3.8.2 nathanw bus_space_write_2(sc->sc_iot, sc->sc_parent->sc_egpioh,
145 1.3.8.2 nathanw 0, sc->sc_parent->ipaq_egpio);
146 1.3.8.2 nathanw
147 1.3.8.2 nathanw if (bus_space_map(sc->sc_iot, SALCD_BASE, SALCD_NPORTS,
148 1.3.8.2 nathanw 0, &sc->sc_ioh))
149 1.3.8.4 nathanw panic("ipaqlcd_init:Cannot map registers");
150 1.3.8.2 nathanw
151 1.3.8.2 nathanw (u_long)bootinfo->fb_addr =
152 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_BA1);
153 1.3.8.2 nathanw
154 1.3.8.2 nathanw /*
155 1.3.8.2 nathanw * Initialize LCD Control Register 0 - 3
156 1.3.8.2 nathanw * must initialize DMA Channel Base Address Register
157 1.3.8.2 nathanw * before enabling LCD(LEN = 1)
158 1.3.8.2 nathanw */
159 1.3.8.2 nathanw bus_space_write_4(sc->sc_iot, sc->sc_ioh,
160 1.3.8.2 nathanw SALCD_CR1, IPAQ_LCCR1);
161 1.3.8.2 nathanw bus_space_write_4(sc->sc_iot, sc->sc_ioh,
162 1.3.8.2 nathanw SALCD_CR2, IPAQ_LCCR2);
163 1.3.8.2 nathanw bus_space_write_4(sc->sc_iot, sc->sc_ioh,
164 1.3.8.2 nathanw SALCD_CR3, IPAQ_LCCR3);
165 1.3.8.2 nathanw bus_space_write_4(sc->sc_iot, sc->sc_ioh,
166 1.3.8.2 nathanw SALCD_CR0, IPAQ_LCCR0);
167 1.3.8.2 nathanw
168 1.3.8.2 nathanw DPRINTF(("\n"
169 1.3.8.2 nathanw "DMA_BASE= %08x : DMA_CUR = %08x \n"
170 1.3.8.2 nathanw "LCCR0 = %08x : LCCR1 = %08x \n"
171 1.3.8.2 nathanw "LCCR2 = %08x : LCCR3 = %08x",
172 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_BA1),
173 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CA1),
174 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR0),
175 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR1),
176 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR2),
177 1.3.8.2 nathanw bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR3)));
178 1.3.8.2 nathanw
179 1.3.8.2 nathanw }
180 1.3.8.2 nathanw
181 1.3.8.2 nathanw int
182 1.3.8.2 nathanw ipaqlcd_fbinit(sc)
183 1.3.8.2 nathanw struct ipaqlcd_softc *sc;
184 1.3.8.2 nathanw {
185 1.3.8.2 nathanw struct hpcfb_fbconf *fb;
186 1.3.8.2 nathanw
187 1.3.8.2 nathanw fb = &sc->sc_fbconf;
188 1.3.8.2 nathanw
189 1.3.8.2 nathanw /* Initialize fb */
190 1.3.8.2 nathanw memset(fb, 0, sizeof(*fb));
191 1.3.8.2 nathanw
192 1.3.8.2 nathanw fb->hf_conf_index = 0; /* configuration index */
193 1.3.8.2 nathanw fb->hf_nconfs = 1;
194 1.3.8.2 nathanw strcpy(fb->hf_name, "built-in video");
195 1.3.8.2 nathanw strcpy(fb->hf_conf_name, "LCD");
196 1.3.8.2 nathanw /* configuration name */
197 1.3.8.2 nathanw fb->hf_height = bootinfo->fb_height;
198 1.3.8.2 nathanw fb->hf_width = bootinfo->fb_width;
199 1.3.8.2 nathanw
200 1.3.8.2 nathanw if (bus_space_map(sc->sc_iot, (bus_addr_t)bootinfo->fb_addr,
201 1.3.8.2 nathanw bootinfo->fb_height * bootinfo->fb_line_bytes,
202 1.3.8.2 nathanw 0, &fb->hf_baseaddr)) {
203 1.3.8.2 nathanw printf("unable to map framebuffer\n");
204 1.3.8.2 nathanw return (-1);
205 1.3.8.2 nathanw }
206 1.3.8.2 nathanw
207 1.3.8.2 nathanw fb->hf_offset = (u_long)bootinfo->fb_addr -
208 1.3.8.2 nathanw __PTOB(__BTOP(bootinfo->fb_addr));
209 1.3.8.2 nathanw /* frame buffer start offset */
210 1.3.8.2 nathanw fb->hf_bytes_per_line = bootinfo->fb_line_bytes;
211 1.3.8.2 nathanw fb->hf_nplanes = 1;
212 1.3.8.2 nathanw fb->hf_bytes_per_plane = bootinfo->fb_height *
213 1.3.8.2 nathanw bootinfo->fb_line_bytes;
214 1.3.8.2 nathanw
215 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_BYTE;
216 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_WORD;
217 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_DWORD;
218 1.3.8.2 nathanw
219 1.3.8.2 nathanw switch (bootinfo->fb_type) {
220 1.3.8.2 nathanw /*
221 1.3.8.2 nathanw * gray scale
222 1.3.8.2 nathanw */
223 1.3.8.2 nathanw case BIFB_D2_M2L_3:
224 1.3.8.2 nathanw case BIFB_D2_M2L_3x2:
225 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_REVERSE;
226 1.3.8.2 nathanw case BIFB_D2_M2L_0:
227 1.3.8.2 nathanw case BIFB_D2_M2L_0x2:
228 1.3.8.2 nathanw fb->hf_class = HPCFB_CLASS_GRAYSCALE;
229 1.3.8.2 nathanw break;
230 1.3.8.2 nathanw case BIFB_D4_M2L_F:
231 1.3.8.2 nathanw case BIFB_D4_M2L_Fx2:
232 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_REVERSE;
233 1.3.8.2 nathanw case BIFB_D4_M2L_0:
234 1.3.8.2 nathanw case BIFB_D4_M2L_0x2:
235 1.3.8.2 nathanw fb->hf_class = HPCFB_CLASS_GRAYSCALE;
236 1.3.8.2 nathanw break;
237 1.3.8.2 nathanw /*
238 1.3.8.2 nathanw * indexed color
239 1.3.8.2 nathanw */
240 1.3.8.2 nathanw case BIFB_D8_FF:
241 1.3.8.2 nathanw case BIFB_D8_00:
242 1.3.8.2 nathanw fb->hf_offset = 0x200;
243 1.3.8.2 nathanw break;
244 1.3.8.2 nathanw /*
245 1.3.8.2 nathanw * RGB color
246 1.3.8.2 nathanw */
247 1.3.8.2 nathanw case BIFB_D16_FFFF:
248 1.3.8.2 nathanw case BIFB_D16_0000:
249 1.3.8.2 nathanw fb->hf_class = HPCFB_CLASS_RGBCOLOR;
250 1.3.8.2 nathanw fb->hf_access_flags |= HPCFB_ACCESS_STATIC;
251 1.3.8.2 nathanw fb->hf_order_flags = HPCFB_REVORDER_BYTE;
252 1.3.8.2 nathanw fb->hf_pack_width = 16;
253 1.3.8.2 nathanw fb->hf_pixels_per_pack = 1;
254 1.3.8.2 nathanw fb->hf_pixel_width = 16;
255 1.3.8.2 nathanw
256 1.3.8.2 nathanw fb->hf_class_data_length = sizeof(struct hf_rgb_tag);
257 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_flags = 0;
258 1.3.8.2 nathanw /* reserved for future use */
259 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_red_width = 5;
260 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_red_shift = 11;
261 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_green_width = 6;
262 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_green_shift = 5;
263 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_blue_width = 5;
264 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_blue_shift = 0;
265 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_alpha_width = 0;
266 1.3.8.2 nathanw fb->hf_u.hf_rgb.hf_alpha_shift = 0;
267 1.3.8.2 nathanw break;
268 1.3.8.2 nathanw default :
269 1.3.8.2 nathanw printf("unknown type (=%d).\n", bootinfo->fb_type);
270 1.3.8.2 nathanw return (-1);
271 1.3.8.2 nathanw break;
272 1.3.8.2 nathanw }
273 1.3.8.2 nathanw
274 1.3.8.2 nathanw return(0);
275 1.3.8.2 nathanw }
276 1.3.8.2 nathanw
277 1.3.8.2 nathanw int
278 1.3.8.2 nathanw ipaqlcd_ioctl(v, cmd, data, flag, p)
279 1.3.8.2 nathanw void *v;
280 1.3.8.2 nathanw u_long cmd;
281 1.3.8.2 nathanw caddr_t data;
282 1.3.8.2 nathanw int flag;
283 1.3.8.2 nathanw struct proc *p;
284 1.3.8.2 nathanw {
285 1.3.8.2 nathanw struct ipaqlcd_softc *sc = (struct ipaqlcd_softc *)v;
286 1.3.8.2 nathanw struct hpcfb_fbconf *fbconf;
287 1.3.8.2 nathanw struct hpcfb_dspconf *dspconf;
288 1.3.8.2 nathanw struct wsdisplay_cmap *cmap;
289 1.3.8.2 nathanw struct wsdisplay_param *dispparam;
290 1.3.8.2 nathanw
291 1.3.8.2 nathanw switch (cmd) {
292 1.3.8.2 nathanw case WSDISPLAYIO_GETCMAP:
293 1.3.8.2 nathanw cmap = (struct wsdisplay_cmap*)data;
294 1.3.8.2 nathanw
295 1.3.8.2 nathanw if (sc->sc_fbconf.hf_class != HPCFB_CLASS_INDEXCOLOR ||
296 1.3.8.2 nathanw sc->sc_fbconf.hf_pack_width != 8 ||
297 1.3.8.2 nathanw 256 <= cmap->index ||
298 1.3.8.2 nathanw 256 < (cmap->index + cmap->count))
299 1.3.8.2 nathanw return (EINVAL);
300 1.3.8.2 nathanw return (0);
301 1.3.8.2 nathanw case WSDISPLAYIO_PUTCMAP:
302 1.3.8.2 nathanw return (EINVAL);
303 1.3.8.2 nathanw case WSDISPLAYIO_GETPARAM:
304 1.3.8.2 nathanw dispparam = (struct wsdisplay_param*)data;
305 1.3.8.2 nathanw switch (dispparam->param) {
306 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_BACKLIGHT:
307 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:BACKLIGHT\n"));
308 1.3.8.2 nathanw return (EINVAL);
309 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_CONTRAST:
310 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:CONTRAST\n"));
311 1.3.8.2 nathanw return (EINVAL);
312 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_BRIGHTNESS:
313 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:BRIGHTNESS\n"));
314 1.3.8.2 nathanw return (EINVAL);
315 1.3.8.2 nathanw default:
316 1.3.8.2 nathanw return (EINVAL);
317 1.3.8.2 nathanw }
318 1.3.8.2 nathanw return (0);
319 1.3.8.2 nathanw case WSDISPLAYIO_SETPARAM:
320 1.3.8.2 nathanw dispparam = (struct wsdisplay_param*)data;
321 1.3.8.2 nathanw switch (dispparam->param) {
322 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_BACKLIGHT:
323 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:BACKLIGHT\n"));
324 1.3.8.2 nathanw return (EINVAL);
325 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_CONTRAST:
326 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:CONTRAST\n"));
327 1.3.8.2 nathanw return (EINVAL);
328 1.3.8.2 nathanw case WSDISPLAYIO_PARAM_BRIGHTNESS:
329 1.3.8.2 nathanw DPRINTF(("ipaqlcd_ioctl: GETPARAM:BRIGHTNESS\n"));
330 1.3.8.2 nathanw return (EINVAL);
331 1.3.8.2 nathanw default:
332 1.3.8.2 nathanw return (EINVAL);
333 1.3.8.2 nathanw }
334 1.3.8.2 nathanw return (0);
335 1.3.8.2 nathanw
336 1.3.8.2 nathanw case HPCFBIO_GCONF:
337 1.3.8.2 nathanw fbconf = (struct hpcfb_fbconf *)data;
338 1.3.8.2 nathanw if (fbconf->hf_conf_index != 0 &&
339 1.3.8.2 nathanw fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
340 1.3.8.2 nathanw return (EINVAL);
341 1.3.8.2 nathanw }
342 1.3.8.2 nathanw *fbconf = sc->sc_fbconf; /* structure assignment */
343 1.3.8.2 nathanw return (0);
344 1.3.8.2 nathanw case HPCFBIO_SCONF:
345 1.3.8.2 nathanw fbconf = (struct hpcfb_fbconf *)data;
346 1.3.8.2 nathanw if (fbconf->hf_conf_index != 0 &&
347 1.3.8.2 nathanw fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
348 1.3.8.2 nathanw return (EINVAL);
349 1.3.8.2 nathanw }
350 1.3.8.2 nathanw /*
351 1.3.8.2 nathanw * nothing to do because we have only one configration
352 1.3.8.2 nathanw */
353 1.3.8.2 nathanw return (0);
354 1.3.8.2 nathanw case HPCFBIO_GDSPCONF:
355 1.3.8.2 nathanw dspconf = (struct hpcfb_dspconf *)data;
356 1.3.8.2 nathanw if ((dspconf->hd_unit_index != 0 &&
357 1.3.8.2 nathanw dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
358 1.3.8.2 nathanw (dspconf->hd_conf_index != 0 &&
359 1.3.8.2 nathanw dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
360 1.3.8.2 nathanw return (EINVAL);
361 1.3.8.2 nathanw }
362 1.3.8.2 nathanw *dspconf = sc->sc_dspconf; /* structure assignment */
363 1.3.8.2 nathanw return (0);
364 1.3.8.2 nathanw case HPCFBIO_SDSPCONF:
365 1.3.8.2 nathanw dspconf = (struct hpcfb_dspconf *)data;
366 1.3.8.2 nathanw if ((dspconf->hd_unit_index != 0 &&
367 1.3.8.2 nathanw dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
368 1.3.8.2 nathanw (dspconf->hd_conf_index != 0 &&
369 1.3.8.2 nathanw dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
370 1.3.8.2 nathanw return (EINVAL);
371 1.3.8.2 nathanw }
372 1.3.8.2 nathanw /*
373 1.3.8.2 nathanw * nothing to do
374 1.3.8.2 nathanw * because we have only one unit and one configration
375 1.3.8.2 nathanw */
376 1.3.8.2 nathanw return (0);
377 1.3.8.2 nathanw
378 1.3.8.2 nathanw case HPCFBIO_GOP:
379 1.3.8.2 nathanw case HPCFBIO_SOP:
380 1.3.8.2 nathanw return (EINVAL);
381 1.3.8.2 nathanw }
382 1.3.8.3 nathanw return (EPASSTHROUGH);
383 1.3.8.2 nathanw }
384 1.3.8.2 nathanw
385 1.3.8.2 nathanw paddr_t
386 1.3.8.2 nathanw ipaqlcd_mmap(ctx, offset, prot)
387 1.3.8.2 nathanw void *ctx;
388 1.3.8.2 nathanw off_t offset;
389 1.3.8.2 nathanw int prot;
390 1.3.8.2 nathanw {
391 1.3.8.2 nathanw struct ipaqlcd_softc *sc = (struct ipaqlcd_softc *)ctx;
392 1.3.8.2 nathanw
393 1.3.8.2 nathanw if (offset < 0 ||
394 1.3.8.2 nathanw (sc->sc_fbconf.hf_bytes_per_plane +
395 1.3.8.2 nathanw sc->sc_fbconf.hf_offset) < offset)
396 1.3.8.2 nathanw return -1;
397 1.3.8.2 nathanw
398 1.3.8.2 nathanw return __BTOP((u_long)bootinfo->fb_addr + offset);
399 1.3.8.2 nathanw }
400