Question about Leonardo 5V Auto Selector

Hello! I have this problem with Leonardo 5V Auto Selector circuit :slight_smile:
You can see its schematic below…

When you look at this 5V auto selector part, it uses a FDN340P, which is a P-MOSFET, I believe when there is no output from LMV358 the MOSFET should be set On, so the power from USB port could get through it to the voltage regulator, which give a 3.3V output. But strange thing is, the VUSB port is connected to its D(Drain), from the experience making H-bridges for my robot I know the circuit should come from S(Source) to D(Drain), thus I think VUSB port should be connected to S(Source)

I looked into the PCB file in Eagle too, just to find VUSB port is connected to D, on that P-MOSFET, which confused me a lot, someone can help me get this confusion out of my mind o.O

Thaanks in advance && Cheers!

Think of it like this:
The design takes advantage of the P-MOSFET’s internal diode - when Vin/2 is < 3.3V, the gate is Low, the MOSFET is “Open” for current flow, and VUSB flows thru to drive 5V; Vin to the regulator is too low to make 5V regulated output.
When Vin/2 is >3.3v, the gate is High, the MOSFET is “Closed” for current flow, 5V would reverse bias the MOSFET internal diode and keep VUSB isolated from the 5V line.