power.c — Power management
Power management: KCCB POW requests and the host power-sync handshake.
The host writes 0 to the power-sync word, sends POW and polls the word;
the firmware writes 1 only once the requested transition is complete.
-
PF_OFF_PENDING
Internal “pow flag”: a power-off is in progress (only printed in the trace).
-
PF_FORCED_IDLE
Internal “pow flag”: the GPU is held in forced idle.
-
PF_FORCED_REQ
Internal “pow flag”: the power-off was a forced request.
-
static uint32_t pow_flags
The
PF_*flags; they only appear in the trace.
-
void pow_set_state(uint32_t s)
Set the firmware power state.
The state is kept in
gand mirrored into the host-visiblesysdataonce that structure is known.- Parameters:
s – The new state, one of the
POW_STATE_*values.
-
static void power_sync_signal(void)
Complete the host power-sync handshake.
Writes 1 to the power-sync word named in
osdata(after a write barrier, so that the state written before it is visible first) and raises the host interrupt.
-
static void gpu_teardown(void)
Forget every piece of GPU state that a power-off loses.
Flushes the dynamic MIPS TLB mappings, clears the BIF catalogue slot table (
kick_init()), the parameter-manager context tracking (pm_invalidate()) and the SPM state (spm_reset()).
How long a forced-idle request waits for running tasks, in microseconds.
Wait until no data master runs a task, handling their completion events
(sched_poll()), for at most FORCED_IDLE_WAIT_US. New
tasks are not started meanwhile (g.forced_idle).
-
void pow_handle(const struct kccb_cmd *cmd)
Handle a KCCB
POWcommand.POW_FORCED_IDLE_REQwithPOWER_FORCE_IDLEorPOWER_HOST_TIMEOUTstops accepting work and runs the scheduler; any other argument cancels the forced idle.POW_OFF_REQtears the GPU state down, marks the firmware powered off and stops the polling timer interrupt until the next boot.POW_NUM_UNITS_CHANGE,POW_APM_LATENCY_CHANGEand anything else are acknowledged without action.
Every request ends with the power-sync handshake.
- Parameters:
cmd – The KCCB command;
cmd->data.powholds the request.