JianyuWang0623 opened a new pull request, #18622:
URL: https://github.com/apache/nuttx/pull/18622

   ## Summary
   
   Fix I2S RX DMA path on ESP32-S3 and add ES7210 4-channel ADC codec driver 
with board support for lckfb-szpi-esp32s3.
   
   This PR contains three commits:
   
   1. **esp_i2s: fix I2S RX DMA path for ESP32-S3** — Fix multiple bugs in the 
I2S RX receive path with GDMA, including streaming flag, interrupt re-enable 
after DMA load, TDM slot config preservation, RX channel count, DMA 
direction/peripheral ID, mono mode API, PCM slot config, and auto-stop when no 
pending buffers remain.
   
   2. **audio: add ES7210 4-ch ADC codec driver** — New audio lower-half driver 
for the ES7210 quad-channel ADC codec. Supports configurable sample rate, bit 
depth, and mic gain via I2C control + I2S data transport. Uses LPWORK for async 
buffer management. Key details: normal I2S mode (not TDM), PGA power-on bit in 
gain registers, 50ms startup delay for clock stabilization, and AUDIOIOC_STOP 
notification to I2S layer on stop.
   
   3. **boards/lckfb-szpi-esp32s3: add ES7210 board support** — Board-level 
integration including defconfig, board init, bringup wiring, header defines, 
and documentation. On this board, I2S0 is wired to dedicated codec chips 
(ES7210 ADC + ES8311 DAC), so generic `audio_i2s` device registration is 
skipped for I2S0 — each codec registers its own audio device directly.
   
   ## Impact
   
   - **I2S RX users on ESP32-S3**: The I2S RX DMA fixes are required for any RX 
recording use case on ESP32-S3 with GDMA. Without these fixes, RX recording 
hangs due to race conditions and misconfigured DMA parameters.
   - **New driver**: `CONFIG_AUDIO_ES7210` adds the ES7210 codec driver under 
`drivers/audio/`. No impact on existing drivers.
   - **Board config**: New `lckfb-szpi-esp32s3:es7210` defconfig. Existing 
board configs are not affected. The bringup.c change only affects I2S0 
initialization when `CONFIG_AUDIO_ES7210` is enabled.
   - **Documentation**: Added ES7210 recording section to lckfb-szpi-esp32s3 
board docs.
   
   ## Testing
   
   Host: Ubuntu Linux x86_64
   Board: LCKFB SZPI ESP32-S3 (N16R8) with on-board ES7210 (4-ch ADC) + ES8311 
(DAC)
   Toolchain: ESP32-S3 xtensa-esp32s3-elf-gcc
   
   Build and flash:
   ```
   ./tools/configure.sh lckfb-szpi-esp32s3:es7210
   make -j8
   make flash ESPTOOL_PORT=/dev/ttyUSB0
   ```
   
   Recording test with nxrecorder (48kHz / 16-bit / 2ch):
   ```
   nsh> nxrecorder
   nxrecorder> recordraw /tmp/test.pcm 2 16 48000
   nxrecorder> stop
   ```
   
   Pull recorded file from device via ADB and convert to WAV:
   ```
   adb pull /tmp/test.pcm .
   sox -r 48000 -c 2 -b 16 -e signed-integer -t raw test.pcm test.wav
   ```
   
   Verified:
   - Recording starts without hang (previously froze due to I2S RX DMA bugs)
   - `nxrecorder stop` completes cleanly without deadlock
   - Recorded PCM data is valid audio (played back on host as WAV)
   - Multiple start/stop cycles work without resource leaks
   - Checkpatch passes on all 3 commits


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to