From patchwork Mon May 28 02:52: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: 10429723 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 DA817601C7 for ; Mon, 28 May 2018 03:10:20 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CA82928AF4 for ; Mon, 28 May 2018 03:10:20 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id BE55428AF7; Mon, 28 May 2018 03:10:20 +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 429DC28AF4 for ; Mon, 28 May 2018 03:10:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753166AbeE1DKS (ORCPT ); Sun, 27 May 2018 23:10:18 -0400 Received: from mail-eopbgr00071.outbound.protection.outlook.com ([40.107.0.71]:48480 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753149AbeE1DKQ (ORCPT ); Sun, 27 May 2018 23:10:16 -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=bE2PVZoZhHkjNegfg+Bjrmenv+mzj9NMWGVC0KQ7ADg=; b=cxtiROseNChUNIsKRKrDe9vwt1xQR/DivAk6CBGU2SfzqKBvNCw22HdQIvoAt6FlYEFKGoNOdlSyiQXXS7DGE8Mb/rHdqcaezz3XqfxXhv6bvKwwyywbITn29S7/E7mb34XptGOQx5KJboGTk463ihjP3cs5/apgYJe00lcHWGo= Received: from b47624-OptiPlex-7040.ap.freescale.net (92.121.68.129) by VI1PR0402MB3919.eurprd04.prod.outlook.com (2603:10a6:803:22::32) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_CBC_SHA384_P256) id 15.20.797.11; Mon, 28 May 2018 03:10:09 +0000 From: Li Jun To: robh+dt@kernel.org, gregkh@linuxfoundation.org, heikki.krogerus@linux.intel.com, linux@roeck-us.net Cc: cw00.choi@samsung.com, a.hajda@samsung.com, shufan_lee@richtek.com, peter.chen@nxp.com, garsilva@embeddedor.com, gsomlo@gmail.com, jun.li@nxp.com, linux-usb@vger.kernel.org, devicetree@vger.kernel.org, linux-imx@nxp.com Subject: [PATCH v6 11/15] typec: tcpm: add starting value for drp toggling Date: Mon, 28 May 2018 10:52:43 +0800 Message-Id: <1527475967-15201-12-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1527475967-15201-1-git-send-email-jun.li@nxp.com> References: <1527475967-15201-1-git-send-email-jun.li@nxp.com> MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: HK2PR0302CA0015.apcprd03.prod.outlook.com (2603:1096:202::25) To VI1PR0402MB3919.eurprd04.prod.outlook.com (2603:10a6:803:22::32) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-HT: Tenant X-Microsoft-Antispam: UriScan:; BCL:0; PCL:0; RULEID:(7020095)(4652020)(5600026)(48565401081)(4534165)(4627221)(201703031133081)(201702281549075)(2017052603328)(7153060)(7193020); SRVR:VI1PR0402MB3919; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3919; 3:28woj2vEIN/Kz1PXTfUHTkSfRUX0IFougd5ppWPJDoc7fiqwkEoBaQrpJ/NtRwRdNGK5GP/r2fcTkuqcsn7Rh41IPNQpskb7a4AXTlbNa44NnQI2NtqNKq0UmR3CCRT68k5hL79Zo06mjjBCPeIWDzI0ON/CUdSEjIcmWS1F6Op1WpInske686GyeemOGC90S9e00nt99xBfYIK+nFJSjGKD8SVrfkP3FolTmmqs02NIJ+HYiDrs4uoKODiCEuCV; 25:6eSQawpsdAT5kCDq/b/qU0zqA6TGJBlxtxMy/S8jgpiD9kRWaLmdUmwNaFTCOXweHxp6HBtImvaLrGSd/b0qzVaz08C/cSbGNxEQ1+OyIPDiog3bwARmb8VmbYKMVSbG8CAv6FvK3kOFSc4pKHC8Y7vI80L8wFiZ6QTYlnAqGNVA0asvqQ2feV0LQ24K1Ra3vae+hbYLs9ji00RWgPRI2pkZAZOa9XRCRcp9grtDgODfgWXmNuSrnAkJv/Im1VdxrX/6dHpSAWJjNVqQPjLeIiZQyMjxyjhZ/GLaXcHEJb4y8wIGIEerCi03Dd8XOFMuIG0D4EeFR4s/Q7duKQ/XiQ==; 31:a2SNYP5OV2Pt9+hlCRDrDtmP7ZEF2iZqZUkNbrx/qVZuJAC8G7DaR6qEjXNACf63/ICYb3yo30pn8mu5rgP0uzanyfBUYq1Y4Ng/+tCIcvny9Q8z0QhqsMmNESIZkjD27qZ+WuLWqGVlIr5pcGZMMM1O82ikzFwMC+cceAi3oZszDRvagPU+LMU2WB9BX9CvANtQGg79nF4FsHVu1Svj1Boqt0Hjc9p4cUpzjhvchdE= X-MS-TrafficTypeDiagnostic: VI1PR0402MB3919: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3919; 20:QWwLQtUuWVaUPXFYPtk2tHUway1SETp0y2TkEJkqZO+XS+pGODbr6c9DQ6EYtzt9efinKHTDfEFWff6b1cjGCtLTKonTTG1bSqw2THfcVVacDS/AvIUW3l8/9PL59pK3v+t5c5XOudOeGKDxVhRDKLKIq1+oeIucxOLj8u+TpkYq+cbtZYT0v6zwBmkfg2jY4vt62kxaEvXWhwAcoEg1NvOtW4TFE3QAW8QQ2blFep9SQBP49XFt3fPfFNeyZNot6yLNk2Au2+hrJlY9dn5kchPKEWU6XLNQCK52VB3g9dffZyTG3/LTeg7xy2F5smYk2xaWGu96felJjmtm7aZ9QLbMdCUGTeWzXOYePImKF4dUORM4/KQiCzIzHgbi04zh46C5OClcpAArL1G0SpD7gGeU/b9tvIa+trFFzboSK0Nk4UdInpCidzxK2y/+vg8VtLEl5CQDuw9aybdqlu8zjg+mLT7a6b8Djb96HGYBXixlKlNxGL1pt/U3E3VhEOlm; 4:FDWZd7rQQgk2EhFWUgbSVrDejzBTG6q4wgtBkzROB3l8byq5KyuAr7fJ2KdiiVybrq26qizHPL8i60CXBH2rjjk0wL5DzP1sekzHkwk/nQSEe4Hi7ogha7M0ZfvtTrLjsoORQsSGKNlQVsd484WjHV/ZeehA57n3Gzh/drxM4h35xvDY49gvEMkytMQZC89BZpAW9scAi+Pxv2aLfNyNeccUj174WSaSc3ywAvPigk+AgdYg4UHnz/C4RuYtGusiOCb6+3H+luUH1gLnnO8+UJ40/3kBNyJyhe/CSXDZhN+uq4/nOMVSHvMFs0RGUZQc X-Microsoft-Antispam-PRVS: X-Exchange-Antispam-Report-Test: UriScan:(185117386973197); X-MS-Exchange-SenderADCheck: 1 X-Exchange-Antispam-Report-CFA-Test: BCL:0; PCL:0; RULEID:(8211001083)(6040522)(2401047)(5005006)(8121501046)(3231254)(944501410)(52105095)(10201501046)(93006095)(93001095)(3002001)(6055026)(149027)(150027)(6041310)(20161123560045)(20161123558120)(20161123564045)(201703131423095)(201702281528075)(20161123555045)(201703061421075)(201703061406153)(20161123562045)(6072148)(201708071742011)(7699016); SRVR:VI1PR0402MB3919; BCL:0; PCL:0; RULEID:; SRVR:VI1PR0402MB3919; X-Forefront-PRVS: 06860EDC7B X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(1496009)(39380400002)(396003)(39860400002)(366004)(346002)(376002)(199004)(189003)(6506007)(8676002)(16526019)(305945005)(26005)(7736002)(386003)(486006)(446003)(48376002)(11346002)(956004)(2616005)(2906002)(66066001)(81156014)(186003)(3846002)(81166006)(478600001)(8936002)(50466002)(6486002)(5660300001)(6116002)(6666003)(7416002)(36756003)(50226002)(47776003)(39060400002)(476003)(86362001)(106356001)(68736007)(53936002)(51416003)(105586002)(16586007)(316002)(4326008)(6512007)(76176011)(97736004)(25786009)(52116002); DIR:OUT; SFP:1101; SCL:1; SRVR:VI1PR0402MB3919; 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; VI1PR0402MB3919; 23:L8neStdKGlwId7QE4KqgMaz/HgKeMc0EX/DuG6L?= =?us-ascii?Q?T7+ZS+ef0Ag00ZxD/gYSpYn9n6nxyk5miuWX7fpegQNELB5yX8kNXGv0AJSD?= =?us-ascii?Q?cOa+4mxRcV70QxBK1elwKBYMXuSqFEwgO+sZXSIepgXlf4NW3+jpFjY3EAZX?= =?us-ascii?Q?ylUzfUo9jbKge/rZUXLXsQrPhbvtHshK6ebIxn39U3A8pOXc1Xjfgv1k/wIn?= =?us-ascii?Q?EWuiczCoXtamFMji2J/tly60ttfyAhJn1rSmXEcoJ1M432CwkqJgh5QjY7gg?= =?us-ascii?Q?LqoUjA1pPmr778JJIr21kpa38ziIWpDhvJmjSgfUtRJmXDyxMJOFW3BARkPF?= =?us-ascii?Q?0v5wvNXLI4kDhFay7BQsDk1IVjBO+mkm/+eyGg8/86wElelkHvncCGdOjTc8?= =?us-ascii?Q?LKKnJbRrQn9DgkOvuOKSW4KoIZWvgm79clFtjTYDqqHLSm2SR3V+AeMg4C1F?= =?us-ascii?Q?imqnHsdKZ/3GRSuBfKGUQdNY1om9P4BJmhzPjkQghyvdSBHB2kADMTWCjCFb?= =?us-ascii?Q?snaZmghqO4Kx3IOarR0AkmJkCvbszztW9sG4oFKGGzODOvbpV6+DBlI9HaKH?= =?us-ascii?Q?S1VCSJfZlohnV50nnb0dEn9wUd/3WAXT3YiKcmj9ci0R4p8mxWM6PYWiM9K1?= =?us-ascii?Q?jv4oWv+WIWJTS0cnSevZS57mYHHqepgbkg67hR1YKWydo3dZLUigco0ZC8Uq?= =?us-ascii?Q?pq0MMYL/CVyywgMydOtnKzTs16gNEVmO+Dbhzgyv+lWkcWW8DbCff5MrwyXi?= =?us-ascii?Q?FXGFSHhl7SIXLdAENNk8/S3yoQnl3obHY3ZP7rt5njaF5GvXAKtTcaL+ujrw?= =?us-ascii?Q?ltVHdZDYJapa5+qC1Qi57JTnn7kOGEoOc0nyija8nfWaZAijwU5H83982lOW?= =?us-ascii?Q?/j9QR86K1sC08TXoEC1JHYGcrlGRBspmB3mO9gWWTb9sFNuR+5LXAidHh7zg?= =?us-ascii?Q?5568UYzKlniTlash7mTviyeaEToGRpzEez/CSvArTNb9y+o2fr7e/CP9I8wI?= =?us-ascii?Q?K2xw7Fa7rwP8WRkECRERsTWHL0NBDq648mBB7haiEmKHkLt79FYkax9ogYFz?= =?us-ascii?Q?q/YEzu1q67nhS98ANjQVfUBszSkXJkbYWodvAGHheiVqL0qpViCw8X4W5nwL?= =?us-ascii?Q?A+Q3Oof1BfkbqGvPsLp6d5N1Eh8uJAUtYYkzmEyaXslP6Crt0M3Qzo+Nfk04?= =?us-ascii?Q?Ryj8GKdjNWw7UL57BvKAtqgWvJTJp0/4Wee/cZF+krCC860zYa2BpHsBVcg?= =?us-ascii?Q?=3D=3D?= X-Microsoft-Antispam-Message-Info: ZLu28tv84Gne3aUlRkKK1G2T34AZeNU//yFDBKyr7JqV4OCYZstzIWPQIKDSLLQIkpm6cx+Q2Aez7cdOKEywsgoW1E3zcWruLEM+5Lza8CQoj9vK6RRmH980T6nRtq3KEB4i4oAoYyVJJ6jywZPy93N3oz4mU5Fq7Oj5z149QSCgMzLDb+/YMjlS2nrWTlGT X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3919; 6:lW6VoypxoI2bP7gWMNg4KbZsP+gMWpH8yrtbtaF/PwU/7tKzJdVWMqbpcrTiEaOfIksv7RXbTphpSWN65QB7XE5Sza0YQJWngtATOJ1n/1yiEeDD8Pyr7imXA8YfNpghupINCITKgMcAx3CH+L+t3WCM+gSvUwW9pTBOVAVNcZdFSmRrygo/a5WHFlijIdH2bF1iYwN/LiPtTX7FQvsDU0/AEMqc77wUwOcV9hR4SKivmWZNmmD7CN+pPAqckgaDgQAQvudFFfFk3q2U1ByqeA322F/2Bk5Yj9lardgpg8VB41qwnKpGngahMgs/1pk3VgnheKIgVJwy7ZqnY4yf2OIdaVwo/tW1hAbywr2oqKRyjAu7zSM/+JLRzENJ4fg1frNnHLMPeRbV6sSIf9MIV0wjE/ErQc2BQqAYSCpTUCuqEIriTIQp3NRR7lN5R4umpwubF8zmwgULd9UkrykOHA==; 5:uoYW6qPONJ33fCXJbjhwbJ5UNalzle/jbZ5MrGAzBtepMaeBzjpBsIeXCiRAvkBBiuL6fd95iWRnvqORtE5u+g+JUDb7KmQMb46STOie48fQxt/fq9JFGuYAv+tNNHknFvbO1jAQpvrmQglKhrk/cRIxhlNR5102Pi5MTpbygUQ=; 24:24N+UFJv0aYHvO8LZuE5urfu3oTCzauIE3byF1nLe2vESze4A/p7GBjtUyjcP87R/TKvOBoji+O8Ef25ojSr5hDdCwO3zrkkmAFIXvwnAns= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3919; 7:0wf5RS3m2WT+YUpiF9Wxj0z2KWjY6qMwd7Z+pGSJD+TAMr70wylpJzdXQcnQocy0kdls0yUnw0uPgzErrdWKpsIihZ/E9ufB+xrwoKI0b30H7tdo7FUxC5UjAAdBYc13PMAmCh8tXIHTWqndBhsk85jleOsummjC9oXcAwHs50VlLI7zV3bmb8bRYjPgamnS3emZyvJBAX6h92qHt2JoxxQMcvvBLXicMIlJpkY/TwIRUaO1PpD2SdTyf1DEwhHb X-MS-Office365-Filtering-Correlation-Id: 28f2246f-14e9-4d54-d88b-08d5c4488829 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2018 03:10:09.0956 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 28f2246f-14e9-4d54-d88b-08d5c4488829 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: VI1PR0402MB3919 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 Reviewed-by: Heikki Krogerus --- 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 aa17cd5..d885bff 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; }