From patchwork Thu May 3 00:24:50 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10376841 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 013B260384 for ; Thu, 3 May 2018 00:42:18 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E512C29137 for ; Thu, 3 May 2018 00:42:17 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D9B9C29153; Thu, 3 May 2018 00:42:17 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI, T_DKIM_INVALID 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 72AB129137 for ; Thu, 3 May 2018 00:42:17 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751778AbeECAmP (ORCPT ); Wed, 2 May 2018 20:42:15 -0400 Received: from mail-eopbgr10055.outbound.protection.outlook.com ([40.107.1.55]:63776 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751755AbeECAmO (ORCPT ); Wed, 2 May 2018 20:42:14 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version; bh=J8Li+s+jKDKeddfTgWHPIrIvx4kK37QjBO7ksONvRJQ=; b=O4hDOGsYDe2FY1x8aSJm0OM0xP9VtBWdxQ/r9thgNPFFZgsNgbUkHoNVh1yfYnoVyeOVQsmS3MSwmm6S9r33azZ39PaUCa5dVIOyHiSDqNv8wY2pC2xCGxYPatLQ93IQVNLb3Qe3BmjNlTBYMqcRNNLho/CCbzC528aZ/CHeJZ0= Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; Received: from b47624-OptiPlex-7040.ap.freescale.net (92.121.68.129) by DB3PR0402MB3914.eurprd04.prod.outlook.com (2603:10a6:8:f::29) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.715.24; Thu, 3 May 2018 00:42:05 +0000 From: Li Jun To: robh+dt@kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com, linux@roeck-us.net Cc: jun.li@nxp.com, a.hajda@samsung.com, cw00.choi@samsung.com, shufan_lee@richtek.com, peter.chen@nxp.com, gsomlo@gmail.com, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH v5 10/14] typec: tcpm: add starting value for drp toggling Date: Thu, 3 May 2018 08:24:50 +0800 Message-Id: <1525307094-27402-11-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1525307094-27402-1-git-send-email-jun.li@nxp.com> References: <1525307094-27402-1-git-send-email-jun.li@nxp.com> MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: OSAPR01CA0012.jpnprd01.prod.outlook.com (2603:1096:603:2a::24) To DB3PR0402MB3914.eurprd04.prod.outlook.com (2603:10a6:8:f::29) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(48565401081)(5600026)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:DB3PR0402MB3914; X-Microsoft-Exchange-Diagnostics: 1; DB3PR0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hya5AFGn8hgRQfyQ+xKQUertqP4Y+9iV9k6VMLkQCTRpPesF5ZXfcIX5FGAiARsN/fydsxaWw/vtDvltOG7aYo1CdUEBFX12JqQ8Ns8dSCANSSAQNkyNzf/DQT+X9kOcPpS/e6NkkMGqQSfWOpVvb3T4AYIEFqhQAH+HPNdiGjiVDgwoVwqXxEHV5WAynYY4NuI2J6yrfbDH10TrTyxsdBo9G3qM6UT6u/7Nb6rFNvQoOpDmy4mgvH8cfH1KHJwKjrvB2/gPS9vBMPUrMOh3EIwVVXtwdjjyhj3sVt5ATZ6Go/jZQCYhBFJKwndAUmrDBKB3T/MPv8/v5rbAdo7BbgRMDC+1lj9umSxCurzD; 4:jbUNMaPQgApt3GenNB1yfD204csc+nQVNHpsctdgULehe+3D0k+ryL1UJ7ifAHad1Oxxm2h0FSReQEC4NY/TmIYli0jCjn57jIu1BpDeskRMoVgC/VXERsUHWMZmRqtuu5MGQT6whHYxTkRE4YEku/gBKmzuE8Zd2m3Pb8dwoskR12nN5h2fTZQ73KnhE0fTSy8kZ5yjlh2wEL+A22QrN8yfNBqwqXaM1nWNj9c+8tQsVMaYnCzffQLpRXbfrJeoWNLSMbzjDFOry50pD0HiqHfmzWvICDK7vxiJJ2lwlCZ2QzcZc7+8K7fNcquWD3Gi X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(8121501046)(5005006)(3002001)(93006095)(93001095)(10201501046)(3231254)(944501410)(52105095)(6055026)(6041310)(20161123562045)(20161123560045)(20161123558120)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123564045)(6072148)(201708071742011); SRVR:DB3PR0402MB3914; BCL:0; PCL:0; RULEID:; SRVR:DB3PR0402MB3914; X-Forefront-PRVS: 066153096A X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(396003)(39380400002)(376002)(39860400002)(346002)(366004)(189003)(199004)(7416002)(47776003)(7736002)(8936002)(66066001)(305945005)(106356001)(2906002)(5660300001)(6486002)(105586002)(6116002)(3846002)(6666003)(81166006)(8676002)(50226002)(68736007)(81156014)(36756003)(956004)(2616005)(386003)(16586007)(476003)(50466002)(6506007)(6512007)(97736004)(316002)(446003)(39060400002)(52116002)(26005)(76176011)(48376002)(4326008)(11346002)(486006)(16526019)(86362001)(51416003)(53936002)(186003)(478600001)(25786009); DIR:OUT; SFP:1101; SCL:1; SRVR:DB3PR0402MB3914; H:b47624-OptiPlex-7040.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; MX:1; A:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; DB3PR0402MB3914; 23:OdynmlX/RROrODnHdziNIuAJw1nFU01ZIDmnP0X?= =?us-ascii?Q?mZEGXfM07VmydbRDQHTqLNIrjdwMiiGDBSwIh/hTB9YNajX01WyXBdzUFGt3?= =?us-ascii?Q?C6M0b4Z5idfN+7YN5GBLbdzYEi2DJG81+7RI3Zj1zjFDqPtKrEzG6VyltmVi?= =?us-ascii?Q?ohi6YeEobQo+Snverjpr5Ni7zOnY9DdoYpfGenVFxEXSKObJgrrhQ2mYtWww?= =?us-ascii?Q?JKduQbEq3ffPto6DESF52ba1qDwJuOHRBw/oCDvjVtxefYE/v3r92KJvWwuc?= =?us-ascii?Q?SUWUXSqoJavL1bpI7edFKYcVkhgJS7Uwa/Am524/W7veT9MZiGsVReT7OEpq?= =?us-ascii?Q?c7DQMXYhFjvp+nGXn9H7AH2q84Qlor4/+DXrqV27bLwRDRk4lYCgfq19i0Mm?= =?us-ascii?Q?gzG9tAuEGBNu302Zfk5cSQZaYLz8tX2ECgfWLz9EvWg5gkR3neYhGwOpnU6b?= =?us-ascii?Q?70LzUATaSUbL/puWpWHv8zM6JbQ4KarsDXnStWnJHk1EhH7r5G0kDrFk/q/a?= =?us-ascii?Q?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microsoft-Exchange-Diagnostics: 1; DB3PR0402MB3914; 6:UBG1lNXK0eOXBdpN05lmTDCvaKd1SL9yJerZ2jryMp0S1RaNuWkt+8Z5dBLy3AlrJf+mmlkPQTBgDKubEvi+U+Q0UY/GDzhUtn0LnByhc5uMptv8KtQTT44HUkQvHu3HOBK8mUi359KwSDFYOT/uyqeXOKYmaV5j9inpUusnMsAkoJo/X3o2+ncMahDfxzycsgTlOuI3Wds/qWilzNuQDOkz39vu0+de+vzPoYKuGAl8mxCkoT2CNIfUSZY+AoP6AOa3Z02u8uPXElegPUpFkc+i+PBHmRNHdGBkJEfG+pmAc23YYjCQcGCJxpy3EnVdVR1mPs6pDcmEPQ8T+/M6xijv+dOU3rs+xkAGk0Jc2l44Apuxmx05dFnrt5tRJwZxX7K0qOs2lFkUGXugRDTU4Nhh3dC0K02kSZS2eafuj+etixXajMYKSLNt7XN7q/w3JjONSMNtLS5MPcV8ORCnWQ==; 5:tKBCJNen+VJaZ4G3XPgVzPfMqkh9KGofHFdEkvuX5aLnU/70zOJ9H/DrI/URjGuqopwZLDyZjtCkVTbEhfJA+u6NzSCKX4qCXwVAdOksTAMib/yp3YGrXiiF68TZlfpzVpiz+/b6uibKoQXKbvge4OqjmYFaQY99xFwpVZynEKc=; 24:B8GVLbO6mrRGaz9rLWssulk8+IoMEXd32PX3ze0X6Um4l+NTXfpfrRjZpBzHzVCYLHfFpatHUmFHzkYlhdYP6eT9zVsAYvEU9b7JVBIK04Y= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR0402MB3914; 7:ZHxG9sT8jDBVoCI9lkfwaobzU7UrqOz7UdLzjZheOL4mVRdZzQBCTahnK08PNEOhm2iM6xLjicueMV47+s0x90/IqMJ2THcEJNL3yIZyCqUwTTy2uRLzPLgen7nSmzpoaLyEaC5imC+Ql2BoTc5MG8ebnyjvuQQ8wnuZXt0BV/x1W0RDncmVwTfTitVimBFt+1+VBpifbYgiSK00+xdVZrpteZXIhtUKH8ePtdmpBFROnqFhGWH+W6dggQn24GMJ X-MS-Office365-Filtering-Correlation-Id: b083bce9-0865-4ac3-d7de-08d5b08eb4e5 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2018 00:42:05.3973 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: b083bce9-0865-4ac3-d7de-08d5b08eb4e5 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: DB3PR0402MB3914 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 As DRP port autonomously toggles the Rp/Rd need a start value to begin with, so add one parameter for it in tcpm_start_drp_toggling. Reviewed-by: Guenter Roeck Signed-off-by: Li Jun --- drivers/usb/typec/tcpm.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/usb/typec/tcpm.c b/drivers/usb/typec/tcpm.c index becedcf..0c7fa14 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -2436,15 +2436,15 @@ static int tcpm_set_charge(struct tcpm_port *port, bool charge) return 0; } -static bool tcpm_start_drp_toggling(struct tcpm_port *port) +static bool tcpm_start_drp_toggling(struct tcpm_port *port, + enum typec_cc_status cc) { int ret; if (port->tcpc->start_drp_toggling && port->port_type == TYPEC_PORT_DRP) { tcpm_log_force(port, "Start DRP toggling"); - ret = port->tcpc->start_drp_toggling(port->tcpc, - tcpm_rp_cc(port)); + ret = port->tcpc->start_drp_toggling(port->tcpc, cc); if (!ret) return true; } @@ -2752,7 +2752,7 @@ static void run_state_machine(struct tcpm_port *port) if (!port->non_pd_role_swap) tcpm_swap_complete(port, -ENOTCONN); tcpm_src_detach(port); - if (tcpm_start_drp_toggling(port)) { + if (tcpm_start_drp_toggling(port, tcpm_rp_cc(port))) { tcpm_set_state(port, DRP_TOGGLING, 0); break; } @@ -2927,7 +2927,7 @@ static void run_state_machine(struct tcpm_port *port) tcpm_swap_complete(port, -ENOTCONN); tcpm_pps_complete(port, -ENOTCONN); tcpm_snk_detach(port); - if (tcpm_start_drp_toggling(port)) { + if (tcpm_start_drp_toggling(port, TYPEC_CC_RD)) { tcpm_set_state(port, DRP_TOGGLING, 0); break; }