diff options
author | Gerd Knorr <devnull@localhost> | 2004-10-12 07:33:22 +0000 |
---|---|---|
committer | Gerd Knorr <devnull@localhost> | 2004-10-12 07:33:22 +0000 |
commit | 6242986c96a52e683e5d44333fceb360ca83d669 (patch) | |
tree | f923b8b1adc1f10cd5c6a84af5add0c098bf2517 /linux/drivers/media/video/cx88/cx88-mpeg.c | |
parent | 3de5a0bda8a7e0289857223e3b645c0782aee2b7 (diff) | |
download | mediapointer-dvb-s2-6242986c96a52e683e5d44333fceb360ca83d669.tar.gz mediapointer-dvb-s2-6242986c96a52e683e5d44333fceb360ca83d669.tar.bz2 |
- more power management stuff.
- misc fixes.
Diffstat (limited to 'linux/drivers/media/video/cx88/cx88-mpeg.c')
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-mpeg.c | 95 |
1 files changed, 78 insertions, 17 deletions
diff --git a/linux/drivers/media/video/cx88/cx88-mpeg.c b/linux/drivers/media/video/cx88/cx88-mpeg.c index bd4d918a9..ff1a27978 100644 --- a/linux/drivers/media/video/cx88/cx88-mpeg.c +++ b/linux/drivers/media/video/cx88/cx88-mpeg.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-mpeg.c,v 1.10 2004/10/07 12:29:56 kraxel Exp $ + * $Id: cx88-mpeg.c,v 1.11 2004/10/12 07:33:22 kraxel Exp $ * * Support for the mpeg transport stream transfers * PCI function #2 of the cx2388x. @@ -48,12 +48,12 @@ MODULE_PARM_DESC(debug,"enable debug messages [mpeg]"); /* ------------------------------------------------------------------ */ -int cx8802_start_dma(struct cx8802_dev *dev, - struct cx88_dmaqueue *q, - struct cx88_buffer *buf) +static int cx8802_start_dma(struct cx8802_dev *dev, + struct cx88_dmaqueue *q, + struct cx88_buffer *buf) { struct cx88_core *core = dev->core; - + dprintk(1, "cx8802_start_mpegport_dma %d\n", buf->vb.width); /* setup fifo + format */ @@ -102,24 +102,24 @@ int cx8802_start_dma(struct cx8802_dev *dev, return 0; } -void cx8802_shutdown(struct cx8802_dev *dev) +static int cx8802_stop_dma(struct cx8802_dev *dev) { struct cx88_core *core = dev->core; - /* disable and clear irqs */ - cx_write(MO_TS_INTMSK, 0x0); - cx_write(MO_TS_INTSTAT, 0x1f1111); - /* stop dma */ cx_clear(MO_TS_DMACNTRL, 0x11); - cx_write(MO_DEV_CNTRL2, 0); /* FIXME: affects other pci functions ??? */ + + /* disable irqs */ + cx_clear(MO_PCI_INTMSK, 0x000004); + cx_clear(MO_TS_INTMSK, 0x1f0011); /* Reset the controller */ cx_write(TS_GEN_CNTRL, 0xcd); + return 0; } -int cx8802_restart_queue(struct cx8802_dev *dev, - struct cx88_dmaqueue *q) +static int cx8802_restart_queue(struct cx8802_dev *dev, + struct cx88_dmaqueue *q) { struct cx88_buffer *buf; struct list_head *item; @@ -226,7 +226,7 @@ void cx8802_cancel_buffers(struct cx8802_dev *dev) struct cx88_dmaqueue *q = &dev->mpegq; del_timer_sync(&q->timeout); - cx8802_shutdown(dev); + cx8802_stop_dma(dev); do_cancel_buffers(dev,"cancel",0); } @@ -238,7 +238,7 @@ static void cx8802_timeout(unsigned long data) if (debug) cx88_sram_channel_dump(dev->core, &cx88_sram_channels[SRAM_CH28]); - cx8802_shutdown(dev); + cx8802_stop_dma(dev); dev->timeout_count++; do_cancel_buffers(dev,"timeout",1); } @@ -285,7 +285,7 @@ static void cx8802_mpeg_irq(struct cx8802_dev *dev) if (status & 0x1f0100) { spin_lock(&dev->slock); dev->error_count++; - cx8802_shutdown(dev); + cx8802_stop_dma(dev); cx8802_restart_queue(dev,&dev->mpegq); spin_unlock(&dev->slock); } @@ -383,7 +383,7 @@ int cx8802_init_common(struct cx8802_dev *dev) void cx8802_fini_common(struct cx8802_dev *dev) { - cx8802_shutdown(dev); + cx8802_stop_dma(dev); pci_disable_device(dev->pci); /* unregister stuff */ @@ -393,6 +393,64 @@ void cx8802_fini_common(struct cx8802_dev *dev) /* free memory */ btcx_riscmem_free(dev->pci,&dev->mpegq.stopper); } + +/* ----------------------------------------------------------- */ + +int cx8802_suspend_common(struct pci_dev *pci_dev, u32 state) +{ + struct cx8802_dev *dev = pci_get_drvdata(pci_dev); + struct cx88_core *core = dev->core; + + /* stop mpeg dma */ + spin_lock(&dev->slock); + if (!list_empty(&dev->mpegq.active)) { + printk("%s: suspend mpeg\n", core->name); + cx8802_stop_dma(dev); + del_timer(&dev->mpegq.timeout); + } + spin_unlock(&dev->slock); + +#if 1 + /* FIXME -- shutdown device */ + cx88_shutdown(dev->core); +#endif + + pci_save_state(pci_dev, dev->state.pci_cfg); + if (0 != pci_set_power_state(pci_dev, state)) { + pci_disable_device(pci_dev); + dev->state.disabled = 1; + } + return 0; +} + +int cx8802_resume_common(struct pci_dev *pci_dev) +{ + struct cx8802_dev *dev = pci_get_drvdata(pci_dev); + struct cx88_core *core = dev->core; + + if (dev->state.disabled) { + pci_enable_device(pci_dev); + dev->state.disabled = 0; + } + pci_set_power_state(pci_dev, 0); + pci_restore_state(pci_dev, dev->state.pci_cfg); + +#if 1 + /* FIXME: re-initialize hardware */ + cx88_reset(dev->core); +#endif + + /* restart video+vbi capture */ + spin_lock(&dev->slock); + if (!list_empty(&dev->mpegq.active)) { + printk("%s: resume mpeg\n", core->name); + cx8802_restart_queue(dev,&dev->mpegq); + } + spin_unlock(&dev->slock); + + return 0; +} + /* ----------------------------------------------------------- */ EXPORT_SYMBOL(cx8802_buf_prepare); @@ -402,6 +460,9 @@ EXPORT_SYMBOL(cx8802_cancel_buffers); EXPORT_SYMBOL(cx8802_init_common); EXPORT_SYMBOL(cx8802_fini_common); +EXPORT_SYMBOL(cx8802_suspend_common); +EXPORT_SYMBOL(cx8802_resume_common); + /* ----------------------------------------------------------- */ /* * Local variables: |