From patchwork Mon May 28 02:52:45 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10429727 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 70D9260362 for ; Mon, 28 May 2018 03:10:32 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 61B9628AF4 for ; Mon, 28 May 2018 03:10:32 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 54F4B28AF7; Mon, 28 May 2018 03:10:32 +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 DC99D28AF4 for ; Mon, 28 May 2018 03:10:31 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753171AbeE1DKa (ORCPT ); Sun, 27 May 2018 23:10:30 -0400 Received: from mail-eopbgr00056.outbound.protection.outlook.com ([40.107.0.56]:32004 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753131AbeE1DK3 (ORCPT ); Sun, 27 May 2018 23:10:29 -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=KZFjMmpi+1C1pELLr96/QzoOQ5f9zuDH/R2cjHvgzLA=; b=MbAODqTywsJuecj46CVnglSn9oBzuu+3v8EZL8olFHgUno+LxCVTzrg8Cyb3QsAGoZ8axtkIgSMnUMpMZ8UG5jqjAmH7M74/ImoJQQEyLEuk+hwGGnWioP0ZUqKIxjYv4w6wrU2JE8i8hcoOLdMR7MY/gtbArLdE3d7o3AylbbA= 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:21 +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 13/15] staging: typec: tcpci: keep the disconnected cc line open Date: Mon, 28 May 2018 10:52:45 +0800 Message-Id: <1527475967-15201-14-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:FFhNs0HT8YAKrkVmqXtlnBd+g5X4v5N2OrpEow3d9CmcLG9FuusVqdY84g8H8I7h1VfCzPseJCJo6r8fdp3/WkssC1Clc81grUKK8NR7cSDgFb1TWHELlzSr88K2RmlvL4gj45s33VpwpupqeU1vs6caJuk1boL0topY/MNU52PbtrxWZX8mxcH0GTqs/9Jg4E/iYJXUOuGSjXe4qqUjI77qSlrafxlbdOdEnp6hIYJ6XtBQYitU0KxP7MLvJ3+A; 25:9AEPdzaCQI7u+4Fob6j+aHK83/rDm893XZ8+6+9fkExRQKxCrZ7hW4F8d8gVQRroI1mQeZmm3sF27jGMiIVCBl+tQpd0+rmX4LcIMIMOIMm1+ozz0PFz87o76TG4AuVp6sQ972gPmwFdgEOnWzXRnZxfIE+ZVVFx24JHAsAk3Q8TaKuHjMIYpeHDonE+C0pecAsdh1vBAL14pb6/9eAOQAiGKEcBzmTu0BwahasLz1XAX/lIKLPen3woDa6ijgbLGEoUcdjGf2+DnkFXGNctvN+tTltQk1/3if9iP18tUPHssMhTf8FmBnAlnlAxVddY7QOqPVppiRXOr449wkZkAQ==; 31:I3CAsT15sfs4jrpTnQ3bRzCUD7b8GxUPZuDXDNtEmye9qkCoQcFqtjmcgnpGcYycoK0DLOJcewUnBWdUS1mV+rQbWXQHA3qEl+DC2XUf0e/5KryYyq4XMB+OzHL1CQYklQJ2E80RJYPmCP9Of4BHjv0EImbkU+anM3je0dTGepjSbGnTFhGo//y1oIc9z6UYlIrH+a9I1AqUyUjuZCBaapmmWpMkJEA1GrQLGEdFVx4= X-MS-TrafficTypeDiagnostic: VI1PR0402MB3919: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3919; 20:CfqebRzmBVd6fsVbc4Bdhvq0NTa0avGKEvJLk1ONlhQNkDPO3p3Q0WVFSwiizIDjOcv/VnuVJiggPTD4+aBsDWDN/+3ZKLZ9dJBVmue2lWB57387Q6iJnmaRi3xXjsZH52HnEi4d43tuWezpWwMYkcu0JY6Yam56DvAtRgVSRKmIAYyFQFG+euUBOujIeSK/SZbxAq8ax8ovkZA8CfLkKtwK4eVRZm4c7cOHETP76R1Xa8G2OFBf1m+1q67xiGmYa5B50YGK1T9D8Z3p3cfCoq1vXC/+/uGN0mw/tkBAoAcIziDDGOPUjIENcfV2BA+zWuOEzy5/qRO1K323RMVygo6VFQzqAOKScJqNCHiAJgjoDdMs0Hmete/KZn+RpbUdpu7cxScFEFPhF+vU0keF2C6AhhqNT5JtFMwxLyvRv7H9XwHVTzznj2ApdgVcoyM0HEIetsjmjscJ7kjsi+Kr3AIIRkMhHXzOwKgumhvdXkMPoOPJYci9iYJ7sw4KQyI9; 4:Em3Qx83ohRU5xgoRBiBjtBLkQLdmqku2/JsWtRvwBnnpkwLS9BVIWieuWRkTa6J8yaOn5GytWQfEWlqDH858Mqp/GkoCC7RdgOELjvOs4fn1v9tXcChJhFbiIX7hScOKOEBQXaV8JnutZYn3J+3C25qr6gTKhpKlaBqsA4Flw+jH7WNnA6OfV6b+SJ4kX5osVxsIOWPD3kCOA25Qgt2tSdquVri+HdfCYeb5kFIbQ5nRg0bNpkKKZqPPEdBsDyilqMs2MheCFLKwEL01nD+uRUsdNrI/D3ybgq4VI2dVT8PxBXyzmsxJv6FiOhMwWMa4 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)(575784001)(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:ROcwzNXKeHxtUhKEzVQz990DIO5lFcPcupCLhd1?= =?us-ascii?Q?X/sWhrVqFeeGDv9aacCLXNPUFju6CiIpc04wGtldIOlh77P+tRm+NlxGzYMQ?= =?us-ascii?Q?gvMe8k91d/dj5xiqpzxAMnIQ8NOxrK4rQk7nosf2Y9Ziq9myEpk8qaBYhi7L?= =?us-ascii?Q?LEl4B6lprPzHctmkIaMPsOdeCRr/lltXFiojJmqHL32oANDUHay/Pg6pXTDt?= =?us-ascii?Q?gZQLCaAt8OLUPe5JgSS6A3/ytRPNh4ern72iRfuf7SRqq0YnFvA6YLM4ZN3c?= =?us-ascii?Q?FjM5S0+s1mh+wARlH7foWS5vFsdT1qQ5XFzNa9WGJejgqNVYGTR7ux1QHPmM?= =?us-ascii?Q?l9twe/opOmHhbGYVlM6IBaVcE20vXgB/aYjRjgh2EmO3+jkUb7SomOo3oVGL?= =?us-ascii?Q?XYaMZfawSxNbfWXm18n9pl13ENGrfmIglklGIHZjYvObzkj07NVlIA15CU7h?= =?us-ascii?Q?BkbxhnTRCI4j7X90KuyVnFAmfrDQohQgcdBgThZ+LlJ58pzZVihvBI0dEB2g?= =?us-ascii?Q?SJpF+m/vzWELr7IM8fTqY8Ja6IDCrfMvN1PEjv3Cau3Fx7Edq5Bakdol0HsC?= =?us-ascii?Q?jU7zXQzl+F4uFSRvdhqyvNHQKDd9lY5VUifGBDnzM6IyTQWChaqQoZyaeNUx?= =?us-ascii?Q?781ZtEfQK8PgJzgsNMiKTecTR5K/wmAxwIjpm3SSSG52BbafMtzfpSv6q44c?= =?us-ascii?Q?d06ubx2kNwcL7Qa4odJxpxid/tYt9o24/ucdF1AkN5aJaeiLoXgOw9s+VrVQ?= =?us-ascii?Q?piylRBrvskKaY7/xvCeiteedCJ1i8NHZsiFnaNCTbTkgcsZxeY63yIo6Yo5J?= =?us-ascii?Q?TaOKV+KohQSo17bUDxYPNYODv+L57HMF6t05Q/3VD8mb6/elSaW1VvKLDzi1?= =?us-ascii?Q?+9HNzaPaYTRso9M10GezI/Xk82HJh9ttpOvl5EBjDT0Mi7zl1LzUuEPTsLMr?= =?us-ascii?Q?oSgeYyDEBPipu+KSf9d3NoYW5Qnwp5OIj+/sIdRHotnkI4OJpxPJzqJ0eisg?= =?us-ascii?Q?w30XTJIipYpsGoBHX72Utrjwvt5DDNjhYpY//WSSTeJozd4dC9vTYQIIK9Az?= =?us-ascii?Q?Al88eklx07eNXFgusw2RvBU/1q0vE4ObYjr6tnwIojGEn1I1dKXlz57hndWD?= =?us-ascii?Q?+BWr+87cqHhlap7ngD2K5lZiXldKrHJk4MaVozWH7x4w8g3ZLIEjTlnnMweV?= =?us-ascii?Q?nV5scPQiHCdNVmatxeaf4H5KkQlLwARswoaGv/X/kyPydAgQfSWTDWMKBXcU?= =?us-ascii?Q?Ox8nJ3/ctRmbhSaFuuRA=3D?= X-Microsoft-Antispam-Message-Info: QEZ1vGL0xsqhF1NrzGbpIQ6+fzOsn4PhvkgIwEI1WZXucActYEze7+YXnxurGfBQ45KnJELbdZJHu9DnTzhlB5lxBT1V+JsUkivOsV0y4HmZxVK6ZAZhPWRQMFsm0102mAkXMR74B6Ze7Dzjo9w2uoFlEpMRT0DiVxu+U9zfoKEHhE3B8j9cKXYDvild49oF X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3919; 6:TQ3/smQ6GlvlkRSh1eD8DbFDMt//SEHd3TKv24IHg/MsqiLPs5Oy8+JGnVEAo47TnAhSb+3VQDkJmoSCgYkOW3T5HT/dZBW32mLczaKTC+T8CXnUSiewA+T9hitgg3/46C1s5yIoh+wsV6pLgBBbDhi94z0DtsEjMDB8OnJb7a5v4a/ycQNwB9psjUxudoRSxjaVAQYtg9lsYaFvrALK8C7sdCQuVw7u9ucZapBiSCCbYvouFrrEqrfFc+QKPDXZBQViLVPyFfYexnP0sEomLQHiYAxuF3qgQR95GETdhDKFWl3OWlis2OLGqq2HrRLzvz80id7Ni2rKp0ahCFjKlavvYwbmbQz7rzIlj6Uv7qdxh/A/hCDNdQc+HmLIaeG5aODKYGUfvEDln4b/MLKmGDRnAp8pz3Cg/dWkbselYhCRTeApusSkxzkb9dJlE0ltdJdDitPhBPSYXIsiW3cM7A==; 5:uqsC/PoRnLefY9o1ameWdZUsmZ1jMHRxmLWLzStqqBQlHJ1HLECOt2UNCdGh77v57N/fgrAaZLi4QgiwbdcyhKunDPGnftjNGbK6UFmCKA/kTuxyEu+CChurwHoOLOKynfwkqrAVIQ9edJfn/M289kqJnenI5SmtDodFB+tLAU4=; 24:FORFiwh3kgm+4MRt9em8ccuMCRAVIYVKHWGQDDbwVeVEnnn/lRdyp3j9broy2t/0yvGfLi1omgh/MJUEyRsuiMrR/mCszNpQ/kM2aYHONq4= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3919; 7:yuRwpGrr4L4lRTxh4x3PQlpmXsqiEEIaV7hu9trDJ7BpwGQ2+zfcONPCRojJH7UsMmEKz2hJeuf9kAcS4EtNY296t9RiH8uFg5HQZbsPJRtzJMnLXnBzIxBzw4k3AioOCHg3HsvC+/zIrD4m74Oflh74vkHvCitKaIDcxhEpqGVHq15LHCFcTi4ED08PWHLYZMS51Bl6T4GAiR3DPCbjWsSCuE7/ewPNinefNXjflFnBev/arJRaq2H3L9Qaczmp X-MS-Office365-Filtering-Correlation-Id: ca8ccfd0-f073-4184-eb3b-08d5c4488f6f X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2018 03:10:21.1427 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: ca8ccfd0-f073-4184-eb3b-08d5c4488f6f 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 While set polarity, we should keep the disconnected cc line to be open. Signed-off-by: Li Jun Reviewed-by: Heikki Krogerus --- 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 4d3b0ae..11c2d37 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)