aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtvfb.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/media/video/ivtv/ivtvfb.c')
-rw-r--r--drivers/media/video/ivtv/ivtvfb.c168
1 files changed, 84 insertions, 84 deletions
diff --git a/drivers/media/video/ivtv/ivtvfb.c b/drivers/media/video/ivtv/ivtvfb.c
index c8ca7cbbe38b..73e46f94b45a 100644
--- a/drivers/media/video/ivtv/ivtvfb.c
+++ b/drivers/media/video/ivtv/ivtvfb.c
@@ -52,8 +52,8 @@
52#include "ivtv-mailbox.h" 52#include "ivtv-mailbox.h"
53 53
54/* card parameters */ 54/* card parameters */
55static int ivtv_fb_card_id = -1; 55static int ivtvfb_card_id = -1;
56static int ivtv_fb_debug = 0; 56static int ivtvfb_debug = 0;
57static int osd_laced; 57static int osd_laced;
58static int osd_compat; 58static int osd_compat;
59static int osd_depth; 59static int osd_depth;
@@ -62,8 +62,8 @@ static int osd_left;
62static int osd_yres; 62static int osd_yres;
63static int osd_xres; 63static int osd_xres;
64 64
65module_param(ivtv_fb_card_id, int, 0444); 65module_param(ivtvfb_card_id, int, 0444);
66module_param_named(debug,ivtv_fb_debug, int, 0644); 66module_param_named(debug,ivtvfb_debug, int, 0644);
67module_param(osd_laced, bool, 0444); 67module_param(osd_laced, bool, 0444);
68module_param(osd_compat, bool, 0444); 68module_param(osd_compat, bool, 0444);
69module_param(osd_depth, int, 0444); 69module_param(osd_depth, int, 0444);
@@ -72,7 +72,7 @@ module_param(osd_left, int, 0444);
72module_param(osd_yres, int, 0444); 72module_param(osd_yres, int, 0444);
73module_param(osd_xres, int, 0444); 73module_param(osd_xres, int, 0444);
74 74
75MODULE_PARM_DESC(ivtv_fb_card_id, 75MODULE_PARM_DESC(ivtvfb_card_id,
76 "Only use framebuffer of the specified ivtv card (0-31)\n" 76 "Only use framebuffer of the specified ivtv card (0-31)\n"
77 "\t\t\tdefault -1: initialize all available framebuffers"); 77 "\t\t\tdefault -1: initialize all available framebuffers");
78 78
@@ -122,21 +122,21 @@ MODULE_LICENSE("GPL");
122 122
123/* --------------------------------------------------------------------- */ 123/* --------------------------------------------------------------------- */
124 124
125#define IVTV_FB_DBGFLG_WARN (1 << 0) 125#define IVTVFB_DBGFLG_WARN (1 << 0)
126#define IVTV_FB_DBGFLG_INFO (1 << 1) 126#define IVTVFB_DBGFLG_INFO (1 << 1)
127 127
128#define IVTV_FB_DEBUG(x, type, fmt, args...) \ 128#define IVTVFB_DEBUG(x, type, fmt, args...) \
129 do { \ 129 do { \
130 if ((x) & ivtv_fb_debug) \ 130 if ((x) & ivtvfb_debug) \
131 printk(KERN_INFO "ivtvfb%d " type ": " fmt, itv->num , ## args); \ 131 printk(KERN_INFO "ivtvfb%d " type ": " fmt, itv->num , ## args); \
132 } while (0) 132 } while (0)
133#define IVTV_FB_DEBUG_WARN(fmt, args...) IVTV_FB_DEBUG(IVTV_FB_DBGFLG_WARN, "warning", fmt , ## args) 133#define IVTVFB_DEBUG_WARN(fmt, args...) IVTVFB_DEBUG(IVTVFB_DBGFLG_WARN, "warning", fmt , ## args)
134#define IVTV_FB_DEBUG_INFO(fmt, args...) IVTV_FB_DEBUG(IVTV_FB_DBGFLG_INFO, "info", fmt , ## args) 134#define IVTVFB_DEBUG_INFO(fmt, args...) IVTVFB_DEBUG(IVTVFB_DBGFLG_INFO, "info", fmt , ## args)
135 135
136/* Standard kernel messages */ 136/* Standard kernel messages */
137#define IVTV_FB_ERR(fmt, args...) printk(KERN_ERR "ivtvfb%d: " fmt, itv->num , ## args) 137#define IVTVFB_ERR(fmt, args...) printk(KERN_ERR "ivtvfb%d: " fmt, itv->num , ## args)
138#define IVTV_FB_WARN(fmt, args...) printk(KERN_WARNING "ivtvfb%d: " fmt, itv->num , ## args) 138#define IVTVFB_WARN(fmt, args...) printk(KERN_WARNING "ivtvfb%d: " fmt, itv->num , ## args)
139#define IVTV_FB_INFO(fmt, args...) printk(KERN_INFO "ivtvfb%d: " fmt, itv->num , ## args) 139#define IVTVFB_INFO(fmt, args...) printk(KERN_INFO "ivtvfb%d: " fmt, itv->num , ## args)
140 140
141/* --------------------------------------------------------------------- */ 141/* --------------------------------------------------------------------- */
142 142
@@ -201,7 +201,7 @@ struct ivtv_osd_coords {
201 201
202/* ivtv API calls for framebuffer related support */ 202/* ivtv API calls for framebuffer related support */
203 203
204static int ivtv_fb_get_framebuffer(struct ivtv *itv, u32 *fbbase, 204static int ivtvfb_get_framebuffer(struct ivtv *itv, u32 *fbbase,
205 u32 *fblength) 205 u32 *fblength)
206{ 206{
207 u32 data[CX2341X_MBOX_MAX_DATA]; 207 u32 data[CX2341X_MBOX_MAX_DATA];
@@ -213,7 +213,7 @@ static int ivtv_fb_get_framebuffer(struct ivtv *itv, u32 *fbbase,
213 return rc; 213 return rc;
214} 214}
215 215
216static int ivtv_fb_get_osd_coords(struct ivtv *itv, 216static int ivtvfb_get_osd_coords(struct ivtv *itv,
217 struct ivtv_osd_coords *osd) 217 struct ivtv_osd_coords *osd)
218{ 218{
219 struct osd_info *oi = itv->osd_info; 219 struct osd_info *oi = itv->osd_info;
@@ -230,7 +230,7 @@ static int ivtv_fb_get_osd_coords(struct ivtv *itv,
230 return 0; 230 return 0;
231} 231}
232 232
233static int ivtv_fb_set_osd_coords(struct ivtv *itv, const struct ivtv_osd_coords *osd) 233static int ivtvfb_set_osd_coords(struct ivtv *itv, const struct ivtv_osd_coords *osd)
234{ 234{
235 struct osd_info *oi = itv->osd_info; 235 struct osd_info *oi = itv->osd_info;
236 236
@@ -245,7 +245,7 @@ static int ivtv_fb_set_osd_coords(struct ivtv *itv, const struct ivtv_osd_coords
245 osd->lines, osd->x, osd->y); 245 osd->lines, osd->x, osd->y);
246} 246}
247 247
248static int ivtv_fb_set_display_window(struct ivtv *itv, struct v4l2_rect *ivtv_window) 248static int ivtvfb_set_display_window(struct ivtv *itv, struct v4l2_rect *ivtv_window)
249{ 249{
250 int osd_height_limit = itv->is_50hz ? 576 : 480; 250 int osd_height_limit = itv->is_50hz ? 576 : 480;
251 251
@@ -255,13 +255,13 @@ static int ivtv_fb_set_display_window(struct ivtv *itv, struct v4l2_rect *ivtv_w
255 255
256 /* Ensure we don't exceed display limits */ 256 /* Ensure we don't exceed display limits */
257 if (ivtv_window->top + ivtv_window->height > osd_height_limit) { 257 if (ivtv_window->top + ivtv_window->height > osd_height_limit) {
258 IVTV_FB_DEBUG_WARN("ivtv_ioctl_fb_set_display_window - Invalid height setting (%d, %d)\n", 258 IVTVFB_DEBUG_WARN("ivtv_ioctl_fb_set_display_window - Invalid height setting (%d, %d)\n",
259 ivtv_window->top, ivtv_window->height); 259 ivtv_window->top, ivtv_window->height);
260 ivtv_window->top = osd_height_limit - ivtv_window->height; 260 ivtv_window->top = osd_height_limit - ivtv_window->height;
261 } 261 }
262 262
263 if (ivtv_window->left + ivtv_window->width > IVTV_OSD_MAX_WIDTH) { 263 if (ivtv_window->left + ivtv_window->width > IVTV_OSD_MAX_WIDTH) {
264 IVTV_FB_DEBUG_WARN("ivtv_ioctl_fb_set_display_window - Invalid width setting (%d, %d)\n", 264 IVTVFB_DEBUG_WARN("ivtv_ioctl_fb_set_display_window - Invalid width setting (%d, %d)\n",
265 ivtv_window->left, ivtv_window->width); 265 ivtv_window->left, ivtv_window->width);
266 ivtv_window->left = IVTV_OSD_MAX_WIDTH - ivtv_window->width; 266 ivtv_window->left = IVTV_OSD_MAX_WIDTH - ivtv_window->width;
267 } 267 }
@@ -281,7 +281,7 @@ static int ivtv_fb_set_display_window(struct ivtv *itv, struct v4l2_rect *ivtv_w
281 return 0; 281 return 0;
282} 282}
283 283
284static int ivtv_fb_prep_dec_dma_to_device(struct ivtv *itv, 284static int ivtvfb_prep_dec_dma_to_device(struct ivtv *itv,
285 unsigned long ivtv_dest_addr, void __user *userbuf, 285 unsigned long ivtv_dest_addr, void __user *userbuf,
286 int size_in_bytes) 286 int size_in_bytes)
287{ 287{
@@ -293,7 +293,7 @@ static int ivtv_fb_prep_dec_dma_to_device(struct ivtv *itv,
293 /* Map User DMA */ 293 /* Map User DMA */
294 if (ivtv_udma_setup(itv, ivtv_dest_addr, userbuf, size_in_bytes) <= 0) { 294 if (ivtv_udma_setup(itv, ivtv_dest_addr, userbuf, size_in_bytes) <= 0) {
295 mutex_unlock(&itv->udma.lock); 295 mutex_unlock(&itv->udma.lock);
296 IVTV_FB_WARN("ivtvfb_prep_dec_dma_to_device, " 296 IVTVFB_WARN("ivtvfb_prep_dec_dma_to_device, "
297 "Error with get_user_pages: %d bytes, %d pages returned\n", 297 "Error with get_user_pages: %d bytes, %d pages returned\n",
298 size_in_bytes, itv->udma.page_count); 298 size_in_bytes, itv->udma.page_count);
299 299
@@ -301,7 +301,7 @@ static int ivtv_fb_prep_dec_dma_to_device(struct ivtv *itv,
301 return -EIO; 301 return -EIO;
302 } 302 }
303 303
304 IVTV_FB_DEBUG_INFO("ivtvfb_prep_dec_dma_to_device, %d bytes, %d pages\n", 304 IVTVFB_DEBUG_INFO("ivtvfb_prep_dec_dma_to_device, %d bytes, %d pages\n",
305 size_in_bytes, itv->udma.page_count); 305 size_in_bytes, itv->udma.page_count);
306 306
307 ivtv_udma_prepare(itv); 307 ivtv_udma_prepare(itv);
@@ -330,7 +330,7 @@ static int ivtv_fb_prep_dec_dma_to_device(struct ivtv *itv,
330 return ret; 330 return ret;
331} 331}
332 332
333static int ivtv_fb_prep_frame(struct ivtv *itv, int cmd, void __user *source, 333static int ivtvfb_prep_frame(struct ivtv *itv, int cmd, void __user *source,
334 unsigned long dest_offset, int count) 334 unsigned long dest_offset, int count)
335{ 335{
336 DEFINE_WAIT(wait); 336 DEFINE_WAIT(wait);
@@ -338,34 +338,34 @@ static int ivtv_fb_prep_frame(struct ivtv *itv, int cmd, void __user *source,
338 338
339 /* Nothing to do */ 339 /* Nothing to do */
340 if (count == 0) { 340 if (count == 0) {
341 IVTV_FB_DEBUG_WARN("ivtv_fb_prep_frame: Nothing to do. count = 0\n"); 341 IVTVFB_DEBUG_WARN("ivtvfb_prep_frame: Nothing to do. count = 0\n");
342 return -EINVAL; 342 return -EINVAL;
343 } 343 }
344 344
345 /* Check Total FB Size */ 345 /* Check Total FB Size */
346 if ((dest_offset + count) > oi->video_buffer_size) { 346 if ((dest_offset + count) > oi->video_buffer_size) {
347 IVTV_FB_WARN("ivtv_fb_prep_frame: Overflowing the framebuffer %ld, only %d available\n", 347 IVTVFB_WARN("ivtvfb_prep_frame: Overflowing the framebuffer %ld, only %d available\n",
348 dest_offset + count, oi->video_buffer_size); 348 dest_offset + count, oi->video_buffer_size);
349 return -E2BIG; 349 return -E2BIG;
350 } 350 }
351 351
352 /* Not fatal, but will have undesirable results */ 352 /* Not fatal, but will have undesirable results */
353 if ((unsigned long)source & 3) 353 if ((unsigned long)source & 3)
354 IVTV_FB_WARN("ivtv_fb_prep_frame: Source address not 32 bit aligned (0x%08lx)\n", 354 IVTVFB_WARN("ivtvfb_prep_frame: Source address not 32 bit aligned (0x%08lx)\n",
355 (unsigned long)source); 355 (unsigned long)source);
356 356
357 if (dest_offset & 3) 357 if (dest_offset & 3)
358 IVTV_FB_WARN("ivtv_fb_prep_frame: Dest offset not 32 bit aligned (%ld)\n", dest_offset); 358 IVTVFB_WARN("ivtvfb_prep_frame: Dest offset not 32 bit aligned (%ld)\n", dest_offset);
359 359
360 if (count & 3) 360 if (count & 3)
361 IVTV_FB_WARN("ivtv_fb_prep_frame: Count not a multiple of 4 (%d)\n", count); 361 IVTVFB_WARN("ivtvfb_prep_frame: Count not a multiple of 4 (%d)\n", count);
362 362
363 /* Check Source */ 363 /* Check Source */
364 if (!access_ok(VERIFY_READ, source + dest_offset, count)) { 364 if (!access_ok(VERIFY_READ, source + dest_offset, count)) {
365 IVTV_FB_WARN("Invalid userspace pointer 0x%08lx\n", 365 IVTVFB_WARN("Invalid userspace pointer 0x%08lx\n",
366 (unsigned long)source); 366 (unsigned long)source);
367 367
368 IVTV_FB_DEBUG_WARN("access_ok() failed for offset 0x%08lx source 0x%08lx count %d\n", 368 IVTVFB_DEBUG_WARN("access_ok() failed for offset 0x%08lx source 0x%08lx count %d\n",
369 dest_offset, (unsigned long)source, 369 dest_offset, (unsigned long)source,
370 count); 370 count);
371 return -EINVAL; 371 return -EINVAL;
@@ -375,7 +375,7 @@ static int ivtv_fb_prep_frame(struct ivtv *itv, int cmd, void __user *source,
375 dest_offset += IVTV_DECODER_OFFSET + oi->video_rbase; 375 dest_offset += IVTV_DECODER_OFFSET + oi->video_rbase;
376 376
377 /* Fill Buffers */ 377 /* Fill Buffers */
378 return ivtv_fb_prep_dec_dma_to_device(itv, dest_offset, source, count); 378 return ivtvfb_prep_dec_dma_to_device(itv, dest_offset, source, count);
379} 379}
380 380
381static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) 381static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg)
@@ -412,15 +412,15 @@ static int ivtvfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long ar
412 case IVTVFB_IOC_DMA_FRAME: { 412 case IVTVFB_IOC_DMA_FRAME: {
413 struct ivtvfb_dma_frame args; 413 struct ivtvfb_dma_frame args;
414 414
415 IVTV_FB_DEBUG_INFO("IVTVFB_IOC_DMA_FRAME\n"); 415 IVTVFB_DEBUG_INFO("IVTVFB_IOC_DMA_FRAME\n");
416 if (copy_from_user(&args, (void __user *)arg, sizeof(args))) 416 if (copy_from_user(&args, (void __user *)arg, sizeof(args)))
417 return -EFAULT; 417 return -EFAULT;
418 418
419 return ivtv_fb_prep_frame(itv, cmd, args.source, args.dest_offset, args.count); 419 return ivtvfb_prep_frame(itv, cmd, args.source, args.dest_offset, args.count);
420 } 420 }
421 421
422 default: 422 default:
423 IVTV_FB_DEBUG_INFO("Unknown ioctl %08x\n", cmd); 423 IVTVFB_DEBUG_INFO("Unknown ioctl %08x\n", cmd);
424 return -EINVAL; 424 return -EINVAL;
425 } 425 }
426 return 0; 426 return 0;
@@ -435,7 +435,7 @@ static int ivtvfb_set_var(struct ivtv *itv, struct fb_var_screeninfo *var)
435 struct v4l2_rect ivtv_window; 435 struct v4l2_rect ivtv_window;
436 int osd_mode = -1; 436 int osd_mode = -1;
437 437
438 IVTV_FB_DEBUG_INFO("ivtvfb_set_var\n"); 438 IVTVFB_DEBUG_INFO("ivtvfb_set_var\n");
439 439
440 /* Select color space */ 440 /* Select color space */
441 if (var->nonstd) /* YUV */ 441 if (var->nonstd) /* YUV */
@@ -463,11 +463,11 @@ static int ivtvfb_set_var(struct ivtv *itv, struct fb_var_screeninfo *var)
463 osd_mode = IVTV_OSD_BPP_16_565; 463 osd_mode = IVTV_OSD_BPP_16_565;
464 break; 464 break;
465 default: 465 default:
466 IVTV_FB_DEBUG_WARN("ivtvfb_set_var - Invalid bpp\n"); 466 IVTVFB_DEBUG_WARN("ivtvfb_set_var - Invalid bpp\n");
467 } 467 }
468 break; 468 break;
469 default: 469 default:
470 IVTV_FB_DEBUG_WARN("ivtvfb_set_var - Invalid bpp\n"); 470 IVTVFB_DEBUG_WARN("ivtvfb_set_var - Invalid bpp\n");
471 } 471 }
472 472
473 /* Change osd mode if needed. 473 /* Change osd mode if needed.
@@ -491,18 +491,18 @@ static int ivtvfb_set_var(struct ivtv *itv, struct fb_var_screeninfo *var)
491 ivtv_vapi(itv, CX2341X_OSD_SET_FLICKER_STATE, 1, 0); 491 ivtv_vapi(itv, CX2341X_OSD_SET_FLICKER_STATE, 1, 0);
492 break; 492 break;
493 default: 493 default:
494 IVTV_FB_DEBUG_WARN("ivtvfb_set_var - Invalid video mode\n"); 494 IVTVFB_DEBUG_WARN("ivtvfb_set_var - Invalid video mode\n");
495 } 495 }
496 496
497 /* Read the current osd info */ 497 /* Read the current osd info */
498 ivtv_fb_get_osd_coords(itv, &ivtv_osd); 498 ivtvfb_get_osd_coords(itv, &ivtv_osd);
499 499
500 /* Now set the OSD to the size we want */ 500 /* Now set the OSD to the size we want */
501 ivtv_osd.pixel_stride = var->xres_virtual; 501 ivtv_osd.pixel_stride = var->xres_virtual;
502 ivtv_osd.lines = var->yres_virtual; 502 ivtv_osd.lines = var->yres_virtual;
503 ivtv_osd.x = 0; 503 ivtv_osd.x = 0;
504 ivtv_osd.y = 0; 504 ivtv_osd.y = 0;
505 ivtv_fb_set_osd_coords(itv, &ivtv_osd); 505 ivtvfb_set_osd_coords(itv, &ivtv_osd);
506 506
507 /* Can't seem to find the right API combo for this. 507 /* Can't seem to find the right API combo for this.
508 Use another function which does what we need through direct register access. */ 508 Use another function which does what we need through direct register access. */
@@ -515,22 +515,22 @@ static int ivtvfb_set_var(struct ivtv *itv, struct fb_var_screeninfo *var)
515 ivtv_window.top = var->upper_margin - 1; 515 ivtv_window.top = var->upper_margin - 1;
516 ivtv_window.left = var->left_margin - 1; 516 ivtv_window.left = var->left_margin - 1;
517 517
518 ivtv_fb_set_display_window(itv, &ivtv_window); 518 ivtvfb_set_display_window(itv, &ivtv_window);
519 519
520 /* Force update of yuv registers */ 520 /* Force update of yuv registers */
521 itv->yuv_info.yuv_forced_update = 1; 521 itv->yuv_info.yuv_forced_update = 1;
522 522
523 IVTV_FB_DEBUG_INFO("Display size: %dx%d (virtual %dx%d) @ %dbpp\n", 523 IVTVFB_DEBUG_INFO("Display size: %dx%d (virtual %dx%d) @ %dbpp\n",
524 var->xres, var->yres, 524 var->xres, var->yres,
525 var->xres_virtual, var->yres_virtual, 525 var->xres_virtual, var->yres_virtual,
526 var->bits_per_pixel); 526 var->bits_per_pixel);
527 527
528 IVTV_FB_DEBUG_INFO("Display position: %d, %d\n", 528 IVTVFB_DEBUG_INFO("Display position: %d, %d\n",
529 var->left_margin, var->upper_margin); 529 var->left_margin, var->upper_margin);
530 530
531 IVTV_FB_DEBUG_INFO("Display filter: %s\n", 531 IVTVFB_DEBUG_INFO("Display filter: %s\n",
532 (var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED ? "on" : "off"); 532 (var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED ? "on" : "off");
533 IVTV_FB_DEBUG_INFO("Color space: %s\n", var->nonstd ? "YUV" : "RGB"); 533 IVTVFB_DEBUG_INFO("Color space: %s\n", var->nonstd ? "YUV" : "RGB");
534 534
535 return 0; 535 return 0;
536} 536}
@@ -539,7 +539,7 @@ static int ivtvfb_get_fix(struct ivtv *itv, struct fb_fix_screeninfo *fix)
539{ 539{
540 struct osd_info *oi = itv->osd_info; 540 struct osd_info *oi = itv->osd_info;
541 541
542 IVTV_FB_DEBUG_INFO("ivtvfb_get_fix\n"); 542 IVTVFB_DEBUG_INFO("ivtvfb_get_fix\n");
543 memset(fix, 0, sizeof(struct fb_fix_screeninfo)); 543 memset(fix, 0, sizeof(struct fb_fix_screeninfo));
544 strcpy(fix->id, "cx23415 TV out"); 544 strcpy(fix->id, "cx23415 TV out");
545 fix->smem_start = oi->video_pbase; 545 fix->smem_start = oi->video_pbase;
@@ -563,7 +563,7 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv)
563 int osd_height_limit; 563 int osd_height_limit;
564 u32 pixclock, hlimit, vlimit; 564 u32 pixclock, hlimit, vlimit;
565 565
566 IVTV_FB_DEBUG_INFO("ivtvfb_check_var\n"); 566 IVTVFB_DEBUG_INFO("ivtvfb_check_var\n");
567 567
568 /* Set base references for mode calcs. */ 568 /* Set base references for mode calcs. */
569 if (itv->is_50hz) { 569 if (itv->is_50hz) {
@@ -582,7 +582,7 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv)
582 /* Check the bits per pixel */ 582 /* Check the bits per pixel */
583 if (osd_compat) { 583 if (osd_compat) {
584 if (var->bits_per_pixel != 32) { 584 if (var->bits_per_pixel != 32) {
585 IVTV_FB_DEBUG_WARN("Invalid colour mode: %d\n", var->bits_per_pixel); 585 IVTVFB_DEBUG_WARN("Invalid colour mode: %d\n", var->bits_per_pixel);
586 return -EINVAL; 586 return -EINVAL;
587 } 587 }
588 } 588 }
@@ -633,7 +633,7 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv)
633 } 633 }
634 } 634 }
635 else { 635 else {
636 IVTV_FB_DEBUG_WARN("Invalid colour mode: %d\n", var->bits_per_pixel); 636 IVTVFB_DEBUG_WARN("Invalid colour mode: %d\n", var->bits_per_pixel);
637 return -EINVAL; 637 return -EINVAL;
638 } 638 }
639 639
@@ -643,14 +643,14 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv)
643 var->yres != oi->ivtvfb_defined.yres || 643 var->yres != oi->ivtvfb_defined.yres ||
644 var->xres_virtual != oi->ivtvfb_defined.xres_virtual || 644 var->xres_virtual != oi->ivtvfb_defined.xres_virtual ||
645 var->yres_virtual != oi->ivtvfb_defined.yres_virtual) { 645 var->yres_virtual != oi->ivtvfb_defined.yres_virtual) {
646 IVTV_FB_DEBUG_WARN("Invalid resolution: %dx%d (virtual %dx%d)\n", 646 IVTVFB_DEBUG_WARN("Invalid resolution: %dx%d (virtual %dx%d)\n",
647 var->xres, var->yres, var->xres_virtual, var->yres_virtual); 647 var->xres, var->yres, var->xres_virtual, var->yres_virtual);
648 return -EINVAL; 648 return -EINVAL;
649 } 649 }
650 } 650 }
651 else { 651 else {
652 if (var->xres > IVTV_OSD_MAX_WIDTH || var->yres > osd_height_limit) { 652 if (var->xres > IVTV_OSD_MAX_WIDTH || var->yres > osd_height_limit) {
653 IVTV_FB_DEBUG_WARN("Invalid resolution: %dx%d\n", 653 IVTVFB_DEBUG_WARN("Invalid resolution: %dx%d\n",
654 var->xres, var->yres); 654 var->xres, var->yres);
655 return -EINVAL; 655 return -EINVAL;
656 } 656 }
@@ -660,7 +660,7 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv)
660 var->xres_virtual * var->yres_virtual * (var->bits_per_pixel / 8) > oi->video_buffer_size || 660 var->xres_virtual * var->yres_virtual * (var->bits_per_pixel / 8) > oi->video_buffer_size ||
661 var->xres_virtual < var->xres || 661 var->xres_virtual < var->xres ||
662 var->yres_virtual < var->yres) { 662 var->yres_virtual < var->yres) {
663 IVTV_FB_DEBUG_WARN("Invalid virtual resolution: %dx%d\n", 663 IVTVFB_DEBUG_WARN("Invalid virtual resolution: %dx%d\n",
664 var->xres_virtual, var->yres_virtual); 664 var->xres_virtual, var->yres_virtual);
665 return -EINVAL; 665 return -EINVAL;
666 } 666 }
@@ -670,43 +670,43 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv)
670 if (var->bits_per_pixel == 8) { 670 if (var->bits_per_pixel == 8) {
671 /* Width must be a multiple of 4 */ 671 /* Width must be a multiple of 4 */
672 if (var->xres & 3) { 672 if (var->xres & 3) {
673 IVTV_FB_DEBUG_WARN("Invalid resolution for 8bpp: %d\n", var->xres); 673 IVTVFB_DEBUG_WARN("Invalid resolution for 8bpp: %d\n", var->xres);
674 return -EINVAL; 674 return -EINVAL;
675 } 675 }
676 if (var->xres_virtual & 3) { 676 if (var->xres_virtual & 3) {
677 IVTV_FB_DEBUG_WARN("Invalid virtual resolution for 8bpp: %d)\n", var->xres_virtual); 677 IVTVFB_DEBUG_WARN("Invalid virtual resolution for 8bpp: %d)\n", var->xres_virtual);
678 return -EINVAL; 678 return -EINVAL;
679 } 679 }
680 } 680 }
681 else if (var->bits_per_pixel == 16) { 681 else if (var->bits_per_pixel == 16) {
682 /* Width must be a multiple of 2 */ 682 /* Width must be a multiple of 2 */
683 if (var->xres & 1) { 683 if (var->xres & 1) {
684 IVTV_FB_DEBUG_WARN("Invalid resolution for 16bpp: %d\n", var->xres); 684 IVTVFB_DEBUG_WARN("Invalid resolution for 16bpp: %d\n", var->xres);
685 return -EINVAL; 685 return -EINVAL;
686 } 686 }
687 if (var->xres_virtual & 1) { 687 if (var->xres_virtual & 1) {
688 IVTV_FB_DEBUG_WARN("Invalid virtual resolution for 16bpp: %d)\n", var->xres_virtual); 688 IVTVFB_DEBUG_WARN("Invalid virtual resolution for 16bpp: %d)\n", var->xres_virtual);
689 return -EINVAL; 689 return -EINVAL;
690 } 690 }
691 } 691 }
692 692
693 /* Now check the offsets */ 693 /* Now check the offsets */
694 if (var->xoffset >= var->xres_virtual || var->yoffset >= var->yres_virtual) { 694 if (var->xoffset >= var->xres_virtual || var->yoffset >= var->yres_virtual) {
695 IVTV_FB_DEBUG_WARN("Invalid offset: %d (%d) %d (%d)\n", 695 IVTVFB_DEBUG_WARN("Invalid offset: %d (%d) %d (%d)\n",
696 var->xoffset, var->xres_virtual, var->yoffset, var->yres_virtual); 696 var->xoffset, var->xres_virtual, var->yoffset, var->yres_virtual);
697 return -EINVAL; 697 return -EINVAL;
698 } 698 }
699 699
700 /* Check pixel format */ 700 /* Check pixel format */
701 if (var->nonstd > 1) { 701 if (var->nonstd > 1) {
702 IVTV_FB_DEBUG_WARN("Invalid nonstd % d\n", var->nonstd); 702 IVTVFB_DEBUG_WARN("Invalid nonstd % d\n", var->nonstd);
703 return -EINVAL; 703 return -EINVAL;
704 } 704 }
705 705
706 /* Check video mode */ 706 /* Check video mode */
707 if (((var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) && 707 if (((var->vmode & FB_VMODE_MASK) != FB_VMODE_NONINTERLACED) &&
708 ((var->vmode & FB_VMODE_MASK) != FB_VMODE_INTERLACED)) { 708 ((var->vmode & FB_VMODE_MASK) != FB_VMODE_INTERLACED)) {
709 IVTV_FB_DEBUG_WARN("Invalid video mode: %d\n", var->vmode & FB_VMODE_MASK); 709 IVTVFB_DEBUG_WARN("Invalid video mode: %d\n", var->vmode & FB_VMODE_MASK);
710 return -EINVAL; 710 return -EINVAL;
711 } 711 }
712 712
@@ -737,24 +737,24 @@ static int _ivtvfb_check_var(struct fb_var_screeninfo *var, struct ivtv *itv)
737 else 737 else
738 var->pixclock = pixclock; 738 var->pixclock = pixclock;
739 739
740 IVTV_FB_DEBUG_INFO("Display size: %dx%d (virtual %dx%d) @ %dbpp\n", 740 IVTVFB_DEBUG_INFO("Display size: %dx%d (virtual %dx%d) @ %dbpp\n",
741 var->xres, var->yres, 741 var->xres, var->yres,
742 var->xres_virtual, var->yres_virtual, 742 var->xres_virtual, var->yres_virtual,
743 var->bits_per_pixel); 743 var->bits_per_pixel);
744 744
745 IVTV_FB_DEBUG_INFO("Display position: %d, %d\n", 745 IVTVFB_DEBUG_INFO("Display position: %d, %d\n",
746 var->left_margin, var->upper_margin); 746 var->left_margin, var->upper_margin);
747 747
748 IVTV_FB_DEBUG_INFO("Display filter: %s\n", 748 IVTVFB_DEBUG_INFO("Display filter: %s\n",
749 (var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED ? "on" : "off"); 749 (var->vmode & FB_VMODE_MASK) == FB_VMODE_NONINTERLACED ? "on" : "off");
750 IVTV_FB_DEBUG_INFO("Color space: %s\n", var->nonstd ? "YUV" : "RGB"); 750 IVTVFB_DEBUG_INFO("Color space: %s\n", var->nonstd ? "YUV" : "RGB");
751 return 0; 751 return 0;
752} 752}
753 753
754static int ivtvfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info) 754static int ivtvfb_check_var(struct fb_var_screeninfo *var, struct fb_info *info)
755{ 755{
756 struct ivtv *itv = (struct ivtv *) info->par; 756 struct ivtv *itv = (struct ivtv *) info->par;
757 IVTV_FB_DEBUG_INFO("ivtvfb_check_var\n"); 757 IVTVFB_DEBUG_INFO("ivtvfb_check_var\n");
758 return _ivtvfb_check_var(var, itv); 758 return _ivtvfb_check_var(var, itv);
759} 759}
760 760
@@ -779,7 +779,7 @@ static int ivtvfb_set_par(struct fb_info *info)
779 int rc = 0; 779 int rc = 0;
780 struct ivtv *itv = (struct ivtv *) info->par; 780 struct ivtv *itv = (struct ivtv *) info->par;
781 781
782 IVTV_FB_DEBUG_INFO("ivtvfb_set_par\n"); 782 IVTVFB_DEBUG_INFO("ivtvfb_set_par\n");
783 783
784 rc = ivtvfb_set_var(itv, &info->var); 784 rc = ivtvfb_set_var(itv, &info->var);
785 ivtvfb_pan_display(&info->var, info); 785 ivtvfb_pan_display(&info->var, info);
@@ -836,7 +836,7 @@ static int ivtvfb_blank(int blank_mode, struct fb_info *info)
836{ 836{
837 struct ivtv *itv = (struct ivtv *)info->par; 837 struct ivtv *itv = (struct ivtv *)info->par;
838 838
839 IVTV_FB_DEBUG_INFO("Set blanking mode : %d\n", blank_mode); 839 IVTVFB_DEBUG_INFO("Set blanking mode : %d\n", blank_mode);
840 switch (blank_mode) { 840 switch (blank_mode) {
841 case FB_BLANK_UNBLANK: 841 case FB_BLANK_UNBLANK:
842 ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, 1); 842 ivtv_vapi(itv, CX2341X_OSD_SET_STATE, 1, 1);
@@ -902,7 +902,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
902 902
903 /* Check horizontal start (osd_left). */ 903 /* Check horizontal start (osd_left). */
904 if (osd_left && osd_left + start_window.width > 721) { 904 if (osd_left && osd_left + start_window.width > 721) {
905 IVTV_FB_ERR("Invalid osd_left - assuming default\n"); 905 IVTVFB_ERR("Invalid osd_left - assuming default\n");
906 osd_left = 0; 906 osd_left = 0;
907 } 907 }
908 908
@@ -928,7 +928,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
928 928
929 /* Check vertical start (osd_upper). */ 929 /* Check vertical start (osd_upper). */
930 if (osd_upper + start_window.height > max_height + 1) { 930 if (osd_upper + start_window.height > max_height + 1) {
931 IVTV_FB_ERR("Invalid osd_upper - assuming default\n"); 931 IVTVFB_ERR("Invalid osd_upper - assuming default\n");
932 osd_upper = 0; 932 osd_upper = 0;
933 } 933 }
934 934
@@ -980,7 +980,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
980 980
981 /* Allocate color map */ 981 /* Allocate color map */
982 if (fb_alloc_cmap(&oi->ivtvfb_info.cmap, 256, 1)) { 982 if (fb_alloc_cmap(&oi->ivtvfb_info.cmap, 256, 1)) {
983 IVTV_FB_ERR("abort, unable to alloc cmap\n"); 983 IVTVFB_ERR("abort, unable to alloc cmap\n");
984 return -ENOMEM; 984 return -ENOMEM;
985 } 985 }
986 986
@@ -988,7 +988,7 @@ static int ivtvfb_init_vidmode(struct ivtv *itv)
988 oi->ivtvfb_info.pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL); 988 oi->ivtvfb_info.pseudo_palette = kmalloc(sizeof(u32) * 16, GFP_KERNEL);
989 989
990 if (!oi->ivtvfb_info.pseudo_palette) { 990 if (!oi->ivtvfb_info.pseudo_palette) {
991 IVTV_FB_ERR("abort, unable to alloc pseudo pallete\n"); 991 IVTVFB_ERR("abort, unable to alloc pseudo pallete\n");
992 return -ENOMEM; 992 return -ENOMEM;
993 } 993 }
994 994
@@ -1004,12 +1004,12 @@ static int ivtvfb_init_io(struct ivtv *itv)
1004 mutex_lock(&itv->serialize_lock); 1004 mutex_lock(&itv->serialize_lock);
1005 if (ivtv_init_on_first_open(itv)) { 1005 if (ivtv_init_on_first_open(itv)) {
1006 mutex_unlock(&itv->serialize_lock); 1006 mutex_unlock(&itv->serialize_lock);
1007 IVTV_FB_ERR("Failed to initialize ivtv\n"); 1007 IVTVFB_ERR("Failed to initialize ivtv\n");
1008 return -ENXIO; 1008 return -ENXIO;
1009 } 1009 }
1010 mutex_unlock(&itv->serialize_lock); 1010 mutex_unlock(&itv->serialize_lock);
1011 1011
1012 ivtv_fb_get_framebuffer(itv, &oi->video_rbase, &oi->video_buffer_size); 1012 ivtvfb_get_framebuffer(itv, &oi->video_rbase, &oi->video_buffer_size);
1013 1013
1014 /* The osd buffer size depends on the number of video buffers allocated 1014 /* The osd buffer size depends on the number of video buffers allocated
1015 on the PVR350 itself. For now we'll hardcode the smallest osd buffer 1015 on the PVR350 itself. For now we'll hardcode the smallest osd buffer
@@ -1020,12 +1020,12 @@ static int ivtvfb_init_io(struct ivtv *itv)
1020 oi->video_vbase = itv->dec_mem + oi->video_rbase; 1020 oi->video_vbase = itv->dec_mem + oi->video_rbase;
1021 1021
1022 if (!oi->video_vbase) { 1022 if (!oi->video_vbase) {
1023 IVTV_FB_ERR("abort, video memory 0x%x @ 0x%lx isn't mapped!\n", 1023 IVTVFB_ERR("abort, video memory 0x%x @ 0x%lx isn't mapped!\n",
1024 oi->video_buffer_size, oi->video_pbase); 1024 oi->video_buffer_size, oi->video_pbase);
1025 return -EIO; 1025 return -EIO;
1026 } 1026 }
1027 1027
1028 IVTV_FB_INFO("Framebuffer at 0x%lx, mapped to 0x%p, size %dk\n", 1028 IVTVFB_INFO("Framebuffer at 0x%lx, mapped to 0x%p, size %dk\n",
1029 oi->video_pbase, oi->video_vbase, 1029 oi->video_pbase, oi->video_vbase,
1030 oi->video_buffer_size / 1024); 1030 oi->video_buffer_size / 1024);
1031 1031
@@ -1045,7 +1045,7 @@ static int ivtvfb_init_io(struct ivtv *itv)
1045 if (mtrr_add(oi->fb_start_aligned_physaddr, 1045 if (mtrr_add(oi->fb_start_aligned_physaddr,
1046 oi->fb_end_aligned_physaddr - oi->fb_start_aligned_physaddr, 1046 oi->fb_end_aligned_physaddr - oi->fb_start_aligned_physaddr,
1047 MTRR_TYPE_WRCOMB, 1) < 0) { 1047 MTRR_TYPE_WRCOMB, 1) < 0) {
1048 IVTV_FB_WARN("cannot use mttr\n"); 1048 IVTVFB_INFO("disabled mttr\n");
1049 oi->fb_start_aligned_physaddr = 0; 1049 oi->fb_start_aligned_physaddr = 0;
1050 oi->fb_end_aligned_physaddr = 0; 1050 oi->fb_end_aligned_physaddr = 0;
1051 } 1051 }
@@ -1089,13 +1089,13 @@ static int ivtvfb_init_card(struct ivtv *itv)
1089 int rc; 1089 int rc;
1090 1090
1091 if (itv->osd_info) { 1091 if (itv->osd_info) {
1092 IVTV_FB_ERR("Card %d already initialised\n", ivtv_fb_card_id); 1092 IVTVFB_ERR("Card %d already initialised\n", ivtvfb_card_id);
1093 return -EBUSY; 1093 return -EBUSY;
1094 } 1094 }
1095 1095
1096 itv->osd_info = kzalloc(sizeof(struct osd_info), GFP_ATOMIC); 1096 itv->osd_info = kzalloc(sizeof(struct osd_info), GFP_ATOMIC);
1097 if (itv->osd_info == 0) { 1097 if (itv->osd_info == 0) {
1098 IVTV_FB_ERR("Failed to allocate memory for osd_info\n"); 1098 IVTVFB_ERR("Failed to allocate memory for osd_info\n");
1099 return -ENOMEM; 1099 return -ENOMEM;
1100 } 1100 }
1101 1101
@@ -1129,7 +1129,7 @@ static int ivtvfb_init_card(struct ivtv *itv)
1129 1129
1130 /* Note if we're running in compatibility mode */ 1130 /* Note if we're running in compatibility mode */
1131 if (osd_compat) 1131 if (osd_compat)
1132 IVTV_FB_INFO("Running in compatibility mode. Display resize & mode change disabled\n"); 1132 IVTVFB_INFO("Running in compatibility mode. Display resize & mode change disabled\n");
1133 1133
1134 /* Allocate DMA */ 1134 /* Allocate DMA */
1135 ivtv_udma_alloc(itv); 1135 ivtv_udma_alloc(itv);
@@ -1142,20 +1142,20 @@ static int __init ivtvfb_init(void)
1142 struct ivtv *itv; 1142 struct ivtv *itv;
1143 int i, registered = 0; 1143 int i, registered = 0;
1144 1144
1145 if (ivtv_fb_card_id < -1 || ivtv_fb_card_id >= IVTV_MAX_CARDS) { 1145 if (ivtvfb_card_id < -1 || ivtvfb_card_id >= IVTV_MAX_CARDS) {
1146 printk(KERN_ERR "ivtvfb: ivtv_fb_card_id parameter is out of range (valid range: -1 - %d)\n", 1146 printk(KERN_ERR "ivtvfb: ivtvfb_card_id parameter is out of range (valid range: -1 - %d)\n",
1147 IVTV_MAX_CARDS - 1); 1147 IVTV_MAX_CARDS - 1);
1148 return -EINVAL; 1148 return -EINVAL;
1149 } 1149 }
1150 1150
1151 /* Locate & initialise all cards supporting an OSD. */ 1151 /* Locate & initialise all cards supporting an OSD. */
1152 for (i = 0; i < ivtv_cards_active; i++) { 1152 for (i = 0; i < ivtv_cards_active; i++) {
1153 if (ivtv_fb_card_id != -1 && i != ivtv_fb_card_id) 1153 if (ivtvfb_card_id != -1 && i != ivtvfb_card_id)
1154 continue; 1154 continue;
1155 itv = ivtv_cards[i]; 1155 itv = ivtv_cards[i];
1156 if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) { 1156 if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)) {
1157 if (ivtvfb_init_card(itv) == 0) { 1157 if (ivtvfb_init_card(itv) == 0) {
1158 IVTV_FB_INFO("Framebuffer registered on ivtv card id %d\n", i); 1158 IVTVFB_INFO("Framebuffer registered on ivtv card id %d\n", i);
1159 registered++; 1159 registered++;
1160 } 1160 }
1161 } 1161 }
@@ -1177,7 +1177,7 @@ static void ivtvfb_cleanup(void)
1177 for (i = 0; i < ivtv_cards_active; i++) { 1177 for (i = 0; i < ivtv_cards_active; i++) {
1178 itv = ivtv_cards[i]; 1178 itv = ivtv_cards[i];
1179 if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) && itv->osd_info) { 1179 if (itv && (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT) && itv->osd_info) {
1180 IVTV_FB_DEBUG_INFO("Unregister framebuffer %d\n", i); 1180 IVTVFB_DEBUG_INFO("Unregister framebuffer %d\n", i);
1181 ivtvfb_blank(FB_BLANK_POWERDOWN, &itv->osd_info->ivtvfb_info); 1181 ivtvfb_blank(FB_BLANK_POWERDOWN, &itv->osd_info->ivtvfb_info);
1182 unregister_framebuffer(&itv->osd_info->ivtvfb_info); 1182 unregister_framebuffer(&itv->osd_info->ivtvfb_info);
1183 ivtvfb_release_buffers(itv); 1183 ivtvfb_release_buffers(itv);