summaryrefslogtreecommitdiff
path: root/drivers/i2c
AgeCommit message (Collapse)Author
5 daysi2c: scx200_acb: depends on HAS_IOPORTJohannes Berg
It already depends on X86_32, but that's also set for ARCH=um. Recent changes made UML no longer have IO port access since it's not needed, but this driver uses it. Build it only for HAS_IOPORT. This is pretty much the same as depending on X86, but on the off-chance that HAS_IOPORT will ever be optional on x86 HAS_IOPORT is the real prerequisite. Signed-off-by: Johannes Berg <johannes.berg@intel.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
6 daysi2c: omap: Fix an error handling path in omap_i2c_probe()Christophe JAILLET
If an error occurs after calling mux_state_select(), mux_state_deselect() should be called as already done in the remove function. Fixes: b6ef830c60b6 ("i2c: omap: Add support for setting mux") Signed-off-by: Christophe JAILLET <christophe.jaillet@wanadoo.fr> Cc: <stable@vger.kernel.org> # v6.15+ Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/998542981b6d2435c057dd8b9fe71743927babab.1749913149.git.christophe.jaillet@wanadoo.fr
6 daysi2c: amd-isp: Initialize unique adapter namePratap Nirujogi
Initialize unique name for amdisp i2c adapter, which is used in the platform driver to detect the matching adapter for i2c_client creation. Add definition of amdisp i2c adapter name in a new header file (include/linux/soc/amd/isp4_misc.h) as it is referred in different driver modules. Tested-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250609155601.1477055-3-pratap.nirujogi@amd.com
6 daysi2c: designware: Initialize adapter name only when not setPratap Nirujogi
Check if the adapter name is already set in the driver prior to initializing with generic name in i2c_dw_probe_master(). This check allows to retain the unique adapter name driver has initialized, which platform driver can use to distinguish it from other i2c designware adapters. Tested-by: Randy Dunlap <rdunlap@infradead.org> Signed-off-by: Pratap Nirujogi <pratap.nirujogi@amd.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250609155601.1477055-2-pratap.nirujogi@amd.com
6 daysi2c: tiny-usb: disable zero-length read messagesWolfram Sang
This driver passes the length of an i2c_msg directly to usb_control_msg(). If the message is now a read and of length 0, it violates the USB protocol and a warning will be printed. Enable the I2C_AQ_NO_ZERO_LEN_READ quirk for this adapter thus forbidding 0-length read messages altogether. Fixes: e8c76eed2ecd ("i2c: New i2c-tiny-usb bus driver") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Cc: <stable@vger.kernel.org> # v2.6.22+ Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250522064349.3823-2-wsa+renesas@sang-engineering.com
6 daysi2c: robotfuzz-osif: disable zero-length read messagesWolfram Sang
This driver passes the length of an i2c_msg directly to usb_control_msg(). If the message is now a read and of length 0, it violates the USB protocol and a warning will be printed. Enable the I2C_AQ_NO_ZERO_LEN_READ quirk for this adapter thus forbidding 0-length read messages altogether. Fixes: 83e53a8f120f ("i2c: Add bus driver for for OSIF USB i2c device.") Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Cc: <stable@vger.kernel.org> # v3.14+ Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250522064234.3721-2-wsa+renesas@sang-engineering.com
6 daysi2c: imx: fix emulated smbus block readLukasz Kucharczyk
Acknowledge the byte count submitted by the target. When I2C_SMBUS_BLOCK_DATA read operation is executed by i2c_smbus_xfer_emulated(), the length of the second (read) message is set to 1. Length of the block is supposed to be obtained from the target by the underlying bus driver. The i2c_imx_isr_read() function should emit the acknowledge on i2c bus after reading the first byte (i.e., byte count) while processing such message (as defined in Section 6.5.7 of System Management Bus Specification [1]). Without this acknowledge, the target does not submit subsequent bytes and the controller only reads 0xff's. In addition, store the length of block data obtained from the target in the buffer provided by i2c_smbus_xfer_emulated() - otherwise the first byte of actual data is erroneously interpreted as length of the data block. [1] https://smbus.org/specs/SMBus_3_3_20240512.pdf Fixes: 5f5c2d4579ca ("i2c: imx: prevent rescheduling in non dma mode") Signed-off-by: Lukasz Kucharczyk <lukasz.kucharczyk@leica-geosystems.com> Cc: <stable@vger.kernel.org> # v6.13+ Acked-by: Oleksij Rempel <o.rempel@pengutronix.de> Reviewed-by: Stefan Eichenberger <eichest@gmail.com> Reviewed-by: Carlos Song <carlos.song@nxp.com> Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Link: https://lore.kernel.org/r/20250520122252.1475403-1-lukasz.kucharczyk@leica-geosystems.com
10 daysi2c: k1: check for transfer errorAlex Elder
If spacemit_i2c_xfer_msg() times out waiting for a message transfer to complete, or if the hardware reports an error, it returns a negative error code (-ETIMEDOUT, -EAGAIN, -ENXIO. or -EIO). The sole caller of spacemit_i2c_xfer_msg() is spacemit_i2c_xfer(), which is the i2c_algorithm->xfer callback function. It currently does not save the value returned by spacemit_i2c_xfer_msg(). The result is that transfer errors go unreported, and a caller has no indication anything is wrong. When this code was out for review, the return value *was* checked in early versions. But for some reason, that assignment got dropped between versions 5 and 6 of the series, perhaps related to reworking the code to merge spacemit_i2c_xfer_core() into spacemit_i2c_xfer(). Simply assigning the value returned to "ret" fixes the problem. Fixes: 5ea558473fa31 ("i2c: spacemit: add support for SpacemiT K1 SoC") Signed-off-by: Alex Elder <elder@riscstar.com> Cc: <stable@vger.kernel.org> # v6.15+ Reviewed-by: Troy Mitchell <troymitchell988@gmail.com> Link: https://lore.kernel.org/r/20250616125137.1555453-1-elder@riscstar.com Signed-off-by: Andi Shyti <andi@smida.it> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-06-12i2c: use inclusive callbacks in struct i2c_algorithmWolfram Sang
Convert the I2C subsystem to drop using the 'master_'-prefixed callbacks in favor of the simplified ones. Fix alignment of '=' while here. Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-06-08treewide, timers: Rename from_timer() to timer_container_of()Ingo Molnar
Move this API to the canonical timer_*() namespace. [ tglx: Redone against pre rc1 ] Signed-off-by: Ingo Molnar <mingo@kernel.org> Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Link: https://lore.kernel.org/all/aB2X0jCKQO56WdMt@gmail.com
2025-05-30Merge tag 'i2c-for-6.16-rc1' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux Pull i2c updates from Wolfram Sang: "Core updates: - move towards using the 'fwnode' handle instead of 'of_node' (meaning 'of_node' even gets removed from i2c_board_info) - add support for Write Disable-aware SPD eeproms - minor stuff (use new helpers, typo fixes) i2c-atr (address translator) updates: - support per-channel alias pools - added support for dynamic address translation (also adds FPC202 driver as its user) - add 'static' and 'passthrough' flags Cleanups and refactorings - Many drivers switched to dev_err_probe() - Generic cleanups applied to designware, iproc, ismt, mlxbf, npcm7xx, qcom-geni, pasemi, and thunderx - davinci: declare I2C mangling support among I2C features - designware: clean up DTS handling - designware: fix PM runtime on driver unregister - imx: improve error logging during probe - lpc2k: improve checks in probe error path - xgene-slimpro: improve PCC shared memory handling - pasemi: improve error handling in reset, smbus clear, timeouts - tegra: validate buffer length during transfers - wmt: convert binding to YAML format Improvements and extended support: - microchip-core: add SMBus support - mlxbf: add support for repeated start in block transfers - mlxbf: improve timer configuration - npcm: attempt clock toggle recovery before failing init - octeon: add support for block mode operations - pasemi: add support for unjam device feature - riic: add support for bus recovery New device support: - MediaTek Dimensity 1200 (MT6893) - Sophgo SG2044 - Renesas RZ/V2N (R9A09G056) - Rockchip RK3528 - AMD ISP (new driver)" * tag 'i2c-for-6.16-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux: (89 commits) i2c: Use str_read_write() helper i2c: mlxbf: avoid 64-bit division i2c: viai2c-wmt: Replace dev_err() with dev_err_probe() in probe function i2c: designware: Don't warn about missing get_clk_rate_khz i2c: designware: Invoke runtime suspend on quick slave re-registration i2c-mlxbf: Improve I2C bus timing configuration i2c-mlxbf: Add repeated start condition support i2c: xgene-slimpro: Replace dev_err() with dev_err_probe() in probe function dt-bindings: i2c: i2c-wmt: Convert to YAML i2c: microchip-corei2c: add smbus support i2c: mlxbf: Allow build with COMPILE_TEST i2c: I2C_DESIGNWARE_AMDISP should depend on DRM_AMD_ISP i2c: atr: add passthrough flag i2c: atr: add static flag i2c: atr: allow replacing mappings in attach_addr() i2c: atr: deduplicate logic in attach_addr() i2c: atr: do not create mapping in detach_addr() i2c: atr: split up i2c_atr_get_mapping_by_addr() i2c: atr: find_mapping() -> get_mapping() i2c: atr: Fix lockdep for nested ATRs ...
2025-05-27Merge tag 'irq-cleanups-2025-05-25' of ↵Linus Torvalds
git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip Pull irq cleanups from Thomas Gleixner: "A set of cleanups for the generic interrupt subsystem: - Consolidate on one set of functions for the interrupt domain code to get rid of pointlessly duplicated code with only marginal different semantics. - Update the documentation accordingly and consolidate the coding style of the irqdomain header" * tag 'irq-cleanups-2025-05-25' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip: (46 commits) irqdomain: Consolidate coding style irqdomain: Fix kernel-doc and add it to Documentation Documentation: irqdomain: Update it Documentation: irq-domain.rst: Simple improvements Documentation: irq/concepts: Minor improvements Documentation: irq/concepts: Add commas and reflow irqdomain: Improve kernel-docs of functions irqdomain: Make struct irq_domain_info variables const irqdomain: Use irq_domain_instantiate()'s return value as initializers irqdomain: Drop irq_linear_revmap() pinctrl: keembay: Switch to irq_find_mapping() irqchip/armada-370-xp: Switch to irq_find_mapping() gpu: ipu-v3: Switch to irq_find_mapping() gpio: idt3243x: Switch to irq_find_mapping() sh: Switch to irq_find_mapping() powerpc: Switch to irq_find_mapping() irqdomain: Drop irq_domain_add_*() functions powerpc: Switch irq_domain_add_nomap() to use fwnode thermal: Switch to irq_domain_create_linear() soc: Switch to irq_domain_create_*() ...
2025-05-23i2c: Use str_read_write() helperYumeng Fang
Remove hard-coded strings by using the str_read_write() helper. Signed-off-by: Yumeng Fang <fang.yumeng@zte.com.cn> Signed-off-by: Yunjian Long <long.yunjian@zte.com.cn> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-23Merge tag 'i2c-host-6.16' of ↵Wolfram Sang
git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux into i2c/for-mergewindow i2c-host updates for v6.16 Cleanups and refactorings - Many drivers switched to dev_err_probe() - Generic cleanups applied to designware, iproc, ismt, mlxbf, npcm7xx, qcom-geni, pasemi, and thunderx - davinci: declare I2C mangling support among I2C features - designware: clean up DTS handling - designware: fix PM runtime on driver unregister - imx: improve error logging during probe - lpc2k: improve checks in probe error path - xgene-slimpro: improve PCC shared memory handling - pasemi: improve error handling in reset, smbus clear, timeouts - tegra: validate buffer length during transfers - wmt: convert binding to YAML format Improvements and extended support: - microchip-core: add SMBus support - mlxbf: add support for repeated start in block transfers - mlxbf: improve timer configuration - npcm: attempt clock toggle recovery before failing init - octeon: add support for block mode operations - pasemi: add support for unjam device feature - riic: add support for bus recovery New device support: - MediaTek Dimensity 1200 (MT6893) - Sophgo SG2044 - Renesas RZ/V2N (R9A09G056) - Rockchip RK3528 - AMD ISP (new driver) Misc changes: - core: add support for Write Disable-aware SPD
2025-05-23i2c: mlxbf: avoid 64-bit divisionArnd Bergmann
The 64-bit division in mlxbf_i2c_get_ticks() causes link failures when compile-testing on 32-bit machines: ERROR: modpost: "__udivdi3" [drivers/i2c/busses/i2c-mlxbf.ko] undefined! Change this to a div_u64(), which should replace the constant division with a a multiply/shift combination in the mlxbf_i2c_get_ticks(). The frequency calculation functions require a slow library call but should be used much rarer. Fixes: 053859002c20 ("i2c: mlxbf: Allow build with COMPILE_TEST") Signed-off-by: Arnd Bergmann <arnd@arndb.de> Link: https://lore.kernel.org/r/20250520152600.1975628-1-arnd@kernel.org Signed-off-by: Andi Shyti <andi@smida.it>
2025-05-23i2c: viai2c-wmt: 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> Link: https://lore.kernel.org/r/20250513210246.528370-2-e.zanda1@gmail.com Signed-off-by: Andi Shyti <andi@smida.it>
2025-05-23i2c: designware: Don't warn about missing get_clk_rate_khzHeikki Krogerus
Converting the WARN_ON() to a dev_dbg() message in i2c_dw_clk_rate(). That removes the need to supply a dummy implementation for the callback (or alternatively a dummy clk device) when the fallback path is preferred where the existing values already in the clock registers are used - when a firmware has programmed the clock registers. The fallback path was introduced in commit 4fec76e0985c ("i2c: designware: Fix wrong setting for {ss,fs,hs}_{h,l}cnt registers"). Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Link: https://lore.kernel.org/r/20250513124015.2568924-1-heikki.krogerus@linux.intel.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-23i2c: designware: Invoke runtime suspend on quick slave re-registrationTan En De
Replaced pm_runtime_put() with pm_runtime_put_sync_suspend() to ensure the runtime suspend is invoked immediately when unregistering a slave. This prevents a race condition where suspend was skipped when unregistering and registering slave in quick succession. For example, consider the rapid sequence of `delete_device -> new_device -> delete_device -> new_device`. In this sequence, it is observed that the dw_i2c_plat_runtime_suspend() might not be invoked after `delete_device` operation. This is because after `delete_device` operation, when the pm_runtime_put() is about to trigger suspend, the following `new_device` operation might race and cancel the suspend. If that happens, during the `new_device` operation, dw_i2c_plat_runtime_resume() is skipped (since there was no suspend), which means `i_dev->init()`, i.e. i2c_dw_init_slave(), is skipped. Since i2c_dw_init_slave() is skipped, i2c_dw_configure_fifo_slave() is skipped too, which leaves `DW_IC_INTR_MASK` unconfigured. If we inspect the interrupt mask register using devmem, it will show as zero. Example shell script to reproduce the issue: ``` #!/bin/sh SLAVE_LADDR=0x1010 SLAVE_BUS=13 NEW_DEVICE=/sys/bus/i2c/devices/i2c-$SLAVE_BUS/new_device DELETE_DEVICE=/sys/bus/i2c/devices/i2c-$SLAVE_BUS/delete_device # Create initial device echo slave-24c02 $SLAVE_LADDR > $NEW_DEVICE sleep 2 # Rapid sequence of # delete_device -> new_device -> delete_device -> new_device echo $SLAVE_LADDR > $DELETE_DEVICE echo slave-24c02 $SLAVE_LADDR > $NEW_DEVICE echo $SLAVE_LADDR > $DELETE_DEVICE echo slave-24c02 $SLAVE_LADDR > $NEW_DEVICE # Using devmem to inspect IC_INTR_MASK will show as zero ``` Signed-off-by: Tan En De <ende.tan@starfivetech.com> Acked-by: Jarkko Nikula <jarkko.nikula@linux.intel.com> Link: https://lore.kernel.org/r/20250412023303.378600-1-ende.tan@starfivetech.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-23i2c-mlxbf: Improve I2C bus timing configurationChris Babroski
Update the I2C bus timing configuration on BlueField to match the configuration recommended and verified by the HW team. I2C block read failures were found on BlueField 3 during communication with a device that requires the use of repeated start conditions. Testing showed that these failures were caused by the I2C transaction getting aborted early due to a short bus "timeout" configuration value. This value determines how long the clock can be held low before the I2C transaction is aborted. Upon further inspection, it was also found that other I2C bus timing configuration values used by the kernel driver do not match the configuration that is recommended by the HW team and used in the BlueField BSP I2C drivers. Signed-off-by: Chris Babroski <cbabroski@nvidia.com> Reviewed-by: Asmaa Mnebhi <asmaa@nvidia.com> Reviewed-by: Khalil Blaiech <kblaiech@nvidia.com> Link: https://lore.kernel.org/r/20250506193059.321345-2-cbabroski@nvidia.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-23i2c-mlxbf: Add repeated start condition supportChris Babroski
Add support for SMBus repeated start conditions to the Mellanox I2C driver. This support is specifically enabled for the I2C_FUNC_SMBUS_WRITE_I2C_BLOCK implementation which is required for communication with a specific I2C device on BlueField 3. Signed-off-by: Chris Babroski <cbabroski@nvidia.com> Reviewed-by: Asmaa Mnebhi <asmaa@nvidia.com> Reviewed-by: Khalil Blaiech <kblaiech@nvidia.com> Link: https://lore.kernel.org/r/20250506193059.321345-1-cbabroski@nvidia.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-23i2c: xgene-slimpro: 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> Link: https://lore.kernel.org/r/20250511203920.325704-2-e.zanda1@gmail.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-23i2c: microchip-corei2c: add smbus supportprashanth kumar burujukindi
Add hardware support for the SMBUS commands smbus_quick, smbus_byte, smbus_byte_data, smbus_word_data and smbus_block_data, replacing the fallback to software emulation Signed-off-by: prashanth kumar burujukindi <prashanthkumar.burujukindi@microchip.com> Signed-off-by: Conor Dooley <conor.dooley@microchip.com> Link: https://lore.kernel.org/r/20250430-preview-dormitory-85191523283d@spud Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-23i2c: mlxbf: Allow build with COMPILE_TESTAndi Shyti
Extend the Kconfig dependency to include COMPILE_TEST so the Mellanox BlueField I2C driver can be built on non-ARM64 platforms for compile testing purposes. Signed-off-by: Andi Shyti <andi.shyti@kernel.org> Cc: Khalil Blaiech <kblaiech@nvidia.com> Cc: Asmaa Mnebhi <asmaa@nvidia.com> Link: https://lore.kernel.org/r/20250505215854.2896383-1-andi.shyti@kernel.org
2025-05-23i2c: I2C_DESIGNWARE_AMDISP should depend on DRM_AMD_ISPGeert Uytterhoeven
The AMD Image Signal Processor I2C functionality is only present on AMD platforms with ISP support, and its platform device is instantiated by the AMD ISP driver. Hence add a dependency on DRM_AMD_ISP, to prevent asking the user about this driver when configuring a kernel that does not support the AMD ISP. Fixes: d6263c468a76 ("i2c: amd-isp: Add ISP i2c-designware driver") Signed-off-by: Geert Uytterhoeven <geert+renesas@glider.be> Reviewed-by: Pratap Nirujogi <pratap.nirujogi@amd.com> Link: https://lore.kernel.org/r/3888f892b8c4d8c8acd17e56581e726ace7f7092.1746536495.git.geert+renesas@glider.be Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-22i2c: atr: add passthrough flagCosmin Tanislav
Some I2C ATRs can have other I2C ATRs as children. The I2C messages of the child ATRs need to be forwarded as-is if the parent I2C ATR can only do static mapping. In the case of GMSL, the deserializer I2C ATR actually doesn't have I2C address remapping hardware capabilities, but it is able to select which GMSL link to talk to, allowing it to change the address of the serializer. The child ATRs need to have their alias pools defined in such a way to prevent overlapping addresses between them, but there's no way around this without orchestration between multiple ATR instances. To allow for this use-case, add a flag that allows unmapped addresses to be passed through, since they are already remapped by the child ATRs. There's no case where an address that has not been remapped by the child ATR will hit the parent ATR. Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Reviewed-by: Romain Gantois <romain.gantois@bootlin.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-22i2c: atr: add static flagCosmin Tanislav
Some I2C ATRs do not support dynamic remapping, only static mapping of direct children. Mappings will only be added or removed as a result of devices being added or removed from a child bus. The ATR pool will have to be big enough to accommodate all devices expected to be added to the child buses. Add a new flag that prevents old mappings to be replaced or new mappings to be created in the alias finding code paths. That mens adding a flags parameter to i2c_atr_new() and an i2c_atr_flags enum. Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Reviewed-by: Romain Gantois <romain.gantois@bootlin.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-22i2c: atr: allow replacing mappings in attach_addr()Cosmin Tanislav
It is possible for aliases to be exhausted while we are still attaching children. Allow replacing mapping on attach by calling i2c_atr_replace_mapping_by_addr() if i2c_atr_create_mapping_by_addr() fails. Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-22i2c: atr: deduplicate logic in attach_addr()Cosmin Tanislav
This is the same logic as in i2c_atr_create_mapping_by_addr(). Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Reviewed-by: Romain Gantois <romain.gantois@bootlin.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-22i2c: atr: do not create mapping in detach_addr()Cosmin Tanislav
It is useless to create a new mapping just to detach it immediately. Use the newly added i2c_atr_find_mapping_by_addr() function to avoid it, and exit without logging an error if not found. Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-22i2c: atr: split up i2c_atr_get_mapping_by_addr()Cosmin Tanislav
The i2c_atr_get_mapping_by_addr() function handles three separate usecases: finding an existing mapping, creating a new mapping, or replacing an existing mapping if a new mapping cannot be created because there aren't enough aliases available. Split up the function into three different functions handling its individual usecases to prepare for better usage of each one. Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-22i2c: atr: find_mapping() -> get_mapping()Cosmin Tanislav
A find operation implies that a null result is not an error. Use get naming to clarify things and to prepare for splitting up the logic inside this function. Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-22i2c: atr: Fix lockdep for nested ATRsTomi Valkeinen
When we have an ATR, and another ATR as a subdevice of the first ATR, we get lockdep warnings for the i2c_atr.lock and i2c_atr_chan.orig_addrs_lock. This is because lockdep uses a static key for the locks, and doesn't see the locks of the separate ATR instances as separate. Fix this by generating a dynamic lock key per lock instance. Signed-off-by: Tomi Valkeinen <tomi.valkeinen+renesas@ideasonboard.com> Signed-off-by: Cosmin Tanislav <demonsingur@gmail.com> Reviewed-by: Luca Ceresoli <luca.ceresoli@bootlin.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-21Merge tag 'v6.15-rc7' into x86/core, to pick up fixesIngo Molnar
Pick up build fixes from upstream to make this tree more testable. Signed-off-by: Ingo Molnar <mingo@kernel.org>
2025-05-20i2c: use only 'fwnode' for client devicesWolfram Sang
No client sets 'of_node' anymore, so we don't need to handle the case in the core anymore. Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-20i2c: powermac: convert of_node usage to fwnodeWolfram Sang
'of_node' in i2c_boardinfo is deprecated in favor of 'fwnode'. The I2C core handles them equally, so simply convert this driver to fwnode. Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Andi Shyti <andi.shyti@kernel.org> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-20i2c: core: add useful info when defer probeXu Yang
Add an useful info when failed to get irq/wakeirq due to -EPROBE_DEFER. Before: [ 15.737361] i2c 2-0050: deferred probe pending: (reason unknown) After: [ 15.816295] i2c 2-0050: deferred probe pending: tcpci: can't get irq Signed-off-by: Xu Yang <xu.yang_2@nxp.com> Reviewed-by: Carlos Song <carlos.song@nxp.com> Reviewed-by: Frank Li <Frank.Li@nxp.com> Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
2025-05-19i2c: mlxbf: Use str_read_write() helperFeng Wei
Remove hard-coded strings by using the str_read_write() helper. Signed-off-by: Feng Wei <feng.wei8@zte.com.cn> Signed-off-by: Shao Mingyin <shao.mingyin@zte.com.cn> Link: https://lore.kernel.org/r/20250401192603311H5OxuFmUSbPc4VnQQkhZr@zte.com.cn Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: thunderx: Use non-hybrid PCI devres APIPhilipp Stanner
thunderx enables its PCI device with pcim_enable_device(). This, implicitly, switches the function pci_request_regions() into managed mode, where it becomes a devres function. The PCI subsystem wants to remove this hybrid nature from its interfaces. To do so, users of the aforementioned combination of functions must be ported to non-hybrid functions. Replace the call to sometimes-managed pci_request_regions() with one to the always-managed pcim_request_all_regions(). Signed-off-by: Philipp Stanner <phasta@kernel.org> Link: https://lore.kernel.org/r/20250417082511.22272-3-phasta@kernel.org Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: ismt: Use non-hybrid PCI devres APIPhilipp Stanner
ismt enables its PCI device with pcim_enable_device(). This, implicitly, switches the function pci_request_region() into managed mode, where it becomes a devres function. The PCI subsystem wants to remove this hybrid nature from its interfaces. To do so, users of the aforementioned combination of functions must be ported to non-hybrid functions. Replace the call to sometimes-managed pci_request_region() with one to the always-managed pcim_request_region(). Signed-off-by: Philipp Stanner <phasta@kernel.org> Link: https://lore.kernel.org/r/20250417082511.22272-2-phasta@kernel.org Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: davinci: add I2C_FUNC_PROTOCOL_MANGLING to feature listMarcus Folkesson
The driver do support I2C_M_IGNORE_NAK, so add I2C_FUNC_PROTOCOL_MANGLING to the feature list. Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com> Acked-by: Mukesh Kumar Savaliya <quic_msavaliy@quicinc.com> Link: https://lore.kernel.org/r/20250326-i2c-v1-1-82409ebe9f2b@gmail.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: smbus: introduce Write Disable-aware SPD instantiating functionsYo-Jung (Leo) Lin
Some SMBus controllers may restrict writes to addresses where SPD sensors may reside. This may lead to some SPD sensors not functioning correctly, and might need extra handling. Introduce new SPD-instantiating functions that are aware of this, and use them instead. Signed-off-by: Yo-Jung Lin (Leo) <leo.lin@canonical.com> Reviewed-by: Guenter Roeck <linux@roeck-us.net> Link: https://lore.kernel.org/r/20250430-for-upstream-i801-spd5118-no-instantiate-v2-1-2f54d91ae2c7@canonical.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: riic: Implement bus recoveryLad Prabhakar
Implement I2C bus recovery support for the RIIC controller by making use of software-controlled SCL and SDA line manipulation. The controller allows forcing SCL and SDA levels through control bits, which enables generation of manual clock pulses and a stop condition to free a stuck bus. This implementation wires up the bus recovery mechanism using i2c_generic_scl_recovery and provides get/set operations for SCL and SDA. This allows the RIIC driver to recover from bus hang scenarios where SDA is held low by a slave. Signed-off-by: Lad Prabhakar <prabhakar.mahadev-lad.rj@bp.renesas.com> Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com> Reviewed-by: Fabrizio Castro <fabrizio.castro.jz@renesas.com> Link: https://lore.kernel.org/r/20250501204003.141134-1-prabhakar.mahadev-lad.rj@bp.renesas.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: tegra: check msg length in SMBUS block readAkhil R
For SMBUS block read, do not continue to read if the message length passed from the device is '0' or greater than the maximum allowed bytes. Signed-off-by: Akhil R <akhilrajeev@nvidia.com> Acked-by: Thierry Reding <treding@nvidia.com> Link: https://lore.kernel.org/r/20250424053320.19211-1-akhilrajeev@nvidia.com Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: pasemi: Log bus reset causesHector Martin
This ensures we get all information we need to debug issues when users forward us their logs. Signed-off-by: Hector Martin <marcan@marcan.st> Reviewed-by: Neal Gompa <neal@gompa.dev> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Signed-off-by: Sven Peter <sven@svenpeter.dev> Link: https://lore.kernel.org/r/20250427-pasemi-fixes-v3-4-af28568296c0@svenpeter.dev Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: pasemi: Improve error recoveryHector Martin
Add handling for all the missing error condition, and better recovery in pasemi_smb_clear(). Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Reviewed-by: Neal Gompa <neal@gompa.dev> Signed-off-by: Hector Martin <marcan@marcan.st> Co-developed-by: Sven Peter <sven@svenpeter.dev> Signed-off-by: Sven Peter <sven@svenpeter.dev> Link: https://lore.kernel.org/r/20250427-pasemi-fixes-v3-3-af28568296c0@svenpeter.dev Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: pasemi: Improve timeout handlingSven Peter
The hardware (supposedly) has a 25ms timeout for clock stretching and the driver uses 100ms which should be plenty. The interrupt path however misses handling for errors while waiting for the completion and the polling path uses an open-coded readx_poll_timeout. Note that we drop reg_write(smbus, REG_SMSTA, status) while fixing those issues here which will be done anyway whenever the next transaction starts via pasemi_smb_clear. Signed-off-by: Sven Peter <sven@svenpeter.dev> Link: https://lore.kernel.org/r/20250427-pasemi-fixes-v3-2-af28568296c0@svenpeter.dev Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: pasemi: Enable the unjam machineHector Martin
The I2C bus can get stuck under some conditions (desync between controller and device). The pasemi controllers include an unjam feature that is enabled on reset, but was being disabled by the driver. Keep it enabled by explicitly setting the UJM bit in the CTL register. This should help recover the bus from certain conditions, which would otherwise remain stuck forever. Signed-off-by: Hector Martin <marcan@marcan.st> Reviewed-by: Neal Gompa <neal@gompa.dev> Reviewed-by: Alyssa Rosenzweig <alyssa@rosenzweig.io> Signed-off-by: Sven Peter <sven@svenpeter.dev> Link: https://lore.kernel.org/r/20250427-pasemi-fixes-v3-1-af28568296c0@svenpeter.dev Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: iproc: Remove unnecessary double negationAndi Shyti
True is true when greater than '0', no need for double negation inside the if statement. Link: https://lore.kernel.org/r/20250418211635.2666234-11-andi.shyti@kernel.org Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: iproc: When there's an error treat it as an errorAndi Shyti
If the xfer fails, it indicates a real error. Log it with an error message instead of a debug message to reflect its severity. Link: https://lore.kernel.org/r/20250418211635.2666234-10-andi.shyti@kernel.org Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
2025-05-19i2c: iproc: Move function and avoid prototypesAndi Shyti
Shuffle a bit the code in order to avoid prototypes. Link: https://lore.kernel.org/r/20250426201920.272135-1-andi.shyti@kernel.org Signed-off-by: Andi Shyti <andi.shyti@kernel.org>