aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media
diff options
context:
space:
mode:
authorMaxim Levitsky <maximlevitsky@gmail.com>2007-10-08 11:07:35 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2007-10-09 23:03:20 -0400
commitacd827d63a568a2cfa26ae8e6093b098c91c631b (patch)
treea6c8372103850552e30f5f3314a9300d4d4c81f5 /drivers/media
parent49ee718ef51f4d938f80f67207e1bfa2a38897a4 (diff)
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)
398int saa7134_buffer_requeue(struct saa7134_dev *dev, 398int saa7134_buffer_requeue(struct saa7134_dev *dev,
399 struct saa7134_dmaqueue *q) 399 struct saa7134_dmaqueue *q)
400{ 400{
401 struct saa7134_buf *buf , *next; 401 struct saa7134_buf *buf, *next;
402 unsigned long flags;
403 402
404 spin_lock_irqsave(&dev->slock, flags); 403 assert_spin_locked(&dev->slock);
405 404
406 buf = q->curr; 405 buf = q->curr;
407 next = buf; 406 next = buf;
408
409 dprintk("buffer_requeue\n"); 407 dprintk("buffer_requeue\n");
410 408
411 if (!buf) { 409 if (!buf)
412 spin_unlock_irqrestore(&dev->slock, flags);
413 return 0; 410 return 0;
414 }
415 411
416 dprintk("buffer_requeue : resending active buffers \n"); 412 dprintk("buffer_requeue : resending active buffers \n");
417 413
418 if (!list_empty(&q->queue)) 414 if (!list_empty(&q->queue))
419 next = list_entry(q->queue.next, struct saa7134_buf, 415 next = list_entry(q->queue.next, struct saa7134_buf,
420 vb.queue); 416 vb.queue);
421
422 buf->activate(dev, buf, next); 417 buf->activate(dev, buf, next);
423 spin_unlock_irqrestore(&dev->slock, flags);
424 418
425 return 0; 419 return 0;
426} 420}
@@ -435,6 +429,9 @@ int saa7134_set_dmabits(struct saa7134_dev *dev)
435 429
436 assert_spin_locked(&dev->slock); 430 assert_spin_locked(&dev->slock);
437 431
432 if (dev->inresume)
433 return 0;
434
438 /* video capture -- dma 0 + video task A */ 435 /* video capture -- dma 0 + video task A */
439 if (dev->video_q.curr) { 436 if (dev->video_q.curr) {
440 task |= 0x01; 437 task |= 0x01;
@@ -1175,13 +1172,15 @@ static void __devexit saa7134_finidev(struct pci_dev *pci_dev)
1175static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state) 1172static int saa7134_suspend(struct pci_dev *pci_dev , pm_message_t state)
1176{ 1173{
1177 1174
1178 /* Disable card's IRQs to prevent it from resuming computer */
1179
1180 struct saa7134_dev *dev = pci_get_drvdata(pci_dev); 1175 struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
1181 1176
1177 /* disable overlay - apps should enable it explicitly on resume*/
1178 dev->ovenable = 0;
1179
1180 /* Disable interrupts, DMA, and rest of the chip*/
1182 saa_writel(SAA7134_IRQ1, 0); 1181 saa_writel(SAA7134_IRQ1, 0);
1183 saa_writel(SAA7134_IRQ2, 0); 1182 saa_writel(SAA7134_IRQ2, 0);
1184 1183 saa_writel(SAA7134_MAIN_CTRL, 0);
1185 1184
1186 pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state)); 1185 pci_set_power_state(pci_dev, pci_choose_state(pci_dev, state));
1187 pci_save_state(pci_dev); 1186 pci_save_state(pci_dev);
@@ -1193,6 +1192,7 @@ static int saa7134_resume(struct pci_dev *pci_dev)
1193{ 1192{
1194 1193
1195 struct saa7134_dev *dev = pci_get_drvdata(pci_dev); 1194 struct saa7134_dev *dev = pci_get_drvdata(pci_dev);
1195 unsigned int flags;
1196 1196
1197 pci_restore_state(pci_dev); 1197 pci_restore_state(pci_dev);
1198 pci_set_power_state(pci_dev, PCI_D0); 1198 pci_set_power_state(pci_dev, PCI_D0);
@@ -1200,6 +1200,7 @@ static int saa7134_resume(struct pci_dev *pci_dev)
1200 /* Do things that are done in saa7134_initdev , 1200 /* Do things that are done in saa7134_initdev ,
1201 except of initializing memory structures.*/ 1201 except of initializing memory structures.*/
1202 1202
1203 dev->inresume = 1;
1203 saa7134_board_init1(dev); 1204 saa7134_board_init1(dev);
1204 1205
1205 if (saa7134_boards[dev->board].video_out) 1206 if (saa7134_boards[dev->board].video_out)
@@ -1209,25 +1210,26 @@ static int saa7134_resume(struct pci_dev *pci_dev)
1209 saa7134_ts_init_hw(dev); 1210 saa7134_ts_init_hw(dev);
1210 1211
1211 saa7134_hw_enable1(dev); 1212 saa7134_hw_enable1(dev);
1212
1213 saa7134_set_decoder(dev); 1213 saa7134_set_decoder(dev);
1214
1215 saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id); 1214 saa7134_i2c_call_clients(dev, VIDIOC_S_STD, &dev->tvnorm->id);
1216
1217 saa7134_board_init2(dev); 1215 saa7134_board_init2(dev);
1218 saa7134_hw_enable2(dev); 1216 saa7134_hw_enable2(dev);
1219 1217
1220 dev->force_mute_update = 1;
1221 saa7134_tvaudio_setmute(dev); 1218 saa7134_tvaudio_setmute(dev);
1222 dev->force_mute_update = 0;
1223 saa7134_tvaudio_setvolume(dev, dev->ctl_volume); 1219 saa7134_tvaudio_setvolume(dev, dev->ctl_volume);
1224 saa7134_enable_i2s(dev); 1220 saa7134_enable_i2s(dev);
1225 1221
1226 /*recapture unfinished buffer(s)*/ 1222 /*resume unfinished buffer(s)*/
1223 spin_lock_irqsave(&dev->slock, flags);
1227 saa7134_buffer_requeue(dev, &dev->video_q); 1224 saa7134_buffer_requeue(dev, &dev->video_q);
1228 saa7134_buffer_requeue(dev, &dev->vbi_q); 1225 saa7134_buffer_requeue(dev, &dev->vbi_q);
1229 saa7134_buffer_requeue(dev, &dev->ts_q); 1226 saa7134_buffer_requeue(dev, &dev->ts_q);
1230 1227
1228 /* start DMA now*/
1229 dev->inresume = 0;
1230 saa7134_set_dmabits(dev);
1231 spin_unlock_irqrestore(&dev->slock, flags);
1232
1231 return 0; 1233 return 0;
1232} 1234}
1233 1235
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)
231 } 231 }
232 232
233 if (dev->hw_mute == mute && 233 if (dev->hw_mute == mute &&
234 dev->hw_input == in && !dev->force_mute_update) { 234 dev->hw_input == in && !dev->inresume) {
235 dprintk("mute/input: nothing to do [mute=%d,input=%s]\n", 235 dprintk("mute/input: nothing to do [mute=%d,input=%s]\n",
236 mute,in->name); 236 mute,in->name);
237 return; 237 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 {
522 struct saa7134_input *input; 522 struct saa7134_input *input;
523 struct saa7134_input *hw_input; 523 struct saa7134_input *hw_input;
524 unsigned int hw_mute; 524 unsigned int hw_mute;
525 unsigned int force_mute_update;
526 int last_carrier; 525 int last_carrier;
527 int nosignal; 526 int nosignal;
527 unsigned int inresume;
528 528
529 /* SAA7134_MPEG_* */ 529 /* SAA7134_MPEG_* */
530 struct saa7134_ts ts; 530 struct saa7134_ts ts;