Julian Scheel wrote:
> Oliver Endriss schrieb:
> > Julian Scheel wrote:
> >   
> >> Attached is a patch with adds full support for suspend/resume in 
> >> budget-av. 
> >> Actually only the CI interface needs to be reinitialised as all the tuner 
> >> stuff gets reinitialised at the next tuning-process anyway.
> >> So this patch should be ready to go pretty straightforward into head.
> >>     
> >
> > Please post the sub-system ids of the cards you tested and which power
> > states you tested.
> >   
> Going to look up the IDs later, when I have access to my dev-system.
> But it should be all current KNC DVB-C and DVB-S cards.
> >> diff -r c45e373bbca3 linux/drivers/media/common/saa7146_core.c
> >> --- a/linux/drivers/media/common/saa7146_core.c Sat Jul 28 00:06:44 2007 
> >> -0300
> >> +++ b/linux/drivers/media/common/saa7146_core.c Tue Aug 07 23:22:54 2007 
> >> +0200
> >> @@ -515,6 +515,28 @@ static void saa7146_remove_one(struct pc
> >>         saa7146_num--;
> >>  }
> >>
> >> +static int saa7146_suspend(struct pci_dev *pdev)
> >> +{
> >> +       struct saa7146_dev* dev = pci_get_drvdata(pdev);
> >> +       DEB_EE(("dev:%p\n",dev));
> >> +       int err;
> >> +
> >> +       err = dev->ext->suspend(dev);
> >>     
> >           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
> > Causes an oops if the card driver did not set the suspend hook.
> >
> > Fix:
> >     int err = -EBUSY;
> >     if (dev->ext->suspend)
> >             err = dev->ext->suspend(dev);
> >   
> Agreed (c:
> >> +
> >> +       return err;
> >> +}
> >> +
> >> +static int saa7146_resume(struct pci_dev *pdev)
> >> +{
> >> +       struct saa7146_dev* dev = pci_get_drvdata(pdev);
> >> +       DEB_EE(("dev:%p\n",dev));
> >> +       int err;
> >> +
> >> +       err = dev->ext->resume(dev);
> >>     
> >
> > ditto
> >
> > IMO this patch can only work with S1 state. Higher states turn off PCI
> > power and require re-initialization of saa7146, demod, tuner etc.
> > See other drivers which fully implement suspend/resume.
> >   
> Works perfectly fine with S3-state for me. Actually S3 always worked 
> fine, only ci interface did not work anymore after S3, that is fixed 
> with this patch.

Hm, I did some tests with budget.c:
- "echo standby > /sys/power/state" works
- "echo mem > /sys/power/state" does not work!
- "echo disk > /sys/power/state" does not work!

It works if the PCI bus stays 'on', i.e. the card is not powered-off.
So there is much more to be done if we want to support power states
properly.

Btw, could you test if the CI works without reinitialisation if you
apply the attached patch? I can't test it. Without this patch the kernel
thread will die and the CI does not work anymore...

CU
Oliver

-- 
----------------------------------------------------------------
VDR Remote Plugin 0.3.9: http://www.escape-edv.de/endriss/vdr/
----------------------------------------------------------------
diff -r 600876f4508f linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c
--- a/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c	Thu Aug 09 07:41:16 2007 +0200
+++ b/linux/drivers/media/dvb/dvb-core/dvb_ca_en50221.c	Sun Aug 12 14:39:07 2007 +0200
@@ -38,8 +38,15 @@
 #include <linux/spinlock.h>
 #include <linux/sched.h>
 
+#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,20)
+#include <linux/suspend.h>
+#else
+#include <linux/freezer.h>
+#endif
+
 #include "dvb_ca_en50221.h"
 #include "dvb_ringbuffer.h"
+#include "compat.h"
 
 static int dvb_ca_en50221_debug;
 
@@ -1002,6 +1009,8 @@ static int dvb_ca_en50221_thread(void *d
 	/* choose the correct initial delay */
 	dvb_ca_en50221_thread_update_delay(ca);
 
+	set_freezable();
+
 	/* main loop */
 	while (!ca->exit) {
 		/* sleep for a bit */
@@ -1009,6 +1018,8 @@ static int dvb_ca_en50221_thread(void *d
 			flags = wait_event_interruptible_timeout(ca->thread_queue,
 								 dvb_ca_en50221_thread_should_wakeup(ca),
 								 ca->delay);
+			if (try_to_freeze())
+				continue;
 			if ((flags == -ERESTARTSYS) || ca->exit) {
 				/* got signal or quitting */
 				break;
_______________________________________________
linux-dvb mailing list
linux-dvb@linuxtv.org
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

Reply via email to