alsa
Differences
This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| alsa [2026-11-22 21:10 UTC (5 days ago)] – update with speaker enable-disable research, examples, stock alsa config, and reasoning. qkb | alsa [2026-11-22 22:40 UTC (5 days ago)] (current) – remove some useless AI text / verbosity jazzy | ||
|---|---|---|---|
| Line 2: | Line 2: | ||
| The two grille speakers are on the Line-Out of a TI TLV320AIC32x4 codec. The | The two grille speakers are on the Line-Out of a TI TLV320AIC32x4 codec. The | ||
| - | codec is on I2C bus 0 at address | + | codec is on I2C bus 0 at address |
| - | 0, `PM3 Audio`. There is a capture path too (Mic PGA / ADC). | + | 0, '' |
| The Line-Out does not drive the speakers directly. It feeds an external power | The Line-Out does not drive the speakers directly. It feeds an external power | ||
| - | amplifier, | + | amplifier, |
| - | PIC32 over `/ | + | PIC32 over '' |
| - | * PIC32 key `0x07E0` (`ValueWrite`, type `0x04`): `1` = amp on, `0` = amp off. | + | |
| - | * One master gate for both channels. | + | * It reads back with '' |
| - | * It reads back with `ValueRead`, so the state can be queried. | + | * It remains in this state until the PIC32 resets at the next power-off. |
| - | * It latches | + | |
| - | written. | + | |
| - | With the amp off, ALSA, the codec, the mixer, and the clocks can all be perfectly | ||
| - | configured and the speaker is still silent. That is why playback appears | ||
| - | to need nx: nx switches the amp on once at startup through | ||
| - | `NxPaCtrl`/ | ||
| ===== Turning the amp on ===== | ===== Turning the amp on ===== | ||
| - | The stock tool does it with: | + | You can toggle the amp using NxExe: |
| < | < | ||
| Line 28: | Line 22: | ||
| </ | </ | ||
| - | That command toggles the amp. The state persists until the PIC32 loses power, so | + | That command toggles the amplifier. The state persists until the PIC32 loses power, so |
| - | blindly toggling | + | blindly toggling |
| - | first, or set it explicitly. | + | |
| To set the amp explicitly, write the PIC32 frame directly. These are IPP frames | To set the amp explicitly, write the PIC32 frame directly. These are IPP frames | ||
| - | with sequence 1 and no payload CRC, because | + | with sequence 1 and no payload CRC, because |
| < | < | ||
| Line 49: | Line 42: | ||
| </ | </ | ||
| - | The reply to the read is a `0x03` frame with the 2-byte key and the current | + | The reply to the read is a '' |
| value. The examples use sequence 1. If you write a script, increment the sequence | value. The examples use sequence 1. If you write a script, increment the sequence | ||
| byte and recompute the CRC-8 for each frame. | byte and recompute the CRC-8 for each frame. | ||
| Line 55: | Line 48: | ||
| ===== ALSA setup ===== | ===== ALSA setup ===== | ||
| - | `alsa-restore.service` restores | + | '' |
| usually already set. The two details that still cause silence are: | usually already set. The two details that still cause silence are: | ||
| - | 1. Line-Out driver gain must be at the 0 dB baseline: | + | Line-Out driver gain must be at the 0 dB baseline. '' |
| - | < | + | |
| - | | + | |
| - | </ | + | |
| - | | + | |
| - | 2. Play a file, not a pipe. A file plays: | + | < |
| - | < | + | amixer |
| - | aplay / | + | </ |
| - | </ | + | |
| - | | + | |
| - | < | + | |
| - | cat tone.wav | aplay -q - | + | |
| - | | + | |
| - | Volume is the `PCM` control. Use it as a percentage: | + | Playing |
| < | < | ||
| - | amixer -c 0 sset PCM 65% | + | aplay / |
| </ | </ | ||
| - | The old `amixer sset PCM 144` command sets a raw level. Treat it as a high level, | + | Volume is the '' |
| - | not a percentage. | + | |
| + | < | ||
| + | amixer -c 0 sset PCM 65% | ||
| + | </ | ||
| A complete manual sequence: | A complete manual sequence: | ||
| Line 96: | Line 83: | ||
| ===== Why nx seemed to be required ===== | ===== Why nx seemed to be required ===== | ||
| - | nx turns the speaker amp on once at startup and never turns it off. The PIC32 | + | nx turned |
| keeps that state until it loses power. | keeps that state until it loses power. | ||
| - | The codec is not the gate. Its registers, DAPM, GPIO, clocks, AUDMUX, and SSI1 | + | The codec can be configured fine without |
| can all match while the speaker is silent. The amp is a separate PIC32 value on | can all match while the speaker is silent. The amp is a separate PIC32 value on | ||
| - | `ttymxc2`, after the codec. nx does not touch any extra ALSA mixer or codec | + | '' |
| - | control. It writes | + | control. It writes |
| - | Set `0x07E0` to 1 and the speaker works from a cold boot with no nx. It stays on | ||
| - | until the PIC32 resets, so it only needs setting once per power cycle. | ||
| ===== Notes (maybe outdated) ===== | ===== Notes (maybe outdated) ===== | ||
| Line 125: | Line 110: | ||
| > is preinstalled and works for setting the volume. | > is preinstalled and works for setting the volume. | ||
| - | ===== Notes Addendum | + | ===== Addendum ===== |
| The older reports about mixed ALSA results are consistent with the amp latch. | The older reports about mixed ALSA results are consistent with the amp latch. | ||
| - | If nx has run since power-on, the amp is on and `aplay` works even after nx is | + | If nx has run since power-on, the amp is on and '' |
| stopped. That is the " | stopped. That is the " | ||
| - | If the unit is cold-booted with nx never started, | + | If the unit is cold-booted with nx never started, |
| - | `0x07E0` is set to 1. Saving and restoring | + | '' |
| the amp, so it cannot fix that case. | the amp, so it cannot fix that case. | ||
| - | The miniaudio theory was a reasonable guess at the time. nx does not need to stay | + | The miniaudio theory was speculation. nx does not need to stay running for |
| - | running for audio. | + | audio. |
| ===== Stock ALSA state ===== | ===== Stock ALSA state ===== | ||
| - | The stock `/ | + | The stock '' |
| file and restore it at boot: | file and restore it at boot: | ||
| Line 149: | Line 133: | ||
| </ | </ | ||
| - | The important parts are the Line-Out DAC switches, | + | The important parts are the Line-Out DAC switches, |
| - | (0 dB), and `PCM Playback Volume` at 85 (about -21 dB). The rest is the input | + | (0 dB), and '' |
| and AGC configuration. | and AGC configuration. | ||
| Line 657: | Line 641: | ||
| } | } | ||
| </ | </ | ||
| + | |||
alsa.1795381807.txt.gz · Last modified: by qkb
