From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=205.220.180.131 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796379586; b=mUk1Wn8J+Cjt1zsrXS7Ea2kFzjYbAuw+0s2N2z9nOgWyfJowgtZwykpeT0QEnqCCn0uH i1O9NQZK/+HoptLKSAtN9VFDdlU4UcvpMsI+OS6NTOu/MCJSWcJN1RSazgC/DFesMtV3d Izrsdxk3wUSp8XfMK4k0JM8tLIeuhfmweBvyuxk5WCMjAkIiEZOuuJk9FD99U9IvM/XNR 2MTgbPuKc1jTBSA0uHzfwVyMcLyT1KFX0Xr+laz+ktkMjtS+A0YoeDopjAZEpRTiWPkDH 5MGctRmM4H1SYmii6gNPyC4Auwre7cb3WoNi2h7rLBW4O8qXKweRI6T0hBigcDO1xPQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796379586; 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-Spam-Info: X-Proofpoint-Spam-Details-Enc:X-Proofpoint-GUID: X-Proofpoint-ORIG-GUID:X-Proofpoint-Virus-Version: X-Proofpoint-Spam-Details; bh=d1yDaxbmNFgmXcmXs/ekV6Xwd9/bIXrYtqRODqgbQKU=; b=IgkP8UmhqlI98MmJ88IaT/ECfwlxe/SVTr0G6FzLisb2mg5jczE/SAtQcfv5q5Zga5d1 xxIqODciRvc8K4OhCOahul1TCJhzTT6Uu4Hm7AJOj1c10VYVUcmR4/C3yHg8umQYRv1/E fS+HcDJsiGz9kbzU15zfFt6X5kNRALVsYUZGRb8Lj/HjAzbp0fMdWfI4jYtmB2RpLAOc+ VuXJo+Iujinwkb3OfWnFVEGleGMM5LYBapeJae49dB5cohEQ/rKJBMf8NYSvVmpCsRaCP Si7GyLmqaBLUbCXSwTMGvdDhoI5vEzm3JvEKirUBmIFJs1xyFXdMHa0rPYdo1rWEFbw== 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=oyt+dtpv; dkim=pass header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=ZosPZftB; arc=none smtp.remote-ip=205.220.180.131 Received: from mx0b-0031df01.pphosted.com (mx0b-0031df01.pphosted.com [205.220.180.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 C4B70606A322 for ; Fri, 4 Dec 2026 10:19:45 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org C4B70606A322 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=oyt+dtpv; dkim=pass (2048-bit key) header.d=oss.qualcomm.com header.i=@oss.qualcomm.com header.a=rsa-sha256 header.s=google header.b=ZosPZftB Received: from pps.filterd (m0279870.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6B45HKof2077134 for ; Fri, 4 Dec 2026 10:19:44 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=d1yDaxbmNFgmXcmXs/ekV6 Xwd9/bIXrYtqRODqgbQKU=; b=oyt+dtpvUTSIeD1Wt8VfXPvzkrg/2zeoCbwEjh tboWOKNsU+JPG+oWS1ucHs+EM6B34v+e6q8wCoNw0vmF+KY4HMNz+dJm8ZJ687b9 Ows74Os27/fxM//Ng4oakBlFvK4tKLmF0U7JrGdpJ1YjrBCBcfKR5pDJ/AA05Opf arWNa6ux4V0oqNGGrJ7pbkOK0CuC/bwkrivpyNNtwYIbOIqCg9CCFDQnSxVhoox3 lBjc+J2Ui6oZWiFBBWOF6jiYOq40svQpgNLq8cTa30OuvIM08ddsbwlDexx5PT4U MN7kr9+I14zfVPGRmc+Ct57gkhalNfo+U4C+9spvy6Vh5dxg== Received: from mail-qv1-f69.google.com (mail-qv1-f69.google.com [209.85.219.69]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4jbq7qgwr8-1 (version=TLSv1.3 cipher=TLS_AES_128_GCM_SHA256 bits=128 verify=NOT) for ; Fri, 04 Dec 2026 10:19:44 +0000 (GMT) Received: by mail-qv1-f69.google.com with SMTP id 6a1803df08f44-92134f1eb00so12079856d6.0 for ; Fri, 04 Dec 2026 02:19:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=oss.qualcomm.com; s=google; t=1796379584; x=1796984384; 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=d1yDaxbmNFgmXcmXs/ekV6Xwd9/bIXrYtqRODqgbQKU=; b=ZosPZftBPyME3mlG+roCkbEFvGXBTEVR4+ukvvPCQ78K8LFJBhnpyQKnlK6NGVxMth YM2pyhf8hsq2x0vsE6i/ZPr0miWP1T6cY0MsTv0oqVjyQi7iMpKT2whFPUu62xWml7yt 8jsOMH64dk9AIaIJc2q+wiZoUCyKDXfZOgPGrD6XlyiZU9CaFOV5gdxZ2MYaO4lVD9LR JYVbYw3kgQT5AL3wZr5ToegyQtw31xWZk7dpUoNGPu+GHKlapZUDxtCi+6j11h7VPZCl i8BivkWNiBhkJjJXMKAYAcWJPMUBhCfb83o5rxMTanjbGQz8oWD/15xdEPwNzXf2WR3h OJ7A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20260707; t=1796379584; x=1796984384; 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=d1yDaxbmNFgmXcmXs/ekV6Xwd9/bIXrYtqRODqgbQKU=; b=wP/xO2bEwm/pChprd1apoOFE80nA36HauRoOnBUwaZB4yLppOhWgEr9HzTPtCCiGYV F9BJ8SybjlNluiBEd9XLTGWCrRw5OWF+jKMJ8EUZIGzeBwpTXjxbvtwxo1K+o4283pRV fys26mxAz+5j3/Ra4oxKWV5MBs2+uKcYTh0Kk57q04q1p2L6vlkz0uzU7R2vUbF9x+gJ CKnIyr05hTI9322P0YVu8Boh6PSRnGhlFQiAo+q0MFiWSlcp4eLgRgVnt6FLFL40VwQj Dl9br9NcM2edOTsmP64eBOVt9VngCJC/L8dcG9p554Nn6lb7N0XAdA+VFVjree0FtPPH 7DlA== X-Forwarded-Encrypted: i=1; AL+hErE7B4prEKGLFMiEqNeEXbZtYmef9HeOd4sUjxZJ264BsjsHC4Jwg+AthoyxdIyw/LYFyGVkZLquEVpw2Rs=@vger.kernel.org X-Gm-Message-State: APuU4Z/oLo5NUPPfv9W7swqleGu8p0KiHGo1VVFUTt05ZeuMOFl0mjAO zJZFICB62z6SK5AOy3yEN+HU1M3L2OAcC3QBEuOdcOT5im3VzbS8+p1HxXGImzta79t3WmbtBGx bKHYtSN/yQX5AMJKzXcyWpjsI2GuWqfRHw4q5Ld1amWnwVtE3egMTuN3mK8iksSWkud8= X-Gm-Gg: AZFdTZc2ELo500dgd3Xl80MEYzVsAsqEhhlswq/8pKh8PpXZi91OrSGTmz3lD6gS5NY ZTSVMAvvsxTMYBdoc2bUzT4CQVCaOMql5Xz/10F0x7hv3AmApxipQwDZM8JukJcfZagPhU1DhpP 5F581+Auwh5+0BIMLD5gI45PIe5+Qjp/SUQuI4srfD3+E/K+oIrVwaBscDW9O+GQ2Umz4Kjo9hA 0Hk6UCqoP/tKeM4E9si/exzdH0R2x/rgysq7/B6ELW9KgRdchfEErQy7mBm8em837KQ4AHYEYVg 6I8rSfp//bd9NvITqNMnZ2nOd2Jf5P7NNE8y1ESe4o9pomGT7OBZIgxI3PgPPdWAeYTUn3C0Q1L Hv6mBPYWzMiUrGZYWakFneitWPErqj7YcJURWqSJ6tj/+jFaRe/yxVVcK7s6UWhkg/nGSyWc28e 2hzGm+EVVNVIt68I3WLPTsV4if2ffUERPuigDBTEz67j/DvhXgi1EetZJo/duw8/C0/WccXtako fQUl159aDtnu0fMmeet+5Sm3JTI X-Received: by 2002:a05:620a:489a:b0:93e:592d:f5a2 with SMTP id af79cd13be357-94a8267e32fmr211866285a.11.1796379583698; Fri, 04 Dec 2026 02:19:43 -0800 (PST) X-Received: by 2002:a05:620a:489a:b0:93e:592d:f5a2 with SMTP id af79cd13be357-94a8267e32fmr211863685a.11.1796379583169; Fri, 04 Dec 2026 02:19:43 -0800 (PST) Received: from QCOM-eG0v1AUPpu.na.qualcomm.com ([2a01:e0a:830:450:2022:3328:5af7:2b49]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4bbea2886f6sm48049005e9.8.2026.12.04.02.19.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 04 Dec 2026 02:19:42 -0800 (PST) From: Loic Poulain Subject: [PATCH v6 0/7] i2c: qcom-cci: Runtime capability detection and improved read/write Date: Fri, 04 Dec 2026 11:19:39 +0100 Message-Id: <20261204-cci-imp-v6-0-bed67559c66a@oss.qualcomm.com> X-Mailing-List: linux-kernel@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=H4sIALuTEmsC/3XQTW7DIBAF4KtErEvEDD82WfUeVRcYJg1SHSeQo FaR717iSsWLejPSG/G9kXiwTClSZofdgyUqMcfpXIN52TF/cucP4jHUzFCgERYt9z7yOF54Pzj ZKymsVcjq60uiY/xamt7ef3Oi670W3tryFPNtSt/LtQLP7VIMQqi/4gJccMQuAPpB9Whfp5z31 7v79NM47utgz6qCKw6ycazc9J2UaAalnNzgcs1N47JyTdSRB3LgYIOrxkG0XymqchW8ElaHIDR ucL3iUjSuKw/ofG/hiIM3//B5nn8AJBIUV7YBAAA= 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=Cpsq4X4D c=1 sm=1 tr=0 ts=6b1293c0 cx=c_pps a=wEM5vcRIz55oU/E2lInRtA==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=pUM-KoujPXoA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=gowsoOTTUOVcmtlkKump:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=iW-xQxGQBiPoasdNFrQA:9 a=QEXdDO2ut3YA:10 a=OIgjcC2v60KrkQgK7BGD:22 X-Proofpoint-Spam-Info: AW1haW4tMjYxMjA0MDA0MCBTYWx0ZWRfXzATyVOuftfA8 6nwOF5yAnFLZMkVNgKniBZNZiGS1swoF4NitQHWDADFBV054W1LpssKvyR4JMuf0RXPxaDL3yP9 pvH4F/Al+jA+4SZUbweR79Wh/CE0rD4= X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMjA0MDA0MCBTYWx0ZWRfX87qWss9OSw4G 7UyG1Os29gdgXrsKNnji0wcWzF6CS9ZH9IusYcRj4t7g3/T4g5Yic7Ng8friIbCYzy2zhEYrjpU /gfSy2QOpjE/ohNSotnVKdR/sYNzo/TSQtg6hCFtsGDEJzm0EkarDcJoVexIcpqM5U7Gnl+QvlM w2jxgT6pX12FcfTBzZhoMK3w+pKWg3SSXugCW4QWtXUwOaX+kRrndxLmIaIwM6WfnDm1p2PTHYx /C8SZ6KJZQWxLeA8mp7cMmM/Ji6XYUYGPJhG0ygLm4Hz1/J7kXWIehuJ9rArEGtrZa7A7CoHPHK Cj3JQBMFr19AiKpBXwCLe7j19NGy/NoCAFqaT2rmJnvW3wma51V9P1tt7QVpwJ2TXU8AqFUUgQP 8O8oXi9Kr8/DO+U5bpnmpS2lwvGIAP9opEVbCV3324vo9T3l6iSHtMCsW8cvvwJ8bW4c9Z3N+k9 vJWT6iSG4izi2RcZZKA== X-Proofpoint-GUID: 5EPV1KrJfZhl_B1u8e2TIjxu8Kez9ef7 X-Proofpoint-ORIG-GUID: 5EPV1KrJfZhl_B1u8e2TIjxu8Kez9ef7 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-12-04_01,2026-12-03_04,2025-10-01_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 bulkscore=0 suspectscore=0 priorityscore=1501 spamscore=0 phishscore=0 malwarescore=0 adultscore=0 clxscore=1015 impostorscore=0 lowpriorityscore=0 classifier=typeunknown authscore=0 authtc= authcc= route=outbound adjust=0 reason=mlx scancount=1 engine=8.22.0-2611040001 definitions=main-2612040040 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. 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 v6: - Rebase onto i2c/i2c-next, the patches themselves are unchanged. v5 was generated on top of two local runtime PM fixes that were not posted, so its base-commit could not be resolved and 3/7 did not apply (Konrad) - Link to v5: https://lore.kernel.org/r/20261130-cci-imp-v5-0-d2ac891f2bc6@oss.qualcomm.com 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: 289279370eae1cc84a77c2fd508482b09f17b480 change-id: 20260929-cci-imp-8ba384309942 Best regards, -- Loic Poulain