Here the schematics of the USB-C power input of the Pi 4 :
You can see that there is a resistor connected to the USB_CC lines of the USC-C socket, the other side is labelled PD_SENSE and is going into an analog input port of the MXL 7704 power management IC (AN1). This would enable the Pi to read the voltage of the CC line via the I2C bus of the power management IC.
What is the purpose of this, i.e. what is this used for ?
A few possible purposes I can think of, none of which make much sense to me :
The Pi 4 uses a passive power delivery, so it could read the advertised capability of the power supply (i.e 500 mA, 1.5 A or 3.0 A), but why would you want to do that ? It would likey not work with anything under 3.0 A anyway.
If the Pi 4 was powered over GPIO, this would read 0V, so you could find out, if the Pi is powered over USB-C or GPIO.
PD_SENSE is used for some unknown purpose, when the USB-C port is used as a USB 2 OTG port (not for power delivery)
Update, some more information :
From the link that tlfong01 has provided in the comments there are 6 different purposes the CC lines can be used for. Most of these do not apply in the case of the Pi 4 :
Detect attach of USB ports, e.g. a Source to a Sink
This is kind of pointless for power connection, because without a connected source the Pi would not work at all. It could be used to determine, if no cable is connected when power is delivered through the GPIO.
Resolve cable orientation and twist connections to establish USB data bus routing
This does not work on the Pi 4 due to the fact that the designers only used one pull-down resistor ( https://email@example.com/how-to-design-a-proper-usb-c-power-sink-hint-not-the-way-raspberry-pi-4-did-it-f470d7a5910 )
Establish data roles between two attached ports
The Pi4 SuperSpeed USB3 pins are not connected, so this cannot be the purpose
Again this does not work on the Pi 4, because of only one pull-down resistor being used.
Discover and configure VBUS
The Pi 4 could use this to determine the current levels (500mA, 1.5A, 3A) the power supply supports. Again, this is kind of pointless ?
Discover and configure optional Alternate and Accessory modes
Advanced USB PD comms is not supported by the Pi, the pin is only connected to an analog input.
So from the above I would conclude that the PD_SENSE on the Pi 4 could be used only for two things : Either to determine the capability of the power supply (i.e power supply can deliver 0.5 / 1.5 / 3.0 A) or to detect, if the Raspberry Pi is powered over GPIO, i.e. nothing is connected to the USB-C port.
I found out, that the I2C communication with the MXL 7704 PMIC is done by the closed-source Pi firmware ( Which Linux driver does control the PMIC of the Raspberry Pi 3B+? ), so I cannot investigate further there.
My original post question still stands, could someone confirm, what (if anything) the Pi 4 firmware is doing with PD_SENSE ?