TX2 NX survive power failure als long as possible on battery mode

My TX2 NX is powered by an external power supply. In case of a power supply failure, I want to switch the TX2 NX to a power-saving mode to extend the battery life. The idea is to turn of CPU cores and reduce the clock frequency. If a power failure gets detected, I get an external signal (GPIO) from my hardware.

Does there exist some processor features which can be used for that?

How could I turn off CPU cores and change clock frequencies in a kernel module? I would like to change the operating mode like nvpmodel in userspace. I want to do it in kernel space because it should be faster there, resulting in longer battery life.