• Guenter Roeck's avatar
    staging: typec: tcpm: Improve role swap with non PD capable partners · b17dd571
    Guenter Roeck authored
    If the partner is not PD capable, we can not use a power role set request
    to swap roles. Use the data role set request instead.
    
    Also, if a partner is not PD capable, it does not really make sense to send
    a PD message to trigger a role swap. On top of that, we should really wait
    for the attempted role change to complete. Otherwise, it may well be that
    user space requests another role change immediately afterwards which will
    fail because the port is not yet in ready state.
    
    Trigger the role swap from data role change requests and introduce new
    state PORT_RESET and use it to solve the problem. This new state is
    mostly identical to ERROR_RECOVERY, only it does not cause a pending
    role change to fail. Use this new state also when initializing the driver.
    Rename ERROR_RECOVERY_WAIT_OFF to PORT_RESET_WAIT_OFF to better reflect
    its new meaning.
    Signed-off-by: default avatarGuenter Roeck <linux@roeck-us.net>
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    b17dd571
tcpm.c 87.1 KB