Example #1
0
mali_bool power_test_check()
{
	if( power_test_flag )
	{
		_mali_uk_pmm_message_s event = {
					NULL,
					0,
					1 };
		event.id = power_test_event;

		power_test_flag = MALI_FALSE;

		/* Send event */
		_mali_ukk_pmm_event_message( &event );

		/* Switch to next event to test */
		if( power_test_event == MALI_PMM_EVENT_OS_POWER_DOWN )
		{
			power_test_event = MALI_PMM_EVENT_OS_POWER_UP;
		}
		else
		{
			power_test_event = MALI_PMM_EVENT_OS_POWER_DOWN;
		}
		_mali_osk_timer_add( power_test_timer, 5000 );
		
		return MALI_TRUE;
	}
	
	return MALI_FALSE;
}
Example #2
0
void malipmm_core_power_down_okay( mali_pmm_core_id core )
{
	_mali_uk_pmm_message_s event = {
		NULL,
		MALI_PMM_EVENT_INTERNAL_POWER_DOWN_ACK,
		0 };

	event.data = core;

	_mali_ukk_pmm_event_message( &event );
}
Example #3
0
/** This function is invoked when mali device is suspended
 */
int mali_device_suspend(unsigned int event_id, struct task_struct **pwr_mgmt_thread)
{
	int err = 0;	
	_mali_uk_pmm_message_s event = {
	                               NULL,
	                               event_id,
	                               timeout_fired};
	*pwr_mgmt_thread = current;
	MALI_DEBUG_PRINT(4, ("OSPMM: MALI device is being suspended\n" ));
	_mali_ukk_pmm_event_message(&event);
	is_os_pmm_thread_waiting = 1;
	err = mali_wait_for_power_management_policy_event();
	is_os_pmm_thread_waiting = 0;
	return err;
}
Example #4
0
mali_bool pmm_invoke_power_up( _mali_pmm_internal_state_t *pmm )
{
	_mali_osk_errcode_t err;

	MALI_DEBUG_ASSERT_POINTER(pmm);

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

	if( pmm_power_up_okay( pmm ) )
	{
		/* Power up has completed - sort out subsystem core status */
		
		int n;
		/* Use volatile to access, so that it is updated if any cores are unregistered */
		volatile mali_pmm_core_mask *ppendup = &(pmm->cores_pend_up);
#if MALI_PMM_TRACE
		mali_pmm_core_mask old_power = pmm->cores_powered;
#endif
		/* Move cores into idle queues */
		for( n = 0; n < SIZEOF_CORES_LIST; n++ )
		{
			if( (cores_list[n] & (*ppendup)) != 0 )
			{
				/* Can't hold the power lock, when acessing subsystem mutex via
				 * the core power call.
				 * Due to terminatation of driver requiring a subsystem mutex
				 * and then power lock held to unregister a core.
				 * This does mean that the following function could fail
				 * as the core is unregistered before we tell it to power
				 * up, but it does not matter as we are terminating
				 */
				MALI_PMM_UNLOCK(pmm);
				err = mali_core_signal_power_up( cores_list[n], MALI_FALSE );
				MALI_PMM_LOCK(pmm);

				if( err != _MALI_OSK_ERR_OK )
				{
					MALI_DEBUG_ASSERT( (err == _MALI_OSK_ERR_FAULT &&
										(*ppendup & cores_list[n]) == 0) );
					/* We only expect this to fail when we are shutting down 
					 * and the core has been unregistered
					 */
				}
			}
		}
		/* Finished power up - add cores to idle and powered list */
		pmm->cores_powered |= (*ppendup);
		pmm->cores_idle |= (*ppendup);
		/* Reset pending/acknowledge status */
		pmm->cores_pend_up = 0;
		pmm->cores_ack_up = 0;

#if MALI_PMM_TRACE
		_mali_pmm_trace_hardware_change( old_power, pmm->cores_powered );
#endif
		return MALI_TRUE;
	}
	else
	{
#if !MALI_PMM_NO_PMU
		/* Power up must now be done */
		err = mali_platform_powerup( pmm->cores_pend_up );
#else
		err = _MALI_OSK_ERR_OK;
#endif
		if( err != _MALI_OSK_ERR_OK )
		{
			MALI_PRINT_ERROR( ("PMM: Failed to get PMU to power up cores - (0x%x) %s", 
					pmm->cores_pend_up, pmm_trace_get_core_name(pmm->cores_pend_up)) );
			pmm->fatal_power_err = MALI_TRUE;
		}
		else
		{
			/* TBD - Update core status immediately rather than use event message */
			_mali_uk_pmm_message_s event = {
				NULL,
				MALI_PMM_EVENT_INTERNAL_POWER_UP_ACK,
				0 };
			/* All the cores that were pending power up, have now completed power up */
			event.data = pmm->cores_pend_up;
			_mali_ukk_pmm_event_message( &event );
			MALIPMM_DEBUG_PRINT( ("PMM: Sending ACK to power up") );
		}
	}

	/* Always return false, as we need an interrupt to acknowledge
	 * when power up is complete
	 */
	return MALI_FALSE;
}