From patchwork Mon Feb 20 16:45:32 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Christian Bach X-Patchwork-Id: 13146748 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 0361EC64EC4 for ; Mon, 20 Feb 2023 16:47:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232290AbjBTQrM (ORCPT ); Mon, 20 Feb 2023 11:47:12 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60396 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231613AbjBTQrL (ORCPT ); Mon, 20 Feb 2023 11:47:11 -0500 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2097.outbound.protection.outlook.com [40.107.105.97]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE4DB173F; Mon, 20 Feb 2023 08:46:37 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=gt3fMGtfDjYc0aZqWNk6dsBVeitgVTnG+p/amAn1A6Fk8dsiYXn60aw4DrjoNuvrsDlfBCFG1Vsg1zQUbu1Uxw9c7v3yeJGuwG1CMm0ufcGIHrmP7d9Kzbibg4npI7/Z+dKafKwSSBz+Xksn+A35cihC364ZqG6rKdxnyCRk+26TjKBcnTRN4deLgOMZWux5fdiH+x1dpMKO8B0OIPf5THIpjNo1tB2xrLpgCloGqLxwaOKR2MauFXgpG6d2KhW5ZtTkfFSNvZekgppfwKKXgfduBRcnSdnanHLUfu3st3NPYkDk49NlTNdfPzQhxz9EFHs/Xh3X2D93Hp5Oko896A== 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=p0/KNVqZgmaRk1WHWtdxC+K7Vo83W9Yvx19Fbk3qX4g=; b=FXQJ0qXAsMe86rLHCjFRSU89pLLh67B73Q6HdIMlMAwsLEH5W3frBwluLVx2gOD8lyJ0bwv7pFrYFc+03vtufG9wFsh0FHNy2JOFbYSKDvL6TtK6iCPNVg2LSyJO9jQOHTFUWz0meyrWCwkg4WJ76PwNVPBAfi+VKGLXUozZVnzMhrepgbVg8DnqIObgIlFBLvywHBKXZjQEnVltHh/z5tfnZ7H9HvJ6EX2SWJyurAt0GDZsAueD89hI6ErNCLW/FELa4QJ/RarQV4mX2GBzDZKg4hZLx/izDStDn0//0mwy/PR9LEnOsrMjI+gX9r+HM+/a6qoqCvQq5SnvSQZ5Tw== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=scs.ch; dmarc=pass action=none header.from=scs.ch; dkim=pass header.d=scs.ch; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=scs.ch; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=p0/KNVqZgmaRk1WHWtdxC+K7Vo83W9Yvx19Fbk3qX4g=; b=q6/vvtlhtXrqpVn3NJeAiVCG6ZBUEsa+v1aDnySDBsDi2tyUpOD+Q5pVqirSuysDwy7uG5s9X5et7DX8R+syOsu59ZKqvKPe72HV/3GN/OMcFdP7jbpQN6XLelwUbZK7aV5JXR1ttr4LQ2CMccqs5s5AZWSmcEI4WFGOfHK6IOaRBx4Db6KCjkyYb+dIw3uug3gl4QWfLtGwsC7a2TVTFz657+p2mpdA7M/nAfL4hKJ201g5VbjdYv8FWcklCewaNDSKOrPHNkROeUBoIteG6ewdnK3UJxzIqoVmsLSLJrSI8rq+kkvyznF5IdjzxOhPW0vF/QUQG1ZujSdg0P37Cw== Received: from ZR0P278MB0773.CHEP278.PROD.OUTLOOK.COM (2603:10a6:910:4d::10) by GV0P278MB0830.CHEP278.PROD.OUTLOOK.COM (2603:10a6:710:51::14) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6086.26; Mon, 20 Feb 2023 16:45:32 +0000 Received: from ZR0P278MB0773.CHEP278.PROD.OUTLOOK.COM ([fe80::1379:5785:1f56:763f]) by ZR0P278MB0773.CHEP278.PROD.OUTLOOK.COM ([fe80::1379:5785:1f56:763f%6]) with mapi id 15.20.6086.031; Mon, 20 Feb 2023 16:45:32 +0000 From: Christian Bach To: Greg KH CC: "stable@vger.kernel.org" , "regressions@lists.linux.dev" , "linux@roeck-us.net" , "linux-usb@vger.kernel.org" , =?big5_tw?b?Y3lfaHVh?= =?big5_tw?b?bmcotsCx0q3sKQ==?= Subject: AW: tcpci module in Kernel 5.15.74 with PTN5110 not working correctly Thread-Topic: tcpci module in Kernel 5.15.74 with PTN5110 not working correctly Thread-Index: AdjoVYnpyrmyLmxITSiX1bJ23H/1egAFm5rgAAClgwAXNteHcA== Date: Mon, 20 Feb 2023 16:45:32 +0000 Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: de-DE X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=scs.ch; x-ms-publictraffictype: Email x-ms-traffictypediagnostic: ZR0P278MB0773:EE_|GV0P278MB0830:EE_ x-ms-office365-filtering-correlation-id: a2907e9e-f866-4cb0-7a62-08db1361e1b1 x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: IAxWLsPPKy3EVcLzPZ4mVSfVFE9yyO6VHtwMtN/+Nu4doS8cIL/stWtB+N7Pn9YjHYhoe5KCIxeS1QPofIG4HgbXpysuEhFCZxijOR4X0+Y/YoMZTA5uZxVDPAOFNeq93n1rShfL/CjhTN4MlbdwpwFAPPApMNYA7RK7D+XHgvCI4yt3EC6KeIAyja0Ot2kesJo19vusn5oF6JjorqzOaFcXTTZwLGnZwHTJeYOvGgchwAS/yUZET8yp63GPnoArP8gB5JTm4xHkIQWqj70pEoXs9cPEWdzBRk9+cOEpJXsFkStzAy8YhcmJigKysY1bepDRh+RK+BjU4+ll030/aLD5kWAL2aL7ViOBRgIpaT2CUaU8wxrj1/k0URPHh1Wp2obw+4+hJ5t7Swgl8GE/K8dIG36/l2yNZ0RJoJLWSIHgVlufom1e7eEhwSpJSgkjZSxSDPxw7WoUMu9Jw8G7TwielLG/h78zavDgeb0vko7uwgtbCUtVYrNil1MLhhjtKFc0Sse4JGaqH5VElUjTqt8iz5ZkvnkAb3WaGI9owBTkKl6uBF7VKCaEl+UWwu4Na1Oc4/rjIaFMjlWoAhPfHQslOUiG44rU1oLff8bgqIv3ruCXCmpVlr+qGAxt9Blx2Era2D9qM0BN5AOMAKqwglxcPvBsxb9ocdd4Wrkm1OiCAz41eXHdoTq5SuMuvxRt x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:ZR0P278MB0773.CHEP278.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(13230025)(346002)(366004)(39840400004)(376002)(396003)(136003)(451199018)(122000001)(71200400001)(76116006)(7696005)(41300700001)(478600001)(9686003)(66556008)(44832011)(26005)(186003)(54906003)(6506007)(8676002)(66946007)(6916009)(66476007)(2906002)(64756008)(316002)(55016003)(8936002)(52536014)(38100700002)(33656002)(38070700005)(66446008)(86362001)(5660300002)(4326008)(83380400001);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?big5_tw?b?RzArejlJbzdvayt3Y3NpSzVlbS9V?= =?big5_tw?b?TzRzdmFpNGFtemIvVjgycV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WI2?= =?big5_tw?b?RnhURWJjT3pDKzRXWnRSb1lYM0lzVXJxcG12VnRta3Nob0JwazBBZ1ZRUUltd2Q0?= =?big5_tw?b?NzJzb0JzVjQ1UmJvWElwZ2F4Q3pIeDhTWjhZNHJYSFpBcEZvaDlMaGJaMlY2amRB?= =?big5_tw?b?RHFBWEFFYXdGQ3RJMFBCYzFIWGx3WElHMjFLREY5dE1XakNRc29UVzV0b2MxZ0Ns?= =?big5_tw?b?S1lhbzVYV0MxNStGT1NkUHJFSWc1enVPV0JMTFNzTk51NEFIUFVFc1UzTmN3ejJO?= =?big5_tw?b?N1FNSkFreU0yaFVmbkhOWFB0Wm81WVg1b3pxYnByOS9MeGV4ZnRqL0dtaQ==?= MIME-Version: 1.0 X-OriginatorOrg: scs.ch X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: ZR0P278MB0773.CHEP278.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: a2907e9e-f866-4cb0-7a62-08db1361e1b1 X-MS-Exchange-CrossTenant-originalarrivaltime: 20 Feb 2023 16:45:32.2161 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 1b8c3cb6-94f9-44ce-91ec-7183fd2364b2 X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: GPElCcTZ1AFPDxX7fAc+TSdPsqAI9ts2NRT8Dmpgz9MnqEJZRcb0HVxCrQvUGYKDuNXIiEy0FXEsk8aQns32Sw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: GV0P278MB0830 Precedence: bulk List-ID: X-Mailing-List: linux-usb@vger.kernel.org Hello everyone We finally found a solution to the problem we had with the PTN5110 Chip and the Kernel Module tcpci that manages this chip in 5.15.xx Kernel. NXP Patched their Kernel a while ago (https://source.codeaurora.org/external/imx/linux-imx/commit/drivers/usb/typec/tcpm/tcpci.c?h=lf-5.15.y&id=2a263f918b25725e0434afa9ff3b83b1bc18ef74) and we reimplemented the NXP patch for the Kernel 5.15.91. I attached my reworked patch below: diff --git a/drivers/usb/typec/tcpm/tcpci.c b/drivers/usb/typec/tcpm/tcpci.c index 5340a3a3a81b..0d715e091b78 100644 --- a/drivers/usb/typec/tcpm/tcpci.c +++ b/drivers/usb/typec/tcpm/tcpci.c @@ -628,6 +628,9 @@ static int tcpci_init(struct tcpc_dev *tcpc) if (ret < 0) return ret; + /* Clear fault condition */ + regmap_write(tcpci->regmap, TCPC_FAULT_STATUS, 0x80); + if (tcpci->controls_vbus) reg = TCPC_POWER_STATUS_VBUS_PRES; else @@ -644,7 +647,8 @@ static int tcpci_init(struct tcpc_dev *tcpc) 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; + TCPC_ALERT_RX_HARD_RST | TCPC_ALERT_CC_STATUS | + TCPC_ALERT_V_ALARM_LO | TCPC_ALERT_FAULT; if (tcpci->controls_vbus) reg |= TCPC_ALERT_POWER_STATUS; /* Enable VSAFE0V status interrupt when detecting VSAFE0V is supported */ @@ -728,6 +732,13 @@ irqreturn_t tcpci_irq(struct tcpci *tcpci) tcpm_vbus_change(tcpci->port); } + /* Clear the fault status anyway */ + if (status & TCPC_ALERT_FAULT) { + regmap_read(tcpci->regmap, TCPC_FAULT_STATUS, &raw); + regmap_write(tcpci->regmap, TCPC_FAULT_STATUS, + raw | TCPC_FAULT_STATUS_MASK); + } + if (status & TCPC_ALERT_RX_HARD_RST) tcpm_pd_hard_reset(tcpci->port);