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 | |
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')
-rw-r--r-- | linux/drivers/media/video/bttv-driver.c | 8 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-blackbird.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-cards.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-core.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-dvb.c | 7 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-mpeg.c | 95 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88-video.c | 4 | ||||
-rw-r--r-- | linux/drivers/media/video/cx88/cx88.h | 13 |
8 files changed, 112 insertions, 30 deletions
diff --git a/linux/drivers/media/video/bttv-driver.c b/linux/drivers/media/video/bttv-driver.c index 57a54b0ba..7a030e60d 100644 --- a/linux/drivers/media/video/bttv-driver.c +++ b/linux/drivers/media/video/bttv-driver.c @@ -1,6 +1,6 @@ /* - $Id: bttv-driver.c,v 1.21 2004/10/11 14:53:12 kraxel Exp $ + $Id: bttv-driver.c,v 1.22 2004/10/12 07:33:22 kraxel Exp $ bttv - Bt848 frame grabber driver @@ -996,6 +996,7 @@ set_input(struct bttv *btv, unsigned int input) audio_mux(btv,(input == bttv_tvcards[btv->c.type].tuner ? AUDIO_TUNER : AUDIO_EXTERN)); set_tvnorm(btv,btv->tvnorm); + i2c_vidiocschan(btv); } static void init_irqreg(struct bttv *btv) @@ -1713,7 +1714,6 @@ int bttv_common_ioctls(struct bttv *btv, unsigned int cmd, void *arg) return -EINVAL; down(&btv->lock); set_input(btv,*i); - i2c_vidiocschan(btv); up(&btv->lock); return 0; } @@ -3952,7 +3952,7 @@ static int bttv_suspend(struct pci_dev *pci_dev, u32 state) struct bttv_buffer_set idle; unsigned long flags; - printk("bttv%d: suspend %d\n", btv->c.nr, state); + dprintk("bttv%d: suspend %d\n", btv->c.nr, state); /* stop dma + irqs */ spin_lock_irqsave(&btv->s_lock,flags); @@ -3986,7 +3986,7 @@ static int bttv_resume(struct pci_dev *pci_dev) struct bttv *btv = pci_get_drvdata(pci_dev); unsigned long flags; - printk("bttv%d: resume\n", btv->c.nr); + dprintk("bttv%d: resume\n", btv->c.nr); /* restore pci state */ if (btv->state.disabled) { diff --git a/linux/drivers/media/video/cx88/cx88-blackbird.c b/linux/drivers/media/video/cx88/cx88-blackbird.c index c85172170..4e754eace 100644 --- a/linux/drivers/media/video/cx88/cx88-blackbird.c +++ b/linux/drivers/media/video/cx88/cx88-blackbird.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-blackbird.c,v 1.13 2004/10/11 14:53:13 kraxel Exp $ + * $Id: cx88-blackbird.c,v 1.14 2004/10/12 07:33:22 kraxel Exp $ * * Support for a cx23416 mpeg encoder via cx2388x host port. * "blackbird" reference design. @@ -872,6 +872,8 @@ static struct pci_driver blackbird_pci_driver = { .id_table = cx8802_pci_tbl, .probe = blackbird_probe, .remove = blackbird_remove, + .suspend = cx8802_suspend_common, + .resume = cx8802_resume_common, }; static int blackbird_init(void) diff --git a/linux/drivers/media/video/cx88/cx88-cards.c b/linux/drivers/media/video/cx88/cx88-cards.c index 8a1ee5792..5df094b78 100644 --- a/linux/drivers/media/video/cx88/cx88-cards.c +++ b/linux/drivers/media/video/cx88/cx88-cards.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-cards.c,v 1.43 2004/10/11 13:45:51 kraxel Exp $ + * $Id: cx88-cards.c,v 1.44 2004/10/12 07:33:22 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * card-specific stuff. @@ -89,6 +89,7 @@ struct cx88_board cx88_boards[] = { .input = {{ .type = CX88_VMUX_TELEVISION, .vmux = 0, + .gpio0 = 0xff00, // internal decoder },{ .type = CX88_VMUX_COMPOSITE1, .vmux = 1, @@ -96,6 +97,10 @@ struct cx88_board cx88_boards[] = { .type = CX88_VMUX_SVIDEO, .vmux = 2, }}, + .radio = { + .type = CX88_RADIO, + .gpio0 = 0xff10, + }, }, [CX88_BOARD_ATI_WONDER_PRO] = { .name = "ATI TV Wonder Pro", diff --git a/linux/drivers/media/video/cx88/cx88-core.c b/linux/drivers/media/video/cx88/cx88-core.c index 533a20b9b..6321887f5 100644 --- a/linux/drivers/media/video/cx88/cx88-core.c +++ b/linux/drivers/media/video/cx88/cx88-core.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-core.c,v 1.12 2004/10/07 12:29:56 kraxel Exp $ + * $Id: cx88-core.c,v 1.13 2004/10/12 07:33:22 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * driver core @@ -418,7 +418,7 @@ int cx88_sram_channel_setup(struct cx88_core *core, cx_write(ch->cnt1_reg, (bpl >> 3) -1); cx_write(ch->cnt2_reg, (lines*16) >> 3); - dprintk(1,"sram setup %s: bpl=%d lines=%d\n", ch->name, bpl, lines); + dprintk(2,"sram setup %s: bpl=%d lines=%d\n", ch->name, bpl, lines); return 0; } diff --git a/linux/drivers/media/video/cx88/cx88-dvb.c b/linux/drivers/media/video/cx88/cx88-dvb.c index f20a39a85..b4adbbaef 100644 --- a/linux/drivers/media/video/cx88/cx88-dvb.c +++ b/linux/drivers/media/video/cx88/cx88-dvb.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-dvb.c,v 1.11 2004/10/07 12:29:56 kraxel Exp $ + * $Id: cx88-dvb.c,v 1.12 2004/10/12 07:33:22 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * MPEG Transport Stream (DVB) routines @@ -28,6 +28,7 @@ #include <linux/fs.h> #include <linux/kthread.h> #include <linux/file.h> +#include <linux/suspend.h> #include "cx88.h" #include "cx22702.h" @@ -107,6 +108,8 @@ static int dvb_thread(void *data) break; if (kthread_should_stop()) break; + if (current->flags & PF_FREEZE) + refrigerator(PF_FREEZE); /* feed buffer data to demux */ if (buf->state == STATE_DONE) @@ -392,6 +395,8 @@ static struct pci_driver dvb_pci_driver = { .id_table = cx8802_pci_tbl, .probe = dvb_probe, .remove = dvb_remove, + .suspend = cx8802_suspend_common, + .resume = cx8802_resume_common, }; static int dvb_init(void) 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: diff --git a/linux/drivers/media/video/cx88/cx88-video.c b/linux/drivers/media/video/cx88/cx88-video.c index eeccdb29b..98161d357 100644 --- a/linux/drivers/media/video/cx88/cx88-video.c +++ b/linux/drivers/media/video/cx88/cx88-video.c @@ -1,5 +1,5 @@ /* - * $Id: cx88-video.c,v 1.39 2004/10/11 14:53:13 kraxel Exp $ + * $Id: cx88-video.c,v 1.40 2004/10/12 07:33:22 kraxel Exp $ * * device driver for Conexant 2388x based TV cards * video4linux video interface @@ -2184,8 +2184,6 @@ static int cx8800_resume(struct pci_dev *pci_dev) struct cx8800_dev *dev = pci_get_drvdata(pci_dev); struct cx88_core *core = dev->core; - printk("%s: resume\n", core->name); - if (dev->state.disabled) { pci_enable_device(pci_dev); dev->state.disabled = 0; diff --git a/linux/drivers/media/video/cx88/cx88.h b/linux/drivers/media/video/cx88/cx88.h index 8a02f0fec..768de629a 100644 --- a/linux/drivers/media/video/cx88/cx88.h +++ b/linux/drivers/media/video/cx88/cx88.h @@ -1,5 +1,5 @@ /* - * $Id: cx88.h,v 1.36 2004/10/11 13:45:51 kraxel Exp $ + * $Id: cx88.h,v 1.37 2004/10/12 07:33:22 kraxel Exp $ * * v4l2 device driver for cx2388x based TV cards * @@ -359,6 +359,11 @@ struct cx8802_fh { struct videobuf_queue mpegq; }; +struct cx8802_suspend_state { + u32 pci_cfg[64 / sizeof(u32)]; + int disabled; +}; + struct cx8802_dev { struct cx88_core *core; struct semaphore lock; @@ -378,6 +383,9 @@ struct cx8802_dev { u32 error_count; u32 timeout_count; + /* other global state info */ + struct cx8802_suspend_state state; + /* for blackbird only */ struct list_head devlist; struct video_device *mpeg_dev; @@ -536,6 +544,9 @@ void cx8802_cancel_buffers(struct cx8802_dev *dev); int cx8802_init_common(struct cx8802_dev *dev); void cx8802_fini_common(struct cx8802_dev *dev); +int cx8802_suspend_common(struct pci_dev *pci_dev, u32 state); +int cx8802_resume_common(struct pci_dev *pci_dev); + /* * Local variables: * c-basic-offset: 8 |