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 8C85A443E3A 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=1789110037; cv=none; b=FB356iKRs4/cnxOp4K55ttQzlZHlOUx/skloYVIM+V8d6kTFJV6gAZKGaPM23sVaIRBCCgkFkZVtpqsL7DMMTeNJgJN0bz8BJFvVF3iF7Wn7jvjSQNH0Ci2tRdFw1nM2EuyZ9/TV2UVQyWDHwfHG1OPa3IB2vhpNA7H+SJh4iww= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1789110037; c=relaxed/simple; bh=ylkjx/zKj9feNOcLIH+wx13fieHyCJOIYgit6seCmw4=; h=From:Subject:Date:Message-Id:MIME-Version:Content-Type:To:Cc; b=rnAai2+vfTBVYYq5mKvmP1anrD1UF8/U7vK5KVkZRnZ7hlyytPsLQKmK1WjVivn9zPyxdXB9LP6FwgiuUwoODjX0WzPx3HHBkekI3nllM7HM4XsrRCFssP6/gEAYxDMCQXQKVnxY5mKBzIcNKGOkSppi1ROt97OPyZkF2aqCCgc= 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 (m0279869.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 68B6kX3M3709532 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 4gm5q41jsk-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-3968dfff779so955917a91.1 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=FGikK19sEeiLiYET4FNS4lGtIbngwMbcbdXVal8PrejuqiKp8wHBP4goDRaqHqI4OP 8jEbD3GAh4aaEgroauz0jb4uuml1ojn3+T47aL9hEt7v9JocBoOqCwTFcsRSZMl3rkzR I0X0DgztT4xeqinaBbV4VXjvV+r30s2VXJviacuizMAOxknRTLQSBp1g+E4ubzHg+pWs tbqFgIB1stkikxBTvvtWbfUPCJcx/rku9v8SiQhR7ygo0YP+k/x4vGksyKuYVCceSzcl vq09yt8LXqFpz7/IlNs6ndPsx3zAvi9MREDqELIewMZpSssB1fBDbFW1xrV6UHsisFrm rBJA== X-Forwarded-Encrypted: i=1; AKwUvBzXIouZ6zx02wCZAzFG7c6nSsCupUsvYZxdmkUYNZOzgblH7LAAGJhVGByuv0Z4JxH1s9D9l0rLO2t09T4d@vger.kernel.org X-Gm-Message-State: AFuF++kDi7WfrisVmi9EQzGVkIbPmdtYtG9kYibqmyB/5GJ0DxEE36Ht 11KXJ/mdt4AMZX8ylNNsMgXYXtv6eILsZs6/xEtACO3qUX6cTXUdFyTJXJdoz3uEenGfB1OHgYo oP2TQqmx7cjRJJqhB3PEeUWzQkMe/S3AXubPIttRL5G5QBW+fOxNCdfNeppmehkbRJUkU X-Gm-Gg: AYBFou2m/h0goOTYdUwxgfsGbEMvu5ufNSl0ypOn1g10khigu6LR7HJCBcCa9+JMmcX P55yYExbKRIBBDXLNjz3Bk5RTbcDEe1HxN4wSktW4CORPJzEfDiKKM3QY7cpgTKngQoGoV+pHuT kWwnTVDFD2vkEo8g1W8/XY9O+1MK25gLhCqM9oHKtVbCHPWAfdgNGeP+XU32H/0cw5lmPq/T9ci Cd4KaBNf3kOWdB+nER58pU21t2iTUfwtt8lLvqnEkMyF6a8SNMYLdVne6kvKEboRV5FdcbaMJY3 /z+CF+oRN0zV6ydBFECLX3u+PxtvC9NnxcPaD53YFoMZDI+hoSwDyNaR/RfSZIPGYnjq0z56sTm S2qmxAFU3Dl/OmoB4bVFfmC5IewNt5R+1u5M= X-Received: by 2002:a17:90b:4ec7:b0:398:a649:8fa3 with SMTP id 98e67ed59e1d1-39d77b770ccmr11682971a91.23.1789110007741; 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-arm-msm@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: GpuY2bJwT5bm2pf5hY80q6FiajiFsunk X-Pro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64EORAAAA:8 a=ernR5N_utsnnydoaGBgA:9 a=QEXdDO2ut3YA:10 a=iS9zxrgQBfv6-_F4QbHw:22 a=FO4_E8m0qiDe52t0p3_H:22 a=Qz6KxWHdQ2_aS5WpiCfK:22 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 malwarescore=0 lowpriorityscore=0 priorityscore=1501 suspectscore=0 spamscore=0 bulkscore=0 impostorscore=0 clxscore=1015 adultscore=0 phishscore=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