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