Received: by 2002:a25:d7c1:0:0:0:0:0 with SMTP id o184csp1746707ybg; Wed, 23 Oct 2019 22:35:57 -0700 (PDT) X-Google-Smtp-Source: APXvYqyCjBf8E+hkw4hpGqZ0/7vw3+pmgNZhHS/N2pX+SYCfHs5yDvM2T2EOF8O8gNPwVL1nQiLE X-Received: by 2002:a17:906:15da:: with SMTP id l26mr15930984ejd.326.1571895356874; Wed, 23 Oct 2019 22:35:56 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1571895356; cv=none; d=google.com; s=arc-20160816; b=BVyfbmGJXJ4nLyQ1hEQXp5rWVStshKGrF6qe7/q9L7zKP1ecHpTSeOq/0D8MUbP2Pd 0KYB15SeogVIc3K4UiZTqW7efvm5LpYcoZNcDkDZ2zW3fx8FNf+2wK/hBhDhjnM96p8Y oePSFbGN7xlgw1FsWwdLiEqhpeHxNtTnmUIqqoP0sDla1obnTWKc1ws1cj8FdX/pibL9 cqymy9t9AHvOqflePemktl2zfyNP2BHOkme/SpjDIoyjb02zr3icyci8LIVh857Ug9lz i764f+tsS/qcMVHd7pwxc6tfQM7gKHTFvzfALVVX9nzrzlyW8zyCDcwiDFAd3FX0mX7u DvBg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=D2OoKNtsGAVLvc4f2BQGxdMeq+kmhIGYlbVvAX3e4wc=; b=mEWf/MCNCXFXZXm0tnsA/7CMHuuvlTSmUknjg1ZlQhWesw6/EhVqXDpXnvVHc1sg7u AwPGtTgZzxxX2b8DmvlF5MHjf/DSmy4LmRJBBlSF7WfRa/rl/wXvEB8EEQIwiOuQI18P ejq06ZzKMFZa4GkJ2qt+Xq0OnyBJEsslCmp3ges1OFO//SrvMEj8MkcwCw55M7izAZJ/ 679nSDJX0N07CS+VolWvxIXzIW9b72f7pyxHuB6z2q/BnwT1XDgqAzwfIaXISoEtmjjI CS9ngyoV+RrsEDDM0256HNcwFV8opB0q+bkkjDHBUxExXAW8eEIPKdEFUt6yYIcTz+m5 eT/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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. [209.132.180.67]) by mx.google.com with ESMTP id s19si10684165edd.351.2019.10.23.22.35.32; Wed, 23 Oct 2019 22:35:56 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 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 S2406993AbfJWP6D (ORCPT + 99 others); Wed, 23 Oct 2019 11:58:03 -0400 Received: from mga07.intel.com ([134.134.136.100]:48166 "EHLO mga07.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2406985AbfJWP6C (ORCPT ); Wed, 23 Oct 2019 11:58:02 -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 orsmga105.jf.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 23 Oct 2019 08:58:01 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.68,221,1569308400"; d="scan'208";a="209947282" Received: from kuha.fi.intel.com ([10.237.72.53]) by fmsmga001.fm.intel.com with SMTP; 23 Oct 2019 08:57:57 -0700 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 23 Oct 2019 18:57:57 +0300 Date: Wed, 23 Oct 2019 18:57:57 +0300 From: Heikki Krogerus To: Guenter Roeck Cc: Puma Hsu , gregkh@linuxfoundation.org, badhri@google.com, kyletso@google.com, albertccwang@google.com, rickyniu@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org Subject: Re: [PATCH V2] usb: typec: Add sysfs node to show connector orientation Message-ID: <20191023155757.GB15396@kuha.fi.intel.com> References: <20191022085924.92783-1-pumahsu@google.com> <20191023083221.GB8828@kuha.fi.intel.com> <644d890b-86e8-f05a-cd4c-32937d971a45@roeck-us.net> <20191023142900.GA15396@kuha.fi.intel.com> <20191023150126.GA16612@roeck-us.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20191023150126.GA16612@roeck-us.net> User-Agent: Mutt/1.12.1 (2019-06-15) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Oct 23, 2019 at 08:01:26AM -0700, Guenter Roeck wrote: > On Wed, Oct 23, 2019 at 05:29:00PM +0300, Heikki Krogerus wrote: > > On Wed, Oct 23, 2019 at 06:44:39AM -0700, Guenter Roeck wrote: > > > On 10/23/19 1:32 AM, Heikki Krogerus wrote: > > > > +Guenter > > > > > > > > On Tue, Oct 22, 2019 at 04:59:24PM +0800, Puma Hsu wrote: > > > > > Export the Type-C connector orientation so that user space > > > > > can get this information. > > > > > > > > > > Signed-off-by: Puma Hsu > > > > > --- > > > > > Documentation/ABI/testing/sysfs-class-typec | 11 +++++++++++ > > > > > drivers/usb/typec/class.c | 18 ++++++++++++++++++ > > > > > 2 files changed, 29 insertions(+) > > > > > > > > > > diff --git a/Documentation/ABI/testing/sysfs-class-typec b/Documentation/ABI/testing/sysfs-class-typec > > > > > index d7647b258c3c..b22f71801671 100644 > > > > > --- a/Documentation/ABI/testing/sysfs-class-typec > > > > > +++ b/Documentation/ABI/testing/sysfs-class-typec > > > > > @@ -108,6 +108,17 @@ Contact: Heikki Krogerus > > > > > Description: > > > > > Revision number of the supported USB Type-C specification. > > > > > +What: /sys/class/typec//connector_orientation > > > > > +Date: October 2019 > > > > > +Contact: Puma Hsu > > > > > +Description: > > > > > + Indicates which typec connector orientation is configured now. > > > > > + cc1 is defined as "normal" and cc2 is defined as "reversed". > > > > > + > > > > > + Valid value: > > > > > + - unknown (nothing configured) > > > > > > > > "unknown" means we do not know the orientation. > > > > > > > > > + - normal (configured in cc1 side) > > > > > + - reversed (configured in cc2 side) > > > > > > > > Guenter, do you think "connector_orientation" OK. I proposed it, but > > > > I'm now wondering if something like "polarity" would be better? > > > > > > > > > > Yes, or just "orientation". I don't see the value in the "connector_" prefix. > > > I also wonder if "unknown" is really correct. Is it really unknown, or > > > does it mean that the port is disconnected ? > > > > Unknown means we don't know the orientation. We don't always have that > > information available to us. With UCSI we simply do not know it. > > > > I think this file needs to be hidden after all if we don't know the > > cable plug orientation. > > > Making the attribute appear and disappear may cause difficulties for > userspace. > > > How about empty string instead of "unknown"? > > > An empty string might also be challenging for userspace. > > "unknown" is fine if it is really unknown. That's what I was thinking, but I realised that since the value may be "unknown" even when the driver is able to tell the cable plug orientation, there is no way for the userspace to know is the driver able to supply the information or not. That is why I say the attribute has to be hidden in cases where the driver really does not know the orientation (like UCSI). I'm really not a big fan of hidden attribute files, as they do make things unpredictable for the userspace, but with information like this, either we simply do not provide it to the userspace at all - option that I'm all for if there is no real need for this - or we hide the file with drivers that can not supply the information. > With that in mind, I wonder what value that attribute has for > userspace, but presumably there must be some use case. I assume it > is purely informational. Puma actually already answered to this one: https://lkml.org/lkml/2019/10/22/198 If I understood correctly, it would be purely informational. Puma, please correct me if I'm wrong! But if that is the case, and it is purely informational, then I don't think we should add this attribute at all. thanks, -- heikki