From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.2 required=3.0 tests=HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_SANE_1 autolearn=no autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id CC492C3A5A6 for ; Thu, 19 Sep 2019 12:23:07 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id A9124207FC for ; Thu, 19 Sep 2019 12:23:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390211AbfISMXH (ORCPT ); Thu, 19 Sep 2019 08:23:07 -0400 Received: from mga04.intel.com ([192.55.52.120]:49831 "EHLO mga04.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2390189AbfISMXH (ORCPT ); Thu, 19 Sep 2019 08:23:07 -0400 X-Amp-Result: UNKNOWN X-Amp-Original-Verdict: FILE UNKNOWN X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga104.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 19 Sep 2019 05:23:06 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.64,523,1559545200"; d="scan'208";a="202274389" Received: from kuha.fi.intel.com ([10.237.72.53]) by fmsmga001.fm.intel.com with SMTP; 19 Sep 2019 05:23:04 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Thu, 19 Sep 2019 15:23:03 +0300 Date: Thu, 19 Sep 2019 15:23:03 +0300 From: Heikki Krogerus To: Ajay Gupta Cc: Ajay Gupta , "linux-usb@vger.kernel.org" Subject: Re: [PATCH v5] usb: typec: ucsi: add support for separate DP altmode devices Message-ID: <20190919122303.GC16243@kuha.fi.intel.com> References: <20190906165516.24006-1-ajayg@nvidia.com> <20190913152009.GA26700@kuha.fi.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org On Tue, Sep 17, 2019 at 09:41:49PM +0000, Ajay Gupta wrote: > Hi Heikki, > > > -----Original Message----- > > From: Heikki Krogerus > > Sent: Friday, September 13, 2019 8:20 AM > > To: Ajay Gupta > > Cc: linux-usb@vger.kernel.org; Ajay Gupta > > 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 > > > > > > 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