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=1796035033; b=itgZK80HHezQlLN9rttDw0br8lLZFtBni6b8S8nuLRThgotLlBBPJXkdiw/BALEPPTj4 faNlstdpRSVVhu3x+rttvF8iwt+ZZ/qUzrp7/cJC4UQc08AAlPSi4jePYuDMhQjze1MiJ QwVdM1PGPEvcgGKkgL4I//6tB1jGhf+F/c1255gTeBNxWStAAppcKLWtwAj9/Da9Lwiau /cJ5TaGdHe4PNa6rPeEvAtr0O89h0DSxR//eawpJgej70UGYxz9bhRz3T78Lr+Lx8k9bt iHW3L2IXORIZRHHu5j3aVMN4gt4aBG5voK1epxzqiDv2wnWBPKgxcD7h2kEzXodhvIw== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796035033; 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-Proofpoint-ORIG-GUID:X-Proofpoint-Spam-Info:X-Proofpoint-GUID: X-Authority-Analysis:X-Proofpoint-Spam-Details-Enc: X-Proofpoint-Virus-Version:X-Proofpoint-Spam-Details; bh=cwQqlvGFTcwdYx8qpqztpPmc8xfOMzWHPn20xqJOYqQ=; b=y9gARbGezNLjvvzDoNGOdAr0d5abw6Quz2RtJqQHewIn3OdjgbI31tCOOn1N498GuWZ/ f2N8jwiXpN2JfbY7SxSVvhqKXtzEFdUGcxbi0xRwguUv6UElaJSHaMI55+Xil7jHL8ONo lPr7LrOnTKjYAKonzTxQ+PX/R0J4coTgRJVJenm7MgDgGJpm/OsJUvs87jIj9XiI8/aWi lztvO0z7K/8Id9Cv0rZXY7Z1gMuqOuxaby0kA/mbVB1hgUqQU/AEb/4Mv83/JBBnVUSTP nF0WRA13EavLsb/VM5wD8zSvUK8IhS/Ue1w+OEKjqdFwLDI79AuwJcIxM7hicR86CJQ== 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.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 77750606A325 for ; Mon, 30 Nov 2026 10:37:12 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 77750606A325 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 (m0279868.ppops.net [127.0.0.1]) by mx0a-0031df01.pphosted.com (8.18.1.11/8.18.1.11) with ESMTP id 6AU9V1lB2004107 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-f198.google.com (mail-qk1-f198.google.com [209.85.222.198]) by mx0a-0031df01.pphosted.com (PPS) with ESMTPS id 4j9477gw2q-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-f198.google.com with SMTP id af79cd13be357-93f26dd2165so2498883785a.3 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=18iY5zYq63a5qac+o8tz9RZywhcvWjvbcECR/Q+KsjJ0AxRruz/TvpdXC8RbDObOdZ ch91KPmzOFJHOKvJ3evv8q2q/s6LHtfVlxE82jviB/9vRuiF89icXGdApKOIlunG5Ul/ kMhiib0OoUsjZG+oj02KxRgDClC389b2X6V/OOdlG9N1j9Evb/axDNpNETEOyno0lN6u gU6Osd21Z+8kKlLUEIxi1/6GJeDIBzYViPUUCxkSWbi7wsvWA49KUqac9RS6wcnQr8uk mT5fg4Zp8ToiN5eGbKJhKPtBj/4DOpUmNVjWRzJbsaN5oJTfl0Ipw5Xzz6kTsUjkjrS4 rvMw== X-Forwarded-Encrypted: i=1; AL+hErE+FwQ4jCdpllt240kkPE4ycoIxCFXiuDlfSrxDL8SPUCdaldOzJMU1kE1yRWWUQU1VYtVKFAb2ZZEtqvc=@vger.kernel.org X-Gm-Message-State: APuU4Z+2WHhAJa5xIE2YMlk4ddj5jVRBnl64EHQ66SuxnCgku5rlZLBp LOenSiYRJpJmK5FqvJV+cBPW8+uolIBzX5Rqs7l3NghtYWQsuXw6jeHAB4+5XtkRa+QWsk3Yw0z Xa+HcC4uPKtqInEdn5ECk5sI523GV7wRjY/FZ7BGtrKyBgYoSDl1AWpAT0YigQYsHZk0= X-Gm-Gg: AZFdTZd4A97RQlvFX+xfVFjSwlLoOdARnsP8pQRdFCSA9ot4Ffe/zHFnx29n3Pbhf83 RtNe1fZX5pevnFHO/yQz9lSyR+WR28AbO3qI4dHr6BN2a1LuiAS/lqQmYysybd/6cIFasZM8rIs aNUhmIWSLs9S/vO6aJRAQcmxY5UVyTxT5Ahv8VsZO/+WYDnEBUhtcAJO58cYAyC7czhPf5LMxHJ gfyY9aeq5ZRgWiUOqvK81PXsoPEBgiAe7nv4HrdOgYg9i0k0LVNKKCqZ3gogPPQThFbAVPXqnC0 ktUCIzXrTZh9nCTRyRnmDqMsAdOLpqpamvrRSKnbFOqQunRAdwE/QnI/0KTDZcRT38SbsEsiqfF wjYQINcHyM0jz5QhU3POoAZkOajHluyEkfP1Ijli6KRhDEiiqXEBo7kWMxJEERPNP7DxfsLyT+O VyxL0A77ButNi7xzp96LmT6ntvih3x5qUM1JYFrr7MqJZuz3GP5ALjrSLblAEX1/bMsWMBuz1mA PCWznERxA4DxqHN4e8LiaynLfFI X-Received: by 2002:a05:620a:4408:b0:949:9cf0:bae5 with SMTP id af79cd13be357-949bab3d2f2mr6075476985a.69.1796035030441; 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-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=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-Proofpoint-ORIG-GUID: Eym7Md_zPcKW_weHlxI3lv5_glQsTwNf X-Proofpoint-Spam-Info: AW1haW4tMjYxMTMwMDA0MiBTYWx0ZWRfX12VckZ3xlg+8 /HK/zLc6xSZkEZUS07WTclFODVkHcZx8wTxZlUyy109O/GVijt0+nA+cRksdpFMYpSHDDtsT5RW QaehxWKZnaCqF3WqqwwTOOXAIfUcXvo= X-Proofpoint-GUID: Eym7Md_zPcKW_weHlxI3lv5_glQsTwNf X-Authority-Analysis: v=2.4 cv=CN6/zhrD c=1 sm=1 tr=0 ts=6b0d51d7 cx=c_pps a=qKBjSQ1v91RyAK45QCPf5w==:117 a=xqWC_Br6kY4A:10 a=IkcTkHD0fZMA:10 a=zJRp6_cAMcgA:10 a=s4-Qcg_JpJYA:10 a=VkNPw1HP01LnGYTKEx00:22 a=u7WPNUs3qKkmUXheDGA7:22 a=ZpdpYltYx_vBUK5n70dp:22 a=VwQbUJbxAAAA:8 a=EUspDBNiAAAA:8 a=GJYhxYVrF0PQDnaCLTQA:9 a=QEXdDO2ut3YA:10 a=NFOGd7dJGGMPyQGDc5-O:22 X-Proofpoint-Spam-Details-Enc: AW1haW4tMjYxMTMwMDA0MiBTYWx0ZWRfXzZbR8Q6ROwWf ob5f/J4QdgTg/k2taHnAIavSRO2cmdhGFIp7rh/u6OdKw28jKqTZEuqn+zZxeJ9k3+AEfMDvrPD Of4mdDqkX/LWpAU2jjxE9cCfPuyKaoyA60ndKIq/NWgIZv6WsbHZA1mL6gRdxqn72Okm7PgRye1 giDcaX/JgRZmJ/a5XUAm1mOHpSxp6kYbb83wpRMZUxS6+bfuBp6kHWae15GmxxwNJtTTxX5dy94 VYZkOqaEdVY1fDMykPEfZVZqEhSMtVkAeam+1bzW3cQD9igaF/TDkkwaL3LfkdF1seR9W9uipxG SW/bTHDjJe7xEKlGi+NGFsmLzJmqjLkxTZr4BNo2T3F7LsTbFKPFmnPlI1Klr7CbjMv5+yE75Cm R9l0DVG90yn/2gKqIfG29ipkZkOm1FDHsDLFy1NtHN240LUTEGkD0o+A/no95/9xGFOXYUUGAz3 DGh2fFAJpTG8yORx0yw== 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 bulkscore=0 impostorscore=0 priorityscore=1501 spamscore=0 malwarescore=0 clxscore=1015 suspectscore=0 phishscore=0 adultscore=0 lowpriorityscore=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