Lines Matching +full:sense +full:- +full:mode
2 * valkyriefb.c -- frame buffer device for the PowerMac 'valkyrie' display
7 * Vmode-switching changes and vmode 15/17 modifications created 29 August
10 * Ported to m68k Macintosh by David Huggins-Daines <dhd@debian.org>
14 * controlfb.c -- frame buffer device for the PowerMac 'control' display
17 * pmc-valkyrie.c -- Console support for PowerMac "valkyrie" display adaptor.
23 * drivers/video/chipsfb.c -- frame buffer device for
30 * And from the frame buffer device for Open Firmware-initialized devices:
88 int sense; member
127 /* Sets the video mode according to info->var */
132 volatile struct valkyrie_regs __iomem *valkyrie_regs = p->valkyrie_regs; in valkyriefb_set_par()
133 struct fb_par_valkyrie *par = info->par; in valkyriefb_set_par()
137 if ((err = valkyrie_var_to_par(&info->var, par, info))) in valkyriefb_set_par()
140 valkyrie_par_to_fix(par, &info->fix); in valkyriefb_set_par()
143 out_8(&valkyrie_regs->status.r, 0); in valkyriefb_set_par()
147 init = par->init; in valkyriefb_set_par()
148 out_8(&valkyrie_regs->mode.r, init->mode | 0x80); in valkyriefb_set_par()
149 out_8(&valkyrie_regs->depth.r, par->cmode + 3); in valkyriefb_set_par()
150 set_valkyrie_clock(init->clock_params); in valkyriefb_set_par()
154 out_8(&valkyrie_regs->mode.r, init->mode); in valkyriefb_set_par()
162 return mac_vmode_to_var(par->vmode, par->cmode, var); in valkyrie_par_to_var()
180 * black. Return 0 if blanking succeeded, != 0 if un-/blanking failed due
181 * to e.g. a video mode which doesn't support it. Implements VESA suspend
191 struct fb_par_valkyrie *par = info->par; in valkyriefb_blank()
192 struct valkyrie_regvals *init = par->init; in valkyriefb_blank()
199 out_8(&p->valkyrie_regs->mode.r, init->mode); in valkyriefb_blank()
210 out_8(&p->valkyrie_regs->mode.r, init->mode | 0x40); in valkyriefb_blank()
213 out_8(&p->valkyrie_regs->mode.r, 0x66); in valkyriefb_blank()
224 volatile struct cmap_regs __iomem *cmap_regs = p->cmap_regs; in valkyriefb_setcolreg()
225 struct fb_par_valkyrie *par = info->par; in valkyriefb_setcolreg()
234 out_8(&p->cmap_regs->addr, regno); in valkyriefb_setcolreg()
237 out_8(&cmap_regs->lut, red); in valkyriefb_setcolreg()
238 out_8(&cmap_regs->lut, green); in valkyriefb_setcolreg()
239 out_8(&cmap_regs->lut, blue); in valkyriefb_setcolreg()
241 if (regno < 16 && par->cmode == CMODE_16) in valkyriefb_setcolreg()
242 ((u32 *)info->pseudo_palette)[regno] = in valkyriefb_setcolreg()
251 struct valkyrie_regvals *init = valkyrie_reg_init[video_mode-1]; in valkyrie_vram_reqd()
253 if ((pitch = init->pitch[color_mode]) == 0) in valkyrie_vram_reqd()
254 pitch = 2 * init->pitch[0]; in valkyrie_vram_reqd()
255 return init->vres * pitch; in valkyrie_vram_reqd()
275 p->sense = read_valkyrie_sense(p); in valkyrie_choose_mode()
276 printk(KERN_INFO "Monitor sense value = 0x%x\n", p->sense); in valkyrie_choose_mode()
278 /* Try to pick a video mode out of NVRAM if we have one. */ in valkyrie_choose_mode()
284 !valkyrie_reg_init[default_vmode - 1]) { in valkyrie_choose_mode()
285 default_vmode = mac_map_monitor_sense(p->sense); in valkyrie_choose_mode()
286 if (!valkyrie_reg_init[default_vmode - 1]) in valkyrie_choose_mode()
298 || valkyrie_reg_init[default_vmode-1]->pitch[default_cmode] == 0 in valkyrie_choose_mode()
299 || valkyrie_vram_reqd(default_vmode, default_cmode) > p->total_vram) in valkyrie_choose_mode()
302 printk(KERN_INFO "using video mode %d and color mode %d.\n", in valkyrie_choose_mode()
314 return -ENODEV; in valkyriefb_init()
319 return -ENODEV; in valkyriefb_init()
323 return -ENODEV; in valkyriefb_init()
325 /* Hardcoded addresses... welcome to 68k Macintosh country :-) */ in valkyriefb_init()
349 return -ENOMEM; in valkyriefb_init()
356 p->total_vram = 0x100000; in valkyriefb_init()
357 p->frame_buffer_phys = frame_buffer_phys; in valkyriefb_init()
359 p->frame_buffer = ioremap(frame_buffer_phys, p->total_vram); in valkyriefb_init()
361 p->frame_buffer = ioremap_wt(frame_buffer_phys, p->total_vram); in valkyriefb_init()
363 p->cmap_regs_phys = cmap_regs_phys; in valkyriefb_init()
364 p->cmap_regs = ioremap(p->cmap_regs_phys, 0x1000); in valkyriefb_init()
365 p->valkyrie_regs_phys = cmap_regs_phys+0x6000; in valkyriefb_init()
366 p->valkyrie_regs = ioremap(p->valkyrie_regs_phys, 0x1000); in valkyriefb_init()
367 err = -ENOMEM; in valkyriefb_init()
368 if (p->frame_buffer == NULL || p->cmap_regs == NULL in valkyriefb_init()
369 || p->valkyrie_regs == NULL) { in valkyriefb_init()
375 mac_vmode_to_var(default_vmode, default_cmode, &p->info.var); in valkyriefb_init()
376 err = valkyrie_init_info(&p->info, p); in valkyriefb_init()
379 valkyrie_init_fix(&p->info.fix, p); in valkyriefb_init()
380 if (valkyriefb_set_par(&p->info)) in valkyriefb_init()
382 printk(KERN_ERR "valkyriefb: can't set default video mode\n"); in valkyriefb_init()
384 if ((err = register_framebuffer(&p->info)) != 0) in valkyriefb_init()
387 fb_info(&p->info, "valkyrie frame buffer device\n"); in valkyriefb_init()
391 fb_dealloc_cmap(&p->info.cmap); in valkyriefb_init()
393 if (p->frame_buffer) in valkyriefb_init()
394 iounmap(p->frame_buffer); in valkyriefb_init()
395 if (p->cmap_regs) in valkyriefb_init()
396 iounmap(p->cmap_regs); in valkyriefb_init()
397 if (p->valkyrie_regs) in valkyriefb_init()
398 iounmap(p->valkyrie_regs); in valkyriefb_init()
404 * Get the monitor sense value.
408 int sense, in; in read_valkyrie_sense() local
410 out_8(&p->valkyrie_regs->msense.r, 0); /* release all lines */ in read_valkyrie_sense()
412 sense = ((in = in_8(&p->valkyrie_regs->msense.r)) & 0x70) << 4; in read_valkyrie_sense()
413 /* drive each sense line low in turn and collect the other 2 */ in read_valkyrie_sense()
414 out_8(&p->valkyrie_regs->msense.r, 4); /* drive A low */ in read_valkyrie_sense()
416 sense |= ((in = in_8(&p->valkyrie_regs->msense.r)) & 0x30); in read_valkyrie_sense()
417 out_8(&p->valkyrie_regs->msense.r, 2); /* drive B low */ in read_valkyrie_sense()
419 sense |= ((in = in_8(&p->valkyrie_regs->msense.r)) & 0x40) >> 3; in read_valkyrie_sense()
420 sense |= (in & 0x10) >> 2; in read_valkyrie_sense()
421 out_8(&p->valkyrie_regs->msense.r, 1); /* drive C low */ in read_valkyrie_sense()
423 sense |= ((in = in_8(&p->valkyrie_regs->msense.r)) & 0x60) >> 5; in read_valkyrie_sense()
425 out_8(&p->valkyrie_regs->msense.r, 7); in read_valkyrie_sense()
427 return sense; in read_valkyrie_sense()
431 * This routine takes a user-supplied var,
449 * messages.) In addition, I think the new code *might* fix some vmode-
466 var->xres, var->yres, var->bits_per_pixel); in valkyrie_var_to_par()
467 return -EINVAL; in valkyrie_var_to_par()
470 /* Check if we know about the wanted video mode */ in valkyrie_var_to_par()
471 if (vmode < 1 || vmode > VMODE_MAX || !valkyrie_reg_init[vmode-1]) { in valkyrie_var_to_par()
473 return -EINVAL; in valkyrie_var_to_par()
478 return -EINVAL; in valkyrie_var_to_par()
481 if (var->xres_virtual > var->xres || var->yres_virtual > var->yres in valkyrie_var_to_par()
482 || var->xoffset != 0 || var->yoffset != 0) { in valkyrie_var_to_par()
483 return -EINVAL; in valkyrie_var_to_par()
486 init = valkyrie_reg_init[vmode-1]; in valkyrie_var_to_par()
487 if (init->pitch[cmode] == 0) { in valkyrie_var_to_par()
490 return -EINVAL; in valkyrie_var_to_par()
493 if (valkyrie_vram_reqd(vmode, cmode) > p->total_vram) { in valkyrie_var_to_par()
496 return -EINVAL; in valkyrie_var_to_par()
499 par->vmode = vmode; in valkyrie_var_to_par()
500 par->cmode = cmode; in valkyrie_var_to_par()
501 par->init = init; in valkyrie_var_to_par()
502 par->xres = var->xres; in valkyrie_var_to_par()
503 par->yres = var->yres; in valkyrie_var_to_par()
504 par->vxres = par->xres; in valkyrie_var_to_par()
505 par->vyres = par->yres; in valkyrie_var_to_par()
513 strcpy(fix->id, "valkyrie"); in valkyrie_init_fix()
514 fix->mmio_start = p->valkyrie_regs_phys; in valkyrie_init_fix()
515 fix->mmio_len = sizeof(struct valkyrie_regs); in valkyrie_init_fix()
516 fix->type = FB_TYPE_PACKED_PIXELS; in valkyrie_init_fix()
517 fix->smem_start = p->frame_buffer_phys + 0x1000; in valkyrie_init_fix()
518 fix->smem_len = p->total_vram; in valkyrie_init_fix()
520 fix->type_aux = 0; in valkyrie_init_fix()
521 fix->ywrapstep = 0; in valkyrie_init_fix()
522 fix->ypanstep = 0; in valkyrie_init_fix()
523 fix->xpanstep = 0; in valkyrie_init_fix()
531 fix->smem_len = valkyrie_vram_reqd(par->vmode, par->cmode); in valkyrie_par_to_fix()
532 fix->visual = (par->cmode == CMODE_8) ? in valkyrie_par_to_fix()
534 fix->line_length = par->vxres << par->cmode; in valkyrie_par_to_fix()
541 info->fbops = &valkyriefb_ops; in valkyrie_init_info()
542 info->screen_base = p->frame_buffer + 0x1000; in valkyrie_init_info()
543 info->flags = FBINFO_DEFAULT; in valkyrie_init_info()
544 info->pseudo_palette = p->pseudo_palette; in valkyrie_init_info()
545 info->par = &p->par; in valkyrie_init_info()
546 return fb_alloc_cmap(&info->cmap, 256, 0); in valkyrie_init_info()