Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.168.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796035032; b=XX+QCIlK/hUz65fKP5CkEhPZwZ5fuzBczKyjHgeuTDtebicBqL6M12PdAl8zaAKbme3R 7fqtiCfjz7CxoCQzQGPhFvn88veOnMdR9pv3NvtGEqJEtjwRoTcLf8af9BnBh5KRQdFN+ BbrZXE6pONYb1APx/XMw7xlfYPA+i6i3FiYk/FmzanVE1mxNrZKQBhajQ+kZ8/HLikR/M NtgpvOvXvXeRwP5yC3tN1RH7fQQvPf+D1m+2b4L/8kEIqgJ10p3A634IVmgYZEflv/V2k JUcEypkscAILeKsVqI7lHIkhdSGhX3FahWo9dwYoFK4BYv2QKaUP9TWNp83jYeKHo1g== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796035032; h=DMARC-Filter:Received:DKIM-Signature:Received:Received: DKIM-Signature:X-Google-DKIM-Signature:X-Forwarded-Encrypted: X-Gm-Message-State:X-Gm-Gg:X-Received:X-Received:Received:From: Subject:Date:Message-Id:MIME-Version:Content-Type: Content-Transfer-Encoding:X-B4-Tracking:X-Change-ID:To:Cc:X-Mailer: X-Authority-Analysis:X-Proofpoint-GUID:X-Proofpoint-ORIG-GUID: X-Proofpoint-Spam-Info:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=cwQqlvGFTcwdYx8qpqztpPmc8xfOMzWHPn20xqJOYqQ=; b=kXK49tIql+QCQTF0JhQlw8cwzY9r1KpQcVknc0JjYPnTf0TeWpa52UTgiuxHWH0PtMrU B0YNIXCiy3yr1ZvglXYNXjusoGKkxubuVQFQElF39YMxXQdlYmOoMkPT24M9AQnNex+Hw qFfm4as0E0ohM9kNhaNsQB2pHhrqdjYc4BR5aN+OHH1QReyuVwWd1I6Aqror/TbdvNejh QWBmyBegibGPUiTW76CPNZNs1YuDmATZMa9n/XZVnT64ZXYtz3GmaHVskq3JgNGZzmP5D 8QBX+a+tKNuBjt0Ji7xTY5SxHxgcX9PIazRizQ4UcIVJ+7Y+I5LbgX8kCSzFHhlfNHw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=oss.qualcomm.com; spf=pass smtp.mailfrom=oss.qualcomm.com; dkim=pass header.d=qualcomm.com header.i=@qualcomm.com header.a=rsa-sha256 header.s=qcppdkim1 header.b=VexWz45F; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=bwXTytss; arc=none smtp.remote-ip=205.220.168.131 Received: from mx0a-0031df01.pphosted.com (mx0a-0031df01.pphosted.com [205.220.168.131]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 290F1606A31C for ; Mon, 30 Nov 2026 10:37:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 290F1606A31C Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none 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.a=rsa-sha256 header.s=qcppdkim1 header.b=VexWz45F; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=bwXTytss Received: from pps.filterd (m0279863.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AU9V0mc2283530 for ; Mon, 30 Nov 2026 10:37:11 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=cwQqlvGFTcwdYx8qpqztpP mc8xfOMzWHPn20xqJOYqQ=; b=VexWz45FlxO8BC/62nODWfMUHTG+3jxZgqgjzJ jK0EqqOA1mZHyWFY58W6Qfqct3Tx++RI2ANFpAz4He9o4aYaQXL0DqhEvuVrHEJ2 G890zerL9Tr6l99TeXYk0g8l4Izz95LIH7MqUpONQjZn8l8RKEGSo4KDc1Duyh+p HkL6qiBrabZiokH3o+/Lv5VMk/xqcG9dWXVqsUZVJ4FT2bZbuFCf/Hbsx/yrXq0i v6qTsFnENdyWqJzaebedOhLj9LjASYORfXROFTVUJTh/Uup9FxgujVdX41EIqQTa Qv6gW7nQUyVjmaPnf5vnk9iqojZzFPkxRwDyHwPMCWucL/aQ== Received: from mail-qk1-f199.google.com (mail-qk1-f199.google.com [209.85.222.199]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j95ndrhk2-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Mon, 30 Nov 2026 10:37:11 +0000 (GMT) Received: by mail-qk1-f199.google.com with SMTP id af79cd13be357-93f32050e72so2231378785a.1 for ; Mon, 30 Nov 2026 02:37:11 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796035030; x=1796639830; 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=cwQqlvGFTcwdYx8qpqztpPmc8xfOMzWHPn20xqJOYqQ=; b=bwXTytss8e+Jy8G4xRU3VWidzF/1kMN52HajuAhmHhSlXbq5eqxKxZaqJR79Wswaj4 A1J2FQILJAFYj0990XdHbOHuxMgIkOrJrdQ983TDSd8SJNID5B4mAOhtuZKgKSeZHxI5 jnp0cjCEWSokTqO2+S7Bif+v19dkSJS7dISqbJQbQY/oD0/KfFPSa1ETO2cOQm3pAPXn 5fkSj3TY9SLQ0esuGtTnRiiZFdAzEc94rJFVMDo1u/W9/rB/4mXG7wTJZJPZNtKXfEAZ hmLUd1Kqiviin9O2P4F/fzmYbMZjreTgWTxTnSaUTXd6x2Cfge0lJUDf5IsFdrCVKVny YvwA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796035030; x=1796639830; 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=cwQqlvGFTcwdYx8qpqztpPmc8xfOMzWHPn20xqJOYqQ=; b=Ut4KcJBbQ9ehRn1MDExBAXAMzHDM2CLmhzZU5r6al2ZSGheVV7RSRi9yv55vA4B4Zc +I936sZgFuEMV66jUW2z7TDoPQW9QN6RoZwjg3DBeGnVPUUFjzrEURG/+yG0zNKOk02J w1uBvI4stp8pof+LO6PNpeNlEYJToCaIJJ6xQKDTzO7z6grS++i2CaE1j4p/hS3m1RqI 2X6zLtiwv1Ne5zh3N/1t98PE6RHDu7Qmdan0zkF+aNHB/4AWNXLwrKCX8uM6j4vuR7yp 4wUFw7q6WffKVUA7TwkS0J6yHRETKP6ESBQUhG4MFuoY5PN6NqiJPz6MyPwIa9ANC63l 4V5A== X-Forwarded-Encrypted: i=1; AL+hErFNy4oMpGKkfmglQaz8XkyeCeV6kVblv4nA3LbyPqfFfMwqtAc2XdRN0eSQ4ByXsA0wqHyjCOA7WuKmfa7m@vger.kernel.org X-Gm-Message-State: APuU4Z+oLZL2t8ImErNd6KC1IH/QTvVypnjohO2KJ/QeBEdnuWiiBZfQ chNh5JRxyeT2HBwqaF50BuaXFRqe1CKzlNM06YT8ChnfGeq1XGyXCe4Ehm7y7OurpvjfgxZBv6U wsV3s4OwDUWH773fMeWtV+KT0LIv9+AZNJwfQckD1oDuAxXH9qXX/GSeBmVrBipeidxDh X-Gm-Gg: AZFdTZfNpLuRV3IDd3w9yAbhng0lCw5GreglYOQgTdAnb97AE0zVd8Jl5gjuuQLZD9r hJQeugwjid7/I0C5H3EKTJgTYb2+Qpya0rqH2a6o0hp6GMPEroDyp1gjCSEjM6PJcLMqLkw2Wiy 93ilVWBXAKCxkZmd5eZf86jWzXztsiylDCdarnPLcL7cwHkfpTrE4dhuUrl6twLTz3K87iENqBi hLSyZCRpySOjlbybZWFFXFKrAI69MkNijCpOlrFg39Qa439vXJh7vaWJ7/BigcT+q7TwFCZ3cZI a9mwEoxmRQQlccKQsu6JPjUbDAXwoBmVD/aulg+yvcfJ5481XkkntMMcWdl/bsrrnuk+uT1h5oc lfp8k3KLa9nmNhXMjMKTgd7g/yAw4Oogug83D/Bf894OUedmheqqy6unfkjsfyJ+RBNRi4iK86F hR6BqlBWhZEVI5dSmbJ7J6dHxV71EtaOsHPRvp9Pmtt8i+D/xc7e7I5cKalnKK4sgM9nA8hrZuJ orCYqz4sM20dRyiwPazdKvLHLG6 X-Received: by 2002:a05:620a:4408:b0:949:9cf0:bae5 with SMTP id af79cd13be357-949bab3d2f2mr6075476385a.69.1796035030379; Mon, 30 Nov 2026 02:37:10 -0800 (PST) X-Received: by 2002:a05:620a:4408:b0:949:9cf0:bae5 with SMTP id af79cd13be357-949bab3d2f2mr6075473685a.69.1796035029818; Mon, 30 Nov 2026 02:37:09 -0800 (PST) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:6046:9c83:ea4b:ae9c]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbab390cf5sm486441005e9.7.2026.11.30.02.37.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 30 Nov 2026 02:37:09 -0800 (PST) From: Loic Poulain Subject: [PATCH v5 0/7] i2c: qcom-cci: Runtime capability detection and improved read/write Date: Mon, 30 Nov 2026 11:36:56 +0100 Message-Id: <20261130-cci-imp-v5-0-d2ac891f2bc6@oss.qualcomm.com> X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-B4-Tracking: v=1; b=H4sIAMlRDWsC/3XQz24CIRAG8FcxnMUMw+wfeup7ND2wMFUS11VQo jH77sVtUjzoZZJvwu+bhLtIHAMn8bG6i8g5pDAdSmjWK+F29rBlGXzJAgFbMGikc0GG8Sj7weq eNBhDKMrrY+SfcF2avr7/cuTTpRSe63IX0nmKt+VaVo/tUqwA6L84KwkSsfMK3UA9ms8ppc3pY vduGsdNGeJRlfGJK105Ft72ndbYDkRWv+H6mbeV68Ib5o6dYqusesOpcgX1VzIVTt4RmMZ7aPA Fn+f5F3IIqSt3AQAA X-Change-ID: 20260929-cci-imp-8ba384309942 To: Robert Foss , Andi Shyti , Konrad Dybcio Cc: linux-i2c@vger.kernel.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org, Loic Poulain , Bryan O'Donoghue X-Mailer: b4 0.14.2 X-Authority-Analysis: v=2.4 cv=BPgmP1QG c=1 sm=1 tr=0 ts=6b0d51d7 cx=c_pps a=HLyN3IcIa5EE8TELMZ618Q==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=yOCtJkima9RkubShWh1s:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=GJYhxYVrF0PQDnaCLTQA:9 a=QEXdDO2ut3YA:10 a=bTQJ7kPSJx9SKPbeHEYW:22 X-Proofpoint-GUID: zMYOcqx8UU6k0jjoiG5yJY0dkeHTvuPI X-Proofpoint-ORIG-GUID: zMYOcqx8UU6k0jjoiG5yJY0dkeHTvuPI X-Proofpoint-Spam-Info: AW1haW4tMjYxMTMwMDA0MiBTYWx0ZWRfX6pCcvGE59OZ7 A1YINJHEmzjpH8ZbV91MdcdwlkC6SAG/Rt4O2IcRFQlRk+9qmQqyU7gDil+4/2VEaYm3/lokooK Iq85Wgu6Ltw/XOBu3JP/8KiUB9W1B9U= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTMwMDA0MiBTYWx0ZWRfX5zYhpb7JtXmn 8g68Yq7ZBkuJ/dnZLvI2UfwCab6HdTO6ULijtqf5DOE4vpeismEtsZLA5CNcLFgoA09JtRmvE+7 7bn+jcKtByvmdRrwT3iFlaJKndNKUNJ+0Hz0agyKJtKirQrtGa4a+e5HNjD4qkP/6W9EooYR9Ds NwgpjdhkwxSQD/78YXZEons2v4BMAhJ7+K6bsqigd3S+1f1k2ajFIJRH7wyMQjWTTrQoHUFtM4L 2ZcVbfwNlK2Dq2vcie95FWhfXRn+CpqumNOoGNcELO3pcC4RIN1IBn2jF459svnRk9N5qsORyEW RFaQ9eyR4B0KpIhjzf4bg0YeO/b7rC/J8sVjoy45Z6IIFFS/bUNIu0yR9uIEZuL6uU5wbTY8dWy VW5QWbQO/skiFKcBrUBaFLl8XfR5dhXvj1jzKEc2zn/JM/JtzeTToDvQEgv98As+gtxq+u8AFYo rWLTeSqLaNf6FudENIg== X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.293,Aquarius:18.0.1176,Hydra:6.1.138,FMLib:17.12.100.49 definitions=2026-11-30_03,2026-11-27_03,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 lowpriorityscore=0 priorityscore=1501 malwarescore=0 suspectscore=0 phishscore=0 clxscore=1015 impostorscore=0 bulkscore=0 spamscore=0 adultscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2611300042 Improves the Qualcomm CCI I2C driver read/write in different ways: - Capabilities (queue sizes, max transfer lengths, supported I2C mode) are currently hardcoded per DT compatible string in a handful of cci_data instances. Replace the static per-compatible structs with a single version-sorted capability catalog resolved at runtime from CCI_HW_VERSION. - The driver only supported single-command writes, capped at 11 bytes regardless of how much space the command queue actually has. Factor out the write-command queueing into a reusable helper and then add burst-write support, chunking longer writes across the whole queue instead of a single command's payload. - The FIFO read path hardcoded a fixed 12-byte limit unrelated to the actual per-revision FIFO size, with a special-cased drain loop. Simplify the FIFO read/drain loop and derive the read-side limits from each revision's FIFO size. - Add burst-read support using threshold interrupts, allowing reads of arbitrary size by draining the FIFO incrementally during the transfer. Also add overflow and underflow IRQ reporting, as queue/fifo limits are now derived from the hardware capabilities and exercised more aggressively. The first two patches are independent fixes for pre-existing runtime PM problems in probe and remove, found while reviewing this series. Unbounded writes, which refill the command queue while the transfer is still in flight and so lift the queue-depth limit on the write side, build on this series and will be posted separately. Reads up to 4 KiB and writes up to the full command queue depth (451 bytes on this part) were exercised on an imx219 behind CCI v1.8 (128-word queue, 400 kHz). Signed-off-by: Loic Poulain --- Changes in v5: - Detect the hardware capabilities before requesting the interrupt, cci_isr() dereferences cci->data and can run as soon as the handler is registered (Sashiko) - Burst write: give a transfer its own 500 ms timeout, the fixed 100 ms budget is shorter than the ~337 ms of wire time a maximum-size burst needs at 100 kHz (Sashiko) - Burst read: strobe CCI_IRQ_GLOBAL_CLEAR_CMD after staging the clear of a stale threshold event, the clear never took effect without it (Sashiko) - Burst read: extend the spinlock to the whole interrupt acknowledge sequence, which both masters share, and mask the one-shot threshold from the handler itself rather than from a second clear and strobe (Sashiko) - Burst read: ignore the status bits that latched while masked (Sashiko) - Burst read: latch the fifo depth on the first init only, re-deriving the threshold from the register on every runtime resume kept halving it (Sashiko) - Burst read: do not wait when the fifo already holds words, a threshold crossed while the previous round was draining is discarded by the re-arm and would otherwise stall until the fifo fills up (Sashiko) - Burst read: wait for an in-flight reset on the error exit, so a pending RST_DONE_ACK cannot complete the following transfer (Sashiko) - Burst read: bound the drain loop by the remaining word count as well (Sashiko) - Link to v4: https://lore.kernel.org/r/20261109-cci-imp-v4-0-4dc4095dd052@oss.qualcomm.com Changes in v4: - Reject an oversized write with -EINVAL instead of -EOPNOTSUPP (Konrad) - Burst read: terminate the drain loop on RD_DONE instead of on the expected byte count, so the transfer is never left in flight when the last bytes arrive on a threshold interrupt (Konrad) - Burst read: restore the short-read sanity check that was dropped, now comparing bytes read against bytes expected so it covers the threshold and the legacy path alike (Konrad) - Burst read: disable the RD_THRESHOLD interrupt on the error exits as well, not only on completion (Konrad) - Burst read: bound the fifo drain loop by the expected word count, so a bogus hardware fifo level cannot turn it into an unbounded loop - Link to v3: https://lore.kernel.org/r/20261016-cci-imp-v3-0-5ee7ec1ea1a1@oss.qualcomm.com Changes in v3: - Reject a write longer than the advertised limit with an error rather than ignoring it. (Bryan) - Build the command words with FIELD_PREP() instead of open-coded shifts, which also documents the per-opcode field widths (Konrad) - Actually program CCI_IRQ_MASK_1, the RD_PAUSE bits were being ORed into the value written to CCI_IRQ_MASK_0 and so never took effect - Clear the per-transfer status on entry and stop reinitialising the completion in the read drain loop, as RD_DONE can fire while the fifo is being drained - Link to v2: https://lore.kernel.org/r/20261013-cci-imp-v2-0-6873326b44a3@oss.qualcomm.com Changes in v2: - Split the HALT_ACK reset fix out into its own patch (Andi) - Fix a typo in the "Detect capabilities from CCI_HW_VERSION" commit message (Andi) - Use GENMASK()/FIELD_GET() to decode the CCI_HW_VERSION fields (Konrad) - Derive the number of masters from the DT i2c-bus subnodes instead of encoding it per compatible string (Konrad) - Add burst read support via RD_THRESHOLD/RD_PAUSE IRQs - Link to v1: https://lore.kernel.org/r/20261004-cci-imp-v1-0-227d12cb4829@oss.qualcomm.com --- Loic Poulain (7): i2c: qcom-cci: Factor out write command queue programming i2c: qcom-cci: Handle and report queue overflow/underflow interrupts i2c: qcom-cci: Detect capabilities from CCI_HW_VERSION at runtime i2c: qcom-cci: Add burst write support i2c: qcom-cci: Extend i2c read limits based on CCI revision i2c: qcom-cci: Add burst read support i2c: qcom-cci: Build command words with FIELD_PREP() drivers/i2c/busses/i2c-qcom-cci.c | 526 +++++++++++++++++++++++++++++--------- 1 file changed, 410 insertions(+), 116 deletions(-) --- base-commit: ffe586343a3a012b3b4f3306e6f6de30f5bc5467 change-id: 20260929-cci-imp-8ba384309942 Best regards, -- Loic Poulain