summaryrefslogtreecommitdiff
path: root/board
diff options
context:
space:
mode:
authorYe Li <ye.li@nxp.com>2018-04-22 23:13:28 -0700
committerYe Li <ye.li@nxp.com>2018-05-11 08:11:33 -0700
commit867b0263d60bb5385b09cfa21d6f620bea855075 (patch)
tree5e6f2ce145d6b9695228e6e809a5e86ad0a876f3 /board
parenta5dd1efd639e65e026b3175735329a3aaaaab7a0 (diff)
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>
Diffstat (limited to 'board')
-rw-r--r--board/freescale/common/tcpc.c11
-rw-r--r--board/freescale/common/tcpc.h2
2 files changed, 7 insertions, 6 deletions
diff --git a/board/freescale/common/tcpc.c b/board/freescale/common/tcpc.c
index b3f11f3b94..57d765ec0d 100644
--- a/board/freescale/common/tcpc.c
+++ b/board/freescale/common/tcpc.c
@@ -14,8 +14,6 @@
#define tcpc_debug_log(port, fmt, args...)
#endif
-static bool tcpc_pd_sink_check_charging(struct tcpc_port *port);
-
static int tcpc_log(struct tcpc_port *port, const char *fmt, ...)
{
va_list args;
@@ -758,7 +756,7 @@ static void tcpc_pd_sink_process(struct tcpc_port *port)
}
}
-static bool tcpc_pd_sink_check_charging(struct tcpc_port *port)
+bool tcpc_pd_sink_check_charging(struct tcpc_port *port)
{
uint8_t valb;
int err;
@@ -939,10 +937,11 @@ int tcpc_init(struct tcpc_port *port, struct tcpc_port_config config, ss_mux_sel
return -EIO;
}
- tcpc_log(port, "TCPC: Vendor ID [0x%x], Product ID [0x%x]\n", vid, pid);
+ tcpc_log(port, "TCPC: Vendor ID [0x%x], Product ID [0x%x], Addr [I2C%u 0x%x]\n",
+ vid, pid, port->cfg.i2c_bus, port->cfg.addr);
- if (port->cfg.port_type == TYPEC_PORT_UFP
- || port->cfg.port_type == TYPEC_PORT_DRP)
+ if (!port->cfg.disable_pd && (port->cfg.port_type == TYPEC_PORT_UFP
+ || port->cfg.port_type == TYPEC_PORT_DRP))
tcpc_pd_sink_init(port);
tcpc_clear_alert(port, 0xffff);
diff --git a/board/freescale/common/tcpc.h b/board/freescale/common/tcpc.h
index 43b5e49394..66002b42b7 100644
--- a/board/freescale/common/tcpc.h
+++ b/board/freescale/common/tcpc.h
@@ -417,6 +417,7 @@ struct tcpc_port_config {
uint32_t max_snk_ma;
uint32_t max_snk_mw;
uint32_t op_snk_mv;
+ bool disable_pd;
};
struct tcpc_port {
@@ -443,6 +444,7 @@ int tcpc_setup_dfp_mode(struct tcpc_port *port);
int tcpc_setup_ufp_mode(struct tcpc_port *port);
int tcpc_disable_src_vbus(struct tcpc_port *port);
int tcpc_init(struct tcpc_port *port, struct tcpc_port_config config, ss_mux_sel ss_sel_func);
+bool tcpc_pd_sink_check_charging(struct tcpc_port *port);
void tcpc_print_log(struct tcpc_port *port);
#endif /* __TCPCI_H */