From patchwork Thu Mar 28 16:25:20 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Javier Carrasco X-Patchwork-Id: 13608952 Received: from EUR01-VE1-obe.outbound.protection.outlook.com (mail-ve1eur01on2112.outbound.protection.outlook.com [40.107.14.112]) (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 887E12D792; Thu, 28 Mar 2024 16:25:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=fail smtp.client-ip=40.107.14.112 ARC-Seal: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711643135; cv=fail; b=Nshzwho4G5zJZqO2T3CxYUJiVUqzqmI6o0KIY3s58gGCH7CvkZAdhTf39Wk8VS90KYZLq8hYSIRdoYqX01fXvHA3VmnYuMFcUWinbfjwByl/SuMEIefzMHjZbhfcCkdGeZ3W339bZX5hWmFu7IPvjQebkppD5VvtrPz8fTtK5FY= ARC-Message-Signature: i=2; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711643135; c=relaxed/simple; bh=VLSh7akUhIgMn3xB/pYmXrnbq8Pdxkzfa7FYdSs/QJ4=; h=From:Subject:Date:Message-Id:Content-Type:To:Cc:MIME-Version; b=U9LFL7cnx3hdE1dvS23VuN5fcktC+65NQ7jKBwXFkdZBVLsI5UWEt02+hik3fM1Ou5e0a6Xw7IMPJUBddsR36VuLgi8Twz5WQc1tcZ1fhwsJCpEylxyV0+oiaUKHnFij2UZU3ObeDkzDffvSoPHy8CU72mIZ+uMZWWY16N5Tfk4= 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=M3G1FUZJ; arc=fail smtp.client-ip=40.107.14.112 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="M3G1FUZJ" ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=V8aOmOlSq7jZjcvxePxbn80gVD4m+0I7qNX5WVy+rs4dE9UYz1y8YwGfXxVfHrM6VISMaRBoaGSWYyYQwllOafsbCpIKJnglsK62BjOYWncQFlg8r94B3JM2yOer97OB5jt55mo428CU19lr3ek3i2HpYATtBRFItn9xkZJaPZD1uO1S+vJ7vW+N7uBWxfRp8qsScuDu0gCqLLEcGZSU8sjqvqTD7OSbelDklO6V8M+k8urwcFzO53ZHxBuHKvdZO07NL06aEQOaqS8w0n5HCAULo/GH6GqcnDBCuv9iXwparGNkPmQ8VyyRqIxR37HRQMpGrmszDgjs+R9+Nj3fig== 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=pa4EwFNeI1Pr3jkX8ALbOt6amLJLxrCA/F108FRHnQw=; b=cAcUMfxPQDvzCEfEC/WleYKNb8XSc1xZsFkqT7my+E1/eK1j+6WxOwvit9iBwNO+tDujWXih7K5HiHTDyzRSzVoSRLPmT8Tg+9iqag4hdoqblTKYTK4HM0M0MpwG5JB0AqL+IxpOkGCQbS/bprr6MvIeUedSrE5tjjOZiUAHB4cSMpsDXoA/Zc8P1CEIRaUrp1xOn1QcEIxc39lsp4DryJ4ouEQbiGKFJehnIG6dE6b6IbdEf27cU7FdVNKOoetIvTIpXD33/uk4fyiFRJ4aiAMdHDBFwxsXD6rtm0skCrIyiCHx+t1gNqFkGTpswlU9YmLnXzS2u/23owS4UIvsIA== 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=pa4EwFNeI1Pr3jkX8ALbOt6amLJLxrCA/F108FRHnQw=; b=M3G1FUZJz31W8zoL47ZUSFKhpyALcwjoWOK+gGZPBdsNnJUWmiENtd685afJsIpUc90lwJp136t0IENVo3Pb0mqluML0RWm57WCmyStnNnbcsTRf32gCd1OqfMmgSy51yjth2c9u4w9owPPMYaSj05vdomQQchUNYEc0q7+ZK6I= 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 DU0PR08MB10358.eurprd08.prod.outlook.com (2603:10a6:10:415::19) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.7409.33; Thu, 28 Mar 2024 16:25:29 +0000 Received: from VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f]) by VE1PR08MB4974.eurprd08.prod.outlook.com ([fe80::9e35:6de9:e4fc:843f%7]) with mapi id 15.20.7409.031; Thu, 28 Mar 2024 16:25:29 +0000 From: Javier Carrasco Subject: [PATCH RESEND 0/2] usb: typec: tipd: fix event checking in interrupt service routines Date: Thu, 28 Mar 2024 17:25:20 +0100 Message-Id: <20240328-tps6598x_fix_event_handling-v1-0-865842a30009@wolfvision.net> X-B4-Tracking: v=1; b=H4sIAPCZBWYC/6tWKk4tykwtVrJSqFYqSi3LLM7MzwNyDHUUlJIzE vPSU3UzU4B8JSMDIxMDYyML3ZKCYjNTS4uK+LTMivjUstS8knigupSczLx0XYu0tDTjRDMDQ4s USyWgCQVFqUBVYNOjlYJcg139XJRia2sBpC4+g3UAAAA= To: Heikki Krogerus , Greg Kroah-Hartman , Abdel Alkuor Cc: linux-usb@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org, Javier Carrasco X-Mailer: b4 0.14-dev X-Developer-Signature: v=1; a=ed25519-sha256; t=1711643129; l=1584; i=javier.carrasco@wolfvision.net; s=20240320; h=from:subject:message-id; bh=VLSh7akUhIgMn3xB/pYmXrnbq8Pdxkzfa7FYdSs/QJ4=; b=L/vqrldhtXEGPxjrm6Z1YMeFNUuDqdeUe3/cow7+ZieRLcQRhn9yN2uY1HtDbfhxpdgq3MX9L NAJGaN5F4gbBx/QUDuxCUBRRy1/0qILjtxsj1Hw496qpk5Q81YdaIh2 X-Developer-Key: i=javier.carrasco@wolfvision.net; a=ed25519; pk=Vxk2/0sGIxM8rsKnceszFuSuHVfQwa1Yo8+is7BX2nY= X-ClientProxiedBy: VI1PR0102CA0026.eurprd01.prod.exchangelabs.com (2603:10a6:802::39) To VE1PR08MB4974.eurprd08.prod.outlook.com (2603:10a6:803:111::15) 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: VE1PR08MB4974:EE_|DU0PR08MB10358:EE_ X-MS-Office365-Filtering-Correlation-Id: b85aec0d-b2d7-434e-0fc5-08dc4f43aeb9 X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: b5ZlBnJvbAASyZTqT9SZ8eOumkgA/0LDlPVTFFcUtq/AfB9pLXpbp9jKHA7q6RY62r5CW2ZWh20AGMsR9WKiIGQIBaOiVFPPbQa2QtmYmzvwWsKURJpcHH6bzjXxLknLqaX1YM10Pgqo130j+P/S/IlvN2kZPm5sL+jSBYlks8k76RUt2z4bMGCPnS3xLsgwvhJP8WjWw5QJGEVV0vjGaxMudTE6qp6N+qpVLN95qu9Bt3P5c2URv6ZU8W8r0CPuYu1ipFNv2XOD9G1A2VehVOTQmniWAucU+9NkoOGznghOEZhcxveGmlT9HMjQHGhosGYoyjaj045JRo9YsrX0Oy+psGwZOyDyjc+VPDpDzlnQAzy0OdFgwhTCNlXgwxYw5bBi4gYFo4AgUV5fGoP9wEO6TW4NpLQA0qV55uyguwuG5Zzpp+JZ+n3acybxaBx4DBrI4eM1GmgXP6/r3W6mClvhIwAYVKhQhE9PC/43ZYbEm5/NNkewBGjkVrpS2oTsnP6Be2SOzkZPxPCz3DcCtfElSZxHBxf3WuZoTixNWvMrgp1UbkrRQ7bsdEs3TRJCpgRIQEPPeGUueFIUWAzC0Gr+Ixv19gHBAhhhNKGKvgC++9HMbKCs+yAQkZ1PzQXQit5emRpVo5m269V8jWUTiUXVjyqG+Tcryj5ocel3sFEQ9PsygUd3dlNrRdzYprW6pMDsAhilNXEmtYUswBuv0A== 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)(376005)(52116005)(1800799015)(366007)(38350700005);DIR:OUT;SFP:1102; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: =?utf-8?q?7AySfQ89sgJ64XIGyNAmpVw8N3A+?= =?utf-8?q?AJKDAsvRmd8oAkWZA1HQtQZBqfM0/VkgpxNdwDNBo9UYpq1BTOYK5rnhujzSgr4eC?= =?utf-8?q?aMGrxa8/vNZpi+kmsHmJd4K6Wg9AYyWycKfarKIinQyg0O77mO1YJZBk0uO2axuf0?= =?utf-8?q?NWgdo3j5iveF2wI5a9W44xsxX+UzWYB/qh0HgqGfg7WDJwrhFiEI721nyIvt/lgQY?= =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cMFzXntB2rSQ8v+ijX79AboQI2bb3090a7rUrSL203pyDoub7e?= =?utf-8?q?Bf2IB6cm3EuLslXxp9nb8RKQ8K2ePIaMuA9hXyGA1CIFwkDmEjw+FYX1n6C8qX9iU?= =?utf-8?q?7YsCYnsxwEls82+eeaSvLmbl8dDHSwFTf5S/7K+K+XxmGMbJ7C1Q+okvFtXP73IHl?= =?utf-8?q?38pMn5bMf1a5js1uChquam3x+US1LFfzOMGjXM1BeBe+BQdmt/4nOyCDRAxwFuaBj?= =?utf-8?q?zczp2S339WMjHIQQvIZdy4UD1xUv48yKl4JMP+kumswkWl7WKlbnrzU7b1KVB1CuN?= =?utf-8?q?eNH1xPa/ivxdwAQspaRWeSenv9UQIafxk9dSS0UGtuhisN4xZ6yEWbr5AsAgBzb5+?= =?utf-8?q?6VwcfDeC9NhKpU8BYhbL4PCHrAY+87RFlWqIf/P6+xL1IdmqKu2mHCD10UEK0LZJu?= =?utf-8?q?yBOYf+VXcCmrWroZB2YA5KDvVpzaL/krtw=3D=3D?= X-OriginatorOrg: wolfvision.net X-MS-Exchange-CrossTenant-Network-Message-Id: b85aec0d-b2d7-434e-0fc5-08dc4f43aeb9 X-MS-Exchange-CrossTenant-AuthSource: VE1PR08MB4974.eurprd08.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 28 Mar 2024 16:25:29.3577 (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: reMhklkkHRtwfx/iWkdDf4F57vdQTePOODPydM6rQMEaKfXfNP20Ulw1TxvsDhyJ+2yom1shycn2JUzIr4IgEc7X9lgo80EWcDlPN7/9DDA= X-MS-Exchange-Transport-CrossTenantHeadersStamped: DU0PR08MB10358 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, 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()). 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. Note: resend to add 'stable' mailing list (fixes in the series). Signed-off-by: Javier Carrasco --- Javier Carrasco (2): usb: typec: tipd: fix event checking for tps25750 usb: typec: tipd: fix event checking for tps6598x drivers/usb/typec/tipd/core.c | 37 +++++++++++++++++++++---------------- 1 file changed, 21 insertions(+), 16 deletions(-) --- base-commit: 4cece764965020c22cff7665b18a012006359095 change-id: 20240328-tps6598x_fix_event_handling-8fff3a6018d9 Best regards,