Introduce a callback function to setup external PD switch. When PD
process is enabled, we call this function only when SINK_VBUS is enabled
to avoid system power shut down.
When PD process is disabled, since the tcpc and external PD switch may
still in dead battery mode, set them to exit dead battery.
This patch is used to fix two issues on iMX8MM EVK:
1. When power on the board, by default the PTN5110 and NX20P3483 will
enter dead battery mode. But for some cases, like timing issue for PTN5110
and NX20P3483 (refer rework instructions CQ6), and when dual port are plugin
power sources. There are possibility the PTN5110 does not enter dead battery mode,
but NX20P3483 is in dead battery. So for the USB2 primary power port, we has to check
SINK_VBUS before NX20P3483 exits dead battery, otherwise the system power will shut down
2. For the USB1 port, when dual port are plugin power sources. We need to set both
PTN5110 and NX20P3483 exit dead battery. Otherwise this port can't work for normal
host/device mode.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 30004c6b35a5f0b8460f534d324f9bde01325373)
On iMX8MM EVK, there are two USB ports. Both can support USB PD, but
with USB2 has HW priority.
So we Change tcpc_pd_sink_check_charging to public function and
use it to know whether the USB tcpc is power charging.
Additional, add disable_pd to init config. So we can disable PD session
for uncharged or lower priority port.
Signed-off-by: Ye Li <ye.li@nxp.com>
(cherry picked from commit 867b0263d60bb5385b09cfa21d6f620bea855075)
Add an simple driver for USB typec port controller in freescale common codes.
The functionalities in this driver include:
1. Support to set UFP mode, when running as device mode, the
board level codes can use it to configure the TCPC port to UFP mode.
2. Support to set DFP mode for USB host.
3. Support PD charge with setup PD connection and send/receive PD messages
to negotiate a proper voltage and current.
4. Support power source with 2 stages of capability. Some power delivery source
send the source capability by 2 stages: 1st stage send the source capability
message with only basic 5V PDO, after the 5V power session setup, 2nd stage
it will send full source capabilities with all PDOs it can support, in this
case, we should go on to process the following PD source cap to have a new
power session setup.
Signed-off-by: Li Jun <jun.li@nxp.com>
Signed-off-by: Ye Li <ye.li@nxp.com>