mirror of
https://github.com/Telecominfraproject/OpenCellular.git
synced 2025-12-29 10:00:51 +00:00
pd: Add pd_capable() to check PD capability of partner port
It's undesirable to do BC1.2 detection on power swap, so add a function to check if the partner port is known to be PD-capable. BUG=chromium:780905 BRANCH=gru TEST=With subsequent CL, attach USB-PD phone capable of role swap. Verify USB 2.0 device is enumerated on plug, and not re-enumerated through a series of "pd # swap power" commands on the EC console. Also verify BC1.2 charging and PD charging are still functional on kevin. Signed-off-by: Shawn Nematbakhsh <shawnn@chromium.org> Change-Id: Ifa75c94e9758d3e407492bbda6fc52ed7bc378fa Reviewed-on: https://chromium-review.googlesource.com/755877 Commit-Ready: Shawn N <shawnn@chromium.org> Tested-by: Shawn N <shawnn@chromium.org> Reviewed-by: Vincent Palatin <vpalatin@chromium.org>
This commit is contained in:
committed by
chrome-bot
parent
f4ee6caa66
commit
fee1bde58d
@@ -294,6 +294,12 @@ int pd_ts_dts_plugged(int port)
|
||||
return pd[port].flags & PD_FLAGS_TS_DTS_PARTNER;
|
||||
}
|
||||
|
||||
/* Return true if partner port is known to be PD capable. */
|
||||
int pd_capable(int port)
|
||||
{
|
||||
return pd[port].flags & PD_FLAGS_PREVIOUS_PD_CONN;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_USB_PD_DUAL_ROLE
|
||||
void pd_vbus_low(int port)
|
||||
{
|
||||
@@ -393,7 +399,7 @@ static inline void set_state(int port, enum pd_states next_state)
|
||||
#ifdef CONFIG_LOW_POWER_IDLE
|
||||
/* If a PD device is attached then disable deep sleep */
|
||||
for (i = 0; i < CONFIG_USB_PD_PORT_COUNT; i++) {
|
||||
if (pd[i].flags & PD_FLAGS_PREVIOUS_PD_CONN)
|
||||
if (pd_capable(i))
|
||||
break;
|
||||
}
|
||||
if (i == CONFIG_USB_PD_PORT_COUNT)
|
||||
@@ -2399,7 +2405,7 @@ void pd_task(void *u)
|
||||
* If we have had PD connection with this port
|
||||
* partner, then start NoResponseTimer.
|
||||
*/
|
||||
if (pd[port].flags & PD_FLAGS_PREVIOUS_PD_CONN)
|
||||
if (pd_capable(port))
|
||||
set_state_timeout(port,
|
||||
get_time().val +
|
||||
PD_T_NO_RESPONSE,
|
||||
@@ -2898,8 +2904,7 @@ void pd_task(void *u)
|
||||
get_time().val +
|
||||
PD_T_SINK_WAIT_CAP,
|
||||
PD_STATE_HARD_RESET_SEND);
|
||||
else if (pd[port].flags &
|
||||
PD_FLAGS_PREVIOUS_PD_CONN)
|
||||
else if (pd_capable(port))
|
||||
/* ErrorRecovery */
|
||||
set_state_timeout(port,
|
||||
get_time().val +
|
||||
|
||||
@@ -1739,6 +1739,13 @@ void pd_set_new_power_request(int port);
|
||||
*/
|
||||
int pd_ts_dts_plugged(int port);
|
||||
|
||||
/**
|
||||
* Return true if partner port is known to be PD capable.
|
||||
*
|
||||
* @param port USB-C port number
|
||||
*/
|
||||
int pd_capable(int port);
|
||||
|
||||
/* ----- Logging ----- */
|
||||
#ifdef CONFIG_USB_PD_LOGGING
|
||||
/**
|
||||
|
||||
Reference in New Issue
Block a user