- device_t/softc split. - use aprint_* function.diff -r1.26 -r1.27 src/sys/arch/arm/xscale/pxa2x0_lcd.c
(nonaka)
--- src/sys/arch/arm/xscale/pxa2x0_lcd.c 2007/10/17 19:53:44 1.26
+++ src/sys/arch/arm/xscale/pxa2x0_lcd.c 2009/01/29 12:28:15 1.27
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pxa2x0_lcd.c,v 1.26 2007/10/17 19:53:44 garbled Exp $ */ | 1 | /* $NetBSD: pxa2x0_lcd.c,v 1.27 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2002 Genetec Corporation. All rights reserved. | 4 | * Copyright (c) 2002 Genetec Corporation. All rights reserved. | |
5 | * Written by Hiroyuki Bessho for Genetec Corporation. | 5 | * Written by Hiroyuki Bessho for Genetec Corporation. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -28,27 +28,27 @@ | @@ -28,27 +28,27 @@ | |||
28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | 28 | * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF | |
29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | 29 | * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS | |
30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | 30 | * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN | |
31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | 31 | * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) | |
32 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | 32 | * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE | |
33 | * POSSIBILITY OF SUCH DAMAGE. | 33 | * POSSIBILITY OF SUCH DAMAGE. | |
34 | */ | 34 | */ | |
35 | 35 | |||
36 | /* | 36 | /* | |
37 | * Support PXA2[15]0's integrated LCD controller. | 37 | * Support PXA2[15]0's integrated LCD controller. | |
38 | */ | 38 | */ | |
39 | 39 | |||
40 | #include <sys/cdefs.h> | 40 | #include <sys/cdefs.h> | |
41 | __KERNEL_RCSID(0, "$NetBSD: pxa2x0_lcd.c,v 1.26 2007/10/17 19:53:44 garbled Exp $"); | 41 | __KERNEL_RCSID(0, "$NetBSD: pxa2x0_lcd.c,v 1.27 2009/01/29 12:28:15 nonaka Exp $"); | |
42 | 42 | |||
43 | #include <sys/param.h> | 43 | #include <sys/param.h> | |
44 | #include <sys/systm.h> | 44 | #include <sys/systm.h> | |
45 | #include <sys/conf.h> | 45 | #include <sys/conf.h> | |
46 | #include <sys/uio.h> | 46 | #include <sys/uio.h> | |
47 | #include <sys/malloc.h> | 47 | #include <sys/malloc.h> | |
48 | #include <sys/kernel.h> /* for cold */ | 48 | #include <sys/kernel.h> /* for cold */ | |
49 | 49 | |||
50 | #include <uvm/uvm_extern.h> | 50 | #include <uvm/uvm_extern.h> | |
51 | 51 | |||
52 | #include <dev/cons.h> | 52 | #include <dev/cons.h> | |
53 | #include <dev/wscons/wsconsio.h> | 53 | #include <dev/wscons/wsconsio.h> | |
54 | #include <dev/wscons/wsdisplayvar.h> | 54 | #include <dev/wscons/wsdisplayvar.h> | |
@@ -127,26 +127,28 @@ pxa2x0_lcd_geometry(struct pxa2x0_lcd_so | @@ -127,26 +127,28 @@ pxa2x0_lcd_geometry(struct pxa2x0_lcd_so | |||
127 | | (info->vsync_pulse_width<<10) | 127 | | (info->vsync_pulse_width<<10) | |
128 | | (info->end_frame_wait<<16) | 128 | | (info->end_frame_wait<<16) | |
129 | | (info->beg_frame_wait<<24)); | 129 | | (info->beg_frame_wait<<24)); | |
130 | 130 | |||
131 | bus_space_write_4(iot, ioh, LCDC_LCCR3, | 131 | bus_space_write_4(iot, ioh, LCDC_LCCR3, | |
132 | (info->pixel_clock_div<<0) | 132 | (info->pixel_clock_div<<0) | |
133 | | (info->ac_bias << 8) | 133 | | (info->ac_bias << 8) | |
134 | | ((info->panel_info & | 134 | | ((info->panel_info & | |
135 | (LCDPANEL_VSP|LCDPANEL_HSP|LCDPANEL_PCP|LCDPANEL_OEP)) | 135 | (LCDPANEL_VSP|LCDPANEL_HSP|LCDPANEL_PCP|LCDPANEL_OEP)) | |
136 | <<20) | 136 | <<20) | |
137 | | (4 << 24) /* 16bpp */ | 137 | | (4 << 24) /* 16bpp */ | |
138 | | ((info->panel_info & LCDPANEL_DPC) ? (1<<27) : 0) | 138 | | ((info->panel_info & LCDPANEL_DPC) ? (1<<27) : 0) | |
139 | ); | 139 | ); | |
140 | ||||
141 | bus_space_write_4(iot, ioh, LCDC_LCCR4, (info->pcd_div << 31)); | |||
140 | } | 142 | } | |
141 | 143 | |||
142 | /* | 144 | /* | |
143 | * Initialize the LCD controller. | 145 | * Initialize the LCD controller. | |
144 | */ | 146 | */ | |
145 | void | 147 | void | |
146 | pxa2x0_lcd_initialize(struct pxa2x0_lcd_softc *sc, | 148 | pxa2x0_lcd_initialize(struct pxa2x0_lcd_softc *sc, | |
147 | const struct lcd_panel_geometry *geom) | 149 | const struct lcd_panel_geometry *geom) | |
148 | { | 150 | { | |
149 | bus_space_tag_t iot; | 151 | bus_space_tag_t iot; | |
150 | bus_space_handle_t ioh; | 152 | bus_space_handle_t ioh; | |
151 | uint32_t lccr0, lscr; | 153 | uint32_t lccr0, lscr; | |
152 | int nldd; | 154 | int nldd; | |
@@ -175,27 +177,28 @@ pxa2x0_lcd_initialize(struct pxa2x0_lcd_ | @@ -175,27 +177,28 @@ pxa2x0_lcd_initialize(struct pxa2x0_lcd_ | |||
175 | 177 | |||
176 | lccr0 = LCCR0_IMASK; | 178 | lccr0 = LCCR0_IMASK; | |
177 | if (CPU_IS_PXA270) | 179 | if (CPU_IS_PXA270) | |
178 | lccr0 |= LCCR0_CMDIM|LCCR0_RDSTM; | 180 | lccr0 |= LCCR0_CMDIM|LCCR0_RDSTM; | |
179 | bus_space_write_4(iot, ioh, LCDC_LCCR0, lccr0); | 181 | bus_space_write_4(iot, ioh, LCDC_LCCR0, lccr0); | |
180 | 182 | |||
181 | /* | 183 | /* | |
182 | * setup GP[77:58] for LCD | 184 | * setup GP[77:58] for LCD | |
183 | */ | 185 | */ | |
184 | /* Always use [FLP]CLK, ACBIAS */ | 186 | /* Always use [FLP]CLK, ACBIAS */ | |
185 | pxa2x0_gpio_set_function(74, GPIO_ALT_FN_2_OUT); | 187 | pxa2x0_gpio_set_function(74, GPIO_ALT_FN_2_OUT); | |
186 | pxa2x0_gpio_set_function(75, GPIO_ALT_FN_2_OUT); | 188 | pxa2x0_gpio_set_function(75, GPIO_ALT_FN_2_OUT); | |
187 | pxa2x0_gpio_set_function(76, GPIO_ALT_FN_2_OUT); | 189 | pxa2x0_gpio_set_function(76, GPIO_ALT_FN_2_OUT); | |
188 | pxa2x0_gpio_set_function(77, GPIO_ALT_FN_2_OUT); | 190 | if (!ISSET(sc->flags, FLAG_NOUSE_ACBIAS)) | |
191 | pxa2x0_gpio_set_function(77, GPIO_ALT_FN_2_OUT); | |||
189 | 192 | |||
190 | if ((geom->panel_info & LCDPANEL_ACTIVE) || | 193 | if ((geom->panel_info & LCDPANEL_ACTIVE) || | |
191 | ((geom->panel_info & (LCDPANEL_MONOCHROME|LCDPANEL_DUAL)) == | 194 | ((geom->panel_info & (LCDPANEL_MONOCHROME|LCDPANEL_DUAL)) == | |
192 | LCDPANEL_DUAL)) { | 195 | LCDPANEL_DUAL)) { | |
193 | /* active and color dual panel need L_DD[15:0] */ | 196 | /* active and color dual panel need L_DD[15:0] */ | |
194 | nldd = 16; | 197 | nldd = 16; | |
195 | } else if ((geom->panel_info & LCDPANEL_DUAL) || | 198 | } else if ((geom->panel_info & LCDPANEL_DUAL) || | |
196 | !(geom->panel_info & LCDPANEL_MONOCHROME)) { | 199 | !(geom->panel_info & LCDPANEL_MONOCHROME)) { | |
197 | /* dual or color need L_DD[7:0] */ | 200 | /* dual or color need L_DD[7:0] */ | |
198 | nldd = 8; | 201 | nldd = 8; | |
199 | } else { | 202 | } else { | |
200 | /* Otherwise just L_DD[3:0] */ | 203 | /* Otherwise just L_DD[3:0] */ | |
201 | nldd = 4; | 204 | nldd = 4; | |
@@ -208,80 +211,82 @@ pxa2x0_lcd_initialize(struct pxa2x0_lcd_ | @@ -208,80 +211,82 @@ pxa2x0_lcd_initialize(struct pxa2x0_lcd_ | |||
208 | } | 211 | } | |
209 | 212 | |||
210 | /* | 213 | /* | |
211 | * Common driver attachment code. | 214 | * Common driver attachment code. | |
212 | */ | 215 | */ | |
213 | void | 216 | void | |
214 | pxa2x0_lcd_attach_sub(struct pxa2x0_lcd_softc *sc, | 217 | pxa2x0_lcd_attach_sub(struct pxa2x0_lcd_softc *sc, | |
215 | struct pxaip_attach_args *pxa, const struct lcd_panel_geometry *geom) | 218 | struct pxaip_attach_args *pxa, const struct lcd_panel_geometry *geom) | |
216 | { | 219 | { | |
217 | bus_space_tag_t iot = pxa->pxa_iot; | 220 | bus_space_tag_t iot = pxa->pxa_iot; | |
218 | bus_space_handle_t ioh; | 221 | bus_space_handle_t ioh; | |
219 | int error; | 222 | int error; | |
220 | 223 | |||
224 | aprint_normal(": PXA2x0 LCD controller\n"); | |||
225 | aprint_naive("\n"); | |||
226 | ||||
221 | sc->n_screens = 0; | 227 | sc->n_screens = 0; | |
222 | LIST_INIT(&sc->screens); | 228 | LIST_INIT(&sc->screens); | |
223 | 229 | |||
224 | /* map controller registers */ | 230 | /* map controller registers */ | |
225 | error = bus_space_map(iot, PXA2X0_LCDC_BASE, | 231 | error = bus_space_map(iot, PXA2X0_LCDC_BASE, PXA2X0_LCDC_SIZE, 0, &ioh); | |
226 | PXA2X0_LCDC_SIZE, 0, &ioh); | |||
227 | if (error) { | 232 | if (error) { | |
228 | printf(": failed to map registers (errno=%d)\n", error); | 233 | aprint_error_dev(sc->dev, | |
234 | "failed to map registers (errno=%d)\n", error); | |||
229 | return; | 235 | return; | |
230 | } | 236 | } | |
231 | 237 | |||
232 | sc->iot = iot; | 238 | sc->iot = iot; | |
233 | sc->ioh = ioh; | 239 | sc->ioh = ioh; | |
234 | sc->dma_tag = &pxa2x0_bus_dma_tag; | 240 | sc->dma_tag = &pxa2x0_bus_dma_tag; | |
235 | 241 | |||
236 | sc->ih = pxa2x0_intr_establish(PXA2X0_INT_LCD, IPL_BIO, lcdintr, sc); | 242 | sc->ih = pxa2x0_intr_establish(PXA2X0_INT_LCD, IPL_BIO, lcdintr, sc); | |
237 | if (sc->ih == NULL) { | 243 | if (sc->ih == NULL) { | |
238 | printf(": unable to establish interrupt at irq %d\n", | 244 | aprint_error_dev(sc->dev, | |
245 | "unable to establish interrupt at irq %d\n", | |||
239 | PXA2X0_INT_LCD); | 246 | PXA2X0_INT_LCD); | |
240 | return; | 247 | return; | |
241 | } | 248 | } | |
242 | 249 | |||
243 | printf(": PXA2x0 LCD controller\n"); | |||
244 | ||||
245 | pxa2x0_lcd_initialize(sc, geom); | 250 | pxa2x0_lcd_initialize(sc, geom); | |
246 | 251 | |||
247 | if (pxa2x0_lcd_console.is_console) { | 252 | if (pxa2x0_lcd_console.is_console) { | |
248 | struct pxa2x0_wsscreen_descr *descr = pxa2x0_lcd_console.descr; | 253 | struct pxa2x0_wsscreen_descr *descr = pxa2x0_lcd_console.descr; | |
249 | struct pxa2x0_lcd_screen *scr; | 254 | struct pxa2x0_lcd_screen *scr; | |
250 | struct rasops_info *ri; | 255 | struct rasops_info *ri; | |
251 | long defattr; | 256 | long defattr; | |
252 | 257 | |||
253 | error = pxa2x0_lcd_new_screen(sc, descr->depth, &scr); | 258 | error = pxa2x0_lcd_new_screen(sc, descr->depth, &scr); | |
254 | if (error) { | 259 | if (error) { | |
255 | printf("%s: unable to create new screen (errno=%d)", | 260 | aprint_error_dev(sc->dev, | |
256 | sc->dev.dv_xname, error); | 261 | "unable to create new screen (errno=%d)", error); | |
257 | return; | 262 | return; | |
258 | } | 263 | } | |
259 | 264 | |||
260 | ri = &scr->rinfo; | 265 | ri = &scr->rinfo; | |
261 | ri->ri_hw = (void *)scr; | 266 | ri->ri_hw = (void *)scr; | |
262 | ri->ri_bits = scr->buf_va; | 267 | ri->ri_bits = scr->buf_va; | |
263 | pxa2x0_lcd_setup_rasops(sc, ri, descr, geom); | 268 | pxa2x0_lcd_setup_rasops(sc, ri, descr, geom); | |
264 | 269 | |||
265 | /* assumes 16 bpp */ | 270 | /* assumes 16 bpp */ | |
266 | (*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr); | 271 | (*ri->ri_ops.allocattr)(ri, 0, 0, 0, &defattr); | |
267 | 272 | |||
268 | pxa2x0_lcd_start_dma(sc, scr); | 273 | pxa2x0_lcd_start_dma(sc, scr); | |
269 | sc->active = scr; | 274 | sc->active = scr; | |
270 | 275 | |||
271 | wsdisplay_cnattach(&descr->c, ri, ri->ri_ccol, ri->ri_crow, | 276 | wsdisplay_cnattach(&descr->c, ri, ri->ri_ccol, ri->ri_crow, | |
272 | defattr); | 277 | defattr); | |
273 | 278 | |||
274 | printf("%s: console\n", sc->dev.dv_xname); | 279 | aprint_normal_dev(sc->dev, "console\n"); | |
275 | } | 280 | } | |
276 | } | 281 | } | |
277 | 282 | |||
278 | int | 283 | int | |
279 | pxa2x0_lcd_cnattach(struct pxa2x0_wsscreen_descr *descr, | 284 | pxa2x0_lcd_cnattach(struct pxa2x0_wsscreen_descr *descr, | |
280 | const struct lcd_panel_geometry *geom) | 285 | const struct lcd_panel_geometry *geom) | |
281 | { | 286 | { | |
282 | 287 | |||
283 | pxa2x0_lcd_console.descr = descr; | 288 | pxa2x0_lcd_console.descr = descr; | |
284 | pxa2x0_lcd_console.geom = geom; | 289 | pxa2x0_lcd_console.geom = geom; | |
285 | pxa2x0_lcd_console.is_console = 1; | 290 | pxa2x0_lcd_console.is_console = 1; | |
286 | 291 | |||
287 | return 0; | 292 | return 0; | |
@@ -481,32 +486,30 @@ pxa2x0_lcd_new_screen(struct pxa2x0_lcd_ | @@ -481,32 +486,30 @@ pxa2x0_lcd_new_screen(struct pxa2x0_lcd_ | |||
481 | case 4: | 486 | case 4: | |
482 | case 8: | 487 | case 8: | |
483 | palette_size = (1<<depth) * sizeof (uint16_t); | 488 | palette_size = (1<<depth) * sizeof (uint16_t); | |
484 | /* FALLTHROUGH */ | 489 | /* FALLTHROUGH */ | |
485 | case 16: | 490 | case 16: | |
486 | size = roundup(width,4) * 2 * height; | 491 | size = roundup(width,4) * 2 * height; | |
487 | break; | 492 | break; | |
488 | case 18: | 493 | case 18: | |
489 | case 24: | 494 | case 24: | |
490 | size = roundup(width,4) * 4 * height; | 495 | size = roundup(width,4) * 4 * height; | |
491 | break; | 496 | break; | |
492 | case 19: | 497 | case 19: | |
493 | case 25: | 498 | case 25: | |
494 | printf("%s: Not supported depth (%d)\n", | 499 | aprint_error_dev(sc->dev, "Not supported depth (%d)\n", depth); | |
495 | sc->dev.dv_xname, depth); | |||
496 | return EINVAL; | 500 | return EINVAL; | |
497 | default: | 501 | default: | |
498 | printf("%s: Unknown depth (%d)\n", | 502 | aprint_error_dev(sc->dev, "Unknown depth (%d)\n", depth); | |
499 | sc->dev.dv_xname, depth); | |||
500 | return EINVAL; | 503 | return EINVAL; | |
501 | } | 504 | } | |
502 | 505 | |||
503 | scr = malloc(sizeof(*scr), M_DEVBUF, M_NOWAIT); | 506 | scr = malloc(sizeof(*scr), M_DEVBUF, M_NOWAIT); | |
504 | if (scr == NULL) | 507 | if (scr == NULL) | |
505 | return ENOMEM; | 508 | return ENOMEM; | |
506 | 509 | |||
507 | memset(scr, 0, sizeof(*scr)); | 510 | memset(scr, 0, sizeof(*scr)); | |
508 | 511 | |||
509 | scr->nsegs = 0; | 512 | scr->nsegs = 0; | |
510 | scr->depth = depth; | 513 | scr->depth = depth; | |
511 | scr->buf_size = size; | 514 | scr->buf_size = size; | |
512 | scr->buf_va = NULL; | 515 | scr->buf_va = NULL; |
--- src/sys/arch/arm/xscale/pxa2x0_lcd.h 2007/03/04 05:59:39 1.8
+++ src/sys/arch/arm/xscale/pxa2x0_lcd.h 2009/01/29 12:28:15 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pxa2x0_lcd.h,v 1.8 2007/03/04 05:59:39 christos Exp $ */ | 1 | /* $NetBSD: pxa2x0_lcd.h,v 1.9 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (c) 2002 Genetec Corporation. All rights reserved. | 3 | * Copyright (c) 2002 Genetec Corporation. All rights reserved. | |
4 | * Written by Hiroyuki Bessho for Genetec Corporation. | 4 | * Written by Hiroyuki Bessho for Genetec Corporation. | |
5 | * | 5 | * | |
6 | * Redistribution and use in source and binary forms, with or without | 6 | * Redistribution and use in source and binary forms, with or without | |
7 | * modification, are permitted provided that the following conditions | 7 | * modification, are permitted provided that the following conditions | |
8 | * are met: | 8 | * are met: | |
9 | * 1. Redistributions of source code must retain the above copyright | 9 | * 1. Redistributions of source code must retain the above copyright | |
10 | * notice, this list of conditions and the following disclaimer. | 10 | * notice, this list of conditions and the following disclaimer. | |
11 | * 2. Redistributions in binary form must reproduce the above copyright | 11 | * 2. Redistributions in binary form must reproduce the above copyright | |
12 | * notice, this list of conditions and the following disclaimer in the | 12 | * notice, this list of conditions and the following disclaimer in the | |
13 | * documentation and/or other materials provided with the distribution. | 13 | * documentation and/or other materials provided with the distribution. | |
14 | * 3. All advertising materials mentioning features or use of this software | 14 | * 3. All advertising materials mentioning features or use of this software | |
@@ -63,31 +63,34 @@ struct pxa2x0_lcd_screen { | @@ -63,31 +63,34 @@ struct pxa2x0_lcd_screen { | |||
63 | size_t map_size; | 63 | size_t map_size; | |
64 | void *buf_va; | 64 | void *buf_va; | |
65 | int depth; | 65 | int depth; | |
66 | 66 | |||
67 | /* DMA frame descriptor */ | 67 | /* DMA frame descriptor */ | |
68 | struct lcd_dma_descriptor *dma_desc; | 68 | struct lcd_dma_descriptor *dma_desc; | |
69 | paddr_t dma_desc_pa; | 69 | paddr_t dma_desc_pa; | |
70 | 70 | |||
71 | /* rasterop */ | 71 | /* rasterop */ | |
72 | struct rasops_info rinfo; | 72 | struct rasops_info rinfo; | |
73 | }; | 73 | }; | |
74 | 74 | |||
75 | struct pxa2x0_lcd_softc { | 75 | struct pxa2x0_lcd_softc { | |
76 | struct device dev; | 76 | device_t dev; | |
77 | /* control register */ | 77 | /* control register */ | |
78 | bus_space_tag_t iot; | 78 | bus_space_tag_t iot; | |
79 | bus_space_handle_t ioh; | 79 | bus_space_handle_t ioh; | |
80 | bus_dma_tag_t dma_tag; | 80 | bus_dma_tag_t dma_tag; | |
81 | ||||
82 | uint32_t flags; | |||
83 | #define FLAG_NOUSE_ACBIAS (1U<<0) | |||
81 | 84 | |||
82 | const struct lcd_panel_geometry *geometry; | 85 | const struct lcd_panel_geometry *geometry; | |
83 | 86 | |||
84 | int n_screens; | 87 | int n_screens; | |
85 | LIST_HEAD(, pxa2x0_lcd_screen) screens; | 88 | LIST_HEAD(, pxa2x0_lcd_screen) screens; | |
86 | struct pxa2x0_lcd_screen *active; | 89 | struct pxa2x0_lcd_screen *active; | |
87 | void *ih; /* interrupt handler */ | 90 | void *ih; /* interrupt handler */ | |
88 | }; | 91 | }; | |
89 | 92 | |||
90 | struct lcd_panel_geometry { | 93 | struct lcd_panel_geometry { | |
91 | short panel_width; | 94 | short panel_width; | |
92 | short panel_height; | 95 | short panel_height; | |
93 | short extra_lines; | 96 | short extra_lines; | |
@@ -105,26 +108,28 @@ struct lcd_panel_geometry { | @@ -105,26 +108,28 @@ struct lcd_panel_geometry { | |||
105 | #define LCDPANEL_PASSIVE 0 | 108 | #define LCDPANEL_PASSIVE 0 | |
106 | #define LCDPANEL_MONOCHROME (1<<7) /* depth=1 */ | 109 | #define LCDPANEL_MONOCHROME (1<<7) /* depth=1 */ | |
107 | 110 | |||
108 | short pixel_clock_div; /* pixel clock divider */ | 111 | short pixel_clock_div; /* pixel clock divider */ | |
109 | short ac_bias; /* AC bias pin frequency */ | 112 | short ac_bias; /* AC bias pin frequency */ | |
110 | 113 | |||
111 | short hsync_pulse_width; /* Horizontao sync pulse width */ | 114 | short hsync_pulse_width; /* Horizontao sync pulse width */ | |
112 | short beg_line_wait; /* beginning of line wait (BLW) */ | 115 | short beg_line_wait; /* beginning of line wait (BLW) */ | |
113 | short end_line_wait; /* end of line pxel wait (ELW) */ | 116 | short end_line_wait; /* end of line pxel wait (ELW) */ | |
114 | 117 | |||
115 | short vsync_pulse_width; /* vertical sync pulse width */ | 118 | short vsync_pulse_width; /* vertical sync pulse width */ | |
116 | short beg_frame_wait; /* beginning of frame wait (BFW) */ | 119 | short beg_frame_wait; /* beginning of frame wait (BFW) */ | |
117 | short end_frame_wait; /* end of frame wait (EFW) */ | 120 | short end_frame_wait; /* end of frame wait (EFW) */ | |
121 | ||||
122 | short pcd_div; /* PCD divisor selection */ | |||
118 | }; | 123 | }; | |
119 | 124 | |||
120 | /* | 125 | /* | |
121 | * we need bits-per-pixel value to configure wsdisplay screen | 126 | * we need bits-per-pixel value to configure wsdisplay screen | |
122 | */ | 127 | */ | |
123 | struct pxa2x0_wsscreen_descr { | 128 | struct pxa2x0_wsscreen_descr { | |
124 | struct wsscreen_descr c; /* standard descriptor */ | 129 | struct wsscreen_descr c; /* standard descriptor */ | |
125 | int depth; /* bits per pixel */ | 130 | int depth; /* bits per pixel */ | |
126 | int flags; /* rasops flags */ | 131 | int flags; /* rasops flags */ | |
127 | }; | 132 | }; | |
128 | 133 | |||
129 | void pxa2x0_lcd_attach_sub(struct pxa2x0_lcd_softc *, | 134 | void pxa2x0_lcd_attach_sub(struct pxa2x0_lcd_softc *, | |
130 | struct pxaip_attach_args *, const struct lcd_panel_geometry *); | 135 | struct pxaip_attach_args *, const struct lcd_panel_geometry *); |
--- src/sys/arch/arm/xscale/pxa2x0_pcic.c 2007/10/17 19:53:44 1.4
+++ src/sys/arch/arm/xscale/pxa2x0_pcic.c 2009/01/29 12:28:15 1.5
@@ -1,34 +1,34 @@ | @@ -1,34 +1,34 @@ | |||
1 | /* $NetBSD: pxa2x0_pcic.c,v 1.4 2007/10/17 19:53:44 garbled Exp $ */ | 1 | /* $NetBSD: pxa2x0_pcic.c,v 1.5 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: pxa2x0_pcic.c,v 1.17 2005/12/14 15:08:51 uwe Exp $ */ | 2 | /* $OpenBSD: pxa2x0_pcic.c,v 1.17 2005/12/14 15:08:51 uwe Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> | 5 | * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | #include <sys/cdefs.h> | 20 | #include <sys/cdefs.h> | |
21 | __KERNEL_RCSID(0, "$NetBSD: pxa2x0_pcic.c,v 1.4 2007/10/17 19:53:44 garbled Exp $"); | 21 | __KERNEL_RCSID(0, "$NetBSD: pxa2x0_pcic.c,v 1.5 2009/01/29 12:28:15 nonaka Exp $"); | |
22 | 22 | |||
23 | #include <sys/param.h> | 23 | #include <sys/param.h> | |
24 | #include <sys/systm.h> | 24 | #include <sys/systm.h> | |
25 | #include <sys/device.h> | 25 | #include <sys/device.h> | |
26 | #include <sys/kernel.h> | 26 | #include <sys/kernel.h> | |
27 | #include <sys/kthread.h> | 27 | #include <sys/kthread.h> | |
28 | #include <sys/malloc.h> | 28 | #include <sys/malloc.h> | |
29 | 29 | |||
30 | #include <uvm/uvm.h> | 30 | #include <uvm/uvm.h> | |
31 | 31 | |||
32 | #include <machine/bus.h> | 32 | #include <machine/bus.h> | |
33 | #include <machine/intr.h> | 33 | #include <machine/intr.h> | |
34 | 34 | |||
@@ -331,33 +331,33 @@ pxapcic_print(void *aux, const char *nam | @@ -331,33 +331,33 @@ pxapcic_print(void *aux, const char *nam | |||
331 | void | 331 | void | |
332 | pxapcic_attach_common(struct pxapcic_softc *sc, | 332 | pxapcic_attach_common(struct pxapcic_softc *sc, | |
333 | void (*socket_setup_hook)(struct pxapcic_socket *)) | 333 | void (*socket_setup_hook)(struct pxapcic_socket *)) | |
334 | { | 334 | { | |
335 | struct pcmciabus_attach_args paa; | 335 | struct pcmciabus_attach_args paa; | |
336 | struct pxapcic_socket *so; | 336 | struct pxapcic_socket *so; | |
337 | int s[PXAPCIC_NSLOT]; | 337 | int s[PXAPCIC_NSLOT]; | |
338 | u_int cs; | 338 | u_int cs; | |
339 | int i; | 339 | int i; | |
340 | 340 | |||
341 | printf(": %d slot%s\n", sc->sc_nslots, sc->sc_nslots < 2 ? "" : "s"); | 341 | printf(": %d slot%s\n", sc->sc_nslots, sc->sc_nslots < 2 ? "" : "s"); | |
342 | 342 | |||
343 | if (sc->sc_nslots == 0) { | 343 | if (sc->sc_nslots == 0) { | |
344 | aprint_error("%s: can't attach\n", sc->sc_dev.dv_xname); | 344 | aprint_error_dev(sc->sc_dev, "can't attach\n"); | |
345 | return; | 345 | return; | |
346 | } | 346 | } | |
347 | 347 | |||
348 | if (bus_space_map(sc->sc_iot, PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, | 348 | if (bus_space_map(sc->sc_iot, PXA2X0_MEMCTL_BASE, PXA2X0_MEMCTL_SIZE, | |
349 | 0, &sc->sc_memctl_ioh)) { | 349 | 0, &sc->sc_memctl_ioh)) { | |
350 | aprint_error("%s: failed to map MEMCTL\n", sc->sc_dev.dv_xname); | 350 | aprint_error_dev(sc->sc_dev, "failed to map MEMCTL\n"); | |
351 | return; | 351 | return; | |
352 | } | 352 | } | |
353 | 353 | |||
354 | /* Clear CIT (card present) and set NOS correctly. */ | 354 | /* Clear CIT (card present) and set NOS correctly. */ | |
355 | bus_space_write_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR, | 355 | bus_space_write_4(sc->sc_iot, sc->sc_memctl_ioh, MEMCTL_MECR, | |
356 | (sc->sc_nslots == 2) ? MECR_NOS : 0); | 356 | (sc->sc_nslots == 2) ? MECR_NOS : 0); | |
357 | 357 | |||
358 | if (sc->sc_flags & PPF_REVERSE_ORDER) { | 358 | if (sc->sc_flags & PPF_REVERSE_ORDER) { | |
359 | for (i = 0; i < sc->sc_nslots; i++) { | 359 | for (i = 0; i < sc->sc_nslots; i++) { | |
360 | s[i] = sc->sc_nslots - 1 - i; | 360 | s[i] = sc->sc_nslots - 1 - i; | |
361 | } | 361 | } | |
362 | } else { | 362 | } else { | |
363 | for (i = 0; i < sc->sc_nslots; i++) { | 363 | for (i = 0; i < sc->sc_nslots; i++) { | |
@@ -369,49 +369,50 @@ pxapcic_attach_common(struct pxapcic_sof | @@ -369,49 +369,50 @@ pxapcic_attach_common(struct pxapcic_sof | |||
369 | so = &sc->sc_socket[s[i]]; | 369 | so = &sc->sc_socket[s[i]]; | |
370 | so->sc = sc; | 370 | so->sc = sc; | |
371 | so->socket = s[i]; | 371 | so->socket = s[i]; | |
372 | so->flags = 0; | 372 | so->flags = 0; | |
373 | 373 | |||
374 | (*socket_setup_hook)(so); | 374 | (*socket_setup_hook)(so); | |
375 | 375 | |||
376 | paa.paa_busname = "pcmcia"; | 376 | paa.paa_busname = "pcmcia"; | |
377 | paa.pct = (pcmcia_chipset_tag_t)&pxapcic_pcmcia_functions; | 377 | paa.pct = (pcmcia_chipset_tag_t)&pxapcic_pcmcia_functions; | |
378 | paa.pch = (pcmcia_chipset_handle_t)so; | 378 | paa.pch = (pcmcia_chipset_handle_t)so; | |
379 | paa.iobase = 0; | 379 | paa.iobase = 0; | |
380 | paa.iosize = 0x4000000; | 380 | paa.iosize = 0x4000000; | |
381 | 381 | |||
382 | so->pcmcia = config_found_ia(&sc->sc_dev, "pcmciabus", &paa, | 382 | so->pcmcia = config_found_ia(sc->sc_dev, "pcmciabus", &paa, | |
383 | pxapcic_print); | 383 | pxapcic_print); | |
384 | 384 | |||
385 | pxa2x0_gpio_set_function(sc->sc_irqpin[s[i]], GPIO_IN); | 385 | pxa2x0_gpio_set_function(sc->sc_irqpin[s[i]], GPIO_IN); | |
386 | pxa2x0_gpio_set_function(sc->sc_irqcfpin[s[i]], GPIO_IN); | 386 | pxa2x0_gpio_set_function(sc->sc_irqcfpin[s[i]], GPIO_IN); | |
387 | 387 | |||
388 | /* Card slot interrupt */ | 388 | /* Card slot interrupt */ | |
389 | so->irq = pxa2x0_gpio_intr_establish(sc->sc_irqcfpin[s[i]], | 389 | so->irq = pxa2x0_gpio_intr_establish(sc->sc_irqcfpin[s[i]], | |
390 | IST_EDGE_BOTH, IPL_BIO /* XXX */, pxapcic_intr, so); | 390 | IST_EDGE_BOTH, IPL_BIO /* XXX */, pxapcic_intr, so); | |
391 | 391 | |||
392 | /* GPIO pin for interrupt */ | 392 | /* GPIO pin for interrupt */ | |
393 | so->irqpin = sc->sc_irqpin[s[i]]; | 393 | so->irqpin = sc->sc_irqpin[s[i]]; | |
394 | 394 | |||
395 | /* If there's a card there, attach it. */ | 395 | /* If there's a card there, attach it. */ | |
396 | cs = (*so->pcictag->read)(so, PXAPCIC_CARD_STATUS); | 396 | cs = (*so->pcictag->read)(so, PXAPCIC_CARD_STATUS); | |
397 | if (cs == PXAPCIC_CARD_VALID) | 397 | if (cs == PXAPCIC_CARD_VALID) | |
398 | pxapcic_attach_card(so); | 398 | pxapcic_attach_card(so); | |
399 | 399 | |||
400 | if (kthread_create(PRI_NONE, 0, NULL, pxapcic_event_thread, | 400 | if (kthread_create(PRI_NONE, 0, NULL, pxapcic_event_thread, | |
401 | so, &so->event_thread, "%s,%d", sc->sc_dev.dv_xname, | 401 | so, &so->event_thread, "%s,%d", device_xname(sc->sc_dev), | |
402 | so->socket)) { | 402 | so->socket)) { | |
403 | printf("%s: unable to create event thread for %d\n", | 403 | aprint_error_dev(sc->sc_dev, | |
404 | sc->sc_dev.dv_xname, so->socket); | 404 | "unable to create event thread for %d\n", | |
405 | so->socket); | |||
405 | } | 406 | } | |
406 | } | 407 | } | |
407 | } | 408 | } | |
408 | 409 | |||
409 | /* | 410 | /* | |
410 | * Card slot interrupt handling | 411 | * Card slot interrupt handling | |
411 | */ | 412 | */ | |
412 | int | 413 | int | |
413 | pxapcic_intr(void *arg) | 414 | pxapcic_intr(void *arg) | |
414 | { | 415 | { | |
415 | struct pxapcic_socket *so = (struct pxapcic_socket *)arg; | 416 | struct pxapcic_socket *so = (struct pxapcic_socket *)arg; | |
416 | 417 | |||
417 | (*so->pcictag->clear_intr)(so); | 418 | (*so->pcictag->clear_intr)(so); |
--- src/sys/arch/arm/xscale/pxa2x0_pcic.h 2007/10/17 19:53:44 1.3
+++ src/sys/arch/arm/xscale/pxa2x0_pcic.h 2009/01/29 12:28:15 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: pxa2x0_pcic.h,v 1.3 2007/10/17 19:53:44 garbled Exp $ */ | 1 | /* $NetBSD: pxa2x0_pcic.h,v 1.4 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: pxapcicvar.h,v 1.7 2005/12/14 15:08:51 uwe Exp $ */ | 2 | /* $OpenBSD: pxapcicvar.h,v 1.7 2005/12/14 15:08:51 uwe Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> | 5 | * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
@@ -58,27 +58,27 @@ struct pxapcic_tag { | @@ -58,27 +58,27 @@ struct pxapcic_tag { | |||
58 | #define PXAPCIC_CARD_STATUS 0 | 58 | #define PXAPCIC_CARD_STATUS 0 | |
59 | #define PXAPCIC_CARD_INVALID 0 | 59 | #define PXAPCIC_CARD_INVALID 0 | |
60 | #define PXAPCIC_CARD_VALID 1 | 60 | #define PXAPCIC_CARD_VALID 1 | |
61 | #define PXAPCIC_CARD_READY 1 | 61 | #define PXAPCIC_CARD_READY 1 | |
62 | #define PXAPCIC_CARD_POWER 2 | 62 | #define PXAPCIC_CARD_POWER 2 | |
63 | #define PXAPCIC_POWER_OFF 0 | 63 | #define PXAPCIC_POWER_OFF 0 | |
64 | #define PXAPCIC_POWER_3V 1 | 64 | #define PXAPCIC_POWER_3V 1 | |
65 | #define PXAPCIC_POWER_5V 2 | 65 | #define PXAPCIC_POWER_5V 2 | |
66 | #define PXAPCIC_CARD_RESET 3 | 66 | #define PXAPCIC_CARD_RESET 3 | |
67 | 67 | |||
68 | #define PXAPCIC_NSLOT 2 | 68 | #define PXAPCIC_NSLOT 2 | |
69 | 69 | |||
70 | struct pxapcic_softc { | 70 | struct pxapcic_softc { | |
71 | struct device sc_dev; | 71 | device_t sc_dev; | |
72 | struct pxapcic_socket sc_socket[PXAPCIC_NSLOT]; | 72 | struct pxapcic_socket sc_socket[PXAPCIC_NSLOT]; | |
73 | 73 | |||
74 | bus_space_tag_t sc_iot; | 74 | bus_space_tag_t sc_iot; | |
75 | bus_space_handle_t sc_memctl_ioh; | 75 | bus_space_handle_t sc_memctl_ioh; | |
76 | 76 | |||
77 | void *sc_irq; | 77 | void *sc_irq; | |
78 | int sc_shutdown; | 78 | int sc_shutdown; | |
79 | int sc_nslots; | 79 | int sc_nslots; | |
80 | int sc_irqpin[PXAPCIC_NSLOT]; | 80 | int sc_irqpin[PXAPCIC_NSLOT]; | |
81 | int sc_irqcfpin[PXAPCIC_NSLOT]; | 81 | int sc_irqcfpin[PXAPCIC_NSLOT]; | |
82 | 82 | |||
83 | u_int sc_flags; | 83 | u_int sc_flags; | |
84 | #define PPF_REVERSE_ORDER (1 << 0) | 84 | #define PPF_REVERSE_ORDER (1 << 0) |
--- src/sys/arch/evbarm/g42xxeb/g42xxeb_lcd.c 2008/06/11 23:24:43 1.11
+++ src/sys/arch/evbarm/g42xxeb/g42xxeb_lcd.c 2009/01/29 12:28:15 1.12
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: g42xxeb_lcd.c,v 1.11 2008/06/11 23:24:43 cegger Exp $ */ | 1 | /* $NetBSD: g42xxeb_lcd.c,v 1.12 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | 2 | |||
3 | /*- | 3 | /*- | |
4 | * Copyright (c) 2001, 2002, 2005 Genetec corp. | 4 | * Copyright (c) 2001, 2002, 2005 Genetec corp. | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * LCD driver for Genetec G4250EB-X002. | 7 | * LCD driver for Genetec G4250EB-X002. | |
8 | * Written by Hiroyuki Bessho for Genetec corp. | 8 | * Written by Hiroyuki Bessho for Genetec corp. | |
9 | * | 9 | * | |
10 | * Redistribution and use in source and binary forms, with or without | 10 | * Redistribution and use in source and binary forms, with or without | |
11 | * modification, are permitted provided that the following conditions | 11 | * modification, are permitted provided that the following conditions | |
12 | * are met: | 12 | * are met: | |
13 | * 1. Redistributions of source code must retain the above copyright | 13 | * 1. Redistributions of source code must retain the above copyright | |
14 | * notice, this list of conditions and the following disclaimer. | 14 | * notice, this list of conditions and the following disclaimer. | |
@@ -46,28 +46,28 @@ | @@ -46,28 +46,28 @@ | |||
46 | 46 | |||
47 | #include <machine/bus.h> | 47 | #include <machine/bus.h> | |
48 | #include <arm/sa11x0/sa11x0_var.h> | 48 | #include <arm/sa11x0/sa11x0_var.h> | |
49 | #include <arm/xscale/pxa2x0var.h> | 49 | #include <arm/xscale/pxa2x0var.h> | |
50 | #include <arm/xscale/pxa2x0reg.h> | 50 | #include <arm/xscale/pxa2x0reg.h> | |
51 | #include <arm/xscale/pxa2x0_lcd.h> | 51 | #include <arm/xscale/pxa2x0_lcd.h> | |
52 | 52 | |||
53 | #include <arch/evbarm/g42xxeb/g42xxeb_reg.h> | 53 | #include <arch/evbarm/g42xxeb/g42xxeb_reg.h> | |
54 | #include <arch/evbarm/g42xxeb/g42xxeb_var.h> | 54 | #include <arch/evbarm/g42xxeb/g42xxeb_var.h> | |
55 | 55 | |||
56 | #include "wsdisplay.h" | 56 | #include "wsdisplay.h" | |
57 | #include "ioconf.h" | 57 | #include "ioconf.h" | |
58 | 58 | |||
59 | int lcd_match( struct device *, struct cfdata *, void *); | 59 | int lcd_match(device_t, cfdata_t, void *); | |
60 | void lcd_attach( struct device *, struct device *, void *); | 60 | void lcd_attach(device_t, device_t, void *); | |
61 | int lcdintr(void *); | 61 | int lcdintr(void *); | |
62 | 62 | |||
63 | #if NWSDISPLAY > 0 | 63 | #if NWSDISPLAY > 0 | |
64 | 64 | |||
65 | /* | 65 | /* | |
66 | * wsdisplay glue | 66 | * wsdisplay glue | |
67 | */ | 67 | */ | |
68 | struct pxa2x0_wsscreen_descr lcd_bpp16_screen = { | 68 | struct pxa2x0_wsscreen_descr lcd_bpp16_screen = { | |
69 | { | 69 | { | |
70 | "bpp16", 0, 0, | 70 | "bpp16", 0, 0, | |
71 | &pxa2x0_lcd_emulops, | 71 | &pxa2x0_lcd_emulops, | |
72 | 0, 0, | 72 | 0, 0, | |
73 | WSSCREEN_WSCOLORS, | 73 | WSSCREEN_WSCOLORS, | |
@@ -122,31 +122,31 @@ const struct wsdisplay_accessops lcd_acc | @@ -122,31 +122,31 @@ const struct wsdisplay_accessops lcd_acc | |||
122 | * Interface to LCD framebuffer without wscons | 122 | * Interface to LCD framebuffer without wscons | |
123 | */ | 123 | */ | |
124 | dev_type_open(lcdopen); | 124 | dev_type_open(lcdopen); | |
125 | dev_type_close(lcdclose); | 125 | dev_type_close(lcdclose); | |
126 | dev_type_ioctl(lcdioctl); | 126 | dev_type_ioctl(lcdioctl); | |
127 | dev_type_mmap(lcdmmap); | 127 | dev_type_mmap(lcdmmap); | |
128 | const struct cdevsw lcd_cdevsw = { | 128 | const struct cdevsw lcd_cdevsw = { | |
129 | lcdopen, lcdclose, noread, nowrite, | 129 | lcdopen, lcdclose, noread, nowrite, | |
130 | lcdioctl, nostop, notty, nopoll, lcdmmap, D_TTY | 130 | lcdioctl, nostop, notty, nopoll, lcdmmap, D_TTY | |
131 | }; | 131 | }; | |
132 | 132 | |||
133 | #endif | 133 | #endif | |
134 | 134 | |||
135 | CFATTACH_DECL(lcd_obio, sizeof (struct pxa2x0_lcd_softc), lcd_match, lcd_attach, | 135 | CFATTACH_DECL_NEW(lcd_obio, sizeof (struct pxa2x0_lcd_softc), | |
136 | NULL, NULL); | 136 | lcd_match, lcd_attach, NULL, NULL); | |
137 | 137 | |||
138 | int | 138 | int | |
139 | lcd_match( struct device *parent, struct cfdata *cf, void *aux ) | 139 | lcd_match( device_t parent, cfdata_t cf, void *aux ) | |
140 | { | 140 | { | |
141 | return 1; | 141 | return 1; | |
142 | } | 142 | } | |
143 | 143 | |||
144 | #ifdef G4250_LCD_NEC_NL3224BC35 | 144 | #ifdef G4250_LCD_NEC_NL3224BC35 | |
145 | /* NEC's QVGA LCD */ | 145 | /* NEC's QVGA LCD */ | |
146 | static const struct lcd_panel_geometry nec_NL3224BC35 = | 146 | static const struct lcd_panel_geometry nec_NL3224BC35 = | |
147 | { | 147 | { | |
148 | 320, /* Width */ | 148 | 320, /* Width */ | |
149 | 240, /* Height */ | 149 | 240, /* Height */ | |
150 | 0, /* No extra lines */ | 150 | 0, /* No extra lines */ | |
151 | 151 | |||
152 | LCDPANEL_SINGLE|LCDPANEL_ACTIVE|LCDPANEL_PCP| | 152 | LCDPANEL_SINGLE|LCDPANEL_ACTIVE|LCDPANEL_PCP| | |
@@ -178,29 +178,31 @@ const struct lcd_panel_geometry toshiba_ | @@ -178,29 +178,31 @@ const struct lcd_panel_geometry toshiba_ | |||
178 | 0xff, /* AC bias pin freq */ | 178 | 0xff, /* AC bias pin freq */ | |
179 | 179 | |||
180 | 4, /* horizontal sync pulse width */ | 180 | 4, /* horizontal sync pulse width */ | |
181 | 8, /* BLW (back porch) */ | 181 | 8, /* BLW (back porch) */ | |
182 | 4, /* ELW (front porch) */ | 182 | 4, /* ELW (front porch) */ | |
183 | 183 | |||
184 | 2, /* vertical sync pulse width */ | 184 | 2, /* vertical sync pulse width */ | |
185 | 2, /* BFW (back porch) */ | 185 | 2, /* BFW (back porch) */ | |
186 | 3, /* EFW (front porch) */ | 186 | 3, /* EFW (front porch) */ | |
187 | 187 | |||
188 | }; | 188 | }; | |
189 | #endif /* G4250_LCD_TOSHIBA_LTM035 */ | 189 | #endif /* G4250_LCD_TOSHIBA_LTM035 */ | |
190 | 190 | |||
191 | void lcd_attach( struct device *parent, struct device *self, void *aux ) | 191 | void lcd_attach( device_t parent, device_t self, void *aux ) | |
192 | { | 192 | { | |
193 | struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)self; | 193 | struct pxa2x0_lcd_softc *sc = device_private(self); | |
194 | ||||
195 | sc->dev = self; | |||
194 | 196 | |||
195 | #ifdef G4250_LCD_TOSHIBA_LTM035 | 197 | #ifdef G4250_LCD_TOSHIBA_LTM035 | |
196 | # define PANEL toshiba_LTM035 | 198 | # define PANEL toshiba_LTM035 | |
197 | #else | 199 | #else | |
198 | # define PANEL nec_NL3224BC35 | 200 | # define PANEL nec_NL3224BC35 | |
199 | #endif | 201 | #endif | |
200 | 202 | |||
201 | pxa2x0_lcd_attach_sub(sc, aux, &PANEL); | 203 | pxa2x0_lcd_attach_sub(sc, aux, &PANEL); | |
202 | 204 | |||
203 | 205 | |||
204 | #if NWSDISPLAY > 0 | 206 | #if NWSDISPLAY > 0 | |
205 | 207 | |||
206 | { | 208 | { |
--- src/sys/arch/evbarm/gumstix/gxpcic.c 2008/05/11 08:23:17 1.8
+++ src/sys/arch/evbarm/gumstix/gxpcic.c 2009/01/29 12:28:15 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: gxpcic.c,v 1.8 2008/05/11 08:23:17 kiyohara Exp $ */ | 1 | /* $NetBSD: gxpcic.c,v 1.9 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* | 2 | /* | |
3 | * Copyright (C) 2005, 2006 WIDE Project and SOUM Corporation. | 3 | * Copyright (C) 2005, 2006 WIDE Project and SOUM Corporation. | |
4 | * All rights reserved. | 4 | * All rights reserved. | |
5 | * | 5 | * | |
6 | * Written by Takashi Kiyohara and Susumu Miki for WIDE Project and SOUM | 6 | * Written by Takashi Kiyohara and Susumu Miki for WIDE Project and SOUM | |
7 | * Corporation. | 7 | * Corporation. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -105,27 +105,27 @@ static void gxpcic_attach(device_t, de | @@ -105,27 +105,27 @@ static void gxpcic_attach(device_t, de | |||
105 | static void gxpcic_pcic_socket_setup(struct pxapcic_socket *); | 105 | static void gxpcic_pcic_socket_setup(struct pxapcic_socket *); | |
106 | 106 | |||
107 | static u_int gxpcic_read(struct pxapcic_socket *, int); | 107 | static u_int gxpcic_read(struct pxapcic_socket *, int); | |
108 | static void gxpcic_write(struct pxapcic_socket *, int, u_int); | 108 | static void gxpcic_write(struct pxapcic_socket *, int, u_int); | |
109 | static void gxpcic_set_power(struct pxapcic_socket *, int); | 109 | static void gxpcic_set_power(struct pxapcic_socket *, int); | |
110 | static void gxpcic_clear_intr(struct pxapcic_socket *); | 110 | static void gxpcic_clear_intr(struct pxapcic_socket *); | |
111 | static void *gxpcic_intr_establish(struct pxapcic_socket *, int, | 111 | static void *gxpcic_intr_establish(struct pxapcic_socket *, int, | |
112 | int (*)(void *), void *); | 112 | int (*)(void *), void *); | |
113 | static void gxpcic_intr_disestablish(struct pxapcic_socket *, void *); | 113 | static void gxpcic_intr_disestablish(struct pxapcic_socket *, void *); | |
114 | __inline void gxpcic_cpld_clk(void); | 114 | __inline void gxpcic_cpld_clk(void); | |
115 | __inline u_char gxpcic_cpld_read_bits(int bits); | 115 | __inline u_char gxpcic_cpld_read_bits(int bits); | |
116 | static int gxpcic_count_slot(struct pxapcic_softc *); | 116 | static int gxpcic_count_slot(struct pxapcic_softc *); | |
117 | 117 | |||
118 | CFATTACH_DECL(pxapcic_gxpcic, sizeof(struct pxapcic_softc), | 118 | CFATTACH_DECL_NEW(pxapcic_gxpcic, sizeof(struct pxapcic_softc), | |
119 | gxpcic_match, gxpcic_attach, NULL, NULL); | 119 | gxpcic_match, gxpcic_attach, NULL, NULL); | |
120 | 120 | |||
121 | static struct pxapcic_tag gxpcic_pcic_functions = { | 121 | static struct pxapcic_tag gxpcic_pcic_functions = { | |
122 | gxpcic_read, | 122 | gxpcic_read, | |
123 | gxpcic_write, | 123 | gxpcic_write, | |
124 | gxpcic_set_power, | 124 | gxpcic_set_power, | |
125 | gxpcic_clear_intr, | 125 | gxpcic_clear_intr, | |
126 | gxpcic_intr_establish, | 126 | gxpcic_intr_establish, | |
127 | gxpcic_intr_disestablish, | 127 | gxpcic_intr_disestablish, | |
128 | }; | 128 | }; | |
129 | 129 | |||
130 | static struct { | 130 | static struct { | |
131 | int cd; | 131 | int cd; | |
@@ -156,26 +156,27 @@ gxpcic_match(device_t parent, struct cfd | @@ -156,26 +156,27 @@ gxpcic_match(device_t parent, struct cfd | |||
156 | return (0); | 156 | return (0); | |
157 | } | 157 | } | |
158 | 158 | |||
159 | return 1; /* match */ | 159 | return 1; /* match */ | |
160 | } | 160 | } | |
161 | 161 | |||
162 | static void | 162 | static void | |
163 | gxpcic_attach(device_t parent, device_t self, void *aux) | 163 | gxpcic_attach(device_t parent, device_t self, void *aux) | |
164 | { | 164 | { | |
165 | struct pxapcic_softc *sc = device_private(self); | 165 | struct pxapcic_softc *sc = device_private(self); | |
166 | struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux; | 166 | struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux; | |
167 | int nslot, i; | 167 | int nslot, i; | |
168 | 168 | |||
169 | sc->sc_dev = self; | |||
169 | sc->sc_iot = pxa->pxa_iot; | 170 | sc->sc_iot = pxa->pxa_iot; | |
170 | 171 | |||
171 | nslot = gxpcic_count_slot(sc); | 172 | nslot = gxpcic_count_slot(sc); | |
172 | 173 | |||
173 | for (i = 0; i < nslot; i++) { | 174 | for (i = 0; i < nslot; i++) { | |
174 | sc->sc_irqpin[i] = gxpcic_slot_irqs[i].prdy; | 175 | sc->sc_irqpin[i] = gxpcic_slot_irqs[i].prdy; | |
175 | sc->sc_irqcfpin[i] = gxpcic_slot_irqs[i].cd; | 176 | sc->sc_irqcfpin[i] = gxpcic_slot_irqs[i].cd; | |
176 | } | 177 | } | |
177 | sc->sc_nslots = nslot; | 178 | sc->sc_nslots = nslot; | |
178 | 179 | |||
179 | pxapcic_attach_common(sc, &gxpcic_pcic_socket_setup); | 180 | pxapcic_attach_common(sc, &gxpcic_pcic_socket_setup); | |
180 | } | 181 | } | |
181 | 182 |
--- src/sys/arch/evbarm/lubbock/lubbock_lcd.c 2008/06/11 23:24:43 1.8
+++ src/sys/arch/evbarm/lubbock/lubbock_lcd.c 2009/01/29 12:28:15 1.9
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: lubbock_lcd.c,v 1.8 2008/06/11 23:24:43 cegger Exp $ */ | 1 | /* $NetBSD: lubbock_lcd.c,v 1.9 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. | 4 | * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. | |
5 | * Written by Hiroyuki Bessho for Genetec Corporation. | 5 | * Written by Hiroyuki Bessho for Genetec Corporation. | |
6 | * | 6 | * | |
7 | * Redistribution and use in source and binary forms, with or without | 7 | * Redistribution and use in source and binary forms, with or without | |
8 | * modification, are permitted provided that the following conditions | 8 | * modification, are permitted provided that the following conditions | |
9 | * are met: | 9 | * are met: | |
10 | * 1. Redistributions of source code must retain the above copyright | 10 | * 1. Redistributions of source code must retain the above copyright | |
11 | * notice, this list of conditions and the following disclaimer. | 11 | * notice, this list of conditions and the following disclaimer. | |
12 | * 2. Redistributions in binary form must reproduce the above copyright | 12 | * 2. Redistributions in binary form must reproduce the above copyright | |
13 | * notice, this list of conditions and the following disclaimer in the | 13 | * notice, this list of conditions and the following disclaimer in the | |
14 | * documentation and/or other materials provided with the distribution. | 14 | * documentation and/or other materials provided with the distribution. | |
@@ -30,51 +30,51 @@ | @@ -30,51 +30,51 @@ | |||
30 | */ | 30 | */ | |
31 | 31 | |||
32 | /* | 32 | /* | |
33 | * LCD driver for Intel Lubbock. | 33 | * LCD driver for Intel Lubbock. | |
34 | * | 34 | * | |
35 | * Controlling LCD is almost completely done through PXA2X0's | 35 | * Controlling LCD is almost completely done through PXA2X0's | |
36 | * integrated LCD controller. Codes for it is arm/xscale/pxa2x0_lcd.c. | 36 | * integrated LCD controller. Codes for it is arm/xscale/pxa2x0_lcd.c. | |
37 | * | 37 | * | |
38 | * Codes in this file provide platform specific things including: | 38 | * Codes in this file provide platform specific things including: | |
39 | * LCD on/off switch in on-board PLD register. | 39 | * LCD on/off switch in on-board PLD register. | |
40 | * LCD panel geometry | 40 | * LCD panel geometry | |
41 | */ | 41 | */ | |
42 | #include <sys/cdefs.h> | 42 | #include <sys/cdefs.h> | |
43 | __KERNEL_RCSID(0, "$NetBSD: lubbock_lcd.c,v 1.8 2008/06/11 23:24:43 cegger Exp $"); | 43 | __KERNEL_RCSID(0, "$NetBSD: lubbock_lcd.c,v 1.9 2009/01/29 12:28:15 nonaka Exp $"); | |
44 | 44 | |||
45 | #include <sys/param.h> | 45 | #include <sys/param.h> | |
46 | #include <sys/systm.h> | 46 | #include <sys/systm.h> | |
47 | #include <sys/conf.h> | 47 | #include <sys/conf.h> | |
48 | #include <sys/uio.h> | 48 | #include <sys/uio.h> | |
49 | #include <sys/malloc.h> | 49 | #include <sys/malloc.h> | |
50 | 50 | |||
51 | #include <dev/cons.h> | 51 | #include <dev/cons.h> | |
52 | #include <dev/wscons/wsconsio.h> | 52 | #include <dev/wscons/wsconsio.h> | |
53 | #include <dev/wscons/wsdisplayvar.h> | 53 | #include <dev/wscons/wsdisplayvar.h> | |
54 | #include <dev/wscons/wscons_callbacks.h> | 54 | #include <dev/wscons/wscons_callbacks.h> | |
55 | 55 | |||
56 | #include <machine/bus.h> | 56 | #include <machine/bus.h> | |
57 | #include <arm/xscale/pxa2x0var.h> | 57 | #include <arm/xscale/pxa2x0var.h> | |
58 | #include <arm/xscale/pxa2x0reg.h> | 58 | #include <arm/xscale/pxa2x0reg.h> | |
59 | #include <arm/xscale/pxa2x0_lcd.h> | 59 | #include <arm/xscale/pxa2x0_lcd.h> | |
60 | 60 | |||
61 | #include <arch/evbarm/lubbock/lubbock_reg.h> | 61 | #include <arch/evbarm/lubbock/lubbock_reg.h> | |
62 | #include <arch/evbarm/lubbock/lubbock_var.h> | 62 | #include <arch/evbarm/lubbock/lubbock_var.h> | |
63 | 63 | |||
64 | #include "wsdisplay.h" | 64 | #include "wsdisplay.h" | |
65 | 65 | |||
66 | int lcd_match( struct device *, struct cfdata *, void *); | 66 | int lcd_match(device_t, cfdata_t, void *); | |
67 | void lcd_attach( struct device *, struct device *, void *); | 67 | void lcd_attach(device_t, device_t, void *); | |
68 | int lcdintr(void *); | 68 | int lcdintr(void *); | |
69 | 69 | |||
70 | #if NWSDISPLAY > 0 | 70 | #if NWSDISPLAY > 0 | |
71 | 71 | |||
72 | /* | 72 | /* | |
73 | * wsdisplay glue | 73 | * wsdisplay glue | |
74 | */ | 74 | */ | |
75 | struct pxa2x0_wsscreen_descr lcd_bpp16_screen = { | 75 | struct pxa2x0_wsscreen_descr lcd_bpp16_screen = { | |
76 | { | 76 | { | |
77 | "bpp16", 0, 0, | 77 | "bpp16", 0, 0, | |
78 | &pxa2x0_lcd_emulops, | 78 | &pxa2x0_lcd_emulops, | |
79 | 0, 0, | 79 | 0, 0, | |
80 | WSSCREEN_WSCOLORS, | 80 | WSSCREEN_WSCOLORS, | |
@@ -132,58 +132,60 @@ const struct wsdisplay_accessops lcd_acc | @@ -132,58 +132,60 @@ const struct wsdisplay_accessops lcd_acc | |||
132 | * Interface to LCD framebuffer without wscons | 132 | * Interface to LCD framebuffer without wscons | |
133 | */ | 133 | */ | |
134 | dev_type_open(lcdopen); | 134 | dev_type_open(lcdopen); | |
135 | dev_type_close(lcdclose); | 135 | dev_type_close(lcdclose); | |
136 | dev_type_ioctl(lcdioctl); | 136 | dev_type_ioctl(lcdioctl); | |
137 | dev_type_mmap(lcdmmap); | 137 | dev_type_mmap(lcdmmap); | |
138 | const struct cdevsw lcd_cdevsw = { | 138 | const struct cdevsw lcd_cdevsw = { | |
139 | lcdopen, lcdclose, noread, nowrite, | 139 | lcdopen, lcdclose, noread, nowrite, | |
140 | lcdioctl, nostop, notty, nopoll, lcdmmap, D_TTY | 140 | lcdioctl, nostop, notty, nopoll, lcdmmap, D_TTY | |
141 | }; | 141 | }; | |
142 | 142 | |||
143 | #endif | 143 | #endif | |
144 | 144 | |||
145 | CFATTACH_DECL(lcd_obio, sizeof (struct pxa2x0_lcd_softc), lcd_match, | 145 | CFATTACH_DECL_NEW(lcd_obio, sizeof (struct pxa2x0_lcd_softc), lcd_match, | |
146 | lcd_attach, NULL, NULL); | 146 | lcd_attach, NULL, NULL); | |
147 | 147 | |||
148 | int | 148 | int | |
149 | lcd_match( struct device *parent, struct cfdata *cf, void *aux ) | 149 | lcd_match( device_t parent, cfdata_t cf, void *aux ) | |
150 | { | 150 | { | |
151 | return 1; | 151 | return 1; | |
152 | } | 152 | } | |
153 | 153 | |||
154 | static const struct lcd_panel_geometry sharp_LM8V31 = | 154 | static const struct lcd_panel_geometry sharp_LM8V31 = | |
155 | { | 155 | { | |
156 | 640, /* Width */ | 156 | 640, /* Width */ | |
157 | 480, /* Height */ | 157 | 480, /* Height */ | |
158 | 0, /* No extra lines */ | 158 | 0, /* No extra lines */ | |
159 | 159 | |||
160 | LCDPANEL_DUAL|LCDPANEL_PASSIVE|LCDPANEL_PCP, | 160 | LCDPANEL_DUAL|LCDPANEL_PASSIVE|LCDPANEL_PCP, | |
161 | 10, /* clock divider */ | 161 | 10, /* clock divider */ | |
162 | 0xff, /* AC bias pin freq */ | 162 | 0xff, /* AC bias pin freq */ | |
163 | 163 | |||
164 | 2, /* horizontal sync pulse width */ | 164 | 2, /* horizontal sync pulse width */ | |
165 | 3, /* BLW */ | 165 | 3, /* BLW */ | |
166 | 3, /* ELW */ | 166 | 3, /* ELW */ | |
167 | 167 | |||
168 | 1, /* vertical sync pulse width */ | 168 | 1, /* vertical sync pulse width */ | |
169 | 0, /* BFW */ | 169 | 0, /* BFW */ | |
170 | 0, /* EFW */ | 170 | 0, /* EFW */ | |
171 | 171 | |||
172 | }; | 172 | }; | |
173 | 173 | |||
174 | void lcd_attach( struct device *parent, struct device *self, void *aux ) | 174 | void lcd_attach( device_t parent, device_t self, void *aux ) | |
175 | { | 175 | { | |
176 | struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)self; | 176 | struct pxa2x0_lcd_softc *sc = device_private(self); | |
177 | ||||
178 | sc->dev = self; | |||
177 | 179 | |||
178 | pxa2x0_lcd_attach_sub(sc, aux, &sharp_LM8V31); | 180 | pxa2x0_lcd_attach_sub(sc, aux, &sharp_LM8V31); | |
179 | 181 | |||
180 | 182 | |||
181 | #if NWSDISPLAY > 0 | 183 | #if NWSDISPLAY > 0 | |
182 | 184 | |||
183 | { | 185 | { | |
184 | struct wsemuldisplaydev_attach_args aa; | 186 | struct wsemuldisplaydev_attach_args aa; | |
185 | 187 | |||
186 | /* make wsdisplay screen list */ | 188 | /* make wsdisplay screen list */ | |
187 | pxa2x0_lcd_setup_wsscreen( &lcd_bpp16_screen, &sharp_LM8V31, NULL ); | 189 | pxa2x0_lcd_setup_wsscreen( &lcd_bpp16_screen, &sharp_LM8V31, NULL ); | |
188 | pxa2x0_lcd_setup_wsscreen( &lcd_bpp8_screen, &sharp_LM8V31, NULL ); | 190 | pxa2x0_lcd_setup_wsscreen( &lcd_bpp8_screen, &sharp_LM8V31, NULL ); | |
189 | pxa2x0_lcd_setup_wsscreen( &lcd_bpp4_screen, &sharp_LM8V31, NULL ); | 191 | pxa2x0_lcd_setup_wsscreen( &lcd_bpp4_screen, &sharp_LM8V31, NULL ); |
--- src/sys/arch/zaurus/dev/scoop.c 2008/06/13 13:58:21 1.5
+++ src/sys/arch/zaurus/dev/scoop.c 2009/01/29 12:28:15 1.6
@@ -1,126 +1,129 @@ | @@ -1,126 +1,129 @@ | |||
1 | /* $NetBSD: scoop.c,v 1.5 2008/06/13 13:58:21 cegger Exp $ */ | 1 | /* $NetBSD: scoop.c,v 1.6 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: zaurus_scoop.c,v 1.12 2005/11/17 05:26:31 uwe Exp $ */ | 2 | /* $OpenBSD: zaurus_scoop.c,v 1.12 2005/11/17 05:26:31 uwe Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> | 5 | * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | #include <sys/cdefs.h> | 20 | #include <sys/cdefs.h> | |
21 | __KERNEL_RCSID(0, "$NetBSD: scoop.c,v 1.5 2008/06/13 13:58:21 cegger Exp $"); | 21 | __KERNEL_RCSID(0, "$NetBSD: scoop.c,v 1.6 2009/01/29 12:28:15 nonaka Exp $"); | |
22 | 22 | |||
23 | #include <sys/param.h> | 23 | #include <sys/param.h> | |
24 | #include <sys/systm.h> | 24 | #include <sys/systm.h> | |
25 | #include <sys/device.h> | 25 | #include <sys/device.h> | |
26 | #include <sys/conf.h> | 26 | #include <sys/conf.h> | |
27 | #include <sys/gpio.h> | 27 | #include <sys/gpio.h> | |
28 | 28 | |||
29 | #include <machine/bus.h> | 29 | #include <machine/bus.h> | |
30 | 30 | |||
31 | #include <arm/xscale/pxa2x0var.h> | 31 | #include <arm/xscale/pxa2x0var.h> | |
32 | 32 | |||
33 | #include <zaurus/zaurus/zaurus_reg.h> | 33 | #include <zaurus/zaurus/zaurus_reg.h> | |
34 | #include <zaurus/zaurus/zaurus_var.h> | 34 | #include <zaurus/zaurus/zaurus_var.h> | |
35 | 35 | |||
36 | #include <zaurus/dev/scoopreg.h> | 36 | #include <zaurus/dev/scoopreg.h> | |
37 | #include <zaurus/dev/scoopvar.h> | 37 | #include <zaurus/dev/scoopvar.h> | |
38 | 38 | |||
39 | #include "ioconf.h" | 39 | #include "ioconf.h" | |
40 | 40 | |||
41 | struct scoop_softc { | 41 | struct scoop_softc { | |
42 | struct device sc_dev; | 42 | device_t sc_dev; | |
43 | 43 | |||
44 | bus_space_tag_t sc_iot; | 44 | bus_space_tag_t sc_iot; | |
45 | bus_space_handle_t sc_ioh; | 45 | bus_space_handle_t sc_ioh; | |
46 | 46 | |||
47 | uint16_t sc_gpwr; /* GPIO state before suspend */ | 47 | uint16_t sc_gpwr; /* GPIO state before suspend */ | |
48 | }; | 48 | }; | |
49 | 49 | |||
50 | static int scoopmatch(struct device *, struct cfdata *, void *); | 50 | static int scoopmatch(device_t, cfdata_t, void *); | |
51 | static void scoopattach(struct device *, struct device *, void *); | 51 | static void scoopattach(device_t, device_t, void *); | |
52 | 52 | |||
53 | CFATTACH_DECL(scoop, sizeof(struct scoop_softc), | 53 | CFATTACH_DECL_NEW(scoop, sizeof(struct scoop_softc), | |
54 | scoopmatch, scoopattach, NULL, NULL); | 54 | scoopmatch, scoopattach, NULL, NULL); | |
55 | 55 | |||
56 | #if 0 | 56 | #if 0 | |
57 | static int scoop_gpio_pin_read(struct scoop_softc *sc, int); | 57 | static int scoop_gpio_pin_read(struct scoop_softc *, int); | |
58 | #endif | 58 | #endif | |
59 | static void scoop_gpio_pin_write(struct scoop_softc *sc, int, int); | 59 | static void scoop_gpio_pin_write(struct scoop_softc *, int, int); | |
60 | static void scoop_gpio_pin_ctl(struct scoop_softc *sc, int, int); | 60 | static void scoop_gpio_pin_ctl(struct scoop_softc *, int, int); | |
61 | 61 | |||
62 | enum scoop_card { | 62 | enum scoop_card { | |
63 | SD_CARD, | 63 | SD_CARD, | |
64 | CF_CARD /* socket 0 (external) */ | 64 | CF_CARD /* socket 0 (external) */ | |
65 | }; | 65 | }; | |
66 | 66 | |||
67 | static void scoop0_set_card_power(enum scoop_card card, int new_cpr); | 67 | static void scoop0_set_card_power(enum scoop_card card, int new_cpr); | |
68 | 68 | |||
69 | static int | 69 | static int | |
70 | scoopmatch(struct device *parent, struct cfdata *cf, void *aux) | 70 | scoopmatch(device_t parent, cfdata_t cf, void *aux) | |
71 | { | 71 | { | |
72 | 72 | |||
73 | /* | 73 | /* | |
74 | * Only C3000-like models are known to have two SCOOPs. | 74 | * Only C3000-like models are known to have two SCOOPs. | |
75 | */ | 75 | */ | |
76 | if (ZAURUS_ISC3000) | 76 | if (ZAURUS_ISC3000) | |
77 | return (cf->cf_unit < 2); | 77 | return (cf->cf_unit < 2); | |
78 | return (cf->cf_unit == 0); | 78 | return (cf->cf_unit == 0); | |
79 | } | 79 | } | |
80 | 80 | |||
81 | static void | 81 | static void | |
82 | scoopattach(struct device *parent, struct device *self, void *aux) | 82 | scoopattach(device_t parent, device_t self, void *aux) | |
83 | { | 83 | { | |
84 | struct scoop_softc *sc = device_private(self); | |||
84 | struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux; | 85 | struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux; | |
85 | struct scoop_softc *sc = (struct scoop_softc *)self; | |||
86 | bus_addr_t addr; | 86 | bus_addr_t addr; | |
87 | bus_size_t size; | 87 | bus_size_t size; | |
88 | 88 | |||
89 | sc->sc_dev = self; | |||
89 | sc->sc_iot = pxa->pxa_iot; | 90 | sc->sc_iot = pxa->pxa_iot; | |
90 | 91 | |||
92 | aprint_normal(": PCMCIA/GPIO controller\n"); | |||
93 | aprint_naive("\n"); | |||
94 | ||||
91 | if (pxa->pxa_addr != -1) | 95 | if (pxa->pxa_addr != -1) | |
92 | addr = pxa->pxa_addr; | 96 | addr = pxa->pxa_addr; | |
93 | else if (sc->sc_dev.dv_unit == 0) | 97 | else if (sc->sc_dev->dv_unit == 0) | |
94 | addr = C3000_SCOOP0_BASE; | 98 | addr = C3000_SCOOP0_BASE; | |
95 | else | 99 | else | |
96 | addr = C3000_SCOOP1_BASE; | 100 | addr = C3000_SCOOP1_BASE; | |
97 | 101 | |||
98 | size = pxa->pxa_size < SCOOP_SIZE ? SCOOP_SIZE : pxa->pxa_size; | 102 | size = pxa->pxa_size < SCOOP_SIZE ? SCOOP_SIZE : pxa->pxa_size; | |
99 | 103 | |||
100 | if (bus_space_map(sc->sc_iot, addr, size, 0, &sc->sc_ioh) != 0) { | 104 | if (bus_space_map(sc->sc_iot, addr, size, 0, &sc->sc_ioh) != 0) { | |
101 | printf(": failed to map %s\n", sc->sc_dev.dv_xname); | 105 | aprint_error_dev(sc->sc_dev, "couldn't map registers\n"); | |
102 | return; | 106 | return; | |
103 | } | 107 | } | |
104 | 108 | |||
105 | if (ZAURUS_ISC3000 && sc->sc_dev.dv_unit == 1) { | 109 | if (ZAURUS_ISC3000 && sc->sc_dev->dv_unit == 1) { | |
106 | scoop_gpio_pin_ctl(sc, SCOOP1_AKIN_PULLUP, GPIO_PIN_OUTPUT); | 110 | scoop_gpio_pin_ctl(sc, SCOOP1_AKIN_PULLUP, GPIO_PIN_OUTPUT); | |
107 | scoop_gpio_pin_write(sc, SCOOP1_AKIN_PULLUP, GPIO_PIN_LOW); | 111 | scoop_gpio_pin_write(sc, SCOOP1_AKIN_PULLUP, GPIO_PIN_LOW); | |
108 | } else if (!ZAURUS_ISC3000) { | 112 | } else if (!ZAURUS_ISC3000) { | |
109 | scoop_gpio_pin_ctl(sc, SCOOP0_AKIN_PULLUP, GPIO_PIN_OUTPUT); | 113 | scoop_gpio_pin_ctl(sc, SCOOP0_AKIN_PULLUP, GPIO_PIN_OUTPUT); | |
110 | scoop_gpio_pin_write(sc, SCOOP0_AKIN_PULLUP, GPIO_PIN_LOW); | 114 | scoop_gpio_pin_write(sc, SCOOP0_AKIN_PULLUP, GPIO_PIN_LOW); | |
111 | } | 115 | } | |
112 | 116 | |||
113 | printf(": PCMCIA/GPIO controller\n"); | |||
114 | } | 117 | } | |
115 | 118 | |||
116 | #if 0 | 119 | #if 0 | |
117 | static int | 120 | static int | |
118 | scoop_gpio_pin_read(struct scoop_softc *sc, int pin) | 121 | scoop_gpio_pin_read(struct scoop_softc *sc, int pin) | |
119 | { | 122 | { | |
120 | uint16_t bit = (1 << pin); | 123 | uint16_t bit = (1 << pin); | |
121 | uint16_t rv; | 124 | uint16_t rv; | |
122 | 125 | |||
123 | rv = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR); | 126 | rv = bus_space_read_2(sc->sc_iot, sc->sc_ioh, SCOOP_GPWR); | |
124 | return (rv & bit) ? 1 : 0; | 127 | return (rv & bit) ? 1 : 0; | |
125 | } | 128 | } | |
126 | #endif | 129 | #endif |
--- src/sys/arch/zaurus/dev/zaudio.c 2007/10/17 19:58:34 1.5
+++ src/sys/arch/zaurus/dev/zaudio.c 2009/01/29 12:28:15 1.6
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: zaudio.c,v 1.5 2007/10/17 19:58:34 garbled Exp $ */ | 1 | /* $NetBSD: zaudio.c,v 1.6 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: zaurus_audio.c,v 1.8 2005/08/18 13:23:02 robert Exp $ */ | 2 | /* $OpenBSD: zaurus_audio.c,v 1.8 2005/08/18 13:23:02 robert Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org> | 5 | * Copyright (c) 2005 Christopher Pascoe <pascoe@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
@@ -48,69 +48,69 @@ __KERNEL_RCSID(0, "$NetBSD"); | @@ -48,69 +48,69 @@ __KERNEL_RCSID(0, "$NetBSD"); | |||
48 | #include <dev/mulaw.h> | 48 | #include <dev/mulaw.h> | |
49 | #include <dev/auconv.h> | 49 | #include <dev/auconv.h> | |
50 | 50 | |||
51 | #include <zaurus/dev/wm8750reg.h> | 51 | #include <zaurus/dev/wm8750reg.h> | |
52 | #include <zaurus/dev/scoopvar.h> | 52 | #include <zaurus/dev/scoopvar.h> | |
53 | 53 | |||
54 | #define WM8750_ADDRESS 0x1B | 54 | #define WM8750_ADDRESS 0x1B | |
55 | #define SPKR_VOLUME 112 | 55 | #define SPKR_VOLUME 112 | |
56 | 56 | |||
57 | #define wm8750_write(sc, reg, val) \ | 57 | #define wm8750_write(sc, reg, val) \ | |
58 | pxa2x0_i2c_write_2(&sc->sc_i2c, WM8750_ADDRESS, \ | 58 | pxa2x0_i2c_write_2(&sc->sc_i2c, WM8750_ADDRESS, \ | |
59 | (((reg) << 9) | ((val) & 0x1ff))) | 59 | (((reg) << 9) | ((val) & 0x1ff))) | |
60 | 60 | |||
61 | static int zaudio_match(struct device *, struct cfdata *, void *); | 61 | static int zaudio_match(device_t, cfdata_t, void *); | |
62 | static void zaudio_attach(struct device *, struct device *, void *); | 62 | static void zaudio_attach(device_t, device_t, void *); | |
63 | static int zaudio_detach(struct device *, int); | 63 | static int zaudio_detach(device_t, int); | |
64 | static void zaudio_power(int, void *); | 64 | static void zaudio_power(int, void *); | |
65 | 65 | |||
66 | #define ZAUDIO_OP_SPKR 0 | 66 | #define ZAUDIO_OP_SPKR 0 | |
67 | #define ZAUDIO_OP_HP 1 | 67 | #define ZAUDIO_OP_HP 1 | |
68 | 68 | |||
69 | #define ZAUDIO_JACK_STATE_OUT 0 | 69 | #define ZAUDIO_JACK_STATE_OUT 0 | |
70 | #define ZAUDIO_JACK_STATE_IN 1 | 70 | #define ZAUDIO_JACK_STATE_IN 1 | |
71 | #define ZAUDIO_JACK_STATE_INS 2 | 71 | #define ZAUDIO_JACK_STATE_INS 2 | |
72 | #define ZAUDIO_JACK_STATE_REM 3 | 72 | #define ZAUDIO_JACK_STATE_REM 3 | |
73 | 73 | |||
74 | /* GPIO pins */ | 74 | /* GPIO pins */ | |
75 | #define GPIO_HP_IN_C3000 116 | 75 | #define GPIO_HP_IN_C3000 116 | |
76 | 76 | |||
77 | struct zaudio_volume { | 77 | struct zaudio_volume { | |
78 | u_int8_t left; | 78 | u_int8_t left; | |
79 | u_int8_t right; | 79 | u_int8_t right; | |
80 | }; | 80 | }; | |
81 | 81 | |||
82 | struct zaudio_softc { | 82 | struct zaudio_softc { | |
83 | struct device sc_dev; | 83 | device_t sc_dev; | |
84 | 84 | |||
85 | /* i2s device softc */ | 85 | /* i2s device softc */ | |
86 | /* NB: pxa2x0_i2s requires this to be the second struct member */ | 86 | /* NB: pxa2x0_i2s requires this to be the second struct member */ | |
87 | struct pxa2x0_i2s_softc sc_i2s; | 87 | struct pxa2x0_i2s_softc sc_i2s; | |
88 | 88 | |||
89 | /* i2c device softc */ | 89 | /* i2c device softc */ | |
90 | struct pxa2x0_i2c_softc sc_i2c; | 90 | struct pxa2x0_i2c_softc sc_i2c; | |
91 | 91 | |||
92 | void *sc_powerhook; | 92 | void *sc_powerhook; | |
93 | int sc_playing; | 93 | int sc_playing; | |
94 | 94 | |||
95 | struct zaudio_volume sc_volume[2]; | 95 | struct zaudio_volume sc_volume[2]; | |
96 | char sc_unmute[2]; | 96 | char sc_unmute[2]; | |
97 | 97 | |||
98 | int sc_state; | 98 | int sc_state; | |
99 | int sc_icount; | 99 | int sc_icount; | |
100 | struct callout sc_to; | 100 | struct callout sc_to; | |
101 | }; | 101 | }; | |
102 | 102 | |||
103 | CFATTACH_DECL(zaudio, sizeof(struct zaudio_softc), | 103 | CFATTACH_DECL_NEW(zaudio, sizeof(struct zaudio_softc), | |
104 | zaudio_match, zaudio_attach, zaudio_detach, NULL); | 104 | zaudio_match, zaudio_attach, zaudio_detach, NULL); | |
105 | 105 | |||
106 | static struct audio_device wm8750_device = { | 106 | static struct audio_device wm8750_device = { | |
107 | "WM8750", | 107 | "WM8750", | |
108 | "1.0", | 108 | "1.0", | |
109 | "wm" | 109 | "wm" | |
110 | }; | 110 | }; | |
111 | 111 | |||
112 | #define ZAUDIO_NFORMATS 4 | 112 | #define ZAUDIO_NFORMATS 4 | |
113 | static const struct audio_format zaudio_formats[ZAUDIO_NFORMATS] = { | 113 | static const struct audio_format zaudio_formats[ZAUDIO_NFORMATS] = { | |
114 | {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16, | 114 | {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16, | |
115 | 2, AUFMT_STEREO, 0, {4000, 48000}}, | 115 | 2, AUFMT_STEREO, 0, {4000, 48000}}, | |
116 | {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16, | 116 | {NULL, AUMODE_PLAY | AUMODE_RECORD, AUDIO_ENCODING_SLINEAR_LE, 16, 16, | |
@@ -193,106 +193,109 @@ static const uint16_t playback_registers | @@ -193,106 +193,109 @@ static const uint16_t playback_registers | |||
193 | 193 | |||
194 | /* Set DAC voltage references */ | 194 | /* Set DAC voltage references */ | |
195 | { PWRMGMT1_REG, PWRMGMT1_SET_VMIDSEL(1) | PWRMGMT1_VREF }, | 195 | { PWRMGMT1_REG, PWRMGMT1_SET_VMIDSEL(1) | PWRMGMT1_VREF }, | |
196 | 196 | |||
197 | /* Direct DACs to output mixers */ | 197 | /* Direct DACs to output mixers */ | |
198 | { LOUTMIX1_REG, LOUTMIX1_LD2LO }, | 198 | { LOUTMIX1_REG, LOUTMIX1_LD2LO }, | |
199 | { ROUTMIX2_REG, ROUTMIX2_RD2RO }, | 199 | { ROUTMIX2_REG, ROUTMIX2_RD2RO }, | |
200 | 200 | |||
201 | /* End of list */ | 201 | /* End of list */ | |
202 | { 0xffff, 0xffff } | 202 | { 0xffff, 0xffff } | |
203 | }; | 203 | }; | |
204 | 204 | |||
205 | static int | 205 | static int | |
206 | zaudio_match(struct device *parent, struct cfdata *cf, void *aux) | 206 | zaudio_match(device_t parent, cfdata_t cf, void *aux) | |
207 | { | 207 | { | |
208 | 208 | |||
209 | return 1; | 209 | return 1; | |
210 | } | 210 | } | |
211 | 211 | |||
212 | static void | 212 | static void | |
213 | zaudio_attach(struct device *parent, struct device *self, void *aux) | 213 | zaudio_attach(device_t parent, device_t self, void *aux) | |
214 | { | 214 | { | |
215 | struct zaudio_softc *sc = (struct zaudio_softc *)self; | 215 | struct zaudio_softc *sc = device_private(self); | |
216 | struct pxaip_attach_args *pxa = aux; | 216 | struct pxaip_attach_args *pxa = aux; | |
217 | int rv; | 217 | int rv; | |
218 | 218 | |||
219 | sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname, | 219 | sc->sc_dev = self; | |
220 | ||||
221 | aprint_normal(": I2C, I2S, WM8750 Audio\n"); | |||
222 | aprint_naive("\n"); | |||
223 | ||||
224 | sc->sc_powerhook = powerhook_establish(device_xname(sc->sc_dev), | |||
220 | zaudio_power, sc); | 225 | zaudio_power, sc); | |
221 | if (sc->sc_powerhook == NULL) { | 226 | if (sc->sc_powerhook == NULL) { | |
222 | printf(": unable to establish powerhook\n"); | 227 | aprint_error_dev(sc->sc_dev, "unable to establish powerhook\n"); | |
223 | return; | 228 | return; | |
224 | } | 229 | } | |
225 | 230 | |||
226 | sc->sc_i2s.sc_iot = pxa->pxa_iot; | 231 | sc->sc_i2s.sc_iot = pxa->pxa_iot; | |
227 | sc->sc_i2s.sc_dmat = pxa->pxa_dmat; | 232 | sc->sc_i2s.sc_dmat = pxa->pxa_dmat; | |
228 | sc->sc_i2s.sc_size = PXA2X0_I2S_SIZE; | 233 | sc->sc_i2s.sc_size = PXA2X0_I2S_SIZE; | |
229 | if (pxa2x0_i2s_attach_sub(&sc->sc_i2s)) { | 234 | if (pxa2x0_i2s_attach_sub(&sc->sc_i2s)) { | |
230 | printf(": unable to attach I2S\n"); | 235 | aprint_error_dev(sc->sc_dev, "unable to attach I2S\n"); | |
231 | goto fail_i2s; | 236 | goto fail_i2s; | |
232 | } | 237 | } | |
233 | 238 | |||
234 | sc->sc_i2c.sc_iot = pxa->pxa_iot; | 239 | sc->sc_i2c.sc_iot = pxa->pxa_iot; | |
235 | sc->sc_i2c.sc_size = PXA2X0_I2C_SIZE; | 240 | sc->sc_i2c.sc_size = PXA2X0_I2C_SIZE; | |
236 | if (pxa2x0_i2c_attach_sub(&sc->sc_i2c)) { | 241 | if (pxa2x0_i2c_attach_sub(&sc->sc_i2c)) { | |
237 | printf(": unable to attach I2C\n"); | 242 | aprint_error_dev(sc->sc_dev, "unable to attach I2C\n"); | |
238 | goto fail_i2c; | 243 | goto fail_i2c; | |
239 | } | 244 | } | |
240 | 245 | |||
241 | /* Check for an I2C response from the wm8750 */ | 246 | /* Check for an I2C response from the wm8750 */ | |
242 | pxa2x0_i2c_open(&sc->sc_i2c); | 247 | pxa2x0_i2c_open(&sc->sc_i2c); | |
243 | rv = wm8750_write(sc, RESET_REG, 0); | 248 | rv = wm8750_write(sc, RESET_REG, 0); | |
244 | pxa2x0_i2c_close(&sc->sc_i2c); | 249 | pxa2x0_i2c_close(&sc->sc_i2c); | |
245 | 250 | |||
246 | if (rv) { | 251 | if (rv) { | |
247 | printf(": codec failed to respond\n"); | 252 | aprint_error_dev(sc->sc_dev, "codec failed to respond\n"); | |
248 | goto fail_probe; | 253 | goto fail_probe; | |
249 | } | 254 | } | |
250 | delay(100); | 255 | delay(100); | |
251 | 256 | |||
252 | /* Speaker on, headphones off by default. */ | 257 | /* Speaker on, headphones off by default. */ | |
253 | sc->sc_volume[ZAUDIO_OP_SPKR].left = 240; | 258 | sc->sc_volume[ZAUDIO_OP_SPKR].left = 240; | |
254 | sc->sc_unmute[ZAUDIO_OP_SPKR] = 1; | 259 | sc->sc_unmute[ZAUDIO_OP_SPKR] = 1; | |
255 | sc->sc_volume[ZAUDIO_OP_HP].left = 180; | 260 | sc->sc_volume[ZAUDIO_OP_HP].left = 180; | |
256 | sc->sc_volume[ZAUDIO_OP_HP].right = 180; | 261 | sc->sc_volume[ZAUDIO_OP_HP].right = 180; | |
257 | sc->sc_unmute[ZAUDIO_OP_HP] = 0; | 262 | sc->sc_unmute[ZAUDIO_OP_HP] = 0; | |
258 | 263 | |||
259 | /* Configure headphone jack state change handling. */ | 264 | /* Configure headphone jack state change handling. */ | |
260 | callout_init(&sc->sc_to, 0); | 265 | callout_init(&sc->sc_to, 0); | |
261 | callout_setfunc(&sc->sc_to, zaudio_jack, sc); | 266 | callout_setfunc(&sc->sc_to, zaudio_jack, sc); | |
262 | pxa2x0_gpio_set_function(GPIO_HP_IN_C3000, GPIO_IN); | 267 | pxa2x0_gpio_set_function(GPIO_HP_IN_C3000, GPIO_IN); | |
263 | (void)pxa2x0_gpio_intr_establish(GPIO_HP_IN_C3000, | 268 | (void)pxa2x0_gpio_intr_establish(GPIO_HP_IN_C3000, | |
264 | IST_EDGE_BOTH, IPL_BIO, zaudio_jack_intr, sc); | 269 | IST_EDGE_BOTH, IPL_BIO, zaudio_jack_intr, sc); | |
265 | 270 | |||
266 | zaudio_init(sc); | 271 | zaudio_init(sc); | |
267 | 272 | |||
268 | printf(": I2C, I2S, WM8750 Audio\n"); | 273 | audio_attach_mi(&wm8750_hw_if, sc, sc->sc_dev); | |
269 | ||||
270 | audio_attach_mi(&wm8750_hw_if, sc, &sc->sc_dev); | |||
271 | 274 | |||
272 | return; | 275 | return; | |
273 | 276 | |||
274 | fail_probe: | 277 | fail_probe: | |
275 | pxa2x0_i2c_detach_sub(&sc->sc_i2c); | 278 | pxa2x0_i2c_detach_sub(&sc->sc_i2c); | |
276 | fail_i2c: | 279 | fail_i2c: | |
277 | pxa2x0_i2s_detach_sub(&sc->sc_i2s); | 280 | pxa2x0_i2s_detach_sub(&sc->sc_i2s); | |
278 | fail_i2s: | 281 | fail_i2s: | |
279 | powerhook_disestablish(sc->sc_powerhook); | 282 | powerhook_disestablish(sc->sc_powerhook); | |
280 | } | 283 | } | |
281 | 284 | |||
282 | static int | 285 | static int | |
283 | zaudio_detach(struct device *self, int flags) | 286 | zaudio_detach(device_t self, int flags) | |
284 | { | 287 | { | |
285 | struct zaudio_softc *sc = (struct zaudio_softc *)self; | 288 | struct zaudio_softc *sc = device_private(self); | |
286 | 289 | |||
287 | if (sc->sc_powerhook != NULL) { | 290 | if (sc->sc_powerhook != NULL) { | |
288 | powerhook_disestablish(sc->sc_powerhook); | 291 | powerhook_disestablish(sc->sc_powerhook); | |
289 | sc->sc_powerhook = NULL; | 292 | sc->sc_powerhook = NULL; | |
290 | } | 293 | } | |
291 | 294 | |||
292 | pxa2x0_i2c_detach_sub(&sc->sc_i2c); | 295 | pxa2x0_i2c_detach_sub(&sc->sc_i2c); | |
293 | pxa2x0_i2s_detach_sub(&sc->sc_i2s); | 296 | pxa2x0_i2s_detach_sub(&sc->sc_i2s); | |
294 | 297 | |||
295 | return 0; | 298 | return 0; | |
296 | } | 299 | } | |
297 | 300 | |||
298 | static void | 301 | static void |
--- src/sys/arch/zaurus/dev/zrc.c 2007/10/17 19:58:35 1.5
+++ src/sys/arch/zaurus/dev/zrc.c 2009/01/29 12:28:15 1.6
@@ -1,34 +1,34 @@ | @@ -1,34 +1,34 @@ | |||
1 | /* $NetBSD: zrc.c,v 1.5 2007/10/17 19:58:35 garbled Exp $ */ | 1 | /* $NetBSD: zrc.c,v 1.6 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: zaurus_remote.c,v 1.1 2005/11/17 05:26:31 uwe Exp $ */ | 2 | /* $OpenBSD: zaurus_remote.c,v 1.1 2005/11/17 05:26:31 uwe Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org> | 5 | * Copyright (c) 2005 Uwe Stuehler <uwe@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | #include <sys/cdefs.h> | 20 | #include <sys/cdefs.h> | |
21 | __KERNEL_RCSID(0, "$NetBSD: zrc.c,v 1.5 2007/10/17 19:58:35 garbled Exp $"); | 21 | __KERNEL_RCSID(0, "$NetBSD: zrc.c,v 1.6 2009/01/29 12:28:15 nonaka Exp $"); | |
22 | 22 | |||
23 | #include <sys/param.h> | 23 | #include <sys/param.h> | |
24 | #include <sys/device.h> | 24 | #include <sys/device.h> | |
25 | #include <sys/kernel.h> | 25 | #include <sys/kernel.h> | |
26 | #include <sys/callout.h> | 26 | #include <sys/callout.h> | |
27 | #include <sys/systm.h> | 27 | #include <sys/systm.h> | |
28 | 28 | |||
29 | #include <dev/wscons/wsconsio.h> | 29 | #include <dev/wscons/wsconsio.h> | |
30 | #include <dev/wscons/wskbdvar.h> | 30 | #include <dev/wscons/wskbdvar.h> | |
31 | #include <dev/wscons/wsksymdef.h> | 31 | #include <dev/wscons/wsksymdef.h> | |
32 | #include <dev/wscons/wsksymvar.h> | 32 | #include <dev/wscons/wsksymvar.h> | |
33 | 33 | |||
34 | #include <arm/xscale/pxa2x0reg.h> | 34 | #include <arm/xscale/pxa2x0reg.h> | |
@@ -71,43 +71,43 @@ static const struct zrc_akey zrc_akeytab | @@ -71,43 +71,43 @@ static const struct zrc_akey zrc_akeytab | |||
71 | { 202, KEY_VOL_DOWN }, | 71 | { 202, KEY_VOL_DOWN }, | |
72 | { 168, KEY_MUTE }, | 72 | { 168, KEY_MUTE }, | |
73 | { 135, KEY_REWIND }, | 73 | { 135, KEY_REWIND }, | |
74 | { 105, KEY_VOL_UP }, | 74 | { 105, KEY_VOL_UP }, | |
75 | { 74, KEY_FORWARD }, | 75 | { 74, KEY_FORWARD }, | |
76 | { 42, KEY_PLAY }, | 76 | { 42, KEY_PLAY }, | |
77 | { 12, KEY_STOP }, | 77 | { 12, KEY_STOP }, | |
78 | { INT_MIN, KEY_EARPHONE } | 78 | { INT_MIN, KEY_EARPHONE } | |
79 | }; | 79 | }; | |
80 | 80 | |||
81 | static const struct zrc_akey *zrc_akeytab = zrc_akeytab_c3000; | 81 | static const struct zrc_akey *zrc_akeytab = zrc_akeytab_c3000; | |
82 | 82 | |||
83 | struct zrc_softc { | 83 | struct zrc_softc { | |
84 | struct device sc_dev; | 84 | device_t sc_dev; | |
85 | struct callout sc_to; | 85 | struct callout sc_to; | |
86 | void *sc_ih; | 86 | void *sc_ih; | |
87 | int sc_key; /* being scanned */ | 87 | int sc_key; /* being scanned */ | |
88 | int sc_scans; /* rescan counter */ | 88 | int sc_scans; /* rescan counter */ | |
89 | int sc_noise; /* discard if too noisy? */ | 89 | int sc_noise; /* discard if too noisy? */ | |
90 | int sc_keydown; /* currently pressed key */ | 90 | int sc_keydown; /* currently pressed key */ | |
91 | struct device *sc_wskbddev; | 91 | struct device *sc_wskbddev; | |
92 | #ifdef WSDISPLAY_COMPAT_RAWKBD | 92 | #ifdef WSDISPLAY_COMPAT_RAWKBD | |
93 | int sc_rawkbd; | 93 | int sc_rawkbd; | |
94 | #endif | 94 | #endif | |
95 | }; | 95 | }; | |
96 | 96 | |||
97 | static int zrc_match(struct device *, struct cfdata *, void *); | 97 | static int zrc_match(struct device *, struct cfdata *, void *); | |
98 | static void zrc_attach(struct device *, struct device *, void *); | 98 | static void zrc_attach(struct device *, struct device *, void *); | |
99 | 99 | |||
100 | CFATTACH_DECL(zrc, sizeof(struct zrc_softc), | 100 | CFATTACH_DECL_NEW(zrc, sizeof(struct zrc_softc), | |
101 | zrc_match, zrc_attach, NULL, NULL); | 101 | zrc_match, zrc_attach, NULL, NULL); | |
102 | 102 | |||
103 | static int zrc_intr(void *); | 103 | static int zrc_intr(void *); | |
104 | static void zrc_timeout(void *); | 104 | static void zrc_timeout(void *); | |
105 | static int zrc_scan(void); | 105 | static int zrc_scan(void); | |
106 | static void zrc_input(struct zrc_softc *, int, int); | 106 | static void zrc_input(struct zrc_softc *, int, int); | |
107 | 107 | |||
108 | static int zrc_enable(void *, int); | 108 | static int zrc_enable(void *, int); | |
109 | static void zrc_set_leds(void *, int); | 109 | static void zrc_set_leds(void *, int); | |
110 | static int zrc_ioctl(void *, u_long, void *, int, struct lwp *); | 110 | static int zrc_ioctl(void *, u_long, void *, int, struct lwp *); | |
111 | 111 | |||
112 | struct wskbd_accessops zrc_accessops = { | 112 | struct wskbd_accessops zrc_accessops = { | |
113 | zrc_enable, | 113 | zrc_enable, | |
@@ -147,54 +147,63 @@ static const keysym_t zrc_xt_keymap[] = | @@ -147,54 +147,63 @@ static const keysym_t zrc_xt_keymap[] = | |||
147 | 147 | |||
148 | static const struct wscons_keydesc zrc_keydesctab[] = { | 148 | static const struct wscons_keydesc zrc_keydesctab[] = { | |
149 | {KB_US, 0, sizeof(zrc_keydesc)/sizeof(keysym_t), zrc_keydesc}, | 149 | {KB_US, 0, sizeof(zrc_keydesc)/sizeof(keysym_t), zrc_keydesc}, | |
150 | {0, 0, 0, 0} | 150 | {0, 0, 0, 0} | |
151 | }; | 151 | }; | |
152 | 152 | |||
153 | struct wskbd_mapdata zrc_keymapdata = { | 153 | struct wskbd_mapdata zrc_keymapdata = { | |
154 | zrc_keydesctab, KB_US | 154 | zrc_keydesctab, KB_US | |
155 | }; | 155 | }; | |
156 | 156 | |||
157 | #undef KC | 157 | #undef KC | |
158 | 158 | |||
159 | static int | 159 | static int | |
160 | zrc_match(struct device *parent, struct cfdata *cf, void *aux) | 160 | zrc_match(device_t parent, cfdata_t cf, void *aux) | |
161 | { | 161 | { | |
162 | 162 | |||
163 | if (ZAURUS_ISC3000) | 163 | if (ZAURUS_ISC3000) | |
164 | return 1; | 164 | return 1; | |
165 | return 0; | 165 | return 0; | |
166 | } | 166 | } | |
167 | 167 | |||
168 | static void | 168 | static void | |
169 | zrc_attach(struct device *parent, struct device *self, void *aux) | 169 | zrc_attach(device_t parent, device_t self, void *aux) | |
170 | { | 170 | { | |
171 | struct zrc_softc *sc = (struct zrc_softc *)self; | 171 | struct zrc_softc *sc = device_private(self); | |
172 | struct wskbddev_attach_args a; | 172 | struct wskbddev_attach_args a; | |
173 | 173 | |||
174 | sc->sc_dev = self; | |||
175 | ||||
176 | aprint_normal(": CE-RH2 remote control\n"); | |||
177 | aprint_naive("\n"); | |||
178 | ||||
174 | /* Configure remote control interrupt handling. */ | 179 | /* Configure remote control interrupt handling. */ | |
175 | callout_init(&sc->sc_to, 0); | 180 | callout_init(&sc->sc_to, 0); | |
176 | callout_setfunc(&sc->sc_to, zrc_timeout, sc); | 181 | callout_setfunc(&sc->sc_to, zrc_timeout, sc); | |
182 | ||||
183 | /* Establish interrput */ | |||
177 | pxa2x0_gpio_set_function(C3000_RC_IRQ_PIN, GPIO_IN); | 184 | pxa2x0_gpio_set_function(C3000_RC_IRQ_PIN, GPIO_IN); | |
178 | sc->sc_ih = pxa2x0_gpio_intr_establish(C3000_RC_IRQ_PIN, | 185 | sc->sc_ih = pxa2x0_gpio_intr_establish(C3000_RC_IRQ_PIN, | |
179 | IST_EDGE_BOTH, IPL_BIO, zrc_intr, sc); | 186 | IST_EDGE_BOTH, IPL_BIO, zrc_intr, sc); | |
187 | if (sc->sc_ih == NULL) { | |||
188 | aprint_error_dev(sc->sc_dev, "couldn't establish interrupt.\n"); | |||
189 | return; | |||
190 | } | |||
180 | 191 | |||
181 | /* Enable the pullup while waiting for an interrupt. */ | 192 | /* Enable the pullup while waiting for an interrupt. */ | |
182 | scoop_akin_pullup(1); | 193 | scoop_akin_pullup(1); | |
183 | 194 | |||
184 | sc->sc_keydown = KEY_RELEASE; | 195 | sc->sc_keydown = KEY_RELEASE; | |
185 | 196 | |||
186 | printf(": CE-RH2 remote control\n"); | |||
187 | ||||
188 | a.console = 0; | 197 | a.console = 0; | |
189 | a.keymap = &zrc_keymapdata; | 198 | a.keymap = &zrc_keymapdata; | |
190 | a.accessops = &zrc_accessops; | 199 | a.accessops = &zrc_accessops; | |
191 | a.accesscookie = sc; | 200 | a.accesscookie = sc; | |
192 | 201 | |||
193 | sc->sc_wskbddev = config_found(self, &a, wskbddevprint); | 202 | sc->sc_wskbddev = config_found(self, &a, wskbddevprint); | |
194 | } | 203 | } | |
195 | 204 | |||
196 | static int | 205 | static int | |
197 | zrc_intr(void *v) | 206 | zrc_intr(void *v) | |
198 | { | 207 | { | |
199 | struct zrc_softc *sc = v; | 208 | struct zrc_softc *sc = v; | |
200 | 209 | |||
@@ -235,53 +244,55 @@ zrc_timeout(void *v) | @@ -235,53 +244,55 @@ zrc_timeout(void *v) | |||
235 | /* generate key press event */ | 244 | /* generate key press event */ | |
236 | if (sc->sc_key != key) { | 245 | if (sc->sc_key != key) { | |
237 | key = sc->sc_key; | 246 | key = sc->sc_key; | |
238 | sc->sc_noise++; | 247 | sc->sc_noise++; | |
239 | } | 248 | } | |
240 | sc->sc_scans++; | 249 | sc->sc_scans++; | |
241 | switch (key) { | 250 | switch (key) { | |
242 | case KEY_EARPHONE: | 251 | case KEY_EARPHONE: | |
243 | case KEY_RELEASE: | 252 | case KEY_RELEASE: | |
244 | sc->sc_scans = 6; | 253 | sc->sc_scans = 6; | |
245 | break; | 254 | break; | |
246 | default: | 255 | default: | |
247 | #ifdef DEBUG | 256 | #ifdef DEBUG | |
248 | printf("%s pressed (%d noise)\n", zrc_keyname[key], | 257 | printf("%s: %s pressed (%d noise)\n", | |
249 | sc->sc_noise); | 258 | device_xname(sc->sc_dev), | |
259 | zrc_keyname[key], sc->sc_noise); | |||
250 | #endif | 260 | #endif | |
251 | sc->sc_keydown = key; | 261 | sc->sc_keydown = key; | |
252 | sc->sc_noise = 0; | 262 | sc->sc_noise = 0; | |
253 | zrc_input(sc, key, 1); | 263 | zrc_input(sc, key, 1); | |
254 | break; | 264 | break; | |
255 | } | 265 | } | |
256 | callout_schedule(&sc->sc_to, RESCAN_INTERVAL); | 266 | callout_schedule(&sc->sc_to, RESCAN_INTERVAL); | |
257 | break; | 267 | break; | |
258 | case 4: | 268 | case 4: | |
259 | case 5: | 269 | case 5: | |
260 | /* wait for key release, permit noise */ | 270 | /* wait for key release, permit noise */ | |
261 | if (sc->sc_key == key) { | 271 | if (sc->sc_key == key) { | |
262 | if (sc->sc_scans == 5) | 272 | if (sc->sc_scans == 5) | |
263 | sc->sc_noise++; | 273 | sc->sc_noise++; | |
264 | sc->sc_scans = 4; | 274 | sc->sc_scans = 4; | |
265 | } else | 275 | } else | |
266 | sc->sc_scans++; | 276 | sc->sc_scans++; | |
267 | callout_schedule(&sc->sc_to, RESCAN_INTERVAL); | 277 | callout_schedule(&sc->sc_to, RESCAN_INTERVAL); | |
268 | break; | 278 | break; | |
269 | case 6: | 279 | case 6: | |
270 | /* generate key release event */ | 280 | /* generate key release event */ | |
271 | if (sc->sc_keydown != KEY_RELEASE) { | 281 | if (sc->sc_keydown != KEY_RELEASE) { | |
272 | zrc_input(sc, sc->sc_keydown, 0); | 282 | zrc_input(sc, sc->sc_keydown, 0); | |
273 | #ifdef DEBUG | 283 | #ifdef DEBUG | |
274 | printf("%s released (%d noise)\n", | 284 | printf("%s: %s released (%d noise)\n", | |
285 | device_xname(sc->sc_dev), | |||
275 | zrc_keyname[sc->sc_keydown], sc->sc_noise); | 286 | zrc_keyname[sc->sc_keydown], sc->sc_noise); | |
276 | #endif | 287 | #endif | |
277 | sc->sc_keydown = KEY_RELEASE; | 288 | sc->sc_keydown = KEY_RELEASE; | |
278 | } | 289 | } | |
279 | /* FALLTHROUGH */ | 290 | /* FALLTHROUGH */ | |
280 | default: | 291 | default: | |
281 | /* unmask interrupt again */ | 292 | /* unmask interrupt again */ | |
282 | callout_stop(&sc->sc_to); | 293 | callout_stop(&sc->sc_to); | |
283 | sc->sc_scans = 7; | 294 | sc->sc_scans = 7; | |
284 | scoop_akin_pullup(1); | 295 | scoop_akin_pullup(1); | |
285 | pxa2x0_gpio_intr_unmask(sc->sc_ih); | 296 | pxa2x0_gpio_intr_unmask(sc->sc_ih); | |
286 | } | 297 | } | |
287 | } | 298 | } |
--- src/sys/arch/zaurus/dev/ztp.c 2007/10/17 19:58:35 1.5
+++ src/sys/arch/zaurus/dev/ztp.c 2009/01/29 12:28:15 1.6
@@ -1,34 +1,34 @@ | @@ -1,34 +1,34 @@ | |||
1 | /* $NetBSD: ztp.c,v 1.5 2007/10/17 19:58:35 garbled Exp $ */ | 1 | /* $NetBSD: ztp.c,v 1.6 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: zts.c,v 1.9 2005/04/24 18:55:49 uwe Exp $ */ | 2 | /* $OpenBSD: zts.c,v 1.9 2005/04/24 18:55:49 uwe Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> | 5 | * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | #include <sys/cdefs.h> | 20 | #include <sys/cdefs.h> | |
21 | __KERNEL_RCSID(0, "$NetBSD: ztp.c,v 1.5 2007/10/17 19:58:35 garbled Exp $"); | 21 | __KERNEL_RCSID(0, "$NetBSD: ztp.c,v 1.6 2009/01/29 12:28:15 nonaka Exp $"); | |
22 | 22 | |||
23 | #include "lcd.h" | 23 | #include "lcd.h" | |
24 | 24 | |||
25 | #include <sys/types.h> | 25 | #include <sys/types.h> | |
26 | #include <sys/param.h> | 26 | #include <sys/param.h> | |
27 | #include <sys/systm.h> | 27 | #include <sys/systm.h> | |
28 | #include <sys/device.h> | 28 | #include <sys/device.h> | |
29 | #include <sys/malloc.h> | 29 | #include <sys/malloc.h> | |
30 | #include <sys/kernel.h> | 30 | #include <sys/kernel.h> | |
31 | #include <sys/callout.h> | 31 | #include <sys/callout.h> | |
32 | 32 | |||
33 | #include <dev/wscons/wsconsio.h> | 33 | #include <dev/wscons/wsconsio.h> | |
34 | #include <dev/wscons/wsmousevar.h> | 34 | #include <dev/wscons/wsmousevar.h> | |
@@ -86,72 +86,75 @@ static const struct wsmouse_calibcoords | @@ -86,72 +86,75 @@ static const struct wsmouse_calibcoords | |||
86 | { 3308, 3452, 48, 576 }, | 86 | { 3308, 3452, 48, 576 }, | |
87 | { 2854, 768, 432, 576 }, | 87 | { 2854, 768, 432, 576 }, | |
88 | { 542, 593, 432, 64 } | 88 | { 542, 593, 432, 64 } | |
89 | } | 89 | } | |
90 | }; | 90 | }; | |
91 | 91 | |||
92 | struct ztp_pos { | 92 | struct ztp_pos { | |
93 | int x; | 93 | int x; | |
94 | int y; | 94 | int y; | |
95 | int z; /* touch pressure */ | 95 | int z; /* touch pressure */ | |
96 | }; | 96 | }; | |
97 | 97 | |||
98 | struct ztp_softc { | 98 | struct ztp_softc { | |
99 | struct device sc_dev; | 99 | device_t sc_dev; | |
100 | struct callout sc_tp_poll; | 100 | struct callout sc_tp_poll; | |
101 | void *sc_gh; | 101 | void *sc_gh; | |
102 | void *sc_powerhook; | 102 | void *sc_powerhook; | |
103 | int sc_enabled; | 103 | int sc_enabled; | |
104 | int sc_buttons; /* button emulation ? */ | 104 | int sc_buttons; /* button emulation ? */ | |
105 | struct device *sc_wsmousedev; | 105 | struct device *sc_wsmousedev; | |
106 | struct ztp_pos sc_oldpos; | 106 | struct ztp_pos sc_oldpos; | |
107 | int sc_resx; | 107 | int sc_resx; | |
108 | int sc_resy; | 108 | int sc_resy; | |
109 | struct tpcalib_softc sc_tpcalib; | 109 | struct tpcalib_softc sc_tpcalib; | |
110 | }; | 110 | }; | |
111 | 111 | |||
112 | static int ztp_match(struct device *, struct cfdata *, void *); | 112 | static int ztp_match(device_t, cfdata_t, void *); | |
113 | static void ztp_attach(struct device *, struct device *, void *); | 113 | static void ztp_attach(device_t, device_t, void *); | |
114 | 114 | |||
115 | CFATTACH_DECL(ztp, sizeof(struct ztp_softc), | 115 | CFATTACH_DECL_NEW(ztp, sizeof(struct ztp_softc), | |
116 | ztp_match, ztp_attach, NULL, NULL); | 116 | ztp_match, ztp_attach, NULL, NULL); | |
117 | 117 | |||
118 | static int ztp_enable(void *); | 118 | static int ztp_enable(void *); | |
119 | static void ztp_disable(void *); | 119 | static void ztp_disable(void *); | |
120 | static void ztp_power(int, void *); | 120 | static void ztp_power(int, void *); | |
121 | static void ztp_poll(void *); | 121 | static void ztp_poll(void *); | |
122 | static int ztp_irq(void *); | 122 | static int ztp_irq(void *); | |
123 | static int ztp_ioctl(void *, u_long, void *, int, struct lwp *); | 123 | static int ztp_ioctl(void *, u_long, void *, int, struct lwp *); | |
124 | 124 | |||
125 | static const struct wsmouse_accessops ztp_accessops = { | 125 | static const struct wsmouse_accessops ztp_accessops = { | |
126 | ztp_enable, | 126 | ztp_enable, | |
127 | ztp_ioctl, | 127 | ztp_ioctl, | |
128 | ztp_disable | 128 | ztp_disable | |
129 | }; | 129 | }; | |
130 | 130 | |||
131 | static int | 131 | static int | |
132 | ztp_match(struct device *parent, struct cfdata *cf, void *aux) | 132 | ztp_match(device_t parent, cfdata_t cf, void *aux) | |
133 | { | 133 | { | |
134 | 134 | |||
135 | return 1; | 135 | return 1; | |
136 | } | 136 | } | |
137 | 137 | |||
138 | static void | 138 | static void | |
139 | ztp_attach(struct device *parent, struct device *self, void *aux) | 139 | ztp_attach(device_t parent, device_t self, void *aux) | |
140 | { | 140 | { | |
141 | struct ztp_softc *sc = (struct ztp_softc *)self; | 141 | struct ztp_softc *sc = device_private(self); | |
142 | struct wsmousedev_attach_args a; | 142 | struct wsmousedev_attach_args a; | |
143 | 143 | |||
144 | printf("\n"); | 144 | sc->sc_dev = self; | |
145 | ||||
146 | aprint_normal("\n"); | |||
147 | aprint_naive("\n"); | |||
145 | 148 | |||
146 | callout_init(&sc->sc_tp_poll, 0); | 149 | callout_init(&sc->sc_tp_poll, 0); | |
147 | callout_setfunc(&sc->sc_tp_poll, ztp_poll, sc); | 150 | callout_setfunc(&sc->sc_tp_poll, ztp_poll, sc); | |
148 | 151 | |||
149 | /* Initialize ADS7846 Difference Reference mode */ | 152 | /* Initialize ADS7846 Difference Reference mode */ | |
150 | (void)zssp_ic_send(ZSSP_IC_ADS7846, | 153 | (void)zssp_ic_send(ZSSP_IC_ADS7846, | |
151 | (1<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH)); | 154 | (1<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH)); | |
152 | delay(5000); | 155 | delay(5000); | |
153 | (void)zssp_ic_send(ZSSP_IC_ADS7846, | 156 | (void)zssp_ic_send(ZSSP_IC_ADS7846, | |
154 | (3<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH)); | 157 | (3<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH)); | |
155 | delay(5000); | 158 | delay(5000); | |
156 | (void)zssp_ic_send(ZSSP_IC_ADS7846, | 159 | (void)zssp_ic_send(ZSSP_IC_ADS7846, | |
157 | (4<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH)); | 160 | (4<<ADSCTRL_ADR_SH) | (1<<ADSCTRL_STS_SH)); | |
@@ -174,92 +177,92 @@ ztp_attach(struct device *parent, struct | @@ -174,92 +177,92 @@ ztp_attach(struct device *parent, struct | |||
174 | sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint); | 177 | sc->sc_wsmousedev = config_found(self, &a, wsmousedevprint); | |
175 | 178 | |||
176 | /* Initialize calibration, set default parameters. */ | 179 | /* Initialize calibration, set default parameters. */ | |
177 | tpcalib_init(&sc->sc_tpcalib); | 180 | tpcalib_init(&sc->sc_tpcalib); | |
178 | tpcalib_ioctl(&sc->sc_tpcalib, WSMOUSEIO_SCALIBCOORDS, | 181 | tpcalib_ioctl(&sc->sc_tpcalib, WSMOUSEIO_SCALIBCOORDS, | |
179 | __UNCONST(&ztp_default_calib), 0, 0); | 182 | __UNCONST(&ztp_default_calib), 0, 0); | |
180 | } | 183 | } | |
181 | 184 | |||
182 | static int | 185 | static int | |
183 | ztp_enable(void *v) | 186 | ztp_enable(void *v) | |
184 | { | 187 | { | |
185 | struct ztp_softc *sc = (struct ztp_softc *)v; | 188 | struct ztp_softc *sc = (struct ztp_softc *)v; | |
186 | 189 | |||
187 | DPRINTF(("%s: ztp_enable()\n", sc->sc_dev.dv_xname)); | 190 | DPRINTF(("%s: ztp_enable()\n", device_xname(sc->sc_dev))); | |
188 | 191 | |||
189 | if (sc->sc_enabled) { | 192 | if (sc->sc_enabled) { | |
190 | DPRINTF(("%s: already enabled\n", sc->sc_dev.dv_xname)); | 193 | DPRINTF(("%s: already enabled\n", device_xname(sc->sc_dev))); | |
191 | return EBUSY; | 194 | return EBUSY; | |
192 | } | 195 | } | |
193 | 196 | |||
194 | callout_stop(&sc->sc_tp_poll); | 197 | callout_stop(&sc->sc_tp_poll); | |
195 | 198 | |||
196 | sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname, ztp_power, | 199 | sc->sc_powerhook = powerhook_establish(device_xname(sc->sc_dev), | |
197 | sc); | 200 | ztp_power, sc); | |
198 | if (sc->sc_powerhook == NULL) { | 201 | if (sc->sc_powerhook == NULL) { | |
199 | printf("%s: enable failed\n", sc->sc_dev.dv_xname); | 202 | aprint_error_dev(sc->sc_dev, "couldn't establish powerhook\n"); | |
200 | return ENOMEM; | 203 | return ENOMEM; | |
201 | } | 204 | } | |
202 | 205 | |||
203 | pxa2x0_gpio_set_function(GPIO_TP_INT_C3K, GPIO_IN); | 206 | pxa2x0_gpio_set_function(GPIO_TP_INT_C3K, GPIO_IN); | |
204 | 207 | |||
205 | /* XXX */ | 208 | /* XXX */ | |
206 | if (sc->sc_gh == NULL) { | 209 | if (sc->sc_gh == NULL) { | |
207 | sc->sc_gh = pxa2x0_gpio_intr_establish(GPIO_TP_INT_C3K, | 210 | sc->sc_gh = pxa2x0_gpio_intr_establish(GPIO_TP_INT_C3K, | |
208 | IST_EDGE_FALLING, IPL_TTY, ztp_irq, sc); | 211 | IST_EDGE_FALLING, IPL_TTY, ztp_irq, sc); | |
209 | } else { | 212 | } else { | |
210 | pxa2x0_gpio_intr_unmask(sc->sc_gh); | 213 | pxa2x0_gpio_intr_unmask(sc->sc_gh); | |
211 | } | 214 | } | |
212 | 215 | |||
213 | /* enable interrupts */ | 216 | /* enable interrupts */ | |
214 | sc->sc_enabled = 1; | 217 | sc->sc_enabled = 1; | |
215 | sc->sc_buttons = 0; | 218 | sc->sc_buttons = 0; | |
216 | 219 | |||
217 | return 0; | 220 | return 0; | |
218 | } | 221 | } | |
219 | 222 | |||
220 | static void | 223 | static void | |
221 | ztp_disable(void *v) | 224 | ztp_disable(void *v) | |
222 | { | 225 | { | |
223 | struct ztp_softc *sc = (struct ztp_softc *)v; | 226 | struct ztp_softc *sc = (struct ztp_softc *)v; | |
224 | 227 | |||
225 | DPRINTF(("%s: ztp_disable()\n", sc->sc_dev.dv_xname)); | 228 | DPRINTF(("%s: ztp_disable()\n", device_xname(sc->sc_dev))); | |
226 | 229 | |||
227 | callout_stop(&sc->sc_tp_poll); | 230 | callout_stop(&sc->sc_tp_poll); | |
228 | 231 | |||
229 | if (sc->sc_powerhook != NULL) { | 232 | if (sc->sc_powerhook != NULL) { | |
230 | powerhook_disestablish(sc->sc_powerhook); | 233 | powerhook_disestablish(sc->sc_powerhook); | |
231 | sc->sc_powerhook = NULL; | 234 | sc->sc_powerhook = NULL; | |
232 | } | 235 | } | |
233 | 236 | |||
234 | if (sc->sc_gh) { | 237 | if (sc->sc_gh) { | |
235 | #if 0 | 238 | #if 0 | |
236 | pxa2x0_gpio_intr_disestablish(sc->sc_gh); | 239 | pxa2x0_gpio_intr_disestablish(sc->sc_gh); | |
237 | sc->sc_gh = NULL; | 240 | sc->sc_gh = NULL; | |
238 | #else | 241 | #else | |
239 | pxa2x0_gpio_intr_mask(sc->sc_gh); | 242 | pxa2x0_gpio_intr_mask(sc->sc_gh); | |
240 | #endif | 243 | #endif | |
241 | } | 244 | } | |
242 | 245 | |||
243 | /* disable interrupts */ | 246 | /* disable interrupts */ | |
244 | sc->sc_enabled = 0; | 247 | sc->sc_enabled = 0; | |
245 | } | 248 | } | |
246 | 249 | |||
247 | static void | 250 | static void | |
248 | ztp_power(int why, void *v) | 251 | ztp_power(int why, void *v) | |
249 | { | 252 | { | |
250 | struct ztp_softc *sc = (struct ztp_softc *)v; | 253 | struct ztp_softc *sc = (struct ztp_softc *)v; | |
251 | 254 | |||
252 | DPRINTF(("%s: ztp_power()\n", sc->sc_dev.dv_xname)); | 255 | DPRINTF(("%s: ztp_power()\n", device_xname(sc->sc_dev))); | |
253 | 256 | |||
254 | switch (why) { | 257 | switch (why) { | |
255 | case PWR_STANDBY: | 258 | case PWR_STANDBY: | |
256 | case PWR_SUSPEND: | 259 | case PWR_SUSPEND: | |
257 | sc->sc_enabled = 0; | 260 | sc->sc_enabled = 0; | |
258 | #if 0 | 261 | #if 0 | |
259 | pxa2x0_gpio_intr_disestablish(sc->sc_gh); | 262 | pxa2x0_gpio_intr_disestablish(sc->sc_gh); | |
260 | #endif | 263 | #endif | |
261 | callout_stop(&sc->sc_tp_poll); | 264 | callout_stop(&sc->sc_tp_poll); | |
262 | 265 | |||
263 | pxa2x0_gpio_intr_mask(sc->sc_gh); | 266 | pxa2x0_gpio_intr_mask(sc->sc_gh); | |
264 | 267 | |||
265 | /* Turn off reference voltage but leave ADC on. */ | 268 | /* Turn off reference voltage but leave ADC on. */ | |
@@ -459,49 +462,49 @@ ztp_irq(void *v) | @@ -459,49 +462,49 @@ ztp_irq(void *v) | |||
459 | struct ztp_softc *sc = (struct ztp_softc *)v; | 462 | struct ztp_softc *sc = (struct ztp_softc *)v; | |
460 | struct ztp_pos tp = { 0, 0, 0 }; | 463 | struct ztp_pos tp = { 0, 0, 0 }; | |
461 | int pindown; | 464 | int pindown; | |
462 | int down; | 465 | int down; | |
463 | int x, y; | 466 | int x, y; | |
464 | int s; | 467 | int s; | |
465 | 468 | |||
466 | if (!sc->sc_enabled) | 469 | if (!sc->sc_enabled) | |
467 | return 0; | 470 | return 0; | |
468 | 471 | |||
469 | s = splhigh(); | 472 | s = splhigh(); | |
470 | 473 | |||
471 | pindown = pxa2x0_gpio_get_bit(GPIO_TP_INT_C3K) ? 0 : 1; | 474 | pindown = pxa2x0_gpio_get_bit(GPIO_TP_INT_C3K) ? 0 : 1; | |
472 | DPRINTF(("%s: pindown = %d\n", sc->sc_dev.dv_xname, pindown)); | 475 | DPRINTF(("%s: pindown = %d\n", device_xname(sc->sc_dev), pindown)); | |
473 | if (pindown) { | 476 | if (pindown) { | |
474 | pxa2x0_gpio_intr_mask(sc->sc_gh); | 477 | pxa2x0_gpio_intr_mask(sc->sc_gh); | |
475 | callout_schedule(&sc->sc_tp_poll, POLL_TIMEOUT_RATE1); | 478 | callout_schedule(&sc->sc_tp_poll, POLL_TIMEOUT_RATE1); | |
476 | } | 479 | } | |
477 | 480 | |||
478 | down = ztp_readpos(&tp); | 481 | down = ztp_readpos(&tp); | |
479 | DPRINTF(("%s: x = %d, y = %d, z = %d, down = %d\n", sc->sc_dev.dv_xname, | 482 | DPRINTF(("%s: x = %d, y = %d, z = %d, down = %d\n", | |
480 | tp.x, tp.y, tp.z, down)); | 483 | device_xname(sc->sc_dev), tp.x, tp.y, tp.z, down)); | |
481 | 484 | |||
482 | if (!pindown) { | 485 | if (!pindown) { | |
483 | pxa2x0_gpio_intr_unmask(sc->sc_gh); | 486 | pxa2x0_gpio_intr_unmask(sc->sc_gh); | |
484 | callout_schedule(&sc->sc_tp_poll, POLL_TIMEOUT_RATE0); | 487 | callout_schedule(&sc->sc_tp_poll, POLL_TIMEOUT_RATE0); | |
485 | } | 488 | } | |
486 | pxa2x0_gpio_clear_intr(GPIO_TP_INT_C3K); | 489 | pxa2x0_gpio_clear_intr(GPIO_TP_INT_C3K); | |
487 | 490 | |||
488 | splx(s); | 491 | splx(s); | |
489 | 492 | |||
490 | if (down) { | 493 | if (down) { | |
491 | if (!ztp_rawmode) { | 494 | if (!ztp_rawmode) { | |
492 | tpcalib_trans(&sc->sc_tpcalib, tp.x, tp.y, &x, &y); | 495 | tpcalib_trans(&sc->sc_tpcalib, tp.x, tp.y, &x, &y); | |
493 | DPRINTF(("%s: x = %d, y = %d\n", sc->sc_dev.dv_xname, | 496 | DPRINTF(("%s: x = %d, y = %d\n", | |
494 | x, y)); | 497 | device_xname(sc->sc_dev), x, y)); | |
495 | tp.x = x; | 498 | tp.x = x; | |
496 | tp.y = y; | 499 | tp.y = y; | |
497 | } | 500 | } | |
498 | } | 501 | } | |
499 | 502 | |||
500 | if (zkbd_modstate != 0 && down) { | 503 | if (zkbd_modstate != 0 && down) { | |
501 | if (zkbd_modstate & (1 << 1)) { | 504 | if (zkbd_modstate & (1 << 1)) { | |
502 | /* Fn */ | 505 | /* Fn */ | |
503 | down = 2; | 506 | down = 2; | |
504 | } else if (zkbd_modstate & (1 << 2)) { | 507 | } else if (zkbd_modstate & (1 << 2)) { | |
505 | /* 'Alt' */ | 508 | /* 'Alt' */ | |
506 | down = 4; | 509 | down = 4; | |
507 | } | 510 | } |
--- src/sys/arch/zaurus/dev/scoop_pcic.c 2006/12/17 16:07:11 1.2
+++ src/sys/arch/zaurus/dev/scoop_pcic.c 2009/01/29 12:28:15 1.3
@@ -1,87 +1,88 @@ | @@ -1,87 +1,88 @@ | |||
1 | /* $NetBSD: scoop_pcic.c,v 1.2 2006/12/17 16:07:11 peter Exp $ */ | 1 | /* $NetBSD: scoop_pcic.c,v 1.3 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: scoop_pcic.c,v 1.1 2005/07/01 23:51:55 uwe Exp $ */ | 2 | /* $OpenBSD: scoop_pcic.c,v 1.1 2005/07/01 23:51:55 uwe Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> | 5 | * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | #include <sys/cdefs.h> | 20 | #include <sys/cdefs.h> | |
21 | __KERNEL_RCSID(0, "$NetBSD: scoop_pcic.c,v 1.2 2006/12/17 16:07:11 peter Exp $"); | 21 | __KERNEL_RCSID(0, "$NetBSD: scoop_pcic.c,v 1.3 2009/01/29 12:28:15 nonaka Exp $"); | |
22 | 22 | |||
23 | #include <sys/param.h> | 23 | #include <sys/param.h> | |
24 | #include <sys/systm.h> | 24 | #include <sys/systm.h> | |
25 | #include <sys/device.h> | 25 | #include <sys/device.h> | |
26 | 26 | |||
27 | #include <uvm/uvm.h> | 27 | #include <uvm/uvm.h> | |
28 | 28 | |||
29 | #include <arch/arm/xscale/pxa2x0var.h> | 29 | #include <arch/arm/xscale/pxa2x0var.h> | |
30 | #include <arch/arm/xscale/pxa2x0_gpio.h> | 30 | #include <arch/arm/xscale/pxa2x0_gpio.h> | |
31 | #include <arch/arm/xscale/pxa2x0_pcic.h> | 31 | #include <arch/arm/xscale/pxa2x0_pcic.h> | |
32 | 32 | |||
33 | #include <zaurus/zaurus/zaurus_reg.h> | 33 | #include <zaurus/zaurus/zaurus_reg.h> | |
34 | #include <zaurus/zaurus/zaurus_var.h> | 34 | #include <zaurus/zaurus/zaurus_var.h> | |
35 | 35 | |||
36 | #include <zaurus/dev/scoopreg.h> | 36 | #include <zaurus/dev/scoopreg.h> | |
37 | 37 | |||
38 | static int scoop_pcic_match(struct device *, struct cfdata *, void *); | 38 | static int scoop_pcic_match(device_t, cfdata_t, void *); | |
39 | static void scoop_pcic_attach(struct device *, struct device *, void *); | 39 | static void scoop_pcic_attach(device_t, device_t, void *); | |
40 | 40 | |||
41 | CFATTACH_DECL(pxapcic_scoop, sizeof(struct pxapcic_softc), | 41 | CFATTACH_DECL_NEW(pxapcic_scoop, sizeof(struct pxapcic_softc), | |
42 | scoop_pcic_match, scoop_pcic_attach, NULL, NULL); | 42 | scoop_pcic_match, scoop_pcic_attach, NULL, NULL); | |
43 | 43 | |||
44 | static void scoop_pcic_socket_setup(struct pxapcic_socket *); | 44 | static void scoop_pcic_socket_setup(struct pxapcic_socket *); | |
45 | static u_int scoop_pcic_read(struct pxapcic_socket *, int); | 45 | static u_int scoop_pcic_read(struct pxapcic_socket *, int); | |
46 | static void scoop_pcic_write(struct pxapcic_socket *, int, u_int); | 46 | static void scoop_pcic_write(struct pxapcic_socket *, int, u_int); | |
47 | static void scoop_pcic_set_power(struct pxapcic_socket *, int); | 47 | static void scoop_pcic_set_power(struct pxapcic_socket *, int); | |
48 | static void scoop_pcic_clear_intr(struct pxapcic_socket *); | 48 | static void scoop_pcic_clear_intr(struct pxapcic_socket *); | |
49 | static void *scoop_pcic_intr_establish(struct pxapcic_socket *, int, | 49 | static void *scoop_pcic_intr_establish(struct pxapcic_socket *, int, | |
50 | int (*)(void *), void *); | 50 | int (*)(void *), void *); | |
51 | static void scoop_pcic_intr_disestablish(struct pxapcic_socket *, void *); | 51 | static void scoop_pcic_intr_disestablish(struct pxapcic_socket *, void *); | |
52 | 52 | |||
53 | struct pxapcic_tag scoop_pcic_functions = { | 53 | static struct pxapcic_tag scoop_pcic_functions = { | |
54 | scoop_pcic_read, | 54 | scoop_pcic_read, | |
55 | scoop_pcic_write, | 55 | scoop_pcic_write, | |
56 | scoop_pcic_set_power, | 56 | scoop_pcic_set_power, | |
57 | scoop_pcic_clear_intr, | 57 | scoop_pcic_clear_intr, | |
58 | scoop_pcic_intr_establish, | 58 | scoop_pcic_intr_establish, | |
59 | scoop_pcic_intr_disestablish | 59 | scoop_pcic_intr_disestablish | |
60 | }; | 60 | }; | |
61 | 61 | |||
62 | static int | 62 | static int | |
63 | scoop_pcic_match(struct device *parent, struct cfdata *cf, void *aux) | 63 | scoop_pcic_match(device_t parent, cfdata_t cf, void *aux) | |
64 | { | 64 | { | |
65 | 65 | |||
66 | return (ZAURUS_ISC860 || ZAURUS_ISC3000); | 66 | return (ZAURUS_ISC860 || ZAURUS_ISC3000); | |
67 | } | 67 | } | |
68 | 68 | |||
69 | static void | 69 | static void | |
70 | scoop_pcic_attach(struct device *parent, struct device *self, void *aux) | 70 | scoop_pcic_attach(device_t parent, device_t self, void *aux) | |
71 | { | 71 | { | |
72 | struct pxapcic_softc *sc = (struct pxapcic_softc *)self; | 72 | struct pxapcic_softc *sc = device_private(self); | |
73 | struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux; | 73 | struct pxaip_attach_args *pxa = (struct pxaip_attach_args *)aux; | |
74 | 74 | |||
75 | sc->sc_dev = self; | |||
75 | sc->sc_iot = pxa->pxa_iot; | 76 | sc->sc_iot = pxa->pxa_iot; | |
76 | 77 | |||
77 | if (ZAURUS_ISC860) { | 78 | if (ZAURUS_ISC860) { | |
78 | sc->sc_nslots = 1; | 79 | sc->sc_nslots = 1; | |
79 | sc->sc_irqpin[0] = C860_CF0_IRQ; | 80 | sc->sc_irqpin[0] = C860_CF0_IRQ; | |
80 | sc->sc_irqcfpin[0] = C860_CF0_IRQ_PIN; | 81 | sc->sc_irqcfpin[0] = C860_CF0_IRQ_PIN; | |
81 | } else if (ZAURUS_ISC3000) { | 82 | } else if (ZAURUS_ISC3000) { | |
82 | sc->sc_nslots = 2; | 83 | sc->sc_nslots = 2; | |
83 | sc->sc_irqpin[0] = C3000_CF0_IRQ; | 84 | sc->sc_irqpin[0] = C3000_CF0_IRQ; | |
84 | sc->sc_irqcfpin[0] = C3000_CF0_IRQ_PIN; | 85 | sc->sc_irqcfpin[0] = C3000_CF0_IRQ_PIN; | |
85 | sc->sc_irqpin[1] = C3000_CF1_IRQ; | 86 | sc->sc_irqpin[1] = C3000_CF1_IRQ; | |
86 | sc->sc_irqcfpin[1] = C3000_CF1_IRQ_PIN; | 87 | sc->sc_irqcfpin[1] = C3000_CF1_IRQ_PIN; | |
87 | } | 88 | } | |
@@ -98,35 +99,35 @@ scoop_pcic_socket_setup(struct pxapcic_s | @@ -98,35 +99,35 @@ scoop_pcic_socket_setup(struct pxapcic_s | |||
98 | bus_size_t size = SCOOP_SIZE; | 99 | bus_size_t size = SCOOP_SIZE; | |
99 | bus_space_tag_t iot; | 100 | bus_space_tag_t iot; | |
100 | bus_space_handle_t scooph; | 101 | bus_space_handle_t scooph; | |
101 | int error; | 102 | int error; | |
102 | 103 | |||
103 | sc = so->sc; | 104 | sc = so->sc; | |
104 | iot = sc->sc_iot; | 105 | iot = sc->sc_iot; | |
105 | 106 | |||
106 | if (so->socket == 0) { | 107 | if (so->socket == 0) { | |
107 | pa = C3000_SCOOP0_BASE; | 108 | pa = C3000_SCOOP0_BASE; | |
108 | } else if (so->socket == 1) { | 109 | } else if (so->socket == 1) { | |
109 | pa = C3000_SCOOP1_BASE; | 110 | pa = C3000_SCOOP1_BASE; | |
110 | } else { | 111 | } else { | |
111 | panic("%s: invalid CF slot %d", sc->sc_dev.dv_xname, | 112 | panic("%s: invalid CF slot %d", device_xname(sc->sc_dev), | |
112 | so->socket); | 113 | so->socket); | |
113 | } | 114 | } | |
114 | 115 | |||
115 | error = bus_space_map(iot, trunc_page(pa), round_page(size), | 116 | error = bus_space_map(iot, trunc_page(pa), round_page(size), | |
116 | 0, &scooph); | 117 | 0, &scooph); | |
117 | if (error) { | 118 | if (error) { | |
118 | panic("%s: failed to map memory %x for scoop", | 119 | panic("%s: failed to map memory %x for scoop", | |
119 | sc->sc_dev.dv_xname, (uint32_t)pa); | 120 | device_xname(sc->sc_dev), (uint32_t)pa); | |
120 | } | 121 | } | |
121 | scooph += pa - trunc_page(pa); | 122 | scooph += pa - trunc_page(pa); | |
122 | 123 | |||
123 | bus_space_write_2(iot, scooph, SCOOP_IMR, | 124 | bus_space_write_2(iot, scooph, SCOOP_IMR, | |
124 | SCP_IMR_UNKN0 | SCP_IMR_UNKN1); | 125 | SCP_IMR_UNKN0 | SCP_IMR_UNKN1); | |
125 | 126 | |||
126 | /* setup */ | 127 | /* setup */ | |
127 | bus_space_write_2(iot, scooph, SCOOP_MCR, 0x0100); | 128 | bus_space_write_2(iot, scooph, SCOOP_MCR, 0x0100); | |
128 | bus_space_write_2(iot, scooph, SCOOP_CDR, 0x0000); | 129 | bus_space_write_2(iot, scooph, SCOOP_CDR, 0x0000); | |
129 | bus_space_write_2(iot, scooph, SCOOP_CPR, 0x0000); | 130 | bus_space_write_2(iot, scooph, SCOOP_CPR, 0x0000); | |
130 | bus_space_write_2(iot, scooph, SCOOP_IMR, 0x0000); | 131 | bus_space_write_2(iot, scooph, SCOOP_IMR, 0x0000); | |
131 | bus_space_write_2(iot, scooph, SCOOP_IRM, 0x00ff); | 132 | bus_space_write_2(iot, scooph, SCOOP_IRM, 0x00ff); | |
132 | bus_space_write_2(iot, scooph, SCOOP_ISR, 0x0000); | 133 | bus_space_write_2(iot, scooph, SCOOP_ISR, 0x0000); |
--- src/sys/arch/zaurus/dev/zapm.c 2007/07/29 14:31:24 1.3
+++ src/sys/arch/zaurus/dev/zapm.c 2009/01/29 12:28:15 1.4
@@ -1,34 +1,34 @@ | @@ -1,34 +1,34 @@ | |||
1 | /* $NetBSD: zapm.c,v 1.3 2007/07/29 14:31:24 nonaka Exp $ */ | 1 | /* $NetBSD: zapm.c,v 1.4 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: zaurus_apm.c,v 1.13 2006/12/12 23:14:28 dim Exp $ */ | 2 | /* $OpenBSD: zaurus_apm.c,v 1.13 2006/12/12 23:14:28 dim Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> | 5 | * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | #include <sys/cdefs.h> | 20 | #include <sys/cdefs.h> | |
21 | __KERNEL_RCSID(0, "$NetBSD: zapm.c,v 1.3 2007/07/29 14:31:24 nonaka Exp $"); | 21 | __KERNEL_RCSID(0, "$NetBSD: zapm.c,v 1.4 2009/01/29 12:28:15 nonaka Exp $"); | |
22 | 22 | |||
23 | #include <sys/param.h> | 23 | #include <sys/param.h> | |
24 | #include <sys/systm.h> | 24 | #include <sys/systm.h> | |
25 | #include <sys/kernel.h> | 25 | #include <sys/kernel.h> | |
26 | #include <sys/callout.h> | 26 | #include <sys/callout.h> | |
27 | 27 | |||
28 | #include <dev/hpc/apm/apmvar.h> | 28 | #include <dev/hpc/apm/apmvar.h> | |
29 | 29 | |||
30 | #include <arm/xscale/pxa2x0reg.h> | 30 | #include <arm/xscale/pxa2x0reg.h> | |
31 | #include <arm/xscale/pxa2x0var.h> | 31 | #include <arm/xscale/pxa2x0var.h> | |
32 | #include <arm/xscale/pxa2x0cpu.h> | 32 | #include <arm/xscale/pxa2x0cpu.h> | |
33 | #include <arm/xscale/pxa2x0_gpio.h> | 33 | #include <arm/xscale/pxa2x0_gpio.h> | |
34 | 34 | |||
@@ -36,27 +36,27 @@ __KERNEL_RCSID(0, "$NetBSD: zapm.c,v 1.3 | @@ -36,27 +36,27 @@ __KERNEL_RCSID(0, "$NetBSD: zapm.c,v 1.3 | |||
36 | 36 | |||
37 | #include <zaurus/dev/scoopvar.h> | 37 | #include <zaurus/dev/scoopvar.h> | |
38 | #include <zaurus/dev/zsspvar.h> | 38 | #include <zaurus/dev/zsspvar.h> | |
39 | #include <zaurus/zaurus/zaurus_reg.h> | 39 | #include <zaurus/zaurus/zaurus_reg.h> | |
40 | #include <zaurus/zaurus/zaurus_var.h> | 40 | #include <zaurus/zaurus/zaurus_var.h> | |
41 | 41 | |||
42 | #ifdef APMDEBUG | 42 | #ifdef APMDEBUG | |
43 | #define DPRINTF(x) printf x | 43 | #define DPRINTF(x) printf x | |
44 | #else | 44 | #else | |
45 | #define DPRINTF(x) do { } while (/*CONSTCOND*/0) | 45 | #define DPRINTF(x) do { } while (/*CONSTCOND*/0) | |
46 | #endif | 46 | #endif | |
47 | 47 | |||
48 | struct zapm_softc { | 48 | struct zapm_softc { | |
49 | struct device sc_dev; | 49 | device_t sc_dev; | |
50 | void *sc_apmdev; | 50 | void *sc_apmdev; | |
51 | 51 | |||
52 | struct callout sc_cyclic_poll; | 52 | struct callout sc_cyclic_poll; | |
53 | struct callout sc_discharge_poll; | 53 | struct callout sc_discharge_poll; | |
54 | struct timeval sc_lastbattchk; | 54 | struct timeval sc_lastbattchk; | |
55 | volatile int suspended; | 55 | volatile int suspended; | |
56 | volatile int charging; | 56 | volatile int charging; | |
57 | volatile int discharging; | 57 | volatile int discharging; | |
58 | int battery_volt; | 58 | int battery_volt; | |
59 | int battery_full_cnt; | 59 | int battery_full_cnt; | |
60 | 60 | |||
61 | /* GPIO pin */ | 61 | /* GPIO pin */ | |
62 | int sc_ac_detect_pin; | 62 | int sc_ac_detect_pin; | |
@@ -66,30 +66,30 @@ struct zapm_softc { | @@ -66,30 +66,30 @@ struct zapm_softc { | |||
66 | /* machine-independent part */ | 66 | /* machine-independent part */ | |
67 | volatile u_int events; | 67 | volatile u_int events; | |
68 | volatile int power_state; | 68 | volatile int power_state; | |
69 | volatile int battery_state; | 69 | volatile int battery_state; | |
70 | volatile int ac_state; | 70 | volatile int ac_state; | |
71 | config_hook_tag sc_standby_hook; | 71 | config_hook_tag sc_standby_hook; | |
72 | config_hook_tag sc_suspend_hook; | 72 | config_hook_tag sc_suspend_hook; | |
73 | config_hook_tag sc_battery_hook; | 73 | config_hook_tag sc_battery_hook; | |
74 | config_hook_tag sc_ac_hook; | 74 | config_hook_tag sc_ac_hook; | |
75 | int battery_life; | 75 | int battery_life; | |
76 | int minutes_left; | 76 | int minutes_left; | |
77 | }; | 77 | }; | |
78 | 78 | |||
79 | static int zapm_match(struct device *, struct cfdata *, void *); | 79 | static int zapm_match(device_t, cfdata_t, void *); | |
80 | static void zapm_attach(struct device *, struct device *, void *); | 80 | static void zapm_attach(device_t, device_t, void *); | |
81 | 81 | |||
82 | CFATTACH_DECL(zapm, sizeof(struct zapm_softc), | 82 | CFATTACH_DECL_NEW(zapm, sizeof(struct zapm_softc), | |
83 | zapm_match, zapm_attach, NULL, NULL); | 83 | zapm_match, zapm_attach, NULL, NULL); | |
84 | 84 | |||
85 | static int zapm_hook(void *, int, long, void *); | 85 | static int zapm_hook(void *, int, long, void *); | |
86 | static void zapm_disconnect(void *); | 86 | static void zapm_disconnect(void *); | |
87 | static void zapm_enable(void *, int); | 87 | static void zapm_enable(void *, int); | |
88 | static int zapm_set_powstate(void *, u_int, u_int); | 88 | static int zapm_set_powstate(void *, u_int, u_int); | |
89 | static int zapm_get_powstat(void *, struct apm_power_info *); | 89 | static int zapm_get_powstat(void *, struct apm_power_info *); | |
90 | static int zapm_get_event(void *, u_int *, u_int *); | 90 | static int zapm_get_event(void *, u_int *, u_int *); | |
91 | static void zapm_cpu_busy(void *); | 91 | static void zapm_cpu_busy(void *); | |
92 | static void zapm_cpu_idle(void *); | 92 | static void zapm_cpu_idle(void *); | |
93 | static void zapm_get_capabilities(void *, u_int *, u_int *); | 93 | static void zapm_get_capabilities(void *, u_int *, u_int *); | |
94 | 94 | |||
95 | static struct apm_accessops zapm_accessops = { | 95 | static struct apm_accessops zapm_accessops = { | |
@@ -108,41 +108,44 @@ static int zapm_bcintr(void *); | @@ -108,41 +108,44 @@ static int zapm_bcintr(void *); | |||
108 | static void zapm_cyclic(void *); | 108 | static void zapm_cyclic(void *); | |
109 | static void zapm_poll(void *); | 109 | static void zapm_poll(void *); | |
110 | static void zapm_poll1(void *, int); | 110 | static void zapm_poll1(void *, int); | |
111 | 111 | |||
112 | /* battery-related GPIO pins */ | 112 | /* battery-related GPIO pins */ | |
113 | #define GPIO_AC_IN_C3000 115 /* 0=AC connected */ | 113 | #define GPIO_AC_IN_C3000 115 /* 0=AC connected */ | |
114 | #define GPIO_CHRG_CO_C3000 101 /* 1=battery full */ | 114 | #define GPIO_CHRG_CO_C3000 101 /* 1=battery full */ | |
115 | #define GPIO_BATT_COVER_C3000 90 /* 0=unlocked */ | 115 | #define GPIO_BATT_COVER_C3000 90 /* 0=unlocked */ | |
116 | 116 | |||
117 | /* Cyclic timer value */ | 117 | /* Cyclic timer value */ | |
118 | #define CYCLIC_TIME (60 * hz) /* 60s */ | 118 | #define CYCLIC_TIME (60 * hz) /* 60s */ | |
119 | 119 | |||
120 | static int | 120 | static int | |
121 | zapm_match(struct device *parent, struct cfdata *cf, void *aux) | 121 | zapm_match(device_t parent, cfdata_t cf, void *aux) | |
122 | { | 122 | { | |
123 | 123 | |||
124 | if (!ZAURUS_ISC3000) | 124 | if (!ZAURUS_ISC3000) | |
125 | return 0; | 125 | return 0; | |
126 | return 1; | 126 | return 1; | |
127 | } | 127 | } | |
128 | 128 | |||
129 | static void | 129 | static void | |
130 | zapm_attach(struct device *parent, struct device *self, void *aux) | 130 | zapm_attach(device_t parent, device_t self, void *aux) | |
131 | { | 131 | { | |
132 | struct zapm_softc *sc = device_private(self); | 132 | struct zapm_softc *sc = device_private(self); | |
133 | struct apmdev_attach_args aaa; | 133 | struct apmdev_attach_args aaa; | |
134 | 134 | |||
135 | sc->sc_dev = self; | |||
136 | ||||
135 | aprint_normal(": pseudo power management module\n"); | 137 | aprint_normal(": pseudo power management module\n"); | |
138 | aprint_naive("\n"); | |||
136 | 139 | |||
137 | /* machine-depent part */ | 140 | /* machine-depent part */ | |
138 | callout_init(&sc->sc_cyclic_poll, 0); | 141 | callout_init(&sc->sc_cyclic_poll, 0); | |
139 | callout_setfunc(&sc->sc_cyclic_poll, zapm_cyclic, sc); | 142 | callout_setfunc(&sc->sc_cyclic_poll, zapm_cyclic, sc); | |
140 | callout_init(&sc->sc_discharge_poll, 0); | 143 | callout_init(&sc->sc_discharge_poll, 0); | |
141 | callout_setfunc(&sc->sc_discharge_poll, zapm_poll, sc); | 144 | callout_setfunc(&sc->sc_discharge_poll, zapm_poll, sc); | |
142 | 145 | |||
143 | if (ZAURUS_ISC3000) { | 146 | if (ZAURUS_ISC3000) { | |
144 | sc->sc_ac_detect_pin = GPIO_AC_IN_C3000; | 147 | sc->sc_ac_detect_pin = GPIO_AC_IN_C3000; | |
145 | sc->sc_batt_cover_pin = GPIO_BATT_COVER_C3000; | 148 | sc->sc_batt_cover_pin = GPIO_BATT_COVER_C3000; | |
146 | sc->sc_charge_comp_pin = GPIO_CHRG_CO_C3000; | 149 | sc->sc_charge_comp_pin = GPIO_CHRG_CO_C3000; | |
147 | } else { | 150 | } else { | |
148 | /* XXX */ | 151 | /* XXX */ |
--- src/sys/arch/zaurus/dev/zssp.c 2007/10/17 19:58:35 1.3
+++ src/sys/arch/zaurus/dev/zssp.c 2009/01/29 12:28:15 1.4
@@ -1,103 +1,104 @@ | @@ -1,103 +1,104 @@ | |||
1 | /* $NetBSD: zssp.c,v 1.3 2007/10/17 19:58:35 garbled Exp $ */ | 1 | /* $NetBSD: zssp.c,v 1.4 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: zaurus_ssp.c,v 1.6 2005/04/08 21:58:49 uwe Exp $ */ | 2 | /* $OpenBSD: zaurus_ssp.c,v 1.6 2005/04/08 21:58:49 uwe Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> | 5 | * Copyright (c) 2005 Uwe Stuehler <uwe@bsdx.de> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | #include <sys/cdefs.h> | 20 | #include <sys/cdefs.h> | |
21 | __KERNEL_RCSID(0, "$NetBSD: zssp.c,v 1.3 2007/10/17 19:58:35 garbled Exp $"); | 21 | __KERNEL_RCSID(0, "$NetBSD: zssp.c,v 1.4 2009/01/29 12:28:15 nonaka Exp $"); | |
22 | 22 | |||
23 | #include <sys/param.h> | 23 | #include <sys/param.h> | |
24 | #include <sys/systm.h> | 24 | #include <sys/systm.h> | |
25 | #include <sys/device.h> | 25 | #include <sys/device.h> | |
26 | 26 | |||
27 | #include <machine/bus.h> | 27 | #include <machine/bus.h> | |
28 | 28 | |||
29 | #include <arm/xscale/pxa2x0reg.h> | 29 | #include <arm/xscale/pxa2x0reg.h> | |
30 | #include <arm/xscale/pxa2x0var.h> | 30 | #include <arm/xscale/pxa2x0var.h> | |
31 | #include <arm/xscale/pxa2x0_gpio.h> | 31 | #include <arm/xscale/pxa2x0_gpio.h> | |
32 | 32 | |||
33 | #include <zaurus/dev/zsspvar.h> | 33 | #include <zaurus/dev/zsspvar.h> | |
34 | #include <zaurus/zaurus/zaurus_var.h> | 34 | #include <zaurus/zaurus/zaurus_var.h> | |
35 | 35 | |||
36 | #define GPIO_ADS7846_CS_C3000 14 /* SSP SFRM */ | 36 | #define GPIO_ADS7846_CS_C3000 14 /* SSP SFRM */ | |
37 | #define GPIO_MAX1111_CS_C3000 20 | 37 | #define GPIO_MAX1111_CS_C3000 20 | |
38 | #define GPIO_TG_CS_C3000 53 | 38 | #define GPIO_TG_CS_C3000 53 | |
39 | 39 | |||
40 | #define SSCR0_ADS7846_C3000 0x06ab /* 12bit/Microwire/div by 7 */ | 40 | #define SSCR0_ADS7846_C3000 0x06ab /* 12bit/Microwire/div by 7 */ | |
41 | #define SSCR0_MAX1111 0x0387 | 41 | #define SSCR0_MAX1111 0x0387 | |
42 | #define SSCR0_LZ9JG18 0x01ab | 42 | #define SSCR0_LZ9JG18 0x01ab | |
43 | 43 | |||
44 | struct zssp_softc { | 44 | struct zssp_softc { | |
45 | struct device sc_dev; | 45 | device_t sc_dev; | |
46 | bus_space_tag_t sc_iot; | 46 | bus_space_tag_t sc_iot; | |
47 | bus_space_handle_t sc_ioh; | 47 | bus_space_handle_t sc_ioh; | |
48 | }; | 48 | }; | |
49 | 49 | |||
50 | static int zssp_match(struct device *, struct cfdata *, void *); | 50 | static int zssp_match(device_t, cfdata_t, void *); | |
51 | static void zssp_attach(struct device *, struct device *, void *); | 51 | static void zssp_attach(device_t, device_t, void *); | |
52 | 52 | |||
53 | CFATTACH_DECL(zssp, sizeof(struct zssp_softc), | 53 | CFATTACH_DECL_NEW(zssp, sizeof(struct zssp_softc), | |
54 | zssp_match, zssp_attach, NULL, NULL); | 54 | zssp_match, zssp_attach, NULL, NULL); | |
55 | 55 | |||
56 | static void zssp_init(void); | 56 | static void zssp_init(void); | |
57 | static void zssp_powerhook(int, void *); | 57 | static void zssp_powerhook(int, void *); | |
58 | 58 | |||
59 | static struct zssp_softc *zssp_sc; | 59 | static struct zssp_softc *zssp_sc; | |
60 | 60 | |||
61 | static int | 61 | static int | |
62 | zssp_match(struct device *parent, struct cfdata *cf, void *aux) | 62 | zssp_match(device_t parent, cfdata_t cf, void *aux) | |
63 | { | 63 | { | |
64 | 64 | |||
65 | if (zssp_sc != NULL) | 65 | if (zssp_sc != NULL) | |
66 | return 0; | 66 | return 0; | |
67 | 67 | |||
68 | return 1; | 68 | return 1; | |
69 | } | 69 | } | |
70 | 70 | |||
71 | static void | 71 | static void | |
72 | zssp_attach(struct device *parent, struct device *self, void *aux) | 72 | zssp_attach(device_t parent, device_t self, void *aux) | |
73 | { | 73 | { | |
74 | struct zssp_softc *sc = (struct zssp_softc *)self; | 74 | struct zssp_softc *sc = device_private(self); | |
75 | ||||
76 | sc->sc_dev = self; | |||
77 | zssp_sc = sc; | |||
78 | ||||
79 | aprint_normal("\n"); | |||
80 | aprint_naive("\n"); | |||
75 | 81 | |||
76 | sc->sc_iot = &pxa2x0_bs_tag; | 82 | sc->sc_iot = &pxa2x0_bs_tag; | |
77 | if (bus_space_map(sc->sc_iot, PXA2X0_SSP1_BASE, PXA2X0_SSP_SIZE, | 83 | if (bus_space_map(sc->sc_iot, PXA2X0_SSP1_BASE, PXA2X0_SSP_SIZE, | |
78 | 0, &sc->sc_ioh)) { | 84 | 0, &sc->sc_ioh)) { | |
79 | printf(": can't map bus space\n"); | 85 | aprint_error_dev(sc->sc_dev, "can't map bus space\n"); | |
80 | return; | 86 | return; | |
81 | } | 87 | } | |
82 | 88 | |||
83 | zssp_sc = sc; | 89 | if (powerhook_establish(device_xname(sc->sc_dev), zssp_powerhook, sc) | |
84 | ||||
85 | printf("\n"); | |||
86 | ||||
87 | if (powerhook_establish(sc->sc_dev.dv_xname, zssp_powerhook, sc) | |||
88 | == NULL) { | 90 | == NULL) { | |
89 | printf("%s: can't establish power hook\n", | 91 | aprint_error_dev(sc->sc_dev, "can't establish power hook\n"); | |
90 | sc->sc_dev.dv_xname); | |||
91 | } | 92 | } | |
92 | 93 | |||
93 | zssp_init(); | 94 | zssp_init(); | |
94 | } | 95 | } | |
95 | 96 | |||
96 | /* | 97 | /* | |
97 | * Initialize the dedicated SSP unit and disable all chip selects. | 98 | * Initialize the dedicated SSP unit and disable all chip selects. | |
98 | * This function is called with interrupts disabled. | 99 | * This function is called with interrupts disabled. | |
99 | */ | 100 | */ | |
100 | static void | 101 | static void | |
101 | zssp_init(void) | 102 | zssp_init(void) | |
102 | { | 103 | { | |
103 | struct zssp_softc *sc; | 104 | struct zssp_softc *sc; | |
@@ -201,37 +202,42 @@ zssp_ic_stop(int ic) | @@ -201,37 +202,42 @@ zssp_ic_stop(int ic) | |||
201 | pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000); | 202 | pxa2x0_gpio_set_bit(GPIO_TG_CS_C3000); | |
202 | pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000); | 203 | pxa2x0_gpio_set_bit(GPIO_MAX1111_CS_C3000); | |
203 | 204 | |||
204 | return rv; | 205 | return rv; | |
205 | } | 206 | } | |
206 | 207 | |||
207 | /* | 208 | /* | |
208 | * Activate one of the chip-select lines, transmit one word value in | 209 | * Activate one of the chip-select lines, transmit one word value in | |
209 | * each direction, and deactivate the chip-select again. | 210 | * each direction, and deactivate the chip-select again. | |
210 | */ | 211 | */ | |
211 | uint32_t | 212 | uint32_t | |
212 | zssp_ic_send(int ic, uint32_t data) | 213 | zssp_ic_send(int ic, uint32_t data) | |
213 | { | 214 | { | |
215 | struct zssp_softc *sc; | |||
216 | ||||
217 | KASSERT(zssp_sc != NULL); | |||
218 | sc = zssp_sc; | |||
214 | 219 | |||
215 | switch (ic) { | 220 | switch (ic) { | |
216 | case ZSSP_IC_MAX1111: | 221 | case ZSSP_IC_MAX1111: | |
217 | return (zssp_read_max1111(data)); | 222 | return (zssp_read_max1111(data)); | |
218 | case ZSSP_IC_ADS7846: | 223 | case ZSSP_IC_ADS7846: | |
219 | return (zssp_read_ads7846(data)); | 224 | return (zssp_read_ads7846(data)); | |
220 | case ZSSP_IC_LZ9JG18: | 225 | case ZSSP_IC_LZ9JG18: | |
221 | zssp_write_lz9jg18(data); | 226 | zssp_write_lz9jg18(data); | |
222 | return 0; | 227 | return 0; | |
223 | default: | 228 | default: | |
224 | printf("zssp_ic_send: invalid IC %d\n", ic); | 229 | aprint_error_dev(sc->sc_dev, | |
230 | "zssp_ic_send: invalid IC %d\n", ic); | |||
225 | return 0; | 231 | return 0; | |
226 | } | 232 | } | |
227 | } | 233 | } | |
228 | 234 | |||
229 | int | 235 | int | |
230 | zssp_read_max1111(uint32_t cmd) | 236 | zssp_read_max1111(uint32_t cmd) | |
231 | { | 237 | { | |
232 | struct zssp_softc *sc; | 238 | struct zssp_softc *sc; | |
233 | int voltage[2]; | 239 | int voltage[2]; | |
234 | int i; | 240 | int i; | |
235 | int s; | 241 | int s; | |
236 | 242 | |||
237 | KASSERT(zssp_sc != NULL); | 243 | KASSERT(zssp_sc != NULL); |
--- src/sys/arch/zaurus/dev/zusb.c 2009/01/28 14:15:56 1.3
+++ src/sys/arch/zaurus/dev/zusb.c 2009/01/29 12:28:15 1.4
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: zusb.c,v 1.3 2009/01/28 14:15:56 nonaka Exp $ */ | 1 | /* $NetBSD: zusb.c,v 1.4 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | 2 | |||
3 | /* | 3 | /* | |
4 | * Copyright (c) 2008 Christopher Gilbert | 4 | * Copyright (c) 2008 Christopher Gilbert | |
5 | * All rights reserved. | 5 | * All rights reserved. | |
6 | * | 6 | * | |
7 | * 1. Redistributions of source code must retain the above copyright | 7 | * 1. Redistributions of source code must retain the above copyright | |
8 | * notice, this list of conditions and the following disclaimer. | 8 | * notice, this list of conditions and the following disclaimer. | |
9 | * 2. Redistributions in binary form must reproduce the above copyright | 9 | * 2. Redistributions in binary form must reproduce the above copyright | |
10 | * notice, this list of conditions and the following disclaimer in the | 10 | * notice, this list of conditions and the following disclaimer in the | |
11 | * documentation and/or other materials provided with the distribution. | 11 | * documentation and/or other materials provided with the distribution. | |
12 | * 3. The name of the company nor the name of the author may be used to | 12 | * 3. The name of the company nor the name of the author may be used to | |
13 | * endorse or promote products derived from this software without specific | 13 | * endorse or promote products derived from this software without specific | |
14 | * prior written permission. | 14 | * prior written permission. | |
@@ -17,27 +17,27 @@ | @@ -17,27 +17,27 @@ | |||
17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | 17 | * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF | |
18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | 18 | * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. | |
19 | * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | 19 | * IN NO EVENT SHALL THE AUTHOR OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, | |
20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | 20 | * INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | |
21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | 21 | * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | |
22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | 22 | * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) | |
23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | 23 | * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT | |
24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | 24 | * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY | |
25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | 25 | * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF | |
26 | * SUCH DAMAGE. | 26 | * SUCH DAMAGE. | |
27 | */ | 27 | */ | |
28 | 28 | |||
29 | #include <sys/cdefs.h> | 29 | #include <sys/cdefs.h> | |
30 | __KERNEL_RCSID(0, "$NetBSD: zusb.c,v 1.3 2009/01/28 14:15:56 nonaka Exp $"); | 30 | __KERNEL_RCSID(0, "$NetBSD: zusb.c,v 1.4 2009/01/29 12:28:15 nonaka Exp $"); | |
31 | 31 | |||
32 | #include <sys/param.h> | 32 | #include <sys/param.h> | |
33 | #include <sys/device.h> | 33 | #include <sys/device.h> | |
34 | #include <sys/kernel.h> | 34 | #include <sys/kernel.h> | |
35 | 35 | |||
36 | #include <arm/xscale/pxa2x0reg.h> | 36 | #include <arm/xscale/pxa2x0reg.h> | |
37 | #include <arm/xscale/pxa2x0var.h> | 37 | #include <arm/xscale/pxa2x0var.h> | |
38 | #include <arm/xscale/pxa2x0_gpio.h> | 38 | #include <arm/xscale/pxa2x0_gpio.h> | |
39 | 39 | |||
40 | #include <machine/intr.h> | 40 | #include <machine/intr.h> | |
41 | #include <machine/bus.h> | 41 | #include <machine/bus.h> | |
42 | 42 | |||
43 | #include <zaurus/zaurus/zaurus_reg.h> | 43 | #include <zaurus/zaurus/zaurus_reg.h> | |
@@ -51,52 +51,53 @@ __KERNEL_RCSID(0, "$NetBSD: zusb.c,v 1.3 | @@ -51,52 +51,53 @@ __KERNEL_RCSID(0, "$NetBSD: zusb.c,v 1.3 | |||
51 | #endif | 51 | #endif | |
52 | 52 | |||
53 | 53 | |||
54 | struct zusb_softc { | 54 | struct zusb_softc { | |
55 | device_t sc_dev; | 55 | device_t sc_dev; | |
56 | 56 | |||
57 | bus_space_tag_t sc_iot; | 57 | bus_space_tag_t sc_iot; | |
58 | bus_space_handle_t sc_ioh; | 58 | bus_space_handle_t sc_ioh; | |
59 | 59 | |||
60 | void *sc_client_ih; | 60 | void *sc_client_ih; | |
61 | void *sc_host_ih; | 61 | void *sc_host_ih; | |
62 | }; | 62 | }; | |
63 | 63 | |||
64 | static int zusb_match(struct device *, struct cfdata *, void *); | 64 | static int zusb_match(device_t, cfdata_t, void *); | |
65 | static void zusb_attach(struct device *, struct device *, void *); | 65 | static void zusb_attach(device_t, device_t, void *); | |
66 | 66 | |||
67 | CFATTACH_DECL_NEW(zusb, sizeof(struct zusb_softc), | 67 | CFATTACH_DECL_NEW(zusb, sizeof(struct zusb_softc), | |
68 | zusb_match, zusb_attach, NULL, NULL); | 68 | zusb_match, zusb_attach, NULL, NULL); | |
69 | 69 | |||
70 | static int zusb_client_intr(void *); | 70 | static int zusb_client_intr(void *); | |
71 | static int zusb_host_intr(void *); | 71 | static int zusb_host_intr(void *); | |
72 | static void zusb_test_and_enabled_host_port(struct zusb_softc *); | 72 | static void zusb_test_and_enabled_host_port(struct zusb_softc *); | |
73 | 73 | |||
74 | static int | 74 | static int | |
75 | zusb_match(device_t parent, cfdata_t cf, void *aux) | 75 | zusb_match(device_t parent, cfdata_t cf, void *aux) | |
76 | { | 76 | { | |
77 | 77 | |||
78 | if (ZAURUS_ISC3000) | 78 | if (ZAURUS_ISC3000) | |
79 | return 1; | 79 | return 1; | |
80 | return 0; | 80 | return 0; | |
81 | } | 81 | } | |
82 | 82 | |||
83 | static void | 83 | static void | |
84 | zusb_attach(device_t parent, device_t self, void *aux) | 84 | zusb_attach(device_t parent, device_t self, void *aux) | |
85 | { | 85 | { | |
86 | struct zusb_softc *sc = device_private(self); | 86 | struct zusb_softc *sc = device_private(self); | |
87 | struct pxaip_attach_args *pxa = aux; | 87 | struct pxaip_attach_args *pxa = aux; | |
88 | 88 | |||
89 | aprint_normal(": USB Mode detection\n"); | 89 | aprint_normal(": USB Mode detection\n"); | |
90 | aprint_naive("\n"); | |||
90 | 91 | |||
91 | sc->sc_dev = self; | 92 | sc->sc_dev = self; | |
92 | sc->sc_iot = pxa->pxa_iot; | 93 | sc->sc_iot = pxa->pxa_iot; | |
93 | 94 | |||
94 | /* Map I/O space */ | 95 | /* Map I/O space */ | |
95 | if (bus_space_map(sc->sc_iot, PXA2X0_USBDC_BASE, PXA270_USBDC_SIZE, 0, | 96 | if (bus_space_map(sc->sc_iot, PXA2X0_USBDC_BASE, PXA270_USBDC_SIZE, 0, | |
96 | &sc->sc_ioh)) { | 97 | &sc->sc_ioh)) { | |
97 | aprint_error_dev(sc->sc_dev, "couldn't map memory space\n"); | 98 | aprint_error_dev(sc->sc_dev, "couldn't map memory space\n"); | |
98 | return; | 99 | return; | |
99 | } | 100 | } | |
100 | 101 | |||
101 | pxa2x0_gpio_set_function(C3000_USB_DEVICE_PIN, GPIO_IN); | 102 | pxa2x0_gpio_set_function(C3000_USB_DEVICE_PIN, GPIO_IN); | |
102 | sc->sc_client_ih = pxa2x0_gpio_intr_establish(C3000_USB_DEVICE_PIN, | 103 | sc->sc_client_ih = pxa2x0_gpio_intr_establish(C3000_USB_DEVICE_PIN, |
--- src/sys/arch/zaurus/dev/zkbd.c 2007/10/17 19:58:34 1.7
+++ src/sys/arch/zaurus/dev/zkbd.c 2009/01/29 12:28:15 1.8
@@ -1,34 +1,34 @@ | @@ -1,34 +1,34 @@ | |||
1 | /* $NetBSD: zkbd.c,v 1.7 2007/10/17 19:58:34 garbled Exp $ */ | 1 | /* $NetBSD: zkbd.c,v 1.8 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: zaurus_kbd.c,v 1.28 2005/12/21 20:36:03 deraadt Exp $ */ | 2 | /* $OpenBSD: zaurus_kbd.c,v 1.28 2005/12/21 20:36:03 deraadt Exp $ */ | |
3 | 3 | |||
4 | /* | 4 | /* | |
5 | * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> | 5 | * Copyright (c) 2005 Dale Rahn <drahn@openbsd.org> | |
6 | * | 6 | * | |
7 | * Permission to use, copy, modify, and distribute this software for any | 7 | * Permission to use, copy, modify, and distribute this software for any | |
8 | * purpose with or without fee is hereby granted, provided that the above | 8 | * purpose with or without fee is hereby granted, provided that the above | |
9 | * copyright notice and this permission notice appear in all copies. | 9 | * copyright notice and this permission notice appear in all copies. | |
10 | * | 10 | * | |
11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | 11 | * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES | |
12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | 12 | * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF | |
13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | 13 | * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR | |
14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | 14 | * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES | |
15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | 15 | * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN | |
16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | 16 | * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF | |
17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | 17 | * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. | |
18 | */ | 18 | */ | |
19 | 19 | |||
20 | #include <sys/cdefs.h> | 20 | #include <sys/cdefs.h> | |
21 | __KERNEL_RCSID(0, "$NetBSD: zkbd.c,v 1.7 2007/10/17 19:58:34 garbled Exp $"); | 21 | __KERNEL_RCSID(0, "$NetBSD: zkbd.c,v 1.8 2009/01/29 12:28:15 nonaka Exp $"); | |
22 | 22 | |||
23 | #include "opt_wsdisplay_compat.h" | 23 | #include "opt_wsdisplay_compat.h" | |
24 | #include "lcd.h" | 24 | #include "lcd.h" | |
25 | #if 0 /* XXX */ | 25 | #if 0 /* XXX */ | |
26 | #include "apm.h" | 26 | #include "apm.h" | |
27 | #endif | 27 | #endif | |
28 | 28 | |||
29 | #include <sys/param.h> | 29 | #include <sys/param.h> | |
30 | #include <sys/systm.h> | 30 | #include <sys/systm.h> | |
31 | #include <sys/device.h> | 31 | #include <sys/device.h> | |
32 | #include <sys/malloc.h> | 32 | #include <sys/malloc.h> | |
33 | #include <sys/kernel.h> | 33 | #include <sys/kernel.h> | |
34 | #include <sys/proc.h> | 34 | #include <sys/proc.h> | |
@@ -73,27 +73,27 @@ static const int gpio_strobe_pins_c3000[ | @@ -73,27 +73,27 @@ static const int gpio_strobe_pins_c3000[ | |||
73 | }; | 73 | }; | |
74 | 74 | |||
75 | static const int stuck_keys[] = { | 75 | static const int stuck_keys[] = { | |
76 | 7, | 76 | 7, | |
77 | 15, | 77 | 15, | |
78 | 23, | 78 | 23, | |
79 | 31 | 79 | 31 | |
80 | }; | 80 | }; | |
81 | 81 | |||
82 | #define REP_DELAY1 400 | 82 | #define REP_DELAY1 400 | |
83 | #define REP_DELAYN 100 | 83 | #define REP_DELAYN 100 | |
84 | 84 | |||
85 | struct zkbd_softc { | 85 | struct zkbd_softc { | |
86 | struct device sc_dev; | 86 | device_t sc_dev; | |
87 | 87 | |||
88 | const int *sc_sense_array; | 88 | const int *sc_sense_array; | |
89 | const int *sc_strobe_array; | 89 | const int *sc_strobe_array; | |
90 | int sc_nsense; | 90 | int sc_nsense; | |
91 | int sc_nstrobe; | 91 | int sc_nstrobe; | |
92 | 92 | |||
93 | short sc_onkey_pin; | 93 | short sc_onkey_pin; | |
94 | short sc_sync_pin; | 94 | short sc_sync_pin; | |
95 | short sc_swa_pin; | 95 | short sc_swa_pin; | |
96 | short sc_swb_pin; | 96 | short sc_swb_pin; | |
97 | char *sc_okeystate; | 97 | char *sc_okeystate; | |
98 | char *sc_keystate; | 98 | char *sc_keystate; | |
99 | char sc_hinge; /* 0=open, 1=nonsense, 2=backwards, 3=closed */ | 99 | char sc_hinge; /* 0=open, 1=nonsense, 2=backwards, 3=closed */ | |
@@ -111,30 +111,30 @@ struct zkbd_softc { | @@ -111,30 +111,30 @@ struct zkbd_softc { | |||
111 | int sc_rawkbd; | 111 | int sc_rawkbd; | |
112 | #ifdef WSDISPLAY_COMPAT_RAWKBD | 112 | #ifdef WSDISPLAY_COMPAT_RAWKBD | |
113 | const char *sc_xt_keymap; | 113 | const char *sc_xt_keymap; | |
114 | struct callout sc_rawrepeat_ch; | 114 | struct callout sc_rawrepeat_ch; | |
115 | #define MAXKEYS 20 | 115 | #define MAXKEYS 20 | |
116 | char sc_rep[MAXKEYS]; | 116 | char sc_rep[MAXKEYS]; | |
117 | int sc_nrep; | 117 | int sc_nrep; | |
118 | #endif | 118 | #endif | |
119 | void *sc_powerhook; | 119 | void *sc_powerhook; | |
120 | }; | 120 | }; | |
121 | 121 | |||
122 | static struct zkbd_softc *zkbd_sc; | 122 | static struct zkbd_softc *zkbd_sc; | |
123 | 123 | |||
124 | static int zkbd_match(struct device *, struct cfdata *, void *); | 124 | static int zkbd_match(device_t, cfdata_t, void *); | |
125 | static void zkbd_attach(struct device *, struct device *, void *); | 125 | static void zkbd_attach(device_t, device_t, void *); | |
126 | 126 | |||
127 | CFATTACH_DECL(zkbd, sizeof(struct zkbd_softc), | 127 | CFATTACH_DECL_NEW(zkbd, sizeof(struct zkbd_softc), | |
128 | zkbd_match, zkbd_attach, NULL, NULL); | 128 | zkbd_match, zkbd_attach, NULL, NULL); | |
129 | 129 | |||
130 | static int zkbd_irq(void *v); | 130 | static int zkbd_irq(void *v); | |
131 | static void zkbd_poll(void *v); | 131 | static void zkbd_poll(void *v); | |
132 | static int zkbd_on(void *v); | 132 | static int zkbd_on(void *v); | |
133 | static int zkbd_sync(void *v); | 133 | static int zkbd_sync(void *v); | |
134 | static int zkbd_hinge(void *v); | 134 | static int zkbd_hinge(void *v); | |
135 | static void zkbd_power(int why, void *arg); | 135 | static void zkbd_power(int why, void *arg); | |
136 | 136 | |||
137 | int zkbd_modstate; | 137 | int zkbd_modstate; | |
138 | 138 | |||
139 | static int zkbd_enable(void *, int); | 139 | static int zkbd_enable(void *, int); | |
140 | static void zkbd_set_leds(void *, int); | 140 | static void zkbd_set_leds(void *, int); | |
@@ -153,45 +153,47 @@ static void zkbd_cngetc(void *, u_int *, | @@ -153,45 +153,47 @@ static void zkbd_cngetc(void *, u_int *, | |||
153 | static void zkbd_cnpollc(void *, int); | 153 | static void zkbd_cnpollc(void *, int); | |
154 | 154 | |||
155 | static struct wskbd_consops zkbd_consops = { | 155 | static struct wskbd_consops zkbd_consops = { | |
156 | zkbd_cngetc, | 156 | zkbd_cngetc, | |
157 | zkbd_cnpollc, | 157 | zkbd_cnpollc, | |
158 | }; | 158 | }; | |
159 | 159 | |||
160 | static struct wskbd_mapdata zkbd_keymapdata = { | 160 | static struct wskbd_mapdata zkbd_keymapdata = { | |
161 | zkbd_keydesctab, | 161 | zkbd_keydesctab, | |
162 | KB_US, | 162 | KB_US, | |
163 | }; | 163 | }; | |
164 | 164 | |||
165 | static int | 165 | static int | |
166 | zkbd_match(struct device *parent, struct cfdata *cf, void *aux) | 166 | zkbd_match(device_t parent, cfdata_t cf, void *aux) | |
167 | { | 167 | { | |
168 | 168 | |||
169 | if (zkbd_sc) | 169 | if (zkbd_sc) | |
170 | return 0; | 170 | return 0; | |
171 | 171 | |||
172 | return 1; | 172 | return 1; | |
173 | } | 173 | } | |
174 | 174 | |||
175 | static void | 175 | static void | |
176 | zkbd_attach(struct device *parent, struct device *self, void *aux) | 176 | zkbd_attach(device_t parent, device_t self, void *aux) | |
177 | { | 177 | { | |
178 | struct zkbd_softc *sc = (struct zkbd_softc *)self; | 178 | struct zkbd_softc *sc = device_private(self); | |
179 | struct wskbddev_attach_args a; | 179 | struct wskbddev_attach_args a; | |
180 | int pin, i; | 180 | int pin, i; | |
181 | 181 | |||
182 | sc->sc_dev = self; | |||
182 | zkbd_sc = sc; | 183 | zkbd_sc = sc; | |
183 | 184 | |||
184 | printf("\n"); | 185 | aprint_normal("\n"); | |
186 | aprint_naive("\n"); | |||
185 | 187 | |||
186 | sc->sc_polling = 0; | 188 | sc->sc_polling = 0; | |
187 | #ifdef WSDISPLAY_COMPAT_RAWKBD | 189 | #ifdef WSDISPLAY_COMPAT_RAWKBD | |
188 | sc->sc_rawkbd = 0; | 190 | sc->sc_rawkbd = 0; | |
189 | #endif | 191 | #endif | |
190 | 192 | |||
191 | callout_init(&sc->sc_roll_to, 0); | 193 | callout_init(&sc->sc_roll_to, 0); | |
192 | callout_setfunc(&sc->sc_roll_to, zkbd_poll, sc); | 194 | callout_setfunc(&sc->sc_roll_to, zkbd_poll, sc); | |
193 | #ifdef WSDISPLAY_COMPAT_RAWKBD | 195 | #ifdef WSDISPLAY_COMPAT_RAWKBD | |
194 | callout_init(&sc->sc_rawrepeat_ch, 0); | 196 | callout_init(&sc->sc_rawrepeat_ch, 0); | |
195 | callout_setfunc(&sc->sc_rawrepeat_ch, zkbd_rawrepeat, sc); | 197 | callout_setfunc(&sc->sc_rawrepeat_ch, zkbd_rawrepeat, sc); | |
196 | #endif | 198 | #endif | |
197 | 199 | |||
@@ -203,31 +205,30 @@ zkbd_attach(struct device *parent, struc | @@ -203,31 +205,30 @@ zkbd_attach(struct device *parent, struc | |||
203 | sc->sc_maxkbdcol = 10; | 205 | sc->sc_maxkbdcol = 10; | |
204 | sc->sc_onkey_pin = 95; | 206 | sc->sc_onkey_pin = 95; | |
205 | sc->sc_sync_pin = 16; | 207 | sc->sc_sync_pin = 16; | |
206 | sc->sc_swa_pin = 97; | 208 | sc->sc_swa_pin = 97; | |
207 | sc->sc_swb_pin = 96; | 209 | sc->sc_swb_pin = 96; | |
208 | #ifdef WSDISPLAY_COMPAT_RAWKBD | 210 | #ifdef WSDISPLAY_COMPAT_RAWKBD | |
209 | sc->sc_xt_keymap = xt_keymap; | 211 | sc->sc_xt_keymap = xt_keymap; | |
210 | #endif | 212 | #endif | |
211 | } else { | 213 | } else { | |
212 | /* XXX */ | 214 | /* XXX */ | |
213 | return; | 215 | return; | |
214 | } | 216 | } | |
215 | 217 | |||
216 | sc->sc_powerhook = powerhook_establish(sc->sc_dev.dv_xname, | 218 | sc->sc_powerhook = powerhook_establish(device_xname(sc->sc_dev), | |
217 | zkbd_power, sc); | 219 | zkbd_power, sc); | |
218 | if (sc->sc_powerhook == NULL) { | 220 | if (sc->sc_powerhook == NULL) { | |
219 | printf("%s: unable to establish powerhook\n", | 221 | aprint_error_dev(sc->sc_dev, "unable to establish powerhook\n"); | |
220 | sc->sc_dev.dv_xname); | |||
221 | return; | 222 | return; | |
222 | } | 223 | } | |
223 | 224 | |||
224 | sc->sc_okeystate = malloc(sc->sc_nsense * sc->sc_nstrobe, | 225 | sc->sc_okeystate = malloc(sc->sc_nsense * sc->sc_nstrobe, | |
225 | M_DEVBUF, M_NOWAIT); | 226 | M_DEVBUF, M_NOWAIT); | |
226 | memset(sc->sc_okeystate, 0, sc->sc_nsense * sc->sc_nstrobe); | 227 | memset(sc->sc_okeystate, 0, sc->sc_nsense * sc->sc_nstrobe); | |
227 | 228 | |||
228 | sc->sc_keystate = malloc(sc->sc_nsense * sc->sc_nstrobe, | 229 | sc->sc_keystate = malloc(sc->sc_nsense * sc->sc_nstrobe, | |
229 | M_DEVBUF, M_NOWAIT); | 230 | M_DEVBUF, M_NOWAIT); | |
230 | memset(sc->sc_keystate, 0, sc->sc_nsense * sc->sc_nstrobe); | 231 | memset(sc->sc_keystate, 0, sc->sc_nsense * sc->sc_nstrobe); | |
231 | 232 | |||
232 | /* set all the strobe bits */ | 233 | /* set all the strobe bits */ | |
233 | for (i = 0; i < sc->sc_nstrobe; i++) { | 234 | for (i = 0; i < sc->sc_nstrobe; i++) { |
--- src/sys/arch/zaurus/dev/zlcd.c 2007/10/17 19:58:35 1.7
+++ src/sys/arch/zaurus/dev/zlcd.c 2009/01/29 12:28:15 1.8
@@ -1,14 +1,14 @@ | @@ -1,14 +1,14 @@ | |||
1 | /* $NetBSD: zlcd.c,v 1.7 2007/10/17 19:58:35 garbled Exp $ */ | 1 | /* $NetBSD: zlcd.c,v 1.8 2009/01/29 12:28:15 nonaka Exp $ */ | |
2 | /* $OpenBSD: zaurus_lcd.c,v 1.20 2006/06/02 20:50:14 miod Exp $ */ | 2 | /* $OpenBSD: zaurus_lcd.c,v 1.20 2006/06/02 20:50:14 miod Exp $ */ | |
3 | /* NetBSD: lubbock_lcd.c,v 1.1 2003/08/09 19:38:53 bsh Exp */ | 3 | /* NetBSD: lubbock_lcd.c,v 1.1 2003/08/09 19:38:53 bsh Exp */ | |
4 | 4 | |||
5 | /* | 5 | /* | |
6 | * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. | 6 | * Copyright (c) 2002, 2003 Genetec Corporation. All rights reserved. | |
7 | * Written by Hiroyuki Bessho for Genetec Corporation. | 7 | * Written by Hiroyuki Bessho for Genetec Corporation. | |
8 | * | 8 | * | |
9 | * Redistribution and use in source and binary forms, with or without | 9 | * Redistribution and use in source and binary forms, with or without | |
10 | * modification, are permitted provided that the following conditions | 10 | * modification, are permitted provided that the following conditions | |
11 | * are met: | 11 | * are met: | |
12 | * 1. Redistributions of source code must retain the above copyright | 12 | * 1. Redistributions of source code must retain the above copyright | |
13 | * notice, this list of conditions and the following disclaimer. | 13 | * notice, this list of conditions and the following disclaimer. | |
14 | * 2. Redistributions in binary form must reproduce the above copyright | 14 | * 2. Redistributions in binary form must reproduce the above copyright | |
@@ -33,27 +33,27 @@ | @@ -33,27 +33,27 @@ | |||
33 | 33 | |||
34 | /* | 34 | /* | |
35 | * LCD driver for Sharp Zaurus (based on the Intel Lubbock driver). | 35 | * LCD driver for Sharp Zaurus (based on the Intel Lubbock driver). | |
36 | * | 36 | * | |
37 | * Controlling LCD is almost completely done through PXA2X0's | 37 | * Controlling LCD is almost completely done through PXA2X0's | |
38 | * integrated LCD controller. Codes for it is arm/xscale/pxa2x0_lcd.c. | 38 | * integrated LCD controller. Codes for it is arm/xscale/pxa2x0_lcd.c. | |
39 | * | 39 | * | |
40 | * Codes in this file provide platform specific things including: | 40 | * Codes in this file provide platform specific things including: | |
41 | * LCD on/off switch and backlight brightness | 41 | * LCD on/off switch and backlight brightness | |
42 | * LCD panel geometry | 42 | * LCD panel geometry | |
43 | */ | 43 | */ | |
44 | 44 | |||
45 | #include <sys/cdefs.h> | 45 | #include <sys/cdefs.h> | |
46 | __KERNEL_RCSID(0, "$NetBSD: zlcd.c,v 1.7 2007/10/17 19:58:35 garbled Exp $"); | 46 | __KERNEL_RCSID(0, "$NetBSD: zlcd.c,v 1.8 2009/01/29 12:28:15 nonaka Exp $"); | |
47 | 47 | |||
48 | #include <sys/param.h> | 48 | #include <sys/param.h> | |
49 | #include <sys/systm.h> | 49 | #include <sys/systm.h> | |
50 | #include <sys/conf.h> | 50 | #include <sys/conf.h> | |
51 | #include <sys/uio.h> | 51 | #include <sys/uio.h> | |
52 | #include <sys/malloc.h> | 52 | #include <sys/malloc.h> | |
53 | 53 | |||
54 | #include <dev/cons.h> | 54 | #include <dev/cons.h> | |
55 | #include <dev/wscons/wsconsio.h> | 55 | #include <dev/wscons/wsconsio.h> | |
56 | #include <dev/wscons/wsdisplayvar.h> | 56 | #include <dev/wscons/wsdisplayvar.h> | |
57 | #include <dev/wscons/wscons_callbacks.h> | 57 | #include <dev/wscons/wscons_callbacks.h> | |
58 | 58 | |||
59 | #include <dev/hpc/hpcfbio.h> | 59 | #include <dev/hpc/hpcfbio.h> | |
@@ -138,68 +138,70 @@ struct sharp_lcd_backlight { | @@ -138,68 +138,70 @@ struct sharp_lcd_backlight { | |||
138 | #define CURRENT_BACKLIGHT sharp_zaurus_C3000_bl | 138 | #define CURRENT_BACKLIGHT sharp_zaurus_C3000_bl | |
139 | 139 | |||
140 | const struct sharp_lcd_backlight sharp_zaurus_C3000_bl[] = { | 140 | const struct sharp_lcd_backlight sharp_zaurus_C3000_bl[] = { | |
141 | { 0x00, 0, 0 }, /* 0: Off */ | 141 | { 0x00, 0, 0 }, /* 0: Off */ | |
142 | { 0x00, 0, 1 }, /* 1: 0% */ | 142 | { 0x00, 0, 1 }, /* 1: 0% */ | |
143 | { 0x01, 0, 1 }, /* 2: 20% */ | 143 | { 0x01, 0, 1 }, /* 2: 20% */ | |
144 | { 0x07, 0, 1 }, /* 3: 40% */ | 144 | { 0x07, 0, 1 }, /* 3: 40% */ | |
145 | { 0x01, 1, 1 }, /* 4: 60% */ | 145 | { 0x01, 1, 1 }, /* 4: 60% */ | |
146 | { 0x07, 1, 1 }, /* 5: 80% */ | 146 | { 0x07, 1, 1 }, /* 5: 80% */ | |
147 | { 0x11, 1, 1 }, /* 6: 100% */ | 147 | { 0x11, 1, 1 }, /* 6: 100% */ | |
148 | { -1, -1, -1 }, /* 7: Invalid */ | 148 | { -1, -1, -1 }, /* 7: Invalid */ | |
149 | }; | 149 | }; | |
150 | 150 | |||
151 | static int lcd_match(struct device *, struct cfdata *, void *); | 151 | static int lcd_match(device_t, cfdata_t, void *); | |
152 | static void lcd_attach(struct device *, struct device *, void *); | 152 | static void lcd_attach(device_t, device_t, void *); | |
153 | 153 | |||
154 | CFATTACH_DECL(zlcd, sizeof(struct pxa2x0_lcd_softc), | 154 | CFATTACH_DECL_NEW(zlcd, sizeof(struct pxa2x0_lcd_softc), | |
155 | lcd_match, lcd_attach, NULL, NULL); | 155 | lcd_match, lcd_attach, NULL, NULL); | |
156 | 156 | |||
157 | void lcd_cnattach(void); | 157 | void lcd_cnattach(void); | |
158 | int lcd_max_brightness(void); | 158 | int lcd_max_brightness(void); | |
159 | int lcd_get_brightness(void); | 159 | int lcd_get_brightness(void); | |
160 | void lcd_set_brightness(int); | 160 | void lcd_set_brightness(int); | |
161 | void lcd_set_brightness_internal(int); | 161 | void lcd_set_brightness_internal(int); | |
162 | int lcd_get_backlight(void); | 162 | int lcd_get_backlight(void); | |
163 | void lcd_set_backlight(int); | 163 | void lcd_set_backlight(int); | |
164 | void lcd_blank(int); | 164 | void lcd_blank(int); | |
165 | void lcd_power(int, void *); | 165 | void lcd_power(int, void *); | |
166 | 166 | |||
167 | static int | 167 | static int | |
168 | lcd_match(struct device *parent, struct cfdata *cf, void *aux) | 168 | lcd_match(device_t parent, cfdata_t cf, void *aux) | |
169 | { | 169 | { | |
170 | 170 | |||
171 | return 1; | 171 | return 1; | |
172 | } | 172 | } | |
173 | 173 | |||
174 | static void | 174 | static void | |
175 | lcd_attach(struct device *parent, struct device *self, void *aux) | 175 | lcd_attach(device_t parent, device_t self, void *aux) | |
176 | { | 176 | { | |
177 | struct pxa2x0_lcd_softc *sc = (struct pxa2x0_lcd_softc *)self; | 177 | struct pxa2x0_lcd_softc *sc = device_private(self); | |
178 | struct wsemuldisplaydev_attach_args aa; | 178 | struct wsemuldisplaydev_attach_args aa; | |
179 | 179 | |||
180 | sc->dev = self; | |||
181 | ||||
180 | pxa2x0_lcd_attach_sub(sc, aux, CURRENT_DISPLAY); | 182 | pxa2x0_lcd_attach_sub(sc, aux, CURRENT_DISPLAY); | |
181 | 183 | |||
182 | aa.console = glass_console; | 184 | aa.console = glass_console; | |
183 | aa.scrdata = &lcd_screen_list; | 185 | aa.scrdata = &lcd_screen_list; | |
184 | aa.accessops = &lcd_accessops; | 186 | aa.accessops = &lcd_accessops; | |
185 | aa.accesscookie = sc; | 187 | aa.accesscookie = sc; | |
186 | 188 | |||
187 | (void) config_found(self, &aa, wsemuldisplaydevprint); | 189 | (void) config_found(self, &aa, wsemuldisplaydevprint); | |
188 | 190 | |||
189 | /* Start with approximately 40% of full brightness. */ | 191 | /* Start with approximately 40% of full brightness. */ | |
190 | lcd_set_brightness(3); | 192 | lcd_set_brightness(3); | |
191 | 193 | |||
192 | (void) powerhook_establish(sc->dev.dv_xname, lcd_power, sc); | 194 | (void) powerhook_establish(device_xname(sc->dev), lcd_power, sc); | |
193 | } | 195 | } | |
194 | 196 | |||
195 | void | 197 | void | |
196 | lcd_cnattach(void) | 198 | lcd_cnattach(void) | |
197 | { | 199 | { | |
198 | 200 | |||
199 | pxa2x0_lcd_cnattach(&lcd_std_screen, CURRENT_DISPLAY); | 201 | pxa2x0_lcd_cnattach(&lcd_std_screen, CURRENT_DISPLAY); | |
200 | } | 202 | } | |
201 | 203 | |||
202 | /* | 204 | /* | |
203 | * wsdisplay accessops overrides | 205 | * wsdisplay accessops overrides | |
204 | */ | 206 | */ | |
205 | static int | 207 | static int |