Message ID | 20240429-tps6598x_fix_event_handling-v3-0-4e8e58dce489@wolfvision.net |
---|---|
Headers | show
Received: from EUR05-DB8-obe.outbound.protection.outlook.com (mail-db8eur05on2108.outbound.protection.outlook.com [40.107.20.108]) (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 BDD266F510; Mon, 29 Apr 2024 13:36:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.20.108 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714397775; cv=fail; b=eowleGmRqBf5GW/ct8c1SefFfVPCPeUWMeFQO5j77MgS4i9M3/66rNp2Cz05+SzcvfAf48woLZnkW/ZK9tWP6DfBIwreq7vJKhXFyKkvB/+4L0bxtREfkNgvdJBlhd2kXUDb8zhhiHueZMN/41JmL+2nCLc2z/O4IsusB/te9hc= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714397775; c=relaxed/simple; bh=b2fB4JTmGhN4zOjp698Eto1qzkFTqwYPsBdkK8M4Pdo=; h=From:Subject:Date:Message-Id:Content-Type:To:Cc:MIME-Version; b=SPoADhrklBPYVDqYZtV0lfY+vt/kc44hfPjX8suO2KVxqxHczvtI+UrSCq2LoyrEekaWu3+psr8BrhHJ9TW28PaLa2GUdMANsP5saFVDJStEgAXIQ+UGKTOZ8XvCfTqTDmKkeleYOghUXg2XyD94XQeEoQTd4CThuhVy+ZSTZdM= ARC-Authentication-Results: i=2; smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net; spf=pass smtp.mailfrom=wolfvision.net; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b=ubie8qzf; arc=fail smtp.client-ip=40.107.20.108 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=wolfvision.net Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=wolfvision.net header.i=@wolfvision.net header.b="ubie8qzf" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B/qHW8o5dmXOmsYNM1CX2TjxMIa6QyX816i1sHZULeZD7titPL3P3/Mhzj8b5ZO0yl+xbx5fYGov905GUvKyw47rBAaqqEQrPBiNkWq5VUyBcOyhtoYZsIfPt8zYHF6bgqWtma/Wn0b0qubF4pl8RFXklyMtjKnEkHNJ8/sRKae6VohSGWjNMxC/DyKcn4Ced8MqTLb7HZebzirORGsnol+l/UHN/25FutSTtoxprvZbxTN0OrQbsBL8XxKBsFIE9mCw/m8TwbHMiJ6d6W60H5NI2HDXILULGLwq29U36cNwuGsZDC6JuiRyniDWUn41CqEd8ELUeXWeYjo4ewdkVg== 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=LTA1lxa/g4Z5bd0fFvP0OdfIlgtGE3qIljn6t1PH5Io=; b=A7oPPpcTOM8MYDeAOH6Lwkaooq4SDgPWlzXMOFkMDoUMmPYw0eu/2jec9KatfpxkzlvJB0YpGy6kpjm9R4NtCx4nNf6gAODbIc165lx8FfRiimpqihjDZKI9sBhmstwhNanWSPJuLLQVUE/V/bkQZjcwCSEG5fklHIGiaW6qpno38z6jWKdo8mYSc9BItO24N4TlPLn9wXAb6GOp5ZWCqqdSZQpPvcTAIiutyVAtLxbpEKlfYX+RVBv81mk95xjjDWSlCkyIyy3hIXsVsoT9epQ/1/fZZkqr0LhjVob99kgx0r09x4e/qRyzaGqxxVUNxmtY2DjMp340FG+yq1xWdg== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=wolfvision.net; dmarc=pass action=none header.from=wolfvision.net; dkim=pass header.d=wolfvision.net; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=wolfvision.net; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=LTA1lxa/g4Z5bd0fFvP0OdfIlgtGE3qIljn6t1PH5Io=; b=ubie8qzfIGk6Th0bxbUdWVmvNI3/Aiovu3j2H2uXk2Z/9fbgeX39IIJRaXaVcdNZd/l9BlZ3+lrCfnKbbbbqgHbqsJM+RMVsqTC7p42jSTH+KzX/RBpUh6doEiSqHiaTjm4G0L6IqpZgha11D0ANFEXlc05h6P5y+yDjJYXvCM4= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=wolfvision.net; Received: from VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) by AS8PR08MB6119.eurprd08.prod.outlook.com (2603:10a6:20b:290::10) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7519.34; Mon, 29 Apr 2024 13:36:10 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6621:68a6:ab00:c040]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::6621:68a6:ab00:c040%6]) with mapi id 15.20.7519.021; Mon, 29 Apr 2024 13:36:10 +0000 From: Javier Carrasco <javier.carrasco@wolfvision.net> Subject: [PATCH v3 0/3] usb: typec: tipd: fix event checking in interrupt service routines Date: Mon, 29 Apr 2024 15:35:56 +0200 Message-Id: <20240429-tps6598x_fix_event_handling-v3-0-4e8e58dce489@wolfvision.net> Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIADyiL2YC/42OQQ7CIBREr9L8tRgKYqkr72GaRuXT/qSBBgjWN L27WC/g8k0mb2aFiIEwwqVaIWCmSN4VkIcKnuPdDcjIFAbBxYlLoVma41m1euktLT1mdKkvPTO RG5iUrTbSaGG1gmKYA5bWbr91hUeKyYf3Ppbrb/qfN9eMM8VFI2prG64e15ef7O/s0WGCbtu2D 5mhZ+bLAAAA To: Heikki Krogerus <heikki.krogerus@linux.intel.com>, Greg Kroah-Hartman <gregkh@linuxfoundation.org>, Abdel Alkuor <abdelalkuor@geotab.com> Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, Javier Carrasco <javier.carrasco@wolfvision.net>, stable@vger.kernel.org X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1714397770; l=2623; i=javier.carrasco@wolfvision.net; s=20240320; h=from:subject:message-id; bh=b2fB4JTmGhN4zOjp698Eto1qzkFTqwYPsBdkK8M4Pdo=; b=OIRHfLncoY7lBQvv5icf2+TtoTiMCH7K8BfKppz3ZZTkBcjpiEkri/pMKdugfVJjCnRM/iAJb QP7AW/tHDD/AfP4kOsBqQBQQ/3jgFMj8nYQyWtRCy1cJbrmposvKgmP X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=Vxk2/0sGIxM8rsKnceszFuSuHVfQwa1Yo8+is7BX2nY= X-ClientProxiedBy: VE1PR03CA0005.eurprd03.prod.outlook.com (2603:10a6:802:a0::17) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) Precedence: bulk X-Mailing-List: linux-usb@vger.kernel.org List-Id: <linux-usb.vger.kernel.org> List-Subscribe: <mailto:linux-usb+subscribe@vger.kernel.org> List-Unsubscribe: <mailto:linux-usb+unsubscribe@vger.kernel.org> MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: VE1PR08MB4974:EE_|AS8PR08MB6119:EE_ X-MS-Office365-Filtering-Correlation-Id: d287b70a-b275-4548-401a-08dc685154a7 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0;ARA:13230031|52116005|1800799015|376005|366007|38350700005; X-Microsoft-Antispam-Message-Info: =?utf-8?q?HiPzzs4/VUs1hNHg0iTp92a/FLJvhHn?= =?utf-8?q?qTlVFz96UIYaliHmsUdEbkOb+JSatJqmgOiBbCNnr0XrP+VimpxVtSER5IR2hYCup?= =?utf-8?q?p7gt27N/BczvvN/1fPqqhzX4svAnw7oAQFt5Ajsmt9U9ef1OrYLZqRvYNrbns2hdN?= =?utf-8?q?fIzymQ28uc+jqwDs0eQq71ZK6qYr/5hLDhoUBorSofQU0FlTp7d0LDEbJc4Sq53O6?= =?utf-8?q?DOaHFKBEh5XvkGKdYWfWUOaeN0l+Hgyu6xvcxK/KUZ/vn4fr2zlCjaR8cyCAqw+wh?= =?utf-8?q?UkEKr4BdAStPU0QjDbdqIyH38/pEVpgD+LrsPLZHdQKBHyRJgPYqneLsNsOFLLRZ+?= =?utf-8?q?FEK0eHr/87pYa3ntIkOpbu6ob8hkxwHlRv7oeOP5MG4DtwXM5PCV3CV3pvpvGnnip?= =?utf-8?q?/GfobftsxDtMJsvdcMoUCFbLHnKHztPAVRI8TSwc5RBcunooxNsZ0fYxxYkE/OHwE?= =?utf-8?q?fp3kPn3HerYJhLxAgKMLPLY5z9ZnsoUTXGjrre0uvSDRN3TGluvILsxt/AYV9VGz1?= =?utf-8?q?bTwldsUMgek9xIZK6KTetknUG8Tol5Cy4hEnzpky7fr5BJ6xovQpZYJzhKjtxe7kr?= =?utf-8?q?Ip7gSh85waiYEvBYky5ior/flIqmqMWP2eZTlOhYIYE/4qSM+Bwg0QLLeHgzFGcNB?= =?utf-8?q?id+czYvitkeAdW9z0/+6/I6otpd3v7ERuVcuDPRmTOIiBEf3RNdbEEjNnD7Q1FbxZ?= =?utf-8?q?KTQ9G4FGemhbKgAhm8d38Xg7n9KRFUZ6QT7B3ovKV1LErK8ZkQbuj0LgPt1SKnLEI?= =?utf-8?q?aGTTqE984yPNpt+djCtI54/4htW+bFDTDDxAWQM9T29l5N2J9MEKhs1dlhv1m5wZK?= =?utf-8?q?sXxafH8JBpNApEnZIRauDPZ4khXlGqBIgeLzc1xbgBuV/+OMoLSEmstRU8ItaVo2n?= =?utf-8?q?eqlE75Et0q9Ek9kUmW30R6XQ4GuwuII7GiBwvofTPVlHs2TP67vVI7Mqe34psSi63?= =?utf-8?q?GrzyVC9xGs1ykIoUVoaY6eVJjHoaUuD13vylCgso8KlJJxbJqKqP0RebZy7x9sXE3?= =?utf-8?q?AhsJR/XWijD3qSTIc//4UkG9XFIWyzmx4bBzwnLpVgGQK+DYkNX8CUDaFucXaEqri?= =?utf-8?q?XJ/5LezU0h9OOX+5aKKCvrmcb1LwzVcBghtdJb1YZQK4s/lovoNvsMzE7+jcVn8D5?= =?utf-8?q?CDKEYaZdDOd3TY21sJE/6my71FY569LjahoE2WZPZuuAPsH0OtB+M95dN6FX3bHWc?= =?utf-8?q?05fc3MuLFxzCujlTs9cdm9pGABIUK93GWU6Q=3D=3D?= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:VE1PR08MB4974.eurprd08.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230031)(52116005)(1800799015)(376005)(366007)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?f9oiBDKFMg9DFNb3cgIyvUJ7q7Vt?= =?utf-8?q?mmSwuSpN2NrA/5cgLmb7mrOD7E+mlOm4is7sd64ncyS+KpD4PQo5LlrholhNI6Bgm?= =?utf-8?q?XTJUkflE/OBmQfj/B/KmE6oRI9IQs6mAM7oEWL3qcUqvzwMEm/0YtTVWwiZWE88MI?= =?utf-8?q?ckuxY/z3Ap8ZYCsj2FJIV9mpLbLRuFPveSEOqGUYSMTWCYTkahshX0sNCla/ontfr?= =?utf-8?q?qat0lC0k9DL9xCVMm6KecFzx0o/XGAd0Wn8BKi7b4hT3A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oZSpGtpNrmC0n3dkO/f?= =?utf-8?q?aZIwpdtqhd10d4r/dON/oq+Fv6ggWg1w2hEO+YYKhwnPJU16vsxnKu0N1VZLEsOLF?= =?utf-8?q?6tJ42XUh3qvt07sXp35OXw1GPXF1H2qOT4IrXGdS/Ukgt/j5GUWEYPRco6IoJBN8A?= =?utf-8?q?61a6gE8c9eXPcffMmonqoM6zQTle2w22VygHZqs5oYVGLn8sC5o361W0B01+FzDQj?= =?utf-8?q?pErpwi3qOIYpIxG3v9NF1FnU5bhr2zF0iHDdyVw+8Spp+pQVIvjeM0W/+bXkRAI3i?= =?utf-8?q?Qhj7lj9DZjvUjDP4jlI8mECQMhOBBiXUcMabBOTKF6yCnv8+ztaceDSHoClMisJW+?= =?utf-8?q?atSOpcmBOxrJLBTjysR/ltc2vUculy3YkXiCjjzRA8+1dn72Siecitdnnq+aVwlIU?= =?utf-8?q?WbE7zkohMO091agpaG7UBIIAAysVANp08dNG2qJuCCFZBcNjAO9eV7g=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: d287b70a-b275-4548-401a-08dc685154a7 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 29 Apr 2024 13:36:10.3010 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: e94ec9da-9183-471e-83b3-51baa8eb804f X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: YeTuIxSFXDHdxf+zae/5a9umXaqa5vWdIphZScN02FewQOpeNiEk7JprAufuwednzLHCyQcix7M1HX/bC89WNA2OvJdP2I32dY1uN3ykFUU= X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR08MB6119 |
Series |
usb: typec: tipd: fix event checking in interrupt service routines
|
expand
|
The ISRs of the tps25750 and tps6598x do not handle generated events properly under all circumstances. The tps6598x ISR does not read all bits of the INT_EVENTX registers in newer devices (tps65987 and tps65988, which have 11-byte interrupt registers), leaving events signaled with bits above 64 unattended. Moreover, these events are not cleared, leaving the interrupt enabled. The tps25750 reads all bits of the INT_EVENT1 register, but the event checking is not right because the same event is checked in two different regions of the same register by means of an OR operation. This series aims to fix both issues by reading all bits of the INT_EVENTX registers, and limiting the event checking to the region where the supported events are defined (currently they are limited to the first 64 bits of the registers, as the are defined as BIT_ULL()). In order to identify the interrupt register size, a simple mechanism has been added to read the version register and select the right size accordingly. This mechanism has been tested with a TPS65987DDHRSHR (DH variant) which returned the expected value (0xF7). If the need for events above the first 64 bits of the INT_EVENTX registers arises, a different mechanism might be required. But for the current needs, all definitions can be left as they are. When at it, an explicit device_get_match_data() (which is already contained in i2c_get_match_data()) has been removed. Signed-off-by: Javier Carrasco <javier.carrasco@wolfvision.net> --- Changes in v3: - Remove explicit usage of device_get_match_data() (new patch). - Fix series versioning (last resend should have been v2). - Keep 64 bit reads in the interrupt handler for tps65981/2/6 by reading the version register. - Link to v2: https://lore.kernel.org/r/20240328-tps6598x_fix_event_handling-v1-0-502721ff705b@wolfvision.net Changes in v2: - Add Cc tag for 'stable' (fixes). - Link to v1: https://lore.kernel.org/r/20240325-tps6598x_fix_event_handling-v1-0-633fe0c87cc8@wolfvision.net/ --- Javier Carrasco (3): usb: typec: tipd: fix event checking for tps25750 usb: typec: tipd: fix event checking for tps6598x usb: typec: tipd: rely on i2c_get_match_data() drivers/usb/typec/tipd/core.c | 56 +++++++++++++++++++++++++-------------- drivers/usb/typec/tipd/tps6598x.h | 11 ++++++++ 2 files changed, 47 insertions(+), 20 deletions(-) --- base-commit: 4cece764965020c22cff7665b18a012006359095 change-id: 20240328-tps6598x_fix_event_handling-3398d3d82f85 Best regards,