There is a small chip, usually on the motherboard, that regulates power coming into the device. This chip takes the power and directs it to the battery and other components. It also has the responsibility of regulating power to the battery so it doesn’t get overcharged.