Received: by 2002:a05:6a10:8c0a:0:0:0:0 with SMTP id go10csp252670pxb; Wed, 3 Feb 2021 04:53:51 -0800 (PST) X-Google-Smtp-Source: ABdhPJzYjKyj4sEI4bZLKJPXNOmN7z270dAZD9kjUq9p0F0nRCOPEc4BPcNzTbQQg5wzaH77rh5J X-Received: by 2002:a50:fd84:: with SMTP id o4mr2748201edt.340.1612356831368; Wed, 03 Feb 2021 04:53:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1612356831; cv=none; d=google.com; s=arc-20160816; b=P8jh5m8ifZpMcGTs/sOQwShKIM0MonlEt1ub8XHnV50NcyyD+YngQbeKHtzlGDZnQN UyQ8S+Jhct9AiwJwiIuUZ/vB2fR7QDBfE/DCYjPj+i9BJ1nmGqr6cc2+K+7Ofn2Zku+g OtJ0awH3qGSwPRyBKELHRNlfZ94ldThC/dEFk6QVrzmKW6O1C+mp9N4DPWBAcVeLLFOZ 9gVwNQVfn9nHywxRRN0fM/EpJ6jYeL7eusCFZyQz97luqDzEmPFq4IwkFv1Im3Pj/YFv DJll1od8LldrPkhf6EzGRtlsGaLB22AFHY4AGJpPkWLgrgRjOiHUrAaiz2NXFLVW77Qw RsiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:ironport-sdr :ironport-sdr; bh=0LyhfmJPdvJwLkDHoatzkNoZViLDlE0HqXitiHAm0bw=; b=jJ5o1Z9Bm5QvFF/m7Et2XBrpJyw96k9e0Qh0bz6uWKmqWPr1OnXfb+iC5bl+SqN88r k2LQ6oaBHZBtK+L1guuCzQXQgsew2DHgJwqQO+6y6d8icHPqU2dZVfEptAg0R8q72jsc Wk6Cj+hbTrQogmuiQB5Us/zOzCzowmoHO9lERTNvU0j7bQCR44E0NIchjeRlslFQJTnc e1o2Tn/H+YLhM5+yPsiJWVRO6QM7T9zM0FJREhEq5qQqTJB1/PwZOzsZZkdxhhpWpCsC vW3WbVuDfP0Sh7odhcGu5K03OZbdc/BqQAcgi3OmqPkMW+OQ1xPx7nkBp8jold9kyR2S La/Q== 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 i23si1071833ejj.317.2021.02.03.04.53.27; Wed, 03 Feb 2021 04:53:51 -0800 (PST) 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 S230159AbhBCMwX (ORCPT + 99 others); Wed, 3 Feb 2021 07:52:23 -0500 Received: from mga03.intel.com ([134.134.136.65]:6781 "EHLO mga03.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231487AbhBCMt3 (ORCPT ); Wed, 3 Feb 2021 07:49:29 -0500 IronPort-SDR: 0d7ReD5eExWadCwu53KROZUQAp+lG2k7bYaIzs0LCa7MEldycJXTrgG7AmIEXmpnc4CCQoTCqV c0VLDqM8KF7g== X-IronPort-AV: E=McAfee;i="6000,8403,9883"; a="181108280" X-IronPort-AV: E=Sophos;i="5.79,398,1602572400"; d="scan'208";a="181108280" Received: from fmsmga001.fm.intel.com ([10.253.24.23]) by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Feb 2021 04:47:28 -0800 IronPort-SDR: a54BKyw3jkn5IqYOxiw5m9UsxbrGNtRp3DjPR9LTJp2KZJ0p+4FY8FhKPE09XwUlF5FTXGV0Z5 VAs449fpzUsg== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.79,398,1602572400"; d="scan'208";a="480338665" Received: from kuha.fi.intel.com ([10.237.72.162]) by fmsmga001.fm.intel.com with SMTP; 03 Feb 2021 04:47:24 -0800 Received: by kuha.fi.intel.com (sSMTP sendmail emulation); Wed, 03 Feb 2021 14:47:24 +0200 Date: Wed, 3 Feb 2021 14:47:24 +0200 From: Heikki Krogerus To: Kyle Tso Cc: linux@roeck-us.net, gregkh@linuxfoundation.org, hdegoede@redhat.com, robh+dt@kernel.org, badhri@google.com, linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, devicetree@vger.kernel.org Subject: Re: [PATCH v5 1/8] usb: typec: Manage SVDM version Message-ID: <20210203124724.GD1687065@kuha.fi.intel.com> References: <20210202161733.932215-1-kyletso@google.com> <20210202161733.932215-2-kyletso@google.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20210202161733.932215-2-kyletso@google.com> Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Kyle, On Wed, Feb 03, 2021 at 12:17:26AM +0800, Kyle Tso wrote: > PD Spec Revision 3.0 Version 2.0 + ECNs 2020-12-10 > 6.4.4.2.3 Structured VDM Version > "The Structured VDM Version field of the Discover Identity Command > sent and received during VDM discovery Shall be used to determine the > lowest common Structured VDM Version supported by the Port Partners or > Cable Plug and Shall continue to operate using this Specification > Revision until they are Detached." > > Add a variable in typec_capability to specify the highest SVDM version > supported by the port and another variable in typec_port to cache the > negotiated SVDM version between the port partners. > > Also add setter/getter functions for the negotiated SVDM version. > > Signed-off-by: Kyle Tso > --- > drivers/usb/typec/class.c | 13 +++++++++++++ > include/linux/usb/typec.h | 10 ++++++++++ > 2 files changed, 23 insertions(+) > > diff --git a/drivers/usb/typec/class.c b/drivers/usb/typec/class.c > index b6ceab3dc16b..42d1be1eece9 100644 > --- a/drivers/usb/typec/class.c > +++ b/drivers/usb/typec/class.c > @@ -51,6 +51,7 @@ struct typec_port { > enum typec_role vconn_role; > enum typec_pwr_opmode pwr_opmode; > enum typec_port_type port_type; > + enum usb_pd_svdm_ver svdm_version; > struct mutex port_type_lock; I just realized that you are storing that in the port object. I guess we don't have to change this right now, but it would have been more clear to store that in the partner object IMO. > enum typec_orientation orientation; > @@ -1841,6 +1842,18 @@ int typec_find_port_data_role(const char *name) > } > EXPORT_SYMBOL_GPL(typec_find_port_data_role); > > +void typec_set_svdm_version(struct typec_port *port, enum usb_pd_svdm_ver ver) > +{ > + port->svdm_version = ver; > +} > +EXPORT_SYMBOL_GPL(typec_set_svdm_version); > + > +enum usb_pd_svdm_ver typec_get_svdm_version(struct typec_port *port) > +{ > + return port->svdm_version; > +} > +EXPORT_SYMBOL_GPL(typec_get_svdm_version); You need to document those exported functions! You need to do that in any case, but in this case it's very important, because the purpose of these functions is not clear from the ctx. I'm sorry for noticing that so late. Since you do need to fix that, please see if you can also store that detail in the partner device object instead of the port object. thanks, -- heikki