Commit 2ce601125874bbf32498937495070f32951d5480
1 parent
406e94c21e
Exists in
smarc_8mm-imx_v2018.03_4.14.98_2.0.0_ga
and in
5 other branches
MLK-18289-1 tcpc: Update driver to support two ports logic
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)
Showing 2 changed files with 7 additions and 6 deletions Side-by-side Diff
board/freescale/common/tcpc.c
... | ... | @@ -14,8 +14,6 @@ |
14 | 14 | #define tcpc_debug_log(port, fmt, args...) |
15 | 15 | #endif |
16 | 16 | |
17 | -static bool tcpc_pd_sink_check_charging(struct tcpc_port *port); | |
18 | - | |
19 | 17 | static int tcpc_log(struct tcpc_port *port, const char *fmt, ...) |
20 | 18 | { |
21 | 19 | va_list args; |
... | ... | @@ -758,7 +756,7 @@ |
758 | 756 | } |
759 | 757 | } |
760 | 758 | |
761 | -static bool tcpc_pd_sink_check_charging(struct tcpc_port *port) | |
759 | +bool tcpc_pd_sink_check_charging(struct tcpc_port *port) | |
762 | 760 | { |
763 | 761 | uint8_t valb; |
764 | 762 | int err; |
765 | 763 | |
... | ... | @@ -939,10 +937,11 @@ |
939 | 937 | return -EIO; |
940 | 938 | } |
941 | 939 | |
942 | - tcpc_log(port, "TCPC: Vendor ID [0x%x], Product ID [0x%x]\n", vid, pid); | |
940 | + tcpc_log(port, "TCPC: Vendor ID [0x%x], Product ID [0x%x], Addr [I2C%u 0x%x]\n", | |
941 | + vid, pid, port->cfg.i2c_bus, port->cfg.addr); | |
943 | 942 | |
944 | - if (port->cfg.port_type == TYPEC_PORT_UFP | |
945 | - || port->cfg.port_type == TYPEC_PORT_DRP) | |
943 | + if (!port->cfg.disable_pd && (port->cfg.port_type == TYPEC_PORT_UFP | |
944 | + || port->cfg.port_type == TYPEC_PORT_DRP)) | |
946 | 945 | tcpc_pd_sink_init(port); |
947 | 946 | |
948 | 947 | tcpc_clear_alert(port, 0xffff); |
board/freescale/common/tcpc.h
... | ... | @@ -417,6 +417,7 @@ |
417 | 417 | uint32_t max_snk_ma; |
418 | 418 | uint32_t max_snk_mw; |
419 | 419 | uint32_t op_snk_mv; |
420 | + bool disable_pd; | |
420 | 421 | }; |
421 | 422 | |
422 | 423 | struct tcpc_port { |
... | ... | @@ -443,6 +444,7 @@ |
443 | 444 | int tcpc_setup_ufp_mode(struct tcpc_port *port); |
444 | 445 | int tcpc_disable_src_vbus(struct tcpc_port *port); |
445 | 446 | int tcpc_init(struct tcpc_port *port, struct tcpc_port_config config, ss_mux_sel ss_sel_func); |
447 | +bool tcpc_pd_sink_check_charging(struct tcpc_port *port); | |
446 | 448 | void tcpc_print_log(struct tcpc_port *port); |
447 | 449 | |
448 | 450 | #endif /* __TCPCI_H */ |