linux/sound
Sugar Zhang efc8faa7b3 ASoC: rockchip: i2s-tdm; Fix frame sync duty cycle
There maybe a risk that FRAME sync is not 50% duty cycle
on TRCM mode, which will cause sound noise.

This patch wraps XFER-start with reset to fix this issue.

- Hold reset
- Enable XFER
- Release reset

e.g. RK3308

Enable TRCM:

  &i2s_8ch_0 {
      assigned-clocks = <&cru SCLK_I2S0_8CH_RX>;
      assigned-clock-parents = <&cru SCLK_I2S0_8CH_TX_MUX>;
      rockchip,clk-trcm = <1>;
  }

StressTest:

  /#!/bin/sh

  count=0

  while true
  do
      yes `echo -en "\x11\x11\x22\x22"` | tr -d '\n' | \
      aplay -D hw:1,0 --period-size=1024 --buffer-size=4096 -r 192000 -c 2 -f s16_le &>/dev/null &
      sleep 2
      rxd=`io -4 0xff300028 | awk '{print $2}'`
      echo "[$count]: $rxd"
      if [ "$rxd" != "22221111" ]; then
          echo "FAIL: mismatch: $rxd, expected: 22221111"
          break
      fi
      count=$((count + 1))
      killall aplay
      sleep 1
  done

Result:

Before:

[35]: 22221111
[36]: 22221111
[37]: 11110888
FAIL: mismatch: 11110888, expected: 22221111

[253]: 22221111
[254]: 22221111
[255]: 11110888
FAIL: mismatch: 11110888, expected: 22221111

[319]: 22221111
[320]: 22221111
[321]: 11110888
FAIL: mismatch: 11110888, expected: 22221111

After this patch:

PASS on 100000+ loop count.

[ 99998]: 22221111
[ 99999]: 22221111
[100000]: 22221111
[100001]: 22221111
...

Change-Id: I77931c529acb43ef0bf7468e2c74ac9ff419218e
Signed-off-by: Sugar Zhang <sugar.zhang@rock-chips.com>
2022-07-25 20:35:40 +08:00
..
ac97 ALSA: ac97: fix PM reference leak in ac97_bus_remove() 2021-07-20 16:05:40 +02:00
aoa rk: revert to v4.19 2021-03-17 18:05:39 +08:00
arm amba: Make the remove callback return void 2022-04-08 14:40:02 +02:00
atmel
core Merge tag 'ASB-2022-06-05_12-5.10' of https://android.googlesource.com/kernel/common 2022-07-15 17:58:38 +08:00
drivers Merge tag 'ASB-2022-04-05_12-5.10' of https://android.googlesource.com/kernel/common 2022-07-15 17:40:39 +08:00
firewire ALSA: firewire-lib: fix uninitialized flag for AV/C deferred transaction 2022-04-08 14:40:09 +02:00
hda ALSA: intel-dsp-config: add quirk for CML devices based on ES8336 codec 2021-12-08 09:03:25 +01:00
i2c rk: revert to v4.19 2021-03-17 18:05:39 +08:00
isa ALSA: cs4236: fix an incorrect NULL check on list iterator 2022-04-08 14:39:53 +02:00
mips
oss
parisc
pci ALSA: hda/realtek: Add alc256-samsung-headphone fixup 2022-04-08 14:40:36 +02:00
pcmcia
ppc ALSA: ppc: fix error return code in snd_pmac_probe() 2021-07-20 16:05:43 +02:00
sh rk: revert to v4.19 2021-03-17 18:05:39 +08:00
soc ASoC: rockchip: i2s-tdm; Fix frame sync duty cycle 2022-07-25 20:35:40 +08:00
sparc rk: revert to v4.19 2021-03-17 18:05:39 +08:00
spi ALSA: spi: Add check for clk_enable() 2022-04-08 14:40:08 +02:00
synth ALSA: synth: missing check for possible NULL after the call to kstrdup 2021-11-18 14:03:40 +01:00
usb Merge tag 'ASB-2022-06-05_12-5.10' of https://android.googlesource.com/kernel/common 2022-07-15 17:58:38 +08:00
x86 ALSA: intel_hdmi: Fix reference to PCM buffer address 2022-03-08 19:09:31 +01:00
xen
ac97_bus.c
Kconfig
last.c
Makefile
sound_core.c rk: revert to v4.19 2021-03-17 18:05:39 +08:00