From patchwork Thu Sep 14 12:11:57 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13385086 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4FB18208AC for ; Thu, 14 Sep 2023 12:07:26 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2043.outbound.protection.outlook.com [40.107.21.43]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9B4291BF4 for ; Thu, 14 Sep 2023 05:07:25 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=WZ8BeYKih5N2fytNZGCsWOkhTJ/d9mPy2NYJdjPZdkkhGAT16n5nnpocvo2YZ0OBejSSNQ391R8cjNyzIwY8LezuT6immhRwk+oESMno7nPUOaxAWmnesIVFo2en/ExYw9QZPhwtPE2mFPBi8/NAE/pJGqFXSkO8gnWkFghjWHO1BsQTo8Q4PwvujTjSL/e7R0I1jpNpC4gPLyiJh+01yKkpNupgpIbsSxtMWb6iE7U6vbkS0PdqojKsu4pKNuh7Zde7Ni/okIMOvxIbozBQXcUHBBOvzPUmsOvXOPCApgRBLFEBRE5C/YIj7NhnvmohVzmp66CxTjFvmzxDqafkDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=5Or3B6gtTrRI1Q5LJEpOoV7Khe7m90u31Q3bE8F7ogo=; b=oLaMt5ZP1IAU7eFHfSmkMJyfG4g8Eqv3c7WHXbKlHsCXYQ1D8UU2C7RupmX+ElZDYxSokY9HSK+zm5GKkloltRKQMhppZW5nA0eFuvt1c03FJxCTfKRPmQxQRIwu3W5KAAoI42ZbUEG3b6pb6fpXAnazoXU+kw0CYp4zbmagwd+eiORD2+NHSwEFx7k766wn5jhpwvbc8BgNAMlVJ4H5Kf+XMsohBZMT3eEnkyBv+GQ7I6jIkz+CfqNfZMI21lvsdGyh2/kCviBS6M6yq57IjkqnDgkjhT2cpM0sj+LftGPL1e4a66nEf0e8rRYfH6ZscbYB2rpiSiFrBgwoQAjy4A== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=5Or3B6gtTrRI1Q5LJEpOoV7Khe7m90u31Q3bE8F7ogo=; b=KJ6cZbXCQqNijeYTRii3j/0qlobhhct3CrX6CZdyJlBez41GrOl4DlwYsBfygx32tt/ismyDU2wQn2CaKmqyOof98PWkqUn7WsUh9+BoL+vofJCIkp/TQTWD00u1ltfcB52b2OeUztq8D75W2fow2KFGNmMebvZcV3SVV64kyRk= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) by AM9PR04MB8486.eurprd04.prod.outlook.com (2603:10a6:20b:419::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Thu, 14 Sep 2023 12:07:22 +0000 Received: from DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::6444:e07a:e7f7:3923]) by DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::6444:e07a:e7f7:3923%7]) with mapi id 15.20.6792.020; Thu, 14 Sep 2023 12:07:22 +0000 From: Xu Yang To: linux@roeck-us.net, heikki.krogerus@linux.intel.com Cc: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, jun.li@nxp.com Subject: [PATCH v2 1/2] usb: typec: tcpci: add check code for tcpci/regmap_read/write() Date: Thu, 14 Sep 2023 20:11:57 +0800 Message-Id: <20230914121158.2955900-1-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 X-ClientProxiedBy: SG2PR04CA0207.apcprd04.prod.outlook.com (2603:1096:4:187::9) To DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4505:EE_|AM9PR04MB8486:EE_ X-MS-Office365-Filtering-Correlation-Id: 73b4299e-ab83-40fb-5346-08dbb51b26d8 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: elY0G+3E3Hx8oeN5xIYnC8gVRcOGnXgXzoZis0QnYizV9Suo4QUJK9gIPHhhDHHllNIqSiqQ8S88x33z899gnUMn2wz+zDYrxCKK7HEIEU0JnizvwyirblMCnudo9FTOGFIdv2ZZ+pC9S4yjyTl+NeEyQktUU/gYnWBs/NaSFhylNuIE6wmIF6EA4Ad+KQFv6uILDtKT5RDrJVK++j4bj8co/+JnsuOmJ4Cwv22SC/K4nB2q53DKFFyo94nuoHZkgXroivdU9WnR5EU5qI+9XnEY/A13gKF5KSod1mq8qrhW0GOZm1P/apwdnJLSC3kdgiu1TSGv4UVdnDiQ3jd8RsH/hghWQ/3lWvArTrRk+us9nnf6w4Fk9PfVRk+6TsgabGKejrYGO2JbHuhsJ7SqDl4ZYv2RKGbhdwMOjlQVMdTS0Jl1UQ9mg7j2XNpTu0Z9rmrSsebVJvkdYDgYcP064clg0wS7j40amY1LScoUFjiHHXkBZnk1J9Nd45ivERc9x1rLzaUfdfEXEkfz6D6wNdaDX5TBT58LpAWmBvys+K2uXg3OxdCGrPtllwW5YdCXPEEXCdwamk9bTjKg1dAGnGkX5krvfWign8jx/8V0DeY2uFNt/8jHAKj19fwfTUWj X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4505.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(346002)(376002)(366004)(136003)(396003)(1800799009)(451199024)(186009)(36756003)(38350700002)(38100700002)(86362001)(6666004)(478600001)(1076003)(26005)(5660300002)(52116002)(66946007)(6486002)(6506007)(66476007)(316002)(66556008)(6512007)(41300700001)(4326008)(2616005)(8676002)(8936002)(2906002)(83380400001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: edYG1Cx2weBnT4pDuxvd4S67mpZxmcMDjrm9VtsQSvwyAp6Za9UQxYD6XsIWukCdxWjk/LlglDhLQJwKob0fcrSXWJHfzKOUzCrxAQUop7OCyq32wNyX+jfvfFxv8V2GQNXwrjppmTFvlIRcyq9EJLWlHnqmdksJbCYMo0pHjDlhheoIxB0dTcnxQKOVioa0m3xrHpdJ0NQ4evqgqovtBWKn0gYVMQ7P65/ni7sXiJ/0TDreeUU++Doed7pxjqn2TnO4aT41tNKr/DcuIgl9ZIsVrsxHEfxlEVAHyVTSdy9f2wgsZNYMOq0lptah1PCIlu51eTH/l7Vvaocn1dZMqn64eQ3oEfUzoZIIIXO3+YfgYcXvkUvM/ctp0AOl8ZJNF4XNBfn54vk3HmYZXviOPN8BJ8jY0WLEf0iY2U5EsITjLUT0kkXGHeBiedybmaEme9BdIOJ7KoqbrLCSbIZw3oRjHuSftFLoE9vyP+8q0aOcRonUqkCTFrdP8feZR1nUWxXbq3iPb+bsjUG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FNg32ZOl7od X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 73b4299e-ab83-40fb-5346-08dbb51b26d8 X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4505.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2023 12:07:22.6050 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: +8PqfEiOpsp2XM8hp5z2pUeo2fMrbUT1EoySChWteDfiPysm4H0QDaSnm080N/mXaNo9b+9wV9uRnIHuU2sgow== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8486 The return value from tcpci/regmap_read/write() must be checked to get rid of the bad influence of other modules. This will add check code for all of the rest read/write() callbacks and will show error when failed to get ALERT register. Signed-off-by: Xu Yang --- Changes in v2: - remove printing code --- drivers/usb/typec/tcpm/tcpci.c | 34 +++++++++++++++++++++++++--------- 1 file changed, 25 insertions(+), 9 deletions(-) diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 0ee3e6e29bb1..8ccc2d1a8ffc 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -657,21 +657,28 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci) int ret; unsigned int raw; - tcpci_read16(tcpci, TCPC_ALERT, &status); + ret = tcpci_read16(tcpci, TCPC_ALERT, &status); + if (ret < 0) + return ret; /* * Clear alert status for everything except RX_STATUS, which shouldn't * be cleared until we have successfully retrieved message. */ - if (status & ~TCPC_ALERT_RX_STATUS) - tcpci_write16(tcpci, TCPC_ALERT, + if (status & ~TCPC_ALERT_RX_STATUS) { + ret = tcpci_write16(tcpci, TCPC_ALERT, status & ~TCPC_ALERT_RX_STATUS); + if (ret < 0) + return ret; + } if (status & TCPC_ALERT_CC_STATUS) tcpm_cc_change(tcpci->port); if (status & TCPC_ALERT_POWER_STATUS) { - regmap_read(tcpci->regmap, TCPC_POWER_STATUS_MASK, &raw); + ret = regmap_read(tcpci->regmap, TCPC_POWER_STATUS_MASK, &raw); + if (ret < 0) + return ret; /* * If power status mask has been reset, then the TCPC * has reset. @@ -687,7 +694,9 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci) unsigned int cnt, payload_cnt; u16 header; - regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, &cnt); + ret = regmap_read(tcpci->regmap, TCPC_RX_BYTE_CNT, &cnt); + if (ret < 0) + return ret; /* * 'cnt' corresponds to READABLE_BYTE_COUNT in section 4.4.14 * of the TCPCI spec [Rev 2.0 Ver 1.0 October 2017] and is @@ -699,18 +708,25 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci) else payload_cnt = 0; - tcpci_read16(tcpci, TCPC_RX_HDR, &header); + ret = tcpci_read16(tcpci, TCPC_RX_HDR, &header); + if (ret < 0) + return ret; msg.header = cpu_to_le16(header); if (WARN_ON(payload_cnt > sizeof(msg.payload))) payload_cnt = sizeof(msg.payload); - if (payload_cnt > 0) - regmap_raw_read(tcpci->regmap, TCPC_RX_DATA, + if (payload_cnt > 0) { + ret = regmap_raw_read(tcpci->regmap, TCPC_RX_DATA, &msg.payload, payload_cnt); + if (ret < 0) + return ret; + } /* Read complete, clear RX status alert bit */ - tcpci_write16(tcpci, TCPC_ALERT, TCPC_ALERT_RX_STATUS); + ret = tcpci_write16(tcpci, TCPC_ALERT, TCPC_ALERT_RX_STATUS); + if (ret < 0) + return ret; tcpm_pd_receive(tcpci->port, &msg); } From patchwork Thu Sep 14 12:11:58 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Xu Yang X-Patchwork-Id: 13385087 Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net [23.128.96.19]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 69A7E208AC for ; Thu, 14 Sep 2023 12:07:28 +0000 (UTC) Received: from EUR05-VI1-obe.outbound.protection.outlook.com (mail-vi1eur05on2067.outbound.protection.outlook.com [40.107.21.67]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A4BA1BD for ; Thu, 14 Sep 2023 05:07:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=dru6/oVitri6Bic27ZzdgQsu9vkTSljOY93g0LxrCBZVRxkZ/pq96UJfEuwdPafllQsOr9cbxZ/3LdYNg0pv5dOGqDzvN55QkXrU9FhzgkqPBq4ueEnDY+rKnfGdfTWG0DU9L9KWQ+3YRVIy0yir7PYOfYJcLnmUHFTCjHjn1Gb8EyGJjUHUAuxS3nTlCZot+wuIuWBSgqI6utEBiCUjvpflvl1bHZC5Ej4CnUlFhmUVWU7L0vtjjeXHK8hAp/DLYHU0pdw6wQPUIOwjHAu2VhwWFvqHLWiykNO1TMCAelJKGfhI38aphGcyJNQTsDJmyzqf8kCaaGqaforQ5lLAEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=Hnbv8mmcvDGT990v4EVAhOLpCGHEHIRlQOeGIMZwteE=; b=h4mlmZiEkbZJ7KSDAqWUBHqCAj7guIQwFzxeUiz9rDSRs8okfEC4DcvsLiiYAOBfs6uXbEsPaJY9B1utEBdOu6gzTn3G4c1C7c+eJ2FJWV3DvGQIHtvVxTqyHvQhP7HiAt8SuX0ZvYdn/PpFRiSCsuAldvepy1XglhUXYLU70n5yF4ICqn6bikrxB8HBu3We2zptWCtOS90+I+xiC5+R1p2M0DlYyI1zGNATKPXO7ay2P4x0zxfe+CQclPjqOwRc1jtgbO5ZBaqxfFr/wyo1rpvUvpRKYRbzZNj5IMhdEnJcAZ4FyfXpkePqngW3zJS1yYrWWirM9JRvkE+uUs/tpQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=Hnbv8mmcvDGT990v4EVAhOLpCGHEHIRlQOeGIMZwteE=; b=KHl5kXBqj50KwNxzz2qIWZBPT14SPUsDKjpWRlADi4Gwls3vD1OhGNREWJb6bQEyJ21yFssR9FgaHipBCGScSCypTLESwoCzvQyviLo3uyabiCu7zSJwxCMWd49wufWw2CJnUsODSjLaD6rz8NFxbFIz/J/IKqTSLstAF8jZK/E= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) by AM9PR04MB8486.eurprd04.prod.outlook.com (2603:10a6:20b:419::21) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6792.20; Thu, 14 Sep 2023 12:07:24 +0000 Received: from DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::6444:e07a:e7f7:3923]) by DB7PR04MB4505.eurprd04.prod.outlook.com ([fe80::6444:e07a:e7f7:3923%7]) with mapi id 15.20.6792.020; Thu, 14 Sep 2023 12:07:24 +0000 From: Xu Yang To: linux@roeck-us.net, heikki.krogerus@linux.intel.com Cc: linux-usb@vger.kernel.org, gregkh@linuxfoundation.org, jun.li@nxp.com Subject: [PATCH v2 2/2] usb: typec: tcpci: enable vSafe0v Detection and Auto Discharge Disconnect for PTN5110 Date: Thu, 14 Sep 2023 20:11:58 +0800 Message-Id: <20230914121158.2955900-2-xu.yang_2@nxp.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230914121158.2955900-1-xu.yang_2@nxp.com> References: <20230914121158.2955900-1-xu.yang_2@nxp.com> X-ClientProxiedBy: SG2PR04CA0207.apcprd04.prod.outlook.com (2603:1096:4:187::9) To DB7PR04MB4505.eurprd04.prod.outlook.com (2603:10a6:5:39::26) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: DB7PR04MB4505:EE_|AM9PR04MB8486:EE_ X-MS-Office365-Filtering-Correlation-Id: e6d97760-bce0-4b9b-3d65-08dbb51b282d X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: BF1WU4lVQkUKFpV5P4c27ixdpU+65uEVKJGu49FDiEoUf7Fa4RC4clgJMQUC1Rv4aiZ2kscOJ8u0/ppRrng4iXWpOfKhmQqOT6Zq1OXQMX1Hn1fOpeIErXLGyYmbH/o9DS++A5NHw50Jtwq8tQT/e43BBPM6gFB8GOrYOhDktcF3Y0Xc6XfgBLtbRz/j+GSJpDExdAc4neuyeu8y5tz/fplL6T1DnaIEaA/6gK/Xyisg5ayD2+A16lM/Pdtth6skwpB8pSdGSMoJP9PnrG39/NEEqFyL4Ret2hP29vTgm1GcENPjS+qM6WJhsiZmWIlYxRqFw3AWNP/j7Q6D4sSTO6H9l9YjakO+wHqSfqO0pb/amGCImY0P5BHM+1x3WkqNsJaA15dBRLFEj3DOXhemkWOjkpo6rz2KtropGh6mOVzSeOXBO4aefEV3+9e0lej4mDUBP16F614PeOgDx72UuRLdSa8L4CMlZJYrE79OLvZhc/cZug504NGLJ63dQzfwPl5ik6vW/62cT2yEBCz1OL5l7B8R2a6FBIDn8gzolV0B7zuDEoeJr1k4AjcwgoK0fVpdgY38W1iIO6jfovuksmPSQmGDYdBhP4dVls953QY+i0dCNCU6pqJJ18slgvHnndB7M/OpCW1D27O9tbV+/w== X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:DB7PR04MB4505.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(39860400002)(346002)(376002)(366004)(136003)(396003)(1800799009)(451199024)(186009)(36756003)(38350700002)(38100700002)(86362001)(6666004)(478600001)(1076003)(26005)(5660300002)(52116002)(66946007)(6486002)(6506007)(66476007)(316002)(66556008)(6512007)(41300700001)(4326008)(2616005)(8676002)(8936002)(2906002)(83380400001)(4744005)(32563001);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: UcCHRZPUNdZAYJ8MmUdmIaIcx+2imjPQBPibOH3ylhQOHtFSXNEjwX6J0wHhgAbRTa7dbnmyfd6TEbMrIwqewHN1vDW8cuzW1KLCIyFH5wkUEXBM3aT37hFoT0VVmjr3zmykARNr6IdChbahz4umqEyRfWGJRQLTZig0wnIRq/Qr7LSW4IRXyO/WHFP5RMJpWJOw+BPjeNii+z71M2fdYr/r+tH46/Jx0inWFaz7+FMGSkNT2Fj40M1vbMw8GtbQbN2IaoCYs9VDbYO3kzCfNvqeZAecgmfG4g0j+18em7ve1sKSGZtflWjFxtxEfirGppDGkXUFBKQ8j9hK1ZbwA5gJAGXusXBOfiUs3Lwo6hNQdUekKjCuCEgKS7CHYxL8KhC+F+q83uyJnYTa2NnA+BhGC2voyKmGXCfq6hAA+dWiLoQaImYA/5W2ijs1hFtJ9n2lZdigDTLvjU8IuEQGumOVd9AlkN7HvjI/lBPqVD3R6FIMYgjXMRHd7qKte0b4iuzTEKRveRXHKr/O7okmLHSx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Gb18sC X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: e6d97760-bce0-4b9b-3d65-08dbb51b282d X-MS-Exchange-CrossTenant-AuthSource: DB7PR04MB4505.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 14 Sep 2023 12:07:24.8788 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: ZcKB+E5fZf6h3/OU2oIRtPiUBDk2LEvx9z8xC3nwN3mIberOL0Vu6G0W7GKyxxiX4zgk/qtbXh21YsSJMaFKzg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AM9PR04MB8486 PTN5110 itself supports vSafe0V detection and auto discharge disconnect capabilities. This will enable these feature. Signed-off-by: Xu Yang --- Changes in v2: - no changes --- drivers/usb/typec/tcpm/tcpci.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 8ccc2d1a8ffc..141d313b9a55 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -861,6 +861,9 @@ static int tcpci_probe(struct i2c_client *client) i2c_set_clientdata(client, chip); + chip->data.vbus_vsafe0v = 1; + chip->data.auto_discharge_disconnect = 1; + /* Disable chip interrupts before requesting irq */ err = regmap_raw_write(chip->data.regmap, TCPC_ALERT_MASK, &val, sizeof(u16));