CRAS: dev_io - Update underrun detector

The pervious underrun detector is not accurate. The better method is
getting a new hardware level and compare with the number of frames
we have written. We also need to compute device wake up time earlier
so that we won't call extra snd_pcm_avail function which may cause
some problems. The related discussion is in
https://docs.google.com/document/d/1AxRP1-GN0Zy7T4ebfsykmJcynzoay6Xjs-gOK0poPnE

BUG=b:77485214
TEST=CRAS works well on peppy and coral for a day.

Change-Id: Id39ceb54c53ae7ec7d874e89fada27156eade660
Reviewed-on: https://chromium-review.googlesource.com/1143097
Commit-Ready: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Tested-by: Yu-Hsuan Hsu <yuhsuan@chromium.org>
Reviewed-by: Cheng-Yi Chiang <cychiang@chromium.org>
7 files changed