According to chemiosmotic hypothesis, ATP synthase produce ATP when protons (H+):
Move from stroma to thylakoid lumen by simple diffusion
Move from stroma to thylakoid lumen by facilitated diffusion
Move from thylakoid lumen to stroma by active transport
Move from thylakoid lumen to stroma by facilitated diffusion
Two protons moving along concentration gradient synthesize 1 ATP through coupling factor.