diff --git a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c index 52daf042a8b6fca2a322ed048ce09159db554e5c..7ab103f8851b2b11ea6e45bac09fcd97a7ded36a 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c +++ b/drivers/mxc/gpu-viv/hal/kernel/arch/gc_hal_kernel_hardware.c @@ -8156,6 +8156,23 @@ _PmStallCommand( { /* Wait to finish all commands. */ status = gckCOMMAND_Stall(Command, gcvTRUE); + + if (!gcmIS_SUCCESS(status)) + { + goto OnError; + } + + for (;;) + { + gcmkONERROR(gckHARDWARE_QueryIdle(Hardware, &idle)); + + if (idle) + { + break; + } + + gcmkVERIFY_OK(gckOS_Delay(Hardware->os, 1)); + } } OnError: @@ -9021,16 +9038,24 @@ gckHARDWARE_SetFscaleValue( gceSTATUS status; gctUINT32 clock; gctBOOL acquired = gcvFALSE; - + gctBOOL commitMutexAcquired = gcvFALSE; gcmkHEADER_ARG("Hardware=0x%x FscaleValue=%d", Hardware, FscaleValue); gcmkVERIFY_ARGUMENT(FscaleValue > 0 && FscaleValue <= 64); + gcmkONERROR(gckOS_AcquireMutex(Hardware->kernel->os, + Hardware->kernel->device->commitMutex, + gcvINFINITE + )); + + commitMutexAcquired = gcvTRUE; + + gcmkONERROR(gckCOMMAND_Stall(Hardware->kernel->command, gcvFALSE)); + gcmkONERROR( gckOS_AcquireMutex(Hardware->os, Hardware->powerMutex, gcvINFINITE)); acquired = gcvTRUE; - gcmkONERROR(gckCOMMAND_Stall(Hardware->kernel->command, gcvFALSE)); Hardware->kernel->timeOut = Hardware->kernel->timeOut * Hardware->powerOnFscaleVal / 64; @@ -9305,6 +9330,9 @@ gckHARDWARE_SetFscaleValue( } gcmkVERIFY(gckOS_ReleaseMutex(Hardware->os, Hardware->powerMutex)); + acquired = gcvFALSE; + gcmkONERROR(gckOS_ReleaseMutex(Hardware->kernel->os, Hardware->kernel->device->commitMutex)); + commitMutexAcquired = gcvFALSE; gcmkFOOTER_NO(); return gcvSTATUS_OK; @@ -9314,7 +9342,10 @@ OnError: { gcmkVERIFY(gckOS_ReleaseMutex(Hardware->os, Hardware->powerMutex)); } - + if (commitMutexAcquired) + { + gcmkONERROR(gckOS_ReleaseMutex(Hardware->kernel->os, Hardware->kernel->device->commitMutex)); +} gcmkFOOTER(); return status; } diff --git a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c index 115c283490ef866ed03ee7beb28615526131fd63..fbc75fcc6624e19841c55edde5ed620ab491262c 100644 --- a/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c +++ b/drivers/mxc/gpu-viv/hal/kernel/gc_hal_kernel_command.c @@ -3937,7 +3937,6 @@ gckCOMMAND_Stall( gceSTATUS status; gctSIGNAL signal = gcvNULL; gctUINT timer = 0; - gctBOOL idle = gcvFALSE; gcmkHEADER_ARG("Command=%p", Command); @@ -4020,19 +4019,6 @@ gckCOMMAND_Stall( /* Delete the signal. */ gcmkVERIFY_OK(gckOS_DestroySignal(os, signal)); - /* Wait for the idle state. */ - for (;;) - { - gcmkONERROR(gckHARDWARE_QueryIdle(hardware, &idle)); - - if (idle) - { - break; - } - - gcmkVERIFY_OK(gckOS_Delay(os, 1)); - } - /* Success. */ gcmkFOOTER_NO(); return gcvSTATUS_OK;