From patchwork Fri Sep 28 23:47:01 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Badhri Jagan Sridharan X-Patchwork-Id: 10620561 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 99835913 for ; Fri, 28 Sep 2018 23:47:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 730B12B90F for ; Fri, 28 Sep 2018 23:47:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 642E82BB17; Fri, 28 Sep 2018 23:47:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3D3C62B90F for ; Fri, 28 Sep 2018 23:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727295AbeI2GNP (ORCPT ); Sat, 29 Sep 2018 02:13:15 -0400 Received: from mail-io1-f74.google.com ([209.85.166.74]:50457 "EHLO mail-io1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727216AbeI2GNP (ORCPT ); Sat, 29 Sep 2018 02:13:15 -0400 Received: by mail-io1-f74.google.com with SMTP id z25-v6so7406616iog.17 for ; Fri, 28 Sep 2018 16:47:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:message-id:mime-version:subject:from:to:cc; bh=WYhEGWFlZp8I00fOpL04YdCTY1rewGNsa3hhi7x38fI=; b=hkOqPqY6CorgJ4JDlZP7VJpetlKZAbmVH/w7SZ6IhA/I7zCiTHAi9LiNPCyTb9oI2s lxjGcJc8CFQ0B0zwd2Q7/33qzCZM7PBHlvqnxnlEPkNxRRYcgTs1Hrta3I6CxaDMqjBN bJ5sj89LlhilWwQMUbOTRYHPpMLAVBVPZ88Qcpn/qdiy4kH7TiyNWQVy7c732S6sp1t7 tU95KAeoyjADInl+7dGjH9uJZ/GUgC96A2WaQZfrhSYlfjb4h4YZoMXCKXvnlt5Zv8S5 iZUcywCuJCfM9505uXd0xnWxiTBIl020EjuB7B5dyPTHvxOnHgSVm3ebPdNvwfujly/2 ywWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:message-id:mime-version:subject:from:to:cc; bh=WYhEGWFlZp8I00fOpL04YdCTY1rewGNsa3hhi7x38fI=; b=RGpC9MkmjdlwcjqD070hlDzfY9SLBs/1T6PhVfvnViBtEI48srlCoNXz0PX2rbjihv yV6hLBVx6mhnN18i/YcuJlruCXaae49HeKZCpBJHd/Han85e5YKhb5COrwYsO0u50zDe ygwl8w/Uj6xolxRrKeMu9md+0HMu1lElpqMI/aHFyrJQRSmrRZtVuq64OhFbZwwH3qpM xOHS0YSRf/DT8qYA1eaN4uLjFEXiW481HQNURy8PiOSlPpExJdLi+30HTiYaumu5D/GL l3MRkWHSCldP1TfUwbqN1JIzZAbaj4VxB2qQ8k89TsjN61K2kNXfWmxZw2SRifigi0Sv Vcnw== X-Gm-Message-State: ABuFfohUdARYw1YqKegkeiXiCjwd/kPkg1lUfWfO9pJoQse3YWwYDUdN Qv/WdzjryfePfWAQyHECKBG41Vu+rwM= X-Google-Smtp-Source: ACcGV61g7rrQxKfWIvtPXvSVn+MwINlXGHoXUpuAaq9awaH6fZPuEyNrvr+s465Yw1+yZufP2gnFDzqq0Oo= X-Received: by 2002:a24:6794:: with SMTP id u142-v6mr197776itc.9.1538178428213; Fri, 28 Sep 2018 16:47:08 -0700 (PDT) Date: Fri, 28 Sep 2018 16:47:01 -0700 Message-Id: <20180928234703.15970-1-badhri@google.com> Mime-Version: 1.0 X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog Subject: [PATCH 1/3] [PATCH 1/3] dt-bindings: connector: Add self-powered property From: Badhri Jagan Sridharan To: Rob Herring , Mark Rutland , Heikki Krogerus , Greg Kroah-Hartman , Chanwoo Choi , Andrzej Hajda , Li Jun , linux@roeck-us.net Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Badhri Jagan Sridharan Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From USB_PD_R3_0 7.1.5 Response to Hard Resets Device operation during and after a Hard Reset is defined as follows: Self-powered devices Should Not disconnect from USB during a Hard Reset (see Section 9.1.2). Bus powered devices will disconnect from USB during a Hard Reset due to the loss of their power source. Therefore it is necessary to know whether the port belongs to a device which is self powered or bus powered. This change adds "self-powered" flag to the connector class which present indicates that the port belongs to a device that is self powered. Else it is bus powered usb device. Signed-off-by: Badhri Jagan Sridharan --- Documentation/devicetree/bindings/connector/usb-connector.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Documentation/devicetree/bindings/connector/usb-connector.txt b/Documentation/devicetree/bindings/connector/usb-connector.txt index 8855bfcfd7785..8f7a36ae29bf7 100644 --- a/Documentation/devicetree/bindings/connector/usb-connector.txt +++ b/Documentation/devicetree/bindings/connector/usb-connector.txt @@ -14,6 +14,8 @@ Optional properties: - label: symbolic name for the connector, - type: size of the connector, should be specified in case of USB-A, USB-B non-fullsize connectors: "mini", "micro". +- self-powered: Set this property if the usb device that has its own power + source. Optional properties for usb-c-connector: - power-role: should be one of "source", "sink" or "dual"(DRP) if typec From patchwork Fri Sep 28 23:47:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Badhri Jagan Sridharan X-Patchwork-Id: 10620563 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id DA703913 for ; Fri, 28 Sep 2018 23:47:25 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CAB032B90F for ; Fri, 28 Sep 2018 23:47:25 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE7A62BB03; Fri, 28 Sep 2018 23:47:25 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5E65B2B919 for ; Fri, 28 Sep 2018 23:47:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727469AbeI2GN0 (ORCPT ); Sat, 29 Sep 2018 02:13:26 -0400 Received: from mail-io1-f74.google.com ([209.85.166.74]:42967 "EHLO mail-io1-f74.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727399AbeI2GNU (ORCPT ); Sat, 29 Sep 2018 02:13:20 -0400 Received: by mail-io1-f74.google.com with SMTP id m13-v6so7663036ioq.9 for ; Fri, 28 Sep 2018 16:47:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=VGBPC0+5MfgBeTwcQV7UNeHMjUpPM219+NLcZ6XjGzQ=; b=TTZVld6gH0rnDFS07wFl5BIabshz9wyHmQX1fIo59S4A+1ZXrwnvYEpoZEVoGLJKwN h7+ESC88kRrkaSfL3Dc0xlaE71v5ySVTtrWmUlM3xyOqs0HRhtLL7Gfne+VRIzN7b628 XVO4ud+Oo9zx3HNKIhBgGDm9YHyFduIHOK1+5f0BpDYT5p5QLr6xp0fDzoi+QtZ9bLWs YtjFDVFlhdd7WGTPJ2Adl9Gf04C2I7a8Ic6ggHu/tAY7UPDIyoGqz9eI3e1ndnWGGoh0 Mru1l5vNV/mM+GaC4xgTmltnav6sAlj2zH++dtep0hkYnXIBuhEMdcFfoYTNx2KhaUYx M6yA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=VGBPC0+5MfgBeTwcQV7UNeHMjUpPM219+NLcZ6XjGzQ=; b=TZG/mxjMyUlrotRrJKzyw+eq11p4I3udrC5hMQUn89dgujla08OeuzZmVTUf8PlD6g WU8Aa7xrMEBBjfTbQs7CJRu0gHvA7cfnwxtZuZ05mZFOm9LIwJXy45Sc+e7CbrowPOZy k3vOea36n208Eeu/5qI6hgbAFUKkfgobAl2G3W/+enWTYjFOYFyviV70f5mgBVf5Tgti 3R1+IRjN6qiTX5BCJpI56MezgepWq5HWMelSOtIX0HAjhiT5So+5F4peD2+eTpmbK6/1 doMfzjFJUyLy44i+V67pAJQbeZWBal3NKk7E9JPR9qvShkdZMChLjinKM3RoZhN5M29H 4v1A== X-Gm-Message-State: ABuFfogHOgy7snnxm4DCBM3Md2Jz0R5r+J2enOXbyUsfQmHH9icGap+P dOqR/a6GQi2XW7neU4adKgQJvJ4TlYI= X-Google-Smtp-Source: ACcGV61EoIXoXQ3l/UoDyCC1vOcEIp5oOqNhIgZlbcfMkBRfrbWhNhCXjp8uaFVRUKwFqpCELVuJmRi1MC8= X-Received: by 2002:a24:2414:: with SMTP id f20-v6mr3495212ita.0.1538178433353; Fri, 28 Sep 2018 16:47:13 -0700 (PDT) Date: Fri, 28 Sep 2018 16:47:02 -0700 In-Reply-To: <20180928234703.15970-1-badhri@google.com> Message-Id: <20180928234703.15970-2-badhri@google.com> Mime-Version: 1.0 References: <20180928234703.15970-1-badhri@google.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog Subject: [PATCH 2/3] [PATCH v2 2/3] usb: typec: tcpm: Do not disconnect link for self powered devices From: Badhri Jagan Sridharan To: Rob Herring , Mark Rutland , Heikki Krogerus , Greg Kroah-Hartman , Chanwoo Choi , Andrzej Hajda , Li Jun , linux@roeck-us.net Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Badhri Jagan Sridharan Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP During HARD_RESET the data link is disconnected. For self powered device, the spec is advising against doing that. From USB_PD_R3_0 7.1.5 Response to Hard Resets Device operation during and after a Hard Reset is defined as follows: Self-powered devices Should Not disconnect from USB during a Hard Reset (see Section 9.1.2). Bus powered devices will disconnect from USB during a Hard Reset due to the loss of their power source. Tackle this by letting TCPM know whether the device is self or bus powered. This overcomes unnecessary port disconnections from hard reset. Also, speeds up the enumeration time when connected to Type-A ports. Signed-off-by: Badhri Jagan Sridharan --------- Version history: V2: Based on feedback from heikki.krogerus@linux.intel.com - self_powered added to the struct tcpm_port which is populated from a. "connector" node of the device tree in tcpm_fw_get_caps() b. "self_powered" node of the tcpc_config in tcpm_copy_caps Based on feedbase from linux@roeck-us.net - Code was refactored - SRC_HARD_RESET_VBUS_OFF sets the link state to false based on self_powered flag V1 located here: https://lkml.org/lkml/2018/9/13/94 Reviewed-by: Guenter Roeck Reviewed-by: Heikki Krogerus --- drivers/usb/typec/tcpm.c | 12 ++++++++++-- include/linux/usb/tcpm.h | 1 + 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c index 4f1f4215f3d6e..c3ac0e46106b4 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -317,6 +317,9 @@ struct tcpm_port { /* Deadline in jiffies to exit src_try_wait state */ unsigned long max_wait; + /* port belongs to a self powered device */ + bool self_powered; + #ifdef CONFIG_DEBUG_FS struct dentry *dentry; struct mutex logbuffer_lock; /* log buffer access lock */ @@ -3257,7 +3260,8 @@ static void run_state_machine(struct tcpm_port *port) case SRC_HARD_RESET_VBUS_OFF: tcpm_set_vconn(port, true); tcpm_set_vbus(port, false); - tcpm_set_roles(port, false, TYPEC_SOURCE, TYPEC_HOST); + tcpm_set_roles(port, port->self_powered, TYPEC_SOURCE, + TYPEC_HOST); tcpm_set_state(port, SRC_HARD_RESET_VBUS_ON, PD_T_SRC_RECOVER); break; case SRC_HARD_RESET_VBUS_ON: @@ -3270,7 +3274,8 @@ static void run_state_machine(struct tcpm_port *port) memset(&port->pps_data, 0, sizeof(port->pps_data)); tcpm_set_vconn(port, false); tcpm_set_charge(port, false); - tcpm_set_roles(port, false, TYPEC_SINK, TYPEC_DEVICE); + tcpm_set_roles(port, port->self_powered, TYPEC_SINK, + TYPEC_DEVICE); /* * VBUS may or may not toggle, depending on the adapter. * If it doesn't toggle, transition to SNK_HARD_RESET_SINK_ON @@ -4409,6 +4414,8 @@ static int tcpm_fw_get_caps(struct tcpm_port *port, return -EINVAL; port->operating_snk_mw = mw / 1000; + port->self_powered = fwnode_property_read_bool(fwnode, "self-powered"); + return 0; } @@ -4717,6 +4724,7 @@ static int tcpm_copy_caps(struct tcpm_port *port, port->typec_caps.prefer_role = tcfg->default_role; port->typec_caps.type = tcfg->type; port->typec_caps.data = tcfg->data; + port->self_powered = port->tcpc->config->self_powered; return 0; } diff --git a/include/linux/usb/tcpm.h b/include/linux/usb/tcpm.h index 7e7fbfb84e8e3..50c74a77db55c 100644 --- a/include/linux/usb/tcpm.h +++ b/include/linux/usb/tcpm.h @@ -89,6 +89,7 @@ struct tcpc_config { enum typec_port_data data; enum typec_role default_role; bool try_role_hw; /* try.{src,snk} implemented in hardware */ + bool self_powered; /* port belongs to a self powered device */ const struct typec_altmode_desc *alt_modes; }; From patchwork Fri Sep 28 23:47:03 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Badhri Jagan Sridharan X-Patchwork-Id: 10620565 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 2886D6CB for ; Fri, 28 Sep 2018 23:47:29 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 19DFA2B90F for ; Fri, 28 Sep 2018 23:47:29 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0D9482BB15; Fri, 28 Sep 2018 23:47:29 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.5 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI, USER_IN_DEF_DKIM_WL autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 98C9F2B90F for ; Fri, 28 Sep 2018 23:47:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727508AbeI2GNb (ORCPT ); Sat, 29 Sep 2018 02:13:31 -0400 Received: from mail-pf1-f202.google.com ([209.85.210.202]:54778 "EHLO mail-pf1-f202.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727474AbeI2GNa (ORCPT ); Sat, 29 Sep 2018 02:13:30 -0400 Received: by mail-pf1-f202.google.com with SMTP id r67-v6so3372060pfd.21 for ; Fri, 28 Sep 2018 16:47:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20161025; h=date:in-reply-to:message-id:mime-version:references:subject:from:to :cc; bh=Bkui6iSebkHx1Pu/R15EYWWA4zHQ+9B38oYC3sD//6o=; b=sE+oeyJY30ic3FHYY+smQoR4/jYzJ2E91PND7YCl1IM8oyvJ4+dt555MSulAOaCSCQ Vpzel0v4GlyCyaaF5iRF18oJjU5VKq1Le5GuocdGXzZB4IWmgvn9JG3pzfRjHT5ElM5u vU+LSVOGdk/fwrDFd7YshAvq68QMH1+h2KFySeIgLoQrwsd6qo7S9Y0FPS1z3ij0u7iK e31bXTezWAaUdDo6r1f1+gaIlYT/SLskoNXzcq/alL8+tFP5yYkceiGjHVAtlNSJCgnU i8YBf9cpDeHT+RsHBTCDY17WfFy4oGs+chVfFYjnTWCVrRRJRwKuVVN5lgyA1Pfb5mgv Wsew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:in-reply-to:message-id:mime-version :references:subject:from:to:cc; bh=Bkui6iSebkHx1Pu/R15EYWWA4zHQ+9B38oYC3sD//6o=; b=Lv98SsbLjZoPf13FFW+WAlZvUfiZMCL0krHXHVjZ9BD35um3B1xx90HWSseHiW6zII o6VGiH0SMw/M6R9K6VSrDY/aRLeeKy+R5FjFCQ0FYpDzir2mW3mn751Cd64jPSVzRa/a oD6ZuQxWkrJ9vsJz329AVYInboik9Ddm23hkrDRl9HyRBlQWtX4x3QzMO+tgmNN3EnPc 3LQ9exI14aWEuU8mtr1YuZXHpU10pk1bMX3wAQ5xrQWaKzyZ6sm+XT5v9TDV93BGw6WI lOQYV2kP0OPMK2T9apWIFDP+0afx3aZXSMQN6wh+zniynU0YY0fXRCUPgL07wSnsTVFP iAKw== X-Gm-Message-State: ABuFfoiWi8PnpPhqYGRPQFKQth9SyKmX1kc4fOqNOo0i16/8dXiqXp1u bjN4ClDDyooA6K7TWMLDBXXNuj+rsC0= X-Google-Smtp-Source: ACcGV63VsFcMFj6qWgBSoJ8TfgCgV94sjrDU4D70rZl0WZ5qlmMR6GHI5OABlcJmgjaFuvRvjEB2V+fKOqQ= X-Received: by 2002:a65:60cc:: with SMTP id r12-v6mr794209pgv.78.1538178443346; Fri, 28 Sep 2018 16:47:23 -0700 (PDT) Date: Fri, 28 Sep 2018 16:47:03 -0700 In-Reply-To: <20180928234703.15970-1-badhri@google.com> Message-Id: <20180928234703.15970-3-badhri@google.com> Mime-Version: 1.0 References: <20180928234703.15970-1-badhri@google.com> X-Mailer: git-send-email 2.19.0.605.g01d371f741-goog Subject: [PATCH 3/3] [PATCH v2 3/3] usb: typec: tcpm: charge current handling for sink during hard reset From: Badhri Jagan Sridharan To: Rob Herring , Mark Rutland , Heikki Krogerus , Greg Kroah-Hartman , Chanwoo Choi , Andrzej Hajda , Li Jun , linux@roeck-us.net Cc: devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, Badhri Jagan Sridharan Sender: linux-usb-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP During the initial connect to a non-pd port, sink would hard reset twice before deeming that the port partner is non-pd. TCPM sets the the charge path to false during the hard reset. This causes unnecessary connects/disconnects of charge path and makes port take longer to charge from the non-pd ports. Avoid this by not setting the charge path to false unless the partner has already identified to be pd capable. When partner is a pd port, set the charge path to false in SNK_HARD_RESET_SINK_OFF. Set the current limits to default value based of CC pull up and resume the charge path when port enters SNK_HARD_RESET_SINK_ON. Signed-off-by: Badhri Jagan Sridharan -------- Changes in V2: Based on feedback of jackp@codeaurora.org - vsafe_5v_hard_reset flag from tcpc_config is removed - Patch only differentiates between pd port partner and non-pd port partner V1 version of the patch is here: https://lkml.org/lkml/2018/9/14/11 Reviewed-by: Guenter Roeck --- drivers/usb/typec/tcpm.c | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c index c3ac0e46106b4..c25a69922ee6a 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -3273,7 +3273,8 @@ static void run_state_machine(struct tcpm_port *port) case SNK_HARD_RESET_SINK_OFF: memset(&port->pps_data, 0, sizeof(port->pps_data)); tcpm_set_vconn(port, false); - tcpm_set_charge(port, false); + if (port->pd_capable) + tcpm_set_charge(port, false); tcpm_set_roles(port, port->self_powered, TYPEC_SINK, TYPEC_DEVICE); /* @@ -3305,6 +3306,12 @@ static void run_state_machine(struct tcpm_port *port) * Similar, dual-mode ports in source mode should transition * to PE_SNK_Transition_to_default. */ + if (port->pd_capable) { + tcpm_set_current_limit(port, + tcpm_get_current_limit(port), + 5000); + tcpm_set_charge(port, true); + } tcpm_set_attached_state(port, true); tcpm_set_state(port, SNK_STARTUP, 0); break;