How are laptop’s power states controlled by software?


On shutdown, an ATX PSU receives a shutdown command (by detecting that the PS_ON is released) on a desktop and cuts power to the motherboard. On a laptop, which part is responsible for cutting power to a laptop when it receives a shutdown command (or the battery dies)? How is this command sent?

In: 0

there’s a bit of code in the computer’s firmware called ”acpi”, **a**dvanced **c**onfiguration and **p**ower **i**nterface that has an open standard interface windows, linux, etc, communicate with and grab capabilities, states from and send command to.

grabbing capabilities includes asking the acpi if standby is available, if suspend to memory is available, if the os is allowed to power the machine off, etc.

sending commands and state requests to acpi is stuff like ”turn off now”, or ”sleep (suspend to memory)”.

on the other side of acpi is proprietary firmware that is specific to the vendor of the hardware and manufacturer of the chipset and cpu.

when your click ”shutdown”, your os:

– cleans up its own mess, closes open apps, saves unsaved data and similar housecleaning.

– then the os sends an acpi command to ”shut off now”

– the firmware implementing the acpi then does spooky proprietary magic that usually includes:
– telling the cpu to shut down
– telling the chipset to tell the drives to power down
– telling the chipset to turn off anything else it has to
– telling the power supply it can go to standby mode.
– note: the power supply in modern computers/laptops never completely turns off. there’s a small trickle of electricity powering a very, very small and simple cpu in the chipset waiting for a power on event like a button press or a magic network packet. this tiny cpu then starts the process of waking up or booting.

note: nearly every device in your computer has its own cpu/processor these days:

– your gpu has a very, very small arm, risc-v, or xtensa running some code to manage the power up sequence, control the fan, check for certain error conditions, and similar.

– your ssd/hdd have 1-3 tiny arm or risc-v cpus/cores in them managing the device and often rescheduling read or write requests to be more efficient

– your cpu has a small cpu in it… seriously.

– your chipset (intel calls it a pch) has a small cpu in it to help manage the zillion or so things it does.

– your mouse has a tiny cpu in it looking at what the optical sensor ”sees” and determining if it moved.

– your keyboard probably has a small cpu in it.

when you really think about it, you don’t have ***a*** computer or ***a*** laptop: your computer (or laptop) is a network of tiny computers attached to a big cpu, all sending messages to each other.

in the case of your original question, sometimes that message it ”go to sleep” or ”power off”

i hope this helps!