2001-07-22 13:56:39 +04:00
|
|
|
/* $NetBSD: ipaq_lcd.c,v 1.3 2001/07/22 09:56:40 takemura Exp $ */
|
2001-07-10 22:09:31 +04:00
|
|
|
#define IPAQ_LCD_DEBUG
|
2001-07-02 17:52:29 +04:00
|
|
|
|
2001-02-23 06:48:06 +03:00
|
|
|
/*
|
|
|
|
* Copyright (c) 2001 The NetBSD Foundation, Inc.
|
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
2001-07-02 17:52:29 +04:00
|
|
|
* by Ichiro FUKUHARA (ichiro@ichiro.org).
|
2001-02-23 06:48:06 +03:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
* 3. All advertising materials mentioning features or use of this software
|
|
|
|
* must display the following acknowledgement:
|
|
|
|
* This product includes software developed by the NetBSD
|
|
|
|
* Foundation, Inc. and its contributors.
|
|
|
|
* 4. Neither the name of The NetBSD Foundation nor the names of its
|
|
|
|
* contributors may be used to endorse or promote products derived
|
|
|
|
* from this software without specific prior written permission.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/param.h>
|
|
|
|
#include <sys/systm.h>
|
|
|
|
#include <sys/kernel.h>
|
|
|
|
#include <sys/time.h>
|
|
|
|
#include <sys/device.h>
|
|
|
|
|
|
|
|
#include <uvm/uvm_extern.h>
|
|
|
|
|
|
|
|
#include <dev/wscons/wsconsio.h>
|
|
|
|
|
|
|
|
#include <machine/bootinfo.h>
|
|
|
|
#include <machine/bus.h>
|
|
|
|
#include <machine/irqhandler.h>
|
|
|
|
#include <machine/cpufunc.h>
|
|
|
|
#include <machine/katelib.h>
|
|
|
|
|
|
|
|
#include <hpcarm/sa11x0/sa11x0_reg.h>
|
2001-07-08 18:45:03 +04:00
|
|
|
#include <hpcarm/sa11x0/sa11x0_gpioreg.h>
|
|
|
|
|
2001-07-10 22:09:31 +04:00
|
|
|
#include <hpcarm/dev/ipaq_gpioreg.h>
|
|
|
|
#include <hpcarm/dev/ipaq_saipvar.h>
|
|
|
|
#include <hpcarm/dev/ipaq_lcdreg.h>
|
|
|
|
#include <hpcarm/dev/ipaq_lcdvar.h>
|
|
|
|
|
|
|
|
#ifdef IPAQ_LCD_DEBUG
|
|
|
|
#define DPRINTFN(n, x) if (ipaqlcddebug > (n)) printf x
|
|
|
|
int ipaqlcddebug = 0xff;
|
2001-02-23 06:48:06 +03:00
|
|
|
#else
|
|
|
|
#define DPRINTFN(n, x)
|
|
|
|
#endif
|
|
|
|
#define DPRINTF(x) DPRINTFN(0, x)
|
|
|
|
|
2001-07-10 22:09:31 +04:00
|
|
|
static int ipaqlcd_match(struct device *, struct cfdata *, void *);
|
|
|
|
static void ipaqlcd_attach(struct device *, struct device *, void *);
|
|
|
|
static void ipaqlcd_init(struct ipaqlcd_softc *);
|
|
|
|
static int ipaqlcd_fbinit(struct ipaqlcd_softc *);
|
|
|
|
static int ipaqlcd_ioctl(void *, u_long, caddr_t, int, struct proc *);
|
|
|
|
static paddr_t ipaqlcd_mmap(void *, off_t offset, int);
|
2001-07-02 17:52:29 +04:00
|
|
|
|
|
|
|
#if defined __mips__ || defined __sh__ || defined __arm__
|
|
|
|
#define __BTOP(x) ((paddr_t)(x) >> PGSHIFT)
|
|
|
|
#define __PTOB(x) ((paddr_t)(x) << PGSHIFT)
|
|
|
|
#else
|
|
|
|
#error "define btop, ptob."
|
|
|
|
#endif
|
|
|
|
|
2001-07-10 22:09:31 +04:00
|
|
|
struct cfattach ipaqlcd_ca = {
|
|
|
|
sizeof(struct ipaqlcd_softc), ipaqlcd_match, ipaqlcd_attach
|
2001-02-23 06:48:06 +03:00
|
|
|
};
|
|
|
|
|
2001-07-10 22:09:31 +04:00
|
|
|
struct hpcfb_accessops ipaqlcd_ha = {
|
|
|
|
ipaqlcd_ioctl, ipaqlcd_mmap
|
2001-02-23 06:48:06 +03:00
|
|
|
};
|
2001-07-02 17:52:29 +04:00
|
|
|
static int console_flag = 0;
|
2001-02-23 06:48:06 +03:00
|
|
|
|
|
|
|
static int
|
2001-07-10 22:09:31 +04:00
|
|
|
ipaqlcd_match(parent, match, aux)
|
2001-02-23 06:48:06 +03:00
|
|
|
struct device *parent;
|
|
|
|
struct cfdata *match;
|
|
|
|
void *aux;
|
|
|
|
{
|
2001-05-01 16:36:54 +04:00
|
|
|
return (1);
|
2001-02-23 06:48:06 +03:00
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-07-10 22:09:31 +04:00
|
|
|
ipaqlcd_attach(parent, self, aux)
|
2001-02-23 06:48:06 +03:00
|
|
|
struct device *parent;
|
|
|
|
struct device *self;
|
|
|
|
void *aux;
|
|
|
|
{
|
2001-07-10 22:09:31 +04:00
|
|
|
struct ipaqlcd_softc *sc = (struct ipaqlcd_softc*)self;
|
2001-02-23 06:48:06 +03:00
|
|
|
struct hpcfb_attach_args ha;
|
2001-07-10 22:09:31 +04:00
|
|
|
struct ipaq_softc *psc = (struct ipaq_softc *)parent;
|
2001-02-23 06:48:06 +03:00
|
|
|
|
2001-07-10 22:09:31 +04:00
|
|
|
sc->sc_iot = psc->sc_iot;
|
|
|
|
sc->sc_parent = (struct ipaq_softc *)parent;
|
2001-07-08 18:45:03 +04:00
|
|
|
|
2001-07-10 22:09:31 +04:00
|
|
|
ipaqlcd_init(sc);
|
|
|
|
ipaqlcd_fbinit(sc);
|
2001-02-23 06:48:06 +03:00
|
|
|
|
2001-07-02 17:52:29 +04:00
|
|
|
printf("\n");
|
2001-07-10 22:09:31 +04:00
|
|
|
printf("%s: iPAQ internal LCD controller\n", sc->sc_dev.dv_xname);
|
2001-02-23 06:48:06 +03:00
|
|
|
|
2001-07-02 17:52:29 +04:00
|
|
|
DPRINTF(("framebuffer_baseaddr=%lx\n", (u_long)bootinfo->fb_addr));
|
2001-02-23 06:48:06 +03:00
|
|
|
|
2001-07-02 17:52:29 +04:00
|
|
|
ha.ha_console = console_flag;
|
2001-07-10 22:09:31 +04:00
|
|
|
ha.ha_accessops = &ipaqlcd_ha;
|
2001-02-23 06:48:06 +03:00
|
|
|
ha.ha_accessctx = sc;
|
|
|
|
ha.ha_curfbconf = 0;
|
|
|
|
ha.ha_nfbconf = 1;
|
|
|
|
ha.ha_fbconflist = &sc->sc_fbconf;
|
|
|
|
ha.ha_curdspconf = 0;
|
|
|
|
ha.ha_ndspconf = 1;
|
|
|
|
ha.ha_dspconflist = &sc->sc_dspconf;
|
|
|
|
|
|
|
|
config_found(&sc->sc_dev, &ha, hpcfbprint);
|
|
|
|
}
|
|
|
|
|
|
|
|
void
|
2001-07-10 22:09:31 +04:00
|
|
|
ipaqlcd_init(sc)
|
|
|
|
struct ipaqlcd_softc *sc;
|
2001-02-23 06:48:06 +03:00
|
|
|
{
|
2001-07-08 18:45:03 +04:00
|
|
|
/* Initialization of Extended GPIO */
|
2001-07-15 04:30:17 +04:00
|
|
|
sc->sc_parent->ipaq_egpio |= EGPIO_LCD_INIT;
|
|
|
|
bus_space_write_2(sc->sc_iot, sc->sc_parent->sc_egpioh,
|
|
|
|
0, sc->sc_parent->ipaq_egpio);
|
2001-02-23 06:48:06 +03:00
|
|
|
|
2001-07-02 17:52:29 +04:00
|
|
|
if (bus_space_map(sc->sc_iot, SALCD_BASE, SALCD_NPORTS,
|
|
|
|
0, &sc->sc_ioh))
|
2001-07-10 22:09:31 +04:00
|
|
|
panic("ipaqlcd_init:Cannot map registers\n");
|
2001-02-23 06:48:06 +03:00
|
|
|
|
2001-07-08 18:45:03 +04:00
|
|
|
(u_long)bootinfo->fb_addr =
|
|
|
|
bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_BA1);
|
2001-02-23 06:48:06 +03:00
|
|
|
|
|
|
|
/*
|
2001-07-08 18:45:03 +04:00
|
|
|
* Initialize LCD Control Register 0 - 3
|
|
|
|
* must initialize DMA Channel Base Address Register
|
|
|
|
* before enabling LCD(LEN = 1)
|
2001-02-23 06:48:06 +03:00
|
|
|
*/
|
|
|
|
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
|
2001-07-08 18:45:03 +04:00
|
|
|
SALCD_CR1, IPAQ_LCCR1);
|
2001-02-23 06:48:06 +03:00
|
|
|
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
|
2001-07-08 18:45:03 +04:00
|
|
|
SALCD_CR2, IPAQ_LCCR2);
|
2001-02-23 06:48:06 +03:00
|
|
|
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
|
2001-07-08 18:45:03 +04:00
|
|
|
SALCD_CR3, IPAQ_LCCR3);
|
2001-02-23 06:48:06 +03:00
|
|
|
bus_space_write_4(sc->sc_iot, sc->sc_ioh,
|
2001-07-08 18:45:03 +04:00
|
|
|
SALCD_CR0, IPAQ_LCCR0);
|
2001-07-02 17:52:29 +04:00
|
|
|
|
2001-07-15 04:30:17 +04:00
|
|
|
DPRINTF(("\n"
|
|
|
|
"DMA_BASE= %08x : DMA_CUR = %08x \n"
|
2001-02-23 06:48:06 +03:00
|
|
|
"LCCR0 = %08x : LCCR1 = %08x \n"
|
2001-07-08 18:45:03 +04:00
|
|
|
"LCCR2 = %08x : LCCR3 = %08x",
|
2001-02-23 06:48:06 +03:00
|
|
|
bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_BA1),
|
|
|
|
bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CA1),
|
|
|
|
bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR0),
|
|
|
|
bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR1),
|
|
|
|
bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR2),
|
|
|
|
bus_space_read_4(sc->sc_iot, sc->sc_ioh, SALCD_CR3)));
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-07-10 22:09:31 +04:00
|
|
|
ipaqlcd_fbinit(sc)
|
|
|
|
struct ipaqlcd_softc *sc;
|
2001-02-23 06:48:06 +03:00
|
|
|
{
|
2001-07-10 22:09:31 +04:00
|
|
|
struct hpcfb_fbconf *fb;
|
|
|
|
|
|
|
|
fb = &sc->sc_fbconf;
|
|
|
|
|
2001-02-23 06:48:06 +03:00
|
|
|
/* Initialize fb */
|
2001-07-07 10:29:13 +04:00
|
|
|
memset(fb, 0, sizeof(*fb));
|
2001-02-23 06:48:06 +03:00
|
|
|
|
|
|
|
fb->hf_conf_index = 0; /* configuration index */
|
|
|
|
fb->hf_nconfs = 1;
|
|
|
|
strcpy(fb->hf_name, "built-in video");
|
|
|
|
strcpy(fb->hf_conf_name, "LCD");
|
|
|
|
/* configuration name */
|
|
|
|
fb->hf_height = bootinfo->fb_height;
|
|
|
|
fb->hf_width = bootinfo->fb_width;
|
|
|
|
|
2001-07-10 22:09:31 +04:00
|
|
|
if (bus_space_map(sc->sc_iot, (bus_addr_t)bootinfo->fb_addr,
|
2001-07-02 17:52:29 +04:00
|
|
|
bootinfo->fb_height * bootinfo->fb_line_bytes,
|
|
|
|
0, &fb->hf_baseaddr)) {
|
|
|
|
printf("unable to map framebuffer\n");
|
|
|
|
return (-1);
|
|
|
|
}
|
|
|
|
|
|
|
|
fb->hf_offset = (u_long)bootinfo->fb_addr -
|
|
|
|
__PTOB(__BTOP(bootinfo->fb_addr));
|
|
|
|
/* frame buffer start offset */
|
2001-02-23 06:48:06 +03:00
|
|
|
fb->hf_bytes_per_line = bootinfo->fb_line_bytes;
|
|
|
|
fb->hf_nplanes = 1;
|
|
|
|
fb->hf_bytes_per_plane = bootinfo->fb_height *
|
|
|
|
bootinfo->fb_line_bytes;
|
|
|
|
|
|
|
|
fb->hf_access_flags |= HPCFB_ACCESS_BYTE;
|
|
|
|
fb->hf_access_flags |= HPCFB_ACCESS_WORD;
|
|
|
|
fb->hf_access_flags |= HPCFB_ACCESS_DWORD;
|
|
|
|
|
|
|
|
switch (bootinfo->fb_type) {
|
|
|
|
/*
|
|
|
|
* gray scale
|
|
|
|
*/
|
|
|
|
case BIFB_D2_M2L_3:
|
|
|
|
case BIFB_D2_M2L_3x2:
|
|
|
|
fb->hf_access_flags |= HPCFB_ACCESS_REVERSE;
|
|
|
|
case BIFB_D2_M2L_0:
|
|
|
|
case BIFB_D2_M2L_0x2:
|
|
|
|
fb->hf_class = HPCFB_CLASS_GRAYSCALE;
|
|
|
|
break;
|
|
|
|
case BIFB_D4_M2L_F:
|
|
|
|
case BIFB_D4_M2L_Fx2:
|
|
|
|
fb->hf_access_flags |= HPCFB_ACCESS_REVERSE;
|
|
|
|
case BIFB_D4_M2L_0:
|
|
|
|
case BIFB_D4_M2L_0x2:
|
|
|
|
fb->hf_class = HPCFB_CLASS_GRAYSCALE;
|
|
|
|
break;
|
|
|
|
/*
|
|
|
|
* indexed color
|
|
|
|
*/
|
|
|
|
case BIFB_D8_FF:
|
|
|
|
case BIFB_D8_00:
|
|
|
|
fb->hf_offset = 0x200;
|
|
|
|
break;
|
|
|
|
/*
|
|
|
|
* RGB color
|
|
|
|
*/
|
|
|
|
case BIFB_D16_FFFF:
|
|
|
|
case BIFB_D16_0000:
|
|
|
|
fb->hf_class = HPCFB_CLASS_RGBCOLOR;
|
|
|
|
fb->hf_access_flags |= HPCFB_ACCESS_STATIC;
|
2001-07-22 13:56:39 +04:00
|
|
|
fb->hf_order_flags = HPCFB_REVORDER_BYTE;
|
2001-02-23 06:48:06 +03:00
|
|
|
fb->hf_pack_width = 16;
|
|
|
|
fb->hf_pixels_per_pack = 1;
|
|
|
|
fb->hf_pixel_width = 16;
|
|
|
|
|
|
|
|
fb->hf_class_data_length = sizeof(struct hf_rgb_tag);
|
2001-07-02 17:52:29 +04:00
|
|
|
fb->hf_u.hf_rgb.hf_flags = 0;
|
|
|
|
/* reserved for future use */
|
2001-02-23 06:48:06 +03:00
|
|
|
fb->hf_u.hf_rgb.hf_red_width = 5;
|
|
|
|
fb->hf_u.hf_rgb.hf_red_shift = 11;
|
|
|
|
fb->hf_u.hf_rgb.hf_green_width = 6;
|
|
|
|
fb->hf_u.hf_rgb.hf_green_shift = 5;
|
|
|
|
fb->hf_u.hf_rgb.hf_blue_width = 5;
|
|
|
|
fb->hf_u.hf_rgb.hf_blue_shift = 0;
|
|
|
|
fb->hf_u.hf_rgb.hf_alpha_width = 0;
|
|
|
|
fb->hf_u.hf_rgb.hf_alpha_shift = 0;
|
|
|
|
break;
|
|
|
|
default :
|
|
|
|
printf("unknown type (=%d).\n", bootinfo->fb_type);
|
|
|
|
return (-1);
|
|
|
|
break;
|
|
|
|
}
|
|
|
|
|
|
|
|
return(0);
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2001-07-10 22:09:31 +04:00
|
|
|
ipaqlcd_ioctl(v, cmd, data, flag, p)
|
2001-02-23 06:48:06 +03:00
|
|
|
void *v;
|
|
|
|
u_long cmd;
|
|
|
|
caddr_t data;
|
|
|
|
int flag;
|
|
|
|
struct proc *p;
|
|
|
|
{
|
2001-07-10 22:09:31 +04:00
|
|
|
struct ipaqlcd_softc *sc = (struct ipaqlcd_softc *)v;
|
2001-02-23 06:48:06 +03:00
|
|
|
struct hpcfb_fbconf *fbconf;
|
|
|
|
struct hpcfb_dspconf *dspconf;
|
|
|
|
struct wsdisplay_cmap *cmap;
|
|
|
|
struct wsdisplay_param *dispparam;
|
|
|
|
|
|
|
|
switch (cmd) {
|
|
|
|
case WSDISPLAYIO_GETCMAP:
|
|
|
|
cmap = (struct wsdisplay_cmap*)data;
|
|
|
|
|
|
|
|
if (sc->sc_fbconf.hf_class != HPCFB_CLASS_INDEXCOLOR ||
|
|
|
|
sc->sc_fbconf.hf_pack_width != 8 ||
|
|
|
|
256 <= cmap->index ||
|
|
|
|
256 < (cmap->index + cmap->count))
|
|
|
|
return (EINVAL);
|
|
|
|
return (0);
|
|
|
|
case WSDISPLAYIO_PUTCMAP:
|
|
|
|
return (EINVAL);
|
|
|
|
case WSDISPLAYIO_GETPARAM:
|
|
|
|
dispparam = (struct wsdisplay_param*)data;
|
|
|
|
switch (dispparam->param) {
|
|
|
|
case WSDISPLAYIO_PARAM_BACKLIGHT:
|
2001-07-10 22:09:31 +04:00
|
|
|
DPRINTF(("ipaqlcd_ioctl: GETPARAM:BACKLIGHT\n"));
|
2001-02-23 06:48:06 +03:00
|
|
|
return (EINVAL);
|
|
|
|
case WSDISPLAYIO_PARAM_CONTRAST:
|
2001-07-10 22:09:31 +04:00
|
|
|
DPRINTF(("ipaqlcd_ioctl: GETPARAM:CONTRAST\n"));
|
2001-02-23 06:48:06 +03:00
|
|
|
return (EINVAL);
|
|
|
|
case WSDISPLAYIO_PARAM_BRIGHTNESS:
|
2001-07-10 22:09:31 +04:00
|
|
|
DPRINTF(("ipaqlcd_ioctl: GETPARAM:BRIGHTNESS\n"));
|
2001-02-23 06:48:06 +03:00
|
|
|
return (EINVAL);
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
case WSDISPLAYIO_SETPARAM:
|
|
|
|
dispparam = (struct wsdisplay_param*)data;
|
|
|
|
switch (dispparam->param) {
|
|
|
|
case WSDISPLAYIO_PARAM_BACKLIGHT:
|
2001-07-10 22:09:31 +04:00
|
|
|
DPRINTF(("ipaqlcd_ioctl: GETPARAM:BACKLIGHT\n"));
|
2001-02-23 06:48:06 +03:00
|
|
|
return (EINVAL);
|
|
|
|
case WSDISPLAYIO_PARAM_CONTRAST:
|
2001-07-10 22:09:31 +04:00
|
|
|
DPRINTF(("ipaqlcd_ioctl: GETPARAM:CONTRAST\n"));
|
2001-02-23 06:48:06 +03:00
|
|
|
return (EINVAL);
|
|
|
|
case WSDISPLAYIO_PARAM_BRIGHTNESS:
|
2001-07-10 22:09:31 +04:00
|
|
|
DPRINTF(("ipaqlcd_ioctl: GETPARAM:BRIGHTNESS\n"));
|
2001-02-23 06:48:06 +03:00
|
|
|
return (EINVAL);
|
|
|
|
default:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
case HPCFBIO_GCONF:
|
|
|
|
fbconf = (struct hpcfb_fbconf *)data;
|
|
|
|
if (fbconf->hf_conf_index != 0 &&
|
|
|
|
fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
*fbconf = sc->sc_fbconf; /* structure assignment */
|
|
|
|
return (0);
|
|
|
|
case HPCFBIO_SCONF:
|
|
|
|
fbconf = (struct hpcfb_fbconf *)data;
|
|
|
|
if (fbconf->hf_conf_index != 0 &&
|
|
|
|
fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* nothing to do because we have only one configration
|
|
|
|
*/
|
|
|
|
return (0);
|
|
|
|
case HPCFBIO_GDSPCONF:
|
|
|
|
dspconf = (struct hpcfb_dspconf *)data;
|
|
|
|
if ((dspconf->hd_unit_index != 0 &&
|
|
|
|
dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
|
|
|
|
(dspconf->hd_conf_index != 0 &&
|
|
|
|
dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
*dspconf = sc->sc_dspconf; /* structure assignment */
|
|
|
|
return (0);
|
|
|
|
case HPCFBIO_SDSPCONF:
|
|
|
|
dspconf = (struct hpcfb_dspconf *)data;
|
|
|
|
if ((dspconf->hd_unit_index != 0 &&
|
|
|
|
dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
|
|
|
|
(dspconf->hd_conf_index != 0 &&
|
|
|
|
dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
/*
|
|
|
|
* nothing to do
|
|
|
|
* because we have only one unit and one configration
|
|
|
|
*/
|
|
|
|
return (0);
|
|
|
|
|
|
|
|
case HPCFBIO_GOP:
|
|
|
|
case HPCFBIO_SOP:
|
|
|
|
return (EINVAL);
|
|
|
|
}
|
|
|
|
return (ENOTTY);
|
|
|
|
}
|
|
|
|
|
|
|
|
paddr_t
|
2001-07-10 22:09:31 +04:00
|
|
|
ipaqlcd_mmap(ctx, offset, prot)
|
2001-02-23 06:48:06 +03:00
|
|
|
void *ctx;
|
|
|
|
off_t offset;
|
|
|
|
int prot;
|
|
|
|
{
|
2001-07-10 22:09:31 +04:00
|
|
|
struct ipaqlcd_softc *sc = (struct ipaqlcd_softc *)ctx;
|
2001-02-23 06:48:06 +03:00
|
|
|
|
2001-07-02 17:52:29 +04:00
|
|
|
if (offset < 0 ||
|
|
|
|
(sc->sc_fbconf.hf_bytes_per_plane +
|
|
|
|
sc->sc_fbconf.hf_offset) < offset)
|
|
|
|
return -1;
|
2001-02-23 06:48:06 +03:00
|
|
|
|
2001-07-02 17:52:29 +04:00
|
|
|
return __BTOP((u_long)bootinfo->fb_addr + offset);
|
|
|
|
}
|