1*c7fb772bSthorpej /* $NetBSD: ipaq_lcd.c,v 1.22 2021/08/07 16:18:53 thorpej Exp $ */
2034e3a0dSichiro
3034e3a0dSichiro /*
4034e3a0dSichiro * Copyright (c) 2001 The NetBSD Foundation, Inc.
5034e3a0dSichiro * All rights reserved.
6034e3a0dSichiro *
7034e3a0dSichiro * This code is derived from software contributed to The NetBSD Foundation
8034e3a0dSichiro * by Ichiro FUKUHARA (ichiro@ichiro.org).
9034e3a0dSichiro *
10034e3a0dSichiro * Redistribution and use in source and binary forms, with or without
11034e3a0dSichiro * modification, are permitted provided that the following conditions
12034e3a0dSichiro * are met:
13034e3a0dSichiro * 1. Redistributions of source code must retain the above copyright
14034e3a0dSichiro * notice, this list of conditions and the following disclaimer.
15034e3a0dSichiro * 2. Redistributions in binary form must reproduce the above copyright
16034e3a0dSichiro * notice, this list of conditions and the following disclaimer in the
17034e3a0dSichiro * documentation and/or other materials provided with the distribution.
18034e3a0dSichiro *
19034e3a0dSichiro * THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
20034e3a0dSichiro * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
21034e3a0dSichiro * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22034e3a0dSichiro * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
23034e3a0dSichiro * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
24034e3a0dSichiro * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
25034e3a0dSichiro * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
26034e3a0dSichiro * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
27034e3a0dSichiro * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
28034e3a0dSichiro * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
29034e3a0dSichiro * POSSIBILITY OF SUCH DAMAGE.
30034e3a0dSichiro */
31034e3a0dSichiro
3208716eaeSlukem #include <sys/cdefs.h>
33*c7fb772bSthorpej __KERNEL_RCSID(0, "$NetBSD: ipaq_lcd.c,v 1.22 2021/08/07 16:18:53 thorpej Exp $");
3408716eaeSlukem
3508716eaeSlukem #define IPAQ_LCD_DEBUG
3608716eaeSlukem
37034e3a0dSichiro #include <sys/types.h>
38034e3a0dSichiro #include <sys/param.h>
39034e3a0dSichiro #include <sys/systm.h>
40034e3a0dSichiro #include <sys/kernel.h>
41034e3a0dSichiro #include <sys/time.h>
42034e3a0dSichiro #include <sys/device.h>
439edf49b0Sdyoung #include <sys/bus.h>
44034e3a0dSichiro
45034e3a0dSichiro #include <uvm/uvm_extern.h>
46034e3a0dSichiro
47034e3a0dSichiro #include <dev/wscons/wsconsio.h>
48034e3a0dSichiro
49034e3a0dSichiro #include <machine/bootinfo.h>
5028466919Sthorpej #include <machine/intr.h>
5196959902Sthorpej #include <arm/cpufunc.h>
52034e3a0dSichiro
53905a47b1Speter #include <arm/sa11x0/sa11x0_reg.h>
54905a47b1Speter #include <arm/sa11x0/sa11x0_gpioreg.h>
55034e3a0dSichiro
56034e3a0dSichiro #include <hpcarm/dev/ipaq_gpioreg.h>
57034e3a0dSichiro #include <hpcarm/dev/ipaq_saipvar.h>
58034e3a0dSichiro #include <hpcarm/dev/ipaq_lcdreg.h>
59034e3a0dSichiro #include <hpcarm/dev/ipaq_lcdvar.h>
60034e3a0dSichiro
61034e3a0dSichiro #ifdef IPAQ_LCD_DEBUG
624c494f76Srjs #define DPRINTFN(n, x) if (ipaqlcddebug > (n)) aprint_normal x
63034e3a0dSichiro int ipaqlcddebug = 0xff;
64034e3a0dSichiro #else
65034e3a0dSichiro #define DPRINTFN(n, x)
66034e3a0dSichiro #endif
67034e3a0dSichiro #define DPRINTF(x) DPRINTFN(0, x)
68034e3a0dSichiro
694c494f76Srjs static int ipaqlcd_match(device_t, cfdata_t, void *);
704c494f76Srjs static void ipaqlcd_attach(device_t, device_t, void *);
71034e3a0dSichiro static void ipaqlcd_init(struct ipaqlcd_softc *);
72034e3a0dSichiro static int ipaqlcd_fbinit(struct ipaqlcd_softc *);
7353524e44Schristos static int ipaqlcd_ioctl(void *, u_long, void *, int, struct lwp *);
74f99ba5e5Srjs static paddr_t ipaqlcd_mmap(void *, off_t, int);
75034e3a0dSichiro
76034e3a0dSichiro #if defined __mips__ || defined __sh__ || defined __arm__
77034e3a0dSichiro #define __BTOP(x) ((paddr_t)(x) >> PGSHIFT)
78034e3a0dSichiro #define __PTOB(x) ((paddr_t)(x) << PGSHIFT)
79034e3a0dSichiro #else
80034e3a0dSichiro #error "define btop, ptob."
81034e3a0dSichiro #endif
82034e3a0dSichiro
834c494f76Srjs CFATTACH_DECL_NEW(ipaqlcd, sizeof(struct ipaqlcd_softc),
84c5e91d44Sthorpej ipaqlcd_match, ipaqlcd_attach, NULL, NULL);
85034e3a0dSichiro
86034e3a0dSichiro struct hpcfb_accessops ipaqlcd_ha = {
87034e3a0dSichiro ipaqlcd_ioctl, ipaqlcd_mmap
88034e3a0dSichiro };
89034e3a0dSichiro static int console_flag = 0;
90034e3a0dSichiro
91034e3a0dSichiro static int
ipaqlcd_match(device_t parent,cfdata_t match,void * aux)924c494f76Srjs ipaqlcd_match(device_t parent, cfdata_t match, void *aux)
93034e3a0dSichiro {
94034e3a0dSichiro return (1);
95034e3a0dSichiro }
96034e3a0dSichiro
97034e3a0dSichiro void
ipaqlcd_attach(device_t parent,device_t self,void * aux)984c494f76Srjs ipaqlcd_attach(device_t parent, device_t self, void *aux)
99034e3a0dSichiro {
1004c494f76Srjs struct ipaqlcd_softc *sc = device_private(self);
101034e3a0dSichiro struct hpcfb_attach_args ha;
1024c494f76Srjs struct ipaq_softc *psc = device_private(parent);
103034e3a0dSichiro
1044c494f76Srjs sc->sc_dev = self;
105034e3a0dSichiro sc->sc_iot = psc->sc_iot;
1064c494f76Srjs sc->sc_parent = psc;
107034e3a0dSichiro
108034e3a0dSichiro ipaqlcd_init(sc);
109034e3a0dSichiro ipaqlcd_fbinit(sc);
110034e3a0dSichiro
1114c494f76Srjs aprint_normal("\n");
1124c494f76Srjs aprint_normal_dev(self, "iPAQ internal LCD controller\n");
113034e3a0dSichiro
114034e3a0dSichiro DPRINTF(("framebuffer_baseaddr=%lx\n", (u_long)bootinfo->fb_addr));
115034e3a0dSichiro
116034e3a0dSichiro ha.ha_console = console_flag;
117034e3a0dSichiro ha.ha_accessops = &ipaqlcd_ha;
118034e3a0dSichiro ha.ha_accessctx = sc;
119034e3a0dSichiro ha.ha_curfbconf = 0;
120034e3a0dSichiro ha.ha_nfbconf = 1;
121034e3a0dSichiro ha.ha_fbconflist = &sc->sc_fbconf;
122034e3a0dSichiro ha.ha_curdspconf = 0;
123034e3a0dSichiro ha.ha_ndspconf = 1;
124034e3a0dSichiro ha.ha_dspconflist = &sc->sc_dspconf;
125034e3a0dSichiro
126*c7fb772bSthorpej config_found(sc->sc_dev, &ha, hpcfbprint, CFARGS_NONE);
127034e3a0dSichiro }
128034e3a0dSichiro
129034e3a0dSichiro void
ipaqlcd_init(struct ipaqlcd_softc * sc)130f99ba5e5Srjs ipaqlcd_init(struct ipaqlcd_softc *sc)
131034e3a0dSichiro {
132034e3a0dSichiro /* Initialization of Extended GPIO */
13360f2ec7eSichiro sc->sc_parent->ipaq_egpio |= EGPIO_LCD_INIT;
13460f2ec7eSichiro bus_space_write_2(sc->sc_iot, sc->sc_parent->sc_egpioh,
13560f2ec7eSichiro 0, sc->sc_parent->ipaq_egpio);
136034e3a0dSichiro
137034e3a0dSichiro if (bus_space_map(sc->sc_iot, SALCD_BASE, SALCD_NPORTS,
138034e3a0dSichiro 0, &sc->sc_ioh))
1390f09ed48Sprovos panic("ipaqlcd_init:Cannot map registers");
140034e3a0dSichiro
141f99ba5e5Srjs bootinfo->fb_addr = (void *)
142034e3a0dSichiro bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_BA1);
143034e3a0dSichiro
144034e3a0dSichiro /*
145034e3a0dSichiro * Initialize LCD Control Register 0 - 3
146034e3a0dSichiro * must initialize DMA Channel Base Address Register
147034e3a0dSichiro * before enabling LCD(LEN = 1)
148034e3a0dSichiro */
149034e3a0dSichiro bus_space_write_4(sc->sc_iot, sc->sc_ioh,
150034e3a0dSichiro SALCD_CR1, IPAQ_LCCR1);
151034e3a0dSichiro bus_space_write_4(sc->sc_iot, sc->sc_ioh,
152034e3a0dSichiro SALCD_CR2, IPAQ_LCCR2);
153034e3a0dSichiro bus_space_write_4(sc->sc_iot, sc->sc_ioh,
154034e3a0dSichiro SALCD_CR3, IPAQ_LCCR3);
155034e3a0dSichiro bus_space_write_4(sc->sc_iot, sc->sc_ioh,
156034e3a0dSichiro SALCD_CR0, IPAQ_LCCR0);
157034e3a0dSichiro
15860f2ec7eSichiro DPRINTF(("\n"
15960f2ec7eSichiro "DMA_BASE= %08x : DMA_CUR = %08x \n"
160034e3a0dSichiro "LCCR0 = %08x : LCCR1 = %08x \n"
161034e3a0dSichiro "LCCR2 = %08x : LCCR3 = %08x",
162034e3a0dSichiro bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_BA1),
163034e3a0dSichiro bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CA1),
164034e3a0dSichiro bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR0),
165034e3a0dSichiro bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR1),
166034e3a0dSichiro bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR2),
167034e3a0dSichiro bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR3)));
168034e3a0dSichiro
169034e3a0dSichiro }
170034e3a0dSichiro
171034e3a0dSichiro int
ipaqlcd_fbinit(struct ipaqlcd_softc * sc)172f99ba5e5Srjs ipaqlcd_fbinit(struct ipaqlcd_softc *sc)
173034e3a0dSichiro {
174034e3a0dSichiro struct hpcfb_fbconf *fb;
175034e3a0dSichiro
176034e3a0dSichiro fb = &sc->sc_fbconf;
177034e3a0dSichiro
178034e3a0dSichiro /* Initialize fb */
179034e3a0dSichiro memset(fb, 0, sizeof(*fb));
180034e3a0dSichiro
181034e3a0dSichiro fb->hf_conf_index = 0; /* configuration index */
182034e3a0dSichiro fb->hf_nconfs = 1;
183034e3a0dSichiro strcpy(fb->hf_name, "built-in video");
184034e3a0dSichiro strcpy(fb->hf_conf_name, "LCD");
185034e3a0dSichiro /* configuration name */
186034e3a0dSichiro fb->hf_height = bootinfo->fb_height;
187034e3a0dSichiro fb->hf_width = bootinfo->fb_width;
188034e3a0dSichiro
189034e3a0dSichiro if (bus_space_map(sc->sc_iot, (bus_addr_t)bootinfo->fb_addr,
190034e3a0dSichiro bootinfo->fb_height * bootinfo->fb_line_bytes,
191034e3a0dSichiro 0, &fb->hf_baseaddr)) {
1924c494f76Srjs aprint_normal("unable to map framebuffer\n");
193034e3a0dSichiro return (-1);
194034e3a0dSichiro }
195034e3a0dSichiro
196034e3a0dSichiro fb->hf_offset = (u_long)bootinfo->fb_addr -
197034e3a0dSichiro __PTOB(__BTOP(bootinfo->fb_addr));
198034e3a0dSichiro /* frame buffer start offset */
199034e3a0dSichiro fb->hf_bytes_per_line = bootinfo->fb_line_bytes;
200034e3a0dSichiro fb->hf_nplanes = 1;
201034e3a0dSichiro fb->hf_bytes_per_plane = bootinfo->fb_height *
202034e3a0dSichiro bootinfo->fb_line_bytes;
203034e3a0dSichiro
204034e3a0dSichiro fb->hf_access_flags |= HPCFB_ACCESS_BYTE;
205034e3a0dSichiro fb->hf_access_flags |= HPCFB_ACCESS_WORD;
206034e3a0dSichiro fb->hf_access_flags |= HPCFB_ACCESS_DWORD;
207034e3a0dSichiro
208034e3a0dSichiro switch (bootinfo->fb_type) {
209034e3a0dSichiro /*
210034e3a0dSichiro * gray scale
211034e3a0dSichiro */
212034e3a0dSichiro case BIFB_D2_M2L_3:
213034e3a0dSichiro case BIFB_D2_M2L_3x2:
214034e3a0dSichiro fb->hf_access_flags |= HPCFB_ACCESS_REVERSE;
215034e3a0dSichiro case BIFB_D2_M2L_0:
216034e3a0dSichiro case BIFB_D2_M2L_0x2:
217034e3a0dSichiro fb->hf_class = HPCFB_CLASS_GRAYSCALE;
218034e3a0dSichiro break;
219034e3a0dSichiro case BIFB_D4_M2L_F:
220034e3a0dSichiro case BIFB_D4_M2L_Fx2:
221034e3a0dSichiro fb->hf_access_flags |= HPCFB_ACCESS_REVERSE;
222034e3a0dSichiro case BIFB_D4_M2L_0:
223034e3a0dSichiro case BIFB_D4_M2L_0x2:
224034e3a0dSichiro fb->hf_class = HPCFB_CLASS_GRAYSCALE;
225034e3a0dSichiro break;
226034e3a0dSichiro /*
227034e3a0dSichiro * indexed color
228034e3a0dSichiro */
229034e3a0dSichiro case BIFB_D8_FF:
230034e3a0dSichiro case BIFB_D8_00:
231034e3a0dSichiro fb->hf_offset = 0x200;
232034e3a0dSichiro break;
233034e3a0dSichiro /*
234034e3a0dSichiro * RGB color
235034e3a0dSichiro */
236034e3a0dSichiro case BIFB_D16_FFFF:
237034e3a0dSichiro case BIFB_D16_0000:
238034e3a0dSichiro fb->hf_class = HPCFB_CLASS_RGBCOLOR;
239034e3a0dSichiro fb->hf_access_flags |= HPCFB_ACCESS_STATIC;
24064b6b76aStakemura fb->hf_order_flags = HPCFB_REVORDER_BYTE;
241034e3a0dSichiro fb->hf_pack_width = 16;
242034e3a0dSichiro fb->hf_pixels_per_pack = 1;
243034e3a0dSichiro fb->hf_pixel_width = 16;
244034e3a0dSichiro
245034e3a0dSichiro fb->hf_class_data_length = sizeof(struct hf_rgb_tag);
246034e3a0dSichiro fb->hf_u.hf_rgb.hf_flags = 0;
247034e3a0dSichiro /* reserved for future use */
248034e3a0dSichiro fb->hf_u.hf_rgb.hf_red_width = 5;
249034e3a0dSichiro fb->hf_u.hf_rgb.hf_red_shift = 11;
250034e3a0dSichiro fb->hf_u.hf_rgb.hf_green_width = 6;
251034e3a0dSichiro fb->hf_u.hf_rgb.hf_green_shift = 5;
252034e3a0dSichiro fb->hf_u.hf_rgb.hf_blue_width = 5;
253034e3a0dSichiro fb->hf_u.hf_rgb.hf_blue_shift = 0;
254034e3a0dSichiro fb->hf_u.hf_rgb.hf_alpha_width = 0;
255034e3a0dSichiro fb->hf_u.hf_rgb.hf_alpha_shift = 0;
256034e3a0dSichiro break;
257034e3a0dSichiro default :
2584c494f76Srjs aprint_normal("unknown type (=%d).\n",
2594c494f76Srjs bootinfo->fb_type);
260034e3a0dSichiro return (-1);
261034e3a0dSichiro break;
262034e3a0dSichiro }
263034e3a0dSichiro
264034e3a0dSichiro return(0);
265034e3a0dSichiro }
266034e3a0dSichiro
267034e3a0dSichiro int
ipaqlcd_ioctl(void * v,u_long cmd,void * data,int flag,struct lwp * l)26853524e44Schristos ipaqlcd_ioctl(void *v, u_long cmd, void *data, int flag, struct lwp *l)
269034e3a0dSichiro {
270034e3a0dSichiro struct ipaqlcd_softc *sc = (struct ipaqlcd_softc *)v;
271034e3a0dSichiro struct hpcfb_fbconf *fbconf;
272034e3a0dSichiro struct hpcfb_dspconf *dspconf;
273034e3a0dSichiro struct wsdisplay_cmap *cmap;
274034e3a0dSichiro struct wsdisplay_param *dispparam;
275034e3a0dSichiro
276034e3a0dSichiro switch (cmd) {
277034e3a0dSichiro case WSDISPLAYIO_GETCMAP:
278034e3a0dSichiro cmap = (struct wsdisplay_cmap*)data;
279034e3a0dSichiro
280034e3a0dSichiro if (sc->sc_fbconf.hf_class != HPCFB_CLASS_INDEXCOLOR ||
281034e3a0dSichiro sc->sc_fbconf.hf_pack_width != 8 ||
282034e3a0dSichiro 256 <= cmap->index ||
283034e3a0dSichiro 256 < (cmap->index + cmap->count))
284034e3a0dSichiro return (EINVAL);
285034e3a0dSichiro return (0);
286034e3a0dSichiro case WSDISPLAYIO_PUTCMAP:
287034e3a0dSichiro return (EINVAL);
288034e3a0dSichiro case WSDISPLAYIO_GETPARAM:
289034e3a0dSichiro dispparam = (struct wsdisplay_param*)data;
290034e3a0dSichiro switch (dispparam->param) {
291034e3a0dSichiro case WSDISPLAYIO_PARAM_BACKLIGHT:
292034e3a0dSichiro DPRINTF(("ipaqlcd_ioctl: GETPARAM:BACKLIGHT\n"));
293034e3a0dSichiro return (EINVAL);
294034e3a0dSichiro case WSDISPLAYIO_PARAM_CONTRAST:
295034e3a0dSichiro DPRINTF(("ipaqlcd_ioctl: GETPARAM:CONTRAST\n"));
296034e3a0dSichiro return (EINVAL);
297034e3a0dSichiro case WSDISPLAYIO_PARAM_BRIGHTNESS:
298034e3a0dSichiro DPRINTF(("ipaqlcd_ioctl: GETPARAM:BRIGHTNESS\n"));
299034e3a0dSichiro return (EINVAL);
300034e3a0dSichiro default:
301034e3a0dSichiro return (EINVAL);
302034e3a0dSichiro }
303034e3a0dSichiro return (0);
304034e3a0dSichiro case WSDISPLAYIO_SETPARAM:
305034e3a0dSichiro dispparam = (struct wsdisplay_param*)data;
306034e3a0dSichiro switch (dispparam->param) {
307034e3a0dSichiro case WSDISPLAYIO_PARAM_BACKLIGHT:
308034e3a0dSichiro DPRINTF(("ipaqlcd_ioctl: GETPARAM:BACKLIGHT\n"));
309034e3a0dSichiro return (EINVAL);
310034e3a0dSichiro case WSDISPLAYIO_PARAM_CONTRAST:
311034e3a0dSichiro DPRINTF(("ipaqlcd_ioctl: GETPARAM:CONTRAST\n"));
312034e3a0dSichiro return (EINVAL);
313034e3a0dSichiro case WSDISPLAYIO_PARAM_BRIGHTNESS:
314034e3a0dSichiro DPRINTF(("ipaqlcd_ioctl: GETPARAM:BRIGHTNESS\n"));
315034e3a0dSichiro return (EINVAL);
316034e3a0dSichiro default:
317034e3a0dSichiro return (EINVAL);
318034e3a0dSichiro }
319034e3a0dSichiro return (0);
320034e3a0dSichiro
321034e3a0dSichiro case HPCFBIO_GCONF:
322034e3a0dSichiro fbconf = (struct hpcfb_fbconf *)data;
323034e3a0dSichiro if (fbconf->hf_conf_index != 0 &&
324034e3a0dSichiro fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
325034e3a0dSichiro return (EINVAL);
326034e3a0dSichiro }
327034e3a0dSichiro *fbconf = sc->sc_fbconf; /* structure assignment */
328034e3a0dSichiro return (0);
329034e3a0dSichiro case HPCFBIO_SCONF:
330034e3a0dSichiro fbconf = (struct hpcfb_fbconf *)data;
331034e3a0dSichiro if (fbconf->hf_conf_index != 0 &&
332034e3a0dSichiro fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
333034e3a0dSichiro return (EINVAL);
334034e3a0dSichiro }
335034e3a0dSichiro /*
336964859d8Sabs * nothing to do because we have only one configuration
337034e3a0dSichiro */
338034e3a0dSichiro return (0);
339034e3a0dSichiro case HPCFBIO_GDSPCONF:
340034e3a0dSichiro dspconf = (struct hpcfb_dspconf *)data;
341034e3a0dSichiro if ((dspconf->hd_unit_index != 0 &&
342034e3a0dSichiro dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
343034e3a0dSichiro (dspconf->hd_conf_index != 0 &&
344034e3a0dSichiro dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
345034e3a0dSichiro return (EINVAL);
346034e3a0dSichiro }
347034e3a0dSichiro *dspconf = sc->sc_dspconf; /* structure assignment */
348034e3a0dSichiro return (0);
349034e3a0dSichiro case HPCFBIO_SDSPCONF:
350034e3a0dSichiro dspconf = (struct hpcfb_dspconf *)data;
351034e3a0dSichiro if ((dspconf->hd_unit_index != 0 &&
352034e3a0dSichiro dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
353034e3a0dSichiro (dspconf->hd_conf_index != 0 &&
354034e3a0dSichiro dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
355034e3a0dSichiro return (EINVAL);
356034e3a0dSichiro }
357034e3a0dSichiro /*
358034e3a0dSichiro * nothing to do
359964859d8Sabs * because we have only one unit and one configuration
360034e3a0dSichiro */
361034e3a0dSichiro return (0);
362034e3a0dSichiro
363034e3a0dSichiro case HPCFBIO_GOP:
364034e3a0dSichiro case HPCFBIO_SOP:
365034e3a0dSichiro return (EINVAL);
366034e3a0dSichiro }
36731144d99Satatat return (EPASSTHROUGH);
368034e3a0dSichiro }
369034e3a0dSichiro
370034e3a0dSichiro paddr_t
ipaqlcd_mmap(void * ctx,off_t offset,int prot)371f99ba5e5Srjs ipaqlcd_mmap(void *ctx, off_t offset, int prot)
372034e3a0dSichiro {
373034e3a0dSichiro struct ipaqlcd_softc *sc = (struct ipaqlcd_softc *)ctx;
374034e3a0dSichiro
375034e3a0dSichiro if (offset < 0 ||
376034e3a0dSichiro (sc->sc_fbconf.hf_bytes_per_plane +
377034e3a0dSichiro sc->sc_fbconf.hf_offset) < offset)
378034e3a0dSichiro return -1;
379034e3a0dSichiro
380034e3a0dSichiro return __BTOP((u_long)bootinfo->fb_addr + offset);
381034e3a0dSichiro }
382