I have some patches that add PM support to all echoaudio drivers. It seems to work fine, but it has been tested on two cards only and the rawmidi device hasn't been tested at all. I can't test it because suspend-to-anything does not work on my pmac. I want to be sure at least it cannot deadlock.
* On suspend:
Rawmidi input is interrupt-driven. The driver tells the card to stop accepting data.
Rawmidi output is timer-driven. The driver uses a timer to check if the card's output buffer has room for more data to send. Do del_timer_sync() and wait until all buffered data is sent, which may take 20ms (64 bytes at 31250bps).
* On resume:
Input: Re-enable midi in.
Output: Restart the timer.
Do you see any race condition or weak points in this scheme, especially in the midi-out part ? Is del_timer_sync() safe ?