diff options
Diffstat (limited to 'kernel/drivers/staging/sm750fb/sm750_cursor.c')
-rw-r--r-- | kernel/drivers/staging/sm750fb/sm750_cursor.c | 158 |
1 files changed, 55 insertions, 103 deletions
diff --git a/kernel/drivers/staging/sm750fb/sm750_cursor.c b/kernel/drivers/staging/sm750fb/sm750_cursor.c index 68d5cbc3e..3b7ce9275 100644 --- a/kernel/drivers/staging/sm750fb/sm750_cursor.c +++ b/kernel/drivers/staging/sm750fb/sm750_cursor.c @@ -1,19 +1,19 @@ -#include<linux/module.h> -#include<linux/kernel.h> -#include<linux/errno.h> -#include<linux/string.h> -#include<linux/mm.h> -#include<linux/slab.h> -#include<linux/delay.h> -#include<linux/fb.h> -#include<linux/ioport.h> -#include<linux/init.h> -#include<linux/pci.h> -#include<linux/vmalloc.h> -#include<linux/pagemap.h> +#include <linux/module.h> +#include <linux/kernel.h> +#include <linux/errno.h> +#include <linux/string.h> +#include <linux/mm.h> +#include <linux/slab.h> +#include <linux/delay.h> +#include <linux/fb.h> +#include <linux/ioport.h> +#include <linux/init.h> +#include <linux/pci.h> +#include <linux/vmalloc.h> +#include <linux/pagemap.h> #include <linux/console.h> -#include<linux/platform_device.h> -#include<linux/screen_info.h> +#include <linux/platform_device.h> +#include <linux/screen_info.h> #include "sm750.h" #include "sm750_help.h" @@ -23,8 +23,8 @@ #define PEEK32(addr) \ readl(cursor->mmio + (addr)) -#define POKE32(addr,data) \ -writel((data),cursor->mmio + (addr)) +#define POKE32(addr, data) \ +writel((data), cursor->mmio + (addr)) /* cursor control for voyager and 718/750*/ #define HWC_ADDRESS 0x0 @@ -58,45 +58,47 @@ writel((data),cursor->mmio + (addr)) /* hw_cursor_xxx works for voyager,718 and 750 */ -void hw_cursor_enable(struct lynx_cursor * cursor) +void hw_cursor_enable(struct lynx_cursor *cursor) { u32 reg; - reg = FIELD_VALUE(0,HWC_ADDRESS,ADDRESS,cursor->offset)| - FIELD_SET(0,HWC_ADDRESS,EXT,LOCAL)| - FIELD_SET(0,HWC_ADDRESS,ENABLE,ENABLE); - POKE32(HWC_ADDRESS,reg); + + reg = FIELD_VALUE(0, HWC_ADDRESS, ADDRESS, cursor->offset)| + FIELD_SET(0, HWC_ADDRESS, EXT, LOCAL)| + FIELD_SET(0, HWC_ADDRESS, ENABLE, ENABLE); + POKE32(HWC_ADDRESS, reg); } -void hw_cursor_disable(struct lynx_cursor * cursor) +void hw_cursor_disable(struct lynx_cursor *cursor) { - POKE32(HWC_ADDRESS,0); + POKE32(HWC_ADDRESS, 0); } -void hw_cursor_setSize(struct lynx_cursor * cursor, - int w,int h) +void hw_cursor_setSize(struct lynx_cursor *cursor, + int w, int h) { cursor->w = w; cursor->h = h; } -void hw_cursor_setPos(struct lynx_cursor * cursor, - int x,int y) +void hw_cursor_setPos(struct lynx_cursor *cursor, + int x, int y) { u32 reg; - reg = FIELD_VALUE(0,HWC_LOCATION,Y,y)| - FIELD_VALUE(0,HWC_LOCATION,X,x); - POKE32(HWC_LOCATION,reg); + + reg = FIELD_VALUE(0, HWC_LOCATION, Y, y)| + FIELD_VALUE(0, HWC_LOCATION, X, x); + POKE32(HWC_LOCATION, reg); } -void hw_cursor_setColor(struct lynx_cursor * cursor, - u32 fg,u32 bg) +void hw_cursor_setColor(struct lynx_cursor *cursor, + u32 fg, u32 bg) { - POKE32(HWC_COLOR_12,(fg<<16)|(bg&0xffff)); - POKE32(HWC_COLOR_3,0xffe0); + POKE32(HWC_COLOR_12, (fg<<16)|(bg&0xffff)); + POKE32(HWC_COLOR_3, 0xffe0); } -void hw_cursor_setData(struct lynx_cursor * cursor, - u16 rop,const u8* pcol,const u8* pmsk) +void hw_cursor_setData(struct lynx_cursor *cursor, + u16 rop, const u8 *pcol, const u8 *pmsk) { - int i,j,count,pitch,offset; - u8 color,mask,opr; + int i, j, count, pitch, offset; + u8 color, mask, opr; u16 data; void __iomem *pbuffer, *pstart; @@ -122,36 +124,14 @@ void hw_cursor_setData(struct lynx_cursor * cursor, odd=0; */ - for(i=0;i<count;i++) - { + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; data = 0; - /* either method below works well, - * but method 2 shows no lag - * and method 1 seems a bit wrong*/ -#if 0 - if(rop == ROP_XOR) - opr = mask ^ color; - else - opr = mask & color; - - for(j=0;j<8;j++) - { - - if(opr & (0x80 >> j)) - { //use fg color,id = 2 - data |= 2 << (j*2); - }else{ - //use bg color,id = 1 - data |= 1 << (j*2); - } - } -#else - for(j=0;j<8;j++){ - if(mask & (0x80>>j)){ - if(rop == ROP_XOR) + for (j = 0; j < 8; j++) { + if (mask & (0x80>>j)) { + if (rop == ROP_XOR) opr = mask ^ color; else opr = mask & color; @@ -160,20 +140,15 @@ void hw_cursor_setData(struct lynx_cursor * cursor, data |= ((opr & (0x80>>j))?2:1)<<(j*2); } } -#endif iowrite16(data, pbuffer); /* assume pitch is 1,2,4,8,...*/ -#if 0 - if(!((i+1)&(pitch-1))) /* below line equal to is line */ -#else - if((i+1) % pitch == 0) -#endif + if ((i+1) % pitch == 0) { /* need a return */ pstart += offset; pbuffer = pstart; - }else{ + } else { pbuffer += sizeof(u16); } @@ -183,10 +158,10 @@ void hw_cursor_setData(struct lynx_cursor * cursor, } -void hw_cursor_setData2(struct lynx_cursor * cursor, - u16 rop,const u8* pcol,const u8* pmsk) +void hw_cursor_setData2(struct lynx_cursor *cursor, + u16 rop, const u8 *pcol, const u8 *pmsk) { - int i,j,count,pitch,offset; + int i, j, count, pitch, offset; u8 color, mask; u16 data; void __iomem *pbuffer, *pstart; @@ -204,46 +179,23 @@ void hw_cursor_setData2(struct lynx_cursor * cursor, pstart = cursor->vstart; pbuffer = pstart; - for(i=0;i<count;i++) - { + for (i = 0; i < count; i++) { color = *pcol++; mask = *pmsk++; data = 0; - /* either method below works well, but method 2 shows no lag */ -#if 0 - if(rop == ROP_XOR) - opr = mask ^ color; - else - opr = mask & color; - - for(j=0;j<8;j++) - { - - if(opr & (0x80 >> j)) - { //use fg color,id = 2 - data |= 2 << (j*2); - }else{ - //use bg color,id = 1 - data |= 1 << (j*2); - } - } -#else - for(j=0;j<8;j++){ - if(mask & (1<<j)) + for (j = 0; j < 8; j++) { + if (mask & (1<<j)) data |= ((color & (1<<j))?1:2)<<(j*2); } -#endif iowrite16(data, pbuffer); /* assume pitch is 1,2,4,8,...*/ - if(!(i&(pitch-1))) - //if((i+1) % pitch == 0) - { + if (!(i&(pitch-1))) { /* need a return */ pstart += offset; pbuffer = pstart; - }else{ + } else { pbuffer += sizeof(u16); } |