From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.131]) (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 89F6F442377 for ; Fri, 11 Sep 2026 07:00:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=205.220.180.131 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789110036; cv=none; b=GoR5gHdAzCxu3XfNLBafr6rzS5h9rA/pgqSU3fpLYO9AgWxRGp1dp/VqfjJxacabPRbjOJVqcGY8ln4GP7LlQ9/9I0opgYPN5wHahJ3GTJ6nRE7aOVT5ePBcJRTS/KlU1yp+xE7RmQSgrJnZ/C1f+8Qyj9y5bqZ7LpYpBZ5NLSo= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789110036; c=relaxed/simple; bh=ylkjx/zKj9feNOcLIH+wx13fieHyCJOIYgit6seCmw4=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=mQiUyJvW66wAQwZxTsYD9ayoQCpk3sHb/KNa5jSaAb5+RtjA+FryccmipNOserbjlaPgbN1OILvjOC7lMjz9x7Rj/srP+zpOemjiTqgbLt7ozmKMlM5u6jEWHivau+j8NY7R5I2dngka6sRu+1VzzGh5c0zmZ4w3oTBoQZgjOOc= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b=GjSpZDbn; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b=VGxGLASU; arc=none smtp.client-ip=205.220.180.131 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=oss.qualcomm.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=qualcomm.com header.i=@qualcomm.com header.b="GjSpZDbn"; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.b="VGxGLASU" Received: from pps.filterd (m0279873.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68B6kI4A3328625 for ; Fri, 11 Sep 2026 07:00:14 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=qualcomm.com; h= cc:content-transfer-encoding:content-type:date:from:message-id :mime-version:subject:to; s=qcppdkim1; bh=ot0o1fL3FlIljmyMpGi3Yg ySihAQwuGmlbW1iDnqSlA=; b=GjSpZDbnuxfZj4YnlV8VWnN5/xDr803fZPn6g5 YiJpokORQACDmSQJYtG8fpJdl+Th93P8uHshvkoTXg8jAoqtcqpYDXHNl+/EpcPF SOajObKqY8qUvr9OazhuYIxwZS4qPpvhO+vzd51dcJtMvLS0sHJowWT6X0DyMGyt NCWSvu+GY8szkMJ8L4JCMVB5P7/XAjB416IEZgs4lBl4rrpmURopjpT2umk57hLK DEWCZxtPR3Gn4blCSAOMct2lzAX0b6+Pv/7u/ph24OMWGE4SkWUqkpq5FcLgcjpt 9BSfa25H5YdsO4q/3VrvKjDtU2Y/HrhzmflGDMgde2jTAYaA== Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4gmbdr8bwv-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 11 Sep 2026 07:00:13 +0000 (GMT) Received: by mail-pj1-f72.google.com with SMTP id 98e67ed59e1d1-39af92138f9so1178577a91.0 for ; Fri, 11 Sep 2026 00:00:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1789110008; x=1789714808; darn=vger.kernel.org; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:from:to:cc:subject:date:message-id :reply-to:content-type; bh=ot0o1fL3FlIljmyMpGi3YgySihAQwuGmlbW1iDnqSlA=; b=VGxGLASUqlboHIgHTBtQGMfAIxy6gWraBKc4ydL86vS38+beIspYbJ3rb7fHyO+E5z KF5Itt9Y8QyhXhEIJ3c8Zos38atPpFa+eEe4dyeg4ZI1n1zIaY+qEOLvo2qedXjqDk5U bvS/Yufavbt3AXRu0bBZPbkbI2GRMCxgiK/NiG1r/uzzv9eSY5lU39ojfwAvDv04BzO/ 7wt6QUC/fqdTvCA8mCQH7r33kzbdJyH8Ob8WoUFOiTrQYsfGxkOterVo6sb0kbBUafMh nW7ry0h/g0t966ufUlHMzhj7S2pnfeQZksaG/0SUO/SoRc4yXVGSU6P1ShlvzPRSEFrr 656Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1789110008; x=1789714808; h=cc:to:content-transfer-encoding:content-type:mime-version :message-id:date:subject:from:x-gm-gg:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to:content-type; bh=ot0o1fL3FlIljmyMpGi3YgySihAQwuGmlbW1iDnqSlA=; b=HIILfvlhIXy2fdaItLXKhr7UYCS675gFI2IeMlC3GQV+grHwcn4/Og3luOPfIQUMEI fSijL794tM5V+sM6gmIXJJ1BGR/bSsvLVNR8WQxN9SrovOgbzpaqyErGaK6SX/UG5nRT Gk34ZYO+nHiQCBUWeuViRBb6xtKRndcJHLy2fKZZg1xtR+cI7u/8KVjKzfcWY4Px6reG 9rUcnO5M+NeZd2JYxjJZrK+r+4nl3B4NsrnE8uveH7bp8JX7M943C5m4Iswv1Rw0r/tQ vrnOtUfCStF0fKSGjWmGWMS9BzLB7SMfQbobKFCbSluniymN3xDXWD0WAmX897sCvkt8 6PBA== X-Forwarded-Encrypted: i=1; AKwUvBzT9LzgI+oGDZUMd6SjorZlNghLu+i1xGQU/2iKXzPF1wcU4vVhyHZLF5TIyl9geEACQkd+F2X1kVIfLV8=@vger.kernel.org X-Gm-Message-State: AFuF++ls6VQEgg8iL824gZOSoXO8/HOlaq3lyX1cW0DMF29yQXjHaAZM /738iBZ5PsHnZfXP7SxmPpI/GoWSMIhekEWXp48LQEZ8iGC7sk9bqbYsWuAJC8QJl+mWYkSl3Ag rzp0QCtwMI55DMuCwyiFCyl88ZYdsxyR7G7j3FCaa8BfZ3NFcbDadypEFzy0swyf1/Ec= X-Gm-Gg: AYBFou1VlQT/civ9wo3Yt4Csel3GR5B4457zO2hY3n/f2jy8nQ+MhXFlI/2VthzquCv IN/J7OAt0dkVJXIoW09O8Z6utqL6uDl2eEpmTroqqBmMgT2tlJJsiHxOH0SpoUSI5ePXWhsGlTG vMDHpno3H3w0bXoAtgtrdQJlnfzB51vhZwICtCbYvKI89PrWOSUwgqn4S8Rq8sDkgZVonesyFAX PMzDN6jiWf1PFxLHoAb7AXl6cgF768BsOX5Z4MN2plR8klxh4aqCkjVi1FD0b/f+1KNlLCB+lXA Egg7UVExf+5+SwzFwvBhS8Y49Hije87EYK3xrwp4RXHQ6Lg56UFHpRX2Wc/llDBKfLC3IrR8fqb 4SWiYRZa1pwVJHqDS0UH7yG8Q6UYIxYgnXbQ= X-Received: by 2002:a17:90b:4ec7:b0:398:a649:8fa3 with SMTP id 98e67ed59e1d1-39d77b770ccmr11682968a91.23.1789110007738; Fri, 11 Sep 2026 00:00:07 -0700 (PDT) X-Received: by 2002:a17:90b:4ec7:b0:398:a649:8fa3 with SMTP id 98e67ed59e1d1-39d77b770ccmr11682908a91.23.1789110007177; Fri, 11 Sep 2026 00:00:07 -0700 (PDT) Received: from hu-arandive-hyd.qualcomm.com ([202.46.22.19]) by smtp.gmail.com with ESMTPSA id 5a478bee46e88-33ba4e9a8a9sm3799532eec.13.2026.09.11.00.00.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 11 Sep 2026 00:00:06 -0700 (PDT) From: Aniket Randive Subject: [PATCH v9 0/2] i2c: Add dynamic transfer timeout based on message length and frequency Date: Fri, 11 Sep 2026 12:29:50 +0530 Message-Id: <20260911-master-v9-0-77ac458344e2@oss.qualcomm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAOamo2oC/22NwQ7CIBAFf6XhLA2loYAn/8N4oBQsxoqyLdE0/ XehjcaDl00meTM7IzDBGUD7YkbBRAfO3xLIXYF0r25ng12XGFFCG8KrBg8KRhOw5Z1iXHNGpUJ pfA/GuucaOp42hqm9GD1mOy96B6MPr/VT5Hm3RUVVf6KRY4JrK0lFtJWUyoMHKB+Tumo/DGU6K Lej+LEp/9oi2Uw2rRaVZinwx16W5Q0R/ebS8wAAAA== X-Change-ID: 20260716-master-f7da57c7529a To: Andi Shyti , Viken Dadhaniya Cc: Dmitry Guzman , naresh.maramaina@oss.qualcomm.com, linux-i2c@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-msm@vger.kernel.org, Mukesh Kumar Savaliya , Aniket Randive X-Mailer: b4 0.15.2 X-Developer-Signature: v=1; a=ed25519-sha256; t=1789110003; l=4088; i=aniket.randive@oss.qualcomm.com; s=20260325; h=from:subject:message-id; bh=ylkjx/zKj9feNOcLIH+wx13fieHyCJOIYgit6seCmw4=; b=cNYpkOrAYObvZYLEbWVlwSo4eX+zpxX1cRCnXHr/rRAqg1EF1iiv3OYF1Jzy1a1XAx7yIQnvr N+M5USBmP/KBZjTZ1xoXqkYB2eemF4AiOiN8DQtodT3I7wGQCIqD1ub X-Developer-Key: i=aniket.randive@oss.qualcomm.com; a=ed25519; pk=4o37X1ZqGbCO/T2SR8kq/HnWvq0yb1RUlFuNukovbQk= X-Proofpoint-GUID: OTtYoNQK0GvnUnQZXfPicYcaGClnHTiH X-Authority-Analysis: v=2.4 cv=PLmaavqC c=1 sm=1 tr=0 ts=6aa3a6fd cx=c_pps a=RP+M6JBNLl+fLTcSJhASfg==:117 a=fChuTYTh2wq5r3m49p7fHw==:17 a=IkcTkHD0fZMA:10 a=VdqzKS8jKosA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=rJkE3RaqiGZ5pbrm-msn:22 a=bC-a23v3AAAA:8 a=EUspDBNiAAAA:8 a=VwQbUJbxAAAA:8 a=JvO64EORAAAA:8 a=ernR5N_utsnnydoaGBgA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 a=FO4_E8m0qiDe52t0p3_H:22 a=Qz6KxWHdQ2_aS5WpiCfK:22 X-Proofpoint-ORIG-GUID: OTtYoNQK0GvnUnQZXfPicYcaGClnHTiH X-Proofpoint-Spam-Info: AW1haW4tMjYwOTExMDA5NSBTYWx0ZWRfX4ZGCVOlUGbSB imYubYFVmIitRRQzaqiyNWm971863d/OuUzI7ZVGgih3xr7BEca1GWm0brRCzR+rgknDc3KVOyC fGYlEVikhxb8nE9+vi7nX7dCfI5Biko= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYwOTExMDA5NSBTYWx0ZWRfX65fn10wHQ1eq bv0Atl02Edjnk6WuFhvneiwud4e4aHjji5bKUv+3tcDVH5Jug85Om1P6LfyJQhloK9s5694tFuL 7U93CTNI4gI8p6/zwT+blEH2TouFSU5E0Lj0kMj99eaMhsGq0HpgenMIGKqHGeqpFIoY/NFUBYJ RviEBIT7VNvSqL5or+kJD9eQJ8Bm+cji1eO2odoyg3ENQF5nGaqMR0QQUJsxY+4Ov2vYLDBCvB3 Yf0K5x3PLEUH48lrXlL4kfs2dlnmqLCrKWwfAGFT1RH4b8tqfPnlHQSaVWfOgKCmGDR4XbCsmuD Pd7U9yuiUb5G/RZsxp7seATwSmAosinKtITvtGEMlZIgNWQiR2JndVilgFGtcB1gZvWRmkDgHrf 0Jcs7Iir0EIR17gQ5lzWFUOao6TQD1RjUaG0MItmiL+AzoH1+n9Zd3FgOtguApFrrgh1nI+dg3G 2dYNL4u56nX7++dnJdA== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.134,FMLib:17.12.100.49 definitions=2026-09-11_02,2026-09-09_02,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 spamscore=0 phishscore=0 adultscore=0 malwarescore=0 clxscore=1015 priorityscore=1501 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2609040000 definitions=main-2609110095 The I2C core and many controller drivers currently rely on a fixed timeout value that does not account for transfer characteristics such as message length or bus frequency. This can make the timeout unnecessarily large for short transfers, while longer transfers at lower bus frequencies may require a timeout that better matches the expected transfer duration. Introduce a generic helper API in the I2C core to calculate a transfer-specific timeout from the expected wire time of a transaction. Store the computed value in adap->timeout so that both the I2C core retry logic and controller drivers use a timeout value that reflects the current transfer. Keep timeout policy decisions within individual controller drivers. Let drivers provide their own safety margins and minimum timeout floors, and avoid exposing those driver-specific policy values as part of the generic API. Convert the Qualcomm GENI I2C driver to use the helper while preserving its existing timeout policy. Preserve the static timeout behaviour when CONFIG_I2C_DYNAMIC_TIMEOUT is disabled, and let a userspace-configured I2C_TIMEOUT value take precedence over the computed timeout. Suggested-by: Dmitry Guzman --- Changes in v9: - Add '---' demarcation before revision history in the cover letter - Link to v8: https://patch.msgid.link/20260827-master-v8-0-596bc81c5cf9@oss.qualcomm.com Changes in v8: - Compute GPI multi-descriptor timeout using the total length of all messages in the batch, since completion is reported only after the entire batch finishes. - Guard against zero bus frequency in i2c_update_timeout() with WARN_ON_ONCE() and retain the existing timeout as a safe fallback. - Link to v7: https://patch.msgid.link/20260813-master-v7-0-3f9010cf9229@oss.qualcomm.com Changes in v7: - Add CONFIG_I2C_DYNAMIC_TIMEOUT to gate i2c_update_timeout(); no-op stub when config is disabled preserving existing static behaviour - Store userspace I2C_TIMEOUT ioctl value in a new adap->user_timeout field; userspace-configured timeout always takes precedence over the kernel-computed value - Fix geni_i2c_gpi_multi_xfer_timeout_handler() parameter type u32 -> unsigned long to match wait_for_completion_timeout() expectation Changes in v6: - Split into two patches: core helper + driver consumer - Moved timeout calculation to i2c-core as i2c_update_timeout(), which writes directly into adap->timeout so all consumers of that field (including the __i2c_transfer() retry loop) benefit automatically - Driver supplies safety coefficient and minimum floor as parameters, keeping I2C_TIMEOUT_SAFETY_COEFFICIENT and I2C_TIMEOUT_MIN_USEC internal to i2c-qcom-geni.c - Compute timeout once per batch in geni_i2c_xfer() using max message length, all internal wait sites read adap->timeout directly Link: https://lore.kernel.org/r/20260715101805.3615166-1-aniket.randive@oss.qualcomm.com To: Andi Shyti To: Viken Dadhaniya Cc: naresh.maramaina@oss.qualcomm.com Cc: linux-i2c@vger.kernel.org Cc: linux-kernel@vger.kernel.org Cc: linux-arm-msm@vger.kernel.org Reviewed-by: Mukesh Kumar Savaliya Signed-off-by: Aniket Randive --- Aniket Randive (2): i2c: core: Add i2c_update_timeout() helper for dynamic transfer timeouts i2c: qcom-geni: Add dynamic transfer timeout based on transfer length and frequency drivers/i2c/Kconfig | 13 +++++++++++ drivers/i2c/busses/i2c-qcom-geni.c | 48 +++++++++++++++++++++++++++++++------- drivers/i2c/i2c-core-base.c | 43 ++++++++++++++++++++++++++++++++++ drivers/i2c/i2c-dev.c | 3 +++ include/linux/i2c.h | 13 +++++++++++ 5 files changed, 111 insertions(+), 9 deletions(-) --- base-commit: f82a5da2f04960df9fb57489992d03dd5e64ec6f change-id: 20260716-master-f7da57c7529a Best regards, -- Aniket Randive