Power

The power manager service controls the top level power state of the device. It is responsible for controlling the following functions:

  • System reboot and shutdown control

  • Opportunistic suspend

  • Scheduled reboots

  • Negotiating the suspend and shutdown sequence between the system and various services

Opportunistic suspend

To reduce power consumption the system will enter suspend as frequently as possible, if the system needs to perform work it should request power during that work.

There is a special pin in the harness called ONSW which can also be used to prevent the system from going into suspend.

The system can be woken up through various means, such as CAN, Digital I/O, Modem Data, RTC and of course the ONSW.

Scheduled reboots

If the device needs to do a scheduled reboot the guest system will be informed via the power_reboot_pending_publish_ind IPC message. This message will arrive with good margins (hours in advance) to allow the guest system to prepare and reboot voluntarily.

Note that the power_reboot_pending_publish_ind IPC message will not arrive for regular reboots.

If this message is ignored the device will eventually force a reboot.

hide footbox
skinparam ParticipantPadding 20
skinparam BoxPadding 10

box "User VM" #White
actor "User Code" as UserCode
participant "User System" as UserSystem
end box

box "ACU6 Base System" #White
participant "Power Service" as PowerService
participant "Base System" as BaseSystem
end box

group Initialize
UserCode -> PowerService : ipc_msg_power_reboot_pending_subscripe_req
PowerService -> UserCode : ipc_msg_power_reboot_pending_subscripe_rsp
end

group Scheduled reboot
PowerService -> UserCode : ipc_msg_power_reboot_pending_publish_ind
UserCode -> UserSystem : Synchronize state for reboot
UserCode -> PowerService : ipc_msg_power_shutdown_reboot_req_norsp
PowerService -> BaseSystem : reboot
end

hide footbox
skinparam ParticipantPadding 20
skinparam BoxPadding 10

box "User VM" #White
actor "User Code" as UserCode
end box

box "ACU6 Base System" #White
participant "Power Service" as PowerService
participant "Base System" as BaseSystem
end box

group Initialize
UserCode -> PowerService : ipc_msg_power_reboot_pending_subscripe_req
PowerService -> UserCode : ipc_msg_power_reboot_pending_subscripe_rsp
end

group Scheduled reboot
PowerService -> UserCode : ipc_msg_power_reboot_pending_publish_ind
PowerService -> UserCode : ipc_msg_power_reboot_pending_publish_ind
PowerService -> UserCode : ipc_msg_power_reboot_pending_publish_ind
PowerService -> UserCode : ipc_msg_power_reboot_pending_publish_ind
PowerService -> UserCode : ipc_msg_power_reboot_pending_publish_ind
PowerService -> BaseSystem : reboot
end

Suspend and shutdown interest

Services that need to perform actions on suspend or shutdown should register interest. Registering interest allows the services to acknowledge when they are ready for the suspend or shutdown to take place. The shutdown interest also applies to reboots.

This is separate from subscribing to the events themselves, it’s still required to register to the indications.

Note that the system may continue running for a brief period after the acknowledgement has been sent if other parts of the system also registered interest and aren’t ready yet.

It’s possible to subscribe without registering interest to get the notifications for e.g. logging purposes.

hide footbox
skinparam ParticipantPadding 20
skinparam BoxPadding 10

box "User VM" #White
actor "User Code" as UserCode
participant "User System" as UserSystem
end box

box "ACU6 Base System" #White
participant "Power Service" as PowerService
participant "Base System" as BaseSystem
end box

queue "Wakeup source" as WakeupSource

group Initialize
UserCode -> PowerService : ipc_msg_power_shutdown_subscribe_req
PowerService -> UserCode : ipc_msg_power_shutdown_subscribe_rsp
UserCode -> PowerService : ipc_msg_power_shutdown_register_req
PowerService -> UserCode : ipc_msg_power_shutdown_register_rsp
UserCode -> PowerService : ipc_msg_power_suspend_subscribe_req
PowerService -> UserCode : ipc_msg_power_suspend_subscribe_rsp
UserCode -> PowerService : ipc_msg_power_suspend_register_req
PowerService -> UserCode : ipc_msg_power_suspend_register_rsp
end

group Suspend Ack
PowerService -> UserCode : ipc_msg_power_suspend_publish_ind
UserCode -> UserSystem : Synchronize state for suspend
UserCode -> PowerService : ipc_msg_power_suspend_ack_req_norsp
PowerService -> BaseSystem : Suspend
end

WakeupSource -> BaseSystem : Wakeup

group Shutdown Ack
UserCode -> PowerService : ipc_msg_power_shutdown_shutdown_req_norsp
PowerService -> UserCode : ipc_msg_power_shutdown_publish_ind
UserCode -> UserSystem : Synchronize state for shutdown
UserCode -> PowerService : ipc_msg_power_shutdown_ack_req_norsp
PowerService -> BaseSystem : Shutdown
end

WakeupSource -> BaseSystem : Boot

group Reboot with Shutdown Ack
UserCode -> PowerService : ipc_msg_power_shutdown_reboot_req_norsp
PowerService -> UserCode : ipc_msg_power_shutdown_publish_ind
UserCode -> UserSystem : Synchronize state for reboot
UserCode -> PowerService : ipc_msg_power_shutdown_ack_req_norsp
PowerService -> BaseSystem : Reboot
end

Power API Reference