Lines Matching +full:top +full:- +full:left
2 * linux/drivers/video/arcfb.c -- FB driver for Arc monochrome LCD board
17 * GPIO-less system, the board can be tested by connecting the respective sigs
24 * - testing with 4x4
25 * - testing with interrupt hw
28 * - User must set tuhold. It's in microseconds. According to the 108 spec,
30 * - User must set num_cols=x num_rows=y, eg: x=2 means 128
31 * - User must set arcfb_enable=1 to enable it
32 * - User must set dio_addr=0xIOADDR cio_addr=0xIOADDR
52 #define floorXres(a,xres) (a&(~(xres - 1)))
55 #define ceilXres(a,xres) (a|(xres - 1))
117 unsigned char chipselval = par->cslut[chipindex]; in ks108_writeb_ctl()
119 outb(chipselval|KS_CEHI|KS_SEL_CMD, par->cio_addr); in ks108_writeb_ctl()
120 outb(value, par->dio_addr); in ks108_writeb_ctl()
122 outb(chipselval|KS_CELO|KS_SEL_CMD, par->cio_addr); in ks108_writeb_ctl()
128 outb(value, par->cio_addr); in ks108_writeb_mainctl()
134 return inb(par->c2io_addr); in ks108_readb_ctl2()
140 unsigned char chipselval = par->cslut[chipindex]; in ks108_writeb_data()
142 outb(chipselval|KS_CEHI|KS_SEL_DATA, par->cio_addr); in ks108_writeb_data()
143 outb(value, par->dio_addr); in ks108_writeb_data()
145 outb(chipselval|KS_CELO|KS_SEL_DATA, par->cio_addr); in ks108_writeb_data()
184 struct arcfb_par *par = info->par; in arcfb_open()
186 atomic_inc(&par->ref_count); in arcfb_open()
192 struct arcfb_par *par = info->par; in arcfb_release()
193 int count = atomic_read(&par->ref_count); in arcfb_release()
196 return -EINVAL; in arcfb_release()
197 atomic_dec(&par->ref_count); in arcfb_release()
205 struct arcfb_par *par = info->par; in arcfb_pan_display()
207 if ((var->vmode & FB_VMODE_YWRAP) && (var->yoffset < 64) in arcfb_pan_display()
208 && (info->var.yres <= 64)) { in arcfb_pan_display()
210 ks108_set_start_line(par, i, var->yoffset); in arcfb_pan_display()
212 info->var.yoffset = var->yoffset; in arcfb_pan_display()
216 return -EINVAL; in arcfb_pan_display()
223 struct arcfb_par *par = info->par; in arcfb_interrupt()
232 spin_lock(&par->lock); in arcfb_interrupt()
236 spin_unlock(&par->lock); in arcfb_interrupt()
248 unsigned int left, unsigned int right, unsigned int distance) in arcfb_lcd_update_page() argument
256 xindex = left >> 6; in arcfb_lcd_update_page()
262 linesize = par->info->var.xres/8; in arcfb_lcd_update_page()
263 src = (unsigned char __force *) par->info->screen_base + (left/8) + in arcfb_lcd_update_page()
265 ks108_set_xaddr(par, chipindex, left); in arcfb_lcd_update_page()
269 while (left <= right) { in arcfb_lcd_update_page()
274 << (i - rightshift); in arcfb_lcd_update_page()
277 >> (rightshift - i); in arcfb_lcd_update_page()
281 left++; in arcfb_lcd_update_page()
295 * lcd chips. update_page uses the upper/left values to decide which
299 static void arcfb_lcd_update_vert(struct arcfb_par *par, unsigned int top, in arcfb_lcd_update_vert() argument
300 unsigned int bottom, unsigned int left, unsigned int right) in arcfb_lcd_update_vert() argument
304 distance = (bottom - top) + 1; in arcfb_lcd_update_vert()
305 upper = top; in arcfb_lcd_update_vert()
306 lower = top + 7; in arcfb_lcd_update_vert()
309 distance -= 8; in arcfb_lcd_update_vert()
310 arcfb_lcd_update_page(par, upper, left, right, 8); in arcfb_lcd_update_vert()
321 static void arcfb_lcd_update_horiz(struct arcfb_par *par, unsigned int left, in arcfb_lcd_update_horiz() argument
322 unsigned int right, unsigned int top, unsigned int h) in arcfb_lcd_update_horiz() argument
327 upper = floor8(top); in arcfb_lcd_update_horiz()
328 lower = min(upper + distance - 1, ceil64(upper)); in arcfb_lcd_update_horiz()
331 distance -= ((lower - upper) + 1 ); in arcfb_lcd_update_horiz()
332 arcfb_lcd_update_vert(par, upper, lower, left, right); in arcfb_lcd_update_horiz()
334 lower = min(upper + distance - 1, ceil64(upper)); in arcfb_lcd_update_horiz()
346 unsigned int left, right, distance, y; in arcfb_lcd_update() local
350 h += dy - y; in arcfb_lcd_update()
354 left = dx; in arcfb_lcd_update()
355 right = min(left + w - 1, ceil64(left)); in arcfb_lcd_update()
358 arcfb_lcd_update_horiz(par, left, right, y, h); in arcfb_lcd_update()
359 distance -= ((right - left) + 1); in arcfb_lcd_update()
360 left = right + 1; in arcfb_lcd_update()
361 right = min(left + distance - 1, ceil64(left)); in arcfb_lcd_update()
368 struct arcfb_par *par = info->par; in arcfb_fillrect()
373 arcfb_lcd_update(par, rect->dx, rect->dy, rect->width, rect->height); in arcfb_fillrect()
379 struct arcfb_par *par = info->par; in arcfb_copyarea()
384 arcfb_lcd_update(par, area->dx, area->dy, area->width, area->height); in arcfb_copyarea()
389 struct arcfb_par *par = info->par; in arcfb_imageblit()
394 arcfb_lcd_update(par, image->dx, image->dy, image->width, in arcfb_imageblit()
395 image->height); in arcfb_imageblit()
402 struct arcfb_par *par = info->par; in arcfb_ioctl()
410 if (!par->irq) in arcfb_ioctl()
411 return -EINVAL; in arcfb_ioctl()
415 spin_lock_irqsave(&par->lock, flags); in arcfb_ioctl()
418 spin_unlock_irqrestore(&par->lock, flags); in arcfb_ioctl()
428 ctl2 = ks108_readb_ctl2(info->par); in arcfb_ioctl()
430 return -EFAULT; in arcfb_ioctl()
434 return -EINVAL; in arcfb_ioctl()
455 par = info->par; in arcfb_write()
456 xres = info->var.xres; in arcfb_write()
457 fbmemlength = (xres * info->var.yres)/8; in arcfb_write()
460 return -ENOSPC; in arcfb_write()
464 count = fbmemlength - p; in arcfb_write()
465 err = -ENOSPC; in arcfb_write()
471 base_addr = (char __force *)info->screen_base; in arcfb_write()
472 count -= copy_from_user(base_addr + p, buf, count); in arcfb_write()
474 err = -EFAULT; in arcfb_write()
481 bitcount = endpos - startpos; in arcfb_write()
510 int retval = -ENOMEM; in arcfb_probe()
519 less-flat actual paged framebuffer */ in arcfb_probe()
524 info = framebuffer_alloc(sizeof(struct arcfb_par), &dev->dev); in arcfb_probe()
528 info->screen_base = (char __iomem *)videomemory; in arcfb_probe()
529 info->fbops = &arcfb_ops; in arcfb_probe()
531 info->var = arcfb_var; in arcfb_probe()
532 info->fix = arcfb_fix; in arcfb_probe()
533 par = info->par; in arcfb_probe()
534 par->info = info; in arcfb_probe()
540 par->dio_addr = dio_addr; in arcfb_probe()
541 par->cio_addr = cio_addr; in arcfb_probe()
542 par->c2io_addr = c2io_addr; in arcfb_probe()
543 par->cslut[0] = 0x00; in arcfb_probe()
544 par->cslut[1] = 0x06; in arcfb_probe()
545 info->flags = FBINFO_FLAG_DEFAULT; in arcfb_probe()
546 spin_lock_init(&par->lock); in arcfb_probe()
548 par->irq = irq; in arcfb_probe()
549 if (request_irq(par->irq, &arcfb_interrupt, IRQF_SHARED, in arcfb_probe()
552 "arcfb: Failed req IRQ %d\n", par->irq); in arcfb_probe()
553 retval = -EBUSY; in arcfb_probe()
597 free_irq(((struct arcfb_par *)(info->par))->irq, info); in arcfb_remove()
598 vfree((void __force *)info->screen_base); in arcfb_remove()
619 return -ENXIO; in arcfb_init()
627 ret = -ENOMEM; in arcfb_init()