msm: vidc: flush work handler before unloading firmware

In case if the spurious interrupts is handled, while the
poweroff is done at the time of unloading firmware, can
create crashes in iommu_attach_device. So, the
core work handler need to be flushed before doing
power off and unloading the venus firmware.

Change-Id: I6a9c5911da855c6d530fd4683a3d9ebebb45c1b0
Signed-off-by: Balamurugan Alagarsamy <balaga@codeaurora.org>
This commit is contained in:
Balamurugan Alagarsamy
2015-07-10 12:04:17 +05:30
parent 90cee04c60
commit 280427a6a7
@@ -2144,11 +2144,23 @@ static void venus_hfi_core_clear_interrupt(struct venus_hfi_device *device)
u32 intr_status = 0;
int rc = 0;
if (!device) {
dprintk(VIDC_ERR, "%s Invalid paramter: %p\n",
__func__, device);
return;
}
if (!device->callback)
return;
mutex_lock(&device->write_lock);
mutex_lock(&device->clk_pwr_lock);
if (device->state == VENUS_STATE_DEINIT) {
dprintk(VIDC_DBG, "SPURIOUS_INTR for device: 0x%x: "
"times: %d interrupt_status: %d",
(u32) device, ++device->spur_count, intr_status);
goto err_clk_gating_off;
}
rc = venus_hfi_clk_gating_off(device);
if (rc) {
dprintk(VIDC_ERR,
@@ -3749,6 +3761,7 @@ static void venus_hfi_unload_fw(void *dev)
return;
}
if (device->resources.fw.cookie) {
flush_workqueue(device->vidc_workq);
flush_workqueue(device->venus_pm_workq);
subsystem_put(device->resources.fw.cookie);
venus_hfi_interface_queues_release(dev);