@@ -319,6 +319,7 @@ struct pd_timings {
u32 sink_wait_cap_time;
u32 ps_src_off_time;
u32 cc_debounce_time;
+ u32 snk_bc12_cmpletion_time;
};
struct tcpm_port {
@@ -4978,7 +4979,16 @@ static void run_state_machine(struct tcpm_port *port)
if (ret < 0)
tcpm_set_state(port, SNK_UNATTACHED, 0);
else
- tcpm_set_state(port, SNK_STARTUP, 0);
+ /*
+ * For Type C port controllers that use Battery Charging
+ * Detection (based on BCv1.2 spec) to detect USB
+ * charger type, add a delay of "snk_bc12_cmpletion_time"
+ * before transitioning to SNK_STARTUP to allow BC1.2
+ * detection to complete before PD is eventually enabled
+ * in later states.
+ */
+ tcpm_set_state(port, SNK_STARTUP,
+ port->timings.snk_bc12_cmpletion_time);
break;
case SNK_STARTUP:
opmode = tcpm_get_pwr_opmode(port->polarity ?
@@ -7090,6 +7100,10 @@ static void tcpm_fw_get_timings(struct tcpm_port *port, struct fwnode_handle *fw
port->timings.cc_debounce_time = val;
else
port->timings.cc_debounce_time = PD_T_CC_DEBOUNCE;
+
+ ret = fwnode_property_read_u32(fwnode, "sink-bc12-completion-time-ms", &val);
+ if (!ret)
+ port->timings.snk_bc12_cmpletion_time = val;
}
static int tcpm_fw_get_caps(struct tcpm_port *port, struct fwnode_handle *fwnode)