From patchwork Mon May 28 02:52: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: 10429721 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 7512A601C7 for ; Mon, 28 May 2018 03:10:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 65A5328AF4 for ; Mon, 28 May 2018 03:10:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5A4CF28AF7; Mon, 28 May 2018 03:10:15 +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 B6E8F28AF4 for ; Mon, 28 May 2018 03:10:14 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753160AbeE1DKN (ORCPT ); Sun, 27 May 2018 23:10:13 -0400 Received: from mail-eopbgr00043.outbound.protection.outlook.com ([40.107.0.43]:28192 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1753149AbeE1DKK (ORCPT ); Sun, 27 May 2018 23:10:10 -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=l+QsCMh3sKwr8eaykMf6NcEF+HA4+MUrMRUR9EnY09M=; b=xJns05ZAJKxLx7pBRRopExMoG0wM3IZWIrm9AtTe0uWAjYI4xV8kky7W92iayz6gGHDMb0ymKdZP7XlgZqDkzeJVVOsoNzQIWmmkbzxN7wEfedWQ6D03UE+sYpiCvbgbUr9y4cIWnLGjmM3jbbSAKe9zwFIkibSH9m+JeUvZ8nk= 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:02 +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 10/15] staging: typec: tcpci: enable vbus detection Date: Mon, 28 May 2018 10:52:42 +0800 Message-Id: <1527475967-15201-11-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:VpgIVbMsPgTV/ju4G4U6G92p748zONECmVR6cqHd6CXAIFsLRN/EKIjvY+Z2lY8u13jefuJDflbebWm3R4oq+jxRp4L+vXcCKNnSdEiHBpOQkjLKmWhJtOEO/4bGfk/XdbxkECW0IGMzqScyQDdZVS3SSc4lsf73BzOQsOcTS7ePgZuavSSuPdyHHiZRxLPr1dJVMDEkNrk0DwgJjz8RnCGimJUNKPHjcrac+Hsiv7xA17VfUBG1wsOidEFmiWU2; 25:lZViFCHsBZTVhfvzRda2N/4cM3M1lrBdEJesyWSGyzFqsKoaa5FqMz9Bt/PH1ipM0j/LN4b0eQ/wSMJRGWO5YtR1Xz3zKoTt1uPQK61O+kGscIwQ4uGGSYv+v4yAOqDW6cd08rHBXbHcfBpKl/02+1MOEpPH/w825CQTOlJryRPOneHht6R1RlvtOP3qwfHVDCn30xV5FQ9aAOlnauCA3G3jI9wfc6gXiy508GR588t0Aj/zU3Z6vCep7MACAb4CifCjBJjyj6Ev+Lc6hUwnLp4w5b8sAOhvGbB+2CAUpg1sA5gsWrndn3YMU4IOY42wwqWG+WaYBWb779jsN5wrnQ==; 31:SqA3+S/CVRGYdxu8HdrWID3+vOyTr23ii01p9QMsu4vXOggASSb9VCmtHQOYuDYEImdHpUJOjPAbDLKZy8Pwz3Ohlmv9kC2hV1WUjtYYJf+j5MZ3cAUO38dH/npiG7K9fd7HTtvimVVm8G1WR9bUVtCvo/MfSbxbRPLLAOmkNa46dln1ahD9KIOJs6W74bwFWIlk3DHTzRYUUYGEN5yPe8jvrJbdRnQAAsKk2Rvd7Ws= X-MS-TrafficTypeDiagnostic: VI1PR0402MB3919: Authentication-Results: spf=none (sender IP is ) smtp.mailfrom=jun.li@nxp.com; X-Microsoft-Exchange-Diagnostics: 1; VI1PR0402MB3919; 20:J5YQ9amn+LiE8Gy6r/pTycc7i07C3iYEWyCX9KsLi99w/t9ub+DADtdT4o83E+AiHsW+okWhpY4GBP6j12NM6Da/pHgiq1+BjpkYU7fuU+WPzd775s10blglGPeXtk8+Z1LVXvtzpIE1m7jt58lBG2+3sgl5TLQLNacc6KdN9j0+8BS4wwGlMzwYQeE4WPVfqTnzthMp3rczCXZIYXkc6tGvQkvySPrgukZHL5prkkANqtvJyU9wpC9UNm8RPZ+thhu0TIooTH6+uNJqWlIWinpu1j5BzVoVWCki4cfng6TOg48KYG2iTzzhRtsR96F0EKVPxI2Ij7zRb9XqpuFX10JuLqcEvsPyU16Rwr5DflvhJtYl/45iyCEHzL6rDMY935n+NGYYXNdDARz+K0fIubGf7jQwY3ovZpbtyVkRCTynOvwzPVCyQ7NFwjJb8oV+hCDhyqWlEwVLvANMR4VmMVpEEOzDzdPBEI9C+0wsHIu+YfL/yXf9xY3psonv+n0w; 4:mygHEv1TZ+JKZlsWWZ7WI+i81s7Hk3lTXhRccxRBqc3q9evT7l4ZNX9kIMhOgtbRQkMKIfVK9INfgGpFUt+8eeetm0llGobmTXfZkD0qeGASjdOzeGPB4g5QdhGyl3LA7L0hRJhv+XPcK2djn4qPKc6HLSwQSvGuDdKk/Qt5lakVqVGX6rkHMsegnt5N1PByI7DAWzBfeL4I7NZTZoUe2S7gi0R1SJp9XapjE9RG+8atnLAXbfMNryOXujj7EBojHqgQoGjzzETs8mw87EQnYQo6xu2Jhnw7RHkYYEvBhxhw/qg563Z/W6mICmQKRsRI 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)(59450400001)(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:acxKUVG8T7SiJ2YnToeRxBHdQnWz4lW0UgzDIM0?= =?us-ascii?Q?81k81Pe2KcUF+YZsKnpJR7uwNmtJh0SqtEMSK5Old2CGSJ91mWj6YA2K0abA?= =?us-ascii?Q?PoUi0HKePbKe7OIupmdeS3vtb10rSP5lcfJbCKifkYu9hpY5KX+SNv4+U75V?= =?us-ascii?Q?/03IXb84mQKdmOdws4wx53+3jhG31D28l3rwPTbHzYpVEoZsTRE0K8Ev8cUe?= =?us-ascii?Q?7U3FIzEZ+/QfZuUJJIFxW+0dYQ0/EJ74LJs1DRyRfRo8FdEZmazwB/1LXtSO?= =?us-ascii?Q?XFH/fLC/idQPExPeZ38kOFtx7O9Xd5xZ+HnGhINB6gIYmkFpL2j/rdSgLCWX?= =?us-ascii?Q?8ufbJbQ4p3zssu+t2OypklViUXBrT1H7TK506NUGeblVARrvYG07fG3V1N+V?= =?us-ascii?Q?HzZyNfRabE06LMt3cPYDpPxZ8hU33LKEY0KPF9oYS9nKIwyBhocvjKxGa9RW?= =?us-ascii?Q?yQWb8hmlIBFpfFVABxOhLfrqbj5gkW5JisqTWo5EBkwuP2Q6IabZ0KhYmW03?= =?us-ascii?Q?w9uJaRnuqLJUvDdfh6Y22J5bY+Qon77O2LN34+m4XUnLg43J1h/rCukRO0gb?= =?us-ascii?Q?bdOLUmYYZOEt9WHT7qIoPIAqEtwvqz84BE+XW5dPH3/Ao8lFP25xu1f9Xd/3?= =?us-ascii?Q?4Go12138eu4xpQDhHUK98T3OMf+Bi5p6bV8jnZulxHisgBDvafl2cC56Fn5c?= =?us-ascii?Q?DAJcS6rPPQ3rv4SH9d7o8yy1HD34V6Oju3QozhnSy/n6i5SW2MfQCCZxyzhm?= =?us-ascii?Q?MJh5uPScp8Vk6DTfvJdoQuJ0qYo/alQEFlSYkYcYUsDLgN0ZfiLYmpD366no?= =?us-ascii?Q?TAe1HmNNZC6bDMh0bIVvEj9KCiEXkHTL+gRUj11DgOzz992rsljpas2ienW1?= =?us-ascii?Q?vqee0vtFq9B26lBHNs+CUzufL//RGKJv7q04weDLLhXI20dycI1cZRDI+nIS?= =?us-ascii?Q?3lDXjzmFBz9mEJIxfb2TLwUH2xePVdGgv8f9Y9y5pYLwh1My0V5MpiI9tF7Z?= =?us-ascii?Q?qnpHdgD7YU15orYtX/5CepBmU7JxXwVAktAAb3H1UVWmI/2YA9HdawY8ar5B?= =?us-ascii?Q?K4EFoYSMas7U8nFhtF5tF9U1pD0T8rULdhEWI+wEpvnLVwQ4eprb9NaSqeJX?= =?us-ascii?Q?IzVh6EhTBzrd+8MZwg5268Unw/SXGDKLQH6H5t5odzT8l42tYDWCwxfRMVSb?= =?us-ascii?Q?9YJpdk5v09Nx4okQik8D0SZBEG2BEJu66WCpVmreXw/vA92ZXz72/vklXgs9?= =?us-ascii?Q?P2teMQegtGDU/6MInXDsZsuPxCO36reA4sqgZEzOF?= X-Microsoft-Antispam-Message-Info: zuJlbYD8IeA6DUFe+qz6cNl2IG/QmIn0c7DJurd4Sqxxw/YVcjV7qju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4lrblTDPLt7ErXJtw015qElgQwtPVxtHR1jVoxHl7bYFaJLPnefC1fNbEDquqf3yjTwP/wzsE1LyPrAQVYkgD7iyGDlicEPWq6fGloNlJVAtapyYQy4A6yMzqt6TpT/It86n6MeK0FGnshmITLowdNOr4SMnT76H+HZ8rWqDg0R2fB/LG+HRnkNpxJFFpR8z0dsUu7qM X-MS-Office365-Filtering-Correlation-Id: e877aeec-1d48-4d81-76de-08d5c448847e X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 May 2018 03:10:02.8924 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: e877aeec-1d48-4d81-76de-08d5c448847e 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 TCPCI implementation may need SW to enable VBUS detection to generate power status events. Reviewed-by: Guenter Roeck Signed-off-by: Li Jun Reviewed-by: Heikki Krogerus --- 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;