Esempio n. 1
0
/* Correct target state based on inactivity timer expiry, etc */
static void adjust_target_states(struct system_power_state *target_state)
{
	switch (target_state->mpu_state) {
	case PRCM_MPU_ACTIVE:
	case PRCM_MPU_INACTIVE:
		target_state->neon_state = PRCM_ON;
		break;
	case PRCM_MPU_CSWR_L2RET:
	case PRCM_MPU_OSWR_L2RET:
	case PRCM_MPU_CSWR_L2OFF:
	case PRCM_MPU_OSWR_L2OFF:
		target_state->neon_state = PRCM_RET;
		break;
	case PRCM_MPU_OFF:
		target_state->neon_state = PRCM_OFF;
		if (!enable_off) {
			target_state->mpu_state  = PRCM_MPU_CSWR_L2RET;
			target_state->neon_state = PRCM_RET;
		}
		break;
	}


	if (target_state->core_state > PRCM_CORE_INACTIVE) {
#ifdef CONFIG_OMAP34XX_OFFMODE
#if 0
/* GPT context save in PER domain not yet implemented. Until it is, we do not
 * put PER to OFF.
 */
		/* Core can be put to RET/OFF - This means PER can be put to
		 * off if its inactivity timer has expired.
		 */
		if (perdomain_timer_pending())
			target_state->per_state = PRCM_RET;
		else
			target_state->per_state = PRCM_OFF;
#else
		target_state->per_state = PRCM_RET;
#endif

		if (target_state->core_state == PRCM_CORE_OFF) {
			if (coredomain_timer_pending())
				target_state->core_state = PRCM_CORE_CSWR_MEMRET;
			if (CM_FCLKEN_DSS & DSS_FCLK_MASK)
				target_state->core_state = PRCM_CORE_CSWR_MEMRET;
			if (!enable_off) {
				target_state->core_state = PRCM_CORE_CSWR_MEMRET;
				target_state->per_state  = PRCM_RET;
			}
		}
#else
		target_state->per_state = PRCM_RET;
#endif
	} else
		target_state->per_state = PRCM_ON;

	if (target_state->core_state == PRCM_CORE_CSWR_MEMRET)
		memory_logic_res_setting(target_state);
}
/* Correct target state based on inactivity timer expiry, etc */
static void correct_target_state(void)
{
	switch (target_state.mpu_state) {
	case PRCM_MPU_ACTIVE:
	case PRCM_MPU_INACTIVE:
		target_state.neon_state = PRCM_ON;
		break;
	case PRCM_MPU_CSWR_L2RET:
	case PRCM_MPU_OSWR_L2RET:
	case PRCM_MPU_CSWR_L2OFF:
	case PRCM_MPU_OSWR_L2OFF:
		target_state.neon_state = PRCM_RET;
		break;
	case PRCM_MPU_OFF:
		target_state.neon_state = PRCM_OFF;
		if (!enable_off) {
			target_state.mpu_state = PRCM_MPU_CSWR_L2RET;
			target_state.neon_state = PRCM_RET;
		}
		break;
	}

	if (target_state.core_state > PRCM_CORE_INACTIVE) {
#ifdef CONFIG_OMAP34XX_OFFMODE
		/* Core can be put to RET/OFF - This means
		 * PER can be put to off if its inactivity timer
		 * has expired
		 */
		if (perdomain_timer_pending())
			target_state.per_state = PRCM_RET;
		else
			target_state.per_state = PRCM_OFF;

		if (target_state.core_state == PRCM_CORE_OFF) {
			if (coredomain_timer_pending())
				target_state.core_state = PRCM_CORE_CSWR_MEMRET;
			if (CM_FCLKEN_DSS & DSS_FCLK_MASK)
				target_state.core_state = PRCM_CORE_CSWR_MEMRET;
			if (!enable_off) {
				target_state.core_state = PRCM_CORE_CSWR_MEMRET;
				target_state.per_state = PRCM_RET;
			}
		}
#else
		target_state.per_state = PRCM_RET;
#endif /* #ifdef CONFIG_OMAP34XX_OFFMODE */
	} else
		target_state.per_state = PRCM_ON;
}