From patchwork Tue Jun 26 23:45:28 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10490343 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 180F760325 for ; Wed, 27 Jun 2018 00:03:22 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0CD381FF13 for ; Wed, 27 Jun 2018 00:03:22 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 00D2B26E54; Wed, 27 Jun 2018 00:03:21 +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 814271FF13 for ; Wed, 27 Jun 2018 00:03:21 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S934329AbeF0ADU (ORCPT ); Tue, 26 Jun 2018 20:03:20 -0400 Received: from mail-eopbgr00042.outbound.protection.outlook.com ([40.107.0.42]:44438 "EHLO EUR02-AM5-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S932104AbeF0ADS (ORCPT ); Tue, 26 Jun 2018 20:03:18 -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=tZZG+pOKmUSKLd6nK67FrgFuO6/n4wO3TX9iHIWQrrhYs+Kwu4Zkgmm93oZFr4WRCmyhf5RGEvgTGMKJ0eoeo3LpeDOdYcxx9wI4NNyllC2QGp8851pJl+JtmaJGWapsmQXdihcXhJ0p4Rzt4SPqi+gXxdqo12ORavOn9KSv9yw= 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 AM0PR0402MB3908.eurprd04.prod.outlook.com (2603:10a6:208:f::28) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.884.22; Wed, 27 Jun 2018 00:03:11 +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 v8 10/14] staging: typec: tcpci: enable vbus detection Date: Wed, 27 Jun 2018 07:45:28 +0800 Message-Id: <1530056732-9640-11-git-send-email-jun.li@nxp.com> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1530056732-9640-1-git-send-email-jun.li@nxp.com> References: <1530056732-9640-1-git-send-email-jun.li@nxp.com> MIME-Version: 1.0 X-Originating-IP: [92.121.68.129] X-ClientProxiedBy: HK0P153CA0011.APCP153.PROD.OUTLOOK.COM (2603:1096:203:18::23) To AM0PR0402MB3908.eurprd04.prod.outlook.com (2603:10a6:208:f::28) X-MS-PublicTrafficType: Email X-MS-Office365-Filtering-Correlation-Id: 7f898a44-96a1-4335-b773-08d5dbc161e7 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:AM0PR0402MB3908; X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3908; 3:Dz0Whq1gkFpU107Sr3R1IUbAez0Udz+P9MNCg5ASEfnvgDDqT2cTJTEd35FHZTSypLEaoopLaAqsYDT3M3zqYFV3pTxDD/cSZlMmb3i1JvJnA0daMoEWnDyKayJwUASK47wMRgiTAZkOkRwHv8IvICjq1idO5xmxq02oX9FOWDCfW45onZO8ZWP++js2O96W0RJOMUrUeya9zUbhQYYBu1RL+02fT382f/2ELCMsbOOOq8kF0sfxPugoRdX6Prxy; 25:t8yd1xViKKhj+WXsA+kChLn3njGPk3H+nT3U1z1m0GYi2GyOW0Z2XSvk6+FPVGw3/ME+YZB37hzYI+k9BD5sKh5+bOvA5+j8H8NAlgvBTuS8WS8i2EwrWAYeB5Bck6xSEErKOdJJKMH9Or8S2nDj8abTN2KD2XB2iZLNhOL0I7CSlvXMIXNR6sZ/YLqkJyEFlb0wNWX5nB5GGZH/9QTve3w59joyLx1OwcJ0dkQJQTEH/ewfAyId7v9KlQe+7mP+B8DxBBx/E8AgWH3k6XAV2olptgt+Y7g4Lp1WIcoSGUE1A17zDXACzpy5J2UoECm2w55T5YFqd7gR8Kt7dfEMYQ==; 31:UJjDTfwiBlHjO8ptJoo+9KHTz4iKeFcQa4Ed30BdDi1EWnC3Jv1HuHLkl3TMjaGRwr08MdmjGAEvI21xjn5xcJI49QPSUPqw/DaH0E5efAQ0jaKbz8n70xf2tN+Y50iqxFUCal8UxzrtDphzM92KPv9NVIJj1BjDUZSa5UJyEjJAWF6O3EcIs7gKR6WwhncsWpux1E+hMRnkBlTTBHjaOIJlg95Ce3E9GYB7uaVZPng= X-MS-TrafficTypeDiagnostic: AM0PR0402MB3908: X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3908; 20:CUy9m2XTxmYSSX2s4baBL6XY801ykZseokN+oY3zUY7HvDhsdGU9ENmbFJbCoIXG1YGidAtl4t1eqY8Eck190r0iZOScNUYQG20EOv4GPCPxFxO+WXx4aFxLCOqVA9eCL9kFnZ8FJHX17yegAITEqH014UQh6K61FJXt0sjmpvIXBlafSpsPSlnhtwstqXEkewVX7L5/qkA9Dl2GgUHbqtdmquAMe8yvTkpUHLgiq2M15CdnzKPShBvTSgL5uHQ9zoaLJ1Vs2A0Nt5k9w83hAjf/OjJM/Kws4F4PkXWX9kfJY6zy2FuhUozvboURjSareMs1vsRVTEzNAVCfR5WvmbChdAw2bkGpzh5R6QFVE37jNIWuP0A5JRk/TC1liiZDfwD2SxofgfdP7jAE0uJ6RmgpavC59arL67T/YI7TRf3s3AECyNnwdwfs3kMtiwpIL2ikHG+ci1n0jxsmtPfx2+PNtAor4/mbtGIKrpB3JfOvwek+aPbOdcVDK0BT3ftd; 4:QxQKZVvtiXimSI7jzjrkS8I0u1o1WUSIfrhXZE53LH+4Wz0I9lzASZjwH8N0H3d2nXZBJSqXTk8DR68Z1oiWuVPM8x2xtF03yx3oRbM5zoxWip4eUXt2ytmRTsKjmhSbds2HcFQhVyr+s+UPv81L/biY96RxclwI2OCsrfiXmT5qMKRtP5SwQ6XoTtM2HDojGJtE1ujwDdS1BT/ribzkDsUSHCc1i5uoJQG414OXycG5szO01uLI+4HRIjYdRpdnjMZ5ykvbb0X08lc1gmMdzE2lAqB9fVNBmrX8N3YTTy3DlKHS2M/ebVtw/8p1yTkDswkj7urzeTlpHkOnBBfWNAHLCHkESJ5f0bROfZh4ZuU= 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:AM0PR0402MB3908; BCL:0; PCL:0; RULEID:; SRVR:AM0PR0402MB3908; X-Forefront-PRVS: 0716E70AB6 X-Forefront-Antispam-Report: SFV:NSPM; SFS:(10009020)(346002)(136003)(376002)(366004)(39860400002)(396003)(189003)(199004)(2906002)(14444005)(7736002)(26005)(6486002)(305945005)(486006)(575784001)(48376002)(478600001)(86362001)(25786009)(4326008)(16526019)(186003)(36756003)(50466002)(16586007)(68736007)(6512007)(47776003)(51416003)(52116002)(53936002)(3846002)(386003)(6506007)(6116002)(76176011)(316002)(97736004)(50226002)(476003)(2616005)(956004)(6666003)(11346002)(446003)(106356001)(8936002)(81156014)(66066001)(5660300001)(81166006)(8676002)(105586002); DIR:OUT; SFP:1101; SCL:1; SRVR:AM0PR0402MB3908; 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; AM0PR0402MB3908; 23:DBQpFUy+2kvmXAsvhU8IbpFB4Bg1zA36LTBXgA6?= =?us-ascii?Q?pgsK9hFVSx3CoHw3oWRY0n8XdJItwGfotdzq/05fY5ywwQ5zgIHYEgIxBE+l?= =?us-ascii?Q?/IKsAdBlWQSoz7H70/0zxBzvXuzRIN1C6VhzVfDe8sfwhzeg57yJ0XagzeYL?= =?us-ascii?Q?TTwIAhsbyiNqepDswse6xzwQ3oWLY7kG1cJpo9VZaGKD/sLMb8D+1Thsmtz5?= =?us-ascii?Q?vSHsCv0oPN9Xo0SHLyUlLGot7uuCuepUOQHNdeFedhX3WxndJHYx6z4G/4LH?= =?us-ascii?Q?WitAs+oH8nfOh9fQWyxq85C1mQ/FcKNtB80DaF7TYsG0bECYZjrkPExR2btl?= =?us-ascii?Q?2cyH32V4InORqjMXMZHHB3lWfiPyRv5dZOa8Gzio1MLRoF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Mr5KfqXvC8lQLLLLqve7SSUF0eZAMV1IzpBV6kuHkDw= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; AM0PR0402MB3908; 7:qX+pqG4MgaO4516YtYLje6XwDraDu+6TM3/W+1IEg8p59zi4kpRXUZH7qUBI0wB6ua+LJ/sNjAQ+rjeUy7sxGNLIxTPw016YfagLUm/tEPOUGsFYwERknrSpDZd+mIiFB3Xq83X18MQF5GA8Z2b2D18eK1ZmH4FKfnt8ev9hKsxWPyw5+TwpBnW/DEEw/EWrppZNc7LMEUN9MS1IAlNsfVYe4EVtSAaxNuKBohq5ilaGvTD0Xpt/2/FvVKeeBTcX X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 27 Jun 2018 00:03:11.5695 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: 7f898a44-96a1-4335-b773-08d5dbc161e7 X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM0PR0402MB3908 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;