nuttx/arch
wangjianyu3 c100e9a9e8 esp_i2s: use actual channel count for BCLK calculation
The I2S BCLK frequency is calculated as:
  bclk = sample_rate * total_slot * data_width

Previously, total_slot was always taken from the static config
(esp_i2s0_config / esp_i2s1_config), which is hardcoded to 2.
This is correct for mono and stereo, but wrong for TDM modes
with more than 2 channels (e.g. 4-channel recording with ES7210).

With 4 channels but total_slot=2, the BCLK is only half of what
it should be, causing the actual sample rate to be half of the
requested rate (e.g. requesting 16 kHz actually samples at 8 kHz).

Replace priv->config->total_slot with MAX(priv->channels, 2) in
all three BCLK calculation sites (i2s_check_mclkfrequency and
i2s_set_clock for both master and slave paths). The MIN of 2
preserves the I2S protocol requirement that at least 2 slots
exist even for mono, while correctly scaling for multi-channel
TDM configurations.

Signed-off-by: wangjianyu3 <wangjianyu3@xiaomi.com>
2026-04-03 13:34:36 +08:00
..
arm arm/ht32f491x3: rework PWM lower-half like nrf53 2026-04-02 12:11:13 +02:00
arm64 build/cmake/stdlib: guard include/cxx by LIBMINIABI, fix div_t conflict 2026-03-29 16:45:29 -03:00
avr style: Fix "the the" typo across the codebase. 2026-03-23 11:07:49 +01:00
ceva arch\ceva: Fix Make style 2026-03-23 18:16:46 -04:00
dummy
hc Makefile: Remove make depend files by make distclean 2026-02-16 16:27:57 +01:00
mips arch\mips: Fix Make style 2026-03-23 18:16:46 -04:00
misoc Makefile: Remove make depend files by make distclean 2026-02-16 16:27:57 +01:00
or1k Makefile: Remove make depend files by make distclean 2026-02-16 16:27:57 +01:00
renesas style: Fix "the the" typo across the codebase. 2026-03-23 11:07:49 +01:00
risc-v arch/espressif: add flash encryption support on CMake 2026-04-02 13:16:54 +08:00
sim style: Fix "the the" typo across the codebase. 2026-03-23 11:07:49 +01:00
sparc style: Fix "the the" typo across the codebase. 2026-03-23 11:07:49 +01:00
tricore build/cmake/stdlib: guard include/cxx by LIBMINIABI, fix div_t conflict 2026-03-29 16:45:29 -03:00
x86 Makefile: Remove make depend files by make distclean 2026-02-16 16:27:57 +01:00
x86_64 arch/intel64: add CPU affinity support for irq 2026-03-31 21:10:51 +08:00
xtensa esp_i2s: use actual channel count for BCLK calculation 2026-04-03 13:34:36 +08:00
z16 style: Fix "the the" typo across the codebase. 2026-03-23 11:07:49 +01:00
z80 style: Fix "is is" typo across the codebase. 2026-03-24 09:39:26 +08:00
CMakeLists.txt arch/z80: migrate to SPDX identifier 2024-12-02 17:23:25 +08:00
Kconfig arch/delays: Invalid default value for BOARD_LOOPSPERMSEC 2026-02-25 15:00:03 -03:00