From patchwork Mon Jun 25 08:08:42 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10485257 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 695196031B for ; Mon, 25 Jun 2018 08:26:52 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 549A028863 for ; Mon, 25 Jun 2018 08:26:52 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 48AEC288A9; Mon, 25 Jun 2018 08:26:52 +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 DB7E328863 for ; Mon, 25 Jun 2018 08:26:51 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752998AbeFYI0o (ORCPT ); Mon, 25 Jun 2018 04:26:44 -0400 Received: from mail-db5eur01on0055.outbound.protection.outlook.com ([104.47.2.55]:25088 "EHLO EUR01-DB5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1754177AbeFYI0j (ORCPT ); Mon, 25 Jun 2018 04:26:39 -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=/Afl3DmApGnccdp+jpVjFufFHiIznmY44HVc1+Jq4qA=; b=UaTKQ+0A+OZXAQe04wslGATat+BdiRqP6AM8+C5se6xYZ798A3NXuEuCLNqs5J3BuMAxUQVTvC7PRMfl59mkhWZkNNWmismDCIEZrJoLVwtthCiEcRKqUj3HyZ8tJk+OQd+ZCzm1LM5IiScZBSfi9EbuXtHwXAfgpyoYC7JlEyk= 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:31 +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 10/14] staging: typec: tcpci: enable vbus detection Date: Mon, 25 Jun 2018 16:08:42 +0800 Message-Id: <1529914126-22550-11-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: 252fb264-c6e2-4ddd-75fb-08d5da755d93 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:mk9xqtHjNFg2bG2w/cxpslJ6UJkqjfXoZ2OlIypbMFa7vSCPCGTH5EUV087X2xBP4oaWGCiZEC3TxhjbYkEbqoaQtUxTF3Ues9RIfe6pynNdwxv7gbv75gKZNDlVgr3KH5Uha7kOra07qDcoDqCpCQaPi43WDeFfilrPEdVsK8GPa+uZwg5z0B6u2URD5NrU7Eg5k9S7Jh2E5G2ULSSCLWYprR96Arapm1oIcG1RKvRdetpcmfNPAROn0O30R2Q4; 25:k8FhNf/SYn9XooW6C1F/SOQURXpZt/vgbvXX0lnW2bg7KNbSKvPxPdBwaUeNGwxKIb8C+hJDs2Dd15uX8v0zaXVTGsA7TYkeoX5SIYTvW1c5sobwZSS7jRbcUlNyK0AEbo63snvfdOV3oARsLhO9RXCLG9vMLICcb4wbFr7VLW67jCWdEGkp0ZqYcGHzubS2j287qAiVRsDfVp8FVdsdL65ki8D7BTIjMqmv/WfZfEXo2A7V/V4aki6Yi2Hor1ThGouSwaiVI3WEAVZw2+DG6s//CINxU92fDqAxg3pH3aBoTn3dRQDdKYaCA9eUCwQFe4A/qjOvw5/ZFkYOcX8u6g==; 31:y/OFKCaLU9wQpJO8JtDB4fR1FOxmAfZWuA9bUgmKQu8dePqr6Lixkaf9nkBos0YRk0x6uT+Dxb8ifw/AujeKOsi7//7CTjZ5cg40Ak4kuSV5L8OcH34V2IgyXfl46ezEHXVCCqR0d+zkS9nt/uN7WhTLUKtw1ebXJpFTlCUMM7HoanmIgxOgI/UQ8tNBcYhe+cSHVgieJLf0Q4CQ1p0OEqgpWriKt6dDvWnvju1gC8g= X-MS-TrafficTypeDiagnostic: VI1PR0402MB3920: X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3920; 20:S1ofdsmcVXRysIgWQ3e/06UA0wLUzJ4Gyohqig9XvlnEWIk8/iIGikIDeJhlVXxQlmdxUJaN2KmbpgDr4+2k6+088IMGJl3eq0uf0XhPLFUD59k7EEEpCDqciI6xhTsQEeWshsYjdeZjRVgtwxRhYu9Va2AXVO3oygND4J3mE1nWh3ICos/RJcwTv5wtq44G5RCwxp5DDCJoUQzc9gY2JOuh1SsojNiK7kBopqT6rMNFCov9l+E2tC9kolCHkhcuT7rYhMEP/Nzsqj3TD+hqFqQkXJIQvUmTeOga0fFwHr7VAojv9iuLfxkylQi4rXcIieQGoTX+mKkQutuhdfkPYkvfkqEwWLErgqQk3tM+rpzG5OcUhrlbeRDHna8IguFvdiEZ1G24JIo/pz1jmpnknBslNY2uEi/NAC0zFSfolgT2ZGNdOdrYN+dXY4GmIefLJ9B9JSovQnAmO3GlrB8ODl1sDe0pZmqZQNocPiZHu+ZAvHw1oDDtt5NMJ5u+ewm1; 4:7XrGrqSnbc0m3phw1Jmc4hOBc2SxlUK7DezWBLZunU+yi8p7mAaMpMM5d2NqJxsKl4w4QTATmdQxcBts9mLExYvu5wjE/Ng1fzp1oNSUYujEBNFQ/HAJAh2Aa6CdIUx2R/bnvSKXaRIfzhWyWbUu8abPz/iXhrKuFW5NyZM7u/kgaqB6TT1lj4BT7dIhWzJVDap6c2qaT02sZFZfl8VJbtjJZ/jVz2yROeWLmWdoR4ztVcb2g8WJILvTiCAPGsVV1olCLyuechzc1PaYLST/Thhgh9yXBj/9NXbvM+xUGxnhY3wGRT+0akD8aCdpmYuRCq27IRUgb95Ohff4Q7QM2+YZhjKGRXnQIuIVvx2qjcM= 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)(59450400001)(50226002)(52116002)(575784001)(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:nNcN89QV9JYybae00c197RBHC7SCx45838FGL+Y?= =?us-ascii?Q?4TxsKj1YyjptwYx2tZjb3ERcEQpd91kDliez7VyGCyCnSIUOiHNEjXlkwdQo?= =?us-ascii?Q?DWLEuQ09Rsb1YTDp6tHrqXe44icDBtPfh6MnGo1eDS/oSUJDlyDpvGGqEJhe?= =?us-ascii?Q?CNz95HXxw5Sx6gSTtbSebkNuBvfziWW6/qpL1r+L/BRn8f7kAkhPbKQ1uLko?= =?us-ascii?Q?bnzvfj9W25yD0kcPiaNshVFGi2i29JQcq9KrmroNoUU/LtvVKlkqfno+LG9A?= =?us-ascii?Q?Bvg+Kybj7iWXM/0T61zZxMeKEPwJySWxQ9Pz40DAXKM9f7OplZNeIpJm+3/o?= =?us-ascii?Q?PXipTI6+st0t12jVE/jteAwj017p4okMxn+w2jGbOdOIJf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TygKaKYWE1zHA7lDI+heBpVz8IkAIswm7KSZMbHq+F3HXfQNGEo3Y/5/7YZY6TJNg= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3920; 7:AHVr0CNXmI9qW9t2NzW9wwexUAKLOUBgmexkRqBNQAGPJd7C784vRc1cXuRASHitnqnVDZChTk8jb37cW3WiWxUBi8fXAUEnB0PUc+kGupETeY7khm9j2PPVknZWFE2TWcVmaR7cYADnUhSuCMtyeCdyLgCOLLfl+/O0TaWZi50FB5QcSecnpB6b5qZfMFUYRYdDbCiW5d8fAkl77gedhnPCJ5K2A3PpDoURxu1nGEKYT4ww9r4Qwz/iUvzdVu2x X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 25 Jun 2018 08:26:31.0173 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 252fb264-c6e2-4ddd-75fb-08d5da755d93 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 TCPCI implementation may need SW to enable VBUS detection to generate power status events. Reviewed-by: Guenter Roeck Reviewed-by: Heikki Krogerus Signed-off-by: Li Jun --- drivers/staging/typec/tcpci.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/staging/typec/tcpci.c b/drivers/staging/typec/tcpci.c index 3b35fce..4d3b0ae 100644 --- a/drivers/staging/typec/tcpci.c +++ b/drivers/staging/typec/tcpci.c @@ -373,6 +373,12 @@ static int tcpci_init(struct tcpc_dev *tcpc) if (ret < 0) return ret; + /* Enable Vbus detection */ + ret = regmap_write(tcpci->regmap, TCPC_COMMAND, + TCPC_CMD_ENABLE_VBUS_DETECT); + if (ret < 0) + return ret; + reg = TCPC_ALERT_TX_SUCCESS | TCPC_ALERT_TX_FAILED | TCPC_ALERT_TX_DISCARDED | TCPC_ALERT_RX_STATUS | TCPC_ALERT_RX_HARD_RST | TCPC_ALERT_CC_STATUS;