Received: by 2002:a25:868d:0:0:0:0:0 with SMTP id z13csp449191ybk; Fri, 15 May 2020 05:08:07 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwCEK/eLsrwr3BIooEcF4O5FtHf5Pd+JPivHkNzaDXkqIHrbNfIY5cNxvCKaCJWyG4pOQoe X-Received: by 2002:a05:6402:357:: with SMTP id r23mr2408667edw.230.1589544487458; Fri, 15 May 2020 05:08:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1589544487; cv=none; d=google.com; s=arc-20160816; b=JqMwKmGJYs2IqoG2opijayb7L+1qDzz0+EAt7qFlQKjM2JnMFpn2yTqSZG1qusBXE8 4YuoS9ZygHnDotqrl6AqE2Yh8AJHxrLOoGvoGSfjmlLVQ7cjcB2Gh+dDnkHo1uwJCSf8 P1RpbdM3Iua8yng+79Trc0WiB/AodWLykNas6m96zP85r2L7fKZWCa++0tXU5kt6cciS bt7qASuDgtIi62CCh1Ck/i1waywtMB/doSg1KQwXoAlT9ILhRScYeZAovROwPK8VgUMg +zWAM3hPnWvMDSGDOiCD8wJQnyy71M1ojbCw2WJ092MwhB5G4H31RP7ShT+K/7wPB7k5 OIXA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :ironport-sdr:ironport-sdr; bh=KQncAbdESGQ4Rn/GvbENhscGV8vp2IzMgxpIJFuCEv8=; b=QooXbue3Zz2brNzKAou9PUD3Ri9peyBEOtt0XREvFfAk243Mzj3e5S45zYBUtQDdGE fwYDBFIFcj9+BvEFgXbf/Hez1g3W+n2w36yGCNoKUoz/OfIZ1O933IQdCzmiSRo7t7jR oAyPC41xYeIf1D9ZTIwW1GGdtKHKCjx4sdW0D1aarWchF7Q3R6iWecsfNQxgtFjF+Mfk Oh1HJ8xgRlcWyVvDTU0tV0CHTF0aTty9KwWNLC3126DSTTEBoS1ll1ovvRYQcdML5+Ok sceb5xJQsIW35dvIZnmGZuZmv9ezaJBa3gRi4I99sWoitO3qobJjLEQl35ZyDJOMIUbX rxWA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id h10si1011434eds.403.2020.05.15.05.07.42; Fri, 15 May 2020 05:08:07 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726239AbgEOMF5 (ORCPT + 99 others); Fri, 15 May 2020 08:05:57 -0400 Received: from mga11.intel.com ([192.55.52.93]:4688 "EHLO mga11.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726112AbgEOMF4 (ORCPT ); Fri, 15 May 2020 08:05:56 -0400 IronPort-SDR: pbNWTpnTexALeOgUTQEJWtgskadJOYSEAPv7RTbh6zLW7pZmxF6YzFs4fyvcWzzFhHOskXad9k y1i8qEAfy3dg== X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by fmsmga102.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 15 May 2020 05:05:56 -0700 IronPort-SDR: ETu/rW6/uFdF7TdKoh27Q9VwNarsKv/Nw6Rqg/wuXAUPeJO4JbkpXTzyU+NuZoqdLKCQMtm7hB 56shWPE1OBtQ== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.73,395,1583222400"; d="scan'208";a="372670460" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 15 May 2020 05:05:53 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Fri, 15 May 2020 15:05:52 +0300 Date: Fri, 15 May 2020 15:05:52 +0300 From: Heikki Krogerus To: Prashant Malani Cc: Greg Kroah-Hartman , Benson Leung , "open list:USB NETWORKING DRIVERS" , Linux Kernel Mailing List , linux-acpi@vger.kernel.org, Tim Wawrzynczak Subject: Re: [PATCH 2/4] usb: typec: mux: intel_pmc_mux: Support for static SBU/HSL orientation Message-ID: <20200515120552.GC1511@kuha.fi.intel.com> References: <20200507150900.12102-1-heikki.krogerus@linux.intel.com> <20200507150900.12102-3-heikki.krogerus@linux.intel.com> <20200507224041.GA247416@google.com> <20200508111840.GG645261@kuha.fi.intel.com> <20200511133202.GA2085641@kuha.fi.intel.com> <20200511175719.GA136540@google.com> <20200512142251.GD2085641@kuha.fi.intel.com> <20200512191910.GD136540@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Prashant, > I just realized, the issue I initially pointed out would apply to the > connect message too, i.e I'm not sure if "normal" orientation setting > handles the case where port orientation is reversed correctly. > Overall, I am not sure that re-using the typec_orientations[] string > list is the best option for this use-case. > we're looking for "normal" (i.e follows port->orientation) and "fixed" > (i.e is always the same orientation, regardless of what > port->orientation is), so it is perhaps better to just define a new > array just for this driver. Sorry, I got sidetracked with that Alternate-Direct Request stuff. Let's start over.. The property itself is the indicator that the orientation is fixed for those lines, not its value. If the property exists, we know the orientation is fixed, and if it doesn't exist, we know we need to use the cable plug orientation. So if we only want to use the property as a flag, then it does not need to have any value at all. It would be a boolean property. But we would then always leave the ORI-HSL field with value 0 when the orientation is fixed, and that would rule out the possibility of supporting a platform where we have to use a fixed value of 1 there (fixed-reversed). If we ever needed to support configuration like that, then we would need to add a new property. That scenario may not be relevant on this platform, and it may seem like an unlikely, or even impossible case now, but experience (and the north mux-agent documentation) tells me we should prepare also for that. That is why I use the typec_orientation strings as the values for these properties. Then the fixed-reversed orientation is also covered with the same properties if we ever need to support it. Maybe this code would be better, or more clear in the driver: /* * Returns the value for the HSL-ORI field. */ static int hsl_orientation(struct pmc_usb_port *port) { enum typec_orientation orientation; /* * Is the orientation fixed: * Yes, use the fixed orientation. * No, use cable plug orientation. */ if (port->hsl_orientation) orientation = hsl_orientation; else orientation = port->orientation; switch (orientation) { case TYPEC_ORIENTATION_NORMAL: return 0; case TYPEC_ORIENTATION_REVERSE: return 1; } return -EINVAL; } thanks, -- heikki