Skip to content

usb: typec: tipd: CD321x polish (style, guards, quieter deferrals) - #310

Merged
RyanTheTide merged 7 commits into
aurora-wipfrom
j700/tipd-polish-20261015
Oct 15, 2026
Merged

RyanTheTide merged 7 commits into
aurora-wipfrom
j700/tipd-polish-20261015

Conversation

@RyanTheTide

Copy link
Copy Markdown
Contributor

What and why

A polish pass over the CD321x additions to the TI tipd driver (J700 / T8140 Type-C ports), aimed at upstream style. Six of the seven commits change no behaviour:

  • Tidy the CD321x fields and includes in tps6598x.h.
  • Fix the checkpatch --strict issues in the CD321x update path.
  • Simplify the DisplayPort connector lookup: fwnode_find_reference() never returns NULL.
  • Rename the sleep hooks after their dev_pm_ops callbacks (prepare/complete).
  • Use guard() for the debugfs locks, as core.c already does.
  • Rename the mux error label err_unregister_mux to err_put_mux.

One commit (MED, log level only) changes what reaches the log: Don't warn about deferred CD321x mode changes. -EAGAIN from the ACIO switch or the ATC PHY is a deferral the update work already retries, so it now logs at debug level, as does the routine tunnel revalidation message. Real failures still warn.

Risk

  • LOW for six commits (no functional change).
  • MED for the log-level commit (no control-flow change).

Tests

  • scripts/checkpatch.pl --strict: clean on every commit. The only warning is the Assisted-by trailer format, which is accepted.
  • Each commit builds, and a W=1 build of drivers/usb/typec/tipd/ gives 0 warnings.
  • KUnit cd321x-pm: 22/22.
  • On the Neo, USB-C, dock and charging behaviour was unchanged across all s2idle runs below (lsusb count steady at 13, both power supplies online).

Hardware qualification (MacBook Neo J700, 2026-10-15)

This series was qualified on the Neo inside the 2026-10-15 release stack: aurora-wip ac89582 plus, in merge order, tipd polish, input polish, speaker KUnit, SEP (#303), DCP sleep fixes, platform polish, audio polish, radio polish, power polish and fixes, and storage polish. It used the published 5f config with LLVM=1 and clang 22, and modules installed with INSTALL_MOD_STRIP=1. Each test was a one-shot GRUB boot. The saved default stayed on the public 5f kernel. The DTB came from Stage 2 and was not changed.

Results on the release kernels (7.1.12-aurora-rel-g257ca7bed, then -g3faecd4f7 with audio and radio added), and on the earlier integration kernels that also carried the held USB wake line (-integ-ge78a80fd8, -g07a8a7ff4, -g32b5436bd):

  • Boot reaches running with no failed units.
  • Kernel and journal warnings were diffed against the public 5f baseline (neo-public5f-20261015). No new kernel warning types appeared. These went away as expected: dockchannel "keyboard is not initialized", AOP "Unknown oslog message", and the PMGR "always-on domain ... not on at boot" ×8 (now info).
  • Both displays came back after every cycle: eDP plus DP at 1080p180, the internal panel alive (77–91 flips per 2 s), 0 DCP errors and 0 "Failed to resume". Run as dcp-s2idle-regress.sh 6 30 5, 6/6 cycles per run, 3 runs. The DCP mailbox rate in s2idle was about 3 IRQ/s, down from about 62/s.
  • USB: tools/aurora-wake/s2idle-rtc-regression.sh -c 5 -s 20 passed 5/5 per run. W1 ran 10 RTC cycles with the lsusb count steady at 13, and no "HC died", Host System Error or DART fault.
  • Touch ID: 3 prints after every resume, no "state 9". The T1 storm (20 cancelled verifies) logged 0 EBUSY or "did not register" lines. T4 (suspend during a capture) logged "ending the capture in progress before sleep" with no drain failure.
  • Audio enumerates and speakerguardd is active. Mic capture is non-zero. Local sink volumes were identical before and after; nothing was written to the mixer.
  • The camera streams at 30.01 fps for 10 s, before and after s2idle.
  • NVMe: a 512 MiB direct read at 2.9 GB/s. The storage in-flight check passed 5/5 RTC cycles, with acknowledged data verified by size and content.
  • Power check: E 2424 / P 4044 MHz, die zones 44–47 °C at idle, MCC 4 planes, rtc1 wake.
  • KUnit under qemu arm64 on the release stack: 132 tests in total (apple-drm, apple-dart 13/13, cd321x-pm, dwc3_apple_state, speaker ceiling, Rust core), all passing. The radio, macsmc-hwmon and PMC suites run when the series that adds them is present.

Evidence: /Volumes/AuroraS500/aurora-ctl/artifacts/integ-20261015/ (per-boot dmesg, journal and checks; scripts are in scripts/).

Held / follow-ups

  • The DCP sleep series (a later PR) changes the display-owner comment in core.c from -EBUSY to -ENOSPC, along with its mux error disambiguation.
  • The USB polish branch carries the same seven commits; they drop out when it is rebased.

🤖 Generated with Claude Code

The CD321x support placed the mux handle and its remove flag ahead of
the device pointer in struct tps6598x, and included cd321x-pm.h in the
middle of the header between a register define and the bit fields.

Keep the includes together at the top, document why TPS_REG_MODE lives
in the header, and move the mux handle next to the other port objects.
Describe what remove_safe_prepared actually means instead of the
previous shorthand.

No functional change.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
Fix the issues checkpatch --strict reports in code added for CD321x:
misaligned continuation lines, two lines over 100 columns, an else
branch after a goto, and a double blank line. Reword the comment on the
shared display connector, which used double spaces and repeated itself,
and the comment on the SAFE transaction left open by cd321x_remove().
Move the DRM include below the linux/ ones, where the DisplayPort Alt
Mode driver has it, instead of ahead of them.

No functional change.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
fwnode_find_reference() already fails with -ENOENT when the property is
missing and never returns NULL, so the separate presence check and the
IS_ERR_OR_NULL() test are redundant. Look the reference up directly and
drop the error pointer, as the DisplayPort Alt Mode driver does.

No functional change.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The tipd_data hooks called from tipd_prepare() and tipd_complete() were
named suspend_prepare and resume_reverify. The latter also runs after
an aborted suspend, so "resume" is misleading, and neither name matches
the dev_pm_ops callback it serves. Call them prepare and complete, and
rename the CD321x implementations to match.

No functional change.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The ACIO Thunderbolt switch and the ATC PHY return -EAGAIN while the
PCIe host behind a USB4 port, or the USB host on the other side of the
PHY, is still being set up or torn down. cd321x_update_work() already
treats that as a deferral: it retries without forcing a reconnect. Yet
cd321x_typec_update_mode() logged every such attempt as a warning, so
a dock that comes up a little slowly left "failed to configure Type-C
connection: -11" in the log even though it then worked.

Log -EAGAIN at debug level and keep the warning for real failures. The
revalidation message after a tunnel state change is in the same
category: it is a routine, bounded recovery step, so make it debug too.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
core.c takes tps->lock with guard() and scoped_guard(), but the debugfs
interface added for CD321x open-codes mutex_lock()/mutex_unlock() and
needs a goto label to unlock on the -EBUSY path. Use the same guards
there, which removes the label and the extra return-value juggling.

The critical sections are unchanged: user copies still happen outside
tps->lock except for the read of the saved DATA1 result, as before.

No functional change.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
The err_unregister_mux label in cd321x_register_port() drops the
references to the mux and the DisplayPort connector; nothing is
unregistered there. Call it err_put_mux, like err_put_switch above it.

No functional change.

Assisted-by: LLM
Signed-off-by: Ryan Murray <[email protected]>
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.

1 participant