summaryrefslogtreecommitdiff
path: root/linux/drivers/media/video/ivtv/ivtv-driver.c
diff options
context:
space:
mode:
Diffstat (limited to 'linux/drivers/media/video/ivtv/ivtv-driver.c')
-rw-r--r--linux/drivers/media/video/ivtv/ivtv-driver.c86
1 files changed, 42 insertions, 44 deletions
diff --git a/linux/drivers/media/video/ivtv/ivtv-driver.c b/linux/drivers/media/video/ivtv/ivtv-driver.c
index adfc8a869..2fcf3e7c3 100644
--- a/linux/drivers/media/video/ivtv/ivtv-driver.c
+++ b/linux/drivers/media/video/ivtv/ivtv-driver.c
@@ -625,8 +625,8 @@ static int __devinit ivtv_init_struct1(struct ivtv *itv)
mutex_init(&itv->i2c_bus_lock);
mutex_init(&itv->udma.lock);
- itv->lock = SPIN_LOCK_UNLOCKED;
- itv->dma_reg_lock = SPIN_LOCK_UNLOCKED;
+ spin_lock_init(&itv->lock);
+ spin_lock_init(&itv->dma_reg_lock);
itv->irq_work_queues = create_workqueue(itv->name);
if (itv->irq_work_queues == NULL) {
@@ -1138,46 +1138,6 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
if (itv->options.radio > 0)
itv->v4l2_cap |= V4L2_CAP_RADIO;
- retval = ivtv_streams_setup(itv);
- if (retval) {
- IVTV_ERR("Error %d setting up streams\n", retval);
- goto free_i2c;
- }
-
- /* Start Threads */
- IVTV_DEBUG_INFO("Starting Threads\n");
-
- /* Decoder Thread */
- if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) {
- ivtv_init_mpeg_decoder(itv);
- }
-
- IVTV_DEBUG_IRQ("Masking interrupts\n");
- /* clear interrupt mask, effectively disabling interrupts */
- ivtv_set_irq_mask(itv, 0xffffffff);
-
- /* Register IRQ */
- retval = request_irq(itv->dev->irq, ivtv_irq_handler,
- IRQF_SHARED | IRQF_DISABLED, itv->name, (void *)itv);
- if (retval) {
- IVTV_ERR("Failed to register irq %d\n", retval);
- goto free_streams;
- }
-
- /* On a cx23416 this seems to be able to enable DMA to the chip? */
- if (!itv->has_cx23415)
- write_reg_sync(0x03, IVTV_REG_DMACONTROL);
-
- /* Default interrupts enabled. For the PVR350 this includes the
- decoder VSYNC interrupt, which is always on. It is not only used
- during decoding but also by the OSD.
- Some old PVR250 cards had a cx23415, so testing for that is too
- general. Instead test if the card has video output capability. */
- if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)
- ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC);
- else
- ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT);
-
if (itv->options.tuner > -1) {
struct tuner_setup setup;
@@ -1216,6 +1176,43 @@ static int __devinit ivtv_probe(struct pci_dev *dev,
itv->std_out = itv->std;
ivtv_v4l2_ioctls(itv, NULL, VIDIOC_S_STD, &itv->tuner_std);
ivtv_v4l2_ioctls(itv, NULL, VIDIOC_S_FREQUENCY, &vf);
+
+ retval = ivtv_streams_setup(itv);
+ if (retval) {
+ IVTV_ERR("Error %d setting up streams\n", retval);
+ goto free_i2c;
+ }
+
+ if (itv->card->v4l2_capabilities & V4L2_CAP_VIDEO_OUTPUT) {
+ ivtv_init_mpeg_decoder(itv);
+ }
+
+ IVTV_DEBUG_IRQ("Masking interrupts\n");
+ /* clear interrupt mask, effectively disabling interrupts */
+ ivtv_set_irq_mask(itv, 0xffffffff);
+
+ /* Register IRQ */
+ retval = request_irq(itv->dev->irq, ivtv_irq_handler,
+ IRQF_SHARED | IRQF_DISABLED, itv->name, (void *)itv);
+ if (retval) {
+ IVTV_ERR("Failed to register irq %d\n", retval);
+ goto free_streams;
+ }
+
+ /* On a cx23416 this seems to be able to enable DMA to the chip? */
+ if (!itv->has_cx23415)
+ write_reg_sync(0x03, IVTV_REG_DMACONTROL);
+
+ /* Default interrupts enabled. For the PVR350 this includes the
+ decoder VSYNC interrupt, which is always on. It is not only used
+ during decoding but also by the OSD.
+ Some old PVR250 cards had a cx23415, so testing for that is too
+ general. Instead test if the card has video output capability. */
+ if (itv->v4l2_cap & V4L2_CAP_VIDEO_OUTPUT)
+ ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT | IVTV_IRQ_DEC_VSYNC);
+ else
+ ivtv_clear_irq_mask(itv, IVTV_IRQ_MASK_INIT);
+
if (itv->has_cx23415)
ivtv_set_osd_alpha(itv);
@@ -1337,7 +1334,7 @@ static int module_start(void)
printk(KERN_INFO "ivtv: debug value must be >= 0 and <= 511!\n");
}
- if (pci_module_init(&ivtv_pci_driver)) {
+ if (pci_register_driver(&ivtv_pci_driver)) {
printk(KERN_ERR "ivtv: Error detecting PCI card\n");
return -ENODEV;
}
@@ -1349,6 +1346,8 @@ static void module_cleanup(void)
{
int i, j;
+ pci_unregister_driver(&ivtv_pci_driver);
+
for (i = 0; i < ivtv_cards_active; i++) {
if (ivtv_cards[i] == NULL)
continue;
@@ -1357,7 +1356,6 @@ static void module_cleanup(void)
}
kfree(ivtv_cards[i]);
}
- pci_unregister_driver(&ivtv_pci_driver);
}
/* Note: These symbols are exported because they are used by the ivtv-fb