lkml.org 
[lkml]   [2021]   [Jan]   [13]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Date
SubjectRe: [PATCH v5 1/3] usb: typec: tcpm: AMS and Collision Avoidance
On Wed, Jan 13, 2021 at 2:11 PM Badhri Jagan Sridharan
<badhri@google.com> wrote:
>
> Hi Kyle,
>
> Do you want to handle the FAST_ROLE_SWAP case as well ?
>
I forgot this part....
Thanks for catching this.
I will fix it.


> You would have to fix up in two places:
>
> #1
> - if (port->state == SNK_READY)
> - tcpm_set_state(port, FR_SWAP_SEND, 0);
> - else
> + if (port->state == SNK_READY) {
> + int ret;
> +
> + port->upcoming_state = FR_SWAP_SEND;
> + ret = tcpm_ams_start(port, FAST_ROLE_SWAP);
> + if (ret == -EAGAIN)
> + port->upcoming_state = INVALID_STATE;
> + } else {
> tcpm_log(port, "Discarding FRS_SIGNAL!
> Not in sink ready");
> + }
>
> #2
> --- a/drivers/usb/typec/tcpm/tcpm.c
> +++ b/drivers/usb/typec/tcpm/tcpm.c
> @@ -4449,9 +4449,14 @@ static void tcpm_enable_frs_work(struct
> kthread_work *work)
> if (port->state != SNK_READY || port->vdm_state !=
> VDM_STATE_DONE || port->send_discover)
> goto resched;
>
> - tcpm_set_state(port, GET_SINK_CAP, 0);
> - port->sink_cap_done = true;
> -
> + port->upcoming_state = GET_SINK_CAP;
> + ret = tcpm_ams_start(port, GET_SINK_CAPABILITIES);
> + if (ret == -EAGAIN) {
> + port->upcoming_state = INVALID_STATE;
> + } else {
> + port->sink_cap_done = true;
> + goto unlock;
> + }
>
> Thanks,
> Badhri
>
>

\
 
 \ /
  Last update: 2021-01-13 15:48    [W:0.050 / U:0.048 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site