On Tue, Sep 17, 2019 at 09:41:49PM +0000, Ajay Gupta wrote: > Hi Heikki, > > > -----Original Message----- > > From: Heikki Krogerus <heikki.krogerus@xxxxxxxxxxxxxxx> > > Sent: Friday, September 13, 2019 8:20 AM > > To: Ajay Gupta <ajaykuee@xxxxxxxxx> > > Cc: linux-usb@xxxxxxxxxxxxxxx; Ajay Gupta <ajayg@xxxxxxxxxx> > > Subject: Re: [PATCH v5] usb: typec: ucsi: add support for separate DP altmode > > devices > > > > Hi Ajay, > > > > On Fri, Sep 06, 2019 at 09:55:16AM -0700, Ajay Gupta wrote: > > > From: Ajay Gupta <ajayg@xxxxxxxxxx> > > > > > > CCGx controller used on NVIDIA GPU card has two separate display > > > altmode for two DP pin assignments. UCSI specification doesn't > > > prohibits using separate display altmode. > > > > > > Current UCSI Type-C framework expects only one display altmode for all > > > DP pin assignment. This patch squashes two separate display altmode > > > into single altmode to support controllers with separate display > > > altmode. We first read all the alternate modes of connector and then > > > run through it to know if there are separate display altmodes. If so, > > > it prepares a new port altmode set after squashing two or more > > > separate altmodes into one. > > > > I'm going to go over this one more time during the merge window. I have an > > idea how to improve this. Please bear with me. I have to make sure all options > > were considered. > > > > I'm really sorry to block this for so long, but I'm just really really afraid of > > mixing special case solutions like this into otherwise generic code. > > I can update the patch to make sure generic code flow remains as-is and special > case is executed only for UCSI controllers which needs squashing of duplicate > DP altmodes. > We can use the new function pointer update_altmode() added in "struct ucsi_ppm" in v5 > of my patch for this purpose. > > if (recipient == UCSI_RECIPIENT_CON && ucsi->ppm && ucsi->ppm->update_altmodes) > Get all the altmodes first, pass it to update_altmodes() for squashing if needed, > and then register each altmodes. > else > Use the current method where we get and register one altmode at a time. > > Please let me know if this looks fine to you. No. Please wait. I'm refactoring ucsi.c. I'm going to redo the I/O completely, and also do some long waited cleanups. Those changes should make handling this case also much easier. thanks, -- heikki