policy_engine: Don't allow MODE change if no active connection
Currently driver is allowing MODE change even if there is no active cable connection and is waiting for to complete. For this MODE change to complete, driver first sets power role to none to do type C disconnect and then switch to new mode. Here disconnect won't come as there is no active cable connection. Fix this issue by returning error in case there is no active connection. Change-Id: Ie423bd8b61ab7b2624f98c84e8d8e75b6c853b00 Signed-off-by: Vijayavardhan Vennapusa <vvreddy@codeaurora.org>
This commit is contained in:
parent
5404e35069
commit
0355a024aa
1 changed files with 5 additions and 0 deletions
|
@ -2519,6 +2519,11 @@ static int usbpd_dr_set_property(struct dual_role_phy_instance *dual_role,
|
|||
case DUAL_ROLE_PROP_MODE:
|
||||
usbpd_dbg(&pd->dev, "Setting mode to %d\n", *val);
|
||||
|
||||
if (pd->current_state == PE_UNKNOWN) {
|
||||
usbpd_warn(&pd->dev, "No active connection. Don't allow MODE change\n");
|
||||
return -EAGAIN;
|
||||
}
|
||||
|
||||
/*
|
||||
* Forces disconnect on CC and re-establishes connection.
|
||||
* This does not use PD-based PR/DR swap
|
||||
|
|
Loading…
Add table
Reference in a new issue