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
115 return platinum_var_to_par(var, info->par, 1); in platinumfb_check_var()
123 struct fb_info_platinum *pinfo = info->par; in platinumfb_set_par()
127 if((err = platinum_var_to_par(&info->var, pinfo, 0))) { in platinumfb_set_par()
135 init = platinum_reg_init[pinfo->vmode-1]; in platinumfb_set_par()
137 if ((pinfo->vmode == VMODE_832_624_75) && (pinfo->cmode > CMODE_8)) in platinumfb_set_par()
140 info->screen_base = pinfo->frame_buffer + init->fb_offset + offset; in platinumfb_set_par()
141 mutex_lock(&info->mm_lock); in platinumfb_set_par()
142 info->fix.smem_start = (pinfo->frame_buffer_phys) + init->fb_offset + offset; in platinumfb_set_par()
143 mutex_unlock(&info->mm_lock); in platinumfb_set_par()
144 info->fix.visual = (pinfo->cmode == CMODE_8) ? in platinumfb_set_par()
146 info->fix.line_length = vmode_attrs[pinfo->vmode-1].hres * (1<<pinfo->cmode) in platinumfb_set_par()
148 printk("line_length: %x\n", info->fix.line_length); in platinumfb_set_par()
157 * black. Return 0 if blanking succeeded, != 0 if un-/blanking failed due in platinumfb_blank()
158 * to e.g. a video mode which doesn't support it. Implements VESA suspend in platinumfb_blank()
169 ctrl = le32_to_cpup(&info->platinum_regs->ctrl.r) | 0x33; in platinumfb_blank()
171 --blank_mode; in platinumfb_blank()
176 out_le32(&info->platinum_regs->ctrl.r, ctrl); in platinumfb_blank()
185 struct fb_info_platinum *pinfo = info->par; in platinumfb_setcolreg()
186 volatile struct cmap_regs __iomem *cmap_regs = pinfo->cmap_regs; in platinumfb_setcolreg()
195 pinfo->palette[regno].red = red; in platinumfb_setcolreg()
196 pinfo->palette[regno].green = green; in platinumfb_setcolreg()
197 pinfo->palette[regno].blue = blue; in platinumfb_setcolreg()
199 out_8(&cmap_regs->addr, regno); /* tell clut what addr to fill */ in platinumfb_setcolreg()
200 out_8(&cmap_regs->lut, red); /* send one color channel at */ in platinumfb_setcolreg()
201 out_8(&cmap_regs->lut, green); /* a time... */ in platinumfb_setcolreg()
202 out_8(&cmap_regs->lut, blue); in platinumfb_setcolreg()
206 u32 *pal = info->pseudo_palette; in platinumfb_setcolreg()
207 switch (pinfo->cmode) { in platinumfb_setcolreg()
223 int baseval = vmode_attrs[video_mode-1].hres * (1<<color_mode); in platinum_vram_reqd()
230 return vmode_attrs[video_mode-1].vres * baseval + 0x1000; in platinum_vram_reqd()
234 out_8(&cmap_regs->addr, (a+32)); \
235 out_8(&cmap_regs->d2, (d)); \
240 volatile struct cmap_regs __iomem *cmap_regs = pinfo->cmap_regs; in set_platinum_clock()
243 init = platinum_reg_init[pinfo->vmode-1]; in set_platinum_clock()
246 out_8(&cmap_regs->addr,3+32); in set_platinum_clock()
248 if (in_8(&cmap_regs->d2) == 2) { in set_platinum_clock()
249 STORE_D2(7, init->clock_params[pinfo->clktype][0]); in set_platinum_clock()
250 STORE_D2(8, init->clock_params[pinfo->clktype][1]); in set_platinum_clock()
253 STORE_D2(4, init->clock_params[pinfo->clktype][0]); in set_platinum_clock()
254 STORE_D2(5, init->clock_params[pinfo->clktype][1]); in set_platinum_clock()
267 volatile struct platinum_regs __iomem *platinum_regs = pinfo->platinum_regs; in platinum_set_hardware()
268 volatile struct cmap_regs __iomem *cmap_regs = pinfo->cmap_regs; in platinum_set_hardware()
273 vmode = pinfo->vmode; in platinum_set_hardware()
274 cmode = pinfo->cmode; in platinum_set_hardware()
276 init = platinum_reg_init[vmode - 1]; in platinum_set_hardware()
279 out_be32(&platinum_regs->reg[24].r, 7); /* turn display off */ in platinum_set_hardware()
282 out_be32(&platinum_regs->reg[i+32].r, init->regs[i]); in platinum_set_hardware()
284 out_be32(&platinum_regs->reg[26+32].r, (pinfo->total_vram == 0x100000 ? in platinum_set_hardware()
285 init->offset[cmode] + 4 - cmode : in platinum_set_hardware()
286 init->offset[cmode])); in platinum_set_hardware()
287 out_be32(&platinum_regs->reg[16].r, (unsigned) pinfo->frame_buffer_phys+init->fb_offset+0x10); in platinum_set_hardware()
288 out_be32(&platinum_regs->reg[18].r, init->pitch[cmode]); in platinum_set_hardware()
289 out_be32(&platinum_regs->reg[19].r, (pinfo->total_vram == 0x100000 ? in platinum_set_hardware()
290 init->mode[cmode+1] : in platinum_set_hardware()
291 init->mode[cmode])); in platinum_set_hardware()
292 out_be32(&platinum_regs->reg[20].r, (pinfo->total_vram == 0x100000 ? 0x11 : 0x1011)); in platinum_set_hardware()
293 out_be32(&platinum_regs->reg[21].r, 0x100); in platinum_set_hardware()
294 out_be32(&platinum_regs->reg[22].r, 1); in platinum_set_hardware()
295 out_be32(&platinum_regs->reg[23].r, 1); in platinum_set_hardware()
296 out_be32(&platinum_regs->reg[26].r, 0xc00); in platinum_set_hardware()
297 out_be32(&platinum_regs->reg[27].r, 0x235); in platinum_set_hardware()
298 /* out_be32(&platinum_regs->reg[27].r, 0x2aa); */ in platinum_set_hardware()
300 STORE_D2(0, (pinfo->total_vram == 0x100000 ? in platinum_set_hardware()
301 init->dacula_ctrl[cmode] & 0xf : in platinum_set_hardware()
302 init->dacula_ctrl[cmode])); in platinum_set_hardware()
308 out_be32(&platinum_regs->reg[24].r, 0); /* turn display on */ in platinum_set_hardware()
318 info->fbops = &platinumfb_ops; in platinum_init_info()
319 info->pseudo_palette = pinfo->pseudo_palette; in platinum_init_info()
320 info->flags = FBINFO_DEFAULT; in platinum_init_info()
321 info->screen_base = pinfo->frame_buffer + 0x20; in platinum_init_info()
323 fb_alloc_cmap(&info->cmap, 256, 0); in platinum_init_info()
326 strcpy(info->fix.id, "platinum"); in platinum_init_info()
327 info->fix.mmio_start = pinfo->platinum_regs_phys; in platinum_init_info()
328 info->fix.mmio_len = 0x1000; in platinum_init_info()
329 info->fix.type = FB_TYPE_PACKED_PIXELS; in platinum_init_info()
330 info->fix.smem_start = pinfo->frame_buffer_phys + 0x20; /* will be updated later */ in platinum_init_info()
331 info->fix.smem_len = pinfo->total_vram - 0x20; in platinum_init_info()
332 info->fix.ywrapstep = 0; in platinum_init_info()
333 info->fix.xpanstep = 0; in platinum_init_info()
334 info->fix.ypanstep = 0; in platinum_init_info()
335 info->fix.type_aux = 0; in platinum_init_info()
336 info->fix.accel = FB_ACCEL_NONE; in platinum_init_info()
342 struct fb_info_platinum *pinfo = info->par; in platinum_init_fb()
344 int sense, rc; in platinum_init_fb() local
346 sense = read_platinum_sense(pinfo); in platinum_init_fb()
347 printk(KERN_INFO "platinumfb: Monitor sense value = 0x%x, ", sense); in platinum_init_fb()
352 !platinum_reg_init[default_vmode - 1]) { in platinum_init_fb()
353 default_vmode = mac_map_monitor_sense(sense); in platinum_init_fb()
354 if (!platinum_reg_init[default_vmode - 1]) in platinum_init_fb()
366 platinum_vram_reqd(default_vmode, default_cmode) > pinfo->total_vram) in platinum_init_fb()
367 default_cmode--; in platinum_init_fb()
369 printk("platinumfb: Using video mode %d and color mode %d.\n", default_vmode, default_cmode); in platinum_init_fb()
380 return -ENXIO; in platinum_init_fb()
388 info->var = var; in platinum_init_fb()
405 * Get the monitor sense value.
411 volatile struct platinum_regs __iomem *platinum_regs = info->platinum_regs; in read_platinum_sense()
412 int sense; in read_platinum_sense() local
414 out_be32(&platinum_regs->reg[23].r, 7); /* turn off drivers */ in read_platinum_sense()
416 sense = (~in_be32(&platinum_regs->reg[23].r) & 7) << 8; in read_platinum_sense()
418 /* drive each sense line low in turn and collect the other 2 */ in read_platinum_sense()
419 out_be32(&platinum_regs->reg[23].r, 3); /* drive A low */ in read_platinum_sense()
421 sense |= (~in_be32(&platinum_regs->reg[23].r) & 3) << 4; in read_platinum_sense()
422 out_be32(&platinum_regs->reg[23].r, 5); /* drive B low */ in read_platinum_sense()
424 sense |= (~in_be32(&platinum_regs->reg[23].r) & 4) << 1; in read_platinum_sense()
425 sense |= (~in_be32(&platinum_regs->reg[23].r) & 1) << 2; in read_platinum_sense()
426 out_be32(&platinum_regs->reg[23].r, 6); /* drive C low */ in read_platinum_sense()
428 sense |= (~in_be32(&platinum_regs->reg[23].r) & 6) >> 1; in read_platinum_sense()
430 out_be32(&platinum_regs->reg[23].r, 7); /* turn off drivers */ in read_platinum_sense()
432 return sense; in read_platinum_sense()
436 * This routine takes a user-supplied var, and picks the best vmode/cmode from it.
437 * It also updates the var structure to the actual mode data obtained
447 printk(KERN_ERR "platinum_var_to_par: var->xres = %d\n", var->xres); in platinum_var_to_par()
448 printk(KERN_ERR "platinum_var_to_par: var->yres = %d\n", var->yres); in platinum_var_to_par()
449 printk(KERN_ERR "platinum_var_to_par: var->xres_virtual = %d\n", var->xres_virtual); in platinum_var_to_par()
450 printk(KERN_ERR "platinum_var_to_par: var->yres_virtual = %d\n", var->yres_virtual); in platinum_var_to_par()
451 printk(KERN_ERR "platinum_var_to_par: var->bits_per_pixel = %d\n", var->bits_per_pixel); in platinum_var_to_par()
452 printk(KERN_ERR "platinum_var_to_par: var->pixclock = %d\n", var->pixclock); in platinum_var_to_par()
453 printk(KERN_ERR "platinum_var_to_par: var->vmode = %d\n", var->vmode); in platinum_var_to_par()
454 return -EINVAL; in platinum_var_to_par()
457 if (!platinum_reg_init[vmode-1]) { in platinum_var_to_par()
459 return -EINVAL; in platinum_var_to_par()
462 if (platinum_vram_reqd(vmode, cmode) > pinfo->total_vram) { in platinum_var_to_par()
464 return -EINVAL; in platinum_var_to_par()
468 return -EINVAL; in platinum_var_to_par()
473 pinfo->vmode = vmode; in platinum_var_to_par()
474 pinfo->cmode = cmode; in platinum_var_to_par()
475 pinfo->xres = vmode_attrs[vmode-1].hres; in platinum_var_to_par()
476 pinfo->yres = vmode_attrs[vmode-1].vres; in platinum_var_to_par()
477 pinfo->xoffset = 0; in platinum_var_to_par()
478 pinfo->yoffset = 0; in platinum_var_to_par()
479 pinfo->vxres = pinfo->xres; in platinum_var_to_par()
480 pinfo->vyres = pinfo->yres; in platinum_var_to_par()
532 struct device_node *dp = odev->dev.of_node; in platinumfb_probe()
538 dev_info(&odev->dev, "Found Apple Platinum video hardware\n"); in platinumfb_probe()
540 info = framebuffer_alloc(sizeof(*pinfo), &odev->dev); in platinumfb_probe()
542 return -ENOMEM; in platinumfb_probe()
544 pinfo = info->par; in platinumfb_probe()
546 if (of_address_to_resource(dp, 0, &pinfo->rsrc_reg) || in platinumfb_probe()
547 of_address_to_resource(dp, 1, &pinfo->rsrc_fb)) { in platinumfb_probe()
548 dev_err(&odev->dev, "Can't get resources\n"); in platinumfb_probe()
550 return -ENXIO; in platinumfb_probe()
552 dev_dbg(&odev->dev, " registers : 0x%llx...0x%llx\n", in platinumfb_probe()
553 (unsigned long long)pinfo->rsrc_reg.start, in platinumfb_probe()
554 (unsigned long long)pinfo->rsrc_reg.end); in platinumfb_probe()
555 dev_dbg(&odev->dev, " framebuffer: 0x%llx...0x%llx\n", in platinumfb_probe()
556 (unsigned long long)pinfo->rsrc_fb.start, in platinumfb_probe()
557 (unsigned long long)pinfo->rsrc_fb.end); in platinumfb_probe()
562 if (!request_mem_region(pinfo->rsrc_fb.start, in platinumfb_probe()
563 resource_size(&pinfo->rsrc_fb), in platinumfb_probe()
567 return -ENXIO; in platinumfb_probe()
570 /* frame buffer - map only 4MB */ in platinumfb_probe()
571 pinfo->frame_buffer_phys = pinfo->rsrc_fb.start; in platinumfb_probe()
572 pinfo->frame_buffer = ioremap_wt(pinfo->rsrc_fb.start, 0x400000); in platinumfb_probe()
573 pinfo->base_frame_buffer = pinfo->frame_buffer; in platinumfb_probe()
576 pinfo->platinum_regs_phys = pinfo->rsrc_reg.start; in platinumfb_probe()
577 pinfo->platinum_regs = ioremap(pinfo->rsrc_reg.start, 0x1000); in platinumfb_probe()
579 pinfo->cmap_regs_phys = 0xf301b000; /* XXX not in prom? */ in platinumfb_probe()
580 request_mem_region(pinfo->cmap_regs_phys, 0x1000, "platinumfb cmap"); in platinumfb_probe()
581 pinfo->cmap_regs = ioremap(pinfo->cmap_regs_phys, 0x1000); in platinumfb_probe()
584 out_be32(&pinfo->platinum_regs->reg[16].r, (unsigned)pinfo->frame_buffer_phys); in platinumfb_probe()
585 out_be32(&pinfo->platinum_regs->reg[20].r, 0x1011); /* select max vram */ in platinumfb_probe()
586 out_be32(&pinfo->platinum_regs->reg[24].r, 0); /* switch in vram */ in platinumfb_probe()
588 fbuffer = pinfo->base_frame_buffer; in platinumfb_probe()
602 pinfo->total_vram = (bank0 + bank1 + bank2 + bank3) * 0x100000; in platinumfb_probe()
604 (unsigned int) (pinfo->total_vram / 1024 / 1024), in platinumfb_probe()
610 out_8(&pinfo->cmap_regs->addr, 0x40); in platinumfb_probe()
611 pinfo->dactype = in_8(&pinfo->cmap_regs->d2); in platinumfb_probe()
612 switch (pinfo->dactype) { in platinumfb_probe()
614 pinfo->clktype = 1; in platinumfb_probe()
618 pinfo->clktype = 0; in platinumfb_probe()
622 pinfo->clktype = 0; in platinumfb_probe()
623 printk(KERN_INFO "platinumfb: Unknown DACula type: %x\n", pinfo->dactype); in platinumfb_probe()
626 dev_set_drvdata(&odev->dev, info); in platinumfb_probe()
630 iounmap(pinfo->frame_buffer); in platinumfb_probe()
631 iounmap(pinfo->platinum_regs); in platinumfb_probe()
632 iounmap(pinfo->cmap_regs); in platinumfb_probe()
641 struct fb_info *info = dev_get_drvdata(&odev->dev); in platinumfb_remove()
642 struct fb_info_platinum *pinfo = info->par; in platinumfb_remove()
647 iounmap(pinfo->frame_buffer); in platinumfb_remove()
648 iounmap(pinfo->platinum_regs); in platinumfb_remove()
649 iounmap(pinfo->cmap_regs); in platinumfb_remove()
651 release_mem_region(pinfo->rsrc_fb.start, in platinumfb_remove()
652 resource_size(&pinfo->rsrc_fb)); in platinumfb_remove()
654 release_mem_region(pinfo->cmap_regs_phys, 0x1000); in platinumfb_remove()
685 return -ENODEV; in platinumfb_init()