Re: [RFC PATCH 0/7] usb: typec: ucsi: Polling the alt modes and PDOs

From: Heikki Krogerus
Date: Wed Jun 09 2021 - 07:26:03 EST


On Tue, Jun 08, 2021 at 09:32:01PM +0200, Benjamin Berg wrote:
> On Tue, 2021-06-08 at 09:54 +0300, Heikki Krogerus wrote:
> > On Tue, Jun 08, 2021 at 09:42:09AM +0300, Heikki Krogerus wrote:
> > > Please check does the partner device get removed. What do you have
> > > under /sys/class/typec after that happens?
> >
> > Oh yes. Could you also share the trace output when that happens?
> >
> >         cd /sys/kernel/debug/tracing
> >         echo 1 > events/ucsi/enable
> >         # now reproduce the issue
> >         cat trace > ucsi.trace
>
> So, the partner device is still there when this happens (see below). I
> also only see a single event in the trace for the fast plug/unplug
> case:
> kworker/u16:8-1771 [003] .... 18848.872145: ucsi_connector_change: port1 status: change=4a04, opmode=5, connected=1, sourcing=0, partner_flags=1, partner_type=1, request_data_obj=1304b12c, BC status=1

OK. Sorry I had to double check because you were only talking about
the psy online state.

Can you now try this HACK on top of these patches:

diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c
index bd39fe2cb1d0b..99f072700ce7f 100644
--- a/drivers/usb/typec/ucsi/ucsi.c
+++ b/drivers/usb/typec/ucsi/ucsi.c
@@ -843,7 +843,8 @@ static void ucsi_handle_connector_change(struct work_struct *work)

if (!status.change) {
dev_dbg(con->ucsi->dev, "con%d: spurious event\n", con->num);
- goto out_ack;
+ /* XXX Force connection check. */
+ status.change = UCSI_CONSTAT_CONNECT_CHANGE;
}

event = kzalloc(sizeof(*event), GFP_KERNEL);

thanks,

--
heikki