2012-07-31

DVB power-management on suspend

Back to the power-management again

Last week I finished with DVB power-management, the issue I touched on earlier too when implementing general suspend / resume support for DVB USB. For now I looked how to implement real hardware power saving functionalities when device is suspended. Initial implementation was lacking all the power management, allowing only computer to enter suspend when television was still streaming. All the chips were still left full power state and thus continued draining full current which is simply against Kernel power-management rules.


In order to fix that problem nicely and general level enough I was forced to study issue from multiple perspectives. It is clear that DVB devices are much more complex than usual Kernel drivers. That is coming from the fact there is at least three sub-drivers (USB/PCI-interface, demodulator, RF-tuner) and each of those works quite independent. Fortunately there is existing power-management callbacks (named init and sleep) which are even often implemented. You can consider those equivalent to USB -framework PM callbacks that are named suspend, resume (and reset_resume). Another lucky point here is that DVB-frontend has cache structure, which basically stores all the transmissions parameters used currently. So as we has existing init/sleep callbacks for power-management and all transmission parameters stored, it should be relatively easy to recover device at the state where it was.
  • on suspend
    • stop remote controller polling (interface driver)
    • stop ongoing stream (interface driver)
    • sleep demodulator (demodulator driver)
    • sleep tuner (RF-tuner driver)
    • sleep interface (interface driver)
    • return with success to inform Kernel PM device is suspended
  • on resume
    • wake-up interface (interface driver)
    • wake-up tuner (RF-tuner driver)
    • wake-up demodulator (demodulator driver)
    • acquire DVB-frontend to retune (DVB-core driver)
    • resume ongoing stream (interface driver)
    • resume remote controller polling (interface driver)
    • return with success to inform Kernel PM device is resumed

Simple? Actually it is, due to no need to touch existing demodulator and tuner drivers. And seems to work nicely. What I tested with few USB devices using VLC, all those continued to show same TV-channel just after resumed!

I still have some thoughts to make it more general by moving that functionality partly to the DVB-frontend. Currently process is lead by DVB USB core parts and DVB-frontend is only asked to perform retune. It could be wise to add suspend and resume functions to the DVB-frontend and let the DVB-frontend then call demodulator and tuner driver init & sleep respectively.

sub-driver level power-management issues

During the development I made simple USB power meter in order to see some real life statistics about device current usage. Quick testing with few USB devices reveals we have quite much room for improvements in that area. I will go back to that topic soon when new multimeter I ordered arrives.

device draining around 280mA when in use


No comments:

Post a comment