From patchwork Tue Jun 26 23:45:29 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10490345 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 8B50660386 for ; Wed, 27 Jun 2018 00:03:27 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F2871FF13 for ; Wed, 27 Jun 2018 00:03:27 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 72F1F26E54; Wed, 27 Jun 2018 00:03:27 +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 E9E041FF13 for ; Wed, 27 Jun 2018 00:03:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934334AbeF0ADZ (ORCPT ); Tue, 26 Jun 2018 20:03:25 -0400 Received: from mail-eopbgr00041.outbound.protection.outlook.com ([40.107.0.41]:20186 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S934331AbeF0ADX (ORCPT ); Tue, 26 Jun 2018 20:03:23 -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:X-MS-Exchange-SenderADCheck; bh=ysx84r8hagJqG6npq0bdFhGv7nsqbQWUfosZKvWvRg8=; b=uXC10Dcj3lpLBF6EX7322tlKZMCt/mzVZ5nfS7+MpZE3AyLN9d7o/H+FW8CIpWgzDy1oFRR8ss5HNXIjRxJw+R92QSgnaBi6XCOXZcR3+trd71wfWlp8XSKevVtZO+RIgKLM3TAIxqaXec9nOsFF2Cjzex1NIKrFCLSHrq2I5RY= 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 AM0PR0402MB3908.eurprd04.prod.outlook.com (2603:10a6:208:f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.22; Wed, 27 Jun 2018 00:03:16 +0000 From: Li Jun To: robh+dt@kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com, linux@roeck-us.net Cc: a.hajda@samsung.com, jun.li@nxp.com, cw00.choi@samsung.com, shufan_lee@richtek.com, peter.chen@nxp.com, devicetree@vger.kernel.org, linux-usb@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH v8 11/14] typec: tcpm: add starting value for drp toggling Date: Wed, 27 Jun 2018 07:45:29 +0800 Message-Id: <1530056732-9640-12-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530056732-9640-1-git-send-email-jun.li@nxp.com> References: <1530056732-9640-1-git-send-email-jun.li@nxp.com> MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: HK0P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096:203:18::23) To AM0PR0402MB3908.eurprd04.prod.outlook.com (2603:10a6:208:f::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 5cb45b0e-732c-4bf3-aa3e-08d5dbc16501 X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(8989117)(4534165)(4627221)(201703031133081)(201702281549075)(8990107)(5600026)(711020)(48565401081)(2017052603328)(7153060)(7193020); SRVR:AM0PR0402MB3908; X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3908; 3:g2lX0iw1L1V31q/rqrrVtCM9WHjqYNJ1RzLwxkfBlO//et+jXkMRto8e52nniqrtGhIGXfD/+FyUwm3zmjU7f+iovSsa1KZyHYFRu/CDy4+JtnCu1JGksItCO4t6dehI/IvATk5Q0n9mm1PpZSjicpBmKcDYQwKXKwTQ/FWWZW2HJUhx8thIOp4RWODf1s8Moc5V43qjqnb94Gdz+UrKZxOPyWE6SuXbQxHkXpAWsoOHa1dMwMV24o4A8yFInNYN; 25:iee8zVbtApxUAr41GlfYi/3flsx17Zw3JSzbnfKLu4hWBL38Yr9GpQIL2Ralw18kU8AYVRwGPOzgo1Mwuo/IY95x2RBJqzy8o3yo0f5GD40PttVB4Wv93PKPi/Zpn+cOQAoOjw+83xN6bGNxzNrZzJDCBGSZWh5A6o8D8MooayHmygBh5mL04aKlhqQDYsm9pJzVdD45ROyqQMZL33H7W5uMCgS/JQLPC5l7k02v3nnC2ePuillk0DIq+pHcsUIsXKGELUVNJbqsXaCEv6JEmGXETnOSmWEQnZgJFVf982F1gdNf3op2ygmrMdfXDP+AhlNO+HPU8EGZm/YnMBcE4Q==; 31:rjcutMM+f1d2aqEVvYw235X6j3nWZsrRDimqdBbytivr/UfzBI4WuPvS12VEBSidaVnw8/Av09tWvq0XtR2T2Dt05vU5bW1U3ikrqSfZTwKnsr/gzrO93C8nBx9usAKUHbufZVidHFDfOEMWf6PQTpN8S46QJZnKMhvKraKbrTOMlgU0eL3NWSRRXJXNnGtX4yZj0Zn1I/Dp8SyM8ZLIxYk6x2mPyir19lgL2MQ1ac8= X-MS-TrafficTypeDiagnostic: AM0PR0402MB3908: X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3908; 20:9+8i0ndfNeQZqiv4E9k3WMmAEPb91ytD/9Hoz4L1q1orLGsR6qwH8dXz+n7VUCI8RR3PYv9+tg9k93T6YrAhaxoRNxDD4+iFwp0oawR4ZrNysG25IDtzwGoCZGv4W0w/C+P9dOcJKR8VHw+ME9mU9KtDvso9aUuobQD1IPO6QUEgZogzD9dFNAYzdhtlAEjXuzX+T6pJoif0CBxodbt4H5x2CimNn030tSOcQPMrbcdxuTXsLWjNCEEDAiEMJ4/meXeSHo+3kpd9N42CYODhageLNQhpiMm8fNAcVHpd0UqOmvLlDrrqPCU1IF4LQdSSqqKAc5J0dxXTA0R+65zeP1ry40sxuYDEwaSFsgnAqxfNr/CeHNjdLx7ZvS+NYxaY8RX9unZS7Qyv1uQ1iEz+SA8mfXMSqfBM4e0B1KDPjtIL83KcQXhuneBv2PpcTReU9rqvp3ad6aojI6Q0T4TltEUXRgc+TzmF/b0UviAcarTbfjN4Y06Y8HtioyhUoFhl; 4:Qj0fff3Crc7+2qJSNF+K9aHl7XSrZ53QDo2tFPIpb9Z2QzvffqalOkxHJgKNuBHXXpG53e4MS61gjPPTJrtvryeg9weJSEZ8BrbjdWmoo5GnX/A0Pa97fzkmejObHIEnUMx6u4T5P59jvmnyrDPTwcTo6+faXs6Q8Ew4RsOWSxP9xlqjaqiQFLAA2rB9kmaHV6H1zy88zq5D2BezvaocXe3k8xwRuVHIdFil1U+bV1abGQ39kQoBelXX5TsHgn43LeQTKOehCix1H/ICqhz2fxuvfoxGnBKuIRzHQIPlCmXV8PCWW4zXKmoWc/6LVgo6cmTxogEfA0H59a6LPXThb+6qgb0FlNRLblgD5I023aA= X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197)(228905959029699); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(93006095)(93001095)(10201501046)(3002001)(3231254)(944501410)(52105095)(6055026)(149027)(150027)(6041310)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(20161123560045)(20161123564045)(20161123558120)(6072148)(201708071742011)(7699016); SRVR:AM0PR0402MB3908; BCL:0; PCL:0; RULEID:; SRVR:AM0PR0402MB3908; X-Forefront-PRVS: 0716E70AB6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(1496009)(346002)(136003)(376002)(366004)(39860400002)(396003)(189003)(199004)(2906002)(7736002)(26005)(6486002)(305945005)(486006)(48376002)(478600001)(86362001)(25786009)(4326008)(16526019)(186003)(36756003)(50466002)(16586007)(68736007)(6512007)(47776003)(51416003)(52116002)(53936002)(3846002)(386003)(6506007)(6116002)(76176011)(316002)(97736004)(50226002)(476003)(2616005)(956004)(6666003)(11346002)(446003)(106356001)(8936002)(81156014)(66066001)(5660300001)(81166006)(8676002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0402MB3908; 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; AM0PR0402MB3908; 23:iP9fKQj9kchcp5XlvUKIqheci0G5rj2m4NU13XQ?= =?us-ascii?Q?kAi+7CZiTu4RhtEdTUc8J6ndsLStGdIfKXsefodRKiOgz9kv7edJrnAkb7zx?= =?us-ascii?Q?bY29qswwkbcLEqvzcJyGdUXBk+xI/IxzsFIDncL3ATFBc8XIfH8PpRVeTD7I?= =?us-ascii?Q?atzRzn40/zdqpgzETtzNI99db1T4Iim4jcsdd1bM/gzXMlMuOB892pLazdWA?= =?us-ascii?Q?DuWHo4R4XcISpVUp0uv6PjphWTtx4+SiN0mhx5hcTLbvygI4waQrLaPNsw2I?= =?us-ascii?Q?gjJEEcBFSxDVO6GQ/kQSKrBBbI9yAeNzkZLDqbVSNtB/ZcrD847gQotvTb8d?= =?us-ascii?Q?BstbKF+vw8ImjedyCHefjmmAHZViVvij3X5TUjX6FukUIUvFZ9X+DOgwV9eh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yBEDEtRP0t8xWg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3908; 7:R/WDmSPGzIikUu7UFtzf4+6dLR1J0wz98NYBpXcVqzqkLwz9NtMrTjZXBCzgv+9oKg4lcIhoHtgcaHkm8NkNn+DXJzRB066IJdn1YzXqzmm8yXMDsiYxVk7yhprZQhrm6PihRV/Y1LGaVGAE98RoTY0Ohq6FCbK6H+E61XW0uAhCCXX/bsG+MH9ohuJEa5Y/lf9l10l5vx/v+4jdcaWygNwMM50sFIyXbz1bj6f6dhoLyKnuaJZnD1EyLa3MIpqI X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2018 00:03:16.7727 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 5cb45b0e-732c-4bf3-aa3e-08d5dbc16501 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3908 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 Reviewed-by: Heikki Krogerus 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 9dcab81..f5e9558 100644 --- a/drivers/usb/typec/tcpm.c +++ b/drivers/usb/typec/tcpm.c @@ -2431,15 +2431,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; } @@ -2747,7 +2747,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; } @@ -2922,7 +2922,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; }