diff options
author | Steven Toth <stoth@kernellabs.com> | 2011-10-10 10:09:54 -0400 |
---|---|---|
committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2011-10-14 16:08:46 -0400 |
commit | b5f74050043f4782517cd9aa2b68c13ebf5cfa90 (patch) | |
tree | c5f8979e4af73ef58fe45ec075a6c352f1dc1ea6 | |
parent | 6aa07d9e6329c93dfa5f6ff4fce8602f2a33b891 (diff) |
[media] cx23885: initial support for VBI with the cx23885
A handlful of coding style issue cleaned up in the following patches.
Signed-off-by: Steven Toth <stoth@kernellabs.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r-- | drivers/media/video/cx23885/cx23885-alsa.c | 4 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-core.c | 2 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885-vbi.c | 42 | ||||
-rw-r--r-- | drivers/media/video/cx23885/cx23885.h | 5 |
4 files changed, 47 insertions, 6 deletions
diff --git a/drivers/media/video/cx23885/cx23885-alsa.c b/drivers/media/video/cx23885/cx23885-alsa.c index 668776d0e98d..795169237e70 100644 --- a/drivers/media/video/cx23885/cx23885-alsa.c +++ b/drivers/media/video/cx23885/cx23885-alsa.c | |||
@@ -46,10 +46,10 @@ | |||
46 | #define AUDIO_SRAM_CHANNEL SRAM_CH07 | 46 | #define AUDIO_SRAM_CHANNEL SRAM_CH07 |
47 | 47 | ||
48 | #define dprintk(level, fmt, arg...) if (audio_debug >= level) \ | 48 | #define dprintk(level, fmt, arg...) if (audio_debug >= level) \ |
49 | printk(KERN_INFO "%s/1: " fmt, chip->dev->name , ## arg) | 49 | printk(KERN_INFO "%s: " fmt, chip->dev->name , ## arg) |
50 | 50 | ||
51 | #define dprintk_core(level, fmt, arg...) if (audio_debug >= level) \ | 51 | #define dprintk_core(level, fmt, arg...) if (audio_debug >= level) \ |
52 | printk(KERN_DEBUG "%s/1: " fmt, chip->dev->name , ## arg) | 52 | printk(KERN_DEBUG "%s: " fmt, chip->dev->name , ## arg) |
53 | 53 | ||
54 | /**************************************************************************** | 54 | /**************************************************************************** |
55 | Module global static vars | 55 | Module global static vars |
diff --git a/drivers/media/video/cx23885/cx23885-core.c b/drivers/media/video/cx23885/cx23885-core.c index a50b5cf2b6be..d42d2251d486 100644 --- a/drivers/media/video/cx23885/cx23885-core.c +++ b/drivers/media/video/cx23885/cx23885-core.c | |||
@@ -54,7 +54,7 @@ MODULE_PARM_DESC(card, "card type"); | |||
54 | 54 | ||
55 | #define dprintk(level, fmt, arg...)\ | 55 | #define dprintk(level, fmt, arg...)\ |
56 | do { if (debug >= level)\ | 56 | do { if (debug >= level)\ |
57 | printk(KERN_DEBUG "%s/0: " fmt, dev->name, ## arg);\ | 57 | printk(KERN_DEBUG "%s: " fmt, dev->name, ## arg);\ |
58 | } while (0) | 58 | } while (0) |
59 | 59 | ||
60 | static unsigned int cx23885_devcount; | 60 | static unsigned int cx23885_devcount; |
diff --git a/drivers/media/video/cx23885/cx23885-vbi.c b/drivers/media/video/cx23885/cx23885-vbi.c index c0b60382ad13..23ff09877395 100644 --- a/drivers/media/video/cx23885/cx23885-vbi.c +++ b/drivers/media/video/cx23885/cx23885-vbi.c | |||
@@ -62,30 +62,65 @@ int cx23885_vbi_fmt(struct file *file, void *priv, | |||
62 | return 0; | 62 | return 0; |
63 | } | 63 | } |
64 | 64 | ||
65 | /* We're given the Video Interrupt status register. | ||
66 | * The cx23885_video_irq() func has already validated | ||
67 | * the potential error bits, we just need to | ||
68 | * deal with vbi payload and return indication if | ||
69 | * we actually processed any payload. | ||
70 | */ | ||
71 | int cx23885_vbi_irq(struct cx23885_dev *dev, u32 status) | ||
72 | { | ||
73 | u32 count; | ||
74 | int handled = 0; | ||
75 | |||
76 | if (status & VID_BC_MSK_VBI_RISCI1) { | ||
77 | dprintk(1, "%s() VID_BC_MSK_VBI_RISCI1\n", __func__); | ||
78 | spin_lock(&dev->slock); | ||
79 | count = cx_read(VID_A_GPCNT); | ||
80 | cx23885_video_wakeup(dev, &dev->vbiq, count); | ||
81 | spin_unlock(&dev->slock); | ||
82 | handled++; | ||
83 | } | ||
84 | |||
85 | if (status & VID_BC_MSK_VBI_RISCI2) { | ||
86 | dprintk(1, "%s() VID_BC_MSK_VBI_RISCI2\n", __func__); | ||
87 | dprintk(2, "stopper vbi\n"); | ||
88 | spin_lock(&dev->slock); | ||
89 | cx23885_restart_vbi_queue(dev, &dev->vbiq); | ||
90 | spin_unlock(&dev->slock); | ||
91 | handled++; | ||
92 | } | ||
93 | |||
94 | return handled; | ||
95 | } | ||
96 | |||
65 | static int cx23885_start_vbi_dma(struct cx23885_dev *dev, | 97 | static int cx23885_start_vbi_dma(struct cx23885_dev *dev, |
66 | struct cx23885_dmaqueue *q, | 98 | struct cx23885_dmaqueue *q, |
67 | struct cx23885_buffer *buf) | 99 | struct cx23885_buffer *buf) |
68 | { | 100 | { |
101 | dprintk(1, "%s()\n", __func__); | ||
102 | |||
69 | /* setup fifo + format */ | 103 | /* setup fifo + format */ |
70 | cx23885_sram_channel_setup(dev, &dev->sram_channels[SRAM_CH02], | 104 | cx23885_sram_channel_setup(dev, &dev->sram_channels[SRAM_CH02], |
71 | buf->vb.width, buf->risc.dma); | 105 | buf->vb.width, buf->risc.dma); |
72 | 106 | ||
73 | /* reset counter */ | 107 | /* reset counter */ |
108 | cx_write(VID_A_GPCNT_CTL, 3); | ||
74 | q->count = 1; | 109 | q->count = 1; |
75 | 110 | ||
76 | /* enable irqs */ | 111 | /* enable irq */ |
77 | cx23885_irq_add_enable(dev, 0x01); | 112 | cx23885_irq_add_enable(dev, 0x01); |
78 | cx_set(VID_A_INT_MSK, 0x000022); | 113 | cx_set(VID_A_INT_MSK, 0x000022); |
79 | 114 | ||
80 | /* start dma */ | 115 | /* start dma */ |
81 | cx_set(DEV_CNTRL2, (1<<5)); | 116 | cx_set(DEV_CNTRL2, (1<<5)); |
82 | cx_set(VID_A_DMA_CTL, 0x00000022); | 117 | cx_set(VID_A_DMA_CTL, 0x22); /* FIFO and RISC enable */ |
83 | 118 | ||
84 | return 0; | 119 | return 0; |
85 | } | 120 | } |
86 | 121 | ||
87 | 122 | ||
88 | static int cx23885_restart_vbi_queue(struct cx23885_dev *dev, | 123 | int cx23885_restart_vbi_queue(struct cx23885_dev *dev, |
89 | struct cx23885_dmaqueue *q) | 124 | struct cx23885_dmaqueue *q) |
90 | { | 125 | { |
91 | struct cx23885_buffer *buf; | 126 | struct cx23885_buffer *buf; |
@@ -115,6 +150,7 @@ void cx23885_vbi_timeout(unsigned long data) | |||
115 | 150 | ||
116 | cx23885_sram_channel_dump(dev, &dev->sram_channels[SRAM_CH02]); | 151 | cx23885_sram_channel_dump(dev, &dev->sram_channels[SRAM_CH02]); |
117 | 152 | ||
153 | /* Stop the VBI engine */ | ||
118 | cx_clear(VID_A_DMA_CTL, 0x22); | 154 | cx_clear(VID_A_DMA_CTL, 0x22); |
119 | 155 | ||
120 | spin_lock_irqsave(&dev->slock, flags); | 156 | spin_lock_irqsave(&dev->slock, flags); |
diff --git a/drivers/media/video/cx23885/cx23885.h b/drivers/media/video/cx23885/cx23885.h index 892d971361a9..718afd8eafc8 100644 --- a/drivers/media/video/cx23885/cx23885.h +++ b/drivers/media/video/cx23885/cx23885.h | |||
@@ -564,6 +564,8 @@ extern void cx23885_free_buffer(struct videobuf_queue *q, | |||
564 | extern int cx23885_video_register(struct cx23885_dev *dev); | 564 | extern int cx23885_video_register(struct cx23885_dev *dev); |
565 | extern void cx23885_video_unregister(struct cx23885_dev *dev); | 565 | extern void cx23885_video_unregister(struct cx23885_dev *dev); |
566 | extern int cx23885_video_irq(struct cx23885_dev *dev, u32 status); | 566 | extern int cx23885_video_irq(struct cx23885_dev *dev, u32 status); |
567 | extern void cx23885_video_wakeup(struct cx23885_dev *dev, | ||
568 | struct cx23885_dmaqueue *q, u32 count); | ||
567 | 569 | ||
568 | /* ----------------------------------------------------------- */ | 570 | /* ----------------------------------------------------------- */ |
569 | /* cx23885-vbi.c */ | 571 | /* cx23885-vbi.c */ |
@@ -571,6 +573,9 @@ extern int cx23885_vbi_fmt(struct file *file, void *priv, | |||
571 | struct v4l2_format *f); | 573 | struct v4l2_format *f); |
572 | extern void cx23885_vbi_timeout(unsigned long data); | 574 | extern void cx23885_vbi_timeout(unsigned long data); |
573 | extern struct videobuf_queue_ops cx23885_vbi_qops; | 575 | extern struct videobuf_queue_ops cx23885_vbi_qops; |
576 | extern int cx23885_restart_vbi_queue(struct cx23885_dev *dev, | ||
577 | struct cx23885_dmaqueue *q); | ||
578 | extern int cx23885_vbi_irq(struct cx23885_dev *dev, u32 status); | ||
574 | 579 | ||
575 | /* cx23885-i2c.c */ | 580 | /* cx23885-i2c.c */ |
576 | extern int cx23885_i2c_register(struct cx23885_i2c *bus); | 581 | extern int cx23885_i2c_register(struct cx23885_i2c *bus); |