Well I'm finally taking a look into power management. As the driver stands now it's reasonably compliant - it won't stop you from changing to different power states.
The hardware supports S0 and S3 which is normal for this type of device. That means either fully on or fully off (though powering down to S3 leaves just enough power to be awakened back in to S0).
This is what I thought I'd implement:
Firstly, on powering up from S3 to S0, I'll re-submit the last tune request to get the hardware back on the previously tuned frequency. It appears a normal part of powering down is for the system to put running graphs into the stop state so streaming (DMA etc) will be stopped and later restarted outside of the driver.
Secondly I'll look at idle detection. I'm thinking 5 seconds after the graph has transitioned to stop state I'll power the device down to S3 to save power. When a graph next goes to pause or run I'll power the device back up.
I have no real idea about the electrical characteristics of the Twinhan hardware so I'm not sure how much electricity (and greenhouse gases) this will save but it can't hurt.
The completion of this part of the code will mark the end of the implementation of all the major components of the driver. After this it should just leave ongoing tweaking and maintenance.
Spectrum