From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Cyrus-Session-Id: sloti22d1t05-2013988-1517317916-2-11544648555803359507 X-Sieve: CMU Sieve 3.0 X-Spam-known-sender: no X-Spam-score: 0.0 X-Spam-hits: BAYES_00 -1.9, HEADER_FROM_DIFFERENT_DOMAINS 0.001, ME_NOAUTH 0.01, RCVD_IN_DNSWL_HI -5, T_RP_MATCHES_RCVD -0.01, LANGUAGES en, BAYES_USED global, SA_VERSION 3.4.0 X-Spam-source: IP='209.132.180.67', Host='vger.kernel.org', Country='US', FromHeader='com', MailFrom='org' X-Spam-charsets: plain='us-ascii' X-Resolved-to: greg@kroah.com X-Delivered-to: greg@kroah.com X-Mail-from: linux-usb-owner@vger.kernel.org ARC-Seal: i=1; a=rsa-sha256; cv=none; d=messagingengine.com; s=arctest; t=1517317916; b=dTcTnPfS0rUDYlHaMYl9zXoSZtQ+udcoGNHg8fa+u0LdgNm /GIxIWdVYzExRVkU4yn96QAzNIRz9h0YEU5TsGkbFHQzuOFcFmpMOgIfCuI+OW/L lY4NpqTXf5Jrjww1agWA9u5Nj1acmIxoMxUX5yTRmyaLokIJ1vLKF70IDPU+RhSj QU1x88VWVYrMbjg5Li7n9S1eQdhzYADBoCRCoWNgR47dcFB6bCGBw9kplHSm3A6V 7olTbhGOxqCP0r25mqtGeu9Me4K3t8qCdFpAa/64meFAb3SRLPIxgQe+pObHBzfR cOv6b8FsUKxbBZ/6fOxW3WorUNkc/XpTVtOzFyg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=date:from:to:cc:subject:message-id :references:mime-version:content-type:in-reply-to:sender :list-id; s=arctest; t=1517317916; bh=5J8uOMDF07Egszlrp6K0glQMis WeUeEob0EekBRi9P8=; b=GdUCNMDkXXhrk+W5sJpkpyQiXb909DuNeqDcUIHWXS TFFMVCybtgg/Gx2Wvjj84IuVDHa17v3AKvwd1BGCONRDxe+BLqHMpekvTZzWLzrZ o2eWdlYM6LXUatixgMlu4Wvgod4b1h8n9AdvLL4vVBEuZXdVqQoqpDxSWTnsk2Bw 9ZB43rp8L1qSNg2NeKWf+esjTzHK7+LqxInHp8lSnNqZAyF288PBdpXXnHDs3Xyo stwx+huDLmszGRrCCD2IUIvwEj7twIIAWs9reHi/p2YtRBEl8bHD9VMk5mE6bDtp SgKdP/hJ3KXseyHUA9WJNfKVRz+lZU9kf2RuWbw/7B4A== ARC-Authentication-Results: i=1; mx2.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=linux.intel.com; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); spf=none smtp.mailfrom=linux-usb-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=fail; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=linux.intel.com header.result=pass header_org.domain=intel.com header_org.result=pass header_is_org_domain=no Authentication-Results: mx2.messagingengine.com; arc=none (no signatures found); dkim=none (no signatures found); dmarc=none (p=none,has-list-id=yes,d=none) header.from=linux.intel.com; iprev=pass policy.iprev=209.132.180.67 (vger.kernel.org); spf=none smtp.mailfrom=linux-usb-owner@vger.kernel.org smtp.helo=vger.kernel.org; x-aligned-from=fail; x-ptr=pass x-ptr-helo=vger.kernel.org x-ptr-lookup=vger.kernel.org; x-return-mx=pass smtp.domain=vger.kernel.org smtp.result=pass smtp_org.domain=kernel.org smtp_org.result=pass smtp_is_org_domain=no header.domain=linux.intel.com header.result=pass header_org.domain=intel.com header_org.result=pass header_is_org_domain=no Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752187AbeA3NLi (ORCPT ); Tue, 30 Jan 2018 08:11:38 -0500 Received: from mga09.intel.com ([134.134.136.24]:3337 "EHLO mga09.intel.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751666AbeA3NLg (ORCPT ); Tue, 30 Jan 2018 08:11:36 -0500 X-Amp-Result: UNSCANNABLE X-Amp-File-Uploaded: False X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.46,435,1511856000"; d="scan'208";a="26623563" Date: Tue, 30 Jan 2018 15:11:31 +0200 From: Heikki Krogerus To: Adam Thomson Cc: Guenter Roeck , Greg Kroah-Hartman , Sebastian Reichel , Hans de Goede , Yueyao Zhu , Rui Miguel Silva , linux-usb@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, support.opensource@diasemi.com Subject: Re: [PATCH v4 6/7] typec: tcpm: Represent source supply through power_supply class Message-ID: <20180130131131.GF14922@kuha.fi.intel.com> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.9.1 (2017-09-22) Sender: linux-usb-owner@vger.kernel.org X-Mailing-List: linux-usb@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-Mailing-List: linux-kernel@vger.kernel.org List-ID: Hi Adam, On Tue, Jan 02, 2018 at 03:50:54PM +0000, Adam Thomson wrote: > This commit adds a power_supply class instance to represent a > PD source's voltage and current properties. This provides an > interface for reading these properties from user-space or other > drivers. > > For PPS enabled Sources, this also provides write access to set > the current and voltage and allows for swapping between standard > PDO and PPS APDO. > > As this represents a superset of the information provided in the > fusb302 driver, the power_supply instance in that code is removed > as part of this change, so reverting the commit titled > 'typec: tcpm: Represent source supply through power_supply class' > Signed-off-by: Adam Thomson > --- > .../ABI/testing/sysfs-class-power-tcpm-source-psy | 92 ++++++++ > drivers/usb/typec/Kconfig | 1 + > drivers/usb/typec/fusb302/Kconfig | 2 +- > drivers/usb/typec/fusb302/fusb302.c | 63 +----- > drivers/usb/typec/tcpm.c | 233 ++++++++++++++++++++- > 5 files changed, 328 insertions(+), 63 deletions(-) > create mode 100644 Documentation/ABI/testing/sysfs-class-power-tcpm-source-psy > > diff --git a/Documentation/ABI/testing/sysfs-class-power-tcpm-source-psy b/Documentation/ABI/testing/sysfs-class-power-tcpm-source-psy > new file mode 100644 > index 0000000..4986cba > --- /dev/null > +++ b/Documentation/ABI/testing/sysfs-class-power-tcpm-source-psy > @@ -0,0 +1,92 @@ > +What: /sys/class/power_supply/tcpm-source-psy/type > +Date: December 2017 > +Contact: Adam Thomson > +Description: > + This read-only property describes the main type of source supply. > + Type-C is a USB standard so this property always returns "USB". > + > +What: /sys/class/power_supply/tcpm-source-psy/connected_type > +Date: December 2017 > +Contact: Adam Thomson > +Description: > + This read-only property describes the type of source supply that is > + connected, if the supply is online. The value is always Type C > + unless a source has been attached which is identified as USB-PD capable. > + > + Valid values: > + - "USB_TYPE_C" : Type C connected supply, not UBS-PD capable > + (default value) > + - "USB_PD" : USB-PD capable source supply connected > + - "USB_PD_PPS" : USB-PD PPS capable source supply connected > + > +What: /sys/class/power_supply/tcpm-source-psy/online > +Date: December 2017 > +Contact: Adam Thomson > +Description: > + This read-write property describes the online state of the source > + supply. When the value of this property is not 0, and the supply allows > + it, then it's possible to switch between online states (i.e. 1 -> 2, > + 2 -> 1) > + > + Valid values: > + - 0 : Offline, no source supply attached > + - 1 : Fixed Online, Type-C or USB-PD capable supply > + attached, non-configurable current and voltage > + properties in this state. > + - 2 : PPS Online, USB-PD PPS feature enabled, 'current_now' > + and 'voltage_now' properties can be modified in this > + state. Re-writing of this value again, once already > + set, will re-request the same configured voltage and > + current values. This can be used as a keep-alive for > + the PPS connection. > + [NOTE: This is value only selectable if > + 'connected_type' reports a value of "USB_PD_PPS"] > + > +What: /sys/class/power_supply/tcpm-source-psy/voltage_min > +Date: December 2017 > +Contact: Adam Thomson > +Description: > + This read-only property describes the minimum voltage the source supply > + can provide. > + > + Value in microvolts. > + > +What: /sys/class/power_supply/tcpm-source-psy/voltage_max > +Date: December 2017 > +Contact: Adam Thomson > +Description: > + This read-only property describes the maximum voltage the source supply > + can provide. > + > + Value in microvolts. > + > +What: /sys/class/power_supply/tcpm-source-psy/voltage_now > +Date: December 2017 > +Contact: Adam Thomson > +Description: > + This read-write property describes the voltage the source supply is > + providing now. This property can only be written to if the source supply > + is in online state '2' (PPS enabled), otherwise it's read-only > + information. > + > + Value in microvolts. > + > +What: /sys/class/power_supply/tcpm-source-psy/current_max > +Date: December 2017 > +Contact: Adam Thomson > +Description: > + This read-only property describes the maximum current the source supply > + can provide. > + > + Value in microamps. > + > +What: /sys/class/power_supply/tcpm-source-psy/current_now > +Date: December 2017 > +Contact: Adam Thomson > +Description: > + This read-write property describes the current the source supply can > + provide now. This property can only be written to if the source supply > + is in online state '2' (PPS enabled), otherwise it's read-only > + information. > + > + Value in microamps. I think those should be documented for the entire psy class, not just for this driver. > diff --git a/drivers/usb/typec/Kconfig b/drivers/usb/typec/Kconfig > index bcb2744..1ef606d 100644 > --- a/drivers/usb/typec/Kconfig > +++ b/drivers/usb/typec/Kconfig > @@ -48,6 +48,7 @@ if TYPEC > config TYPEC_TCPM > tristate "USB Type-C Port Controller Manager" > depends on USB > + select POWER_SUPPLY I'm a little bit uncomfortable with such a strong dependency on an other subsystem that we may not always need, but let's see what Guenter says. Thanks, -- heikki