Skip to content

ASoC: tas2764: J604 amplifier init writes through the built-in quirks - #2615

Open
IronsideXXVI wants to merge 2 commits into
aurora-silicon:mainfrom
IronsideXXVI:j604-tas2764-quirks
Open

IronsideXXVI wants to merge 2 commits into
aurora-silicon:mainfrom
IronsideXXVI:j604-tas2764-quirks

Conversation

@IronsideXXVI

@IronsideXXVI IronsideXXVI commented Nov 20, 2026 •

Copy link
Copy Markdown

The J604 (MacBook Pro 14" M4, T8132) has six SN012776 amplifiers, and macOS 26B123 initialises each of them with writes this driver does not make (traced at boot on the J604 from the hypervisor, see #2595). This is the quirks version asked for in #2595: the change goes through the driver's built-in Apple quirks, with no binding or DT change.

Two commits on integration/aurora df62a8c:

  1. ASoC: tas2764: set the DVC ramp rate as macOS does; name MISC_CFG2 and TG_EN. This is the four earlier commits folded into one. Its tree is the same as the old head a12eae7 (git diff a12eae78 2be0b034 is empty), so no commit in the branch ever turns off thermal threshold 1 or makes immediate SDZ the default.
    • Names MISC_CFG2 (page 0 0x07) and its fields from the data sheet (SLOS998A, 8.9.11, reset 0x20): SDZ_MODE 7:6, SDZ_TIMEOUT 5:4, DVC_RAMP_RATE 3:2.
    • Adds TAS2764_DVC_RAMP_INIT (BIT(8)), enabled for every SN012776 (ENABLED_APPLE_QUIRKS 0x3f -> 0x13f). It sets only DVC_RAMP_RATE to 10b (the volume ramps 0.5 dB per 8 samples instead of per sample) with regmap_update_bits(). SDZ_MODE stays at its reset value unless the shutdown dance is on; with the dance on, the register ends at macOS's 0x68.
    • Names TG_EN (page 1 0x47, SLOS998A 8.9.113, reset 0xab) and its two threshold enables. TAS2764_THERMAL_TH1_DISABLE now writes it by name, but it stays out of the defaults, so threshold 1 stays enabled on every SN012776.
  2. ASoC: tas2764: use TAS2764_TG_EN in the writeable list; drop a done TODO. These are the two review nits. The object code does not change (see below).

Left out on purpose:

  • Immediate SDZ by default: it has only run on the J604 without the dance's page 0xfd writes.
  • Turning off thermal threshold 1: the data sheet doesn't say what threshold 1 is or what crossing it does, and one J604 trace isn't enough to change it on every SN012776.
  • The page 1 0x19 = 0x40 write: its effect is unknown. The J604 A/B with and without it (register readback during playback, level and THD+N of a 1 kHz tone through the built-in mics at a fixed volume, amp temperature and fault latches over a 60 s tone) is still to come and will be posted here, since ASoC: tas2764: J604 amplifier init writes as macOS does them #2595 is closed in favour of this PR.

Hardware: not tested on this head yet. Still to come from the J604, and I'll post it here:

  • MISC_CFG2 read back after init and again after a suspend and resume.
  • Playback with stream stop and start, with the fault latches INT_LTCH0..4 read after each.
  • The usual regression line: SELinux denials, failed units and new kernel error lines, all expected at 0.

A row from a second SN012776 Mac would be welcome from anyone who has one.

Checked on this head:

  • git diff a12eae78 2be0b034: empty (the fold keeps the tree byte for byte).
  • checkpatch --strict: clean on both commits.
  • sound/soc/codecs/tas2764.o built with LLVM and W=1 on each commit, with no warnings. With debug info stripped, the two objects are byte-identical, and .text, .rodata and .data are the same, so the nits commit is no functional change.
  • CI here is the real check for the rest.

Assisted-by: LLM (Claude:Opus 5.5, Claude:Fable 5.2)

@RyanTheTide

Copy link
Copy Markdown

Thanks for the quirks version. Two concerns before this becomes the default for every SN012776:

  • tas2764-quirks.h:10: adding TAS2764_THERMAL_TH1_DISABLE to ENABLED_APPLE_QUIRKS switches off thermal threshold 1 on every SN012776 the driver binds, which is about 26 board files (M1 Pro/Max through M5), on the strength of one J604 trace. The original quirks commit (f33b01e) enabled "all of them to be safe" and still left bit 6 out, so this reverses a deliberate choice. Could the commit say what threshold 1 gates? If it feeds the over-temperature latch in INT_LTCH0, the SDZ group fail-closed path (tas2764.c:114-145) would see that fault later or not at all. If the effect can't be named from the datasheet, it needs a measurement that exercises it: a sustained stream at the protected level on one amp with speaker protection running, TAS2764_TEMP and INT_LTCH0..4 read back, with and without this bit. Playback and sense rows alone don't exercise a thermal threshold. Until then I'd keep bit 6 out of the default mask.
  • tas2764-quirks.h (TAS2764_SDZ_MODE_INIT): please name bit 3 of page 0 0x07, or say it is undocumented. This also makes immediate SDZ shutdown the default without the 0xfd pre/post writes that the shutdown-dance comment says it is meant to run under, and only the J604 has run that. A stream stop/start loop on another Mac, with the fault latches read afterwards, would cover the over-current-on-stop case.
  • Both commits are missing a Signed-off-by: line.

Leaving page 1 0x19 out until the A/B is in sounds right.

Assisted-by: LLM (Claude:Opus 5.5)

@IronsideXXVI

Copy link
Copy Markdown
Author

Thanks Ryan. Agreed, bit 6 stays out of ENABLED_APPLE_QUIRKS until I can either say what threshold 1 gates or show it with a measurement: a sustained stream at the protected level with speaker protection on, logging TAS2764_TEMP and INT_LTCH0..4 with and without bit 6. I'll also name page 0 0x07 bit 3 or say plainly that it's undocumented, and answer the SDZ point with the next push.

@IronsideXXVI

Copy link
Copy Markdown
Author

@RyanTheTide pushed two commits on top (head 1b127df):

  • bea4b8c takes TAS2764_THERMAL_TH1_DISABLE back out of ENABLED_APPLE_QUIRKS (0x17f -> 0x13f), as f33b01e had it. The TAS2764 data sheet (SLOS998A, 8.9.113) calls page 1 0x47 TG_EN, reset 0xab: bit 0 enables thermal threshold 1, bit 1 thermal threshold 2. So the quirk's 0x02 keeps threshold 2 only. The data sheet doesn't say which temperature threshold 1 is or what the amp does when it's crossed, so that isn't an explanation yet. The register is now written by name (TAS2764_TG_EN, TAS2764_TG_EN_TH2), and bit 6 only comes back with the TAS2764_TEMP / INT_LTCH0..4 measurement.
  • 1b127df names page 0 0x07. It's MISC_CFG2 (8.9.11, reset 0x20): SDZ_MODE in bits 7:6, SDZ_TIMEOUT in 5:4, DVC_RAMP_RATE in 3:2. Bit 3 is the high bit of the ramp rate, so macOS's 0x68 is immediate SDZ, the 6 ms timeout (the reset value), and DVC_RAMP_RATE=10b, which ramps the digital volume 0.5 dB per 8 samples instead of per sample. The dance's 0x60 is the same thing without the ramp rate.

On the SDZ point: I have no other Mac to run the stop/start loop on, so I took immediate SDZ out of the default. The init quirk is now TAS2764_DVC_RAMP_INIT and only updates the ramp rate field. SDZ_MODE stays at its reset value unless the shutdown dance is on, and with the dance on the register ends at 0x68, the same as macOS. If you'd rather keep the ramp rate out of the default too until a trace from another Mac shows the same write, I'll drop it.

These are the TAS2764's names. I'm assuming the SN012776 follows them, as the driver already does for the other registers.

The J604 rows (bit 6 with the temperature and latches logged, and a stream stop/start loop with the latches read) will come here with the 0x19 A/B.

The missing Signed-off-by: lines are mine to add, and I'll add them myself before this is ready.

Checkpatch --strict is clean on both, a W=1 build of sound/soc/codecs has no warnings, and the host tests and DT checks give the same results as on the base.

@RyanTheTide

Copy link
Copy Markdown

Checked 1b127df. Both points are addressed. ENABLED_APPLE_QUIRKS is 0x13f, so threshold 1 stays enabled. 0x07 is now named from the data sheet (MISC_CFG2: SDZ_MODE, SDZ_TIMEOUT, DVC_RAMP_RATE), and the default writes only the ramp-rate field through regmap_update_bits(), so immediate SDZ stays with the shutdown dance. A ramp of 0.5 dB per 8 samples is still about 3,000 dB/s at 48 kHz, so a volume cut lands within a few ms.

Still open: none of the four commits carries a Signed-off-by: line.

Assisted-by: LLM (Claude:Opus 5.5)

@IronsideXXVI

Copy link
Copy Markdown
Author

Force-pushed d96df02: the same four commits with my Signed-off-by added. No code change (same tree as 1b127df), so the review of the last two commits still applies.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pre-PR checklist review at a12eae78a916 (CI: host-tests passing).

The final tree at a12eae78a916 looks solid: ENABLED_APPLE_QUIRKS is 0x13f (leaving TAS2764_THERMAL_TH1_DISABLE and TAS2764_SHUTDOWN_DANCE off by default), TAS2764_MISC_CFG2 and TAS2764_TG_EN fields are properly named from the datasheet, and tas2764_apply_init_quirks() updates only DVC_RAMP_RATE via regmap_update_bits() (verified against tas2764_i2c_regmap cache/resume sync). Commit attribution (§4) is clean: all commits carry human author/committer and Signed-off-by: only, and the PR body carries Assisted-by:.

Blockers:

  1. §3 Safety / bisectability — unsafe intermediate commits in branch history: integration/aurora merges PRs with merge commits rather than squashing, so commits 1 and 2 (8cdfd6dee8 and 1c1039d186) would enter mainline history with TAS2764_THERMAL_TH1_DISABLE enabled (0x3f -> 0x7f) and immediate SDZ enabled without the shutdown dance (0x68, 0x17f) across all ~26 SN012776 boards before commits 3 and 4 (897c89adf1, a12eae78a9) revert both. A git bisect landing on commits 1–2 would disable thermal threshold 1 on speaker amps. Please fold/squash the branch into clean commit(s) that never introduce those intermediate states.
  2. Stale PR description: The PR body still describes the old 2-commit series (0x3f -> 0x7f enabling TAS2764_THERMAL_TH1_DISABLE, and TAS2764_SDZ_MODE_INIT / 0x17f), contradicting the live head (0x13f, TAS2764_DVC_RAMP_INIT).

Still needed (§5 Evidence):

  • No hardware test row on a12eae78a916 yet. Because ENABLED_APPLE_QUIRKS applies to every SN012776 Mac (~26 boards), please post a J604 run on the squashed head (and request a row on a second SN012776 Mac): MISC_CFG2 readback after init/resume, playback + stream stop/start fault-latch check (INT_LTCH0..4), and the §5 regression line (0 SELinux denials, 0 failed units, 0 new kernel errors).

Minor nits (non-blocking):

  • sound/soc/codecs/tas2764-quirks.h:174 still lists DVC ramp rate under Other setup TODOs.
  • sound/soc/codecs/tas2764.c:1483 can use the new TAS2764_TG_EN macro instead of raw TAS2764_REG(0x1, 0x47).

Assisted-by: LLM (Gemini 4 Neon)

RyanTheTide
RyanTheTide previously approved these changes Nov 22, 2026

@RyanTheTide RyanTheTide left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Checked a12eae7: same tree as 1b127df, the head reviewed last, and all four commits now carry your Signed-off-by, which was the only open item. Approving: threshold 1 stays enabled (0x13f), and the MISC_CFG2 default only touches the ramp-rate field, so no protection setting moves. No speaker playback was needed for this check; the init is register-level.

Assisted-by: LLM (Claude:Opus 5.5)

…d TG_EN

macOS 26B123 writes 0x68 to page 0 register 0x07 when it initialises
each SN012776 on the J604 (traced at boot from the hypervisor). That
register is MISC_CFG2 in the TAS2764 data sheet (SLOS998A, 8.9.11, reset
0x20): SDZ_MODE in bits 7:6, SDZ_TIMEOUT in bits 5:4, DVC_RAMP_RATE in
bits 3:2. 0x68 is immediate SDZ, the 6 ms timeout (the reset value) and
DVC_RAMP_RATE=10b, which ramps the digital volume by 0.5 dB per 8
samples instead of per sample. The shutdown dance's 0x60 is the same
value without the ramp rate.

Immediate SDZ without the dance's page 0xfd writes around shutdown has
only run on the J604, so it does not become the default for every
SN012776. Add TAS2764_DVC_RAMP_INIT, enabled for every SN012776, which
updates only the ramp rate field. SDZ_MODE stays at its reset value
unless the shutdown dance is enabled; with the dance enabled the
register ends at 0x68, as macOS leaves it.

macOS also writes 0x02 to page 1 register 0x47 at init. That register is
TG_EN (SLOS998A, 8.9.113, reset 0xab): bit 0 enables thermal threshold
1, bit 1 thermal threshold 2, so 0x02 leaves threshold 2 only. The data
sheet does not say which temperature threshold 1 is or what the
amplifier does when it is crossed, and one J604 boot trace is not enough
to turn it off on every SN012776. TAS2764_THERMAL_TH1_DISABLE therefore
stays out of ENABLED_APPLE_QUIRKS; name the register and its two enable
bits, and have that quirk write the register by name.

Name the MISC_CFG2 fields too, and have the shutdown dance write its
0x60 by field.

Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
The writeable-register list still spells TG_EN as TAS2764_REG(0x1,
0x47), and the "Other setup TODOs" list still names the DVC ramp rate,
which TAS2764_DVC_RAMP_INIT now sets. Use the name, and drop the TODO
along with its now empty list. The object code does not change.

Signed-off-by: Dylan Ironside <dylan@dylanironside.io>
@IronsideXXVI

Copy link
Copy Markdown
Author

@DjDeveloperr thanks. Pushed 200b94a, two commits:

  1. Bisectability. The four commits are folded into one, 2be0b03. Its tree is the same as the old head a12eae7 (git diff a12eae78 2be0b034 is empty), so no commit in the branch enables TAS2764_THERMAL_TH1_DISABLE or makes immediate SDZ the default any more.
  2. Stale description. Rewritten for the live head: 0x13f, TAS2764_DVC_RAMP_INIT, and what is left out and why.
  3. Nits. Both are in a second commit, 200b94a. The "DVC ramp rate" TODO is gone, along with its list, which was then empty, and the writeable list uses TAS2764_TG_EN. I built tas2764.o with LLVM and W=1 on both commits. With debug info stripped the objects are byte-identical, so the commit changes no code.
  4. Hardware row. Not done yet, and still owed: on the J604 on this head, MISC_CFG2 read back after init and after a resume, playback with stream stop and start and INT_LTCH0..4 read after each, and the regression line. I'll post it here. I don't have a second SN012776 Mac, so a row from anyone who does would be welcome.

@RyanTheTide your approval was on a12eae7. The first commit is that same tree, and the second commit is only the two nits.

@DjDeveloperr DjDeveloperr left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Formal §1–§6 re-review at verified live head 200b94a76e6ff3c35bf8a9b9c25bfb94424ac093 (live integration/aurora 70a00e583b03, not superseded; CI: host-tests green).

Resolved since a12eae78a916

  • §3 Safety / bisectability: Pass — the earlier 4 commits are folded into 2be0b03498cf, so no commit in the branch ever enables TAS2764_THERMAL_TH1_DISABLE or immediate SDZ by default (ENABLED_APPLE_QUIRKS is 0x13f throughout).
  • PR description & nits: Pass — PR body accurately reflects the live head, 200b94a76e6f uses TAS2764_TG_EN in tas2764_writeable_register(), and removes the completed DVC ramp-rate TODO.
  • §1, §2, §4, §6: Pass — no model gating, regmap_update_bits() updates only TAS2764_MISC_CFG2_DVC_RAMP_RATE in tas2764_apply_init_quirks() (covered across probe and SDZ-reset resume), both commits carry human author/committer + human Signed-off-by: only, PR body carries Assisted-by:, and naming/CI are clean.

Remaining Blocker (§5 Evidence)

  1. No hardware verification on live head 200b94a76e6f: Because ENABLED_APPLE_QUIRKS (0x3f -> 0x13f) runs on every SN012776 Mac (~26 board files), please post the pending J604 test row on this head before approval:
    • MISC_CFG2 (0x07) readback after init and after suspend/resume confirming DVC_RAMP_RATE = 10b and preserved SDZ_MODE/SDZ_TIMEOUT.
    • Playback with stream stop/start loop and INT_LTCH0..4 fault-latch readback after each.
    • Full §5 regression line: 0 SELinux denials, 0 failed units, 0 new kernel error lines (plus a row on a second SN012776 Mac if available).

Assisted-by: LLM (Gemini 4 Neon)

@IronsideXXVI

Copy link
Copy Markdown
Author

@DjDeveloperr thanks. There's no code change here either, since the hardware row is the open item. It's queued on the J604 with tas2764.c, tas2764.h and tas2764-quirks.h taken whole from 200b94a:

  • MISC_CFG2 (0x07) read back after init and again after a suspend/resume: DVC_RAMP_RATE = 10b, with SDZ_MODE and SDZ_TIMEOUT at their reset values, so 0x28 expected.
  • Playback with a stream stop/start loop, reading INT_LTCH0..4 after each.
  • 0 failed units and 0 new kernel errors. SELinux is N/A here (Arch).

I don't have a second SN012776 Mac, so that row will need someone who does. The J604 results will go here.

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.

3 participants