linux/drivers/i2c/busses
Tommaso Merciai 469f8fe4c8 i2c: riic: Move suspend handling to NOIRQ phase
commit e383f09614 upstream.

Commit 53326135d0 ("i2c: riic: Add suspend/resume support") added
suspend support for the Renesas I2C driver and following this change
on RZ/G3E the following WARNING is seen on entering suspend ...

[  134.275704] Freezing remaining freezable tasks completed (elapsed 0.001 seconds)
[  134.285536] ------------[ cut here ]------------
[  134.290298] i2c i2c-2: Transfer while suspended
[  134.295174] WARNING: drivers/i2c/i2c-core.h:56 at __i2c_smbus_xfer+0x1e4/0x214, CPU#0: systemd-sleep/388
[  134.365507] Tainted: [W]=WARN
[  134.368485] Hardware name: Renesas SMARC EVK version 2 based on r9a09g047e57 (DT)
[  134.375961] pstate: 60400005 (nZCv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
[  134.382935] pc : __i2c_smbus_xfer+0x1e4/0x214
[  134.387329] lr : __i2c_smbus_xfer+0x1e4/0x214
[  134.391717] sp : ffff800083f23860
[  134.395040] x29: ffff800083f23860 x28: 0000000000000000 x27: ffff800082ed5d60
[  134.402226] x26: 0000001f4395fd74 x25: 0000000000000007 x24: 0000000000000001
[  134.409408] x23: 0000000000000000 x22: 000000000000006f x21: ffff800083f23936
[  134.416589] x20: ffff0000c090e140 x19: ffff0000c090e0d0 x18: 0000000000000006
[  134.423771] x17: 6f63657320313030 x16: 2e30206465737061 x15: ffff800083f23280
[  134.430953] x14: 0000000000000000 x13: ffff800082b16ce8 x12: 0000000000000f09
[  134.438134] x11: 0000000000000503 x10: ffff800082b6ece8 x9 : ffff800082b16ce8
[  134.445315] x8 : 00000000ffffefff x7 : ffff800082b6ece8 x6 : 80000000fffff000
[  134.452495] x5 : 0000000000000504 x4 : 0000000000000000 x3 : 0000000000000000
[  134.459672] x2 : 0000000000000000 x1 : 0000000000000000 x0 : ffff0000c9ee9e80
[  134.466851] Call trace:
[  134.469311]  __i2c_smbus_xfer+0x1e4/0x214 (P)
[  134.473715]  i2c_smbus_xfer+0xbc/0x120
[  134.477507]  i2c_smbus_read_byte_data+0x4c/0x84
[  134.482077]  isl1208_i2c_read_time+0x44/0x178 [rtc_isl1208]
[  134.487703]  isl1208_rtc_read_time+0x14/0x20 [rtc_isl1208]
[  134.493226]  __rtc_read_time+0x44/0x88
[  134.497012]  rtc_read_time+0x3c/0x68
[  134.500622]  rtc_suspend+0x9c/0x170

The warning is triggered because I2C transfers can still be attempted
while the controller is already suspended, due to inappropriate ordering
of the system sleep callbacks.

If the controller is autosuspended, there is no way to wake it up once
runtime PM disabled (in suspend_late()). During system resume, the I2C
controller will be available only after runtime PM is re-enabled
(in resume_early()). However, this may be too late for some devices.

Wake up the controller in the suspend() callback while runtime PM is
still enabled. The I2C controller will remain available until the
suspend_noirq() callback (pm_runtime_force_suspend()) is called. During
resume, the I2C controller can be restored by the resume_noirq() callback
(pm_runtime_force_resume()). Finally, the resume() callback re-enables
autosuspend. As a result, the I2C controller can remain available until
the system enters suspend_noirq() and from resume_noirq().

Cc: stable@vger.kernel.org
Fixes: 53326135d0 ("i2c: riic: Add suspend/resume support")
Signed-off-by: Tommaso Merciai <tommaso.merciai.xr@bp.renesas.com>
Reviewed-by: Biju Das <biju.das.jz@bp.renesas.com>
Tested-by: Biju Das <biju.das.jz@bp.renesas.com>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
History 2026-01-23 11:18:46 +01:00
..
i2c-acorn.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 500 2019-06-19 17:09:55 +02:00
i2c-ali15x3.c i2c: ali15x3: Fix an error handling path in ali15x3_probe() 2025-03-22 12:54:27 -07:00
i2c-ali1535.c i2c: ali1535: Fix an error handling path in ali1535_probe() 2025-03-22 12:54:27 -07:00
i2c-ali1563.c i2c: add missing MODULE_DESCRIPTION() macros 2024-07-09 00:46:06 +02:00
i2c-altera.c i2c: altera: reword according to newest specification 2024-07-11 15:13:11 +02:00
i2c-amd-mp2-pci.c i2c: amd-mp2: fix reference leak in MP2 PCI device 2026-01-08 10:14:30 +01:00
i2c-amd-mp2-plat.c i2c: don't use ',' after delimiters 2024-09-10 00:33:52 +02:00
i2c-amd-mp2.h i2c: amd-mp2: use msix/msi if the hardware supports 2022-11-01 13:41:22 +01:00
i2c-amd756-s4882.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-amd756.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-amd8111.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-aspeed.c i2c-for-6.12-rc1 2024-09-23 14:34:19 -07:00
i2c-at91-core.c i2c: at91-core: Use devm_clk_get_enabled() 2023-10-21 20:45:29 +02:00
i2c-at91-master.c i2c: at91-master: remove printout on handled timeouts 2024-05-06 00:56:31 +02:00
i2c-at91-slave.c i2c: at91: Fix the functionality flags of the slave-only interface 2024-06-12 17:07:33 +01:00
i2c-at91.h i2c: at91: remove legacy DMA left overs 2020-11-03 21:34:40 +01:00
i2c-au1550.c i2c: au1550: reword according to newest specification 2024-07-11 15:13:11 +02:00
i2c-axxia.c i2c: axxia: eliminate kernel-doc warnings 2023-10-28 14:34:53 +02:00
i2c-bcm-iproc.c i2c: bcm-iproc: remove printout on handled timeouts 2024-05-06 00:56:32 +02:00
i2c-bcm-kona.c i2c: bcm-kona: reword according to newest specification 2024-07-11 15:13:12 +02:00
i2c-bcm2835.c i2c: bcm2835: reword according to newest specification 2024-07-11 15:13:12 +02:00
i2c-brcmstb.c i2c: brcmstb: reword according to newest specification 2024-07-11 15:13:12 +02:00
i2c-cadence.c Code cleanup: 2024-05-13 15:56:14 +02:00
i2c-cbus-gpio.c i2c: Convert to platform remove callback returning void 2023-06-05 09:47:37 +02:00
i2c-ccgx-ucsi.c i2c: add missing MODULE_DESCRIPTION() macros 2024-07-09 00:46:06 +02:00
i2c-ccgx-ucsi.h i2c: Introduce common module to instantiate CCGx UCSI 2022-02-15 10:04:53 +01:00
i2c-cht-wc.c i2c: cht-wc: reword according to newest specification 2024-07-11 15:13:13 +02:00
i2c-cp2615.c i2c: cp2615: reword according to newest specification 2024-07-11 15:13:30 +02:00
i2c-cpm.c i2c: cpm: reword according to newest specification 2024-07-11 15:14:26 +02:00
i2c-cros-ec-tunnel.c i2c: cros-ec-tunnel: defer probe if parent EC is not present 2025-04-25 10:47:52 +02:00
i2c-davinci.c i2c: davinci: reword according to newest specification 2024-07-11 15:14:07 +02:00
i2c-designware-amdpsp.c i2c: designware: Add doorbell support for Mendocino 2023-04-20 18:20:05 +08:00
i2c-designware-baytrail.c i2c: designware: Add AMD PSP I2C bus support 2022-02-11 15:38:23 +01:00
i2c-designware-common.c i2c: designware: Actually make use of the I2C_DW_COMMON and I2C_DW symbol namespaces 2025-02-08 09:57:22 +01:00
i2c-designware-core.h i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware 2026-01-08 10:14:12 +01:00
i2c-designware-master.c i2c: designware: Disable SMBus interrupts to prevent storms from mis-configured firmware 2026-01-08 10:14:12 +01:00
i2c-designware-pcidrv.c i2c: designware: Fix an error handling path in i2c_dw_pci_probe() 2025-05-29 11:01:56 +02:00
i2c-designware-platdrv.c i2c: designware: Add disabling clocks when probe fails 2025-10-15 12:00:03 +02:00
i2c-designware-slave.c i2c: designware: Invoke runtime suspend on quick slave re-registration 2025-06-27 11:11:28 +01:00
i2c-digicolor.c i2c: don't use ',' after delimiters 2024-09-10 00:33:52 +02:00
i2c-diolan-u2c.c i2c: diolan-u2c: reword according to newest specification 2024-07-11 15:14:08 +02:00
i2c-dln2.c i2c: dln2: reword according to newest specification 2024-07-11 15:14:08 +02:00
i2c-eg20t.c i2c: move drivers from strlcpy to strscpy 2022-08-11 23:02:51 +02:00
i2c-elektor.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-emev2.c i2c: emev2: Use devm_clk_get_enabled() helpers 2024-09-10 00:36:48 +02:00
i2c-exynos5.c i2c: exynos5: use 'time_left' variable with wait_for_completion_timeout() 2024-05-06 00:56:50 +02:00
i2c-fsi.c i2c: fsi: reword according to newest specification 2024-07-11 15:14:09 +02:00
i2c-gpio.c i2c: gpio: reword according to newest specification 2024-07-11 15:14:09 +02:00
i2c-gxp.c I2C: Explicitly include correct DT includes 2023-08-14 17:47:21 +02:00
i2c-highlander.c i2c: highlander: reword according to newest specification 2024-07-11 15:14:09 +02:00
i2c-hisi.c i2c: hisi: reword according to newest specification 2024-07-11 15:14:10 +02:00
i2c-hix5hd2.c i2c: hix5hd2: reword according to newest specification 2024-07-11 15:14:10 +02:00
i2c-hydra.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-i801.c i2c: i801: Hide Intel Birch Stream SoC TCO WDT 2025-09-19 16:35:45 +02:00
i2c-ibm_iic.c i2c: ibm_iic: reword according to newest specification 2024-07-11 15:14:11 +02:00
i2c-ibm_iic.h treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 152 2019-05-30 11:26:32 -07:00
i2c-icy.c i2c: move drivers from strlcpy to strscpy 2022-08-11 23:02:51 +02:00
i2c-img-scb.c i2c: img-scb: remove printout on handled timeouts 2024-05-06 00:56:33 +02:00
i2c-imx-lpi2c.c i2c: imx-lpi2c: Fix clock count when probe defers 2025-05-09 09:50:31 +02:00
i2c-imx.c i2c: imx: add imx7d compatible string for applying erratum ERR007805 2025-01-02 10:34:23 +01:00
i2c-iop3xx.c i2c: iop3xx: reword according to newest specification 2024-07-11 15:14:11 +02:00
i2c-iop3xx.h Merge branch 'i2c/for-5.3' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux 2019-07-15 21:10:39 -07:00
i2c-isch.c i2c: isch: Add missed 'else' 2024-09-11 23:32:24 +02:00
i2c-ismt.c i2c: ismt: kill transaction in hardware on timeout 2024-09-10 00:36:55 +02:00
i2c-jz4780.c i2c: jz4780: Use devm_clk_get_enabled() helpers 2024-09-10 00:36:48 +02:00
i2c-keba.c i2c: keba: Add KEBA I2C controller support 2024-09-10 11:02:45 +02:00
i2c-kempld.c i2c: kempld: reword according to newest specification 2024-07-11 15:14:13 +02:00
i2c-ljca.c i2c: ljca: Remove unused "target_addr" parameter 2024-09-10 17:10:55 +02:00
i2c-lpc2k.c i2c: lpc2k: reword according to newest specification 2024-07-11 15:14:13 +02:00
i2c-ls2x.c i2c: ls2x: Fix frequency division register access 2025-03-07 18:25:40 +01:00
i2c-mchp-pci1xxxx.c i2c: mchp-pci1xxxx: Avoid cast to incompatible function type 2023-06-05 10:43:45 +02:00
i2c-meson.c I2C: Explicitly include correct DT includes 2023-08-14 17:47:21 +02:00
i2c-microchip-corei2c.c i2c: microchip-core: fix "ghost" detections 2025-01-02 10:34:23 +01:00
i2c-mlxbf.c i2c: mlxbf: Use devm_platform_get_and_ioremap_resource() 2023-08-14 18:09:44 +02:00
i2c-mlxcpld.c i2c: mlxcpld: reword according to newest specification 2024-07-11 15:14:14 +02:00
i2c-mpc.c i2c: mpc: Use devm_clk_get_optional_enabled() to simplify code 2024-09-10 00:36:45 +02:00
i2c-mt65xx.c i2c: mediatek: fix potential incorrect use of I2C_MASTER_WRRD 2025-10-15 12:00:03 +02:00
i2c-mt7621.c i2c: mt7621: reword according to newest specification 2024-07-11 15:14:15 +02:00
i2c-mv64xxx.c i2c: mv64xxx: reword according to newest specification 2024-07-11 15:14:15 +02:00
i2c-mxs.c I2C: Explicitly include correct DT includes 2023-08-14 17:47:21 +02:00
i2c-nforce2-s4985.c treewide: Replace GPLv2 boilerplate/reference with SPDX - rule 157 2019-05-30 11:26:37 -07:00
i2c-nforce2.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-nomadik.c I2C core removes an argument from the i2c_mux_add_adapter() call to 2024-05-20 08:55:18 -07:00
i2c-npcm7xx.c i2c: npcm: Add clock toggle recovery 2025-06-27 11:11:29 +01:00
i2c-nvidia-gpu.c move asm/unaligned.h to linux/unaligned.h 2024-10-02 17:23:23 -04:00
i2c-ocores.c i2c: ocores: reword according to newest specification 2024-07-11 15:14:16 +02:00
i2c-octeon-core.c i2c: octeon: reword according to newest specification 2024-07-11 15:14:16 +02:00
i2c-octeon-core.h i2c: octeon: reword according to newest specification 2024-07-11 15:14:16 +02:00
i2c-octeon-platdrv.c i2c: octeon: reword according to newest specification 2024-07-11 15:14:16 +02:00
i2c-omap.c i2c: omap: fix deprecated of_property_read_bool() use 2025-07-24 08:56:37 +02:00
i2c-opal.c i2c: opal: reword according to newest specification 2024-07-11 15:14:17 +02:00
i2c-owl.c i2c: owl: reword according to newest specification 2024-07-11 15:14:17 +02:00
i2c-parport.c parport: Remove parport_driver.devmodel 2024-07-03 16:44:22 +02:00
i2c-pasemi-core.c i2c: pasemi: reword according to newest specification 2024-07-11 15:14:17 +02:00
i2c-pasemi-core.h i2c: /pasemi: PASemi I2C controller IRQ enablement 2022-11-12 21:30:16 +01:00
i2c-pasemi-pci.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-pasemi-platform.c i2c: pasemi-platform: Use devm_clk_get_enabled() 2023-06-23 11:56:34 +02:00
i2c-pca-isa.c isa: Make the remove callback for isa drivers return void 2021-01-26 07:42:27 +01:00
i2c-pca-platform.c I2C: Explicitly include correct DT includes 2023-08-14 17:47:21 +02:00
i2c-piix4.c i2c: don't use ',' after delimiters 2024-09-10 00:33:52 +02:00
i2c-pnx.c i2c: pnx: Fix timeout in wait functions 2024-12-27 14:01:59 +01:00
i2c-powermac.c i2c: powermac: reword according to newest specification 2024-07-11 15:14:18 +02:00
i2c-pxa-pci.c i2c: don't use ',' after delimiters 2024-09-10 00:33:52 +02:00
i2c-pxa.c i2c: pxa: fix call balance of i2c->clk handling routines 2025-05-29 11:02:12 +02:00
i2c-qcom-cci.c i2c: qcom-cci: Fix error checking in cci_probe() 2023-08-25 22:07:10 +02:00
i2c-qcom-geni.c i2c: qcom-geni: make sure I2C hub controllers can't use SE DMA 2026-01-23 11:18:42 +01:00
i2c-qup.c i2c: qup: jump out of the loop in case of timeout 2025-08-01 09:48:42 +01:00
i2c-rcar.c i2c: rcar: fix NACK handling when being a target 2025-01-23 17:22:54 +01:00
i2c-riic.c i2c: riic: Move suspend handling to NOIRQ phase 2026-01-23 11:18:46 +01:00
i2c-rk3x.c i2c: rk3x: reword according to newest specification 2024-07-11 15:14:19 +02:00
i2c-robotfuzz-osif.c i2c: robotfuzz-osif: disable zero-length read messages 2025-07-06 11:01:38 +02:00
i2c-rzv2m.c i2c: rzv2m: reword according to newest specification 2024-07-11 15:14:20 +02:00
i2c-s3c2410.c i2c: don't use ',' after delimiters 2024-09-10 00:33:52 +02:00
i2c-scmi.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-sh7760.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-sh_mobile.c i2c: sh_mobile: remove printout on handled timeouts 2024-05-06 00:56:36 +02:00
i2c-sibyte.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-simtec.c i2c: Convert to platform remove callback returning void 2023-06-05 09:47:37 +02:00
i2c-sis96x.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-sis630.c i2c: sis630: Fix an error handling path in sis630_probe() 2025-03-22 12:54:27 -07:00
i2c-sis5595.c i2c: sis5595: reword according to newest specification 2024-07-11 15:14:20 +02:00
i2c-sprd.c i2c: sprd: reword according to newest specification 2024-07-11 15:14:21 +02:00
i2c-st.c i2c: st: reword according to newest specification 2024-07-11 15:14:26 +02:00
i2c-stm32.c i2c: stm32: fix the device used for the DMA map 2025-07-24 08:56:20 +02:00
i2c-stm32.h i2c: stm32: Use the correct style for SPDX License Identifier 2019-08-14 14:56:54 +02:00
i2c-stm32f4.c i2c: stm32f4: reword according to newest specification 2024-07-11 15:14:21 +02:00
i2c-stm32f7.c i2c: stm32f7: unmap DMA mapped buffer 2025-07-24 08:56:21 +02:00
i2c-sun6i-p2wi.c i2c: sun6i-p2wi: reword according to newest specification 2024-07-11 15:14:21 +02:00
i2c-synquacer.c i2c: synquacer: Deal with optional PCLK correctly 2024-09-24 16:23:26 +02:00
i2c-taos-evm.c i2c: taos-evm: reword according to newest specification 2024-07-11 15:14:22 +02:00
i2c-tegra-bpmp.c i2c: tegra-bpmp: reword according to newest specification 2024-07-11 15:14:22 +02:00
i2c-tegra.c i2c: tegra: Fix reset error handling with ACPI 2025-08-01 09:48:42 +01:00
i2c-thunderx-pcidrv.c i2c: thunderx-pcidrv: reword according to newest specification 2024-07-11 15:14:23 +02:00
i2c-tiny-usb.c i2c: tiny-usb: disable zero-length read messages 2025-07-06 11:01:38 +02:00
i2c-uniphier-f.c i2c: uniphier-f: reword according to newest specification 2024-07-11 15:14:23 +02:00
i2c-uniphier.c i2c: uniphier: reword according to newest specification 2024-07-11 15:14:24 +02:00
i2c-versatile.c i2c: versatile: Use devm_platform_get_and_ioremap_resource() 2023-06-14 10:40:09 +02:00
i2c-via.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-viai2c-common.c i2c: viai2c: reword according to newest specification 2024-07-11 15:14:24 +02:00
i2c-viai2c-common.h i2c: viai2c: turn common code into a proper module 2024-06-26 16:07:21 +02:00
i2c-viai2c-wmt.c i2c: viai2c: reword according to newest specification 2024-07-11 15:14:24 +02:00
i2c-viai2c-zhaoxin.c i2c: viai2c: reword according to newest specification 2024-07-11 15:14:24 +02:00
i2c-viapro.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00
i2c-viperboard.c i2c: viperboard: reword according to newest specification 2024-07-11 15:14:24 +02:00
i2c-virtio.c i2c: virtio: Avoid hang by using interruptible completion wait 2025-08-01 09:48:43 +01:00
i2c-xgene-slimpro.c i2c: xgene-slimpro: Migrate to use generic PCC shmem related macros 2023-09-29 11:55:21 +01:00
i2c-xiic.c i2c: xiic: Fix pm_runtime_set_suspended() with runtime pm enabled 2024-09-27 11:48:21 +02:00
i2c-xlp9xx.c i2c: xlp9xx: Use dev_err_probe in probe function 2023-08-10 10:12:55 +02:00
Kconfig i2c: omap: Add support for setting mux 2025-07-24 08:56:37 +02:00
Makefile i2c: keba: Add KEBA I2C controller support 2024-09-10 11:02:45 +02:00
scx200_acb.c i2c: Don't let i2c adapters declare I2C_CLASS_SPD support if they support I2C_CLASS_HWMON 2024-01-18 21:10:41 +01:00