A process in chloroplasts and mitochondria in which the movement of protons down their concentration gradient across a membrane is coupled to the synthesis of ATP.