[linux-dvb] Power management and dvb framework
stoth at linuxtv.org
Sat Sep 13 23:53:21 CEST 2008
Devin Heitmueller wrote:
> I have been doing some debugging of a USB DVB capture device, and I
> was hoping someone could answer the following question about the DVB
> What facilities exist to power down a device after a user is done with it?
> Let's look at an example:
> I have a dib0700 based device. I specify my own frontend_attach()
> function, which twiddles various GPIOs for the demodulator, and I have
> a tuner_attach() function which I use to initialize the tuner. Both
> of these are called when I plug in the device.
> I had to set various GPIOs to bring components out of reset or
> properly set the sleep pin, but I do not see any way to put them back
> to sleep after the user is done with them.
> So in my case the USB device draws 100ma when plugged in, then goes to
> 320ma when I start streaming, but when I stop streaming I have no hook
> to put the demodulator back to sleep so it *stays* at 320ma until I
> unplug the device.
A common problem.
> I know I have similar issues with em28xx based devices I am responsible for.
> Is there some part of the framework I am simply missing? Ideally I
> would like to be able to power down the tuner and demodulator when the
> user is done with them. I know there are *_sleep functions but it's
> not clear how they are used and it doesn't look like they are commonly
> used by other devices. Are the sleep functions called when a user
> disconnects from the frontend, or is this purely a power management
> call that is used when a user suspends his workstation?
> Any advise anyone can give about the basic workflow here would be very useful.
I looked at some power stuff for the au0828 recently. I added a couple
of callbacks in the USB_register struct IIRC, I had those drive the
gpios. I don't recall the details but if you look at the definition of
the structure you should see some power related callbacks. Actually, I'm
not even sure if those patches got merged.
Also, the demod _init() and _sleep() callbacks get called by dvb-core
when the demod is required (or not). These might help.
Lastly, depending on how the driver implements DVB, is might use
videobuf - or it might do it's own buffer handing. In case of the
latter, look at the feed_start() feed_stop() functions and the struct
specific feed counter that usually accompanies this... you could
probably add some useful power related stuff with these indications.
More information about the linux-dvb