Skip to content

spmi: apple: deliver follower interrupts on generation 4 controllers - #2466

Closed
sithglan wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
sithglan:thomas/spmi-gen4-irq
Closed

sithglan wants to merge 1 commit into
aurora-silicon:integration/aurorafrom
sithglan:thomas/spmi-gen4-irq

Conversation

@sithglan

Copy link
Copy Markdown
Contributor

The generation 4 Apple SPMI controllers (T8142, T8152) refused an interrupt line: Generation 4 interrupt layout is not supported. So the followers' interrupts couldn't be used, and the USB-C PD controllers behind them (ACE3, tipd's apple,sn201202x) are polled on the J813 today.

Generation 4 keeps one bit per interrupt source as generation 1 does, at other offsets: the enables at 0x400 and the pending sources (write 1 to clear) at 0x600. 0x600 is where the driver already acknowledges the generation 4 fault interrupt. This takes both offsets from the match data and accepts the interrupt line on generation 4. Command replies stay polled on generation 4: source 256 isn't enabled for them.

How the layout was found, from outside: with nothing enabling interrupts, the J873g's 0x600 bitmap holds the PD controllers' sources latched (11/13/19, 37/39/45, 63/71, and 256), and 0x400–0x5ff read 0. With enables written at 0x400, the sources are delivered.

Test (J873g, test kernel = #2178's stack + this + a DT describing the PD controllers' event, sleep and wake sources and the controller's AIC line 682):

Not changed: generation 1 offsets. A generation 4 controller without an interrupt in its DT behaves exactly as before.

Not tested: the J813. Its DT doesn't describe its PD controllers' interrupts yet; that follows with the board DT.

This is the step that makes the single PD owner on #2178 interrupt-driven.

The generation 4 controllers (T8142, T8152) refused an interrupt line
("Generation 4 interrupt layout is not supported"), so their followers'
interrupts could not be used and the USB-C PD controllers behind them
were polled.

Generation 4 keeps one bit per interrupt source as generation 1 does,
only at other offsets: the enables at 0x400 and the pending sources,
write 1 to clear, at 0x600 (where the fault interrupt is acknowledged
already). Take both offsets from the match data and accept the
interrupt line on generation 4. Its command replies stay polled: source
256 is not enabled for them.

On the J873g (T8152), with the PD controllers' event, sleep and wake
sources described (11/17/19, 37/43/45 and 63/69/71, as in the ADT) and
the controller's line (AIC 682), the sources arrive and are acknowledged:
the controller whose DisplayPort partner raised IRQ_HPD delivered its
event interrupts, and all three displays stayed up. Generation 1
controllers keep their offsets, and generation 4 controllers without an
interrupt in the device tree are unchanged.

Signed-off-by: Thomas Glanzmann <thomas@glanzmann.de>
@RyanTheTide

Copy link
Copy Markdown
Contributor

Thanks, Thomas, and thanks for the J873g run: seeing the PD controllers' event sources arrive (63 firing on IRQ_HPD) is the evidence this layout needed.

This is the same change as #1743 (Joshua): match-data mask/ack offsets at 0x400/0x600, num_irqs for gen 4, the -EOPNOTSUPP removed, source 256 left masked. Two PRs for one mechanism will conflict, so we'd like to land it once, in #1743. It already has three things this one doesn't:

What #1743 is missing is your hardware run. Could you repeat it on #1743's head: tipd binding the three controllers with IRQs, 63 firing on a DP hotplug, then rtcwake -m freeze -s 20 three times with a hotplug after each wake still delivering interrupts and no fault lines? That would be the T8152 row for #1743, and this PR could then be closed in its favour.

@sithglan

Copy link
Copy Markdown
Contributor Author

Closed in favour of #1743, which is the same mechanism and also drains the fault queue before the shared ack, writes 8 mask words and restores the enables on resume. The J873g row for #1743's head is posted there. #2486 is now stacked on #1743.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants