summaryrefslogtreecommitdiff
path: root/drivers/i2c/busses
AgeCommit message (Collapse)Author
7 daysi2c: mediatek: fix WRRD for SoCs without auto_restart optionRoman Vivchar
MediaTek mt65xx family SoCs have no auto restart, however, they still support the WRRD mode in the hardware. Because auto_restart is set to 0, the WRRD mode will be never enabled, leading to read errors. Fix this by removing auto_restart check from the WRRD enable path. Fixes: b49218365280 ("i2c: mediatek: fix potential incorrect use of I2C_MASTER_WRRD") Signed-off-by: Roman Vivchar <rva333@protonmail.com> Cc: <stable@vger.kernel.org> # v6.18+ Reviewed-by: AngeloGioacchino Del Regno <angelogioacchino.delregno@collabora.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260709-6572-6595-i2c-v2-1-b2fb8510d1d3@protonmail.com
7 daysi2c: mlxbf: Fix use-after-free in mlxbf_i2c_init_resource()Xuanqiang Luo
If devm_platform_get_and_ioremap_resource() returns an error, mlxbf_i2c_init_resource() frees tmp_res before reading tmp_res->io to get the error code. This results in a use-after-free. Save the error code before freeing tmp_res. Fixes: b5b5b32081cd ("i2c: mlxbf: I2C SMBus driver for Mellanox BlueField SoC") Signed-off-by: Xuanqiang Luo <luoxuanqiang@kylinos.cn> Cc: <stable@vger.kernel.org> # v5.10+ Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260714150808.85045-1-xuanqiang.luo@linux.dev
7 daysi2c: spacemit: fix spurious IRQ handling returning IRQ_HANDLEDPei Xiao
When the interrupt status register reads zero, the handler should return IRQ_NONE instead of IRQ_HANDLED. What the return value actually feeds into is the spurious interrupt accounting in note_interrupt(): falsely claiming IRQ_HANDLED defeats the "irq XX: nobody cared" detection, so a stuck interrupt source would never be caught. Fixes: 5ea558473fa3 ("i2c: spacemit: add support for SpacemiT K1 SoC") Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn> Cc: <stable@vger.kernel.org> # v6.15+ Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com> Reviewed-by: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/ef8b623f45d4e430721e46572c2598d882044aed.1783667875.git.xiaopei01@kylinos.cn
7 daysi2c: imx: fix locked bus on SMBus block-read of 0 (IRQ)Vincent Jardin
SMBus 3.1 6.5.7 allows a Block Read byte count of 0, but the interrupt-driven block-read state machine rejects it as -EPROTO. Worse, it returns without a NACK+STOP: the next receive cycle has already started, so the target keeps holding SDA and the bus stays stuck until a power cycle of this i2c controller. Accept count=0: NACK the in-flight dummy byte (TXAK) and set msg->len to 2 so i2c_imx_isr_read_continue() emits STOP via its normal last-byte path. The dummy byte is discarded; block-read callers only consume buf[0..count-1]. Reading I2DR has likewise already armed the next byte on the count > I2C_SMBUS_BLOCK_MAX error path, so NACK it (TXAK) before aborting with -EPROTO; otherwise the failing transfer's STOP cannot complete and the bus stays held. The atomic path regressed earlier (v3.16) and is fixed separately; this patch covers only the v6.13 state-machine rework. Fixes: 5f5c2d4579ca ("i2c: imx: prevent rescheduling in non dma mode") Signed-off-by: Vincent Jardin <vjardin@free.fr> Cc: <stable@vger.kernel.org> # v6.13+ Acked-by: Oleksij Rempel <o.rempel@pengutronix.de> Acked-by: Carlos Song <carlos.song@nxp.com> Reviewed-by: Stefan Eichenberger <eichest@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260713-for-upstream-i2c-lx2160-fix-v1-v3-2-073ac9e103a5@free.fr
7 daysi2c: imx: fix locked bus on SMBus block-read of 0 (atomic)Vincent Jardin
SMBus 3.1 6.5.7 allows a Block Read byte count of 0, but the atomic (polling) path rejects it as -EPROTO. Worse, it returns without a NACK+STOP: the next receive cycle has already started, so the target keeps holding SDA and the bus stays stuck until a power cycle for this i2c controller. Reading I2DR to obtain the count likewise arms the next byte on the count > I2C_SMBUS_BLOCK_MAX path, which also returned -EPROTO directly and left the bus held. Handle both: NACK the in-flight dummy byte (TXAK) and extend msgs->len so the existing last-byte handling emits STOP; the dummy byte is discarded. A count of 0 is a valid empty block read; a count above I2C_SMBUS_BLOCK_MAX is still reported as -EPROTO, but only after the bus has been released. The interrupt-driven path has the same flaw from a later commit and is fixed separately, as it carries a different Fixes: tag and stable range. Fixes: 8e8782c71595 ("i2c: imx: add SMBus block read support") Signed-off-by: Vincent Jardin <vjardin@free.fr> Cc: <stable@vger.kernel.org> # v3.16+ Acked-by: Oleksij Rempel <o.rempel@pengutronix.de> Acked-by: Carlos Song <carlos.song@nxp.com> Reviewed-by: Stefan Eichenberger <eichest@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260713-for-upstream-i2c-lx2160-fix-v1-v3-1-073ac9e103a5@free.fr
2026-07-03Replace <linux/mod_devicetable.h> by more specific <linux/device-id/*.h> (c ↵Uwe Kleine-König (The Capable Hub)
files) Replace the #include of <linux/mod_devicetable.h> by the more specific <linux/device-id/*.h> where applicable. For most cases the include can be dropped completely, only a few drivers need one or two headers added. Acked-by: Danilo Krummrich <dakr@kernel.org> Acked-by: Takashi Sakamoto <o-takashi@sakamocchi.jp> Acked-by: Bjorn Helgaas <bhelgaas@google.com> Link: https://patch.msgid.link/1a3f2007c5c5dcf555c09a4035ce3ae8ef1b6c49.1782808461.git.u.kleine-koenig@baylibre.com Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com>
2026-06-23i2c: i801: fix hardware state machine corruption in error pathMingyu Wang
A severe livelock and subsequent Hung Task panic were observed in the i2c-i801 driver during concurrent Fuzzing. The crash is caused by an unconditional hardware register cleanup in the error handling path of i801_access(). When i801_check_pre() fails (e.g., returning -EBUSY because the SMBus controller is actively used by BIOS/ACPI), the kernel does not actually acquire the hardware ownership. However, the code jumps to the 'out' label and executes: iowrite8(SMBHSTSTS_INUSE_STS | STATUS_FLAGS, SMBHSTSTS(priv)); This forcefully clears the INUSE_STS lock and resets the hardware status flags without owning the controller. Doing so interrupts ongoing BIOS/ACPI transactions and totally corrupts the SMBus hardware state machine. Consequently, all subsequent i801_access() calls fail at the pre-check stage, triggering an endless stream of "SMBus is busy, can't use it!" error logs. Over a slow serial console, this printk flood monopolizes the CPU (Console Livelock), starving other processes trying to acquire the mmap_lock down_read semaphore, ultimately triggering the hung task watchdog. Fix this by moving the 'out' label below the hardware register cleanup. If i801_check_pre() fails, we safely bypass the iowrite8() and only release the software locks (pm_runtime and mutex), strictly adhering to the rule of not releasing resources that were never acquired. Fixes: 1f760b87e54c ("i2c: i801: Call i801_check_pre() from i801_access()") Signed-off-by: Mingyu Wang <25181214217@stu.xidian.edu.cn> Cc: <stable@vger.kernel.org> # v6.3+ Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260512093534.348655-1-w15303746062@163.com
2026-06-23i2c: mpc: Fix timeout calculationsAndy Shevchenko
At first glance the harmless cleanup of the driver does nothing bad. However, as the operator precedence list states the '*' (multiplication) and '/' division operators have order 5 with left-to-right associativity the *= has order 17 and associativity right-to-left. It wouldn't be a problem to replace foo = foo * HZ / 1000000; with foo *= HZ / 1000000; if HZ constant is in Hertz. The problem is that in the Linux kernel HZ is defined in jiffy units, which is order of magnitude smaller than a million. That's why operator precedence has a crucial role here. Fix the regression by reverting pre-optimized calculations. Fixes: be40a3ae719f ("i2c: mpc: Use of_property_read_u32 instead of of_get_property") Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Cc: <stable@vger.kernel.org> # v6.4+ Reviewed-by: Chris Packham <chris.packham@alliedtelesis.co.nz> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260618144934.3249950-1-andriy.shevchenko@linux.intel.com
2026-06-18i2c: pxa: Use named initializers for the platform_device_id arrayUwe Kleine-König (The Capable Hub)
Named initializers are better readable and more robust to changes of the struct definition. This robustness is relevant for a planned change to struct platform_device_id replacing .driver_data by an anonymous union. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/827657abb02edb39bc90f7336194f614d383770e.1781688767.git.u.kleine-koenig@baylibre.com
2026-06-17i2c: imx-lpi2c: mark I2C adapter when hardware is powered downCarlos Song
On some i.MX platforms, certain I2C client drivers keep a periodic workqueue which continues to trigger I2C transfers. During system suspend/resume, there exists a time window between: - suspend_noirq and the system entering suspend - the system starting to resume and resume_noirq In this window, the I2C controller resources such as clock and pinctrl may already be disabled or not yet restored. If a workqueue triggers an I2C transfer in this period, the driver attempts to access I2C registers while the hardware resources are unavailable, which may lead to system hang. Mark the I2C adapter as suspended during noirq suspend and block new transfers until resume, ensuring that I2C transfers are only issued when hardware resources are available. Fixes: 1ee867e465c1 ("i2c: imx-lpi2c: add target mode support") Signed-off-by: Carlos Song <carlos.song@nxp.com> Cc: <stable@vger.kernel.org> # v6.14+ Acked-by: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260525031450.3183421-1-carlos.song@oss.nxp.com
2026-06-17i2c: stm32f7: truncate clock period instead of rounding itGuillermo Rodríguez
stm32f7_i2c_compute_timing() derives the I2C clock source period (i2cclk) with DIV_ROUND_CLOSEST, which may round it up. When the period is overestimated, all timings computed from it (SCLDEL, SDADEL, SCLL, SCLH) come out shorter on the wire than calculated, and the resulting bus rate can exceed the requested speed, violating the I2C specification minimums for tLOW and tHIGH. For example, with a 104.45 MHz clock source (e.g. PCLK1, the reset-default I2C clock source on STM32MP1), i2cclk is rounded from 9.574 ns up to 10 ns. Requesting a 400 kHz fast mode bus with 72/27 ns rise/fall times and no analog/digital filters then produces an actual bus rate of 415.6 kHz with tLOW = 1254 ns, violating both the 400 kHz maximum rate and the 1300 ns tLOW minimum of the specification. Truncate the period instead, so that it can only be underestimated. The error then falls on the safe side: the programmed timings come out slightly longer than computed and the bus runs marginally below the target rate (375.3 kHz in the example above) while meeting the specification. i2cbus is left rounded-to-closest: it is only used as the target of the clk_error comparison and is never multiplied into the programmed timings, so nearest rounding remains accurate there. Fixes: aeb068c57214 ("i2c: i2c-stm32f7: add driver") Signed-off-by: Guillermo Rodríguez <guille.rodriguez@gmail.com> Cc: <stable@vger.kernel.org> # v4.14+ Acked-by: Alain Volmat <alain.volmat@foss.st.com> Reviewed-by: Pierre-Yves MORDRET <pierre-yves.mordret@foss.st.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260611104857.242153-1-guille.rodriguez@gmail.com
2026-06-17i2c: qcom: Unify user-visible "Qualcomm" nameKrzysztof Kozlowski
Various names for Qualcomm as a company are used in user-visible config options: QCOM, Qualcomm and Qualcomm Technologies. Switch to unified "Qualcomm" so it will be easier for users to identify the options when for example running menuconfig. Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@oss.qualcomm.com> Link: https://lore.kernel.org/r/20260423173550.92317-2-krzysztof.kozlowski@oss.qualcomm.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2026-06-17i2c: ls2x-v2: return IRQ_HANDLED after servicing an errorDavid Carlier
The event ISR reads SR1 and, when an error flag (ARLO/AF/BERR) is set, calls loongson2_i2c_isr_error() which clears the offending flag, issues STOP for the AF case, records msg->result, masks every CR2 interrupt enable and completes the waiter. The handler then returns IRQ_NONE, declaring to the IRQ core that the device did not interrupt. That report is wrong. The device did interrupt and the handler fully serviced it. Because the IRQ is requested with IRQF_SHARED, the genirq spurious-IRQ tracker counts each error as unhandled. A bus that emits sporadic NACKs, arbitration losses or bus errors will therefore march toward the spurious-IRQ threshold and the line can end up disabled, wedging the controller. Return IRQ_HANDLED on this path. The other IRQ_NONE site, taken when neither an event nor an error bit is set, remains correct. Fixes: 6d1b0785f6d5 ("i2c: ls2x-v2: Add driver for Loongson-2K0300 I2C controller") Signed-off-by: David Carlier <devnexen@gmail.com> Assisted-by: Codex:GPT-5.5 Reviewed-by: Binbin Zhou <zhoubinbin@loongson.cn> Tested-by: Binbin Zhou <zhoubinbin@loongson.cn> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260506154015.94815-1-devnexen@gmail.com
2026-06-16i2c: davinci: Unregister cpufreq notifier on probe failureHaoxiang Li
davinci_i2c_probe() registers a cpufreq transition notifier before adding the I2C adapter. If i2c_add_numbered_adapter() fails, the probe error path releases the device resources without unregistering the notifier. Add a dedicated error path to unregister the cpufreq notifier after i2c_add_numbered_adapter() fails. Fixes: 82c0de11b734 ("i2c: davinci: Add cpufreq support") Signed-off-by: Haoxiang Li <haoxiang_li2024@163.com> Cc: <stable@vger.kernel.org> # v2.6.36+ Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260610030513.2651018-1-haoxiang_li2024@163.com
2026-06-16i2c: qcom-cci: Remove overcautious disable_irq() callsVladimir Zapolskiy
In cci_probe() the controller's interrupt is requested using a devres managed API, and in cci_probe() error path and cci_remove() it'd be safe to rely on devres mechanism to free and shutdown the interrupt, thus explicit disable_irq() calls can be removed as unnecessary ones. Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260515234121.1607425-5-vladimir.zapolskiy@linaro.org
2026-06-16i2c: qcom-cci: Move cci_init() under cci_reset() functionVladimir Zapolskiy
On probe or runtime errors cci_reset() is called and it should be coupled with cci_init(), instead of doing this on caller's side, embed cci_init() directly into the cci_reset() function. This is a non-functional change, cci_reset() and cci_init() function bodies are reordered. Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260515234121.1607425-4-vladimir.zapolskiy@linaro.org
2026-06-16i2c: qcom-cci: Do not check return value of cci_init()Vladimir Zapolskiy
The cci_init() function is not supposed to fail, and it never returns a non-zero, so it'd make sense to convert its signature to void. Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com> Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260515234121.1607425-3-vladimir.zapolskiy@linaro.org
2026-06-16Merge tag 'i2c-7.2-part1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux Pull i2c updates from Andi Shyti: "This pull request is mostly made of cleanups and small infrastructure improvements across the I2C core, drivers and bindings. It also adds support for three drivers and a few new compatibles. Two major cleanup across drivers and core code: - use named initializers in device ID tables - replace dev_err() with dev_err_probe() Drivers: - at24: use named initializers for arrays of i2c_device_data - at91: add MCHP_LAN966X_PCI dependency - cadence: add shutdown callback - k1: enable by default on SpacemiT - mxs: improve documentation - qcom-geni: use pm_runtime_force_suspend/resume for system sleep - tegra: - disable fair arbitration on non-MCTP buses - allocate DMA buffers from the correct DMA device - designware: - handle active target shutdown cleanly - add shutdown callbacks for platform and PCI drivers - adopt the new PM_RUNTIME_ACQUIRE() helpers DT bindings: - convert davinci bindings to DT schema Core and muxes: - acpi: report missing I2C resources as -ENOENT - gpiolib: add gpiod_is_single_ended() helper for I2C GPIO users - i2c-mux-reg: add generic firmware node support - a set of 10 patches from Johan Hovold fixing adapter registration races, cleanup paths and resource management issues New support: - DesignWare LECA0003 (ACPI ID) - Loongson LS2K0300 I2C controller (new driver) - Qualcomm CCI Glymur and Shikra compatibles" * tag 'i2c-7.2-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux: (46 commits) i2c: mxs: add missing kernel-doc for struct mxs_i2c_dev members i2c: qcom-geni: Use pm_runtime_force_{suspend,resume} helpers dt-bindings: i2c: qcom-cci: Document Glymur compatible dt-bindings: i2c: qcom-cci: Document Shikra compatible i2c: mux: reg: use device property accessors i2c: acpi: Return -ENOENT when no resources found in i2c_acpi_client_count() i2c: at91: Add MCHP_LAN966X_PCI dependency i2c: eg20t: Consistently define pci_device_ids using named initializers i2c: designware-pcidrv: Consistently define pci_device_ids using named initializers i2c: bcm-kona: fix spelling mistake in timeout-check comment i2c: cadence: Add shutdown handler i2c: tegra: Disable fair arbitration for non-MCTP buses i2c: tegra: use dmaengine_get_dma_device() for DMA buffer allocation i2c: busses: make K1 driver default for SpacemiT platforms i2c: Use named initializers for arrays of i2c_device_data i2c: core: clean up adapter registration error label i2c: core: clean up bus id allocation i2c: core: fix adapter deregistration race i2c: core: fix adapter registration race i2c: core: disable runtime PM on adapter registration failure ...
2026-06-10i2c: mxs: add missing kernel-doc for struct mxs_i2c_dev membersRosen Penev
Add kernel-doc documentation for the struct members that were previously undocumented. This fixes warnings when building with W=1 and ensures the struct is fully documented per kernel-doc conventions. Assisted-by: opencode:big-pickle Signed-off-by: Rosen Penev <rosenp@gmail.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260603031135.289302-1-rosenp@gmail.com
2026-06-09i2c: qcom-geni: Use pm_runtime_force_{suspend,resume} helpersPraveen Talari
The driver carries custom system suspend/resume handling that manually tracks a suspended state and conditionally calls geni_i2c_runtime_suspend() from the noirq suspend path, then adjusts runtime PM state by hand. This duplicates PM core behavior and adds unnecessary complexity. Drop the manual state tracking and switch to pm_runtime_force_suspend() and pm_runtime_force_resume() for system sleep. These helpers already perform the required checks, call the runtime PM callbacks when needed, and keep runtime PM state transitions consistent. Reviewed-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com> Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260520-use_pm_runtime_apis-v1-1-6a5238fc6cb6@oss.qualcomm.com
2026-06-09i2c: at91: Add MCHP_LAN966X_PCI dependencyHerve Codina
The AT91 I2C driver depends on ARCH_MICROCHIP. This I2C controller can be used by the LAN966x PCI device and so it needs to be available when the LAN966x PCI device is enabled. Signed-off-by: Herve Codina <herve.codina@bootlin.com> Acked-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2026-06-09i2c: imx-lpi2c: fix resource leaks switching to devm_dma_request_chan()Carlos Song
The LPI2C driver requests DMA channels using dma_request_chan(), but never releases them in lpi2c_imx_remove(), resulting in DMA channel leaks every time the driver is unloaded. Additionally, when lpi2c_dma_init() successfully requests the TX DMA channel but fails to request the RX DMA channel, the probe falls back to PIO mode and completes successfully. Since probe succeeds, the devres framework will not trigger any cleanup, leaving the TX DMA channel and the memory allocated for the dma structure held for the lifetime of the device even though DMA is never used. Switch to devm_dma_request_chan() to let the device core manage DMA channel lifetime automatically. Wrap all allocations within a devres group so that devres_release_group() can release all partially acquired resources when DMA init fails and probe continues in PIO mode. Fixes: a09c8b3f9047 ("i2c: imx-lpi2c: add eDMA mode support for LPI2C") Signed-off-by: Carlos Song <carlos.song@nxp.com> Cc: <stable@vger.kernel.org> # v6.14+ Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260520093323.2882070-1-carlos.song@oss.nxp.com
2026-06-09i2c: eg20t: Consistently define pci_device_ids using named initializersUwe Kleine-König (The Capable Hub)
The .driver_data member of the struct pci_device_id array were initialized by list expressions. This isn't easily readable if you're not into PCI. Using named initializers is more explicit and thus easier to parse. This change doesn't introduce changes to the compiled pci_device_id arrays. Tested on x86 and arm64. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/41316792102ff2860ec019373293cb07d545a0b0.1779481436.git.u.kleine-koenig@baylibre.com
2026-06-09i2c: designware-pcidrv: Consistently define pci_device_ids using named ↵Uwe Kleine-König (The Capable Hub)
initializers The .driver_data member of the struct pci_device_id array were initialized by list expressions. This isn't easily readable if you're not into PCI. Using named initializers is more explicit and thus easier to parse. This change doesn't introduce changes to the compiled pci_device_id array. Tested on x86 and arm64. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/68667c4ab85716b190d8b705813b610e21a386f6.1779481436.git.u.kleine-koenig@baylibre.com
2026-06-09i2c: bcm-kona: fix spelling mistake in timeout-check commentStepan Ionichev
Fix a spelling mistake in the timeout-check comment. No functional change. Signed-off-by: Stepan Ionichev <sozdayvek@gmail.com> Acked-by: Ray Jui <ray.jui@broadcom.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260503165925.1738-1-sozdayvek@gmail.com
2026-06-09i2c: cadence: Add shutdown handlerAjay Neeli
During system reboot or kexec, in-flight I2C transfers can cause spurious interrupts or leave the bus in an undefined state. Add a shutdown handler that marks the adapter suspended and resets the controller, ensuring a clean handoff. Signed-off-by: Ajay Neeli <ajay.neeli@amd.com> Acked-by: Michal Simek <michal.simek@amd.com> Reviewed-by: Radhey Shyam Pandey <radhey.shyam.pandey@amd.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260430053050.3590173-1-ajay.neeli@amd.com
2026-06-08i2c: tegra: Disable fair arbitration for non-MCTP busesAkhil R
Recent Tegra I2C controllers have a fairness arbitration register, which allows configuring the fair idle time required to support MCTP protocol over I2C. It is enabled by default, adding a per-transfer latency overhead that impacts non-MCTP I2C buses. Disable the fairness arbitration register during controller init for buses that are not MCTP controllers. Assisted-by: Cursor:claude-4.6-opus Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260518114013.62065-3-akhilrajeev@nvidia.com
2026-06-08i2c: tegra: use dmaengine_get_dma_device() for DMA buffer allocationAkhil R
Use dmaengine_get_dma_device() to obtain the correct struct device pointer for dma_alloc_coherent() instead of directly dereferencing chan->device->dev. The dmaengine_get_dma_device() helper checks whether the DMA channel has a per-channel DMA device (chan->dev->chan_dma_dev) and returns it when available, falling back to the controller device otherwise. On platforms where the DMA controller sits behind an IOMMU with per-channel IOVA spaces (e.g. Tegra264 GPC DMA), the per-channel device carries the correct DMA mapping context. Using the controller device directly would allocate DMA buffers against the wrong IOMMU domain, leading to SMMU faults at runtime. On platforms without per-channel DMA devices the helper returns the same pointer as before, so there is no change in behavior for existing hardware. Assisted-by: Cursor:claude-4.6-opus Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260518114013.62065-2-akhilrajeev@nvidia.com
2026-06-08i2c: tegra: Fix NOIRQ suspend/resumeAkhil R
The Tegra I2C driver relies on runtime PM to wake up the controller before each transfer. However, runtime PM is disabled between the system suspend and NOIRQ suspend. If an I2C device initiates a transfer during this window, the I2C controller fails to wake up and the transfer fails. To handle this, the controller must be kept available for this period to allow transfers. Rework the I2C controller's system PM callbacks such that the controller is resumed from runtime suspend during system suspend and it stays RPM_ACTIVE throughout the suspend-resume cycle until it is runtime suspended back in the system resume. The clocks are disabled in NOIRQ suspend and enabled back in NOIRQ resume by calling the controller's runtime PM functions directly. Fixes: 8ebf15e9c869 ("i2c: tegra: Move suspend handling to NOIRQ phase") Assisted-by: Cursor:claude-4.6-opus Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Cc: <stable@vger.kernel.org> # v5.4+ Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260518114013.62065-5-akhilrajeev@nvidia.com
2026-06-08i2c: tegra: Update Tegra410 I2C timing parametersAkhil R
Update Tegra410 I2C timing parameters based on hardware characterization results. This adjusts the fast mode and HS mode settings to be compliant with the I2C specification. Fixes: 59717f260183 ("i2c: tegra: Add support for Tegra410") Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Reviewed-by: Jon Hunter <jonathanh@nvidia.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260518114013.62065-4-akhilrajeev@nvidia.com
2026-06-08i2c: qcom-cci: Fix NULL pointer dereference in cci_remove()Vladimir Zapolskiy
On all modern platforms Qualcomm CCI controller provides two I2C masters, and on particular boards only one I2C master may be initialized, and in such cases the device unbinding or driver removal causes a NULL pointer dereference, because cci_halt() is called for all two I2C masters, but a completion is initialized only for the single enabled master: % rmmod i2c-qcom-cci Unable to handle kernel NULL pointer dereference at virtual address 0000000000000000 <snip> Call trace: __wait_for_common+0x194/0x1a8 (P) wait_for_completion_timeout+0x20/0x2c cci_remove+0xc4/0x138 [i2c_qcom_cci] platform_remove+0x20/0x30 device_remove+0x4c/0x80 device_release_driver_internal+0x1c8/0x224 driver_detach+0x50/0x98 bus_remove_driver+0x6c/0xbc driver_unregister+0x30/0x60 platform_driver_unregister+0x14/0x20 qcom_cci_driver_exit+0x18/0x1008 [i2c_qcom_cci] .... Fixes: e517526195de ("i2c: Add Qualcomm CCI I2C driver") Signed-off-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org> Cc: <stable@vger.kernel.org> # v5.8+ Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260515234121.1607425-2-vladimir.zapolskiy@linaro.org
2026-06-08i2c: stm32f7: fix timing computation ignoring i2c-analog-filterGuillermo Rodríguez
stm32f7_i2c_compute_timing() uses i2c_dev->analog_filter to pick the analog filter delay, but i2c_dev->analog_filter is parsed from the "i2c-analog-filter" DT property only after the compute_timing loop in stm32f7_i2c_setup_timing(), so in practice the timing calculations always ignore the analog filter. On an STM32MP1 board with clock-frequency = <400000> and i2c-analog-filter set, measured SCL frequency was ~382 kHz. This also affects (widens) the computed SDADEL range. At high bus clock speeds, this can select an SDADEL value that violates tVD;DAT (data valid time). Fix by parsing "i2c-analog-filter" before the compute_timing loop. Fixes: 83c3408f7b9c ("i2c: stm32f7: support DT binding i2c-analog-filter") Signed-off-by: Guillermo Rodríguez <guille.rodriguez@gmail.com> Cc: <stable@vger.kernel.org> # v5.13+ Acked-by: Alain Volmat <alain.volmat@foss.st.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260526091210.20383-1-guille.rodriguez@gmail.com
2026-06-08i2c: imx: fix clock and pinctrl state inconsistency in runtime PMCarlos Song
In i2c_imx_runtime_suspend(), the clock is disabled before switching the pinctrl state to sleep. If pinctrl_pm_select_sleep_state() fails, the runtime suspend is aborted but the clock remains disabled, causing a system crash when the hardware is subsequently accessed. Fix this by switching the pinctrl state before disabling the clock so that a pinctrl failure leaves the clock enabled and the hardware accessible. In i2c_imx_runtime_resume(), restore the pinctrl state back to sleep if clk_enable() fails to keep the consistent. Fixes: 576eba03c994 ("i2c: imx: switch different pinctrl state in different system power status") Signed-off-by: Carlos Song <carlos.song@nxp.com> Cc: <stable@vger.kernel.org> # v6.14+ Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260521065038.2954998-1-carlos.song@oss.nxp.com
2026-06-08i2c: riic: fix refcount leak in riic_i2c_resume_noirq()Wentao Liang
When riic_i2c_resume_noirq() is called, it deasserts the reset using reset_control_deassert(), which for shared resets increments a reference count. If pm_runtime_force_resume() then fails, the function returns without calling reset_control_assert() to decrement the count. This leaves the reset deasserted and the reference count unbalanced, which can prevent other users of the shared reset from properly asserting it later. Fix the leak by calling reset_control_assert() on the error handling path for a failed pm_runtime_force_resume(). Fixes: e383f0961422 ("i2c: riic: Move suspend handling to NOIRQ phase") Signed-off-by: Wentao Liang <vulab@iscas.ac.cn> Cc: <stable@vger.kernel.org> # v6.19+ Reviewed-by: Geert Uytterhoeven <geert+renesas@glider.be> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260608071123.128964-1-vulab@iscas.ac.cn
2026-06-05i2c: busses: make K1 driver default for SpacemiT platformsIker Pedrosa
Enable I2C_K1 by default when ARCH_SPACEMIT is configured to ensure SD card functionality works out-of-the-box. SpacemiT K1 boards use I2C-controlled PMICs (like the P1 chip) to provide SD card power supplies. Without the I2C_K1 driver enabled, regulators cannot be controlled and SD card detection/operation fails. Suggested-by: Margherita Milani <margherita.milani@amarulasolutions.com> Suggested-by: Yixun Lan <dlan@kernel.org> Signed-off-by: Iker Pedrosa <ikerpedrosam@gmail.com> Reviewed-by: Yixun Lan <dlan@kernel.org> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260526-orangepi-sd-card-i2c-v1-1-b92268bfd467@gmail.com
2026-05-30i2c: virtio: mark device ready before registering the adapterAlexis Bouzigues
virtio_i2c_probe() synchronously probes child i2c drivers on the bus, but peripherals may use the bus at probe for tasks like reading a chip id. The vhost-user-i2c backend stalls at such probes unless DRIVER_OK is already set before the virtqueue is first kicked. Set DRIVER_OK explicitly before i2c_add_adapter(), as done for the same reason in commit f5866db64f34 ("virtio_console: enable VQs early") and commit 71e4b8bf0482 ("virtio_rpmsg: set DRIVER_OK before using device"). Signed-off-by: Alexis Bouzigues <BouziguesAlexis@JohnDeere.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2026-05-29i2c: designware: Add ACPI ID LECA0003 for LECARC SoCsThomas Lin
Add ACPI ID "LECA0003" for LECARC SoCs that integrate the DesignWare I2C controller. Also add corresponding ACPI description in acpi_apd.c. Signed-off-by: Thomas Lin <thomas_lin@lecomputing.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260526-lecarc-i2c-acpi-id-v1-1-f0942bd491d2@lecomputing.com
2026-05-29i2c: designware: Handle active target cleanlyWilliam A. Kennington III
When the I2C controller attempts a new transaction while the target controller is shutting down or restarting, it can lead to bus lockups and system bootloops if the hardware enters an inconsistent state. Address this by ensuring that the internal state machines are properly cleared when disabling the controller if target activity is detected. If the controller remains active after disabling, perform a bus recovery to reset it to a known good state. Signed-off-by: William A. Kennington III <william@wkennington.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260527-dw-i2c-v5-4-3483057f8d67@wkennington.com
2026-05-29i2c: designware: Convert platform driver to use shutdown hookWilliam A. Kennington III
Convert the platform driver to use the new i2c_dw_shutdown() hook, allowing the controller to gracefully NACK controllers requests during system shutdown. Signed-off-by: William A. Kennington III <william@wkennington.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260527-dw-i2c-v5-3-3483057f8d67@wkennington.com
2026-05-29i2c: designware: Convert PCI driver to use shutdown hookWilliam A. Kennington III
Convert the PCI driver to use the new i2c_dw_shutdown() hook, allowing the controller to gracefully NACK controller requests during system shutdown. Signed-off-by: William A. Kennington III <william@wkennington.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260527-dw-i2c-v5-2-3483057f8d67@wkennington.com
2026-05-29i2c: designware: Introduce shutdown exported functionWilliam A. Kennington III
Introduce an exported shutdown function to safely shutdown the DesignWare I2C controller. This shutdown hook gracefully sets the target disable bit before disabling the controller. This guarantees that any incoming requests from the controller are immediately NACKed during shutdown, preventing the bus from hanging. Signed-off-by: William A. Kennington III <william@wkennington.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20260527-dw-i2c-v5-1-3483057f8d67@wkennington.com
2026-05-29i2c: icy: Use named initializer for zorro_device_id arraysUwe Kleine-König (The Capable Hub)
Using named initializers is more explicit and thus easier to parse for a human. While touching this array, drop explicit zeros from the list terminator. This change doesn't introduce changes to the compiled zorro_device_id array. Signed-off-by: Uwe Kleine-König (The Capable Hub) <u.kleine-koenig@baylibre.com> Reviewed-by: Max Staudt <max@enpas.org> Reviewed-by: Geert Uytterhoeven <geert@linux-m68k.org> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/3d7690c7a8948f977d6c50bd0c8010efb715fbdc.1779803053.git.u.kleine-koenig@baylibre.com
2026-05-29i2c: sis630: Replace dev_err() with dev_err_probe() in probe functionEnrico Zanda
This simplifies the code while improving log. Signed-off-by: Enrico Zanda <e.zanda1@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250520194400.341079-11-e.zanda1@gmail.com
2026-05-29i2c: sis96x: Replace dev_err() with dev_err_probe() in probe functionEnrico Zanda
This simplifies the code while improving log. Signed-off-by: Enrico Zanda <e.zanda1@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250520194400.341079-10-e.zanda1@gmail.com
2026-05-29i2c: sprd: Replace dev_err() with dev_err_probe() in probe functionEnrico Zanda
This simplifies the code while improving log. Signed-off-by: Enrico Zanda <e.zanda1@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250520194400.341079-9-e.zanda1@gmail.com
2026-05-29i2c: st: Replace dev_err() with dev_err_probe() in probe functionEnrico Zanda
This simplifies the code while improving log. Signed-off-by: Enrico Zanda <e.zanda1@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250520194400.341079-8-e.zanda1@gmail.com
2026-05-29i2c: stm32: Replace dev_err() with dev_err_probe() in probe functionEnrico Zanda
This simplifies the code while improving log. Signed-off-by: Enrico Zanda <e.zanda1@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250520194400.341079-7-e.zanda1@gmail.com
2026-05-29i2c: stm32f4: Replace dev_err() with dev_err_probe() in probe functionEnrico Zanda
This simplifies the code while improving log. Signed-off-by: Enrico Zanda <e.zanda1@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250520194400.341079-6-e.zanda1@gmail.com
2026-05-28i2c: stm32f7: Replace dev_err() with dev_err_probe() in probe functionEnrico Zanda
This simplifies the code while improving log. Signed-off-by: Enrico Zanda <e.zanda1@gmail.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250520194400.341079-5-e.zanda1@gmail.com
2026-05-28i2c: sun6i-p2wi: Replace dev_err() with dev_err_probe() in probe functionEnrico Zanda
This simplifies the code while improving log. Signed-off-by: Enrico Zanda <e.zanda1@gmail.com> Reviewed-by: Chen-Yu Tsai <wens@kernel.org> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250520194400.341079-4-e.zanda1@gmail.com