Lines Matching refs:dev

44 	struct cx8802_dev *dev = container_of(work, struct cx8802_dev,  in request_module_async()  local
47 if (dev->core->board.mpeg & CX88_MPEG_DVB) in request_module_async()
49 if (dev->core->board.mpeg & CX88_MPEG_BLACKBIRD) in request_module_async()
53 static void request_modules(struct cx8802_dev *dev) in request_modules() argument
55 INIT_WORK(&dev->request_module_wk, request_module_async); in request_modules()
56 schedule_work(&dev->request_module_wk); in request_modules()
59 static void flush_request_modules(struct cx8802_dev *dev) in flush_request_modules() argument
61 flush_work(&dev->request_module_wk); in flush_request_modules()
64 #define request_modules(dev) argument
65 #define flush_request_modules(dev) argument
72 int cx8802_start_dma(struct cx8802_dev *dev, in cx8802_start_dma() argument
76 struct cx88_core *core = dev->core; in cx8802_start_dma()
83 dev->ts_packet_size, buf->risc.dma); in cx8802_start_dma()
86 cx_write(MO_TS_LNGTH, dev->ts_packet_size); in cx8802_start_dma()
99 cx_write(TS_GEN_CNTRL, 0x0040 | dev->ts_gen_cntrl); in cx8802_start_dma()
129 dev->ts_gen_cntrl = 5; in cx8802_start_dma()
138 cx_write(TS_GEN_CNTRL, dev->ts_gen_cntrl); in cx8802_start_dma()
180 static int cx8802_stop_dma(struct cx8802_dev *dev) in cx8802_stop_dma() argument
182 struct cx88_core *core = dev->core; in cx8802_stop_dma()
198 static int cx8802_restart_queue(struct cx8802_dev *dev, in cx8802_restart_queue() argument
210 cx8802_start_dma(dev, q, buf); in cx8802_restart_queue()
216 int cx8802_buf_prepare(struct vb2_queue *q, struct cx8802_dev *dev, in cx8802_buf_prepare() argument
219 int size = dev->ts_packet_size * dev->ts_packet_count; in cx8802_buf_prepare()
228 rc = cx88_risc_databuffer(dev->pci, risc, sgt->sgl, in cx8802_buf_prepare()
229 dev->ts_packet_size, dev->ts_packet_count, 0); in cx8802_buf_prepare()
232 dma_free_coherent(&dev->pci->dev, risc->size, in cx8802_buf_prepare()
241 void cx8802_buf_queue(struct cx8802_dev *dev, struct cx88_buffer *buf) in cx8802_buf_queue() argument
244 struct cx88_dmaqueue *cx88q = &dev->mpegq; in cx8802_buf_queue()
272 static void do_cancel_buffers(struct cx8802_dev *dev) in do_cancel_buffers() argument
274 struct cx88_dmaqueue *q = &dev->mpegq; in do_cancel_buffers()
278 spin_lock_irqsave(&dev->slock, flags); in do_cancel_buffers()
284 spin_unlock_irqrestore(&dev->slock, flags); in do_cancel_buffers()
287 void cx8802_cancel_buffers(struct cx8802_dev *dev) in cx8802_cancel_buffers() argument
290 cx8802_stop_dma(dev); in cx8802_cancel_buffers()
291 do_cancel_buffers(dev); in cx8802_cancel_buffers()
304 static void cx8802_mpeg_irq(struct cx8802_dev *dev) in cx8802_mpeg_irq() argument
306 struct cx88_core *core = dev->core; in cx8802_mpeg_irq()
326 cx88_sram_channel_dump(dev->core, in cx8802_mpeg_irq()
333 spin_lock(&dev->slock); in cx8802_mpeg_irq()
335 cx88_wakeup(dev->core, &dev->mpegq, count); in cx8802_mpeg_irq()
336 spin_unlock(&dev->slock); in cx8802_mpeg_irq()
342 spin_lock(&dev->slock); in cx8802_mpeg_irq()
343 cx8802_stop_dma(dev); in cx8802_mpeg_irq()
344 spin_unlock(&dev->slock); in cx8802_mpeg_irq()
352 struct cx8802_dev *dev = dev_id; in cx8802_irq() local
353 struct cx88_core *core = dev->core; in cx8802_irq()
371 cx8802_mpeg_irq(dev); in cx8802_irq()
383 static int cx8802_init_common(struct cx8802_dev *dev) in cx8802_init_common() argument
385 struct cx88_core *core = dev->core; in cx8802_init_common()
389 if (pci_enable_device(dev->pci)) in cx8802_init_common()
391 pci_set_master(dev->pci); in cx8802_init_common()
392 err = dma_set_mask(&dev->pci->dev, DMA_BIT_MASK(32)); in cx8802_init_common()
398 dev->pci_rev = dev->pci->revision; in cx8802_init_common()
399 pci_read_config_byte(dev->pci, PCI_LATENCY_TIMER, &dev->pci_lat); in cx8802_init_common()
401 pci_name(dev->pci), dev->pci_rev, dev->pci->irq, in cx8802_init_common()
402 dev->pci_lat, in cx8802_init_common()
403 (unsigned long long)pci_resource_start(dev->pci, 0)); in cx8802_init_common()
406 spin_lock_init(&dev->slock); in cx8802_init_common()
409 INIT_LIST_HEAD(&dev->mpegq.active); in cx8802_init_common()
412 err = request_irq(dev->pci->irq, cx8802_irq, in cx8802_init_common()
413 IRQF_SHARED, dev->core->name, dev); in cx8802_init_common()
415 pr_err("can't get IRQ %d\n", dev->pci->irq); in cx8802_init_common()
421 pci_set_drvdata(dev->pci, dev); in cx8802_init_common()
425 static void cx8802_fini_common(struct cx8802_dev *dev) in cx8802_fini_common() argument
428 cx8802_stop_dma(dev); in cx8802_fini_common()
429 pci_disable_device(dev->pci); in cx8802_fini_common()
432 free_irq(dev->pci->irq, dev); in cx8802_fini_common()
439 struct cx8802_dev *dev = pci_get_drvdata(pci_dev); in cx8802_suspend_common() local
443 spin_lock_irqsave(&dev->slock, flags); in cx8802_suspend_common()
444 if (!list_empty(&dev->mpegq.active)) { in cx8802_suspend_common()
447 cx8802_stop_dma(dev); in cx8802_suspend_common()
449 spin_unlock_irqrestore(&dev->slock, flags); in cx8802_suspend_common()
452 cx88_shutdown(dev->core); in cx8802_suspend_common()
458 dev->state.disabled = 1; in cx8802_suspend_common()
465 struct cx8802_dev *dev = pci_get_drvdata(pci_dev); in cx8802_resume_common() local
469 if (dev->state.disabled) { in cx8802_resume_common()
475 dev->state.disabled = 0; in cx8802_resume_common()
481 dev->state.disabled = 1; in cx8802_resume_common()
488 cx88_reset(dev->core); in cx8802_resume_common()
491 spin_lock_irqsave(&dev->slock, flags); in cx8802_resume_common()
492 if (!list_empty(&dev->mpegq.active)) { in cx8802_resume_common()
494 cx8802_restart_queue(dev, &dev->mpegq); in cx8802_resume_common()
496 spin_unlock_irqrestore(&dev->slock, flags); in cx8802_resume_common()
501 struct cx8802_driver *cx8802_get_driver(struct cx8802_dev *dev, in cx8802_get_driver() argument
506 list_for_each_entry(d, &dev->drvlist, drvlist) in cx8802_get_driver()
598 struct cx8802_dev *dev; in cx8802_register_driver() local
615 list_for_each_entry(dev, &cx8802_devlist, devlist) { in cx8802_register_driver()
617 dev->pci->subsystem_vendor, in cx8802_register_driver()
618 dev->pci->subsystem_device, dev->core->board.name, in cx8802_register_driver()
619 dev->core->boardnr); in cx8802_register_driver()
629 drv->core = dev->core; in cx8802_register_driver()
640 list_add_tail(&driver->drvlist, &dev->drvlist); in cx8802_register_driver()
656 struct cx8802_dev *dev; in cx8802_unregister_driver() local
667 list_for_each_entry(dev, &cx8802_devlist, devlist) { in cx8802_unregister_driver()
669 dev->pci->subsystem_vendor, in cx8802_unregister_driver()
670 dev->pci->subsystem_device, dev->core->board.name, in cx8802_unregister_driver()
671 dev->core->boardnr); in cx8802_unregister_driver()
673 mutex_lock(&dev->core->lock); in cx8802_unregister_driver()
675 list_for_each_entry_safe(d, dtmp, &dev->drvlist, drvlist) { in cx8802_unregister_driver()
689 mutex_unlock(&dev->core->lock); in cx8802_unregister_driver()
702 struct cx8802_dev *dev; in cx8802_probe() local
718 dev = kzalloc(sizeof(*dev), GFP_KERNEL); in cx8802_probe()
719 if (!dev) in cx8802_probe()
721 dev->pci = pci_dev; in cx8802_probe()
722 dev->core = core; in cx8802_probe()
725 core->dvbdev = dev; in cx8802_probe()
727 err = cx8802_init_common(dev); in cx8802_probe()
731 INIT_LIST_HEAD(&dev->drvlist); in cx8802_probe()
733 list_add_tail(&dev->devlist, &cx8802_devlist); in cx8802_probe()
737 request_modules(dev); in cx8802_probe()
741 kfree(dev); in cx8802_probe()
750 struct cx8802_dev *dev; in cx8802_remove() local
752 dev = pci_get_drvdata(pci_dev); in cx8802_remove()
756 flush_request_modules(dev); in cx8802_remove()
758 mutex_lock(&dev->core->lock); in cx8802_remove()
760 if (!list_empty(&dev->drvlist)) { in cx8802_remove()
766 list_for_each_entry_safe(drv, tmp, &dev->drvlist, drvlist) { in cx8802_remove()
777 mutex_unlock(&dev->core->lock); in cx8802_remove()
780 dev->core->dvbdev = NULL; in cx8802_remove()
783 cx8802_fini_common(dev); in cx8802_remove()
784 cx88_core_put(dev->core, dev->pci); in cx8802_remove()
785 kfree(dev); in cx8802_remove()