aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/arv.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2010-03-22 03:44:29 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-17 23:51:27 -0400
commit88f4423454a23375f07bb4ff3a80d209930560d0 (patch)
tree59ae8cef091bc3af7bf7feac84a240f73c104228 /drivers/media/video/arv.c
parent1d61aac0996d96847e17263a41d34ab54bf8e103 (diff)
V4L/DVB: arv: coding style cleanup
Clean up the coding style before we convert this driver to V4L2. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/arv.c')
-rw-r--r--drivers/media/video/arv.c153
1 files changed, 76 insertions, 77 deletions
diff --git a/drivers/media/video/arv.c b/drivers/media/video/arv.c
index a356d6bd3131..9f88096a520c 100644
--- a/drivers/media/video/arv.c
+++ b/drivers/media/video/arv.c
@@ -39,7 +39,7 @@
39#include <asm/byteorder.h> 39#include <asm/byteorder.h>
40 40
41#if 0 41#if 0
42#define DEBUG(n, args...) printk(args) 42#define DEBUG(n, args...) printk(KERN_INFO args)
43#define CHECK_LOST 1 43#define CHECK_LOST 1
44#else 44#else
45#define DEBUG(n, args...) 45#define DEBUG(n, args...)
@@ -55,7 +55,7 @@
55#define VERSION "0.03" 55#define VERSION "0.03"
56 56
57#define ar_inl(addr) inl((unsigned long)(addr)) 57#define ar_inl(addr) inl((unsigned long)(addr))
58#define ar_outl(val, addr) outl((unsigned long)(val),(unsigned long)(addr)) 58#define ar_outl(val, addr) outl((unsigned long)(val), (unsigned long)(addr))
59 59
60extern struct cpuinfo_m32r boot_cpu_data; 60extern struct cpuinfo_m32r boot_cpu_data;
61 61
@@ -214,13 +214,12 @@ void init_iic(void)
214 214
215 /* I2C CLK */ 215 /* I2C CLK */
216 /* 50MH-100k */ 216 /* 50MH-100k */
217 if (freq == 75) { 217 if (freq == 75)
218 ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */ 218 ar_outl(369, PLDI2CFREQ); /* BCLK = 75MHz */
219 } else if (freq == 50) { 219 else if (freq == 50)
220 ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */ 220 ar_outl(244, PLDI2CFREQ); /* BCLK = 50MHz */
221 } else { 221 else
222 ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */ 222 ar_outl(244, PLDI2CFREQ); /* default: BCLK = 50MHz */
223 }
224 ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */ 223 ar_outl(0x1, PLDI2CCR); /* I2CCR Enable */
225} 224}
226 225
@@ -260,7 +259,7 @@ static inline void wait_for_vertical_sync(int exp_line)
260 break; 259 break;
261 } 260 }
262 if (tmout < 0) 261 if (tmout < 0)
263 printk("arv: lost %d -> %d\n", exp_line, l); 262 printk(KERN_ERR "arv: lost %d -> %d\n", exp_line, l);
264#else 263#else
265 while (ar_inl(ARVHCOUNT) != exp_line) 264 while (ar_inl(ARVHCOUNT) != exp_line)
266 cpu_relax(); 265 cpu_relax();
@@ -277,7 +276,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos)
277 unsigned char *p; 276 unsigned char *p;
278 int h, w; 277 int h, w;
279 unsigned char *py, *pu, *pv; 278 unsigned char *py, *pu, *pv;
280#if ! USE_INT 279#if !USE_INT
281 int l; 280 int l;
282#endif 281#endif
283 282
@@ -313,7 +312,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos)
313 /* .... AR interrupts .... */ 312 /* .... AR interrupts .... */
314 interruptible_sleep_on(&ar->wait); 313 interruptible_sleep_on(&ar->wait);
315 if (signal_pending(current)) { 314 if (signal_pending(current)) {
316 printk("arv: interrupted while get frame data.\n"); 315 printk(KERN_ERR "arv: interrupted while get frame data.\n");
317 ret = -EINTR; 316 ret = -EINTR;
318 goto out_up; 317 goto out_up;
319 } 318 }
@@ -386,7 +385,7 @@ static ssize_t ar_read(struct file *file, char *buf, size_t count, loff_t *ppos)
386 } 385 }
387 } 386 }
388 if (copy_to_user(buf, yuv, ar->frame_bytes)) { 387 if (copy_to_user(buf, yuv, ar->frame_bytes)) {
389 printk("arv: failed while copy_to_user yuv.\n"); 388 printk(KERN_ERR "arv: failed while copy_to_user yuv.\n");
390 ret = -EFAULT; 389 ret = -EFAULT;
391 goto out_up; 390 goto out_up;
392 } 391 }
@@ -402,7 +401,7 @@ static long ar_do_ioctl(struct file *file, unsigned int cmd, void *arg)
402 struct ar_device *ar = video_get_drvdata(dev); 401 struct ar_device *ar = video_get_drvdata(dev);
403 402
404 DEBUG(1, "ar_ioctl()\n"); 403 DEBUG(1, "ar_ioctl()\n");
405 switch(cmd) { 404 switch (cmd) {
406 case VIDIOCGCAP: 405 case VIDIOCGCAP:
407 { 406 {
408 struct video_capability *b = arg; 407 struct video_capability *b = arg;
@@ -559,11 +558,11 @@ static void ar_interrupt(int irq, void *dev)
559 line_count = ar_inl(ARVHCOUNT); /* line number */ 558 line_count = ar_inl(ARVHCOUNT); /* line number */
560 if (ar->mode == AR_MODE_INTERLACE && ar->size == AR_SIZE_VGA) { 559 if (ar->mode == AR_MODE_INTERLACE && ar->size == AR_SIZE_VGA) {
561 /* operations for interlace mode */ 560 /* operations for interlace mode */
562 if ( line_count < (AR_HEIGHT_VGA/2) ) /* even line */ 561 if (line_count < (AR_HEIGHT_VGA / 2)) /* even line */
563 line_number = (line_count << 1); 562 line_number = (line_count << 1);
564 else /* odd line */ 563 else /* odd line */
565 line_number = 564 line_number =
566 (((line_count - (AR_HEIGHT_VGA/2)) << 1) + 1); 565 (((line_count - (AR_HEIGHT_VGA / 2)) << 1) + 1);
567 } else { 566 } else {
568 line_number = line_count; 567 line_number = line_count;
569 } 568 }
@@ -627,7 +626,7 @@ static int ar_initialize(struct video_device *dev)
627{ 626{
628 struct ar_device *ar = video_get_drvdata(dev); 627 struct ar_device *ar = video_get_drvdata(dev);
629 unsigned long cr = 0; 628 unsigned long cr = 0;
630 int i,found=0; 629 int i, found = 0;
631 630
632 DEBUG(1, "ar_initialize:\n"); 631 DEBUG(1, "ar_initialize:\n");
633 632
@@ -666,66 +665,66 @@ static int ar_initialize(struct video_device *dev)
666 if (found == 0) 665 if (found == 0)
667 return -ENODEV; 666 return -ENODEV;
668 667
669 printk("arv: Initializing "); 668 printk(KERN_INFO "arv: Initializing ");
670 669
671 iic(2,0x78,0x11,0x01,0x00); /* start */ 670 iic(2, 0x78, 0x11, 0x01, 0x00); /* start */
672 iic(3,0x78,0x12,0x00,0x06); 671 iic(3, 0x78, 0x12, 0x00, 0x06);
673 iic(3,0x78,0x12,0x12,0x30); 672 iic(3, 0x78, 0x12, 0x12, 0x30);
674 iic(3,0x78,0x12,0x15,0x58); 673 iic(3, 0x78, 0x12, 0x15, 0x58);
675 iic(3,0x78,0x12,0x17,0x30); 674 iic(3, 0x78, 0x12, 0x17, 0x30);
676 printk("."); 675 printk(KERN_CONT ".");
677 iic(3,0x78,0x12,0x1a,0x97); 676 iic(3, 0x78, 0x12, 0x1a, 0x97);
678 iic(3,0x78,0x12,0x1b,0xff); 677 iic(3, 0x78, 0x12, 0x1b, 0xff);
679 iic(3,0x78,0x12,0x1c,0xff); 678 iic(3, 0x78, 0x12, 0x1c, 0xff);
680 iic(3,0x78,0x12,0x26,0x10); 679 iic(3, 0x78, 0x12, 0x26, 0x10);
681 iic(3,0x78,0x12,0x27,0x00); 680 iic(3, 0x78, 0x12, 0x27, 0x00);
682 printk("."); 681 printk(KERN_CONT ".");
683 iic(2,0x78,0x34,0x02,0x00); 682 iic(2, 0x78, 0x34, 0x02, 0x00);
684 iic(2,0x78,0x7a,0x10,0x00); 683 iic(2, 0x78, 0x7a, 0x10, 0x00);
685 iic(2,0x78,0x80,0x39,0x00); 684 iic(2, 0x78, 0x80, 0x39, 0x00);
686 iic(2,0x78,0x81,0xe6,0x00); 685 iic(2, 0x78, 0x81, 0xe6, 0x00);
687 iic(2,0x78,0x8d,0x00,0x00); 686 iic(2, 0x78, 0x8d, 0x00, 0x00);
688 printk("."); 687 printk(KERN_CONT ".");
689 iic(2,0x78,0x8e,0x0c,0x00); 688 iic(2, 0x78, 0x8e, 0x0c, 0x00);
690 iic(2,0x78,0x8f,0x00,0x00); 689 iic(2, 0x78, 0x8f, 0x00, 0x00);
691#if 0 690#if 0
692 iic(2,0x78,0x90,0x00,0x00); /* AWB on=1 off=0 */ 691 iic(2, 0x78, 0x90, 0x00, 0x00); /* AWB on=1 off=0 */
693#endif 692#endif
694 iic(2,0x78,0x93,0x01,0x00); 693 iic(2, 0x78, 0x93, 0x01, 0x00);
695 iic(2,0x78,0x94,0xcd,0x00); 694 iic(2, 0x78, 0x94, 0xcd, 0x00);
696 iic(2,0x78,0x95,0x00,0x00); 695 iic(2, 0x78, 0x95, 0x00, 0x00);
697 printk("."); 696 printk(KERN_CONT ".");
698 iic(2,0x78,0x96,0xa0,0x00); 697 iic(2, 0x78, 0x96, 0xa0, 0x00);
699 iic(2,0x78,0x97,0x00,0x00); 698 iic(2, 0x78, 0x97, 0x00, 0x00);
700 iic(2,0x78,0x98,0x60,0x00); 699 iic(2, 0x78, 0x98, 0x60, 0x00);
701 iic(2,0x78,0x99,0x01,0x00); 700 iic(2, 0x78, 0x99, 0x01, 0x00);
702 iic(2,0x78,0x9a,0x19,0x00); 701 iic(2, 0x78, 0x9a, 0x19, 0x00);
703 printk("."); 702 printk(KERN_CONT ".");
704 iic(2,0x78,0x9b,0x02,0x00); 703 iic(2, 0x78, 0x9b, 0x02, 0x00);
705 iic(2,0x78,0x9c,0xe8,0x00); 704 iic(2, 0x78, 0x9c, 0xe8, 0x00);
706 iic(2,0x78,0x9d,0x02,0x00); 705 iic(2, 0x78, 0x9d, 0x02, 0x00);
707 iic(2,0x78,0x9e,0x2e,0x00); 706 iic(2, 0x78, 0x9e, 0x2e, 0x00);
708 iic(2,0x78,0xb8,0x78,0x00); 707 iic(2, 0x78, 0xb8, 0x78, 0x00);
709 iic(2,0x78,0xba,0x05,0x00); 708 iic(2, 0x78, 0xba, 0x05, 0x00);
710#if 0 709#if 0
711 iic(2,0x78,0x83,0x8c,0x00); /* brightness */ 710 iic(2, 0x78, 0x83, 0x8c, 0x00); /* brightness */
712#endif 711#endif
713 printk("."); 712 printk(KERN_CONT ".");
714 713
715 /* color correction */ 714 /* color correction */
716 iic(3,0x78,0x49,0x00,0x95); /* a */ 715 iic(3, 0x78, 0x49, 0x00, 0x95); /* a */
717 iic(3,0x78,0x49,0x01,0x96); /* b */ 716 iic(3, 0x78, 0x49, 0x01, 0x96); /* b */
718 iic(3,0x78,0x49,0x03,0x85); /* c */ 717 iic(3, 0x78, 0x49, 0x03, 0x85); /* c */
719 iic(3,0x78,0x49,0x04,0x97); /* d */ 718 iic(3, 0x78, 0x49, 0x04, 0x97); /* d */
720 iic(3,0x78,0x49,0x02,0x7e); /* e(Lo) */ 719 iic(3, 0x78, 0x49, 0x02, 0x7e); /* e(Lo) */
721 iic(3,0x78,0x49,0x05,0xa4); /* f(Lo) */ 720 iic(3, 0x78, 0x49, 0x05, 0xa4); /* f(Lo) */
722 iic(3,0x78,0x49,0x06,0x04); /* e(Hi) */ 721 iic(3, 0x78, 0x49, 0x06, 0x04); /* e(Hi) */
723 iic(3,0x78,0x49,0x07,0x04); /* e(Hi) */ 722 iic(3, 0x78, 0x49, 0x07, 0x04); /* e(Hi) */
724 iic(2,0x78,0x48,0x01,0x00); /* on=1 off=0 */ 723 iic(2, 0x78, 0x48, 0x01, 0x00); /* on=1 off=0 */
725 724
726 printk("."); 725 printk(KERN_CONT ".");
727 iic(2,0x78,0x11,0x00,0x00); /* end */ 726 iic(2, 0x78, 0x11, 0x00, 0x00); /* end */
728 printk(" done\n"); 727 printk(KERN_CONT " done\n");
729 return 0; 728 return 0;
730} 729}
731 730
@@ -787,8 +786,8 @@ static int __init ar_init(void)
787#if USE_INT 786#if USE_INT
788 /* allocate a DMA buffer for 1 line. */ 787 /* allocate a DMA buffer for 1 line. */
789 ar->line_buff = kmalloc(MAX_AR_LINE_BYTES, GFP_KERNEL | GFP_DMA); 788 ar->line_buff = kmalloc(MAX_AR_LINE_BYTES, GFP_KERNEL | GFP_DMA);
790 if (ar->line_buff == NULL || ! ALIGN4(ar->line_buff)) { 789 if (ar->line_buff == NULL || !ALIGN4(ar->line_buff)) {
791 printk("arv: buffer allocation failed for DMA.\n"); 790 printk(KERN_ERR "arv: buffer allocation failed for DMA.\n");
792 ret = -ENOMEM; 791 ret = -ENOMEM;
793 goto out_end; 792 goto out_end;
794 } 793 }
@@ -796,8 +795,8 @@ static int __init ar_init(void)
796 /* allocate buffers for a frame */ 795 /* allocate buffers for a frame */
797 for (i = 0; i < MAX_AR_HEIGHT; i++) { 796 for (i = 0; i < MAX_AR_HEIGHT; i++) {
798 ar->frame[i] = kmalloc(MAX_AR_LINE_BYTES, GFP_KERNEL); 797 ar->frame[i] = kmalloc(MAX_AR_LINE_BYTES, GFP_KERNEL);
799 if (ar->frame[i] == NULL || ! ALIGN4(ar->frame[i])) { 798 if (ar->frame[i] == NULL || !ALIGN4(ar->frame[i])) {
800 printk("arv: buffer allocation failed for frame.\n"); 799 printk(KERN_ERR "arv: buffer allocation failed for frame.\n");
801 ret = -ENOMEM; 800 ret = -ENOMEM;
802 goto out_line_buff; 801 goto out_line_buff;
803 } 802 }
@@ -834,14 +833,14 @@ static int __init ar_init(void)
834 833
835#if USE_INT 834#if USE_INT
836 if (request_irq(M32R_IRQ_INT3, ar_interrupt, 0, "arv", ar)) { 835 if (request_irq(M32R_IRQ_INT3, ar_interrupt, 0, "arv", ar)) {
837 printk("arv: request_irq(%d) failed.\n", M32R_IRQ_INT3); 836 printk(KERN_ERR "arv: request_irq(%d) failed.\n", M32R_IRQ_INT3);
838 ret = -EIO; 837 ret = -EIO;
839 goto out_irq; 838 goto out_irq;
840 } 839 }
841#endif 840#endif
842 841
843 if (ar_initialize(ar->vdev) != 0) { 842 if (ar_initialize(ar->vdev) != 0) {
844 printk("arv: M64278 not found.\n"); 843 printk(KERN_ERR "arv: M64278 not found.\n");
845 ret = -ENODEV; 844 ret = -ENODEV;
846 goto out_dev; 845 goto out_dev;
847 } 846 }
@@ -854,12 +853,12 @@ static int __init ar_init(void)
854 */ 853 */
855 if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) { 854 if (video_register_device(ar->vdev, VFL_TYPE_GRABBER, video_nr) != 0) {
856 /* return -1, -ENFILE(full) or others */ 855 /* return -1, -ENFILE(full) or others */
857 printk("arv: register video (Colour AR) failed.\n"); 856 printk(KERN_ERR "arv: register video (Colour AR) failed.\n");
858 ret = -ENODEV; 857 ret = -ENODEV;
859 goto out_dev; 858 goto out_dev;
860 } 859 }
861 860
862 printk("%s: Found M64278 VGA (IRQ %d, Freq %dMHz).\n", 861 printk(KERN_INFO "%s: Found M64278 VGA (IRQ %d, Freq %dMHz).\n",
863 video_device_node_name(ar->vdev), M32R_IRQ_INT3, freq); 862 video_device_node_name(ar->vdev), M32R_IRQ_INT3, freq);
864 863
865 return 0; 864 return 0;
@@ -886,7 +885,7 @@ out_end:
886static int __init ar_init_module(void) 885static int __init ar_init_module(void)
887{ 886{
888 freq = (boot_cpu_data.bus_clock / 1000000); 887 freq = (boot_cpu_data.bus_clock / 1000000);
889 printk("arv: Bus clock %d\n", freq); 888 printk(KERN_INFO "arv: Bus clock %d\n", freq);
890 if (freq != 50 && freq != 75) 889 if (freq != 50 && freq != 75)
891 freq = DEFAULT_FREQ; 890 freq = DEFAULT_FREQ;
892 return ar_init(); 891 return ar_init();