linux-usb.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Ajay Gupta <ajayg@nvidia.com>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>,
	Ajay Gupta <ajaykuee@gmail.com>
Cc: "linux-usb@vger.kernel.org" <linux-usb@vger.kernel.org>
Subject: RE: [PATCH v5] usb: typec: ucsi: add support for separate DP altmode devices
Date: Tue, 17 Sep 2019 21:41:49 +0000	[thread overview]
Message-ID: <BYAPR12MB27272A58997E4D9BC030C9C3DC8F0@BYAPR12MB2727.namprd12.prod.outlook.com> (raw)
In-Reply-To: <20190913152009.GA26700@kuha.fi.intel.com>

Hi Heikki,

> -----Original Message-----
> From: Heikki Krogerus <heikki.krogerus@linux.intel.com>
> Sent: Friday, September 13, 2019 8:20 AM
> To: Ajay Gupta <ajaykuee@gmail.com>
> Cc: linux-usb@vger.kernel.org; Ajay Gupta <ajayg@nvidia.com>
> 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@nvidia.com>
> >
> > 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.

Thanks
> nvpublic
> They always
> make it difficult to modify the code later, and unfortunately we have them all
> over the kernel. Look at the serial driver 8250_core/port/*.cas an example.
> Ideally we should be able to "modularize" the whole alternate mode handling
> in the ucsi driver since there are now two different ways the PPMs can handle
> them instead of simply mixing the support for the new method straight into
> the existing structures.
> 
> thanks,
> 
> --
> heikki

  reply	other threads:[~2019-09-17 21:41 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-09-06 16:55 [PATCH v5] usb: typec: ucsi: add support for separate DP altmode devices Ajay Gupta
2019-09-13 15:20 ` Heikki Krogerus
2019-09-17 21:41   ` Ajay Gupta [this message]
2019-09-19 12:23     ` Heikki Krogerus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=BYAPR12MB27272A58997E4D9BC030C9C3DC8F0@BYAPR12MB2727.namprd12.prod.outlook.com \
    --to=ajayg@nvidia.com \
    --cc=ajaykuee@gmail.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-usb@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).