summaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2007-10-08 12:07:35 -0300
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-10 00:03:20 -0300
commitacd827d63a568a2cfa26ae8e6093b098c91c631b (patch)
treea6c8372103850552e30f5f3314a9300d4d4c81f5 /drivers/media
parent49ee718ef51f4d938f80f67207e1bfa2a38897a4 (diff)
downloadlinux-acd827d63a568a2cfa26ae8e6093b098c91c631b.tar.bz2
V4L/DVB (6306): Few clenups for saa7134 resume code
*Disable DMA explictly on suspend *Enable DMA on resume, after all buffers were configured *Disable overlay on resume - apps should enable it when X is resumed Signed-off-by: Maxim Levitsky <maximlevitsky@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media')
-rw-r--r--drivers/media/video/saa7134/saa7134-core.c38
-rw-r--r--drivers/media/video/saa7134/saa7134-tvaudio.c2
-rw-r--r--drivers/media/video/saa7134/saa7134.h2
3 files changed, 22 insertions, 20 deletions
diff --git a/drivers/media/video/saa7134/saa7134-core.c b/drivers/media/video/saa7134/saa7134-core.c
index fae0bfe7939f..80f04f252fce 100644
--- a/drivers/media/video/saa7134/saa7134-core.c
+++ b/drivers/media/video/saa7134/saa7134-core.c
@@ -398,29 +398,23 @@ void saa7134_buffer_timeout(unsigned long data)
int saa7134_buffer_requeue(struct saa7134_dev *dev,
struct saa7134_dmaqueue *q)
{
- struct saa7134_buf *buf , *next;
- unsigned long flags;
+ struct saa7134_buf *buf, *next;
- spin_lock_irqsave(&dev->slock, flags);
+ assert_spin_locked(&dev->slock);
buf = q->curr;
next = buf;
-
dprintk("buffer_requeue\n");
- if (!buf) {
- spin_unlock_irqrestore(&dev->slock, flags);
+ if (!buf)
return 0;
- }
dprintk("buffer_requeue : resending active buffers \n");
if (!list_empty(&q->queue))
next = list_entry(q->queue.next, struct saa7134_buf,
vb.queue);
-
buf->activate(dev, buf, next);
- spin_unlock_irqrestore(&dev->slock, flags);
return 0;
}
@@ -435,6 +429,9 @@ int saa7134_set_dmabits(struct saa7134_dev *dev)
assert_spin_locked(&dev->slock);
+ if (dev->inresume)
+ return 0;
+
/* video capture -- dma 0 + video task A */
if (dev->video_q.curr) {
task |= 0x01;
@@ -1175,13 +1172,15 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state)
{
- /* Disable card's IRQs to prevent it from resuming computer */
-
struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
+ /* disable overlay - apps should enable it explicitly on resume*/
+ dev->ovenable = 0;
+
+ /* Disable interrupts, DMA, and rest of the chip*/
saa_writel(SAA7134_IRQ1, 0);
saa_writel(SAA7134_IRQ2, 0);
-
+ saa_writel(SAA7134_MAIN_CTRL, 0);
pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
pci_save_state(pci_dev);
@@ -1193,6 +1192,7 @@ static int saa7134_resume(struct pci_dev *pci_dev)
{
struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
+ unsigned int flags;
pci_restore_state(pci_dev);
pci_set_power_state(pci_dev, PCI_D0);
@@ -1200,6 +1200,7 @@ static int saa7134_resume(struct pci_dev *pci_dev)
/* Do things that are done in saa7134_initdev ,
except of initializing memory structures.*/
+ dev->inresume = 1;
saa7134_board_init1(dev);
if (saa7134_boards[dev->board].video_out)
@@ -1209,25 +1210,26 @@ static int saa7134_resume(struct pci_dev *pci_dev)
saa7134_ts_init_hw(dev);
saa7134_hw_enable1(dev);
-
saa7134_set_decoder(dev);
-
saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id);
-
saa7134_board_init2(dev);
saa7134_hw_enable2(dev);
- dev->force_mute_update = 1;
saa7134_tvaudio_setmute(dev);
- dev->force_mute_update = 0;
saa7134_tvaudio_setvolume(dev, dev->ctl_volume);
saa7134_enable_i2s(dev);
- /*recapture unfinished buffer(s)*/
+ /*resume unfinished buffer(s)*/
+ spin_lock_irqsave(&dev->slock, flags);
saa7134_buffer_requeue(dev, &dev->video_q);
saa7134_buffer_requeue(dev, &dev->vbi_q);
saa7134_buffer_requeue(dev, &dev->ts_q);
+ /* start DMA now*/
+ dev->inresume = 0;
+ saa7134_set_dmabits(dev);
+ spin_unlock_irqrestore(&dev->slock, flags);
+
return 0;
}
diff --git a/drivers/media/video/saa7134/saa7134-tvaudio.c b/drivers/media/video/saa7134/saa7134-tvaudio.c
index df2dab06387d..1b9e39a5ea47 100644
--- a/drivers/media/video/saa7134/saa7134-tvaudio.c
+++ b/drivers/media/video/saa7134/saa7134-tvaudio.c
@@ -231,7 +231,7 @@ static void mute_input_7134(struct saa7134_dev *dev)
}
if (dev->hw_mute == mute &&
- dev->hw_input == in && !dev->force_mute_update) {
+ dev->hw_input == in && !dev->inresume) {
dprintk("mute/input: nothing to do [mute=%d,input=%s]\n",
mute,in->name);
return;
diff --git a/drivers/media/video/saa7134/saa7134.h b/drivers/media/video/saa7134/saa7134.h
index 064f3dbe6951..28ec6804bd5d 100644
--- a/drivers/media/video/saa7134/saa7134.h
+++ b/drivers/media/video/saa7134/saa7134.h
@@ -522,9 +522,9 @@ struct saa7134_dev {
struct saa7134_input *input;
struct saa7134_input *hw_input;
unsigned int hw_mute;
- unsigned int force_mute_update;
int last_carrier;
int nosignal;
+ unsigned int inresume;
/* SAA7134_MPEG_* */
struct saa7134_ts ts;