From patchwork Thu May 3 00:24:49 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jun Li X-Patchwork-Id: 10376839 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 2882560384 for ; Thu, 3 May 2018 00:42:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 17D6029137 for ; Thu, 3 May 2018 00:42:12 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0AB6C29153; Thu, 3 May 2018 00:42:12 +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 C82EF29137 for ; Thu, 3 May 2018 00:42:10 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751741AbeECAmJ (ORCPT ); Wed, 2 May 2018 20:42:09 -0400 Received: from mail-eopbgr10064.outbound.protection.outlook.com ([40.107.1.64]:29433 "EHLO EUR02-HE1-obe.outbound.protection.outlook.com" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1751410AbeECAmH (ORCPT ); Wed, 2 May 2018 20:42:07 -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=Jqg8gKGM0vlZg0C0ekxKZZljYEfWEENukzmYi0A4rmc=; b=d+RdQI8YDfDYURtMPnkghyCHX5B10qlY5Z5UCwklNTtDNrr5EJohSEHGb+nMwqlmJAypmkpFBJWFza3T6FQ4WF+2HtsnMFQD+iFFpjthRI3QY9J66N3cRHiYXm4Ru49s/RFeKe4CEB0+o67FKDh/M2WpmPcbC3KR1yaCWAOKgso= 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:41:59 +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 09/14] staging: typec: tcpci: enable vbus detection Date: Thu, 3 May 2018 08:24:49 +0800 Message-Id: <1525307094-27402-10-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: 1; DB3PR0402MB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+jIK+o2w0I/g+jXIi/EVFFCxwdp8eqjnZ1RT96GxeqDDKI2tmaTxey2wCH68VMKqEGz7CAiAil2VJYRVMtmPpgZusuvDbJ4X3QjNCEjNmI3CS5zMC3N1ukj1C1JsJO0OUU2gJ6Dkct06K3+Ws48W/lh1KjykLU0U13CACmwyRTz02+4wJJfcXJBxXIHMjbgfrSxH/Mfm6hP/BHNWdMvHjJ2gel66j7ATCJib0cChHrgG1rsVMerqd9R9LIsJziawmT8AsztZrDan5AhftVSW/gz49Rnn4MLzL7MZV9JNY9W/5ZrhsQGaQU6Q2WHdw+FuPaAXdNnYAyaov/qeQ9FpEYNiXSf7xFaBRdTx/; 4:aVY9XokgylzsDtTkw+Q9MEfq6zwqqI3DR3gBEP4MfnSbzu46zrVTMKCsyKze/SuPTYtBm+q6TDdU7eJ802NJx/R+I3bu/eJOjM8N2r0Q6+InzgWPwGmt1N8OgqFdUk9gZDMrTNy7d9j8uqggZy1Hsu0QH9GPgPrOkqHrIMiyLi428DP1kXoSF+dRAyAxm15ekYbxPq92+m5HlqGEJHqwUL3c4ZMdGNQfy/ZuTV1KXWXBRGc/2cQASorUZOHXjY4Ct1cRKpV8tPDto3ZmunVU916n3ShHAY49AjfJ5gDF4yg2jXahzhZZlGMYvaI8R97l 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)(59450400001)(6512007)(97736004)(316002)(446003)(39060400002)(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:CBJQmcaRYKLj2rezLXYrH6PE7ZKdE51OjN+lVh/?= =?us-ascii?Q?VctT85vhzNpASHg9Jg/vDpT469PL564CGEcqfcxB/bOVeFLwJgUqm0X1RSqB?= =?us-ascii?Q?iBsNfOy186x9uAP4GXtle7OU0kiqXo+doNdHxm5I3NpRiGW9ah0O0UMgPuSc?= =?us-ascii?Q?nLINh4OzZxtI9kXzdFZV+MfcMJ2ljZMh8yju0ZDCqB5vAQMPL2xAdul0PIbT?= =?us-ascii?Q?Lqmxr1etP2x9JfA30Ouindmq1PTez9HifRNxdf1Jp+1wQlHT8wdBoDXjQhr2?= =?us-ascii?Q?FWzR+ZupZ7mFn3oPYK8+EzeqaxtFN0x3Fu25pSE1/2Jay9+918Bo7bDyt2ko?= =?us-ascii?Q?5My5EG7gZxfnJTPQMwI0da/2M+Gdv7lbemzNf2OP1/WBfXicMv2l48naHnOe?= =?us-ascii?Q?vqUJ6SDlZ3Oh64GNoaKdSHhdDLOgRl6W0l7CqGf8d8FH7kkCna485um+eBNx?= =?us-ascii?Q?UVyxv7JMXoHj7j9U2pz9bg0ieXknOe3iaK6VbubM8puT3rXtYbVsonsS9oF8?= =?us-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mtAJadwz/fiyv+QqUOf1hCEa46BxsBmLK+7RvLU3E X-Microsoft-Exchange-Diagnostics: 1; DB3PR0402MB3914; 6:IrEZoG7ZGZyVmmWiksymLD6YDIqfOumZ5R1GL3apit0fJrDrZDJNX52oaUSBKrdRDJLvs0PGHm1jAaAeZB7RZS+VJ6dk9pEjkPlLaQmW1PeL60FWtODlDAQc2dowIjTdzCB1Cj8fM5Nd3OBs9dhFm+IkeTQ5BP5K+R09vXna1qgY6zguXAx1geHCw7Wn4DBBE0/aQmMNe0OMQKroqeRDRDrpna5aRgs5dlLUzf/eAXJtn8VbGo6TNiR40MM6Ce5Tn3JYBFlfjMT5JnqgfwHk06YYx1qErSzq0C0JBo2WFvVepN9qf8LviCsxEzdPW2sc+E7rR7zdyKqMqOcjeL+0qL78CSoLNb2GIju7MrVOGHkQfbtwuYgcGN+5OPAmoWkv461XWoMRkhVt61saCFK/i8kiCM3BCwaVC1ZEu+aDxHB2Yro1RLiR5WCJZJouq3xWTIn/M7qc+zpcllwC01S3ng==; 5:VEo0q1/u+uJmjHJIlhlAJQqcFPb/EdvTV9fVJK2rY53QOUdne9v3vLIdM4gxfGDDCBK6CvlC5N3hX+dMsNnP455tVhel0yhmr10uMilI+s87dLkU1HICdsdHGcUYY9xvfR662Q/LGu2AMUuo08EwBL9EHPMah6+bxsOjc8NdBaM=; 24:MKsuTQkQvNzK6gZKrIcO2cxCv08lEGTu0/SOcxUf/udItG54PLUpizMETJDmnzk6S9LeChN17iU/G0BWiATTRyov01v1sTFtGR3q/i51eYk= SpamDiagnosticOutput: 1:99 SpamDiagnosticMetadata: NSPM X-Microsoft-Exchange-Diagnostics: 1; DB3PR0402MB3914; 7:cbkwOC270UxFTrPT4X8IEyIZhe+h3KxeWIO8xGmBxUErAkKEMNHH55iaCvqcF/LqPV7nJNfwAyEgz0+a/XGsN17TnAtV/n4s0E0l6oZ+NPbT/KM9p7YG+TwdA/MOtxPIaFPJtnWm2G8WoAQ/gWTxZ17hdmT2Y+dNPql8zYtcPVZLxv3jzGekJK2QBGxYTBB5NABK85loWimWknApIzB/MQiw/ZX536KVyc3s5kMNt9MXUNOp6GB4PtfCQBMXitsH X-MS-Office365-Filtering-Correlation-Id: bed41d00-0cbd-4b62-7721-08d5b08eb11b X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-OriginalArrivalTime: 03 May 2018 00:41:59.0222 (UTC) X-MS-Exchange-CrossTenant-Network-Message-Id: bed41d00-0cbd-4b62-7721-08d5b08eb11b 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 TCPCI implementation may need SW to enable VBUS detection to generate power status events. Reviewed-by: Guenter Roeck 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 139c2ab..5c48810 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;