Repository navigation
i2c: pasemi: Reset a controller that stays stuck in a transaction - #825
Merged
erykwieliczko merged 3 commits intoNov 4, 2026
Merged
Conversation
This was referenced Nov 2, 2026
The controller's power state in the PMGR can also reset it. The driver uses that reset to recover a controller that stays stuck in a transaction. Signed-off-by: Erik Bourget <[email protected]>
A transfer that a device doesn't complete can leave the controller in its transaction, with XIP set in SMSTA. The CTL reset that follows the failed transfer doesn't end it, and neither does rebinding the driver, so every later transfer on the bus fails with "Bus is still stuck" until the next boot. This was seen on the M4 MacBook Air (J713) after a debugfs read of a TAS2764's regmap had cached the amp's whole register space: the cache sync at the next resume wrote back registers the amp didn't complete, and the stuck controller (SMSTA 0x10850140) took down the bus of all four speaker amps. A transaction left open on purpose gives the same state. Only resetting the controller ends that transaction. When it has a reset: - a bus still busy after the wait at the start of a transfer is reset, and IMASK and CTL are written again as at probe (the reset returns CTL to its reset value) before waiting once more; - an I2C transfer that times out and leaves XIP set gets the same reset and returns -EAGAIN, and the adapter retries it once. The retry sends the whole transfer again, including what may already have reached the device. SMBus transfers have no retry; they recover at the start of the next transfer. Controllers without a reset, such as the PA Semi one, behave as before. Signed-off-by: Erik Bourget <[email protected]> [eryk: rebased onto integration/aurora 21f7ffc, where 8d54cd2 holds a runtime PM reference around each transfer: reset the controller of a timed-out transfer before that reference is dropped, and leave with -EAGAIN through the put; get the reset before the clock is enabled] Signed-off-by: Eryk Wieliczko <[email protected]> Co-Authored-By: Claude Opus 5.5 <[email protected]>
Each I2C controller is reset through its own PMGR power state. The driver resets a controller that stays stuck in a transaction. Signed-off-by: Erik Bourget <[email protected]>
Member
|
Merging with a conflict resolved. This comment is from Claude Opus 5.5, working for Eryk, not from Eryk himself. Rebased onto integration/aurora Changes in
|
erykwieliczko
force-pushed
the
j713/i2c-recovery
branch
from
November 4, 2026 08:42
caa023b to
c5e0897
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
If a device doesn't complete a transfer, the Apple I2C controller can be left stuck in its transaction, with XIP set in SMSTA. Nothing in the driver gets it out. The CTL reset after the failed transfer doesn't, and neither does rebinding the driver, so every later transfer on that bus fails with "Bus is still stuck" until the next boot. This resets the controller through its PMGR power state, which does end the transaction.
How it showed up
On the M4 MacBook Air (J713), reading a TAS2764's full regmap
registersfile in debugfs caches the amp's whole register space: 63,606 registers, where the driver normally caches about 110. At the next suspend-to-idle resume, the cache sync writes all of them back. The amp didn't complete the0xb3-0x313block, and the controller of the speaker amps' bus stayed stuck atSMSTA 0x10850140. That silenced all four amps until a reboot. Normal use doesn't trigger it, but the dead bus is the real problem. A transaction left open on purpose produces the same stuck state.The change
dt-bindings:
apple,i2callowsresets.i2c: pasemi: an optional reset in
struct pasemi_smbus. When a controller has one:-EAGAIN, and the adapter retries the transfer once. The retry resends the whole transfer, including anything that may already have reached the device. SMBus transfers get no retry; they recover at the start of the next transfer.Controllers without a reset, such as the PA Semi one, behave exactly as before.
arm64: dts: apple: t8132:
resets = <&ps_i2cN>on all five controllers.The reset leaves the controller's other configuration registers (
0x2c,0x30,0x38) as they were, so only IMASK and CTL need writing again.Relation to #807
This complements #807, which adds suspend/resume handling to the same driver. #807 restores CTL and IMASK after the controller's power domain was off. This PR handles a controller that is stuck mid-transaction, which a CTL write can't end: on the J713, rewriting CTL and rebinding the driver both left it stuck. Each covers a case the other doesn't. The two branches merge cleanly in either order.
Testing (J713)
On integration/aurora 41c4055 with the J713 audio series, plus a test-only module parameter that leaves a transaction open:
Timeout, status 0x10850140)Bus is still stuck (status 0x10850140 xfstatus 0x20000000)0x90fto its reset value0x1104, and the first transfer after the CTL write works.Checks:
checkpatch --strictis clean;dt_binding_checkis clean forapple,i2c.yaml;CHECK_DTBSW=1 on all six T8132 DTBs gives the same output as the base.Not tested: other Apple SoCs; this only adds
resetsto T8132. The PA Semi PCI driver isn't affected: without a reset, the new paths don't run.