From mboxrd@z Thu Jan 1 00:00:00 1970 From: Adam Thomson Subject: [PATCH v4 0/7] typec: tcpm: Add sink side support for PPS Date: Tue, 2 Jan 2018 15:50:48 +0000 Message-ID: Mime-Version: 1.0 Content-Type: text/plain Return-path: Sender: linux-kernel-owner@vger.kernel.org To: Heikki Krogerus , Guenter Roeck , Greg Kroah-Hartman , Sebastian Reichel , Hans de Goede , Yueyao Zhu , Rui Miguel Silva Cc: linux-usb@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, support.opensource@diasemi.com List-Id: linux-pm@vger.kernel.org This patch set adds sink side support for the PPS feature introduced in the USB PD 3.0 specification. The source PPS supply is represented using the Power Supply framework to provide access and control APIs for dealing with it's operating voltage and current, and switching between a standard PDO and PPS APDO operation. During standard PDO operation the voltage and current is read-only, but for APDO PPS these are writable as well to allow for control. It should be noted that the keepalive for PPS is not handled within TCPM. The expectation is that the external user will be required to ensure re-requests occur regularly to ensure PPS remains and the source does not hard reset. Changes in v4: - For PD 3.0 definitions patch, make it benign with regards to existing TCPM code so build isn't broken if this one patch is applied, as suggested by kbuild robot. Update for dynamic revision is moved to be part of sink side PPS support patch. - Use PTR_ERR_OR_ZERO macro to simplify return of devm_tcpm_psy_register() function, as suggested by kbuild robot. - Make devm_tcpm_psy_register() static as not used outside this file. Changes in v3: - Drop 'RFC' from patch series titles - Rename PPS related defines to be PPS specific rather than generic APDO titles - Update source caps logging to only print PPS APDOs, and for others report as undefined. - Add ABI documentation for tcpm-source-psy sysfs properties - Rebase PDO selection on top of 'typec: tcpm: Only request matching pdos' patch. - Update capabilities validation introduced in 'typec: tcpm: Validate source and sink caps' to support PPS APDOs. - Dropped power_supply 'type' property update for PPS addition - Added 'connected_type' property to power_supply framework, to support supplies which can report multiple connected types (e.g. USB), as discussed with Heikki. Changes in v2: - Use USB_PD and usb_pd prefixes for macros and inline functions in headers. - Negotiate spec revision of PD headers during initial contract agreement. - New headers now use SPDX tags for referencing correct license. NOTE: Code changes are based on linux-next tag 'next-20171212' to pick up capabilities validation and selection updates. Adam Thomson (7): typec: tcpm: Add PD Rev 3.0 definitions to PD header typec: tcpm: Add ADO header for Alert message handling typec: tcpm: Add SDB header for Status message handling typec: tcpm: Add core support for sink side PPS power: supply: Add 'connected_type' property and supporting code typec: tcpm: Represent source supply through power_supply class typec: tcpm: Add support for sink PPS related messages .../ABI/testing/sysfs-class-power-tcpm-source-psy | 92 +++ drivers/power/supply/power_supply_sysfs.c | 50 ++ drivers/usb/typec/Kconfig | 1 + drivers/usb/typec/fusb302/Kconfig | 2 +- drivers/usb/typec/fusb302/fusb302.c | 63 +- drivers/usb/typec/tcpm.c | 916 ++++++++++++++++++++- include/linux/power_supply.h | 15 + include/linux/usb/pd.h | 187 ++++- include/linux/usb/pd_ado.h | 42 + include/linux/usb/pd_ext_sdb.h | 31 + include/linux/usb/tcpm.h | 2 +- 11 files changed, 1306 insertions(+), 95 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-class-power-tcpm-source-psy create mode 100644 include/linux/usb/pd_ado.h create mode 100644 include/linux/usb/pd_ext_sdb.h -- 1.9.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751446AbeABPu4 (ORCPT + 1 other); Tue, 2 Jan 2018 10:50:56 -0500 Received: from mail1.bemta5.messagelabs.com ([195.245.231.152]:49502 "EHLO mail1.bemta5.messagelabs.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751190AbeABPuw (ORCPT ); Tue, 2 Jan 2018 10:50:52 -0500 X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrNIsWRWlGSWpSXmKPExsUSt3OpsW7kKu8 og23HdCyaF69ns3hzfDqTRdfqnSwWl3fNYbP43HuE0WLRslZmiycLzzBZNC54z2JxeneJxZ/n t9gcuDx2zrrL7rFpVSebx7yTgR77565h93i/7yqbx87vDewenzfJBbBHsWbmJeVXJLBmLFzWz VrQK1Ox5GILUwPjd9EuRk4OIYF1jBIT3it3MXIA2RUSl5elgJi8Am4SM87YglSwCVhITD7xgA 3EZhFQkViy/DQriC0s4CQx/fFH5i5GLg4RgXlMEq823AUrYhaok+j9/ZYFxOYVEJQ4OfMJC0R cQuLgixfMEGsNJE4vaASLSwjYS0x/f5UZZK+EgL5E47FYiLChxPdZ36BKzCV23L7BOoGRfxaS qbOQTF3AyLSKUaM4tagstUjXyEgvqSgzPaMkNzEzR9fQwFQvN7W4ODE9NScxqVgvOT93EyMw8 OsZGBh3MO5p9zvEKMnBpCTKm5PqHSXEl5SfUpmRWJwRX1Sak1p8iFGDg0Og5eLJg0xSLHn5ea lKEry3VwDVCRalpqdWpGXmAGMTplSCg0dJhPcdSJq3uCAxtzgzHSJ1ilGX49nM1w3MQmAzpMR 5eVYCFQmAFGWU5sGNgKWJS4yyUsK8jAwMDEI8BalFuZklqPKvGMU5GJWEed+DrOLJzCuB2/QK 6AgmoCP+nPcEOaIkESEl1cB44NakiRv2hdx5Z8730flgya29oQvPaHwx9pb45Dql/ZzvIVUXb 9e52rpbMg/ybNpfK3B5+qIj3x2iDnWq7+w8JsPTo1T0rd176xztXVwFFamH1p5lbGxgCdFI0b fpOCZ4rNHs8pdmj5dKl5MOai791/7B5kJAvHb00bI03QqV03G/zpz7fjtXiaU4I9FQi7moOBE A31ONmA4DAAA= X-Env-Sender: Adam.Thomson.Opensource@diasemi.com X-Msg-Ref: server-7.tower-179.messagelabs.com!1514908249!108298789!1 X-Originating-IP: [94.185.165.51] X-StarScan-Received: X-StarScan-Version: 9.4.45; banners=-,-,- X-VirusChecked: Checked Message-ID: From: Adam Thomson Date: Tue, 2 Jan 2018 15:50:48 +0000 Subject: [PATCH v4 0/7] typec: tcpm: Add sink side support for PPS To: Heikki Krogerus , Guenter Roeck , Greg Kroah-Hartman , Sebastian Reichel , Hans de Goede , Yueyao Zhu , Rui Miguel Silva CC: , , , MIME-Version: 1.0 Content-Type: text/plain X-KSE-AttachmentFiltering-Interceptor-Info: protection disabled X-KSE-ServerInfo: sw-ex-cashub01.diasemi.com, 9 X-KSE-Antivirus-Interceptor-Info: scan successful X-KSE-Antivirus-Info: Clean, bases: 02/01/2018 11:56:00 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Return-Path: This patch set adds sink side support for the PPS feature introduced in the USB PD 3.0 specification. The source PPS supply is represented using the Power Supply framework to provide access and control APIs for dealing with it's operating voltage and current, and switching between a standard PDO and PPS APDO operation. During standard PDO operation the voltage and current is read-only, but for APDO PPS these are writable as well to allow for control. It should be noted that the keepalive for PPS is not handled within TCPM. The expectation is that the external user will be required to ensure re-requests occur regularly to ensure PPS remains and the source does not hard reset. Changes in v4: - For PD 3.0 definitions patch, make it benign with regards to existing TCPM code so build isn't broken if this one patch is applied, as suggested by kbuild robot. Update for dynamic revision is moved to be part of sink side PPS support patch. - Use PTR_ERR_OR_ZERO macro to simplify return of devm_tcpm_psy_register() function, as suggested by kbuild robot. - Make devm_tcpm_psy_register() static as not used outside this file. Changes in v3: - Drop 'RFC' from patch series titles - Rename PPS related defines to be PPS specific rather than generic APDO titles - Update source caps logging to only print PPS APDOs, and for others report as undefined. - Add ABI documentation for tcpm-source-psy sysfs properties - Rebase PDO selection on top of 'typec: tcpm: Only request matching pdos' patch. - Update capabilities validation introduced in 'typec: tcpm: Validate source and sink caps' to support PPS APDOs. - Dropped power_supply 'type' property update for PPS addition - Added 'connected_type' property to power_supply framework, to support supplies which can report multiple connected types (e.g. USB), as discussed with Heikki. Changes in v2: - Use USB_PD and usb_pd prefixes for macros and inline functions in headers. - Negotiate spec revision of PD headers during initial contract agreement. - New headers now use SPDX tags for referencing correct license. NOTE: Code changes are based on linux-next tag 'next-20171212' to pick up capabilities validation and selection updates. Adam Thomson (7): typec: tcpm: Add PD Rev 3.0 definitions to PD header typec: tcpm: Add ADO header for Alert message handling typec: tcpm: Add SDB header for Status message handling typec: tcpm: Add core support for sink side PPS power: supply: Add 'connected_type' property and supporting code typec: tcpm: Represent source supply through power_supply class typec: tcpm: Add support for sink PPS related messages .../ABI/testing/sysfs-class-power-tcpm-source-psy | 92 +++ drivers/power/supply/power_supply_sysfs.c | 50 ++ drivers/usb/typec/Kconfig | 1 + drivers/usb/typec/fusb302/Kconfig | 2 +- drivers/usb/typec/fusb302/fusb302.c | 63 +- drivers/usb/typec/tcpm.c | 916 ++++++++++++++++++++- include/linux/power_supply.h | 15 + include/linux/usb/pd.h | 187 ++++- include/linux/usb/pd_ado.h | 42 + include/linux/usb/pd_ext_sdb.h | 31 + include/linux/usb/tcpm.h | 2 +- 11 files changed, 1306 insertions(+), 95 deletions(-) create mode 100644 Documentation/ABI/testing/sysfs-class-power-tcpm-source-psy create mode 100644 include/linux/usb/pd_ado.h create mode 100644 include/linux/usb/pd_ext_sdb.h -- 1.9.1