From patchwork Mon Jun 25 08:08:43 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10485259 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 54BB76031B for ; Mon, 25 Jun 2018 08:26:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3F1BF28863 for ; Mon, 25 Jun 2018 08:26:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 33B84288A9; Mon, 25 Jun 2018 08:26:54 +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 C0CE128863 for ; Mon, 25 Jun 2018 08:26:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754204AbeFYI0v (ORCPT ); Mon, 25 Jun 2018 04:26:51 -0400 Received: from mail-eopbgr60041.outbound.protection.outlook.com ([40.107.6.41]:19650 "EHLO EUR04-DB3-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1752496AbeFYI0o (ORCPT ); Mon, 25 Jun 2018 04:26:44 -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=mzKFJTvO5fwpyx0FStjyTJzm4x/J4JzhPx8XitDf+xA=; b=SB4rygMLJWOoMG1hcT5gwuFr4yvD3Z+KaCa2dKWC0QvLgtCGagkNTDbvQPLiBrZPeErhFezSec1RPsA3RdQ9fDEKuX6k1reiFmhCX3C9pLjriVlDPwSHwUDTPDZYXCC++cHbiRFdq9fSLo4yH4OVBE4Yc5Gu4FfIEHx14JfUq08= 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 VI1PR0402MB3920.eurprd04.prod.outlook.com (2603:10a6:803:23::12) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.24; Mon, 25 Jun 2018 08:26:36 +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 v7 11/14] typec: tcpm: add starting value for drp toggling Date: Mon, 25 Jun 2018 16:08:43 +0800 Message-Id: <1529914126-22550-12-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1529914126-22550-1-git-send-email-jun.li@nxp.com> References: <1529914126-22550-1-git-send-email-jun.li@nxp.com> MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: HK0PR04CA0004.apcprd04.prod.outlook.com (2603:1096:203:36::16) To VI1PR0402MB3920.eurprd04.prod.outlook.com (2603:10a6:803:23::12) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 8f822b4b-1c64-45d5-da24-08d5da7560e1 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:VI1PR0402MB3920; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3920; 3:hodybcyi85uokv94cmFmh5pxNMiLCbVTSoFadnlQFVI1NvLgjz9auHCiup2VqPGkUBw7iTS2xq3oRkDKV74LgKzLP5ePP3zzpn7PywEfk5ZG7CNnV+kZUd9R5MGbPo2iKw8lQiswKSlpGtFwKRzCwd7uV/Ty+upC35pDCToIcc1hbAVRWRMzf5hJYBdsk/ojI73xz7qALVHdgvY3o/FeDvo0+zjgJjC46/ToPAcPO+Ne74g+1yPyH1it6genk0OM; 25:ln4nasy90YX00B60qOQff3DFgOuCm8B3o8ge6aYnlh7sac52fBnlqXUpmgVr/46pjFe+S9LFYnXXhEPZBirpL7otPvTtMxVCY+FdIpteIqslzaQWXoROzQG+lg1Aeb196+OoDg8FyyTKXTntm2c1rJJKA7F4gIk3n3dLLktLINnZKVrr46b5RgeRxBPAILf1zx7NF6PQ9RMn9IJYQc2+B1msOrm+0YYepAhDWr8IdDhHAfHSFuUeBT6KK2ewPistP2BkwagIcQx+MWiwNw8Kp5iCstmneVtjdhfV7np8oBFhRXS+bcZS2/f2qNCFn1i6yW99PUfcz5+6YpcNszCcLw==; 31:N5bRTGaP6n8z4SnREK0KyRaBlyg1fIY3Xq0aE483B7l/vFhHI+PUVoW9Wluw+5o7ERN4Uc30nzqZk2x85fGUiBwUfBZDXJY0Eoc/wXVxGs7DUrFAM4WeO9xEugsmVh35uBiKdKotbTtT722V0qz3exPa/zswOwJ0qXombZV6c5RgwDegze5xtq9BpLTsXwqH9lqqCveDaUJ5ESTVmCjh3AcXhS5V8bBWFQW6KBvBS4Q= X-MS-TrafficTypeDiagnostic: VI1PR0402MB3920: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3920; 20:3LGAG7QNSo/N+uzVPL1AmcV+hKu5iBwTCbJ58Nx74lm1fc9ff/ccRsKjcyxFnOniYOwLwGlSs+vPcyXbUJESH8/5BznIwytmSLLv+0UBd1UxNzdN+ZjXA+bncpgePECybfTp6awprwWUFhhaFRkuzwYss09sGE1wMV0ChoyTP0LGV6HgDOZ9GhE8akGlTo2yx6H9EU8ddfMNr3h/GYILjlbCXO1HxJ7AwHjivASbpQy8l7b4EIEfLic7SheUAN09EcnsmnFrYXCqUB4pb7Vo5t4GpcE8lVCyxnwaliXpHhUEiPPulM1xWRmtcj0G44A0OTb/KBxY6e00WZGiMuxFx4j/wmE+lE9AzfNCLwpaH4EtO3Vi7IAwtf4ym7T1HSgJ+L5smhDNFuxoFwZMJc3V8D44qzcKVRDeynV6f6QaGuHXcmKrKjee4u/xpWwpG4XoBP/lkm4uIynEn0blPquiGP0qGFRbczx+pbdj0qJms3JXW9VCWAXDguZ+ne3ZhVjV; 4:7WryfNd/VP70YIUv2VFGdY58QiXwS4NwJiGf8+1retL6vKFR+WMg/0Xx+nVMY4Eqxl5bEdzg8mBkRIqqO1nYi594PV7lpidHvUM/ZEdn5QHQs8J5BaA6DPNdwIZrDM5iOYR/dcaiJ3jZyqHem79R4RTqzKNrqOZAkCtXAFDDGrLWCqbR802wwXdMOxuOwLXQMzUShg4dIsHa9VA890Pq9vyafJzIUUmDe9U28sC0FZBaM2bfSPjq3ouiVe4Nl8Z8/DTdroCnYTQVdExJdMLWDwfowbU2Xg7r8muCzj7tkofv7Y9Jn11fri6YATEqg9GDoiBWWUxJv6lUC9k75KAyjg== 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:VI1PR0402MB3920; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0402MB3920; X-Forefront-PRVS: 0714841678 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(366004)(346002)(39380400002)(39860400002)(396003)(376002)(199004)(189003)(53936002)(25786009)(47776003)(316002)(2906002)(16586007)(6486002)(36756003)(4326008)(386003)(6506007)(186003)(6512007)(478600001)(26005)(16526019)(97736004)(8936002)(86362001)(50226002)(52116002)(476003)(81166006)(81156014)(486006)(76176011)(305945005)(51416003)(8676002)(2616005)(6666003)(105586002)(68736007)(446003)(11346002)(66066001)(5660300001)(7736002)(50466002)(3846002)(106356001)(48376002)(6116002)(956004); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0402MB3920; H:b47624-OptiPlex-7040.ap.freescale.net; FPR:; SPF:None; LANG:en; PTR:InfoNoRecords; A:1; MX:1; Received-SPF: None (protection.outlook.com: nxp.com does not designate permitted sender hosts) X-Microsoft-Exchange-Diagnostics: =?us-ascii?Q?1; VI1PR0402MB3920; 23:cz9caGLfTiUWy54BSU9qokPspJAqlGIVFk1e/gc?= =?us-ascii?Q?3SxQ0/bCgY4UAhyJUuorO01MwgV9rxOE+WRhg93TY5hhCi6/EaoZH3scWSyp?= =?us-ascii?Q?CIy+8TwlIWBPWbIWXn3Evds+Klu5tj7+nPSCm/Sib0RsXMaFfXDXgJeb9M11?= =?us-ascii?Q?4CQbHhr0cB265WltjmB6tFZHjAZH1MBw7qBADNjwGeUJgh70zE0g/Z/FHJzC?= =?us-ascii?Q?y5WSBi+0hn7RCMaYZGJit5MNC2pz1ltBmUyJmg49NCtrvubk5g1YDRJtAoq7?= =?us-ascii?Q?8t1D6IbtLx8EwayshHMPeJT0z0U5/wieITiablOb0/y+hddG/Xe/R23Ji23Z?= =?us-ascii?Q?edZ2zpr1TCQBsQ+7+Q9B0+FicCSVQbEezdkIZBeGf/Sqgiv3TeZChNLasSOK?= =?us-ascii?Q?CLmJ10EuEwPllZxk0UqEIA4xp25pkb6Qux+pcxbjBIBYxSSfzkOBO72QbEIm?= =?us-ascii?Q?zcENXTm9Fpb8o9hp9onEW0NiR+66sP2GOu3F0pnkMXhJzGH+7KgTqtDCSrqV?= =?us-ascii?Q?ZiVN70O2sK2LM5UbdvW+V96QQ3cWSp0yDE3XRcGpJbCyIs5XL6da1JpQB8pH?= =?us-ascii?Q?t20Og3Ss1dGEG1VQ/QfdC/J3h6aiiKGpAFUfq0LGI2FpLO2ggXFfUIgryEfQ?= =?us-ascii?Q?E9gHl1TKo6X//drLWe6shSt9JbWGOXtXrEpyATwchgfOIN1j1UuyW+YAdhrH?= =?us-ascii?Q?YXeTdcdJQV3dpxCCRUfRANE/kzLde2tKema2xAd7jAp/Slx4DZ8K/m0A5qUW?= =?us-ascii?Q?4IXITj/rsugniY9N1tvDIWKSmhNIXZTRJ3TEWbSGt8ZxziIROf601B5qbwE9?= =?us-ascii?Q?JKmkR/WdcQ3SyNS78vcqSgyilpLfvq2jdK3bU0dk1ac59pguUOP7JgdFbGWo?= =?us-ascii?Q?xTRomCSe41TZAOGrkaceDflko75EwrgVq9NuQSnH0zZUvwEJoWpzYoIiCwqC?= =?us-ascii?Q?P8312W2Whp2jLADv8pH212DkO0oHFWlV88bO1p00rNeeOIpjjJV6SoXGsm+0?= =?us-ascii?Q?gnA7j/9/WHpQYVkkvzMKCtFpVY5O8NnojZlr6RahSFX5BUOrsxYqRvh8dtMi?= =?us-ascii?Q?PzJoCe2lrapZJcwruHPLK3jqNSaynIC90ihljL7UwV+xUv0ESmh96JyNtj2W?= =?us-ascii?Q?RTqlkYU2I7PF5lcdeWG1lZQZD8laGgC5ZbCVSHK8tjttF0sBC4gPTuA=3D?= =?us-ascii?Q?=3D?= X-Microsoft-Antispam-Message-Info: iSp9UkKFwTmU9z7apTvrHSX4b9w4UTTprwCz66UvOmYvaHBflv+adk1lLRWLVWiARunMvY10UgHYPQdoae8Ls3oYowCmii9HeMXt6iuvBcQylEc1l7gXIrh/v7oz4eYcp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amDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3920; 7:tdeSTv4WaWVUZ/0ldh62BdRHBEYSlWiofNpgXRUhCZ4AVprLEqXFxf7BARKX5llX6YbAQQM8E6UgcnJQyMKnYl4++enaHdYvfBWUP0d2MqEqOEzOSDRxl7dRO9ezYtLn4xQ9nObRN6gGCc4rLphRkDzt8oQg9E9wKzuJnK4L9oiW2m88kUKLy0XSZqqZCyNn5yAAOU29sonq3qG+oXLPhSKJKT34s0h2Gp7FZAKtwyXNSqb68DwYuXff4pePe9ED X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2018 08:26:36.7360 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 8f822b4b-1c64-45d5-da24-08d5da7560e1 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3920 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 0454654..c80f1a4 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; }