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:
87 int sense; member
120 /* Sets the video mode according to info->var */
125 volatile struct valkyrie_regs __iomem *valkyrie_regs = p->valkyrie_regs; in valkyriefb_set_par()
126 struct fb_par_valkyrie *par = info->par; in valkyriefb_set_par()
130 if ((err = valkyrie_var_to_par(&info->var, par, info))) in valkyriefb_set_par()
133 valkyrie_par_to_fix(par, &info->fix); in valkyriefb_set_par()
136 out_8(&valkyrie_regs->status.r, 0); in valkyriefb_set_par()
140 init = par->init; in valkyriefb_set_par()
141 out_8(&valkyrie_regs->mode.r, init->mode | 0x80); in valkyriefb_set_par()
142 out_8(&valkyrie_regs->depth.r, par->cmode + 3); in valkyriefb_set_par()
143 set_valkyrie_clock(init->clock_params); in valkyriefb_set_par()
147 out_8(&valkyrie_regs->mode.r, init->mode); in valkyriefb_set_par()
155 return mac_vmode_to_var(par->vmode, par->cmode, var); in valkyrie_par_to_var()
173 * black. Return 0 if blanking succeeded, != 0 if un-/blanking failed due
174 * to e.g. a video mode which doesn't support it. Implements VESA suspend
184 struct fb_par_valkyrie *par = info->par; in valkyriefb_blank()
185 struct valkyrie_regvals *init = par->init; in valkyriefb_blank()
192 out_8(&p->valkyrie_regs->mode.r, init->mode); in valkyriefb_blank()
203 out_8(&p->valkyrie_regs->mode.r, init->mode | 0x40); in valkyriefb_blank()
206 out_8(&p->valkyrie_regs->mode.r, 0x66); in valkyriefb_blank()
217 volatile struct cmap_regs __iomem *cmap_regs = p->cmap_regs; in valkyriefb_setcolreg()
218 struct fb_par_valkyrie *par = info->par; in valkyriefb_setcolreg()
227 out_8(&p->cmap_regs->addr, regno); in valkyriefb_setcolreg()
230 out_8(&cmap_regs->lut, red); in valkyriefb_setcolreg()
231 out_8(&cmap_regs->lut, green); in valkyriefb_setcolreg()
232 out_8(&cmap_regs->lut, blue); in valkyriefb_setcolreg()
234 if (regno < 16 && par->cmode == CMODE_16) in valkyriefb_setcolreg()
235 ((u32 *)info->pseudo_palette)[regno] = in valkyriefb_setcolreg()
244 struct valkyrie_regvals *init = valkyrie_reg_init[video_mode-1]; in valkyrie_vram_reqd()
246 if ((pitch = init->pitch[color_mode]) == 0) in valkyrie_vram_reqd()
247 pitch = 2 * init->pitch[0]; in valkyrie_vram_reqd()
248 return init->vres * pitch; in valkyrie_vram_reqd()
268 p->sense = read_valkyrie_sense(p); in valkyrie_choose_mode()
269 printk(KERN_INFO "Monitor sense value = 0x%x\n", p->sense); in valkyrie_choose_mode()
271 /* Try to pick a video mode out of NVRAM if we have one. */ in valkyrie_choose_mode()
277 !valkyrie_reg_init[default_vmode - 1]) { in valkyrie_choose_mode()
278 default_vmode = mac_map_monitor_sense(p->sense); in valkyrie_choose_mode()
279 if (!valkyrie_reg_init[default_vmode - 1]) in valkyrie_choose_mode()
291 || valkyrie_reg_init[default_vmode-1]->pitch[default_cmode] == 0 in valkyrie_choose_mode()
292 || valkyrie_vram_reqd(default_vmode, default_cmode) > p->total_vram) in valkyrie_choose_mode()
295 printk(KERN_INFO "using video mode %d and color mode %d.\n", in valkyrie_choose_mode()
307 return -ENODEV; in valkyriefb_init()
312 return -ENODEV; in valkyriefb_init()
316 return -ENODEV; in valkyriefb_init()
318 /* Hardcoded addresses... welcome to 68k Macintosh country :-) */ in valkyriefb_init()
342 return -ENOMEM; in valkyriefb_init()
349 p->total_vram = 0x100000; in valkyriefb_init()
350 p->frame_buffer_phys = frame_buffer_phys; in valkyriefb_init()
352 p->frame_buffer = ioremap(frame_buffer_phys, p->total_vram); in valkyriefb_init()
354 p->frame_buffer = ioremap_wt(frame_buffer_phys, p->total_vram); in valkyriefb_init()
356 p->cmap_regs_phys = cmap_regs_phys; in valkyriefb_init()
357 p->cmap_regs = ioremap(p->cmap_regs_phys, 0x1000); in valkyriefb_init()
358 p->valkyrie_regs_phys = cmap_regs_phys+0x6000; in valkyriefb_init()
359 p->valkyrie_regs = ioremap(p->valkyrie_regs_phys, 0x1000); in valkyriefb_init()
360 err = -ENOMEM; in valkyriefb_init()
361 if (p->frame_buffer == NULL || p->cmap_regs == NULL in valkyriefb_init()
362 || p->valkyrie_regs == NULL) { in valkyriefb_init()
368 mac_vmode_to_var(default_vmode, default_cmode, &p->info.var); in valkyriefb_init()
369 err = valkyrie_init_info(&p->info, p); in valkyriefb_init()
372 valkyrie_init_fix(&p->info.fix, p); in valkyriefb_init()
373 if (valkyriefb_set_par(&p->info)) in valkyriefb_init()
375 printk(KERN_ERR "valkyriefb: can't set default video mode\n"); in valkyriefb_init()
377 if ((err = register_framebuffer(&p->info)) != 0) in valkyriefb_init()
380 fb_info(&p->info, "valkyrie frame buffer device\n"); in valkyriefb_init()
384 fb_dealloc_cmap(&p->info.cmap); in valkyriefb_init()
386 if (p->frame_buffer) in valkyriefb_init()
387 iounmap(p->frame_buffer); in valkyriefb_init()
388 if (p->cmap_regs) in valkyriefb_init()
389 iounmap(p->cmap_regs); in valkyriefb_init()
390 if (p->valkyrie_regs) in valkyriefb_init()
391 iounmap(p->valkyrie_regs); in valkyriefb_init()
397 * Get the monitor sense value.
401 int sense, in; in read_valkyrie_sense() local
403 out_8(&p->valkyrie_regs->msense.r, 0); /* release all lines */ in read_valkyrie_sense()
405 sense = ((in = in_8(&p->valkyrie_regs->msense.r)) & 0x70) << 4; in read_valkyrie_sense()
406 /* drive each sense line low in turn and collect the other 2 */ in read_valkyrie_sense()
407 out_8(&p->valkyrie_regs->msense.r, 4); /* drive A low */ in read_valkyrie_sense()
409 sense |= ((in = in_8(&p->valkyrie_regs->msense.r)) & 0x30); in read_valkyrie_sense()
410 out_8(&p->valkyrie_regs->msense.r, 2); /* drive B low */ in read_valkyrie_sense()
412 sense |= ((in = in_8(&p->valkyrie_regs->msense.r)) & 0x40) >> 3; in read_valkyrie_sense()
413 sense |= (in & 0x10) >> 2; in read_valkyrie_sense()
414 out_8(&p->valkyrie_regs->msense.r, 1); /* drive C low */ in read_valkyrie_sense()
416 sense |= ((in = in_8(&p->valkyrie_regs->msense.r)) & 0x60) >> 5; in read_valkyrie_sense()
418 out_8(&p->valkyrie_regs->msense.r, 7); in read_valkyrie_sense()
420 return sense; in read_valkyrie_sense()
424 * This routine takes a user-supplied var,
442 * messages.) In addition, I think the new code *might* fix some vmode-
459 var->xres, var->yres, var->bits_per_pixel); in valkyrie_var_to_par()
460 return -EINVAL; in valkyrie_var_to_par()
463 /* Check if we know about the wanted video mode */ in valkyrie_var_to_par()
464 if (vmode < 1 || vmode > VMODE_MAX || !valkyrie_reg_init[vmode-1]) { in valkyrie_var_to_par()
466 return -EINVAL; in valkyrie_var_to_par()
471 return -EINVAL; in valkyrie_var_to_par()
474 if (var->xres_virtual > var->xres || var->yres_virtual > var->yres in valkyrie_var_to_par()
475 || var->xoffset != 0 || var->yoffset != 0) { in valkyrie_var_to_par()
476 return -EINVAL; in valkyrie_var_to_par()
479 init = valkyrie_reg_init[vmode-1]; in valkyrie_var_to_par()
480 if (init->pitch[cmode] == 0) { in valkyrie_var_to_par()
483 return -EINVAL; in valkyrie_var_to_par()
486 if (valkyrie_vram_reqd(vmode, cmode) > p->total_vram) { in valkyrie_var_to_par()
489 return -EINVAL; in valkyrie_var_to_par()
492 par->vmode = vmode; in valkyrie_var_to_par()
493 par->cmode = cmode; in valkyrie_var_to_par()
494 par->init = init; in valkyrie_var_to_par()
495 par->xres = var->xres; in valkyrie_var_to_par()
496 par->yres = var->yres; in valkyrie_var_to_par()
497 par->vxres = par->xres; in valkyrie_var_to_par()
498 par->vyres = par->yres; in valkyrie_var_to_par()
506 strcpy(fix->id, "valkyrie"); in valkyrie_init_fix()
507 fix->mmio_start = p->valkyrie_regs_phys; in valkyrie_init_fix()
508 fix->mmio_len = sizeof(struct valkyrie_regs); in valkyrie_init_fix()
509 fix->type = FB_TYPE_PACKED_PIXELS; in valkyrie_init_fix()
510 fix->smem_start = p->frame_buffer_phys + 0x1000; in valkyrie_init_fix()
511 fix->smem_len = p->total_vram; in valkyrie_init_fix()
513 fix->type_aux = 0; in valkyrie_init_fix()
514 fix->ywrapstep = 0; in valkyrie_init_fix()
515 fix->ypanstep = 0; in valkyrie_init_fix()
516 fix->xpanstep = 0; in valkyrie_init_fix()
524 fix->smem_len = valkyrie_vram_reqd(par->vmode, par->cmode); in valkyrie_par_to_fix()
525 fix->visual = (par->cmode == CMODE_8) ? in valkyrie_par_to_fix()
527 fix->line_length = par->vxres << par->cmode; in valkyrie_par_to_fix()
534 info->fbops = &valkyriefb_ops; in valkyrie_init_info()
535 info->screen_base = p->frame_buffer + 0x1000; in valkyrie_init_info()
536 info->pseudo_palette = p->pseudo_palette; in valkyrie_init_info()
537 info->par = &p->par; in valkyrie_init_info()
538 return fb_alloc_cmap(&info->cmap, 256, 0); in valkyrie_init_info()