lib/sw_apps/zynqmp_pmufw/src/pm_slave.c
static s32 PmConstrainStateByLatency(const PmSlave* const slave,
				     PmStateId* const state,
				     const u32 capsToSet,
				     const u32 minLatency)
{
	s32 status = XST_PM_CONFLICT;
	PmStateId startState = *state;
	u32 wkupLat, i;

	for (i = startState; i < slave->slvFsm->statesCnt; i++) {
		if ((capsToSet & slave->slvFsm->states[i]) != capsToSet) {
			/* State candidate has no required capabilities */
			continue;
		}
		wkupLat = PmGetLatencyFromState(slave, (PmStateId)i);
		if (wkupLat > minLatency) {
			/* State does not satisfy latency requirement */
			continue;
		}

		status = XST_SUCCESS;
		*state = (PmStateId)i;
		break;
	}

	return status;
}
/**
 * PmConstrainStateByLatency() - Find a higher power state which satisfies
 *                               latency requirements
 * @slave       Slave whose state may be constrained
 * @state       Chosen state which does not satisfy latency requirements
 * @capsToSet   Capabilities that the state must have
 * @minLatency  Latency requirements to be satisfied
 *
 * @return      Status showing whether the higher power state is found or not.
 *              State may not be found if multiple masters have contradicting
 *              requirements, then XST_PM_CONFLICT is returned. Otherwise,
 *              function returns success.
 */
Find a higher power state which satisfies
latency requirements
@slave       Slave whose state may be constrained
@state       Chosen state which does not satisfy latency requirements
@capsToSet   Capabilities that the state must have
@minLatency  Latency requirements to be satisfied

@return      Status showing whether the higher power state is found or not.
State may not be found if multiple masters have contradicting
requirements, then XST_PM_CONFLICT is returned. Otherwise,
function returns success.
Find a higher power state which satisfies latency requirements @slave Slave whose state may be constrained @state Chosen state which does not satisfy latency requirements @capsToSet Capabilities that the state must have @minLatency Latency requirements to be satisfied @return Status showing whether the higher power state is found or not . State may not be found if multiple masters have contradicting requirements then XST_PM_CONFLICT is returned . Otherwise function returns success .
static s32 PmConstrainStateByLatency(const PmSlave* const slave,
				     PmStateId* const state,
				     const u32 capsToSet,
				     const u32 minLatency)
{
	s32 status = XST_PM_CONFLICT;
	PmStateId startState = *state;
	u32 wkupLat, i;
	for (i = startState; i < slave->slvFsm->statesCnt; i++) {
		if ((capsToSet & slave->slvFsm->states[i]) != capsToSet) {
			continue;
		}
		wkupLat = PmGetLatencyFromState(slave, (PmStateId)i);
		if (wkupLat > minLatency) {
			continue;
		}
		status = XST_SUCCESS;
		*state = (PmStateId)i;
		break;
	}
	return status;
}
static s32 PmConstrainStateByLatency ( const PmSlave * const slave , PmStateId * const state , const u32 capsToSet , const u32 minLatency ) { s32 status = XST_PM_CONFLICT ; PmStateId startState = * state ; u32 wkupLat , i ; for ( i = startState ; i < slave -> slvFsm -> statesCnt ; i ++ ) { if ( ( capsToSet & slave -> slvFsm -> states [ i ] ) != capsToSet ) { continue ; } wkupLat = PmGetLatencyFromState ( slave , ( PmStateId ) i ) ; if ( wkupLat > minLatency ) { continue ; } status = XST_SUCCESS ; * state = ( PmStateId ) i ; break ; } return status ; }
PmConstrainStateByLatency() - Find a higher power state which satisfies
                               latency requirements
 @slave       Slave whose state may be constrained
 @state       Chosen state which does not satisfy latency requirements
 @capsToSet   Capabilities that the state must have
 @minLatency  Latency requirements to be satisfied
PmConstrainStateByLatency () - Find a higher power state which satisfies latency requirements @slave Slave whose state may be constrained @state Chosen state which does not satisfy latency requirements @capsToSet Capabilities that the state must have @minLatency Latency requirements to be satisfied
/* State candidate has no required capabilities */ /* State does not satisfy latency requirement */