UPSTREAM: ALSA: intel8x0: Fix breakage at ac97 clock measurement

The recent workaround for the wild interrupts in commit c1f0616124c4
("ALSA: intel8x0: Don't update period unless prepared") leaded to a
regression, causing the interrupt storm during ac97 clock measurement
at the driver probe.  We need to handle the interrupt while the clock
measurement as well as the proper PCM streams.

Fixes: c1f0616124c4 ("ALSA: intel8x0: Don't update period unless prepared")
Reported-and-tested-by: Max Filippov <jcmvbkbc@gmail.com>
Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Cc: <stable@vger.kernel.org>
Link: https://lore.kernel.org/r/CAMo8BfKKMQkcsbOQaeEjq_FsJhdK=fn598dvh7YOcZshUSOH=g@mail.gmail.com
Link: https://lore.kernel.org/r/20210708090738.1569-1-tiwai@suse.de
Signed-off-by: Takashi Iwai <tiwai@suse.de>
(cherry picked from commit 24d1e49415be546470b20429d748e240d0518b7e)

BUG=None
TEST=None

Signed-off-by: Linux Patches Robot <linux-patches-robot@chromeos-missing-patches.google.com.iam.gserviceaccount.com>
Change-Id: I551c2396eb5f180c35f71a0935f418a38f980856
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/3019614
Reviewed-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Reviewed-by: Guenter Roeck <groeck@chromium.org>
Tested-by: Sergey Senozhatsky <senozhatsky@chromium.org>
Auto-Submit: Sergey Senozhatsky <senozhatsky@chromium.org>
Commit-Queue: Guenter Roeck <groeck@chromium.org>
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 6fb6f36..3707dc2 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -715,7 +715,7 @@
 	int status, civ, i, step;
 	int ack = 0;
 
-	if (!ichdev->prepared || ichdev->suspended)
+	if (!(ichdev->prepared || chip->in_measurement) || ichdev->suspended)
 		return;
 
 	spin_lock_irqsave(&chip->reg_lock, flags);