summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c17
-rw-r--r--drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c12
2 files changed, 28 insertions, 1 deletions
diff --git a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c
index 64929350f567..2d7f629e28d8 100644
--- a/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c
+++ b/drivers/mxc/gpu-viv/arch/XAQ2/hal/kernel/gc_hal_kernel_hardware.c
@@ -3973,6 +3973,23 @@ gckHARDWARE_SetPowerManagementState(
** if lock holder call gckCOMMAND_Stall() */
gcmkONERROR(gcvSTATUS_INVALID_REQUEST);
}
+#if gcdPOWEROFF_TIMEOUT
+ else if(State == gcvPOWER_OFF && timeout == gcvTRUE)
+ {
+ /*
+ ** try to aqcuire the mutex with more milliseconds,
+ ** flush_delayed_work should be running with timeout,
+ ** so waiting here will cause deadlock */
+ status = gckOS_AcquireMutex(os, Hardware->powerMutex, gcdPOWEROFF_TIMEOUT);
+
+ if (status == gcvSTATUS_TIMEOUT)
+ {
+ gckOS_Print("GPU Timer deadlock, exit by timeout!!!!\n");
+
+ gcmkONERROR(gcvSTATUS_INVALID_REQUEST);
+ }
+ }
+#endif
else
{
/* Acquire the power mutex. */
diff --git a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
index 1afd1332eae5..b7717fca0ec6 100644
--- a/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
+++ b/drivers/mxc/gpu-viv/hal/os/linux/kernel/gc_hal_kernel_os.c
@@ -8432,7 +8432,17 @@ gckOS_StartTimer(
if (unlikely(delayed_work_pending(&timer->work)))
{
- cancel_delayed_work(&timer->work);
+ if (unlikely(!cancel_delayed_work(&timer->work)))
+ {
+ cancel_work_sync(&timer->work.work);
+
+ if (unlikely(delayed_work_pending(&timer->work)))
+ {
+ gckOS_Print("gckOS_StartTimer error, the pending worker cannot complete!!!! \n");
+
+ return gcvSTATUS_INVALID_REQUEST;
+ }
+ }
}
queue_delayed_work(Os->workqueue, &timer->work, msecs_to_jiffies(Delay));