Exemplo n.º 1
0
mali_bool pmm_invoke_power_down( _mali_pmm_internal_state_t *pmm, mali_power_mode power_mode )
{
	_mali_osk_errcode_t err;
	MALI_DEBUG_ASSERT_POINTER(pmm);

	/* Check that cores are pending power down during power down invoke */
	MALI_DEBUG_ASSERT( pmm->cores_pend_down != 0 );
	/* Check that cores are not pending power up during power down invoke */
	MALI_DEBUG_ASSERT( pmm->cores_pend_up == 0 );

	if( !pmm_power_down_okay( pmm ) )
	{
		MALIPMM_DEBUG_PRINT( ("PMM: Waiting for cores to go idle for power off - 0x%08x / 0x%08x\n", 
				pmm->cores_pend_down, pmm->cores_ack_down) );
		return MALI_FALSE;
	}
	else
	{
		pmm->cores_powered &= ~(pmm->cores_pend_down);
#if !MALI_PMM_NO_PMU
		err = malipmm_powerdown( pmm->cores_pend_down, power_mode);
#else
		err = _MALI_OSK_ERR_OK;
#endif
		
		if( err == _MALI_OSK_ERR_OK )
		{
#if MALI_PMM_TRACE
			mali_pmm_core_mask old_power = pmm->cores_powered;
#endif
			/* Remove powered down cores from idle and powered list */
			pmm->cores_idle &= ~(pmm->cores_pend_down);
			/* Reset pending/acknowledged status */
			pmm->cores_pend_down = 0;
			pmm->cores_ack_down = 0;
#if MALI_PMM_TRACE
			_mali_pmm_trace_hardware_change( old_power, pmm->cores_powered );
#endif
		}
		else
		{
			pmm->cores_powered |= pmm->cores_pend_down;
			MALI_PRINT_ERROR( ("PMM: Failed to get PMU to power down cores - (0x%x) %s", 
					pmm->cores_pend_down, pmm_trace_get_core_name(pmm->cores_pend_down)) );
			pmm->fatal_power_err = MALI_TRUE;
		}
	}

	return MALI_TRUE;
}
Exemplo n.º 2
0
void malipmm_kernel_subsystem_terminate( mali_kernel_subsystem_identifier id )
{
	/* Check this is the right system */
	MALI_DEBUG_ASSERT( id == mali_subsystem_pmm_id );
	MALI_DEBUG_ASSERT_POINTER(pmm_state);

	if( pmm_state )
	{
#if PMM_OS_TEST
		power_test_end();
#endif
		/* Get the lock so we can shutdown */
		MALI_PMM_LOCK(pmm_state);
#if MALI_STATE_TRACKING
		pmm_state->mali_pmm_lock_acquired = 1;
#endif /* MALI_STATE_TRACKING */
		pmm_state->status = MALI_PMM_STATUS_OFF;
#if MALI_STATE_TRACKING
		pmm_state->mali_pmm_lock_acquired = 0;
#endif /* MALI_STATE_TRACKING */
		MALI_PMM_UNLOCK(pmm_state);
		_mali_osk_pmm_ospmm_cleanup();
		pmm_policy_term(pmm_state);
		_mali_osk_irq_term( pmm_state->irq );
		_mali_osk_notification_queue_term( pmm_state->queue );
		_mali_osk_notification_queue_term( pmm_state->iqueue );
		if (pmm_state->cores_registered) malipmm_powerdown(pmm_state->cores_registered,MALI_POWER_MODE_LIGHT_SLEEP);
#if USING_MALI_PMU
		if( pmm_state->pmu_initialized )
		{
			_mali_osk_resource_type_t t = PMU;
			mali_pmm_pmu_deinit(&t);
		}
#endif /* USING_MALI_PMU */

		_mali_osk_atomic_term( &(pmm_state->messages_queued) );
		MALI_PMM_LOCK_TERM(pmm_state);
		_mali_osk_free(pmm_state);
		pmm_state = NULL; 
	}

	MALIPMM_DEBUG_PRINT( ("PMM: subsystem terminated\n") );
}