SAMA5D27 custom board I2S1 problem

Discussion around products based on ARM Cortex-A5 core.

Moderator: nferre

oohay0000
Posts: 12
Joined: Fri Mar 20, 2009 10:56 pm

SAMA5D27 custom board I2S1 problem

Sun May 05, 2019 2:15 pm

I have a custom board that has WM8904 connected to I2S1. I have the following code in device tree,

i2s1: i2s@fc04c000 {
pinctrl-names = "default";
pinctrl-0 = <&pinctrl_i2s1_default>;
status = "okay";
};

pinctrl_i2s1_default: i2s1_default {
pinmux = <PIN_PA15__I2SC1_CK>,
<PIN_PA14__I2SC1_MCK>,
<PIN_PA16__I2SC1_WS>,
<PIN_PA17__I2SC1_DI0>,
<PIN_PA18__I2SC1_DO0>;
bias-disable;
};

But I'm getting the following error messages when booting the kernel,

atmel_i2s fc04c000.i2s: failed to get the I2S clock control: -2
atmel_i2s fc04c000.i2s: hw version: 0x101
ssc: ssc-19 platform device is missing
Unable to parent ASoC SSC DAI on SSC: -19
atmel-wm8904-audio sound: failed to set SSC -19 for audio

Do I need to enable the SSC1 also in order to have I2S1 working?
oohay0000
Posts: 12
Joined: Fri Mar 20, 2009 10:56 pm

Re: SAMA5D27 custom board I2S1 problem

Tue May 07, 2019 9:43 pm

Forgot to mention the kernel source is the latest from https://github.com/linux4sam/linux-at91

Adding dump_stack() to the kernel code was able to trace the device node the driver was looking for was actually a ssc device, not a i2s device. With the sound node changed to the following the WM8904 driver was able to register,

sound {
compatible = "atmel,asoc-wm8904";
/* pinctrl-names = "default";
pinctrl-0 = <&pinctrl_pck2_as_audio_mck>;
*/

atmel,model = "wm8904 @ MTP-5200";
atmel,audio-routing =
"Headphone Jack", "HPOUTL",
"Headphone Jack", "HPOUTR",
"IN2L", "Line In Jack",
"IN2R", "Line In Jack",
"Mic", "MICBIAS",
"IN1L", "Mic";
atmel,ssc-controller = <&ssc1>;
atmel,audio-codec = <&wm8904>;
};

However the driver will fail when trying to play an audio file. The stack dump is as the following,

nable to handle kernel NULL pointer dereference at virtual address 00000004
pgd = c5224000
[00000004] *pgd=c0c1404000000000, *pte=00000000, *ppte=00000000
Internal error: Oops: 17 [#1] ARM
Modules linked in:
CPU: 0 PID: 213 Comm: madplay Not tainted 4.14.88-01445-g234c56a-dirty #5
Hardware name: Atmel SAMA5
task: c48389c0 task.stack: c4a00000
PC is at atmel_ssc_prepare+0x48/0x60
LR is at soc_pcm_prepare+0x110/0x21c
pc : [<c05b7854>] lr : [<c05aebcc>] psr: 60000013
sp : c4a01de0 ip : c4a01df0 fp : c4a01dec
r10: c47c9d80 r9 : c47d280c r8 : c47c9b00
r7 : 00000000 r6 : c47ca200 r5 : 00000001 r4 : c47d2800
r3 : d0874000 r2 : 00000000 r1 : ffffffed r0 : 00000000
Flags: nZCv IRQs on FIQs on Mode SVC_32 ISA ARM Segment none
Control: 10c53c7d Table: 25224059 DAC: 00000051
Process madplay (pid: 213, stack limit = 0xc4a00208)
Stack: (0xc4a01de0 to 0xc4a02000)
1de0: c4a01e1c c4a01df0 c05aebcc c05b7818 c05aeabc c47ca200 c47ca200 00020002
1e00: 00000000 c5166680 c4a00000 000000d5 c4a01e34 c4a01e20 c0595d18 c05aeac8
1e20: c0595cf4 c085e578 c4a01e54 c4a01e38 c05957b0 c0595d00 c47ca200 00020002
1e40: c085e578 c4eccd80 c4a01e74 c4a01e58 c0595938 c0595774 00000001 c47ca200
1e60: 00020002 00004140 c4a01e8c c4a01e78 c0596590 c05958e0 c47ca200 00000000
1e80: c4a01ed4 c4a01e90 c0598a58 c0596540 c4eccd80 00000000 c4eccd80 00000000
1ea0: 00000010 c4a9f4e0 00000000 beff0000 c47e5cc0 c4eccd80 000000d5 00004140
1ec0: 00000005 00000036 c4a01f7c c4a01ed8 c0214ccc c059826c c01e6f8c c01e66ac
1ee0: 00000000 c4a01f44 10c53c7d 00000001 c47e5cc0 000000fb c4a01f04 c4a01f44
1f00: c4c121f8 00000003 00010000 00000000 c4a00000 c01d01a4 c4a01f74 c4a01f28
1f20: c01d01a4 c0149580 00000001 00000000 00000000 c4a01f4c c4a01f44 c021f6bc
1f40: 00000001 c4a01f44 c4a01f44 00000000 00000001 c4eccd80 c4eccd80 000000d5
1f60: 00004140 00000005 c4a00000 00000036 c4a01fa4 c4a01f80 c0215534 c0214c3c
1f80: b6e0968c 0002f938 0002e4ec 00000000 00000036 c0108008 00000000 c4a01fa8
1fa0: c0107dc0 c02154f8 0002f938 0002e4ec 00000005 00004140 000000d5 b6e0968c
1fc0: 0002f938 0002e4ec 00000000 00000036 0002fad8 0002e520 0002e514 be96b864
1fe0: b6e8e520 be96b534 b6e096a0 b6c25f9c 60000010 00000005 00000000 00000000
[<c05b7854>] (atmel_ssc_prepare) from [<c05aebcc>] (soc_pcm_prepare+0x110/0x21c)
[<c05aebcc>] (soc_pcm_prepare) from [<c0595d18>] (snd_pcm_do_prepare+0x24/0x3c)
[<c0595d18>] (snd_pcm_do_prepare) from [<c05957b0>] (snd_pcm_action_single+0x48/0x88)
[<c05957b0>] (snd_pcm_action_single) from [<c0595938>] (snd_pcm_action_nonatomic+0x64/0x70)
[<c0595938>] (snd_pcm_action_nonatomic) from [<c0596590>] (snd_pcm_prepare+0x5c/0x88)
[<c0596590>] (snd_pcm_prepare) from [<c0598a58>] (snd_pcm_ioctl+0x7f8/0x1158)
[<c0598a58>] (snd_pcm_ioctl) from [<c0214ccc>] (do_vfs_ioctl+0x9c/0x8bc)
[<c0214ccc>] (do_vfs_ioctl) from [<c0215534>] (SyS_ioctl+0x48/0x64)
[<c0215534>] (SyS_ioctl) from [<c0107dc0>] (ret_fast_syscall+0x0/0x54)
Code: e7932102 e5933004 e5922010 e593300c (e5921004)
---[ end trace 7e0f2b38c0c75728 ]---

Looks like the i2s never worked, doesn't matter it's i2s1 or i2s0.
blue_z
Location: USA
Posts: 1986
Joined: Thu Apr 19, 2007 10:15 pm

Re: SAMA5D27 custom board I2S1 problem

Thu May 09, 2019 2:37 am

oohay0000 wrote: I have a custom board that has WM8904 connected to I2S1. I have the following code in device tree,
oohay0000 wrote: With the sound node changed to the following the WM8904 driver was able to register,

You need to learn how to use the 'code' tag so that indentation is preserved.
Your snippets of DT nodes have no context. There's absolutely no indication of the parent nodes.

Seems like you have been reading some of the DT binding documentation.
But you have some omissions (from your post if not also your DT) that are questionable.

There's a reference to ssc1. Where and what is that node? Is that an accurate description of the connections on your board?
Have you resolved the pin conflicts of using i2s1 (i.e. spi0, sdmmc1)?

Have you reviewed the boot log for warning and/or error messages?

oohay0000 wrote: Looks like the i2s never worked, doesn't matter it's i2s1 or i2s0.
Huh? What are the actual hardware connections?

Regards
oohay0000
Posts: 12
Joined: Fri Mar 20, 2009 10:56 pm

Re: SAMA5D27 custom board I2S1 problem

Mon May 13, 2019 3:16 pm

Sorry about the indentation and any missing device tree node info.

The ssc1 node was added to the device tree as the following,

Code: Select all

                        ssc1: ssc@fc004000 {
                                compatible = "atmel,at91sam9g45-ssc";
                                reg = <0xfc004000 0x4000>;
                                interrupts = <44 IRQ_TYPE_LEVEL_HIGH 4>;
                                dmas = <&dma0
                                        (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
                                        AT91_XDMAC_DT_PERID(23))>,
                                       <&dma0
                                        (AT91_XDMAC_DT_MEM_IF(0) | AT91_XDMAC_DT_PER_IF(1) |
                                        AT91_XDMAC_DT_PERID(24))>;
                                dma-names = "tx", "rx";
                                clocks = <&ssc1_clk>;
                                clock-names = "pclk";
                                status = "okay";
                        };
 
The WM8904 is connected to PA14 ~ PA18. The MMC1 is disabled in the device tree. There wasn't any warning or error messages regarding the WM8904 device initialization.

Have anyone ever tried to use either I2S on the SAMA5D27?
thackerp
Posts: 12
Joined: Tue Jul 19, 2016 10:19 pm

Re: SAMA5D27 custom board I2S1 problem

Tue May 14, 2019 12:19 am

oohay0000
Posts: 12
Joined: Fri Mar 20, 2009 10:56 pm

Re: SAMA5D27 custom board I2S1 problem

Tue May 14, 2019 3:17 pm

Thank you very much for the info.

Going through mikroe-proto.c and atmel_wm8904.c source file it appears to me that I need to spin my own version of I2S driver with the WM8904 audio codec chip. I had assumed the WM8904 driver can be plugged together with the SOC I2S driver. Unfortunately that is not the case, The current atmel_wm8904.c only expect a SSC.

Return to “SAMA5D Cortex-A5 MPU”

Who is online

Users browsing this forum: No registered users and 3 guests