Repository navigation
iPad 6 and 7: headphone jack (CS42L83 on MCA4) - #131
Open
jerricky26 wants to merge 1 commit into
Open
jerricky26 wants to merge 1 commit into
jerricky26 wants to merge 1 commit into
Conversation
Describe the CS42L83 headphone codec and its MCA4 I2S link as a second link of the shared iPad 6/7 card (devices/t8010/0022), with a T8010 I2S variant of the MCA driver (drivers/sound/0010, 0011) and a jack type for the CS42L42-family driver so simple-audio-card creates the codec's jack (drivers/sound/0012), and expose MCA4's SmartIO transmit endpoint 0x30 as a T8010 DMA channel (drivers/soc-apple/0014). Enable CONFIG_SND_SOC_CS42L83 as a module. The UCM gains a Headphones device on PCM 1 with the codec's jack and mixer volume, at a higher priority than the speakers. Tested on J171: without the SmartIO endpoint the MCA4 DMA request fails with -ENODEV and the whole card fails to probe. Two more pieces get SCLK to the codec (drivers/sound/0015, 0016, devices/t8010/0023): MCA4 only drives SCLK while TX is enabled, so the I2S variant enables TX with the frame at prepare and keeps both until hw_free, after the codec has left SCLK; and the codec sits on AOP pads, so MCA4 also programs the AOP i2s-switch route the ADT lists (function-i2s_route_aop 'mca1' to 'pin0', output enable 0xf). On J171 the PLL now locks within a millisecond at prepare and the codec runs from SCLK for the whole stream, also across an XRUN. Assisted-by: LLM
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.
This adds the headphone jack to the shared iPad 6 and 7 card: a CS42L83 on i2c0, fed by MCA4 in I2S. Rebased onto main
71502a0(Release 0.3.0).Changes
kernel/patches/devices/t8010/0022: sharedt8010-ipad6.dtsi, and MCA4 int8010.dtsi. The codec is at i2c0 0x48, reset on AP GPIO 25, jack IRQ on AP GPIO 71. A second dai-link ini2suses MCA4 as clock provider, and the codec is an aux-dev so simple-audio-card creates its jack. The speaker link stays dai-link 0 / PCM 0; the headphones are PCM 1.cirrus,ts-inv = 1, as on Apple's other CS42L83 boards. The ADT's AOP MCLK (AOP GPIO 36) is left unused; the codec runs its PLL from SCLK.devices/t8010/0023: the AOP i2s-switch and pad output-enable syscons, andapple,aop-i2s-routeon MCA4. The CS42L83 sits on AOP pads 32-35. The words come from the ADT (function-i2s_route_aopmca1topin0, oe0xf) and were checked live on J171:0x00010101,0x00080818,0xf. Without this route the PLL does not lock, because SCLK never reaches the codec.drivers/sound/0010,0011: T8010 I2S variant of the MCA driver (apple,t8010-mca-i2s) and its bindings.drivers/soc-apple/0014: expose MCA4's SmartIO TX endpoint0x30as a DMA channel. Without it, MCA4's DMA request fails with-ENODEVand the whole card fails to probe.drivers/sound/0012: CS42L42-family jack type, so simple-audio-card creates the codec's jack.drivers/sound/0013,0015: MCA4 only drives SCLK while TX is enabled, so the I2S variant starts the frame and TX at prepare and keeps both untilhw_free, after the codec has left SCLK. These flags are only ont8010_i2s_mca_hw; the speaker TDM path is unchanged.drivers/sound/0014: CS42L42 stays on the oscillator if the PLL does not lock.drivers/sound/0016: MCA can program anapple,aop-i2s-route. It is a no-op on links that lack the property.CONFIG_SND_SOC_CS42L83=m(andCONFIG_SND_SOC_CS42L42_CORE=m).UCM
Orchard/ipad6/HiFi.conf: a Headphones device on PCM 1, jack controlcs42l83.0-0048-jack Jack, Jack Mixer Volume 43, PlaybackPriority 200, wrapped inIf.headphones/ControlExistsso a kernel without the link still gets the speakers only.devices/j171/device.tomlis alreadyaudio_output = "working"from the speakers work.audio_inputstays"missing". This PR does not change the catalog.ADT evidence
I compared the IPSW ADTs of J71b, J72b, J171 and J172. Everything this uses matches (only phandle numbers differ):
/arm-io/i2c0/audio-codec, address 0x48ps_mca4mca1topin0,aop_i2s_oe_reg_val0xfThe AOP route words were also read back from a running J171: MCA1 node
0x00010101, pin0 node0x00080818, output enable0xf.Hardware test (one J171)
I tested this series on official Omarchy A 0.3.0, with a side-by-side boot entry for a kernel built from this branch (a local
CONFIG_LOCALVERSION=-hpwas used only to keep the stock 0.3.0 kernel as a fallback; it is not in this PR).dsp_a, S16_LE). PCM 1 is the headphone I2S link (i2s, S32_LE, 2ch, 48 kHz). The CS42L83 probes as "Cirrus Logic CS42L83, Revision: B0".SW_HEADPHONE_INSERT, the ALSA jack control, and the UCM Headphones port). Unplugging clears it.cirrus,ts-inv = 1is consistent with this plug on J171.alsa_output.platform-sound.HiFi__Headphones__sinkwas heard in the headphones. The DAPM playback path (SDIN, MIXER, DAC, HP, ASP DAI0, SCLK) was On, and there was noPLL failed to lockin dmesg. After unplug, a 440 Hz tone was heard on the built-in speakers; PCM 0 andSD_MODEwere live. The T8010 I2S clock flags did not break the speaker TDM path.61-omarchy-a-ipad7-speakers.confmatchesalsa.card_name = "J171 Speakers"and forces S16LE/4ch on the whole card, so PipeWire could not open PCM 1 (spa.alsa: hw:Speakers,1p: no format found ... formats:S32_LE). A live override that matches only the Speaker node, plus S32LE/2ch on the headphones node, created the sink. WirePlumber also ranks PCM 0 above PCM 1 by device number, so the default stayed on the speakers until a headphonespriority.sessionof 1100. I'll send those as an omarchy-a follow-up, following the placement from J171: enable the speakers (J71b's TDM link) #100. Official new-sink volume is very low, and the UCM mixer value of 43 is about -20 dB, so a quiet test tone can be inaudible even when the path is running.Untested: J71b, J72b, and J172; headphone capture / the headset mic; Bluetooth audio at the same time as the jack. A user-saved default (a Bluetooth sink) still wins while it is connected.
Checks
71502a0(Release 0.3.0) with no conflicts.