audio:sst: Flush message reply wq before allowing runtime suspend to exit
authorSamu Onkalo <samu.onkalo@intel.com>
Thu, 17 May 2012 10:34:08 +0000 (13:34 +0300)
committerbuildbot <buildbot@intel.com>
Mon, 21 May 2012 10:56:38 +0000 (03:56 -0700)
BZ: 32221

Audio IPC message processing happens in a workqueue while the runtime
suspend in running in different context. There is a race condition
between those. Sometimes runtime suspend turns the audio sub system off
before the message workqueue is finished. At the end of the
message handling there are writes to audio sub system registers.

Flush the message handling workqueues before leaving the runtime_suspend
call. This guarantees that the other activity is properly finished.

Change-Id: I1612fb3206a186b0877f0c8dc94bf0ee40c9dfe5
Signed-off-by: Samu Onkalo <samu.onkalo@intel.com>
Signed-off-by: Ramesh Babu K V <ramesh.babu@intel.com>
Reviewed-on: http://android.intel.com:8080/49229
Reviewed-by: Koskinen, Ilkka <ilkka.koskinen@intel.com>
Reviewed-by: Koul, Vinod <vinod.koul@intel.com>
Reviewed-by: Gupta, ArvindX K <arvindx.k.gupta@intel.com>
Reviewed-by: Hibare, PramodX <pramodx.hibare@intel.com>
Tested-by: Hibare, PramodX <pramodx.hibare@intel.com>
Reviewed-by: buildbot <buildbot@intel.com>
Tested-by: buildbot <buildbot@intel.com>
sound/soc/mid-x86/sst/intel_sst.c

index 997aa4d..bbd32b6 100644 (file)
@@ -598,6 +598,10 @@ static int intel_sst_runtime_suspend(struct device *dev)
        mutex_unlock(&sst_drv_ctx->sst_lock);
        if (sst_drv_ctx->pci_id == SST_CLV_PCI_ID)
                vibra_pwm_configure(false);
+
+       flush_workqueue(sst_drv_ctx->post_msg_wq);
+       flush_workqueue(sst_drv_ctx->process_msg_wq);
+       flush_workqueue(sst_drv_ctx->process_reply_wq);
        return 0;
 }