Repository navigation
Conversation
|
This looks like an upstream file unmodified by this repo. As such, the fix belongs upstream. |
|
Hardware result with this patch, as a module built against |
The datasheet's power-up sequence powers the converters, sets the other registers and activates the digital audio interface last. The driver has ACTIVE as a supply widget, which DAPM powers ahead of the ADC, DAC and line input, and gives each converter a widget of its own, so a capture starting next to a running playback powers the ADC up under an active interface. With the codec as clock provider at 96 kHz from a 12 MHz crystal (USB mode), as on the AudioInjector stereo card for the Raspberry Pi, about one capture start in five then leaves the ADC delivering its DC offset and noise at their usual levels but no signal, until the interface is deactivated and activated again. Both orders reproduce it on a running codec over I2C: the driver's start order (interface active, then ADC and line input powered up) went deaf in 1 of 8 trials, and powering the ADC and line input down and up under an active interface in 2 of 8. Activating the interface with the converters already powered stayed healthy in 42 of 42, and rewriting SRATE or IFACE with their values under an active interface in 12 of 12. Power the ADC, DAC and line input from one supply, with the interface inactive, set ACTIVE from a DAPM post widget once a stream's widgets are up, and clear it before the converters go down. A second stream then finds the converters powered and leaves the interface as it is. A second stream's hw_params also rewrote the sample rate and format registers of an interface already active for the other direction. One rate and word length serve both directions: keep matching settings as they are and refuse others with -EBUSY while the interface is active. Tested on a Raspberry Pi 4 with that card, 6.18.60 (Raspberry Pi kernel, where the driver is the same): with this patch, 30 of 30 full-duplex stream starts had the test signal in the capture, against about one in five deaf without it. Built with W=1 on mainline. The analysis, the I2C reproducers, the patch and this changelog were written with Claude Code (Claude Opus 5.5) from the reported fault and the kernel sources, and the tool ran the hardware tests on the submitter's test setup at the submitter's direction. Fixes: 8a27bd9 ("ASoC: Manage WM8731 ACTIVE bit as a supply widget") Link: raspberrypi#7776 Assisted-by: Claude:claude-opus-5-5 Signed-off-by: Rafael Diniz <rafael@riseup.net>
2e100f9 to
7f90d54
Compare
Fixes #7776.
On a WM8731 card with the codec as clock provider (
audioinjector-wm8731-audio: 12 MHz crystal, 96 kHz, USB mode), about one start in five of a playback and capture pair leaves the capture without signal. The ADC keeps delivering its DC offset and noise, and stays like that until the interface is deactivated and activated again. Tests on a running codec over I2C point to the ADC being powered up while the interface is active (details and figures are in the issue). That happens with the driver's DAPM layout:ACTIVEis a supply widget, set before the converters on every stream start;The patch:
ACTIVEfrom a DAPM post widget once a stream's widgets are up, and clears it before the converters go down. A second stream then finds the converters powered and leaves the interface alone;hw_params, keeps an active interface's rate and word length when they match and refuses others with-EBUSY, instead of rewritingSRATEandIFACEunder the running direction.The ADC and DAC are now powered whenever either direction runs, which costs a few mW while a stream is open.
Testing:
6.18.60+rpt-rpi-v8, and with W=1 on mainline; checkpatch is clean (apart from not knowing theFixes:commit in a shallow clone);SRATE/IFACErewritten under an active interface;The commit carries
Fixes: 8a27bd9a3318(the change that made ACTIVE a supply widget). Mainline has the same widget layout andhw_params; the same patch is going to the ASoC list, and I'll link the thread here.The analysis, the reproducers, the patch and its changelog were written with Claude Code (Claude Opus 5.5), which also ran the hardware tests at my direction; see the changelog.
🤖 Generated with Claude Code