Lines Matching +full:sense +full:- +full:mode
2 * platinumfb.c -- frame buffer device for the PowerMac 'platinum' display
7 * drivers/video/controlfb.c -- frame buffer device for
113 return platinum_var_to_par(var, info->par, 1); in platinumfb_check_var()
121 struct fb_info_platinum *pinfo = info->par; in platinumfb_set_par()
125 if((err = platinum_var_to_par(&info->var, pinfo, 0))) { in platinumfb_set_par()
133 init = platinum_reg_init[pinfo->vmode-1]; in platinumfb_set_par()
135 if ((pinfo->vmode == VMODE_832_624_75) && (pinfo->cmode > CMODE_8)) in platinumfb_set_par()
138 info->screen_base = pinfo->frame_buffer + init->fb_offset + offset; in platinumfb_set_par()
139 mutex_lock(&info->mm_lock); in platinumfb_set_par()
140 info->fix.smem_start = (pinfo->frame_buffer_phys) + init->fb_offset + offset; in platinumfb_set_par()
141 mutex_unlock(&info->mm_lock); in platinumfb_set_par()
142 info->fix.visual = (pinfo->cmode == CMODE_8) ? in platinumfb_set_par()
144 info->fix.line_length = vmode_attrs[pinfo->vmode-1].hres * (1<<pinfo->cmode) in platinumfb_set_par()
146 printk("line_length: %x\n", info->fix.line_length); in platinumfb_set_par()
155 * black. Return 0 if blanking succeeded, != 0 if un-/blanking failed due in platinumfb_blank()
156 * to e.g. a video mode which doesn't support it. Implements VESA suspend in platinumfb_blank()
167 ctrl = le32_to_cpup(&info->platinum_regs->ctrl.r) | 0x33; in platinumfb_blank()
169 --blank_mode; in platinumfb_blank()
174 out_le32(&info->platinum_regs->ctrl.r, ctrl); in platinumfb_blank()
183 struct fb_info_platinum *pinfo = info->par; in platinumfb_setcolreg()
184 volatile struct cmap_regs __iomem *cmap_regs = pinfo->cmap_regs; in platinumfb_setcolreg()
193 pinfo->palette[regno].red = red; in platinumfb_setcolreg()
194 pinfo->palette[regno].green = green; in platinumfb_setcolreg()
195 pinfo->palette[regno].blue = blue; in platinumfb_setcolreg()
197 out_8(&cmap_regs->addr, regno); /* tell clut what addr to fill */ in platinumfb_setcolreg()
198 out_8(&cmap_regs->lut, red); /* send one color channel at */ in platinumfb_setcolreg()
199 out_8(&cmap_regs->lut, green); /* a time... */ in platinumfb_setcolreg()
200 out_8(&cmap_regs->lut, blue); in platinumfb_setcolreg()
204 u32 *pal = info->pseudo_palette; in platinumfb_setcolreg()
205 switch (pinfo->cmode) { in platinumfb_setcolreg()
221 int baseval = vmode_attrs[video_mode-1].hres * (1<<color_mode); in platinum_vram_reqd()
228 return vmode_attrs[video_mode-1].vres * baseval + 0x1000; in platinum_vram_reqd()
232 out_8(&cmap_regs->addr, (a+32)); \
233 out_8(&cmap_regs->d2, (d)); \
238 volatile struct cmap_regs __iomem *cmap_regs = pinfo->cmap_regs; in set_platinum_clock()
241 init = platinum_reg_init[pinfo->vmode-1]; in set_platinum_clock()
244 out_8(&cmap_regs->addr,3+32); in set_platinum_clock()
246 if (in_8(&cmap_regs->d2) == 2) { in set_platinum_clock()
247 STORE_D2(7, init->clock_params[pinfo->clktype][0]); in set_platinum_clock()
248 STORE_D2(8, init->clock_params[pinfo->clktype][1]); in set_platinum_clock()
251 STORE_D2(4, init->clock_params[pinfo->clktype][0]); in set_platinum_clock()
252 STORE_D2(5, init->clock_params[pinfo->clktype][1]); in set_platinum_clock()
265 volatile struct platinum_regs __iomem *platinum_regs = pinfo->platinum_regs; in platinum_set_hardware()
266 volatile struct cmap_regs __iomem *cmap_regs = pinfo->cmap_regs; in platinum_set_hardware()
271 vmode = pinfo->vmode; in platinum_set_hardware()
272 cmode = pinfo->cmode; in platinum_set_hardware()
274 init = platinum_reg_init[vmode - 1]; in platinum_set_hardware()
277 out_be32(&platinum_regs->reg[24].r, 7); /* turn display off */ in platinum_set_hardware()
280 out_be32(&platinum_regs->reg[i+32].r, init->regs[i]); in platinum_set_hardware()
282 out_be32(&platinum_regs->reg[26+32].r, (pinfo->total_vram == 0x100000 ? in platinum_set_hardware()
283 init->offset[cmode] + 4 - cmode : in platinum_set_hardware()
284 init->offset[cmode])); in platinum_set_hardware()
285 out_be32(&platinum_regs->reg[16].r, (unsigned) pinfo->frame_buffer_phys+init->fb_offset+0x10); in platinum_set_hardware()
286 out_be32(&platinum_regs->reg[18].r, init->pitch[cmode]); in platinum_set_hardware()
287 out_be32(&platinum_regs->reg[19].r, (pinfo->total_vram == 0x100000 ? in platinum_set_hardware()
288 init->mode[cmode+1] : in platinum_set_hardware()
289 init->mode[cmode])); in platinum_set_hardware()
290 out_be32(&platinum_regs->reg[20].r, (pinfo->total_vram == 0x100000 ? 0x11 : 0x1011)); in platinum_set_hardware()
291 out_be32(&platinum_regs->reg[21].r, 0x100); in platinum_set_hardware()
292 out_be32(&platinum_regs->reg[22].r, 1); in platinum_set_hardware()
293 out_be32(&platinum_regs->reg[23].r, 1); in platinum_set_hardware()
294 out_be32(&platinum_regs->reg[26].r, 0xc00); in platinum_set_hardware()
295 out_be32(&platinum_regs->reg[27].r, 0x235); in platinum_set_hardware()
296 /* out_be32(&platinum_regs->reg[27].r, 0x2aa); */ in platinum_set_hardware()
298 STORE_D2(0, (pinfo->total_vram == 0x100000 ? in platinum_set_hardware()
299 init->dacula_ctrl[cmode] & 0xf : in platinum_set_hardware()
300 init->dacula_ctrl[cmode])); in platinum_set_hardware()
306 out_be32(&platinum_regs->reg[24].r, 0); /* turn display on */ in platinum_set_hardware()
316 info->fbops = &platinumfb_ops; in platinum_init_info()
317 info->pseudo_palette = pinfo->pseudo_palette; in platinum_init_info()
318 info->screen_base = pinfo->frame_buffer + 0x20; in platinum_init_info()
320 fb_alloc_cmap(&info->cmap, 256, 0); in platinum_init_info()
323 strcpy(info->fix.id, "platinum"); in platinum_init_info()
324 info->fix.mmio_start = pinfo->platinum_regs_phys; in platinum_init_info()
325 info->fix.mmio_len = 0x1000; in platinum_init_info()
326 info->fix.type = FB_TYPE_PACKED_PIXELS; in platinum_init_info()
327 info->fix.smem_start = pinfo->frame_buffer_phys + 0x20; /* will be updated later */ in platinum_init_info()
328 info->fix.smem_len = pinfo->total_vram - 0x20; in platinum_init_info()
329 info->fix.ywrapstep = 0; in platinum_init_info()
330 info->fix.xpanstep = 0; in platinum_init_info()
331 info->fix.ypanstep = 0; in platinum_init_info()
332 info->fix.type_aux = 0; in platinum_init_info()
333 info->fix.accel = FB_ACCEL_NONE; in platinum_init_info()
339 struct fb_info_platinum *pinfo = info->par; in platinum_init_fb()
341 int sense, rc; in platinum_init_fb() local
343 sense = read_platinum_sense(pinfo); in platinum_init_fb()
344 printk(KERN_INFO "platinumfb: Monitor sense value = 0x%x, ", sense); in platinum_init_fb()
349 !platinum_reg_init[default_vmode - 1]) { in platinum_init_fb()
350 default_vmode = mac_map_monitor_sense(sense); in platinum_init_fb()
351 if (!platinum_reg_init[default_vmode - 1]) in platinum_init_fb()
363 platinum_vram_reqd(default_vmode, default_cmode) > pinfo->total_vram) in platinum_init_fb()
364 default_cmode--; in platinum_init_fb()
366 printk("platinumfb: Using video mode %d and color mode %d.\n", default_vmode, default_cmode); in platinum_init_fb()
377 return -ENXIO; in platinum_init_fb()
385 info->var = var; in platinum_init_fb()
402 * Get the monitor sense value.
408 volatile struct platinum_regs __iomem *platinum_regs = info->platinum_regs; in read_platinum_sense()
409 int sense; in read_platinum_sense() local
411 out_be32(&platinum_regs->reg[23].r, 7); /* turn off drivers */ in read_platinum_sense()
413 sense = (~in_be32(&platinum_regs->reg[23].r) & 7) << 8; in read_platinum_sense()
415 /* drive each sense line low in turn and collect the other 2 */ in read_platinum_sense()
416 out_be32(&platinum_regs->reg[23].r, 3); /* drive A low */ in read_platinum_sense()
418 sense |= (~in_be32(&platinum_regs->reg[23].r) & 3) << 4; in read_platinum_sense()
419 out_be32(&platinum_regs->reg[23].r, 5); /* drive B low */ in read_platinum_sense()
421 sense |= (~in_be32(&platinum_regs->reg[23].r) & 4) << 1; in read_platinum_sense()
422 sense |= (~in_be32(&platinum_regs->reg[23].r) & 1) << 2; in read_platinum_sense()
423 out_be32(&platinum_regs->reg[23].r, 6); /* drive C low */ in read_platinum_sense()
425 sense |= (~in_be32(&platinum_regs->reg[23].r) & 6) >> 1; in read_platinum_sense()
427 out_be32(&platinum_regs->reg[23].r, 7); /* turn off drivers */ in read_platinum_sense()
429 return sense; in read_platinum_sense()
433 * This routine takes a user-supplied var, and picks the best vmode/cmode from it.
434 * It also updates the var structure to the actual mode data obtained
444 printk(KERN_ERR "platinum_var_to_par: var->xres = %d\n", var->xres); in platinum_var_to_par()
445 printk(KERN_ERR "platinum_var_to_par: var->yres = %d\n", var->yres); in platinum_var_to_par()
446 printk(KERN_ERR "platinum_var_to_par: var->xres_virtual = %d\n", var->xres_virtual); in platinum_var_to_par()
447 printk(KERN_ERR "platinum_var_to_par: var->yres_virtual = %d\n", var->yres_virtual); in platinum_var_to_par()
448 printk(KERN_ERR "platinum_var_to_par: var->bits_per_pixel = %d\n", var->bits_per_pixel); in platinum_var_to_par()
449 printk(KERN_ERR "platinum_var_to_par: var->pixclock = %d\n", var->pixclock); in platinum_var_to_par()
450 printk(KERN_ERR "platinum_var_to_par: var->vmode = %d\n", var->vmode); in platinum_var_to_par()
451 return -EINVAL; in platinum_var_to_par()
454 if (!platinum_reg_init[vmode-1]) { in platinum_var_to_par()
456 return -EINVAL; in platinum_var_to_par()
459 if (platinum_vram_reqd(vmode, cmode) > pinfo->total_vram) { in platinum_var_to_par()
461 return -EINVAL; in platinum_var_to_par()
465 return -EINVAL; in platinum_var_to_par()
470 pinfo->vmode = vmode; in platinum_var_to_par()
471 pinfo->cmode = cmode; in platinum_var_to_par()
472 pinfo->xres = vmode_attrs[vmode-1].hres; in platinum_var_to_par()
473 pinfo->yres = vmode_attrs[vmode-1].vres; in platinum_var_to_par()
474 pinfo->xoffset = 0; in platinum_var_to_par()
475 pinfo->yoffset = 0; in platinum_var_to_par()
476 pinfo->vxres = pinfo->xres; in platinum_var_to_par()
477 pinfo->vyres = pinfo->yres; in platinum_var_to_par()
529 struct device_node *dp = odev->dev.of_node; in platinumfb_probe()
535 dev_info(&odev->dev, "Found Apple Platinum video hardware\n"); in platinumfb_probe()
537 info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); in platinumfb_probe()
539 return -ENOMEM; in platinumfb_probe()
541 pinfo = info->par; in platinumfb_probe()
543 if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) || in platinumfb_probe()
544 of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) { in platinumfb_probe()
545 dev_err(&odev->dev, "Can't get resources\n"); in platinumfb_probe()
547 return -ENXIO; in platinumfb_probe()
549 dev_dbg(&odev->dev, " registers : 0x%llx...0x%llx\n", in platinumfb_probe()
550 (unsigned long long)pinfo->rsrc_reg.start, in platinumfb_probe()
551 (unsigned long long)pinfo->rsrc_reg.end); in platinumfb_probe()
552 dev_dbg(&odev->dev, " framebuffer: 0x%llx...0x%llx\n", in platinumfb_probe()
553 (unsigned long long)pinfo->rsrc_fb.start, in platinumfb_probe()
554 (unsigned long long)pinfo->rsrc_fb.end); in platinumfb_probe()
559 if (!request_mem_region(pinfo->rsrc_fb.start, in platinumfb_probe()
560 resource_size(&pinfo->rsrc_fb), in platinumfb_probe()
564 return -ENXIO; in platinumfb_probe()
567 /* frame buffer - map only 4MB */ in platinumfb_probe()
568 pinfo->frame_buffer_phys = pinfo->rsrc_fb.start; in platinumfb_probe()
569 pinfo->frame_buffer = ioremap_wt(pinfo->rsrc_fb.start, 0x400000); in platinumfb_probe()
570 pinfo->base_frame_buffer = pinfo->frame_buffer; in platinumfb_probe()
573 pinfo->platinum_regs_phys = pinfo->rsrc_reg.start; in platinumfb_probe()
574 pinfo->platinum_regs = ioremap(pinfo->rsrc_reg.start, 0x1000); in platinumfb_probe()
576 pinfo->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ in platinumfb_probe()
577 request_mem_region(pinfo->cmap_regs_phys, 0x1000, "platinumfb cmap"); in platinumfb_probe()
578 pinfo->cmap_regs = ioremap(pinfo->cmap_regs_phys, 0x1000); in platinumfb_probe()
581 out_be32(&pinfo->platinum_regs->reg[16].r, (unsigned)pinfo->frame_buffer_phys); in platinumfb_probe()
582 out_be32(&pinfo->platinum_regs->reg[20].r, 0x1011); /* select max vram */ in platinumfb_probe()
583 out_be32(&pinfo->platinum_regs->reg[24].r, 0); /* switch in vram */ in platinumfb_probe()
585 fbuffer = pinfo->base_frame_buffer; in platinumfb_probe()
599 pinfo->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000; in platinumfb_probe()
601 (unsigned int) (pinfo->total_vram / 1024 / 1024), in platinumfb_probe()
607 out_8(&pinfo->cmap_regs->addr, 0x40); in platinumfb_probe()
608 pinfo->dactype = in_8(&pinfo->cmap_regs->d2); in platinumfb_probe()
609 switch (pinfo->dactype) { in platinumfb_probe()
611 pinfo->clktype = 1; in platinumfb_probe()
615 pinfo->clktype = 0; in platinumfb_probe()
619 pinfo->clktype = 0; in platinumfb_probe()
620 printk(KERN_INFO "platinumfb: Unknown DACula type: %x\n", pinfo->dactype); in platinumfb_probe()
623 dev_set_drvdata(&odev->dev, info); in platinumfb_probe()
627 iounmap(pinfo->frame_buffer); in platinumfb_probe()
628 iounmap(pinfo->platinum_regs); in platinumfb_probe()
629 iounmap(pinfo->cmap_regs); in platinumfb_probe()
638 struct fb_info *info = dev_get_drvdata(&odev->dev); in platinumfb_remove()
639 struct fb_info_platinum *pinfo = info->par; in platinumfb_remove()
644 iounmap(pinfo->frame_buffer); in platinumfb_remove()
645 iounmap(pinfo->platinum_regs); in platinumfb_remove()
646 iounmap(pinfo->cmap_regs); in platinumfb_remove()
648 release_mem_region(pinfo->rsrc_fb.start, in platinumfb_remove()
649 resource_size(&pinfo->rsrc_fb)); in platinumfb_remove()
651 release_mem_region(pinfo->cmap_regs_phys, 0x1000); in platinumfb_remove()
680 return -ENODEV; in platinumfb_init()