From 8d3f9ba350137a3f423a4241067cf96762e518bf Mon Sep 17 00:00:00 2001 From: paulhsia Date: Wed, 11 Dec 2019 10:23:06 +0800 Subject: [PATCH] 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 Tested-by: kokoro Commit-Queue: Chih-Yang Hsia --- devices/src/pci/ac97_bus_master.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/devices/src/pci/ac97_bus_master.rs b/devices/src/pci/ac97_bus_master.rs index 23aec916d6..d3d2f857a1 100644 --- a/devices/src/pci/ac97_bus_master.rs +++ b/devices/src/pci/ac97_bus_master.rs @@ -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.