Commit Graph

6667 Commits

Author SHA1 Message Date
Linus Torvalds
78bb208b99 i2c-fixes for v7.3-rc1
Fixes mainly for teardown and resource handling, runtime PM and
 hardware-specific controller issues.
 
 - core: fix debugfs use-after-free when removing the adapter
 - designware: apply interrupt mask quirk for HJMC3001
 - imx-lpi2c: avoid target accesses on master-only controllers
 - mux: release channel node when adapter registration fails
 - qcom-cci: fix autosuspend and runtime PM cleanup on removal
 - qcom-geni: fix timing parameters for 32 MHz clock
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQScDfrjQa34uOld1VLaeAVmJtMtbgUCapRFYgAKCRDaeAVmJtMt
 bpVsAQDz0v5x5AdiZQS224oErSA6vfd7ztavFkh8gg3tR+PgogEAhhV+xChRle4U
 DTwvfC2DYuzxJxYpuQbMGdvu39cuTgA=
 =t/+3
 -----END PGP SIGNATURE-----

Merge tag 'i2c-fixes-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux

Pull i2c fixes from Andi Shyti:
 "Fixes mainly for teardown and resource handling, runtime PM and
  hardware-specific controller issues:

   - fix debugfs use-after-free when removing the adapter

   - designware: apply interrupt mask quirk for HJMC3001

   - imx-lpi2c: avoid target accesses on master-only controllers

   - mux: release channel node when adapter registration fails

   - qcom-cci: fix autosuspend and runtime PM cleanup on removal

   - qcom-geni: fix timing parameters for 32 MHz clock"

* tag 'i2c-fixes-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux:
  i2c: core: fix debugfs UAF on adapter removal
  i2c: imx-lpi2c: avoid accessing target registers on master-only controllers
  i2c: qcom-cci: fix autosuspend cleanup
  i2c: designware: Enable interrupt mask workaround for HJMC3001
  i2c: qcom-geni: update frequency table to fix timing parameters
  i2c: mux: Fix channel node leak on adapter add failure
2026-08-30 10:53:24 -07:00
Linus Torvalds
a99d741df7 drm next/fixes for 7.3-rc1
core:
 - use drm_warn instead of warn
 
 msm:
 - Bindings:
   - Added Shikra support
   - Document a840, a704, a722
 - Core:
   - Use drm_client buffers for fbdev emulation
   - teardown fixes
   - ARM32 DMA fixup
   - Remove objects from evict list when re-validated
   - Bunch of corner case and error path fixes
 - DPU:
   - Dropped dev_pm_opp_set_rate(0) preventing burnout
   - Fixed SSPP offsets of Kaanapali
 - DP:
   - Dropped dev_pm_opp_set_rate(0) preventing burnout
   - Cleaned up core code in preparation for MST support
   - Fixed prepare() to let Pipewire continue in case of the unplugged cable
 - GPU:
   - Add support for a704
   - Add support for a722
 - HDMI:
   - Simplifed register access
 
 amdgpu:
 - eGPU fixes
 - Runtime PM fix
 - UserQ fixes
 - Backlight fix
 - Discovery sysfs fix
 - Reset handling fixes
 - Buffer func handling fix for xgmi
 - VCN boundary check fix
 - DC lut handling fixes
 - MES fixes
 - UVD fix
 - VCE 3 fix
 - Enforce isolation fix
 - HPD fix for VGA/LVDS
 - DML fix
 - DCN 6 fixes
 - DC gpu reset fix
 
 amdkfd:
 - Fix return value
 - CU occupancy for GFX 11
 - CU occupancy for GFX 12/12.1
 - Queue bounds checking fix
 - SVM fixes
 - CRIU bounds checking fix
 
 radeon:
 - iMac display fix
 
 xe:
 - error message cleanups
 - i2c global register definitions as dependency for xe/i2c fixes
 - Media workardound
 - Add CCS to gt_idle debugfs print
 - Page fault related fix
 - i2c related fixes
 - System Controller mailbox bit fix
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEEKbZHaGwW9KfbeusDHTzWXnEhr4FAmqR+2wACgkQDHTzWXnE
 hr5VPRAAhJpCnUEOUnhiBRfQB3lqHuKV4N9XQGVoaAZHYLxNkZD6I99ScpIznEr9
 sHG0ViBqz2PHyM2XoJzPZDzm8Us0moVUMMdV56IH7h11l8E7Az2Sd/Ji+AQvZEBT
 /qh9Py0/fjibfDm0ueMROFRhuD8RA2sJqzkGMZUBvErh+zmEQvkIDkIT6A5RpHD8
 B3XEGN+UCxPBzCnKNixyNDgY2i4ipFAe0MDj9+Mh0b9BM9BoV8+Eb7sjkBz+ROMH
 tl57Mjjd37FaYM9MgtEt9m7eOBf266V9Xb9tbIfqShwO1aZa0Vfzuih/3Ck53Nwc
 VkwepP7NHZZKFHIxFgcRCVjzyA3HpZJmLot8YYOyZDJOG6KKp2X0ZUFBog5Uiv8o
 7exd95FLUtIsnUtmLxlermOYJwrokgcVoigcalhLCB2+KZ5/BznutzcCSvrd8vI2
 LzEGnLMgzuEKeOmiWZjagID51TYwHfPogULUlwWT4XB62dKih7/uselCObj4m/Lc
 kRSbiXWz1pxisfiFRsK2GECwsbEb/8qOYgSOQBgppuPbSWpX+2P4IApomRBesQ8E
 Db+i6hptauOwT0/1ZBo8gkOfb0XIWsjg9iV6pVuUIS80hOlr7Zj1MR7mMrWgL0nM
 Chs4/Nq8jWU1ESbmKPBINIXCGOGuev4lJO/pBjfySLpTUhWOQcw=
 =wbEZ
 -----END PGP SIGNATURE-----

Merge tag 'drm-next-2026-08-29' of https://gitlab.freedesktop.org/drm/kernel

Pull more drm updates from Dave Airlie:
 "As mentioned last week, an msm pull request fell down the side of the
  couch or whatever the email equivalent of that is. This has the msm
  next stuff + the usual fixes for amd/intel.

  core:
   - use drm_warn instead of warn

  msm:
   - Bindings:
      - Added Shikra support
      - Document a840, a704, a722
   - Core:
      - Use drm_client buffers for fbdev emulation
      - teardown fixes
      - ARM32 DMA fixup
      - Remove objects from evict list when re-validated
      - Bunch of corner case and error path fixes
   - DPU:
      - Dropped dev_pm_opp_set_rate(0) preventing burnout
      - Fixed SSPP offsets of Kaanapali
   - DP:
      - Dropped dev_pm_opp_set_rate(0) preventing burnout
      - Cleaned up core code in preparation for MST support
      - Fixed prepare() to let Pipewire continue in case of the unplugged cable
   - GPU:
      - Add support for a704
      - Add support for a722
   - HDMI:
      - Simplifed register access

  amdgpu:
   - eGPU fixes
   - Runtime PM fix
   - UserQ fixes
   - Backlight fix
   - Discovery sysfs fix
   - Reset handling fixes
   - Buffer func handling fix for xgmi
   - VCN boundary check fix
   - DC lut handling fixes
   - MES fixes
   - UVD fix
   - VCE 3 fix
   - Enforce isolation fix
   - HPD fix for VGA/LVDS
   - DML fix
   - DCN 6 fixes
   - DC gpu reset fix

  amdkfd:
   - Fix return value
   - CU occupancy for GFX 11
   - CU occupancy for GFX 12/12.1
   - Queue bounds checking fix
   - SVM fixes
   - CRIU bounds checking fix

  radeon:
   - iMac display fix

  xe:
   - error message cleanups
   - i2c global register definitions as dependency for xe/i2c fixes
   - Media workardound
   - Add CCS to gt_idle debugfs print
   - Page fault related fix
   - i2c related fixes
   - System Controller mailbox bit fix"

* tag 'drm-next-2026-08-29' of https://gitlab.freedesktop.org/drm/kernel: (121 commits)
  drm/xe/sysctrl: Read mailbox phase bit from hardware
  drm/xe/i2c: Keep the i2c controller always enabled
  drm/xe/i2c: Fix the interrupt handling
  i2c: designware: Global register definitions
  drm/xe: Reject page faults from non-fault-mode scratch VMs
  drm/xe/xe_gt_idle: Add CCS to the powergating info print
  drm/xe: Do not apply WA 14025883347 to media 3503
  drm/amd/display: fix dc_lock leak on GPU reset error paths
  drm/amd/display: Fix redundant GPUVMEnable checks in dcn6 flip schedule
  drm/amd/display: Fix wrong bytes-per-pixel value for dml2_422_packed_10
  drm/amdkfd: guard against NULL restore_mqd in CRIU queue restore
  drm/amdgpu/userq: fix lock missing for userq fence error set
  drm/amdkfd: Fix the case that vm range is hole at svm_migrate_copy_to_vram
  drm/amdkfd: Fix error path at svm_migrate_copy_to_ram
  drm/amd/display: Log details when failing to register HPD IRQ
  drm/amd/display: Fix HPD consideration for VGA/LVDS connectors on DCE
  drm/amdgpu: clamp the isolation index for rings outside a partition
  drm/amdkfd: Reject zero-sized AQL queue allocations after size halving
  drm/amdgpu: Fix VCE 3 ring align_mask
  drm/kfd: Add CU occupancy support to GFX12.1
  ...
2026-08-28 16:37:55 -07:00
Vasileios Almpanis
b15b548d52
i2c: core: fix debugfs UAF on adapter removal
i2c_del_adapter() frees the adapter's debugfs directory before it
unregisters the adapter device, but the new_device sysfs attribute
stays writable until device_del(). A write racing with removal still
reaches i2c_device_probe(), which passes the freed adap->debugfs to
debugfs_create_dir() as the new client's parent:

  BUG: KASAN: slab-use-after-free in lookup_noperm_common+0x407/0x430
  Read of size 4 at addr ffff88803ef87810 by task syz.0.61/6090
   lookup_noperm_common+0x407/0x430
   simple_start_creating+0x9c/0x110
   debugfs_start_creating+0xdb/0x1a0
   debugfs_create_dir+0x24/0x350
   i2c_device_probe+0x814/0xbf0

It's technically possible to create a client after i2c_deregister_clients
has run. That client will never be unregistered and make
wait_for_completion hang.

Close the window by removing the new_device attribute at the start of
i2c_del_adapter(). device_remove_file() will drain any clients left.

Fixes: 73febd775b ("i2c: create debugfs entry per adapter")
Reported-by: syzbot+23ad911c819b923238b7@syzkaller.appspotmail.com
Closes: https://syzkaller.appspot.com/bug?extid=23ad911c819b923238b7
Signed-off-by: Vasileios Almpanis <vasilisalmpanis@gmail.com>
Cc: <stable@vger.kernel.org> # v6.8+
Tested-by: syzbot+23ad911c819b923238b7@syzkaller.appspotmail.com
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/20260812-i2c-v2-1-5efaab4c3334@gmail.com
2026-08-28 03:12:01 +02:00
Carlos Song
27c9445be8
i2c: imx-lpi2c: avoid accessing target registers on master-only controllers
Not all LPI2C controller instances implement the Target block.
Since commit 90311787f483 ("i2c: imx-lpi2c: reset controller in
probe stage"), the driver unconditionally resets both the Master
and Target blocks during probe.

On controllers that do not support target mode, accessing the
Target registers triggers an asynchronous SError and prevents the
driver from probing successfully. For example on i.MX8QM:

  SError Interrupt on CPU2, code 0x00000000bf000002 -- SError
  Hardware name: Freescale i.MX8QM MEK (DT)
  pc : lpi2c_imx_probe+0x280/0x594
  lr : lpi2c_imx_probe+0x224/0x594
  Kernel panic - not syncing: Asynchronous SError Interrupt

The VERID register is implemented in the Master block and can be
safely accessed on all controller variants. Its FEATURE field
indicates whether target mode is supported.

Read VERID during probe and use it to determine whether the
Target block is present. Only access Target registers when target
mode is supported and reject target registration requests with
-EOPNOTSUPP otherwise.

Fixes: 90311787f483 ("i2c: imx-lpi2c: reset controller in probe stage")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/20260803032705.2250373-1-carlos.song@oss.nxp.com
2026-08-28 03:00:32 +02:00
Guangshuo Li
f98d498648
i2c: qcom-cci: fix autosuspend cleanup
cci_probe() calls pm_runtime_use_autosuspend(), but the remove path
does not call the matching pm_runtime_dont_use_autosuspend() before
disabling runtime PM.

If the autosuspend delay is set to a negative value while autosuspend
is enabled, the runtime PM core increments usage_count to prevent
runtime suspend. Without undoing the autosuspend setting during
teardown, this reference is not dropped and usage_count remains
unbalanced.

Use devm_pm_runtime_set_active_enabled() to manage the runtime PM
state. Its managed cleanup disables autosuspend and runtime PM and
restores the suspended state on probe failure and driver removal.
Remove the now redundant manual runtime PM cleanup.

This issue was found by manual code inspection.

Fixes: e517526195 ("i2c: Add Qualcomm CCI I2C driver")
Signed-off-by: Guangshuo Li <lgs201920130244@gmail.com>
Cc: <stable@vger.kernel.org> # v5.8+
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/20260812094425.3515179-1-lgs201920130244@gmail.com
2026-08-28 02:52:43 +02:00
Hongbo Yao
77549d01ed
i2c: designware: Enable interrupt mask workaround for HJMC3001
On HJMicro ARM64 servers, the DesignWare I2C controller does not
retrigger a pending interrupt if the interrupt status changes after
the current status bits have been cleared.

The issue is exposed under heavy system load when the corresponding
SPI is routed across sockets to a core in the remote socket. The
interrupt is then lost and the I2C transfer times out.

Enable ACCESS_INTR_MASK for HJMC3001. This toggles DW_IC_INTR_MASK
before returning from the interrupt handler and retriggers any
pending interrupt.

Fixes: 6816ce57c4 ("i2c: designware: Add a new ACPI HID for HJMC01 I2C controller")
Signed-off-by: Hongbo Yao <andy.xu@hj-micro.com>
Cc: <stable@vger.kernel.org> # v6.13+
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/20260826070547.268672-1-andy.xu@hj-micro.com
2026-08-28 02:38:00 +02:00
Kathiravan Thirumoorthy
a4f3fbccb6
i2c: qcom-geni: update frequency table to fix timing parameters
In IPQ5424, to meet the setup and hold timing requirements in the
standard mode, update the frequency table with the values recommended by
HW design team.

Also remove the stray space in the I2C_MAX_FAST_MODE_FREQ entry.

Fixes: 85c3453284 ("i2c: qcom-geni: fix I2C frequency table to achieve accurate bus rates")
Fixes: 506bb2ab00 ("i2c: qcom-geni: Support systems with 32MHz serial engine clock")
Signed-off-by: Kathiravan Thirumoorthy <kathiravan.thirumoorthy@oss.qualcomm.com>
Cc: <stable@vger.kernel.org> # v6.13+
Reviewed-by: Mukesh Savaliya <mukesh.savaliya@oss.qualcomm.com>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/20260812-ipq5424_i2c_scl_updates-v2-1-e09cd39d01d7@oss.qualcomm.com
2026-08-28 02:27:57 +02:00
Heikki Krogerus
874ef9a6f2
i2c: designware: Global register definitions
Moving the register definitions to a global header file
include/linux/designware_i2c.h. That removes the need to
duplicate them in the adaptation layers for this driver
outside of drivers/i2c/busses/. There is at least one of
those in drivers/gpu/drm/xe/xe_i2c.c.

Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Suggested-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Raag Jadav <raag.jadav@intel.com>
Reviewed-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Link: https://patch.msgid.link/20260811121008.1493015-2-heikki.krogerus@linux.intel.com
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
(cherry picked from commit 2ab2fb31411a494e4579dfacda986a2672f80e65)
Signed-off-by: Rodrigo Vivi <rodrigo.vivi@intel.com>
2026-08-27 12:00:16 -04:00
Ahmad Byagowi
385c7af4e3
i2c: mux: Fix channel node leak on adapter add failure
i2c_mux_add_adapter() takes a reference to the Device Tree channel node
before registering the new adapter. If adapter registration fails, the
error path frees the private data without dropping that reference.

Release the channel node before freeing the private data.

Fixes: bc45449b14 ("i2c/of: Automatically populate i2c mux busses from device tree data.")
Signed-off-by: Ahmad Byagowi <ahmadexp@gmail.com>
Cc: <stable@vger.kernel.org> # v3.5+
Acked-by: Peter Rosin <peda@lysator.liu.se>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/b3e46bbee781b3cb4029aca9a71316cc5e36dc17.1787502619.git.ahmadexp@gmail.com
2026-08-26 15:39:36 +02:00
Linus Torvalds
47096fc3d0 i2c for v7.3, part 2
Fixes and cleanups around probe error handling, resource
 management and a minor Rust cleanup.
 
 Drivers:
 - several drivers: drop duplicate IRQ error reporting
 - imx-lpi2c: improve probe initialization and error cleanup
 - mxs: fix DMA channel leak on probe failure
 - ocores: fix clock cleanup on resume failure
 - rcar: handle reset controllers without status support
 
 Muxes:
 - demux-pinctrl: fix OF node leak on allocation failure
 
 Rust:
 - mark trivial I2cAdapter reference-counting methods inline
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQScDfrjQa34uOld1VLaeAVmJtMtbgUCaowtFAAKCRDaeAVmJtMt
 btHCAQCsWbWHyIgqrfHvJqD0IhdB6jc5UB/9Uu1cArF9V4mCVwD/XLkzuBtKDw82
 QAaonKQUp9OaS7TAlZqcmGxMn+yGhg8=
 =ULkr
 -----END PGP SIGNATURE-----

Merge tag 'i2c-7.3-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux

Pull more i2c updates from Andi Shyti:
 "Fixes and cleanups around probe error handling, resource management
  and a minor Rust cleanup.

  Drivers:
   - several drivers: drop duplicate IRQ error reporting
   - imx-lpi2c: improve probe initialization and error cleanup
   - mxs: fix DMA channel leak on probe failure
   - ocores: fix clock cleanup on resume failure
   - rcar: handle reset controllers without status support

  Muxes:
   - demux-pinctrl: fix OF node leak on allocation failure

  Rust:
   - mark trivial I2cAdapter reference-counting methods inline"

* tag 'i2c-7.3-part2' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux:
  i2c: rust: mark I2cAdapter methods as inline
  i2c: rcar: fix reset handling for Gen5
  i2c: mxs: fix DMA channel leak on probe error
  i2c: mux: demux-pinctrl: fix OF node leak on kstrdup failure
  i2c: ocores: Disable clock on failed resume
  i2c: imx-lpi2c: reset controller in probe stage
  i2c: imx-lpi2c: properly unwind resources on probe failure
  i2c: busses: drop redundant dev_err_probe() around irq helpers
2026-08-24 09:07:15 -07:00
Wolfram Sang
7a79b02dd1
i2c: rcar: fix reset handling for Gen5
Missing reset_control_status() support is not Gen5 specific. It depends
on the firmware used, if any. Refactor the code to handle missing
reset_control_status() more generically.

Fixes: 87e713f200 ("i2c: rcar: add R-Car Gen5 support")
Suggested-by: Geert Uytterhoeven <geert+renesas@glider.be>
Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/20260817083046.11935-2-wsa+renesas@sang-engineering.com
2026-08-19 22:07:13 +02:00
Ruoyu Wang
777979e627
i2c: mxs: fix DMA channel leak on probe error
mxs_i2c_probe() requests an exclusive DMA channel before resetting the
controller and registering the I2C adapter. If either later operation
fails, probe returns without releasing the channel because the remove
callback is not invoked after a failed probe.

Use devm_dma_request_chan() so the device core releases the channel on
probe failure and driver detach. Remove the manual release from the
remove callback because the channel is now device-managed.

This issue was found by a static analysis checker and confirmed by
manual source review.

Fixes: 62885f59a2 ("MXS: Implement DMA support into mxs-i2c")
Assisted-by: unnamed:claude-opus-4.8 typestate
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Cc: <stable@vger.kernel.org> # v3.7+
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/20260815151720.3757460-1-ruoyuw560@gmail.com
2026-08-19 21:55:53 +02:00
Linkai Gong
62edb8ca0a
i2c: mux: demux-pinctrl: fix OF node leak on kstrdup failure
of_parse_phandle() takes a reference on the parent node. If a later
devm_kstrdup() fails, err_rollback only releases nodes for indices
0..i-1, so the current node is leaked.

of_node_put() the current parent before rolling back.

Fixes: 7c0195fa9a ("i2c: mux: demux-pinctrl: check the return value of devm_kstrdup()")
Signed-off-by: Linkai Gong <gonglinkai@kylinos.cn>
Cc: <stable@vger.kernel.org> # v6.6+
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/20260813095617.2246320-1-gonglinkai@kylinos.cn
2026-08-19 21:55:53 +02:00
Ruoyu Wang
43eb13f133
i2c: ocores: Disable clock on failed resume
ocores_i2c_resume() enables the controller clock before reinitializing
the hardware. If the clock rate changed while the device was suspended,
ocores_init() may reject the resulting prescaler. The callback then
returns an error with the clock still enabled, while the controller
itself remains disabled.

Disable and unprepare the clock when ocores_init() fails so the failed
resume path balances the successful clk_prepare_enable() call.

This issue was found by a static analysis checker and confirmed by manual
source review.

Fixes: e961a094af ("i2c: ocores: add common clock support")
Signed-off-by: Ruoyu Wang <ruoyuw560@gmail.com>
Reviewed-by: Max Filippov <jcmvbkbc@gmail.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://patch.msgid.link/20260813153155.3953577-1-ruoyuw560@gmail.com
2026-08-19 21:55:52 +02:00
Carlos Song
a4c419356a
i2c: imx-lpi2c: reset controller in probe stage
Reset I2C controller in probe stage to avoid unexpected LPI2C controller
state left from previous stages and hang system boot.

Per the LPI2C reference manual, section 7.1.4 "Controller Control (MCR)"
and 7.1.20 Target Control (SCR), the RST bit (bit 1) description states:

  "The reset takes effect immediately and remains asserted until negated
  by software. There is no minimum delay required before clearing the
  software reset."

Therefore, it is safe to write 0 to MCR and SCR immediately after
asserting the RST bit without any additional delay.

Signed-off-by: Carlos Song <carlos.song@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260716071957.2670263-3-carlos.song@oss.nxp.com
2026-08-19 21:55:52 +02:00
Carlos Song
cbd043b00e
i2c: imx-lpi2c: properly unwind resources on probe failure
When probe fails at devm_clk_rate_exclusive_get() or clk_get_rate(),
which occur before runtime PM is initialized, the clocks enabled by
clk_bulk_prepare_enable() are never disabled.

When probe fails after runtime PM is initialized, the previous error
path called pm_runtime_put_sync(), which triggers the runtime suspend
callback. However, due to different clock management strategies on
different SoCs[1] (to avoid deadlocks between the global prepare_lock
and runtime PM), the callback may only disable clocks without
unpreparing them, causing an incomplete unwind.

Introduce a new error label 'clk_disable' to explicitly invoke
clk_bulk_disable_unprepare(). Replace pm_runtime_put_sync() with the
sequence of pm_runtime_disable(), pm_runtime_set_suspended() and
pm_runtime_put_noidle() to bypass the runtime suspend callback during
error recovery. During the LPI2C driver probe phase, clock APIs are
used exclusively to manage clocks. Once probing succeeds, clock
management is handed over to the runtime PM core.

[1] https://lore.kernel.org/all/20251125084718.2156168-1-carlos.song@nxp.com/

Signed-off-by: Carlos Song <carlos.song@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260716071957.2670263-2-carlos.song@oss.nxp.com
2026-08-19 21:55:52 +02:00
Pei Xiao
d1f112e2fa
i2c: busses: drop redundant dev_err_probe() around irq helpers
platform_get_irq(), devm_request_irq() and devm_request_threaded_irq()
already print an error message via dev_err_probe() on failure, so
wrapping their return value with another dev_err_probe() results in
duplicate error output.

Drop these redundant dev_err_probe() calls across i2c bus drivers
and return the error code directly instead.

Signed-off-by: Pei Xiao <xiaopei01@kylinos.cn>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/aea09858af6be39497325e2560267771ed62e6b0.1784537126.git.xiaopei01@kylinos.cn
2026-08-19 21:55:51 +02:00
Linus Torvalds
59e6295fac Driver core changes for 7.3-rc1
- container_of:
 
   - Apply typeof_member(), remove the local __mptr variable to eliminate
     variable shadowing warnings on nested container_of() calls, and remove
     unnecessary parentheses.
 
 - core:
 
   - Add driver name to probe debug print for initcall_debug.
 
   - Avoid repeatedly printing the same 'Fixed dependency cycle' log.
 
   - Unwind device_add() on attribute creation failure in
     attribute_container_add_class_device().
 
   - Remove statistics group if encryption group creation fails in
     transport_add_class_device().
 
 - debugfs:
 
   - Fix lockdown check for mmap_prepare().
 
   - Warn if file creation failed due to uninitialized debugfs.
 
 - device property:
 
   - Implement fw_devlink support for software nodes by adding
     software_node_add_links(), which creates fwnode links from DEV_PROP_REF
     properties to enable automatic probe ordering. Add kunit-managed fwnode
     helpers and test coverage.
 
   - Fix infinite loop in fwnode_for_each_child_node() when the secondary fwnode
     has more than one child. Add test cases.
 
   - Fix out-of-bounds access in software_node_get_reference_args() when called
     with index -1 (UINT_MAX).
 
   - Refactor to use RAII approach with __free().
 
   - Add Bartosz Golaszewski as software node reviewer.
 
 - firmware loader:
 
   - Fix race where a sysfs fallback request can complete before being queued as
     pending, leading to a use-after-free on the next fallback request.
 
   - Reject 0-size built-in firmware and fail the build on empty firmware files
     in CONFIG_EXTRA_FIRMWARE.
 
 - kobject:
 
   - Provide __KOBJ_ATTR() and __KOBJ_ATTR_RO/WO() initialization macros and
     allow the constification of kobject attributes, enabling them to reside in
     read-only memory.
 
 - platform:
 
   - Provide platform_device_set_of_node(), platform_device_set_fwnode(), and
     platform_device_set_of_node_from_dev() helpers that encapsulate firmware
     node reference counting for dynamically allocated platform devices. Convert
     all in-tree users that manually assigned dev.of_node or dev.fwnode, fixing a
     pre-existing refcount bug in powermac.  Switch to counting references of all
     firmware node types, not only OF nodes.
 
   - Unify the release path for dynamically allocated platform devices by
     removing platform_device_release_full(). Amend the fwnode setter API
     contract to warn if a primary software node is overwritten. Add KUnit tests
     for correct software node removal on device unregistration.
 
 - Rust:
 
   - Auxiliary:
 
     - Add registration_data_with() closure-based API for invariant ForLt types.
 
   - Debugfs:
 
     - Migrate BinaryWriter and BinaryReaderMut trait requirements from
       kernel::transmute traits to zerocopy traits.
 
   - Device:
 
     - Add BoundInternal device context and InternalBoundContext trait for bus
       abstractions that need internal access to a bound device.
 
     - Make the lifetime on Core and CoreInternal invariant to prevent coercion
       to shorter lifetimes.
 
   - Devres:
 
     - Fix race between concurrent revokers where the losing revoker could return
       before the winning revoker finished dropping the inner data, causing
       use-after-free.
 
     - Ensure revocation is complete before the device finishes unbinding by
       making the synchronization bidirectional.
 
     - Add DevresLt<F: ForLt>, a wrapper around Devres that shortens 'static back
       to the caller's borrow scope. Implement ForLt and CovariantForLt for Bar,
       IoMem, and ExclusiveIoMem.
 
   - Driver:
 
     - Switch from index-based to pointer-based device ID info lookup, storing
       static references in driver_data. Centralize device ID handling in
       device_id.rs, removing the open-coded ACPI/OF matching logic and duplicate
       ID table from driver.rs.
 
   - I/O:
 
     - Make I/O regions typed (with a dynamically-sized Region type for the
       existing untyped case), create view types representing subregions of a
       mapped I/O region, and add io_project!() for safely creating subviews.
 
     - Split Io into a base trait (IoBase) and an extension trait (Io) with a
       blanket implementation, preventing implementers from overriding provided
       methods that unsafe code relies on.
 
     - Add a SysMem backend for shared system memory with volatile access, and
       make Coherent implement Io via an I/O view type.  Add IoSysMap as sum type
       of Mmio and SysMem. Add copying methods (memcpy_{from,to}io()) and
       read_val()/write_val() for typed access.
 
     - Replace dma_read!()/dma_write!() with io_read!()/io_write!() for
       primitives and copying methods for aggregates; drop the old macros.
       Convert nova-core to use I/O projection.
 
     - Fix internal shortcut rule dispatch in the register!() macro, remove
       unused rule arguments, and use path fragments for alias destinations.
 
   - IRQ:
 
     - Make irq::Registration compatible with lifetime-bound drivers by
       removing the 'static bound on Handler/ThreadedHandler and
       replacing Devres<RegistrationInner> with direct
       request_irq()/free_irq() calls.  Handlers can now directly own
       lifetime-bound device resources.
 
   - PCI:
 
     - Convert IrqVectorRegistration to a lifetime-annotated owning type,
       giving drivers explicit control over the allocation lifetime.
       IrqVector embeds a resolved IrqRequest, making the conversion
       infallible. Remove the redundant
       request_irq()/request_threaded_irq() wrappers from pci::Device.
 
     - Add pci_irq_type() C helper and expose it via irq_type() on
       IrqVectorRegistration and IrqVector, returning PCI_IRQ_MSIX, PCI_IRQ_MSI,
       or PCI_IRQ_INTX.
 
     - Mark pci::Device refcount methods inline.
 
   - Serdev:
 
     - Add Rust abstractions for the serial device bus, including serdev::Driver
       trait, serdev::Device wrapping struct serdev_device, and serdev::Adapter
       implementing RegistrationOps.  Includes a sample driver. Markus Probst
       takes over as serdev maintainer for both C and Rust code.
 
   - Misc:
 
     - Split ForLt into a base trait (providing the Of<'a> GAT) and an unsafe
       CovariantForLt subtrait guaranteeing covariance, enabling invariant types
       (e.g. those containing Mutex<&'bound T>) to participate in the ForLt
       abstraction.
 
     - Fix Coherent read past EOF returning -ERANGE instead of zero.
 
     - Fix firmware example UB by avoiding null-pointer ARef.
 
 - misc:
 
   - Avoid iattr allocation in kernfs listxattr by using kernfs_iattrs_noalloc().
   - Unregister SoC bus on early device registration failure.
   - Remove unused DMA_FENCE_TRACE Kconfig symbol.
   - Fix /sys/module path in comment.
   - Refactor ISA bus init to remove nested blocks.
   - Remove redundant nodemask clears in numa_init().
   - Add kernel-doc for fwnode_operations and sys_soc.h, mark internal property
     data as private for kernel-doc, and add property.h/fwnode.h to driver-api
     infrastructure docs.
   - Add MAINTAINERS entry for sys_soc.h.
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQS2q/xV6QjXAdC7k+1FlHeO1qrKLgUCaoSPugAKCRBFlHeO1qrK
 LlBrAP958EaYZVyfAsqq0EyHv86ahXKWoDDvkwbRUZA5CfV9tAD/bMWVtPLRYaaq
 eNEZT7p5w3Haezh61H3c5zpuwFNMTA0=
 =VRIa
 -----END PGP SIGNATURE-----

Merge tag 'driver-core-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core

Pull driver core updates from Danilo Krummrich:
 "container_of:

   - Apply typeof_member(), remove the local __mptr variable to
     eliminate variable shadowing warnings on nested container_of()
     calls, and remove unnecessary parentheses

  core:

   - Add driver name to probe debug print for initcall_debug

   - Avoid repeatedly printing the same 'Fixed dependency cycle' log

   - Unwind device_add() on attribute creation failure in
     attribute_container_add_class_device()

   - Remove statistics group if encryption group creation fails in
     transport_add_class_device()

  debugfs:

   - Fix lockdown check for mmap_prepare()

   - Warn if file creation failed due to uninitialized debugfs

  device property:

   - Implement fw_devlink support for software nodes by adding
     software_node_add_links(), which creates fwnode links from
     DEV_PROP_REF properties to enable automatic probe ordering. Add
     kunit-managed fwnode helpers and test coverage

   - Fix infinite loop in fwnode_for_each_child_node() when the
     secondary fwnode has more than one child. Add test cases

   - Fix out-of-bounds access in software_node_get_reference_args() when
     called with index -1 (UINT_MAX)

   - Refactor to use RAII approach with __free()

   - Add Bartosz Golaszewski as software node reviewer

  firmware loader:

   - Fix race where a sysfs fallback request can complete before being
     queued as pending, leading to a use-after-free on the next fallback
     request

   - Reject 0-size built-in firmware and fail the build on empty
     firmware files in CONFIG_EXTRA_FIRMWARE

  kobject:

   - Provide __KOBJ_ATTR() and __KOBJ_ATTR_RO/WO() initialization macros
     and allow the constification of kobject attributes, enabling them
     to reside in read-only memory

  platform:

   - Provide platform_device_set_of_node(), platform_device_set_fwnode(),
     and platform_device_set_of_node_from_dev() helpers that encapsulate
     firmware node reference counting for dynamically allocated platform
     devices

     Convert all in-tree users that manually assigned dev.of_node or
     dev.fwnode, fixing a pre-existing refcount bug in powermac. Switch
     to counting references of all firmware node types, not only OF
     nodes

   - Unify the release path for dynamically allocated platform devices
     by removing platform_device_release_full(). Amend the fwnode setter
     API contract to warn if a primary software node is overwritten. Add
     KUnit tests for correct software node removal on device
     unregistration

  Rust:

   - Auxiliary:
       - Add registration_data_with() closure-based API for invariant
         ForLt types

   - Debugfs:
       - Migrate BinaryWriter and BinaryReaderMut trait requirements
         from kernel::transmute traits to zerocopy traits

   - Device:
       - Add BoundInternal device context and InternalBoundContext trait
         for bus abstractions that need internal access to a bound
         device.
       - Make the lifetime on Core and CoreInternal invariant to prevent
         coercion to shorter lifetimes

   - Devres:
       - Fix race between concurrent revokers where the losing revoker
         could return before the winning revoker finished dropping the
         inner data, causing use-after-free.
       - Ensure revocation is complete before the device finishes
         unbinding by making the synchronization bidirectional.
       - Add DevresLt<F: ForLt>, a wrapper around Devres that shortens
         'static back to the caller's borrow scope. Implement ForLt and
         CovariantForLt for Bar, IoMem, and ExclusiveIoMem

   - Driver:
       - Switch from index-based to pointer-based device ID info lookup,
         storing static references in driver_data. Centralize device ID
         handling in device_id.rs, removing the open-coded ACPI/OF
         matching logic and duplicate ID table from driver.rs

   - I/O:
       - Make I/O regions typed (with a dynamically-sized Region type
         for the existing untyped case), create view types representing
         subregions of a mapped I/O region, and add io_project!() for
         safely creating subviews.
       - Split Io into a base trait (IoBase) and an extension trait (Io)
         with a blanket implementation, preventing implementers from
         overriding provided methods that unsafe code relies on.
       - Add a SysMem backend for shared system memory with volatile
         access, and make Coherent implement Io via an I/O view type.
         Add IoSysMap as sum type of Mmio and SysMem. Add copying
         methods (memcpy_{from,to}io()) and read_val()/write_val() for
         typed access.
       - Replace dma_read!()/dma_write!() with io_read!()/io_write!()
         for primitives and copying methods for aggregates; drop the old
         macros. Convert nova-core to use I/O projection.
       - Fix internal shortcut rule dispatch in the register!() macro,
         remove unused rule arguments, and use path fragments for alias
         destinations

   - IRQ:
       - Make irq::Registration compatible with lifetime-bound drivers
         by removing the 'static bound on Handler/ThreadedHandler and
         replacing Devres<RegistrationInner> with direct
         request_irq()/free_irq() calls. Handlers can now directly own
         lifetime-bound device resources

   - PCI:
       - Convert IrqVectorRegistration to a lifetime-annotated owning
         type, giving drivers explicit control over the allocation
         lifetime. IrqVector embeds a resolved IrqRequest, making the
         conversion infallible. Remove the redundant
         request_irq()/request_threaded_irq() wrappers from pci::Device.
       - Add pci_irq_type() C helper and expose it via irq_type() on
         IrqVectorRegistration and IrqVector, returning PCI_IRQ_MSIX,
         PCI_IRQ_MSI, or PCI_IRQ_INTX.
       - Mark pci::Device refcount methods inline

   - Serdev:
       - Add Rust abstractions for the serial device bus, including
         serdev::Driver trait, serdev::Device wrapping struct
         serdev_device, and serdev::Adapter implementing
         RegistrationOps. Includes a sample driver. Markus Probst takes
         over as serdev maintainer for both C and Rust code

   - Misc:
       - Split ForLt into a base trait (providing the Of<'a> GAT) and an
         unsafe CovariantForLt subtrait guaranteeing covariance,
         enabling invariant types (e.g. those containing Mutex<&'bound T>)
         to participate in the ForLt abstraction.
       - Fix Coherent read past EOF returning -ERANGE instead of zero.
       - Fix firmware example UB by avoiding null-pointer ARef

  misc:
   - Avoid iattr allocation in kernfs listxattr by using
     kernfs_iattrs_noalloc().
   - Unregister SoC bus on early device registration failure.
   - Remove unused DMA_FENCE_TRACE Kconfig symbol.
   - Fix /sys/module path in comment.
   - Refactor ISA bus init to remove nested blocks.
   - Remove redundant nodemask clears in numa_init().
   - Add kernel-doc for fwnode_operations and sys_soc.h, mark
     internal property data as private for kernel-doc, and add
     property.h/fwnode.h to driver-api infrastructure docs.
   - Add MAINTAINERS entry for sys_soc.h"

* tag 'driver-core-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/driver-core/driver-core: (129 commits)
  rust: pci: expose the allocated interrupt type
  PCI: Add pci_irq_type() to query the allocated interrupt type
  rust: pci: remove request_irq() and request_threaded_irq() from Device
  rust: pci: resolve IRQ in index() and embed IrqRequest in IrqVector
  rust: pci: convert IrqVectorRegistration to a lifetime-managed owning type
  kernfs: avoid iattr allocation in listxattr
  rust: serdev: use ThisModule::as_ptr() instead of field access
  ACPI/IORT: use platform_device_set_fwnode()
  ACPI/APMT: use platform_device_set_fwnode()
  firmware_loader: do not queue completed sysfs fallback requests
  rust: pci: Mark Device refcount methods inline
  rust: irq: make Registration compatible with lifetime-bound drivers
  rust: net/phy: remove expansion from doc
  rust: dma: return zero for Coherent reads past EOF
  rust: io: register: use path fragment for alias destination
  rust: io: register: remove unused rule arguments
  rust: io: register: dispatch shortcut rules internally
  MAINTAINERS: add sys_soc.h to DRIVER CORE
  rust: debugfs: remove unsafe blocks from traits impl for Vec
  rust: debugfs: migrate debugfs traits requirements to zerocopy
  ...
2026-08-19 10:42:18 -07:00
Linus Torvalds
abea5c3493 i2c for v7.3
Core and helpers:
 - support bus recovery with single-ended GPIOs
 - acpi: clean up resource handling
 - acpi: force ELAN1300 to 100 kHz
 - algo-bit: allow consumers to skip the optional bus test
 
 Drivers:
 - use generic bus frequency definitions in nomadik,
   octeon-core, microchip-corei2c, k1, davinci and pnx
 - i2c-gpio: support multiple buses sharing the same SCL line
 - qup: propagate clock enable failures
 - spacemit: configure SCL timing and clean up clock handling
 - amd-asf: guard against oversized firmware length
 
 qcom-geni:
 - add tracepoints for bus setup, interrupts and errors
 - use dedicated completion events for abort and reset
 - distinguish address and data NACK handling
 - cancel transfers before falling back to abort
 - simplify runtime PM and resource management
 - refactor resource and serial engine initialization
 
 DT bindings:
 - convert Altera bindings to DT schema
 - convert Axxia bindings to DT schema
 
 New support:
 - R-Car Gen5 and R-Car X5H
 - Axiado AX3005
 - Qualcomm Nord SA8797P
 - Qualcomm SA8255p
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYKAB0WIQScDfrjQa34uOld1VLaeAVmJtMtbgUCaoA//QAKCRDaeAVmJtMt
 bvzYAQDPhRd2O6BruFmCkxKKvlrxZ2AaHQX/ZHLNqLAq/oX4NwD8CSecgva9faf/
 bC+kTGoTMBhje3FEJFufHKe2YtmJdgg=
 =u6az
 -----END PGP SIGNATURE-----

Merge tag 'i2c-7.3-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux

Pull i2c updates from Andi Shyti:
 "The main changes are support for shared SCL lines in i2c-gpio, a
  larger qcom-geni update covering tracing and transfer recovery and
  support for R-Car Gen5.

  The rest is mostly smaller driver, core and DT binding updates.

  Core and helpers:
   - support bus recovery with single-ended GPIOs
   - acpi: clean up resource handling
   - acpi: force ELAN1300 to 100 kHz
   - algo-bit: allow consumers to skip the optional bus test

  Drivers:
   - use generic bus frequency definitions in nomadik, octeon-core,
     microchip-corei2c, k1, davinci and pnx
   - i2c-gpio: support multiple buses sharing the same SCL line
   - qup: propagate clock enable failures
   - spacemit: configure SCL timing and clean up clock handling
   - amd-asf: guard against oversized firmware length

  qcom-geni:
   - add tracepoints for bus setup, interrupts and errors
   - use dedicated completion events for abort and reset
   - distinguish address and data NACK handling
   - cancel transfers before falling back to abort
   - simplify runtime PM and resource management
   - refactor resource and serial engine initialization

  DT bindings:
   - convert Altera bindings to DT schema
   - convert Axxia bindings to DT schema

  New support:
   - R-Car Gen5 and R-Car X5H
   - Axiado AX3005
   - Qualcomm Nord SA8797P
   - Qualcomm SA8255p"

* tag 'i2c-7.3-part1' of git://git.kernel.org/pub/scm/linux/kernel/git/andi.shyti/linux: (33 commits)
  i2c: core: support recovery for single-ended GPIOs
  i2c: rcar: add R-Car Gen5 support
  dt-bindings: i2c: rcar-i2c: Document R-Car X5H support
  i2c: i2c-gpio: Enhance driver for buses with shared SCL
  i2c: algo: bit: Allow to skip bit test
  i2c: qcom-geni: Add trace events for Qualcomm GENI I2C driver
  i2c: qcom-geni: trace: Add trace events for Qualcomm GENI I2C
  i2c: qup: Propagate clock enable failures
  i2c: qcom-geni: distinguish address-phase and data-phase NACK
  i2c: qcom-geni: use dedicated completions for abort and reset events
  i2c: qcom-geni: use cancel command before abort on transfer timeout
  dt-bindings: i2c: cdns: add Axiado AX3005 I2C variant
  i2c: qcom-geni: Use devm_pm_runtime_enable() for PM management
  dt-bindings: i2c: qcom,sa8255p-geni-i2c: Add compatible for Nord SA8797P
  i2c: nomadik: Use generic definitions for bus frequencies
  i2c: octeon-core: Use generic definitions for bus frequencies
  i2c: microchip-corei2c: Use generic definitions for bus frequencies
  i2c: k1: Use generic definitions for bus frequencies
  i2c: davinci: Use generic definitions for bus frequencies
  i2c: pnx: Use generic definitions for bus frequencies
  ...
2026-08-19 09:23:13 -07:00
Linus Torvalds
0d508f1745 ACPI support updates for 7.3-rc1
- Eliminate struct acpi_driver whose users have all been converted to
    bind to platform devices or auxiliary devices and set the "no power
    management" flag for all struct acpi_device objects (Rafael Wysocki)
 
  - Avoid complaints regarding missing _OSC features on platforms where
    OSC_CAPABILITIES_MASK_ERROR is set in _OSC error bits even though all
    of the requested features are actually acknowledged (Rafael Wysocki)
 
  - Avoid printing confusing _OSC messages for non-PCIe host bridges
    without _OSC which is a valid configuration (Kazuma Kondo)
 
  - Use correct region struct for BERT region size check and properly
    map BERT and CCEL data to their ACPI tables (Thomas Renninger)
 
  - Add acpi_device_clear_deps(), refactor RISC-V interrupt controller
    management code to extract generic code from it into the common ACPI
    IRQ code, and enable GICv5 IWB ACPI probe ordering detection on ARM
    on top of that (Lorenzo Pieralisi)
 
  - Stop using acpi_device_name() in the PNP core, stop setting
    acpi_device_name/class() in the Xen variant of the ACPI PAD
    (Processor Aggregator Device) driver, and make the Loongarch
    laptop driver stop setting acpi_device_class() (Rafael Wysocki)
 
  - Fix issues related to the desired_perf register access in the ACPI
    CPPC library and update it to avoid unnecessary overhead (Christian
    Loehle)
 
  - Simplify acpi_get_pci_dev() with the help of a mutex guard, introduce
    acpi_dev_get_pci_dev() for code that has a struct ACPI device for
    which it wants to get the struct pci_dev pointer of the associated
    PCI device, and use it in the ACPI video bus driver (Rafael Wysocki)
 
  - Avoid registering platform devices with resource overlaps in the ACPI
    core device enumeration code (Rafael Wysocki)
 
  - Clean up the list of included header files in the NHLT table parser
    and validate the table and record lengths in the FPDT parser (Andy
    Shevchenko and Pengpeng Hou)
 
  - Unregister the cpufreq notifier on init failure in the ACPI processor
    driver (Can Peng)
 
  - Validate MADT IOAPIC entry bounds during IOAPIC hotplug lookup in the
    ACPI processor driver (Pengpeng Hou)
 
  - Avoid _REG disconnect on probe deferrals related to GPIO IRQ in the
    ACPI EC driver (Zhu Ling)
 
  - Update kerneldoc comments of two structures in the ACPI bus type code
    to use correct struct member names to avoid warnings (Randy Dunlap)
 
  - Use a correct function parameter name in kernel-doc in the ACPI fan
    driver (Randy Dunlap)
 
  - Update ACPI fan IDs to follow modern style and clean up header file
    inclusions in the ACPI fan driver (Andy Shevchenko)
 
  - Use devm_acpi_install_notify_handler() to replace a custom open-coded
    devres-based management of an ACPI notify handler in the ACPI fan
    driver (Rafael Wysocki)
 
  - Adjust charging status validation check in the ACPI battery driver to
    avoid incorrect status reporting (Rafael Wysocki)
 
  - Merge consecutive battery notifications in the ACPI battery driver to
    reduce the pressure on STA, _BST and _BIX/_BIF ACPI control methods
    and make that driver use kstrtoul() instead of sscanf("%lu\n") (Rong
    Zhang)
 
  - Sanitise model_number in the ACPI battery driver by dropping
    unprintable characters (Kate Hsuan)
 
  - Remove a node_set() call that is redundant from
    acpi_parse_memory_affinity() (Sang-Heon Jeon)
 
  - Prevent kernel-doc warnings by converting 2 function description
    comments to kernel-doc format (Randy Dunlap)
 
  - Fix docs build error in the ACPI admin-guide documentation (Randy
    Dunlap)
 
  - Replace __get_free_page() with kmalloc() in the code handling ACPI
    NVS memory during system suspend/resume (Mike Rapoport)
 
  - Fix card device cleanup on registration failure in the core PNP
    code (Yuho Choi)
 
  - Drop an unused assignment of pnp_device_id driver data (Uwe
    Kleine-König)
 
  - Clear driver_data on all paths that free acpi_pci_root in
    acpi_pci_root_add() (Chen Pei)
 
  - Add locking around evaluation of ACPI control methods in the ACPI TAD
    driver to avoid race conditions (Rafael Wysocki)
 
  - Handle repeated SEA error storms in APEI (Junhao He)
 
  - Fix ERST timeout unit conversion in APEI (Nirmoy Das)
 
  - Fix ARM section length accounting after header in the ACPI APEI GHES
    driver (TanZheng)
 
  - Mark ghes_in_nmi_spool_from_list() as maybe unused (Rui Qi)
 
  - Introduce helper function acpi_dev_is_video_device() and use it in
    the core ACPI device enumeration code, in the ACPI video bus driver,
    in the ACPI support code for I2C, in the PCI VGA driver, and in the
    x86 platform thinkpad_acpi driver (Andy Shevchenko)
 
  - Add a quirk to use the native backlight on Acer Nitro AN515-46 to the
    ACPI video bus driver (Marcos Paulo Medeiros)
 
  - Release PCI device reference after lookup in video_detect_portege_r100()
    in the ACPI video bus driver (Yuho Choi)
 -----BEGIN PGP SIGNATURE-----
 
 iQFGBAABCAAwFiEEcM8Aw/RY0dgsiRUR7l+9nS/U47UFAmp+DIkSHHJqd0Byand5
 c29ja2kubmV0AAoJEO5fvZ0v1OO13jQH/2+Xfd7gzUh7to1lIqulfBMc52i3Cp9w
 RC3HUc+/sJV93MO7Lbsje6s+6199citBPaqG9cwl5E+jdsvOOqg2aCy14nYKGRNs
 QLr0TnDMO/mOl0OR2zOLlW6To9W59GtdQ3RkJAqJhKKZakNfvqRCOj5PZhjN8jb7
 XOhNxkS+rIBreCsf14t51K8KQUsqhlXqeReRPyzCYLaxVNwCzGNyVTjSKNGAYRAR
 VcMdjWMczLz6WpWLEVK3EwPhxF385ildUw3cky66l5zmLbxJIBkz9P5YziuyUSi2
 5udUpOXumiEbZwlewpY+kGhL7Jd0cJu5KDt0zM0Rt4OwPIj/ootyyz0=
 =nNPc
 -----END PGP SIGNATURE-----

Merge tag 'acpi-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm

Pull ACPI support updates from Rafael Wysocki:
 "The most significant change here is the elimination of struct
  acpi_driver that has no more users in the tree now along with some
  documentation related to it, and a follow-up update to set the "no PM"
  flag for all ACPI devices that are now only going to play the role of
  other devices' "companions" (in analogy with DT nodes).

  There is also a significant update of irqchip code related to ACPI
  done in order to enable GICv5 IWB ACPI probe ordering detection on
  ARM, which involves RISC-V interrupt controller management code
  refactoring to extract generic code from it into the common ACPI IRQ
  code.

  The rest is mostly fixes, including some fallout of the _OSC handling
  rework in 7.0, ACPI CPPC library fixes, a workaround for registering
  ACPI platform devices with overlapping I/O or memory resources, an
  ACPI EC driver fix related to probe deferral on platforms using
  HW-reduced ACPI, two ACPI battery driver fixes and a workaround for
  handling model numbers with unprintable characters in it, probe error
  cleanup and driver unload code path fixes, hardware error reporting
  fixes, documentation fixes, and assorted code cleanups all over.

  Specifics:

   - Eliminate struct acpi_driver whose users have all been converted to
     bind to platform devices or auxiliary devices and set the "no power
     management" flag for all struct acpi_device objects (Rafael
     Wysocki)

   - Avoid complaints regarding missing _OSC features on platforms where
     OSC_CAPABILITIES_MASK_ERROR is set in _OSC error bits even though
     all of the requested features are actually acknowledged (Rafael
     Wysocki)

   - Avoid printing confusing _OSC messages for non-PCIe host bridges
     without _OSC which is a valid configuration (Kazuma Kondo)

   - Use correct region struct for BERT region size check and properly
     map BERT and CCEL data to their ACPI tables (Thomas Renninger)

   - Add acpi_device_clear_deps(), refactor RISC-V interrupt controller
     management code to extract generic code from it into the common
     ACPI IRQ code, and enable GICv5 IWB ACPI probe ordering detection
     on ARM on top of that (Lorenzo Pieralisi)

   - Stop using acpi_device_name() in the PNP core, stop setting
     acpi_device_name/class() in the Xen variant of the ACPI PAD
     (Processor Aggregator Device) driver, and make the Loongarch laptop
     driver stop setting acpi_device_class() (Rafael Wysocki)

   - Fix issues related to the desired_perf register access in the ACPI
     CPPC library and update it to avoid unnecessary overhead (Christian
     Loehle)

   - Simplify acpi_get_pci_dev() with the help of a mutex guard,
     introduce acpi_dev_get_pci_dev() for code that has a struct ACPI
     device for which it wants to get the struct pci_dev pointer of the
     associated PCI device, and use it in the ACPI video bus driver
     (Rafael Wysocki)

   - Avoid registering platform devices with resource overlaps in the
     ACPI core device enumeration code (Rafael Wysocki)

   - Clean up the list of included header files in the NHLT table parser
     and validate the table and record lengths in the FPDT parser (Andy
     Shevchenko and Pengpeng Hou)

   - Unregister the cpufreq notifier on init failure in the ACPI
     processor driver (Can Peng)

   - Validate MADT IOAPIC entry bounds during IOAPIC hotplug lookup in
     the ACPI processor driver (Pengpeng Hou)

   - Avoid _REG disconnect on probe deferrals related to GPIO IRQ in the
     ACPI EC driver (Zhu Ling)

   - Update kerneldoc comments of two structures in the ACPI bus type
     code to use correct struct member names to avoid warnings (Randy
     Dunlap)

   - Use a correct function parameter name in kernel-doc in the ACPI fan
     driver (Randy Dunlap)

   - Update ACPI fan IDs to follow modern style and clean up header file
     inclusions in the ACPI fan driver (Andy Shevchenko)

   - Use devm_acpi_install_notify_handler() to replace a custom
     open-coded devres-based management of an ACPI notify handler in the
     ACPI fan driver (Rafael Wysocki)

   - Adjust charging status validation check in the ACPI battery driver
     to avoid incorrect status reporting (Rafael Wysocki)

   - Merge consecutive battery notifications in the ACPI battery driver
     to reduce the pressure on STA, _BST and _BIX/_BIF ACPI control
     methods and make that driver use kstrtoul() instead of
     sscanf("%lu\n") (Rong Zhang)

   - Sanitise model_number in the ACPI battery driver by dropping
     unprintable characters (Kate Hsuan)

   - Remove a node_set() call that is redundant from
     acpi_parse_memory_affinity() (Sang-Heon Jeon)

   - Prevent kernel-doc warnings by converting 2 function description
     comments to kernel-doc format (Randy Dunlap)

   - Fix docs build error in the ACPI admin-guide documentation (Randy
     Dunlap)

   - Replace __get_free_page() with kmalloc() in the code handling ACPI
     NVS memory during system suspend/resume (Mike Rapoport)

   - Fix card device cleanup on registration failure in the core PNP
     code (Yuho Choi)

   - Drop an unused assignment of pnp_device_id driver data (Uwe
     Kleine-König)

   - Clear driver_data on all paths that free acpi_pci_root in
     acpi_pci_root_add() (Chen Pei)

   - Add locking around evaluation of ACPI control methods in the ACPI
     TAD driver to avoid race conditions (Rafael Wysocki)

   - Handle repeated SEA error storms in APEI (Junhao He)

   - Fix ERST timeout unit conversion in APEI (Nirmoy Das)

   - Fix ARM section length accounting after header in the ACPI APEI
     GHES driver (TanZheng)

   - Mark ghes_in_nmi_spool_from_list() as maybe unused (Rui Qi)

   - Introduce helper function acpi_dev_is_video_device() and use it in
     the core ACPI device enumeration code, in the ACPI video bus
     driver, in the ACPI support code for I2C, in the PCI VGA driver,
     and in the x86 platform thinkpad_acpi driver (Andy Shevchenko)

   - Add a quirk to use the native backlight on Acer Nitro AN515-46 to
     the ACPI video bus driver (Marcos Paulo Medeiros)

   - Release PCI device reference after lookup in
     video_detect_portege_r100() in the ACPI video bus driver (Yuho
     Choi)"

* tag 'acpi-7.3-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/rafael/linux-pm: (61 commits)
  ACPI: scan: Avoid registering platform devices with resource overlaps
  ACPI: APEI: Handle repeated SEA error storms
  ACPI: APEI: Fix ERST timeout unit conversion
  ACPI: APEI: GHES: fix ARM section length accounting after header
  ACPI: video: Release PCI device reference after lookup
  ACPI: PCI: Avoid misleading _OSC messages for non-PCIe host bridges without _OSC
  ACPI: TAD: Add locking around AML evaluations
  ACPI: video: force native backlight on Acer Nitro AN515-46
  ACPI: CPPC: Evaluate performance-control PCC use once
  ACPI: CPPC: Avoid locking standalone full-width registers
  ACPI: CPPC: Avoid unnecessary reads for full-width writes
  ACPI: CPPC: Stop reading desired_perf in cppc_get_perf()
  ACPI: CPPC: Skip desired_perf read in cppc_get_perf()
  ACPI: CPPC: Reject desired_perf reads on _CPC revision 4+
  ACPI: processor: Unregister cpufreq notifier on init failure
  ACPI: bus: Avoid confusing complaints regarding missing _OSC features
  ACPI: battery: Adjust charging status validation check
  ACPI: pmtmr: Convert to kernel-doc format
  ACPI: bus: Use correct struct member names
  ACPI: fan: Use correct function parameter name in kernel-doc
  ...
2026-08-18 08:29:30 -07:00
Linus Torvalds
d5b95e612c Revert "i2c: designware: defer probe if child GpioInt controllers are not bound"
This reverts commit 0a4bb2abc3.

This was reported to break the touchpad on at least some Thinkpads, and
while the revert has hit the i2c tree, it hasn't hit mine.  So I'm
reverting it directly just to have this resolved for the imminent 7.2
release.

Reported-by: Thorsten Leemhuis <linux@leemhuis.info>
Link: https://lore.kernel.org/all/b4a4eadb-282f-464c-843a-19d415a34d0c@leemhuis.info/
Cc: Mario Limonciello <mario.limonciello@amd.com>
CC: Hardik Prakash <hardikprakash.official@gmail.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2026-08-16 10:40:14 -07:00
Rafael J. Wysocki
79ba234b39 Merge branch 'acpi-video'
Merge updates related to the ACPI video bus driver for 7.3-rc1:

 - Introduce helper function acpi_dev_is_video_device() and use it in
   the core ACPI device enumeration code, in the ACPI video bus driver,
   in the ACPI support code for I2C, in the PCI VGA driver, and in the
   x86 platform thinkpad_acpi driver (Andy Shevchenko)

 - Add a quirk to use the native backlight on Acer Nitro AN515-46 to the
   ACPI video bus driver (Marcos Paulo Medeiros)

 - Release PCI device reference after lookup in video_detect_portege_r100()
   in the ACPI video bus driver (Yuho Choi)

* acpi-video:
  ACPI: video: Release PCI device reference after lookup
  ACPI: video: force native backlight on Acer Nitro AN515-46
  platform/x86: thinkpad_acpi: Convert to use acpi_dev_is_video_device() helper
  PCI/VGA: Convert to use acpi_dev_is_video_device() helper
  i2c: acpi: Convert to use acpi_dev_is_video_device() helper
  ACPI: video: Convert to use acpi_dev_is_video_device() helper
  ACPI: scan: Convert to use acpi_dev_is_video_device() helper
  ACPI: utils: Introduce acpi_dev_is_video_device() helper
2026-08-10 12:46:29 +02:00
Danilo Krummrich
dbaafe9cc5 Linux 7.2-rc7
-----BEGIN PGP SIGNATURE-----
 
 iQFSBAABCgA8FiEEq68RxlopcLEwq+PEeb4+QwBBGIYFAmp49yoeHHRvcnZhbGRz
 QGxpbnV4LWZvdW5kYXRpb24ub3JnAAoJEHm+PkMAQRiG1WIH/1SD1rNIb4Prf0C7
 Rk9Hz0IZ3uYNe1Xi+Ozv3zQUuLB6d7ewl9e4zyHHYT4eeIKvBZv9jtIF3QH4ty5X
 JB9Gy62WICtqIEkzzt2bkcV1byFmKz2+BLv04fgcyTXEGOEByCDiZ3/N3kSJOqvg
 YxsGOmKkQSTavFLSe96Gj2pgchJqZ6j3qucDO6GrPOo8depP2kfzxfaJbXix0HEZ
 ln08X9hgZDxy4I98PmSaaJsK2R/i6T6jQdA3i8DnSbbyNhLn+3FK6gkP08ZEpaor
 82WwJf+MVCLHXLYDy0aYOUDHpkNkkJWOj45A2Hv9JkOupGcUpyPGr82l4yh/MrxC
 +kM28xs=
 =rIbd
 -----END PGP SIGNATURE-----

Merge tag 'v7.2-rc7' into driver-core-next

We need the driver-core fixes in here as well to build on top of.

Signed-off-by: Danilo Krummrich <dakr@kernel.org>
2026-08-10 01:20:05 +02:00
Jie Li
18ca2ce160
i2c: core: support recovery for single-ended GPIOs
Currently, i2c_init_recovery() only assigns the set_sda/set_scl
hooks if gpiod_get_direction() returns GPIO_LINE_DIRECTION_OUT.

This logic fails on certain SoC controllers where open-drain lines
in a high-impedance state are physically reported as inputs. This
leads to a "deadlock" where the I2C core refuses to assign the
recovery hooks because it incorrectly assumes the pins are
input-only, even though they are fully capable of driving the bus
low for recovery.

Update the recovery initialization to use the new
gpiod_is_single_ended() helper. If a GPIO is configured as
open-drain or open-source in the firmware, it is safe to assume
it can be used for bus recovery, even if the current hardware
direction is reported as input.

Signed-off-by: Jie Li <jie.i.li@nokia.com>
Reviewed-by: Linus Walleij <linusw@kernel.org>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260511113726.49041-3-jie.i.li@nokia.com
2026-07-29 23:38:13 +02:00
Wolfram Sang
87e713f200
i2c: rcar: add R-Car Gen5 support
To support the next generation of R-Car SoCs, we need to skip polling
the reset status. SCMI doesn't support it and the firmware must take
care of this anyhow. Other than that, the driver works fine as-is.

Signed-off-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260727122546.4232-6-wsa+renesas@sang-engineering.com
2026-07-29 22:29:30 +02:00
Markus Stockhausen
645c3d7d07
i2c: i2c-gpio: Enhance driver for buses with shared SCL
Some lower end hardware (especially Realtek based switches) are
designed with multiple I2C buses that share a single clock line.
E.g. the D-Link DGS-1250-28X realizes 4 I2C SFP busses with 5 GPIOs.

Enhance the i2c-gpio driver so it can handle such hardware designs.

- Detect shared SCL GPIOs that are used by multiple I2C buses in the
  devicetree by using a "unique identifier". This is basically the
  phandle and all additional cells.

- The first probing instance allocates and requests the shared SCL
  GPIO with an associated rt_mutex. Subsequent instances detect the
  existing entry via the identifier and increment a reference count
  to reuse the descriptor.

- All data transfers are serialized via custom lock_ops that handle
  both the standard adapter bus lock and the shared SCL mutex. This
  ensures mutual exclusion across adapters sharing the clock line.

- This shared SCL detection works only for dts based systems where
  the GPIO node has at least one cell (usually the pin). GPIOs in
  legacy systems without devicetree will be handled individudally
  as before.

This patch was successfully tested on Linksys LGS310C that has two
SFP slots with two GPIO based I2C buses that share a single SCL.
Test environment: OpenWrt snapshot ported to kernel 6.19.14
including CONFIG_GPIO_SHARED=y and CONFIG_GPIO_SHARED_PROXY=y.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Tested-by: Sander Vanheule <sander@svanheule.net>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260714162915.3018703-3-markus.stockhausen@gmx.de
2026-07-29 20:51:24 +02:00
Markus Stockhausen
a40498ebe1
i2c: algo: bit: Allow to skip bit test
An I2C bus can make use of shared resources. E.g. two GPIO based buses
that share a single SCL line. To synchronize access to the bus the driver
might use locking with the help of i2c_lock_operations(). While this
works for normal transfers it is not available during initialization.

Especially if i2c-algo-bit module is loaded with parameter bit_test
it will issue some basic sanity checks that will access the bus without
locking. This might interfere badly with concurrent transfers. Even
if these are well synchronized via locks.

Allow the consumer of an algorithm to override if the bit_test is allowed
or not. For this add a new boolean attribute named skip_bit_test to
i2c_algo_bit_data. If set the test is not run.

Signed-off-by: Markus Stockhausen <markus.stockhausen@gmx.de>
Reviewed-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Tested-by: Wolfram Sang <wsa+renesas@sang-engineering.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260714162915.3018703-2-markus.stockhausen@gmx.de
2026-07-29 20:51:16 +02:00
Praveen Talari
f957616d55
i2c: qcom-geni: Add trace events for Qualcomm GENI I2C driver
Add trace event definitions for the Qualcomm GENI (Generic Interface)
I2C driver. These trace events enable runtime debugging and performance
analysis of I2C operations.

The trace events capture I2C clock configuration, interrupt status and
error code and message.

Reviewed-by: Konrad Dybcio <konrad.dybcio@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/20260703-add-tracepoints-for-qcom-geni-i2c-v2-2-e8bf8b178290@oss.qualcomm.com
2026-07-28 23:51:13 +02:00
Pengpeng Hou
a477626332
i2c: qup: Propagate clock enable failures
The QUP I2C driver treats the core and iface clocks as required
resources, but qup_i2c_enable_clocks() ignores clk_prepare_enable()
failures.  Probe can then continue to register the I2C adapter, and
runtime/system resume can return success, even when a required clock
transition failed.

Make the helper return an error, unwind a partially enabled clock, and
propagate failures from probe and resume paths.

Signed-off-by: Pengpeng Hou <pengpeng@iscas.ac.cn>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260624055237.29977-1-pengpeng@iscas.ac.cn
2026-07-28 23:39:07 +02:00
Wenmeng Liu
b08c9857aa
i2c: qcom-cci: drop custom suspend/resume and rely on runtime PM helpers
cci_resume() unconditionally calls cci_resume_runtime() regardless of
the runtime PM state.

If the device is already runtime-suspended before system suspend,
the clock is re-enabled while runtime_status remains RPM_SUSPENDED.
As a result, pm_request_autosuspend() does not arm the timer,
leaving the clock permanently enabled.

Fixes: e517526195 ("i2c: Add Qualcomm CCI I2C driver")
Signed-off-by: Wenmeng Liu <wenmeng.liu@oss.qualcomm.com>
Cc: <stable@vger.kernel.org> # v5.8+
Reviewed-by: Vladimir Zapolskiy <vladimir.zapolskiy@linaro.org>
Reviewed-by: Konrad Dybcio <konrad.dybcio@oss.qualcomm.com>
Reviewed-by: Loic Poulain <loic.poulain@oss.qualcomm.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260625-cci-v1-1-a100cda673ce@oss.qualcomm.com
2026-07-28 23:34:16 +02:00
Liem
6ac7702b6c
i2c: imx: Cancel hrtimer before clearing slave pointer
In i2c_imx_unreg_slave(), the slave pointer is set to NULL after
disabling interrupts.  However, a pending interrupt might already
have started the hrtimer (i2c_imx_slave_timeout) before the pointer
was cleared.  If the hrtimer fires after i2c_imx->slave is set to
NULL, the timer callback i2c_imx_slave_finish_op() will call
i2c_imx_slave_event() with a NULL slave pointer, which results in a
use-after-free / NULL pointer dereference.

Fix by canceling the hrtimer and waiting for it to complete after
disabling interrupts, before clearing the slave pointer.

Fixes: f7414cd692 ("i2c: imx: support slave mode for imx I2C driver")
Signed-off-by: Liem <liem16213@gmail.com>
Cc: <stable@vger.kernel.org> # v5.11+
Acked-by: Carlos Song <carlos.song@nxp.com>
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260629023829.152651-3-liem16213@gmail.com
2026-07-28 23:24:03 +02:00
Liem
d64ec362c3
i2c: imx: Fix slave registration race and error handling
In i2c_imx_reg_slave(), the slave pointer was assigned before
pm_runtime_resume_and_get().  If pm_runtime_resume_and_get() failed,
the error path returned without clearing i2c_imx->slave, leaving it
non-NULL and causing all subsequent registration attempts to fail
with -EBUSY.

Additionally, because this driver uses a shared IRQ, the interrupt
handler i2c_imx_isr() can execute concurrently and, after acquiring
slave_lock, dereference i2c_imx->slave.  The previous fix attempt
added a lockless i2c_imx->slave = NULL on the error path, but that
could race with the ISR under the lock and still cause a NULL pointer
dereference.

Fix both issues by deferring the assignment of i2c_imx->slave and
i2c_imx->last_slave_event to after a successful resume, and by
performing the assignment inside the slave_lock critical section.
This guarantees that the slave pointer is never left stale on the
error path and is always valid when observed by the interrupt handler.

Fixes: f7414cd692 ("i2c: imx: support slave mode for imx I2C driver")
Signed-off-by: Liem <liem16213@gmail.com>
Cc: <stable@vger.kernel.org> # v5.11+
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Carlos Song <carlos.song@nxp.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260629023829.152651-2-liem16213@gmail.com
2026-07-28 23:23:20 +02:00
Jonas Gorski
98f2e9e6d6
i2c: iproc: reset bus after timeout if START_BUSY is stuck
If a transaction times out, the START_BUSY signal can stay up, and
subsequent transactaction attempts will fail as the bus is still
considered busy.

I can easily trigger this by attempting to read from an address with no
device, e.g. when running i2cdetect. After the first read times out, all
subsequent read attempts return busy.

To get to a working state again, the controller needs to be reset to
clear the START_BUSY signal. So check for START_BUSY still asserted on a
timeout, and do reset in case it is,

This is also done by the original non-upstream iproc-smbus driver
implementation [1].

Works around situations like:

    bcm-iproc-2c 1803b000.i2c: transaction timed out
    bcm-iproc-2c 1803b000.i2c: bus is busy
    bcm-iproc-2c 1803b000.i2c: bus is busy
    bcm-iproc-2c 1803b000.i2c: bus is busy
    bcm-iproc-2c 1803b000.i2c: bus is busy
    bcm-iproc-2c 1803b000.i2c: bus is busy
    ...

where the bus never recovers after a timeout.

[1] https://github.com/opencomputeproject/onie/blob/master/patches/kernel/3.2.69/driver-iproc-smbus.patch

Fixes: e6e5dd3566 ("i2c: iproc: Add Broadcom iProc I2C Driver")
Signed-off-by: Jonas Gorski <jonas.gorski@bisdn.de>
Cc: <stable@vger.kernel.org> # v4.0+
Acked-by: Ray Jui <ray.jui@broadcom.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260717085507.34209-1-jonas.gorski@bisdn.de
2026-07-28 22:44:48 +02:00
Praveen Talari
1275cbed80
i2c: qcom-geni: distinguish address-phase and data-phase NACK
The M_GP_IRQ_1 interrupt signals a NACK condition, but does not
distinguish whether it occurred during the address phase or the data
phase.  The driver always attempted cancel and DMA FSM reset on any
NACK, which is incorrect for an address NACK since the DMA engine was
never armed and the hardware requires no recovery.

Add geni_i2c_check_addr_data_nack() to distinguish the two cases by
reading SE_GENI_M_GP_LENGTH after the NACK event.  A zero value means
the address phase was NACKed (ADDR_NACK) and no DMA recovery is needed.
A non-zero value on a write transfer means a data byte was NACKed
(DATA_NACK) and the normal cancel and DMA FSM reset path must run.

Co-developed-by: Naresh Maramaina <naresh.maramaina@oss.qualcomm.com>
Signed-off-by: Naresh Maramaina <naresh.maramaina@oss.qualcomm.com>
Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
Reviewed-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260716-fix_cancel_sequence_on_failure_for_i2c-v3-3-9091315a33a0@oss.qualcomm.com
2026-07-28 17:39:10 +02:00
Praveen Talari
b64f1a0709
i2c: qcom-geni: use dedicated completions for abort and reset events
The driver uses a common completion event for transfer, abort and DMA
reset operations.  This allows unrelated completion events to
prematurely wake abort and reset waiters, leading to incorrect
synchronization.

Introduce dedicated completions for abort, TX reset, and RX reset
operations, and signal them only from their respective interrupt
events.  This removes the dependency on shared completion state and
eliminates the abort_done flag-based synchronization.

Co-developed-by: Naresh Maramaina <naresh.maramaina@oss.qualcomm.com>
Signed-off-by: Naresh Maramaina <naresh.maramaina@oss.qualcomm.com>
Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
Reviewed-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260716-fix_cancel_sequence_on_failure_for_i2c-v3-2-9091315a33a0@oss.qualcomm.com
2026-07-28 17:39:01 +02:00
Praveen Talari
3275b99ecb
i2c: qcom-geni: use cancel command before abort on transfer timeout
The GENI I2C driver currently invokes geni_se_abort_m_cmd() directly when
a transfer times out. However, the GENI hardware command cancellation
flow requires a cancel command to be issued first. An abort should only
be used as a fallback when the cancel operation itself fails to complete.

Introduce a dedicated cancel_done completion that is signaled when
M_CMD_CANCEL_EN is received. The timeout recovery path waits for cancel
completion and escalates to geni_i2c_abort_xfer() only if the cancel
command does not complete within the expected time.

Co-developed-by: Naresh Maramaina <naresh.maramaina@oss.qualcomm.com>
Signed-off-by: Naresh Maramaina <naresh.maramaina@oss.qualcomm.com>
Signed-off-by: Praveen Talari <praveen.talari@oss.qualcomm.com>
Reviewed-by: Mukesh Kumar Savaliya <mukesh.savaliya@oss.qualcomm.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260716-fix_cancel_sequence_on_failure_for_i2c-v3-1-9091315a33a0@oss.qualcomm.com
2026-07-28 17:38:40 +02:00
Carlos Song
00d86dd5c2
i2c: imx: mark I2C adapter when hardware is powered down
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: 358025ac09 ("i2c: imx: make controller available until system suspend_noirq() and from resume_noirq()")
Signed-off-by: Carlos Song <carlos.song@nxp.com>
Cc: <stable@vger.kernel.org> # v6.14+
Reviewed-by: Frank Li <Frank.Li@nxp.com>
Acked-by: Oleksij Rempel <o.rempel@pengutronix.de>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260525030400.3182911-1-carlos.song@oss.nxp.com
2026-07-28 17:33:07 +02:00
Mukesh Kumar Savaliya
5272a6ab6b
i2c: qcom-geni: Use devm_pm_runtime_enable() for PM management
The current implementation manually calls pm_runtime_enable() in probe()
and pm_runtime_disable() in remove() and error paths. This pattern is
error-prone and requires careful cleanup in all failure paths. Using the
devres-managed variant eliminates this complexity.

Migrate from manual pm_runtime_enable()/pm_runtime_disable() calls to
the devres-managed devm_pm_runtime_enable() API. This simplifies the
driver by automatically handling runtime PM cleanup when the device is
removed or probe fails. This helps  with Simplified error handling and
Automatic cleanup.

Signed-off-by: Mukesh Kumar Savaliya <mukesh.savaliya@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/20260714051512.3732551-1-mukesh.savaliya@oss.qualcomm.com
2026-07-28 10:44:38 +02:00
Hardik Prakash
0a4bb2abc3
i2c: designware: defer probe if child GpioInt controllers are not bound
I2C controllers may have child devices with GpioInt resources that
depend on GPIO controllers being fully initialized. If the I2C
controller probes and enumerates children before the referenced GPIO
controller has completed probe, GPIO interrupts may not be properly
configured, leading to device failures.

On Lenovo Yoga 7 14AGP11, the WACF2200 touchscreen (child of
AMDI0010:02) has a GpioInt resource pointing to GPIO 157 on the
pinctrl-amd controller (AMDI0030:00). When i2c-designware probes
AMDI0010:02 before pinctrl-amd finishes initializing, I2C transactions
fail with lost arbitration errors:

  0.285952  amd_gpio_probe: registering gpiochip  <- GPIO chip visible
  0.287121  amd_gpio_probe: requesting parent IRQ <- probe still running
  0.301454  AMDI0010:02 dw_i2c_plat_probe: start  <- races here
  2.348157  lost arbitration

Add a dependency check that walks ACPI child devices and defers probe
until any referenced GPIO controller is bound.

Fixes: 3812a9e842 ("pinctrl-amd: enable IRQ for WACF2200 touchscreen on Lenovo Yoga 7 14AGP11")
Closes: https://bugzilla.kernel.org/show_bug.cgi?id=221494
Suggested-by: Mario Limonciello <mario.limonciello@amd.com>
Suggested-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Hardik Prakash <hardikprakash.official@gmail.com>
Assisted-by: Claude:claude-sonnet-5
Assisted-by: DeepSeek:deepseek-v4-pro
Cc: <stable@vger.kernel.org> # v7.1+
Acked-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260718054330.8975-2-hardikprakash.official@gmail.com
2026-07-28 10:24:35 +02:00
H. Nikolaus Schaller
d99607c888
i2c: jz4780: Cache host clock rate at probe to prevent CCF prepare_lock deadlock
Fix a severe AB/BA deadlock between the Common Clock Framework (CCF)
and the I2C adapter lock, which triggers when an I2C-controlled clock
generator client (like the Si5351) is registered or modified under the CCF.

During an i2c client clock (generator) frequency change, the CCF acquires its global
'prepare_lock' mutex and the driver calls i2c_transfer() to update the client's
chip registers, stalling for the adapter's I2C bus lock.

Concurrently, an independent, parallel transfer on the same bus (e.g., a GPIO
expander handling LEDs) can hold the I2C adapter lock. Inside this parallel
transfer path, jz4780_i2c_set_speed() calls clk_get_rate() on the host
controller's input clock to calculate bus timings. This call attempts to acquire
the blocked CCF 'prepare_lock', creating a circular dependency that freezes
the system.

The jz4780 host controller clock itself is static and never changes at runtime.

However, calling clk_get_rate() inside the active transfer path introduces
an unnecessary dependency on the CCF internal locks.

Eliminate this synchronous clk_get_rate() call from the active transfer
path by caching the static host peripheral clock rate once - inside the private
jz4780_i2c structure during jz4780_i2c_probe(). Update jz4780_i2c_set_speed()
to use this cached value, safely decoupling active I2C transactions from the
CCF internal locks without any risk of stale timings.

Assisted-by web based Google AI (pinpointing the bug and writing the message).

Fixes: ba92222ed6 ("i2c: jz4780: Add i2c bus controller driver for Ingenic JZ4780")
Signed-off-by: H. Nikolaus Schaller <hns@goldelico.com>
Cc: <stable@vger.kernel.org> # v4.1+
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/2db6fd233aceb7238474e4833f4d25ca681c3ffb.1784492382.git.hns@goldelico.com
2026-07-27 22:56:08 +02:00
Myeonghun Pak
8204879524
i2c: amd-mp2: Unregister callback on adapter add failure
amd_mp2_register_cb() stores the platform I2C context in the MP2 PCI
driver's callback table before the adapter is registered. If
i2c_add_adapter() fails, probe returns and devres frees the context,
but the PCI driver can still dereference the stale pointer from its IRQ
and system-sleep callbacks.

Unregister the callback before returning the adapter registration error.

Fixes: 529766e0a0 ("i2c: Add drivers for the AMD PCIe MP2 I2C controller")
Co-developed-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Ijae Kim <ae878000@gmail.com>
Signed-off-by: Myeonghun Pak <mhun512@gmail.com>
Cc: <stable@vger.kernel.org> # v5.2+
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260721144147.31150-1-mhun512@gmail.com
2026-07-27 22:52:34 +02:00
Linmao Li
cdac670237
i2c: spacemit: request IRQ after controller initialization
spacemit_i2c_probe() requests the IRQ before it enables the clocks, resets
the controller and runs init_completion(). If an interrupt is already
pending, the handler runs too early: it reads registers while the clocks
are still off and calls complete() on an uninitialized completion. Request
the IRQ after the controller and completion are initialized, but still
before the adapter is registered.

Fixes: 5ea558473f ("i2c: spacemit: add support for SpacemiT K1 SoC")
Signed-off-by: Linmao Li <lilinmao@kylinos.cn>
Cc: <stable@vger.kernel.org> # v6.15+
Reviewed-by: Troy Mitchell <troy.mitchell@linux.spacemit.com>
Reviewed-by: Alex Elder <elder@riscstar.com>
Signed-off-by: Andi Shyti <andi.shyti@kernel.org>
Link: https://lore.kernel.org/r/20260723021140.2293844-1-lilinmao@kylinos.cn
2026-07-27 22:52:34 +02:00
Rafael J. Wysocki
b0572550d8 Merge back ACPI video bus driver changes for 7.3
Merge the introduction of acpi_dev_is_video_device() along with some
following driver updates related to it (from Andy Shevchenko).

* acpi-video:
  platform/x86: thinkpad_acpi: Convert to use acpi_dev_is_video_device() helper
  PCI/VGA: Convert to use acpi_dev_is_video_device() helper
  i2c: acpi: Convert to use acpi_dev_is_video_device() helper
  ACPI: video: Convert to use acpi_dev_is_video_device() helper
  ACPI: scan: Convert to use acpi_dev_is_video_device() helper
  ACPI: utils: Introduce acpi_dev_is_video_device() helper
2026-07-22 13:18:31 +02:00
Andy Shevchenko
4bff98d343 i2c: acpi: Convert to use acpi_dev_is_video_device() helper
Replace open coded variant of acpi_dev_is_video_device() helper.

Acked-by: Wolfram Sang <wsa@kernel.org>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Link: https://patch.msgid.link/20260714185915.865396-5-andriy.shevchenko@linux.intel.com
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
2026-07-21 15:37:50 +02:00
Roman Vivchar
deb35336b5
i2c: mediatek: fix WRRD for SoCs without auto_restart option
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: b492183652 ("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
2026-07-15 00:21:51 +02:00
Xuanqiang Luo
71356737a7
i2c: mlxbf: Fix use-after-free in mlxbf_i2c_init_resource()
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: b5b5b32081 ("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
2026-07-14 23:50:12 +02:00
Pei Xiao
9db20d23aa
i2c: spacemit: fix spurious IRQ handling returning IRQ_HANDLED
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: 5ea558473f ("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
2026-07-14 17:38:13 +02:00
Vincent Jardin
07fd9385f0
i2c: imx: fix locked bus on SMBus block-read of 0 (IRQ)
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: 5f5c2d4579 ("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
2026-07-14 16:40:20 +02:00
Vincent Jardin
cb2fc37857
i2c: imx: fix locked bus on SMBus block-read of 0 (atomic)
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: 8e8782c715 ("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-14 16:39:39 +02:00
Bartosz Golaszewski
34934e7cd1 i2c: pxa-pci: use platform_device_set_of_node()
Ahead of reworking the reference counting logic for platform devices,
encapsulate the assignment of the OF node for dynamically allocated
platform devices with the provided helper.

Acked-by: Andi Shyti <andi.shyti@kernel.org>
Acked-by: Wolfram Sang <wsa+renesas@sang-engineering.com> # for I2C
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@oss.qualcomm.com>
Link: https://patch.msgid.link/20260706-pdev-fwnode-ref-v3-8-1ff028e33779@oss.qualcomm.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2026-07-10 16:07:09 +02:00