On Fri, Sep 27, 2019 at 12:13:57AM +0000, Ajay Gupta wrote: > Hi Heikki, > > -----Original Message----- > > From: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> > > Sent: Thursday, September 26, 2019 3:07 AM > > To: Ajay Gupta <ajayg@xxxxxxxxxx> > > Cc: linux-usb@xxxxxxxxxxxxxxx > > Subject: [PATCH 00/14] usb: typec: UCSI driver overhaul > > > > Hi Ajay, > > > > Here's the pretty much complete rewrite of the I/O handling that I was > > talking about. The first seven patches are not actually related to > > this stuff, but I'm including them here because the rest of the series > > is made on top of them. I'm including also that fix patch I send you > > earlier. > > > > After this it should be easier to handle quirks. My idea how to handle > > the multi-instance connector alt modes is that we "emulate" the PPM in > > ucsi_ccg.c in order to handle them, so ucsi.c is not touched at all. > > > > We can now get the connector alternate modes that the actual > > controller supplies during probe - before registering the ucsi > > interface - and squash all alt modes with the same SVID into one that > > we supply to the ucsi.c when ever it sends GET_ALTERNATE_MODES > > command. Also other alt mode commands like SET_NEW_CAM can have > > special processing in ucsi_ccg.c and ucsi_ccg.c alone. There should > > not be any problem with that anymore. > I took the changes and loaded on my GPU system and do not see > altmode devices under /sys/bus/typec/devices/*. Its empty. > > Below error is seen > "ucsi_ccg 4-0008: con1: failed to register alternate modes" > > ucsi_run_command() is returning -16. > > I will review the ccg changes and try to debug above issue. There is at least on obvious bug. The number of alternate modes field is wrong. The this: diff --git a/drivers/usb/typec/ucsi/ucsi.c b/drivers/usb/typec/ucsi/ucsi.c index accf54d987ad..506d963ecc6c 100644 --- a/drivers/usb/typec/ucsi/ucsi.c +++ b/drivers/usb/typec/ucsi/ucsi.c @@ -330,7 +330,7 @@ static int ucsi_register_altmodes(struct ucsi_connector *con, u8 recipient) command |= UCSI_GET_ALTMODE_RECIPIENT(recipient); command |= UCSI_GET_ALTMODE_CONNECTOR_NUMBER(con->num); command |= UCSI_GET_ALTMODE_OFFSET(i); - command |= UCSI_GET_ALTMODE_NUM_ALTMODES(1); /* One at a time */ + command |= UCSI_GET_ALTMODE_NUM_ALTMODES(0); /* One at a time */ len = ucsi_run_command(con->ucsi, command, alt, sizeof(alt)); if (len <= 0) return len; Alternatively you can also just drop two last patches of the series. thanks, -- heikki