You could have a look in the open source repo
https://github.com/spark/firmware/blob/develop/wiring/inc/spark_wiring_power.h
https://github.com/spark/firmware/blob/develop/wiring/src/spark_wiring_power.cpp
In the header file are some comments about the registers and the .cpp
does tell you about how they do it.