Received: by 2002:a05:6a10:6744:0:0:0:0 with SMTP id w4csp280012pxu; Thu, 22 Oct 2020 23:51:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyOmjMkOvt4TGEOrW9WkL3ngfZ4nXv68w8ZOc2LLesdVM8K78WB8sBUKut7i1vPTbYci+KE X-Received: by 2002:aa7:cd42:: with SMTP id v2mr794639edw.151.1603435875012; Thu, 22 Oct 2020 23:51:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1603435875; cv=none; d=google.com; s=arc-20160816; b=Y5XIny+IEDZU2u2rtFRmRkwzM7rxAlISue7WKaw7F0hrbLevJwBMEZcqbTnSuX/xB0 qV21S6ndm8xC76LTekwePIX07h/mJuuWPDasP9yHrgiO0dtNsnE6XW6poFej4rkpgLxo XgOZ0oRNuplgjWGjw5mbv99RsBgmHLgjVDuz9pEp/7mmrKa3Ag9js4GzTwjlT/w8weDg EgtW3j/DvwEWVt0HQozEtWHnHpgcQlApbDybQxWUCrGyO1nAGPMuuMX0qurn7NrLjkSO I7/hYaco60GaZbYDlUHA2TprTo9cg/33uLUprPTZgMtFuMEAFMb4ekuNOTvdPt425WWZ 4LIw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=PHrw0JfjJb9twAK3ln44mr+GANmK39ZjwO95rghOQdQ=; b=IPrWn2zie9NG7HWdYv4Ph+irIq0eLf4365fPgQCFRkNWC054fN0nijvleax65PZYmh hmnsr9c0MPwBYjBqUzOHHgpNn84AHKu7T9utNhiRHVTOzUTozXmgDNQrCIortUxXWQFt HX7Fi/7edkjsRn564qKEALPG9hU1WRYWVIyB41WFyR7Z5XZ7xOaJoVKGTXEIhQs8fYp1 GdD5M0x8WuR93whdx4dpBKiUXlgNYHBliIbRbLZMhTqbqw29In64D5bHh+LQbu6bLqYI 8gt4ikm7Gd9fch4vmHD4EvG02roe2a4vbCzGelY98mapueD2KlqJjz9C9PHPFX6CDP5i BTAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b="UH/1lsGD"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id q1si289976ejf.509.2020.10.22.23.50.52; Thu, 22 Oct 2020 23:51:14 -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; dkim=pass header.i=@chromium.org header.s=google header.b="UH/1lsGD"; 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=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S373369AbgJVXZj (ORCPT + 99 others); Thu, 22 Oct 2020 19:25:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59770 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S373370AbgJVXZi (ORCPT ); Thu, 22 Oct 2020 19:25:38 -0400 Received: from mail-ed1-x529.google.com (mail-ed1-x529.google.com [IPv6:2a00:1450:4864:20::529]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DB4ACC0613CE for ; Thu, 22 Oct 2020 16:25:36 -0700 (PDT) Received: by mail-ed1-x529.google.com with SMTP id x1so3468229eds.1 for ; Thu, 22 Oct 2020 16:25:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=PHrw0JfjJb9twAK3ln44mr+GANmK39ZjwO95rghOQdQ=; b=UH/1lsGD9S6xaaoRApk4Nn23uH2VJ7+Oc/a5lKr2+7MqiTQ/YhkUikfK+zgYYch1lf gx9p3iO981SwYgZyP+/nNqu7msU4Gy5+BlCzR3zePM99c6+BOQPr9DPcF48Nlfy+UZCJ ZTTAAEScd1rLvJlyna0Gidt+aBXjpynj46gFI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=PHrw0JfjJb9twAK3ln44mr+GANmK39ZjwO95rghOQdQ=; b=aMFeabYWAc/w4K+4IjJGRp5RVn0URC1RDu+oR976nYxt7VHqf/dZAq5CGg54i/gWih B+4ow2HDuvpKhQ9ESK+3JwMHVb8Fv6rjFaBmAO3kt8oS4nrrC2oEnINb42od8hDSWzdQ puCw5+GFLC0DfiZxvRFi1UyJlaZM+itrG/YPLE05WKO1dOXvD6wdCwMwCjGIa7YvQmqZ kfDnFI4MdI72Y1lptgZ+/t7oWfdI3h38NaGKv4RU7XvzQEsPuq8SM6eFbmhhn4oQ9NGg rz6mI63bfgsQ3ulj9oas0S9c61SXc0ofI4v3tcPTFiSzLXM4jk52M/3ntUcZiADzw0gJ pAow== X-Gm-Message-State: AOAM530LS5kKtgy8YerfCzXdoJkitY9xh93VMN18dt+2voijUX39/iM+ SHx7mTT3O344FbUFxcrGV/kvF6EXyKV53cXZ//F3oQ== X-Received: by 2002:a50:a267:: with SMTP id 94mr4365625edl.30.1603409135139; Thu, 22 Oct 2020 16:25:35 -0700 (PDT) MIME-Version: 1.0 References: <20201022061554.3418060-1-pmalani@chromium.org> <20201022065719.GA1440360@kroah.com> <20201022071753.GA1470296@kroah.com> <20201022124248.GQ1667571@kuha.fi.intel.com> In-Reply-To: <20201022124248.GQ1667571@kuha.fi.intel.com> From: Benson Leung Date: Thu, 22 Oct 2020 16:25:23 -0700 Message-ID: Subject: Re: [PATCH v2] usb: typec: Expose Product Type VDOs via sysfs To: Heikki Krogerus Cc: Prashant Malani , Greg KH , Linux Kernel Mailing List , "open list:USB NETWORKING DRIVERS" Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Hi Heikki, On Thu, Oct 22, 2020 at 5:43 AM Heikki Krogerus wrote: > > On Thu, Oct 22, 2020 at 12:25:07AM -0700, Prashant Malani wrote: > > Hi Greg, > > > > On Thu, Oct 22, 2020 at 12:17 AM Greg KH wrote: > > > > > > > > > +What: /sys/class/typec/-partner/identity/product_type_vdo > > > > > > +Date: October 2020 > > > > > > +Contact: Prashant Malani > > > > > > +Description: > > > > > > + Product Type VDOs part of Discover Identity command result. 3 values > > > > > > + are displayed (for the 3 possible Product Type VDOs), one per line. > > > > > > > > > > sysfs is "one value per file", not "one value per line". This is not > > > > > ok. > > > > > > > > I see. Would listing these out as three separate vdos (i.e vdo0, vdo1, > > > > vdo2) be better? > > > > > > Given that your current implementation is not acceptable, something has > > > to change :) > > > > Got it. I'd like to see if Heikki has any suggestions on naming these > > entries better. > > Why not have product type specific attribute files? > > So if the partner is UFP, then we expose ufp1 and ufp2 files that > return the UFP1 and UFP2 VDO values and hide the other files: > > % ls /sys/class/typec/port0-partner/identity/ > id_header cert_stat product ufp1 ufp2 > > If the partner is DFP, then you expose the dfp file and hide > everything else: > > % ls /sys/class/typec/port0-partner/identity/ > id_header cert_stat product dfp > > And so on. I would caution against any decoding of the VDO contents in the kernel and making assumptions about the # or the names of these three individual objects. Since PD 2.0 through PD 3.0, and PD 3.0's different subrevisions (1.0, 1.3, 2.0), the # of VDOs that have been supported has changed in the various spec versions. PD R3.0 V2.0 actually added extra objects here (UFP VDO1 UFP VDO2, DFP VDO), but thanks to some troublemaker (me, actually...), the PD spec's next version deprecates and deletes two of them (the AMA VDO and the UFP VDO2 are gone, thanks to an ECR I put into USB PD). (If you've got USB PD working group access, the two ECRs in question are: https://groups.usb.org/wg/powerdelivery/document/11007 and https://groups.usb.org/wg/powerdelivery/document/10967). Since the different spec versions need to all be supported (since the firmware of PD devices are baked for a particular version of the PD spec at the time they are released and don't change in practice), the software on USB PD hosts should provide these objects up to the next layer without adding any extra decoding, and the upper layer (userspace) can figure out the specifics based on comparing different revision and version fields to figure out what vdo1, vdo2, and vdo3 are. Anyway, hope this helps, and sorry in advance for making this section of the PD spec more complicated to handle over time... Benson > > thanks, > > -- > heikki -- Benson Leung Staff Software Engineer Chrome OS Kernel Google Inc. bleung@google.com Chromium OS Project bleung@chromium.org