[Letux-kernel] McBSP1 woes

Andreas Kemnade andreas at kemnade.info
Fri Aug 3 07:37:08 CEST 2018


I tried to get McBSP1 + FM working but did not succeed.
I compared with my working setup on GTA04A4 + Kernel 3.7
Things I checked:

setting MCBSP1_FSR there makes sampling work, at least arecord produces data at
the right rate.
But it is not set on 3.7 and works there also

On 3.7:
# devmem2 0x48002198 h
/dev/mem opened.
Memory mapped at address 0xb6f1a000.
Value at address 0x48002198 (0xb6f1a198): 0x108
root at gta04:~# devmem2 0x48002194 w
/dev/mem opened.
Memory mapped at address 0xb6f6e000.
Value at address 0x48002194 (0xb6f6e194): 0x118011C
root at gta04:~# devmem2 0x48002190 w
/dev/mem opened.
Memory mapped at address 0xb6fbc000.
Value at address 0x48002190 (0xb6fbc190): 0x1100008

does not match the values configured in 4.17, but configuring the values the
same as for 3.7 does not solve the problem on its own.

Comparing McBSP1 registers when arecord is running:
$ wdiff mcbsp1-dtb mcbsp1-working 
0x00: [-0x00000000-] {+0x0000feb7+}
--> sampling data, should be random but not zero

0x04: 0x00000000
0x08: 0x00000000
0x0c: 0x00000000
0x10: 0x000002f0
0x14: 0x00000031
0x18: 0x00008041
0x1c: 0x00000040
0x20: 0x00008041
0x24: 0x00000040
0x28: [-0x000017cf-] {+0x00001035+}
-> MCBSPLP_SRGR2_REG FPER = 0x7cf vs 0x35

0x2c: [-0x0000e700-] {+0x00001a24+}
    FWID = 0xe7 vs 0x1a
    CLKGDV = 0x00 vs 0x24

0x30: 0x00000000
0x34: 0x00000000
0x38: 0x00000000
0x3c: 0x00000000
0x40: 0x00000000
0x44: 0x00000000
0x48: 0x00000f0f
0x4c: 0x00000000
0x50: 0x00000000
0x54: 0x00000000
0x58: 0x00000000
0x5c: 0x00000000
0x60: 0x00000000
0x64: 0x00000000
0x68: 0x00000000
0x6c: 0x00000000
0x70: 0x00000000
0x74: 0x00000000
0x78: 0x00000000
0x7c: 0x00000013
0x80: 0x00000000
0x84: 0x00000000
0x88: 0x00000000
0x8c: 0x00000014
0x90: 0x00000000
0x94: 0x00000001
0x98: 0x00000000
0x9c: 0x00000000
0xa0: 0x0000010e
0xa4: [-0x000018b1-] {+0x00000081+}
-> some more interrupts set, probably not harmful

At least I need to have a dtb entry resembling the following:
#define IN_FREQUENCY (96000000)
#define CLOCK_DIVISOR (IN_FREQUENCY / 2594000)  /* 37 */

        ret = snd_soc_dai_set_clkdiv(cpu_dai, OMAP_MCBSP_CLKGDV,

As far as I understand such a thing does not exist in the simple sound card dtb,
so this cannot be fixed by extending the dtb files.
$ grep -R snd_soc_dai_set_clkdiv *
fsl/wm1133-ev1.c:	snd_soc_dai_set_clkdiv(codec_dai, WM8350_BCLK_CLKDIV,
fsl/wm1133-ev1.c:	snd_soc_dai_set_clkdiv(codec_dai,
fsl/wm1133-ev1.c:	snd_soc_dai_set_clkdiv(codec_dai,
fsl/wm1133-ev1.c:	snd_soc_dai_set_clkdiv(codec_dai,
fsl/wm1133-ev1.c:	snd_soc_dai_set_clkdiv(codec_dai,
omap/omap3pandora.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, OMAP_MCBSP_CLKGDV, 8);
omap/gta04-fm.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, OMAP_MCBSP_CLKGDV, CLOCK_DIVISOR);
pxa/magician.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai,
pxa/magician.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai,
pxa/raumfeld.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, PXA_SSP_DIV_SCR, 4);
pxa/raumfeld.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, PXA_SSP_DIV_SCR, 4);
pxa/zylonite.c:		ret = snd_soc_dai_set_clkdiv(codec_dai, WM9713_PCMCLK_PLL_DIV,
pxa/zylonite.c:		ret = snd_soc_dai_set_clkdiv(codec_dai, WM9713_PCMCLK_DIV,
samsung/jive_wm8750.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C2412_DIV_RCLK, div.fs_div);
samsung/jive_wm8750.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C2412_DIV_PRESCALER,
samsung/rx1950_uda1380.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK,
samsung/rx1950_uda1380.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_BCLK,
samsung/rx1950_uda1380.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER,
samsung/smdk_wm8994pcm.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C_PCM_SCLK_PER_FS, rfs);
samsung/s3c24xx_uda134x.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK, fs_mode);
samsung/s3c24xx_uda134x.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_BCLK,
samsung/s3c24xx_uda134x.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER,
samsung/s3c24xx_simtec.c:		ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER,
samsung/neo1973_wm8753.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK,
samsung/neo1973_wm8753.c:	ret = snd_soc_dai_set_clkdiv(codec_dai, WM8753_BCLKDIV, bclk);
samsung/neo1973_wm8753.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER,
samsung/neo1973_wm8753.c:	ret = snd_soc_dai_set_clkdiv(codec_dai, WM8753_PCMDIV, pcmdiv);
samsung/smdk_wm8580.c:	ret = snd_soc_dai_set_clkdiv(codec_dai, WM8580_MCLK,
samsung/h1940_uda1380.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_MCLK,
samsung/h1940_uda1380.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_BCLK,
samsung/h1940_uda1380.c:	ret = snd_soc_dai_set_clkdiv(cpu_dai, S3C24XX_DIV_PRESCALER,
sh/migor.c:	ret = snd_soc_dai_set_clkdiv(codec_dai, WM8978_OPCLKRATE, rate * 512);
soc-core.c: * snd_soc_dai_set_clkdiv - configure DAI clock dividers.
soc-core.c:int snd_soc_dai_set_clkdiv(struct snd_soc_dai *dai,
Binary file soc-core.o matches

no calls from simple-card context.

If that is set, we will probably also get the right frame size (FWID) and period (FPER),
so the Si472X will be happy.

So probably we should try to extend the simple sound card?
Or use gta04-fm.c again

-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 833 bytes
Desc: OpenPGP digital signature
URL: <http://lists.goldelico.com/pipermail/letux-kernel/attachments/20180803/b98ed8b3/attachment.asc>

More information about the Letux-kernel mailing list