Home | History | Annotate | Line # | Download | only in dev
wzero3_lcd.c revision 1.1
      1  1.1  nonaka /*	$NetBSD: wzero3_lcd.c,v 1.1 2010/04/17 13:36:21 nonaka Exp $	*/
      2  1.1  nonaka 
      3  1.1  nonaka /*
      4  1.1  nonaka  * Copyright (c) 2008,2009 NONAKA Kimihiro <nonaka (at) netbsd.org>
      5  1.1  nonaka  * All rights reserved.
      6  1.1  nonaka  *
      7  1.1  nonaka  * Redistribution and use in source and binary forms, with or without
      8  1.1  nonaka  * modification, are permitted provided that the following conditions
      9  1.1  nonaka  * are met:
     10  1.1  nonaka  * 1. Redistributions of source code must retain the above copyright
     11  1.1  nonaka  *    notice, this list of conditions and the following disclaimer.
     12  1.1  nonaka  * 2. Redistributions in binary form must reproduce the above copyright
     13  1.1  nonaka  *    notice, this list of conditions and the following disclaimer in the
     14  1.1  nonaka  *    documentation and/or other materials provided with the distribution.
     15  1.1  nonaka  *
     16  1.1  nonaka  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
     17  1.1  nonaka  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
     18  1.1  nonaka  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
     19  1.1  nonaka  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
     20  1.1  nonaka  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
     21  1.1  nonaka  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
     22  1.1  nonaka  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
     23  1.1  nonaka  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
     24  1.1  nonaka  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
     25  1.1  nonaka  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
     26  1.1  nonaka  * SUCH DAMAGE.
     27  1.1  nonaka  */
     28  1.1  nonaka 
     29  1.1  nonaka #include <sys/cdefs.h>
     30  1.1  nonaka __KERNEL_RCSID(0, "$NetBSD: wzero3_lcd.c,v 1.1 2010/04/17 13:36:21 nonaka Exp $");
     31  1.1  nonaka 
     32  1.1  nonaka #include <sys/param.h>
     33  1.1  nonaka #include <sys/systm.h>
     34  1.1  nonaka #include <sys/device.h>
     35  1.1  nonaka #include <sys/pmf.h>
     36  1.1  nonaka 
     37  1.1  nonaka #include <dev/cons.h>
     38  1.1  nonaka #include <dev/wscons/wsconsio.h>
     39  1.1  nonaka #include <dev/wscons/wsdisplayvar.h>
     40  1.1  nonaka #include <dev/wscons/wscons_callbacks.h>
     41  1.1  nonaka 
     42  1.1  nonaka #include <dev/hpc/hpcfbio.h>
     43  1.1  nonaka 
     44  1.1  nonaka #include <arm/xscale/pxa2x0cpu.h>
     45  1.1  nonaka #include <arm/xscale/pxa2x0var.h>
     46  1.1  nonaka #include <arm/xscale/pxa2x0_lcd.h>
     47  1.1  nonaka 
     48  1.1  nonaka #include <machine/bus.h>
     49  1.1  nonaka #include <machine/bootinfo.h>
     50  1.1  nonaka #include <machine/platid.h>
     51  1.1  nonaka #include <machine/platid_mask.h>
     52  1.1  nonaka 
     53  1.1  nonaka #ifdef DEBUG
     54  1.1  nonaka #define DPRINTF(arg)	printf arg
     55  1.1  nonaka #else
     56  1.1  nonaka #define DPRINTF(arg)	/* nothing */
     57  1.1  nonaka #endif
     58  1.1  nonaka 
     59  1.1  nonaka /*
     60  1.1  nonaka  * wsdisplay glue
     61  1.1  nonaka  */
     62  1.1  nonaka static struct pxa2x0_wsscreen_descr wzero3lcd_std_screen = {
     63  1.1  nonaka 	.c = {
     64  1.1  nonaka 		.name = "std",
     65  1.1  nonaka 		.textops = &pxa2x0_lcd_emulops,
     66  1.1  nonaka 		.fontwidth = 8,
     67  1.1  nonaka 		.fontheight = 16,
     68  1.1  nonaka 		.capabilities = WSSCREEN_WSCOLORS,
     69  1.1  nonaka 	},
     70  1.1  nonaka 	.depth = 16,			/* bits per pixel */
     71  1.1  nonaka 	.flags = 0,
     72  1.1  nonaka };
     73  1.1  nonaka 
     74  1.1  nonaka static const struct wsscreen_descr *wzero3lcd_scr_descr[] = {
     75  1.1  nonaka 	&wzero3lcd_std_screen.c
     76  1.1  nonaka };
     77  1.1  nonaka 
     78  1.1  nonaka static const struct wsscreen_list wzero3lcd_screen_list = {
     79  1.1  nonaka 	.nscreens = __arraycount(wzero3lcd_scr_descr),
     80  1.1  nonaka 	.screens = wzero3lcd_scr_descr,
     81  1.1  nonaka };
     82  1.1  nonaka 
     83  1.1  nonaka static int wzero3lcd_ioctl(void *, void *, u_long, void *, int, struct lwp *);
     84  1.1  nonaka static int wzero3lcd_param(struct pxa2x0_lcd_softc *, u_long, struct wsdisplay_param *);
     85  1.1  nonaka static int wzero3lcd_show_screen(void *, void *, int, void (*)(void *, int, int), void *);
     86  1.1  nonaka 
     87  1.1  nonaka static struct wsdisplay_accessops wzero3lcd_accessops = {
     88  1.1  nonaka 	wzero3lcd_ioctl,
     89  1.1  nonaka 	pxa2x0_lcd_mmap,
     90  1.1  nonaka 	pxa2x0_lcd_alloc_screen,
     91  1.1  nonaka 	pxa2x0_lcd_free_screen,
     92  1.1  nonaka 	wzero3lcd_show_screen,
     93  1.1  nonaka 	NULL,
     94  1.1  nonaka 	NULL,
     95  1.1  nonaka 	NULL,
     96  1.1  nonaka };
     97  1.1  nonaka 
     98  1.1  nonaka /* WS003SH or WS004SH */
     99  1.1  nonaka static const struct lcd_panel_geometry sharp_ws003sh = {
    100  1.1  nonaka 	480,			/* Width */
    101  1.1  nonaka 	640,			/* Height */
    102  1.1  nonaka 	0,			/* No extra lines */
    103  1.1  nonaka 
    104  1.1  nonaka 	LCDPANEL_ACTIVE | LCDPANEL_VSP | LCDPANEL_HSP,
    105  1.1  nonaka 	1,			/* clock divider */
    106  1.1  nonaka 	0,			/* AC bias pin freq */
    107  1.1  nonaka 
    108  1.1  nonaka 	0x14,			/* horizontal sync pulse width */
    109  1.1  nonaka 	0x4e,			/* BLW */
    110  1.1  nonaka 	0x46,			/* ELW */
    111  1.1  nonaka 
    112  1.1  nonaka 	0,			/* vertical sync pulse width */
    113  1.1  nonaka 	2,			/* BFW */
    114  1.1  nonaka 	5,			/* EFW */
    115  1.1  nonaka 
    116  1.1  nonaka 	0,			/* PCDDIV */
    117  1.1  nonaka };
    118  1.1  nonaka 
    119  1.1  nonaka /* WS007SH */
    120  1.1  nonaka static const struct lcd_panel_geometry sharp_ws007sh = {
    121  1.1  nonaka 	480,			/* Width */
    122  1.1  nonaka 	640,			/* Height */
    123  1.1  nonaka 	0,			/* No extra lines */
    124  1.1  nonaka 
    125  1.1  nonaka 	LCDPANEL_ACTIVE | LCDPANEL_VSP | LCDPANEL_HSP | LCDPANEL_PCP | LCDPANEL_OEP,
    126  1.1  nonaka 	3,			/* clock divider */
    127  1.1  nonaka 	0,			/* AC bias pin freq */
    128  1.1  nonaka 
    129  1.1  nonaka 	0x27,			/* horizontal sync pulse width */
    130  1.1  nonaka 	0x68,			/* BLW */
    131  1.1  nonaka 	0x5b,			/* ELW */
    132  1.1  nonaka 
    133  1.1  nonaka 	0,			/* vertical sync pulse width */
    134  1.1  nonaka 	2,			/* BFW */
    135  1.1  nonaka 	5,			/* EFW */
    136  1.1  nonaka 
    137  1.1  nonaka 	1,			/* PCDDIV */
    138  1.1  nonaka };
    139  1.1  nonaka 
    140  1.1  nonaka /* WS011SH */
    141  1.1  nonaka static const struct lcd_panel_geometry sharp_ws011sh = {
    142  1.1  nonaka 	480,			/* Width */
    143  1.1  nonaka 	800,			/* Height */
    144  1.1  nonaka 	0,			/* No extra lines */
    145  1.1  nonaka 
    146  1.1  nonaka 	LCDPANEL_ACTIVE | LCDPANEL_VSP | LCDPANEL_HSP | LCDPANEL_PCP,
    147  1.1  nonaka 	1,			/* clock divider */
    148  1.1  nonaka 	0,			/* AC bias pin freq */
    149  1.1  nonaka 
    150  1.1  nonaka 	0x0a,			/* horizontal sync pulse width */
    151  1.1  nonaka 	0x0c,			/* BLW */
    152  1.1  nonaka 	0x5e,			/* ELW */
    153  1.1  nonaka 
    154  1.1  nonaka 	0,			/* vertical sync pulse width */
    155  1.1  nonaka 	2,			/* BFW */
    156  1.1  nonaka 	1,			/* EFW */
    157  1.1  nonaka 
    158  1.1  nonaka 	0,			/* PCDDIV */
    159  1.1  nonaka };
    160  1.1  nonaka 
    161  1.1  nonaka /* WS020SH */
    162  1.1  nonaka static const struct lcd_panel_geometry sharp_ws020sh = {
    163  1.1  nonaka 	480,			/* Width */
    164  1.1  nonaka 	800,			/* Height */
    165  1.1  nonaka 	0,			/* No extra lines */
    166  1.1  nonaka 
    167  1.1  nonaka 	LCDPANEL_ACTIVE | LCDPANEL_VSP | LCDPANEL_HSP | LCDPANEL_PCP,
    168  1.1  nonaka 	1,			/* clock divider */
    169  1.1  nonaka 	0,			/* AC bias pin freq */
    170  1.1  nonaka 
    171  1.1  nonaka 	0x0a,			/* horizontal sync pulse width */
    172  1.1  nonaka 	0x0c,			/* BLW */
    173  1.1  nonaka 	0x5e,			/* ELW */
    174  1.1  nonaka 
    175  1.1  nonaka 	0,			/* vertical sync pulse width */
    176  1.1  nonaka 	2,			/* BFW */
    177  1.1  nonaka 	1,			/* EFW */
    178  1.1  nonaka 
    179  1.1  nonaka 	0,			/* PCDDIV */
    180  1.1  nonaka };
    181  1.1  nonaka 
    182  1.1  nonaka static int	wzero3lcd_match(struct device *, struct cfdata *, void *);
    183  1.1  nonaka static void	wzero3lcd_attach(struct device *, struct device *, void *);
    184  1.1  nonaka 
    185  1.1  nonaka CFATTACH_DECL_NEW(wzero3lcd, sizeof(struct pxa2x0_lcd_softc),
    186  1.1  nonaka 	wzero3lcd_match, wzero3lcd_attach, NULL, NULL);
    187  1.1  nonaka 
    188  1.1  nonaka static const struct lcd_panel_geometry *wzero3lcd_lookup(void);
    189  1.1  nonaka void wzero3lcd_cnattach(void);
    190  1.1  nonaka static bool wzero3lcd_suspend(device_t dv, const pmf_qual_t *);
    191  1.1  nonaka static bool wzero3lcd_resume(device_t dv, const pmf_qual_t *);
    192  1.1  nonaka 
    193  1.1  nonaka /* default: quarter counter clockwise rotation */
    194  1.1  nonaka int screen_rotate = 270;
    195  1.1  nonaka 
    196  1.1  nonaka static const struct lcd_panel_geometry *
    197  1.1  nonaka wzero3lcd_lookup(void)
    198  1.1  nonaka {
    199  1.1  nonaka 
    200  1.1  nonaka 	if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS003SH)
    201  1.1  nonaka 	 || platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS004SH))
    202  1.1  nonaka 		return &sharp_ws003sh;
    203  1.1  nonaka 	if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS007SH))
    204  1.1  nonaka 		return &sharp_ws007sh;
    205  1.1  nonaka 	if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS011SH))
    206  1.1  nonaka 		return &sharp_ws011sh;
    207  1.1  nonaka 	if (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS020SH))
    208  1.1  nonaka 		return &sharp_ws020sh;
    209  1.1  nonaka 	return NULL;
    210  1.1  nonaka }
    211  1.1  nonaka 
    212  1.1  nonaka static int
    213  1.1  nonaka wzero3lcd_match(struct device *parent, struct cfdata *cf, void *aux)
    214  1.1  nonaka {
    215  1.1  nonaka 
    216  1.1  nonaka 	if (strcmp(cf->cf_name, "lcd") != 0)
    217  1.1  nonaka 		return 0;
    218  1.1  nonaka 	if (wzero3lcd_lookup() == NULL)
    219  1.1  nonaka 		return 0;
    220  1.1  nonaka 	return 1;
    221  1.1  nonaka }
    222  1.1  nonaka 
    223  1.1  nonaka static void
    224  1.1  nonaka wzero3lcd_attach(struct device *parent, struct device *self, void *aux)
    225  1.1  nonaka {
    226  1.1  nonaka 	struct pxa2x0_lcd_softc *sc = device_private(self);
    227  1.1  nonaka 	struct wsemuldisplaydev_attach_args aa;
    228  1.1  nonaka 	const struct lcd_panel_geometry *panel;
    229  1.1  nonaka 
    230  1.1  nonaka 	sc->dev = self;
    231  1.1  nonaka 
    232  1.1  nonaka 	panel = wzero3lcd_lookup();
    233  1.1  nonaka 	if (panel == NULL) {
    234  1.1  nonaka 		aprint_error(": unknown model\n");
    235  1.1  nonaka 		return;
    236  1.1  nonaka 	}
    237  1.1  nonaka 
    238  1.1  nonaka 	if ((platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS007SH))
    239  1.1  nonaka 	 || (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS011SH))
    240  1.1  nonaka 	 || (platid_match(&platid, &platid_mask_MACH_SHARP_WZERO3_WS020SH)))
    241  1.1  nonaka 		sc->flags |= FLAG_NOUSE_ACBIAS;
    242  1.1  nonaka 
    243  1.1  nonaka 	wzero3lcd_std_screen.flags &= ~(RI_ROTATE_MASK);
    244  1.1  nonaka 	switch (screen_rotate) {
    245  1.1  nonaka 	default:
    246  1.1  nonaka 		break;
    247  1.1  nonaka 
    248  1.1  nonaka 	case 270:	/* quarter counter clockwise rotation */
    249  1.1  nonaka 		wzero3lcd_std_screen.flags |= RI_ROTATE_CCW;
    250  1.1  nonaka 		break;
    251  1.1  nonaka 	}
    252  1.1  nonaka 	pxa2x0_lcd_attach_sub(sc, aux, panel);
    253  1.1  nonaka 
    254  1.1  nonaka 	aa.console = (bootinfo->bi_cnuse != BI_CNUSE_SERIAL);
    255  1.1  nonaka 	aa.scrdata = &wzero3lcd_screen_list;
    256  1.1  nonaka 	aa.accessops = &wzero3lcd_accessops;
    257  1.1  nonaka 	aa.accesscookie = sc;
    258  1.1  nonaka 
    259  1.1  nonaka 	(void) config_found(self, &aa, wsemuldisplaydevprint);
    260  1.1  nonaka 
    261  1.1  nonaka 	if (!pmf_device_register(sc->dev, wzero3lcd_suspend, wzero3lcd_resume))
    262  1.1  nonaka 		aprint_error_dev(sc->dev, "couldn't establish power handler\n");
    263  1.1  nonaka }
    264  1.1  nonaka 
    265  1.1  nonaka void
    266  1.1  nonaka wzero3lcd_cnattach(void)
    267  1.1  nonaka {
    268  1.1  nonaka 	const struct lcd_panel_geometry *panel;
    269  1.1  nonaka 
    270  1.1  nonaka 	panel = wzero3lcd_lookup();
    271  1.1  nonaka 	if (panel == NULL)
    272  1.1  nonaka 		return;
    273  1.1  nonaka 
    274  1.1  nonaka 	pxa2x0_lcd_cnattach(&wzero3lcd_std_screen, panel);
    275  1.1  nonaka }
    276  1.1  nonaka 
    277  1.1  nonaka /*
    278  1.1  nonaka  * Power management
    279  1.1  nonaka  */
    280  1.1  nonaka static bool
    281  1.1  nonaka wzero3lcd_suspend(device_t dv, const pmf_qual_t *qual)
    282  1.1  nonaka {
    283  1.1  nonaka 	struct pxa2x0_lcd_softc *sc = device_private(dv);
    284  1.1  nonaka 
    285  1.1  nonaka 	pxa2x0_lcd_suspend(sc);
    286  1.1  nonaka 
    287  1.1  nonaka 	return true;
    288  1.1  nonaka }
    289  1.1  nonaka 
    290  1.1  nonaka static bool
    291  1.1  nonaka wzero3lcd_resume(device_t dv, const pmf_qual_t *qual)
    292  1.1  nonaka {
    293  1.1  nonaka 	struct pxa2x0_lcd_softc *sc = device_private(dv);
    294  1.1  nonaka 
    295  1.1  nonaka 	pxa2x0_lcd_resume(sc);
    296  1.1  nonaka 
    297  1.1  nonaka 	return true;
    298  1.1  nonaka }
    299  1.1  nonaka 
    300  1.1  nonaka /*
    301  1.1  nonaka  * wsdisplay accessops overrides
    302  1.1  nonaka  */
    303  1.1  nonaka static int
    304  1.1  nonaka wzero3lcd_ioctl(void *v, void *vs, u_long cmd, void *data, int flag, struct lwp *l)
    305  1.1  nonaka {
    306  1.1  nonaka 	struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)v;
    307  1.1  nonaka 	struct hpcfb_fbconf *fbconf;
    308  1.1  nonaka 	struct hpcfb_dspconf *dspconf;
    309  1.1  nonaka 	int res = EINVAL;
    310  1.1  nonaka 
    311  1.1  nonaka 	switch (cmd) {
    312  1.1  nonaka 	case WSDISPLAYIO_GETPARAM:
    313  1.1  nonaka 	case WSDISPLAYIO_SETPARAM:
    314  1.1  nonaka 		res = wzero3lcd_param(sc, cmd, (struct wsdisplay_param *)data);
    315  1.1  nonaka 		break;
    316  1.1  nonaka 
    317  1.1  nonaka 	case HPCFBIO_GCONF:
    318  1.1  nonaka 		fbconf = (struct hpcfb_fbconf *)data;
    319  1.1  nonaka 		if (fbconf->hf_conf_index != 0 &&
    320  1.1  nonaka 		    fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
    321  1.1  nonaka 			break;
    322  1.1  nonaka 		}
    323  1.1  nonaka 
    324  1.1  nonaka 		fbconf->hf_conf_index = 0;
    325  1.1  nonaka 		fbconf->hf_nconfs = 1;
    326  1.1  nonaka 		fbconf->hf_class = HPCFB_CLASS_RGBCOLOR;
    327  1.1  nonaka 		strlcpy(fbconf->hf_name, "Sharp W-ZERO3 frame buffer",
    328  1.1  nonaka 		    sizeof(fbconf->hf_name));
    329  1.1  nonaka 		strlcpy(fbconf->hf_conf_name, "LCD",
    330  1.1  nonaka 		    sizeof(fbconf->hf_conf_name));
    331  1.1  nonaka 		fbconf->hf_baseaddr = (u_long)sc->active->buf_va;
    332  1.1  nonaka 		fbconf->hf_width = sc->geometry->panel_width;
    333  1.1  nonaka 		fbconf->hf_height = sc->geometry->panel_height;
    334  1.1  nonaka 		fbconf->hf_offset = 0;
    335  1.1  nonaka 		fbconf->hf_bytes_per_line = fbconf->hf_width *
    336  1.1  nonaka 		    sc->active->depth / 8;
    337  1.1  nonaka 		fbconf->hf_nplanes = 1;
    338  1.1  nonaka 		fbconf->hf_bytes_per_plane = fbconf->hf_width *
    339  1.1  nonaka 		    fbconf->hf_height * sc->active->depth / 8;
    340  1.1  nonaka 		fbconf->hf_pack_width = sc->active->depth;
    341  1.1  nonaka 		fbconf->hf_pixels_per_pack = 1;
    342  1.1  nonaka 		fbconf->hf_pixel_width = sc->active->depth;
    343  1.1  nonaka 		fbconf->hf_access_flags = (HPCFB_ACCESS_STATIC
    344  1.1  nonaka 					   | HPCFB_ACCESS_BYTE
    345  1.1  nonaka 					   | HPCFB_ACCESS_WORD
    346  1.1  nonaka 					   | HPCFB_ACCESS_DWORD);
    347  1.1  nonaka 		fbconf->hf_order_flags = 0;
    348  1.1  nonaka 		fbconf->hf_reg_offset = 0;
    349  1.1  nonaka 
    350  1.1  nonaka 		fbconf->hf_class_data_length = sizeof(struct hf_rgb_tag);
    351  1.1  nonaka 		fbconf->hf_u.hf_rgb.hf_flags = 0;
    352  1.1  nonaka 		fbconf->hf_u.hf_rgb.hf_red_width = 5;
    353  1.1  nonaka 		fbconf->hf_u.hf_rgb.hf_red_shift = 11;
    354  1.1  nonaka 		fbconf->hf_u.hf_rgb.hf_green_width = 6;
    355  1.1  nonaka 		fbconf->hf_u.hf_rgb.hf_green_shift = 5;
    356  1.1  nonaka 		fbconf->hf_u.hf_rgb.hf_blue_width = 5;
    357  1.1  nonaka 		fbconf->hf_u.hf_rgb.hf_blue_shift = 0;
    358  1.1  nonaka 		fbconf->hf_u.hf_rgb.hf_alpha_width = 0;
    359  1.1  nonaka 		fbconf->hf_u.hf_rgb.hf_alpha_shift = 0;
    360  1.1  nonaka 
    361  1.1  nonaka 		fbconf->hf_ext_size = 0;
    362  1.1  nonaka 		fbconf->hf_ext_data = NULL;
    363  1.1  nonaka 
    364  1.1  nonaka 		res = 0;
    365  1.1  nonaka 		break;
    366  1.1  nonaka 
    367  1.1  nonaka 	case HPCFBIO_SCONF:
    368  1.1  nonaka 		fbconf = (struct hpcfb_fbconf *)data;
    369  1.1  nonaka 		if (fbconf->hf_conf_index != 0 &&
    370  1.1  nonaka 		    fbconf->hf_conf_index != HPCFB_CURRENT_CONFIG) {
    371  1.1  nonaka 			break;
    372  1.1  nonaka 		}
    373  1.1  nonaka 		/* nothing to do because we have only one configuration */
    374  1.1  nonaka 		res = 0;
    375  1.1  nonaka 		break;
    376  1.1  nonaka 
    377  1.1  nonaka 	case HPCFBIO_GDSPCONF:
    378  1.1  nonaka 		dspconf = (struct hpcfb_dspconf *)data;
    379  1.1  nonaka 		if ((dspconf->hd_unit_index != 0 &&
    380  1.1  nonaka 		     dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
    381  1.1  nonaka 		    (dspconf->hd_conf_index != 0 &&
    382  1.1  nonaka 		     dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
    383  1.1  nonaka 			break;
    384  1.1  nonaka 		}
    385  1.1  nonaka 
    386  1.1  nonaka 		dspconf->hd_unit_index = 0;
    387  1.1  nonaka 		dspconf->hd_nunits = 1;
    388  1.1  nonaka 		dspconf->hd_class = HPCFB_DSP_CLASS_COLORLCD;
    389  1.1  nonaka 		strlcpy(dspconf->hd_name, "PXA2x0 Internal LCD controller",
    390  1.1  nonaka 		    sizeof(dspconf->hd_name));
    391  1.1  nonaka 		dspconf->hd_op_flags = 0;
    392  1.1  nonaka 		dspconf->hd_conf_index = 0;
    393  1.1  nonaka 		dspconf->hd_nconfs = 1;
    394  1.1  nonaka 		strlcpy(dspconf->hd_conf_name, "LCD",
    395  1.1  nonaka 		    sizeof(dspconf->hd_conf_name));
    396  1.1  nonaka 		dspconf->hd_width = sc->geometry->panel_width;
    397  1.1  nonaka 		dspconf->hd_height = sc->geometry->panel_height;
    398  1.1  nonaka 		dspconf->hd_xdpi = HPCFB_DSP_DPI_UNKNOWN;
    399  1.1  nonaka 		dspconf->hd_ydpi = HPCFB_DSP_DPI_UNKNOWN;
    400  1.1  nonaka 
    401  1.1  nonaka 		res = 0;
    402  1.1  nonaka 		break;
    403  1.1  nonaka 
    404  1.1  nonaka 	case HPCFBIO_SDSPCONF:
    405  1.1  nonaka 		dspconf = (struct hpcfb_dspconf *)data;
    406  1.1  nonaka 		if ((dspconf->hd_unit_index != 0 &&
    407  1.1  nonaka 		     dspconf->hd_unit_index != HPCFB_CURRENT_UNIT) ||
    408  1.1  nonaka 		    (dspconf->hd_conf_index != 0 &&
    409  1.1  nonaka 		     dspconf->hd_conf_index != HPCFB_CURRENT_CONFIG)) {
    410  1.1  nonaka 			break;
    411  1.1  nonaka 		}
    412  1.1  nonaka 		/*
    413  1.1  nonaka 		 * nothing to do
    414  1.1  nonaka 		 * because we have only one unit and one configuration
    415  1.1  nonaka 		 */
    416  1.1  nonaka 		res = 0;
    417  1.1  nonaka 		break;
    418  1.1  nonaka 
    419  1.1  nonaka 	case HPCFBIO_GOP:
    420  1.1  nonaka 	case HPCFBIO_SOP:
    421  1.1  nonaka 		/* curently not implemented...  */
    422  1.1  nonaka 		break;
    423  1.1  nonaka 	}
    424  1.1  nonaka 
    425  1.1  nonaka 	if (res == EINVAL)
    426  1.1  nonaka 		res = pxa2x0_lcd_ioctl(v, vs, cmd, data, flag, l);
    427  1.1  nonaka 	return res;
    428  1.1  nonaka }
    429  1.1  nonaka 
    430  1.1  nonaka static int
    431  1.1  nonaka wzero3lcd_show_screen(void *v, void *cookie, int waitok, void (*cb_func)(void *, int, int), void *cb_arg)
    432  1.1  nonaka {
    433  1.1  nonaka 	int error;
    434  1.1  nonaka 
    435  1.1  nonaka 	error = pxa2x0_lcd_show_screen(v, cookie, waitok, cb_func, cb_arg);
    436  1.1  nonaka 	if (error)
    437  1.1  nonaka 		return (error);
    438  1.1  nonaka 
    439  1.1  nonaka 	return 0;
    440  1.1  nonaka }
    441  1.1  nonaka 
    442  1.1  nonaka /*
    443  1.1  nonaka  * wsdisplay I/O controls
    444  1.1  nonaka  */
    445  1.1  nonaka static int
    446  1.1  nonaka wzero3lcd_param(struct pxa2x0_lcd_softc *sc, u_long cmd, struct wsdisplay_param *dp)
    447  1.1  nonaka {
    448  1.1  nonaka 	int res = EINVAL;
    449  1.1  nonaka 
    450  1.1  nonaka 	switch (dp->param) {
    451  1.1  nonaka 	case WSDISPLAYIO_PARAM_BACKLIGHT:
    452  1.1  nonaka 		/* unsupported */
    453  1.1  nonaka 		DPRINTF(("%s: ioctl(WSDISPLAYIO_PARAM_BACKLIGHT) isn't supported\n", device_xname(&sc->dev)));
    454  1.1  nonaka 		res = ENOTTY;
    455  1.1  nonaka 		break;
    456  1.1  nonaka 
    457  1.1  nonaka 	case WSDISPLAYIO_PARAM_CONTRAST:
    458  1.1  nonaka 		DPRINTF(("%s: ioctl(WSDISPLAYIO_PARAM_CONTRAST) isn't supported\n", device_xname(&sc->dev)));
    459  1.1  nonaka 		/* unsupported */
    460  1.1  nonaka 		res = ENOTTY;
    461  1.1  nonaka 		break;
    462  1.1  nonaka 
    463  1.1  nonaka 	case WSDISPLAYIO_PARAM_BRIGHTNESS:
    464  1.1  nonaka 		DPRINTF(("%s: ioctl(WSDISPLAYIO_PARAM_BRIGHTNESS) isn't supported\n", device_xname(&sc->dev)));
    465  1.1  nonaka 		/* unsupported */
    466  1.1  nonaka 		res = ENOTTY;
    467  1.1  nonaka 	}
    468  1.1  nonaka 
    469  1.1  nonaka 	return res;
    470  1.1  nonaka }
    471