The potential energy required to drive the enzyme to phosphorylate ADP comes from the flow of protons down an electrochemical gradient from one side of the membrane to the other by facilitated diffusion, this is chemiosmosis.
High-energy electrons are delivered to the chain, powering a proton pump to pump the H+ ions through to the membrane-bound space (inter-membrane space or thylakoid space) from the matrix or stroma.
Electron carrier molecules shuttle these electrons to the next proton pump in the chain, resulting in a build up of protons on one side of the membrane making an electrochemical gradient.
In mitochondria, the proton pumps on the inner mitochondrial membrane are powered by high energy electrons from the hydrogen and pump protons into the intermembrane space where an electrochemical gradient is formed.
Electrons are excited by photons of light and passed along an electron transport chain, powering proton pumps to pump protons across the membrane into the thylakoid space.
The stalked particles are ATP synthetase and protons flow from inside the thylakoid back out into the stroma through this enzyme phosphorylating ADP to ATP.
In both mitochondria and chloroplasts, the phosphorylation process generally involves an electron transport chain providing the energy for the creation of an electrochemical gradient that drives ATP synthetase to create ATP due to chemiosmosis.