From patchwork Thu May 3 00:24:52 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10376847 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 5F29360384 for ; Thu, 3 May 2018 00:42:30 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4F39529137 for ; Thu, 3 May 2018 00:42:30 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4408C29153; Thu, 3 May 2018 00:42:30 +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 CD13929137 for ; Thu, 3 May 2018 00:42:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751864AbeECAm2 (ORCPT ); Wed, 2 May 2018 20:42:28 -0400 Received: from mail-eopbgr10064.outbound.protection.outlook.com ([40.107.1.64]:32679 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751755AbeECAm0 (ORCPT ); Wed, 2 May 2018 20:42:26 -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=Nxe0T3R3kxrS4B4TqYKDzjvXcwHRM5hKDLeRiSUKQW8=; b=ri2sfS2PltwD04urnKVo9JPZ5VM02kgxlTqrMMmTtZ5DtVlSAKgGyyVXBYGYaAg+MoezZO0iW8MFczbQ7+FGkwDCG0AKQm+94avDfGC2kfT+q4PnNSIJ4g5ZTuvDr2oBTk0UJ/vtc/3vn2WKcvyxlFxZYSlItVmnlWBkobMRvHs= 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:17 +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 12/14] staging: typec: tcpci: keep the not connecting cc line open Date: Thu, 3 May 2018 08:24:52 +0800 Message-Id: <1525307094-27402-13-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: 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/BvydWkrlBNLUWrx78iGtad/Sd59ZjTNaKZxogEn4s0WFhlKFEoV8O5ZF3QcBwRqCcMA0arg9pL54mVodUFx9HjzikPy2G9nHDz4BshuCnhk61pwn1yVrxzVt24NQskRs7W13e01LAna6SzihqNbdDJcOBZ0vVSxhTsXd97UCTnETeM0BsaPhMY23xmZju8dbCISnseh2kWHKhiewvK2U6R/s7Ffw8fQjO1QWjyCRqwsJJ/yoyaQt4jcBAuA6aDmu4xdxbEOpehOI5Vp9u/Nc4g7Pkm2nSWwloqo9dsjmnxikrnpsPbivr+Gwp7533gWUqY3+9MJzcJEsOWdTCH3GMFiFeExDQJZmuUnO+pRluyLCgVX7C; 4:Dk/8DIn4RH24Fltp6rZkw4TtiC+hbfaEYWBeHwcWKLyztyiy7RjVX2NAiz1xiYzngVjCxVzJ+2cJsXZOzVpMSdzQSGklB7mY6p5M+AZxO5XY2Qv1CmM4a2hY+8dtHxzi1WtMLfV3/zhjelLMiEyUAPHy7E8Ley5tBOzOBtXIGZ/ceQlBqRK1K2DkduUt0t0/i9Aq53feCDJu1XSSNCq1YkGIJvpAPk0mxOaJemsFCBhTwR2CumIrNwNuuTf6pRx0jwlRkNox9fwGSBnVSJNkZSVQnTZYERDE+5d5r+1iJ5OTtWqtSLJbhyzhyDRnQV/V 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)(575784001)(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:AsU0RAfROdp5Pdwo+DBDeKn2n3/w7TVhVP04ng2?= =?us-ascii?Q?IhAaf26bFYX1X6LTyAoT5gD+hb8TTYIfvHaHcA9F/2gSUT5Vx8Vj55MQoMmk?= =?us-ascii?Q?KZyMeDqWWitiMczY+mEqaZ/k12YG6PcqwebTge38hStLXoawce0IJELOxk88?= =?us-ascii?Q?t2GXwSE05ltFLHBYvx3vmfuIa1Kzi1lseIc94JaB7Wqc9T1Pqo/IPul17BQg?= =?us-ascii?Q?4oV6R7dbxUJTkZ4TyhgsWahW7Ow4DCTsJTdvZ316PZ5Vpoa15He8CUi0VC3n?= =?us-ascii?Q?EUmH+9Dl9gxYoCUIBW35+5U62airBNBBgGBWT3O5E+vDh8mCX0nkBA0i756/?= =?us-ascii?Q?ka8XUPfjlHFboTIrjSymrn689StCHzWSqIjhwYEUbuxWI5RJxoof4YI4l/jg?= =?us-ascii?Q?RB9YrCKnTaKzyhE6p+Otfg9OOQVPDHInOvc1KmELMLbMJ6uvpXO1J/saSmBN?= =?us-ascii?Q?udjlUHy/Xj3+0VtvfaHSxN+FmLZfzByb4hb6Yl4my3cWOrUtIq7W6gGoGs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V7Cf7kVbIAtqq2/ai8oiFCkMiwQZMVROTHAjdsdgwHECjz X-Microsoft-Exchange-Diagnostics: 1; DB3PR0402MB3914; 6:o6cIJ0yHDovlSMGAICejLY+/hXqHxvZ1Et4sthjm6/QFXFZBBMsveQ+ma+j3D2dpIXnpqvijrDYsBKkxXQZYuYzvXF9ZxAGmq7WV6TVGGYwLbKrjfS1Np24VQFmqdmHVhio65p3GHeQtRq6bYsDdA907fZoV4JYzVnCkmYuaILFcDP+pwY4tz66Y+Uhg82IhRCg1ZCPpIEZn7MCWiBwOX2uZY7n92h1zjb3AJ/cCbnEoKWN2/kbQIE+pi5RcOcrXKGOay9dffVw5VnWN7frhc0JS4MLwlo0iM+eXdDtV0ETNStdk/bzlyJFOiZvwvzsh4UvoP1LVyvtNj5jHNuDqM8qHID+In9OBzH3xz+zWW1+Tkp4dxmP4uubOvip+caqr13GtKsq5GtopT0thNSYQuaedh0hHdrzSiZa5+qdbZBby5EhCwT5M1yv67I6gR4giQHD2FgCkdM1HVu/buFbDDA==; 5:Db6ymDpiymeFxl5XX0AojJiRkaheP6JiIdowLq78BEguhUgcf5u1UitmTBN/BS2YK+JR39AXXWRnc5xJ94pJS54Gg/dkrBEHC+nPxE7GodIcSMlYvK1oOxF3AmXegtGZbR6TyhHQQ4waR9yViJoRPTKHLNDxJH9Jl8BM2WqJ9r4=; 24:EivNua8VVoszY1I1IhssifW4b5oUaS7BunPkVtKYceo7p2a1owvUGcj87IJ3LwWplSoJ7UiuFmoqvpiPN8sHVoXlmg1LSYzgJAfKCirSqus= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR0402MB3914; 7:P2o0f8muDL2xu4J1Y+j7BmdnucMXJ+J1wUa9piVK0g8fJj77pXzbX3wrFj/b3H9xcLNjERfYntjHtl+DUGSxbTzw9VhwP/mEV94jgGSfswce6m9SDEUy7KDflcDy4xssvMoSuxi9a4G6ibqbpOWCapizjL6R5EUC+JT9yfFYTKKVgeuJ+0uttCpaa1UKD2nbRInnMLoe9Nro3T0vy8gUYsmI4u5s4hUlQTlqHmBDpXVAXmD+uR2hmjaeMv7aSVPi X-MS-Office365-Filtering-Correlation-Id: 7e742b01-abfe-4530-5f64-08d5b08ebc60 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2018 00:42:17.9288 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7e742b01-abfe-4530-5f64-08d5b08ebc60 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 While set polarity, we should keep the not connecting cc line to be open. Signed-off-by: Li Jun --- drivers/staging/typec/tcpci.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index 5c48810..5c0c5e3 100644 --- a/drivers/staging/typec/tcpci.c +++ b/drivers/staging/typec/tcpci.c @@ -185,15 +185,25 @@ static int tcpci_set_polarity(struct tcpc_dev *tcpc, enum typec_cc_polarity polarity) { struct tcpci *tcpci = tcpc_to_tcpci(tcpc); + unsigned int reg; int ret; - ret = regmap_write(tcpci->regmap, TCPC_TCPC_CTRL, - (polarity == TYPEC_POLARITY_CC2) ? - TCPC_TCPC_CTRL_ORIENTATION : 0); + /* Keep the disconnect cc line open */ + ret = regmap_read(tcpci->regmap, TCPC_ROLE_CTRL, ®); if (ret < 0) return ret; - return 0; + if (polarity == TYPEC_POLARITY_CC2) + reg |= TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC1_SHIFT; + else + reg |= TCPC_ROLE_CTRL_CC_OPEN << TCPC_ROLE_CTRL_CC2_SHIFT; + ret = regmap_write(tcpci->regmap, TCPC_ROLE_CTRL, reg); + if (ret < 0) + return ret; + + return regmap_write(tcpci->regmap, TCPC_TCPC_CTRL, + (polarity == TYPEC_POLARITY_CC2) ? + TCPC_TCPC_CTRL_ORIENTATION : 0); } static int tcpci_set_vconn(struct tcpc_dev *tcpc, bool enable)