aboutsummaryrefslogtreecommitdiffstats
path: root/drivers
diff options
context:
space:
mode:
authorKrzysztof Helt <krzysztof.h1@wp.pl>2007-08-05 21:06:52 -0400
committerDavid S. Miller <davem@sunset.davemloft.net>2007-10-14 00:53:08 -0400
commitf9c97e5d7cd9ff5e51e16d5db08d7e54fa4cb6bb (patch)
tree794904e607716c79eed5db1a9a28c6875e916ad1 /drivers
parenta140e94d92f82db7406e116b63e78bd024907657 (diff)
[FFB]: source cleanup
This patch cleans up the driver a bit. It contains coding style fixes (pointed by Lindent and checkpatch) and white space clean ups. Signed-off-by: Krzysztof Helt <krzysztof.h1@wp.pl> Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'drivers')
-rw-r--r--drivers/video/ffb.c161
1 files changed, 78 insertions, 83 deletions
diff --git a/drivers/video/ffb.c b/drivers/video/ffb.c
index 4b520b573911..d7e24889650e 100644
--- a/drivers/video/ffb.c
+++ b/drivers/video/ffb.c
@@ -171,17 +171,17 @@ static struct fb_ops ffb_ops = {
171#define FFB_PPC_CS_VAR 0x000002 171#define FFB_PPC_CS_VAR 0x000002
172#define FFB_PPC_CS_CONST 0x000003 172#define FFB_PPC_CS_CONST 0x000003
173 173
174#define FFB_ROP_NEW 0x83 174#define FFB_ROP_NEW 0x83
175#define FFB_ROP_OLD 0x85 175#define FFB_ROP_OLD 0x85
176#define FFB_ROP_NEW_XOR_OLD 0x86 176#define FFB_ROP_NEW_XOR_OLD 0x86
177 177
178#define FFB_UCSR_FIFO_MASK 0x00000fff 178#define FFB_UCSR_FIFO_MASK 0x00000fff
179#define FFB_UCSR_FB_BUSY 0x01000000 179#define FFB_UCSR_FB_BUSY 0x01000000
180#define FFB_UCSR_RP_BUSY 0x02000000 180#define FFB_UCSR_RP_BUSY 0x02000000
181#define FFB_UCSR_ALL_BUSY (FFB_UCSR_RP_BUSY|FFB_UCSR_FB_BUSY) 181#define FFB_UCSR_ALL_BUSY (FFB_UCSR_RP_BUSY|FFB_UCSR_FB_BUSY)
182#define FFB_UCSR_READ_ERR 0x40000000 182#define FFB_UCSR_READ_ERR 0x40000000
183#define FFB_UCSR_FIFO_OVFL 0x80000000 183#define FFB_UCSR_FIFO_OVFL 0x80000000
184#define FFB_UCSR_ALL_ERRORS (FFB_UCSR_READ_ERR|FFB_UCSR_FIFO_OVFL) 184#define FFB_UCSR_ALL_ERRORS (FFB_UCSR_READ_ERR|FFB_UCSR_FIFO_OVFL)
185 185
186struct ffb_fbc { 186struct ffb_fbc {
187 /* Next vertex registers */ 187 /* Next vertex registers */
@@ -197,7 +197,7 @@ struct ffb_fbc {
197 u32 ryf; 197 u32 ryf;
198 u32 rxf; 198 u32 rxf;
199 u32 xxx3[2]; 199 u32 xxx3[2];
200 200
201 u32 dmyf; 201 u32 dmyf;
202 u32 dmxf; 202 u32 dmxf;
203 u32 xxx4[2]; 203 u32 xxx4[2];
@@ -211,13 +211,13 @@ struct ffb_fbc {
211 u32 bh; 211 u32 bh;
212 u32 bw; 212 u32 bw;
213 u32 xxx6[2]; 213 u32 xxx6[2];
214 214
215 u32 xxx7[32]; 215 u32 xxx7[32];
216 216
217 /* Setup unit vertex state register */ 217 /* Setup unit vertex state register */
218 u32 suvtx; 218 u32 suvtx;
219 u32 xxx8[63]; 219 u32 xxx8[63];
220 220
221 /* Control registers */ 221 /* Control registers */
222 u32 ppc; 222 u32 ppc;
223 u32 wid; 223 u32 wid;
@@ -235,7 +235,7 @@ struct ffb_fbc {
235 u32 dcsb; 235 u32 dcsb;
236 u32 dczf; 236 u32 dczf;
237 u32 dczb; 237 u32 dczb;
238 238
239 u32 xxx9; 239 u32 xxx9;
240 u32 blendc; 240 u32 blendc;
241 u32 blendc1; 241 u32 blendc1;
@@ -252,7 +252,7 @@ struct ffb_fbc {
252 u32 fbcfg1; 252 u32 fbcfg1;
253 u32 fbcfg2; 253 u32 fbcfg2;
254 u32 fbcfg3; 254 u32 fbcfg3;
255 255
256 u32 ppcfg; 256 u32 ppcfg;
257 u32 pick; 257 u32 pick;
258 u32 fillmode; 258 u32 fillmode;
@@ -269,7 +269,7 @@ struct ffb_fbc {
269 u32 clip2max; 269 u32 clip2max;
270 u32 clip3min; 270 u32 clip3min;
271 u32 clip3max; 271 u32 clip3max;
272 272
273 /* New 3dRAM III support regs */ 273 /* New 3dRAM III support regs */
274 u32 rawblend2; 274 u32 rawblend2;
275 u32 rawpreblend; 275 u32 rawpreblend;
@@ -287,7 +287,7 @@ struct ffb_fbc {
287 u32 rawcmp; 287 u32 rawcmp;
288 u32 rawwac; 288 u32 rawwac;
289 u32 fbramid; 289 u32 fbramid;
290 290
291 u32 drawop; 291 u32 drawop;
292 u32 xxx10[2]; 292 u32 xxx10[2];
293 u32 fontlpat; 293 u32 fontlpat;
@@ -302,7 +302,7 @@ struct ffb_fbc {
302 u32 stencil; 302 u32 stencil;
303 u32 stencilctl; 303 u32 stencilctl;
304 304
305 u32 xxx13[4]; 305 u32 xxx13[4];
306 u32 dcss1; 306 u32 dcss1;
307 u32 dcss2; 307 u32 dcss2;
308 u32 dcss3; 308 u32 dcss3;
@@ -315,17 +315,17 @@ struct ffb_fbc {
315 u32 dcd3; 315 u32 dcd3;
316 u32 dcd4; 316 u32 dcd4;
317 u32 xxx15; 317 u32 xxx15;
318 318
319 u32 pattern[32]; 319 u32 pattern[32];
320 320
321 u32 xxx16[256]; 321 u32 xxx16[256];
322 322
323 u32 devid; 323 u32 devid;
324 u32 xxx17[63]; 324 u32 xxx17[63];
325 325
326 u32 ucsr; 326 u32 ucsr;
327 u32 xxx18[31]; 327 u32 xxx18[31];
328 328
329 u32 mer; 329 u32 mer;
330}; 330};
331 331
@@ -336,20 +336,20 @@ struct ffb_dac {
336 u32 value2; 336 u32 value2;
337}; 337};
338 338
339#define FFB_DAC_UCTRL 0x1001 /* User Control */ 339#define FFB_DAC_UCTRL 0x1001 /* User Control */
340#define FFB_DAC_UCTRL_MANREV 0x00000f00 /* 4-bit Manufacturing Revision */ 340#define FFB_DAC_UCTRL_MANREV 0x00000f00 /* 4-bit Manufacturing Revision */
341#define FFB_DAC_UCTRL_MANREV_SHIFT 8 341#define FFB_DAC_UCTRL_MANREV_SHIFT 8
342#define FFB_DAC_TGEN 0x6000 /* Timing Generator */ 342#define FFB_DAC_TGEN 0x6000 /* Timing Generator */
343#define FFB_DAC_TGEN_VIDE 0x00000001 /* Video Enable */ 343#define FFB_DAC_TGEN_VIDE 0x00000001 /* Video Enable */
344#define FFB_DAC_DID 0x8000 /* Device Identification */ 344#define FFB_DAC_DID 0x8000 /* Device Identification */
345#define FFB_DAC_DID_PNUM 0x0ffff000 /* Device Part Number */ 345#define FFB_DAC_DID_PNUM 0x0ffff000 /* Device Part Number */
346#define FFB_DAC_DID_PNUM_SHIFT 12 346#define FFB_DAC_DID_PNUM_SHIFT 12
347#define FFB_DAC_DID_REV 0xf0000000 /* Device Revision */ 347#define FFB_DAC_DID_REV 0xf0000000 /* Device Revision */
348#define FFB_DAC_DID_REV_SHIFT 28 348#define FFB_DAC_DID_REV_SHIFT 28
349 349
350#define FFB_DAC_CUR_CTRL 0x100 350#define FFB_DAC_CUR_CTRL 0x100
351#define FFB_DAC_CUR_CTRL_P0 0x00000001 351#define FFB_DAC_CUR_CTRL_P0 0x00000001
352#define FFB_DAC_CUR_CTRL_P1 0x00000002 352#define FFB_DAC_CUR_CTRL_P1 0x00000002
353 353
354struct ffb_par { 354struct ffb_par {
355 spinlock_t lock; 355 spinlock_t lock;
@@ -382,7 +382,9 @@ static void FFBFifo(struct ffb_par *par, int n)
382 382
383 if (cache - n < 0) { 383 if (cache - n < 0) {
384 fbc = par->fbc; 384 fbc = par->fbc;
385 do { cache = (upa_readl(&fbc->ucsr) & FFB_UCSR_FIFO_MASK) - 8; 385 do {
386 cache = (upa_readl(&fbc->ucsr) & FFB_UCSR_FIFO_MASK);
387 cache -= 8;
386 } while (cache - n < 0); 388 } while (cache - n < 0);
387 } 389 }
388 par->fifo_cache = cache - n; 390 par->fifo_cache = cache - n;
@@ -401,12 +403,12 @@ static void FFBWait(struct ffb_par *par)
401 upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr); 403 upa_writel(FFB_UCSR_ALL_ERRORS, &fbc->ucsr);
402 } 404 }
403 udelay(10); 405 udelay(10);
404 } while(--limit > 0); 406 } while (--limit > 0);
405} 407}
406 408
407static int ffb_sync(struct fb_info *p) 409static int ffb_sync(struct fb_info *p)
408{ 410{
409 struct ffb_par *par = (struct ffb_par *) p->par; 411 struct ffb_par *par = (struct ffb_par *)p->par;
410 412
411 FFBWait(par); 413 FFBWait(par);
412 return 0; 414 return 0;
@@ -431,8 +433,8 @@ static void ffb_switch_from_graph(struct ffb_par *par)
431 FFBWait(par); 433 FFBWait(par);
432 par->fifo_cache = 0; 434 par->fifo_cache = 0;
433 FFBFifo(par, 7); 435 FFBFifo(par, 7);
434 upa_writel(FFB_PPC_VCE_DISABLE|FFB_PPC_TBE_OPAQUE| 436 upa_writel(FFB_PPC_VCE_DISABLE | FFB_PPC_TBE_OPAQUE |
435 FFB_PPC_APE_DISABLE|FFB_PPC_CS_CONST, 437 FFB_PPC_APE_DISABLE | FFB_PPC_CS_CONST,
436 &fbc->ppc); 438 &fbc->ppc);
437 upa_writel(0x2000707f, &fbc->fbc); 439 upa_writel(0x2000707f, &fbc->fbc);
438 upa_writel(par->rop_cache, &fbc->rop); 440 upa_writel(par->rop_cache, &fbc->rop);
@@ -455,7 +457,7 @@ static void ffb_switch_from_graph(struct ffb_par *par)
455 457
456static int ffb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info) 458static int ffb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
457{ 459{
458 struct ffb_par *par = (struct ffb_par *) info->par; 460 struct ffb_par *par = (struct ffb_par *)info->par;
459 461
460 /* We just use this to catch switches out of 462 /* We just use this to catch switches out of
461 * graphics mode. 463 * graphics mode.
@@ -468,16 +470,14 @@ static int ffb_pan_display(struct fb_var_screeninfo *var, struct fb_info *info)
468} 470}
469 471
470/** 472/**
471 * ffb_fillrect - REQUIRED function. Can use generic routines if 473 * ffb_fillrect - Draws a rectangle on the screen.
472 * non acclerated hardware and packed pixel based.
473 * Draws a rectangle on the screen.
474 * 474 *
475 * @info: frame buffer structure that represents a single frame buffer 475 * @info: frame buffer structure that represents a single frame buffer
476 * @rect: structure defining the rectagle and operation. 476 * @rect: structure defining the rectagle and operation.
477 */ 477 */
478static void ffb_fillrect(struct fb_info *info, const struct fb_fillrect *rect) 478static void ffb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
479{ 479{
480 struct ffb_par *par = (struct ffb_par *) info->par; 480 struct ffb_par *par = (struct ffb_par *)info->par;
481 struct ffb_fbc __iomem *fbc = par->fbc; 481 struct ffb_fbc __iomem *fbc = par->fbc;
482 unsigned long flags; 482 unsigned long flags;
483 u32 fg; 483 u32 fg;
@@ -494,9 +494,9 @@ static void ffb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
494 par->fg_cache = fg; 494 par->fg_cache = fg;
495 } 495 }
496 496
497 ffb_rop(par, (rect->rop == ROP_COPY ? 497 ffb_rop(par, rect->rop == ROP_COPY ?
498 FFB_ROP_NEW : 498 FFB_ROP_NEW :
499 FFB_ROP_NEW_XOR_OLD)); 499 FFB_ROP_NEW_XOR_OLD);
500 500
501 FFBFifo(par, 5); 501 FFBFifo(par, 5);
502 upa_writel(FFB_DRAWOP_RECTANGLE, &fbc->drawop); 502 upa_writel(FFB_DRAWOP_RECTANGLE, &fbc->drawop);
@@ -509,18 +509,15 @@ static void ffb_fillrect(struct fb_info *info, const struct fb_fillrect *rect)
509} 509}
510 510
511/** 511/**
512 * ffb_copyarea - REQUIRED function. Can use generic routines if 512 * ffb_copyarea - Copies on area of the screen to another area.
513 * non acclerated hardware and packed pixel based.
514 * Copies on area of the screen to another area.
515 * 513 *
516 * @info: frame buffer structure that represents a single frame buffer 514 * @info: frame buffer structure that represents a single frame buffer
517 * @area: structure defining the source and destination. 515 * @area: structure defining the source and destination.
518 */ 516 */
519 517
520static void 518static void ffb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
521ffb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
522{ 519{
523 struct ffb_par *par = (struct ffb_par *) info->par; 520 struct ffb_par *par = (struct ffb_par *)info->par;
524 struct ffb_fbc __iomem *fbc = par->fbc; 521 struct ffb_fbc __iomem *fbc = par->fbc;
525 unsigned long flags; 522 unsigned long flags;
526 523
@@ -547,16 +544,14 @@ ffb_copyarea(struct fb_info *info, const struct fb_copyarea *area)
547} 544}
548 545
549/** 546/**
550 * ffb_imageblit - REQUIRED function. Can use generic routines if 547 * ffb_imageblit - Copies a image from system memory to the screen.
551 * non acclerated hardware and packed pixel based.
552 * Copies a image from system memory to the screen.
553 * 548 *
554 * @info: frame buffer structure that represents a single frame buffer 549 * @info: frame buffer structure that represents a single frame buffer
555 * @image: structure defining the image. 550 * @image: structure defining the image.
556 */ 551 */
557static void ffb_imageblit(struct fb_info *info, const struct fb_image *image) 552static void ffb_imageblit(struct fb_info *info, const struct fb_image *image)
558{ 553{
559 struct ffb_par *par = (struct ffb_par *) info->par; 554 struct ffb_par *par = (struct ffb_par *)info->par;
560 struct ffb_fbc __iomem *fbc = par->fbc; 555 struct ffb_fbc __iomem *fbc = par->fbc;
561 const u8 *data = image->data; 556 const u8 *data = image->data;
562 unsigned long flags; 557 unsigned long flags;
@@ -644,13 +639,14 @@ static void ffb_fixup_var_rgb(struct fb_var_screeninfo *var)
644} 639}
645 640
646/** 641/**
647 * ffb_setcolreg - Optional function. Sets a color register. 642 * ffb_setcolreg - Sets a color register.
648 * @regno: boolean, 0 copy local, 1 get_user() function 643 *
649 * @red: frame buffer colormap structure 644 * @regno: boolean, 0 copy local, 1 get_user() function
650 * @green: The green value which can be up to 16 bits wide 645 * @red: frame buffer colormap structure
651 * @blue: The blue value which can be up to 16 bits wide. 646 * @green: The green value which can be up to 16 bits wide
652 * @transp: If supported the alpha value which can be up to 16 bits wide. 647 * @blue: The blue value which can be up to 16 bits wide.
653 * @info: frame buffer info structure 648 * @transp: If supported the alpha value which can be up to 16 bits wide.
649 * @info: frame buffer info structure
654 */ 650 */
655static int ffb_setcolreg(unsigned regno, 651static int ffb_setcolreg(unsigned regno,
656 unsigned red, unsigned green, unsigned blue, 652 unsigned red, unsigned green, unsigned blue,
@@ -672,14 +668,13 @@ static int ffb_setcolreg(unsigned regno,
672} 668}
673 669
674/** 670/**
675 * ffb_blank - Optional function. Blanks the display. 671 * ffb_blank - Optional function. Blanks the display.
676 * @blank_mode: the blank mode we want. 672 * @blank_mode: the blank mode we want.
677 * @info: frame buffer structure that represents a single frame buffer 673 * @info: frame buffer structure that represents a single frame buffer
678 */ 674 */
679static int 675static int ffb_blank(int blank, struct fb_info *info)
680ffb_blank(int blank, struct fb_info *info)
681{ 676{
682 struct ffb_par *par = (struct ffb_par *) info->par; 677 struct ffb_par *par = (struct ffb_par *)info->par;
683 struct ffb_dac __iomem *dac = par->dac; 678 struct ffb_dac __iomem *dac = par->dac;
684 unsigned long flags; 679 unsigned long flags;
685 u32 val; 680 u32 val;
@@ -867,7 +862,7 @@ static int ffb_mmap(struct fb_info *info, struct vm_area_struct *vma)
867 862
868static int ffb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) 863static int ffb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
869{ 864{
870 struct ffb_par *par = (struct ffb_par *) info->par; 865 struct ffb_par *par = (struct ffb_par *)info->par;
871 866
872 return sbusfb_ioctl_helper(cmd, arg, info, 867 return sbusfb_ioctl_helper(cmd, arg, info,
873 FBTYPE_CREATOR, 24, par->fbsize); 868 FBTYPE_CREATOR, 24, par->fbsize);
@@ -877,8 +872,7 @@ static int ffb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
877 * Initialisation 872 * Initialisation
878 */ 873 */
879 874
880static void 875static void ffb_init_fix(struct fb_info *info)
881ffb_init_fix(struct fb_info *info)
882{ 876{
883 struct ffb_par *par = (struct ffb_par *)info->par; 877 struct ffb_par *par = (struct ffb_par *)info->par;
884 const char *ffb_type_name; 878 const char *ffb_type_name;
@@ -902,7 +896,8 @@ ffb_init_fix(struct fb_info *info)
902 info->fix.accel = FB_ACCEL_SUN_CREATOR; 896 info->fix.accel = FB_ACCEL_SUN_CREATOR;
903} 897}
904 898
905static int __devinit ffb_probe(struct of_device *op, const struct of_device_id *match) 899static int __devinit ffb_probe(struct of_device *op,
900 const struct of_device_id *match)
906{ 901{
907 struct device_node *dp = op->node; 902 struct device_node *dp = op->node;
908 struct ffb_fbc __iomem *fbc; 903 struct ffb_fbc __iomem *fbc;