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