ac97: bus_master: Check pi_info before warm reset

According to ac97 spec, warm reset is specified to no-op when the device
is running. We should ignore it while the device is recording audio as
well.

BUG=chromium:1026538
TEST=Build

Change-Id: I64be922149c90be9a7a8669ef6d56591e6de632b
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/platform/crosvm/+/1960058
Reviewed-by: Dylan Reid <dgreid@chromium.org>
Tested-by: kokoro <noreply+kokoro@google.com>
Commit-Queue: Chih-Yang Hsia <paulhsia@chromium.org>
This commit is contained in:
paulhsia 2019-12-11 10:23:06 +08:00 committed by Commit Bot
parent 65588b2535
commit 8d3f9ba350

View file

@ -447,7 +447,9 @@ impl Ac97BusMaster {
if new_glob_cnt & GLOB_CNT_WARM_RESET != 0 {
// Check if running and if so, ignore. Warm reset is specified to no-op when the device
// is playing or recording audio.
if !self.po_info.thread_run.load(Ordering::Relaxed) {
if !self.po_info.thread_run.load(Ordering::Relaxed)
&& !self.pi_info.thread_run.load(Ordering::Relaxed)
{
self.stop_all_audio();
let mut regs = self.regs.lock();
regs.glob_cnt = new_glob_cnt & !GLOB_CNT_WARM_RESET; // Auto-cleared reset bit.